Closed bumbeishvili closed 9 months ago
Thank you for your detailed feedback.
I just wanted to write simple javascript and not run any backend & typescript project
Indeed, working within the current structure can be challenging if you are not using a package bundler. At least for now, it's primarily designed for TypeScript and relies on the package bundlers for plugin development.
createPlugin
come from and what would it do
createPlugin
is a utility function. It just adds a version as you mentioned, but it's needed to ensure compatibility with the pane that is used by plugin user. It can be useful if plugin developers follow the expected way (forking @tweakpane/plugin-template
and extend it) since it includes the core (@tweakpane/core
) version automatically.
Although it was unclear if I needed to register CounterPluginBundle or CounterInputPlugin.
You raise a valid point. While typings can assist you if you uses TypeScript, but anyway registerPlugin
requires TpPluginBundle
and it seems strange a bit. Their names (registerPlugin
, TpPluginBundle
, TpPlugin
) can be improved.
P.S. Was there a specific reason you chose not to use @tweakpane/plugin-template
and decided to develop a plugin from scratch? (just curious)
P.S. Was there a specific reason you chose not to use @tweakpane/plugin-template and decided to develop a plugin from scratch? (just curious)
Yes, it seemed excessive from my point of view. Did not want to run another project within my project (or outside it) to make use of a feature of the tweakpane library, first I wanted to do it quickly when failed to do so, I just had an interest in how would I achieve it.
In the end, the plugin is just 3 classes and 1 object, which can be written in vanilla JS easily (as long as the structure matches)
Not optimal, but still got what I wanted in the end with vanilla js (code editor integrated into pane).
Thank you for this library. It's great
https://github.com/cocopon/tweakpane/assets/6873202/9f57b5e1-098f-477b-bbbd-d2f97f25d74e
I am going to close this issue, I hope it helps someone
Hi,
I wanted to create a simple text editor plugin. I faced some issues and I'll list them here, might be helpful for others who are just starting out, or for you to simplify workflow & improve docs.
First, I just wanted to write simple javascript and not run any backend & typescript project and publish the result to npm. This was the first hassle.
So, I just followed your tutorial - https://cocopon.github.io/tweakpane/plugins/dev/
The second hassle was understanding where
createPlugin
comes from and what would it do, turns out it just adds a version number. Not sure if this approach is good, since it might invalidate a perfectly working plugin.Although it was unclear if I needed to register
CounterPluginBundle
orCounterInputPlugin
.The third hassle came when I registered
CounterInputPlugin
and there were no errors, but also it did not have any influence.Then I followed the code and after digging into it, turns out I needed to register
CounterPluginBundle
.After registering it, I got an incompatibility error, I think it's because the version is hard-coded in the source code
So, I had to manually set the version
Here is a working vanilla js code if it helps anyone