retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
9.86k stars 647 forks source link

[Discussion] Frameworks worth considering #219

Closed trsh closed 5 years ago

trsh commented 5 years ago

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

Ni55aN commented 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.

trsh commented 5 years ago

@Ni55aN I know. This not specially for u, but for whole contributors.

trsh commented 5 years ago

@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.

Ni55aN commented 5 years ago

@trsh

  1. This property was used earlier to access an instance of a Vue component (for example, for forceUpdate), but later vueContext was added, that refers to the component itself, not to the root.
  2. custom components require some basic methods (which the mixin contains), and they are reusable
  3. Socket also may be reusable
  4. https://github.com/retejs/vue-render-plugin/blob/master/src/index.js#L49
  5. https://vuejs.org/v2/guide/mixins.html
trsh commented 5 years ago

@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.

Ni55aN commented 5 years ago

@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.

trsh commented 5 years ago

@Ni55aN got it

trsh commented 5 years ago

Popped up this discussion with questions, wasnt meant so.. will reopen new