Creating plugins
Sample plugin
packages/sample-plugin is a minimal plugin to start from. It colors today's day cell by listening to the picker's view event, and shows the parts every plugin has:
getName()returns the name the plugin's options are read from (SamplePlugin: { ... }).onAttach()/onDetach()add and remove event listeners.optionsholds the defaults; the user's options are merged over them.src/interface.tsadds the options to the picker's config type through module augmentation.
It is built, tested and type-checked with the other packages, but not published to npm.
Creating plugin in own repository
Copy packages/sample-plugin into a new repository, then:
- Rename the package and the plugin class.
- Add the
@gothassos/easepick-*packages it imports as dependencies, plus a build setup (the rootrollup.config.jsandtsconfig.jsonare a starting point). - Remove
"private": truefrompackage.jsonto publish it.
Adding plugin in main repository
- Copy
packages/sample-pluginto a new folder inpackages. (Eg.: myawesome-plugin) - Rename the package in
package.jsonand the plugin insrc, and remove"private": trueif it should be published. - Run
npm installso npm links the new workspace intonode_modules/@gothassos. - Add plugin references in
~/tsconfig.json. - Add plugin in
rollup.config.jsfile.