Closed trsh closed 5 years ago
Anyone can create * -render-plugin to render controls and nodes using the library/framework he prefers.
https://rete.js.org/#/cli All functionality of your plugin can be implemented according to the vue-render-plugin.
@Ni55aN I know. This not specially for u, but for whole contributors.
@Ni55aN 3 questions (https://github.com/retejs/vue-render-plugin/blob/master/src/index.js):
1) Why this binding node._vue = createNode(editor, { el, node, component, bindSocket, bindControl });
, node._vue
? I can't see it being used in renderer, so its used in rete core? Thats not good? Same control._vue = xx
2) mixin is returned in index.js and then via Node.vue. Is one place not enough?
3) Also here
export default {
name: 'vue-render',
install,
mixin,
Node,
Socket
}
returns Socket via Node.vue default components. Overall I could write it like this:
export default {
name: "xxx-render",
install,
mixin,
Node: {
mixins: [mixin],
components: {
props: ["type", "socket"]
}
},
Socket: {
props: ["type", "socket"]
}
};
Something seems odd about those final returns! :)
4) How exactly does the component update? I see entity.vueContext.$forceUpdate();, but can't see where it's props are changed.
5) Also do not understand how mixin comes in play overall.
@trsh
vueContext
was added, that refers to the component itself, not to the root.Socket
also may be reusable@Ni55aN
The question that still remains is - are all these required to return:
export default {
name: 'vue-render',
install,
mixin,
Node,
Socket
}
??
Node, Socket, mixin is kind of Vue thing...
Update:
Also this line
.input-control(
v-show='input.showControl()'
v-control="input.control"
)
v-control makes me worry? What does it? Very vue'ish thing.
@trsh yes, if you want the plugin to be customized. For example, render plugin based on react can export default Node,jsx component that allows extending component.
The v-control
directive calls bindControl
after HTMLElement created.
@Ni55aN got it
Popped up this discussion with questions, wasnt meant so.. will reopen new
1) ReactJS and AngularJS (new version)
Why? Very popular, so most of projects I think are based on these. It's a bit 'grrrrrr' to ad another 30 kb (compressed) js framework like vue, when you have to load this beasts anyway.
2) Pick something small and fast from top runners https://www.stefankrause.net/wp/, like domc, stage0 or solid, surplus from the list. These are 5-30 kb frameworks (not compressed), so adding them is not so much to add to total KB.
Update:
I contacted domc and stage0 author. These are even smaller FW then I thought. Around 2-3 KB