@yuneta/gobj-ui 6.1.1 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -539,12 +539,15 @@ schema, so the drawing can be held against the ASCII one in its `.c`.
539
539
  - Events: `EV_SHOW`, `EV_REBUILD`, `EV_THEME` (restyle — it repaints the G6
540
540
  graph in place, preserving the user's zoom/pan), plus `EV_NODE_CLICK`, which
541
541
  a node click sends into the FSM. **With a `node_route` the click IS a
542
- navigation** and this view makes it; **without one the click is published**
543
- (`{topic}`) for whoever mounted the view a host that draws the same picture
544
- inside its own screens opens the topic in place, with no hash involved. A
545
- host that subscribes must declare `EV_NODE_CLICK` in its own FSM, as with
546
- every event a child publishes. Since 6.1.0; before that a click with no route
547
- was dropped.
542
+ navigation** and this view makes it. **Without one the click is dropped,
543
+ unless the host asked for it with `with_node_click`** then it is published
544
+ as `{topic}`, for a host that draws the same picture inside its own screens
545
+ and opens the topic in place, with no hash involved. That host must declare
546
+ `EV_NODE_CLICK` in its own FSM, as with every event a child publishes, which
547
+ is exactly why it is opt-in: the CHILD subscription model subscribes a host
548
+ to ALL of this view's events, so publishing one unasked turns a click into
549
+ "Event NOT DEFINED in state" underneath a host that never wanted it. Since
550
+ 6.1.2 (6.1.0 and 6.1.1 published it unconditionally).
548
551
 
549
552
  Barrel-exported and public from 4.0.0. Renders with `@antv/g6`; the cards are
550
553
  HTML nodes carrying their own inline colours, so a theme switch repaints them in
@@ -19831,6 +19831,7 @@ var attrs_table$3 = [
19831
19831
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
19832
19832
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "descs", 0, null, "Treedb schema: {topic_name: desc}"),
19833
19833
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "node_route", 0, "", "Hash-route template with a {topic} placeholder: a node click opens that topic (e.g. '#/topics/db/<sel>/{topic}')"),
19834
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "with_node_click", 0, false, "With no `node_route`, PUBLISH a node click as EV_NODE_CLICK instead of dropping it. Opt-in, because a subscriber has to DECLARE the event: the hosts that route by hash, and the ones that want nothing, must not have it appear underneath them"),
19834
19835
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "system", 0, false, "Include system topics (__*__) too"),
19835
19836
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "$container", 0, null, "Root HTML element"),
19836
19837
  (0, _yuneta_gobj_js.SDATA_END)()
@@ -20235,19 +20236,26 @@ function destroy_graph(gobj) {
20235
20236
  * With a `node_route` the click IS a navigation and this view
20236
20237
  * makes it: that is what the route was handed down for.
20237
20238
  *
20238
- * Without one it is still an action, and it belongs to whoever
20239
- * mounted this view — the schema editor draws the same picture
20240
- * inside its own screens, where a topic opens in place and no
20241
- * hash is involved. So the click is published rather than
20242
- * dropped. A host that subscribes must DECLARE EV_NODE_CLICK in
20243
- * its own FSM, as with every event a child publishes.
20239
+ * Without one it is still an action, and it can belong to
20240
+ * whoever mounted this view — the schema editor draws the same
20241
+ * picture inside its own screens, where a topic opens in place
20242
+ * and no hash is involved. That host asks for it with
20243
+ * `with_node_click` and DECLARES EV_NODE_CLICK in its own FSM,
20244
+ * as with every event a child publishes.
20245
+ *
20246
+ * It is opt-in and not the default for exactly that reason: the
20247
+ * CHILD subscription model subscribes the host to ALL of this
20248
+ * view's events, so publishing one unasked turns a click into
20249
+ * "Event NOT DEFINED in state" in every host that never wanted
20250
+ * it — the topics view that mounts this as its schema landing,
20251
+ * and the offline demo that mounts it against a json file.
20244
20252
  ************************************************************/
20245
20253
  function ac_node_click$2(gobj, event, kw, src) {
20246
20254
  let topic = kw && kw.node_id;
20247
20255
  let route = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "node_route");
20248
20256
  if (!topic) return 0;
20249
20257
  if (!route) {
20250
- (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_NODE_CLICK", { topic });
20258
+ if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_node_click")) (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_NODE_CLICK", { topic });
20251
20259
  return 0;
20252
20260
  }
20253
20261
  let href = route.replace("{topic}", topic);
@@ -23415,6 +23423,7 @@ function render_diagram(gobj) {
23415
23423
  subscriber: gobj,
23416
23424
  descs,
23417
23425
  node_route: "",
23426
+ with_node_click: true,
23418
23427
  system: true
23419
23428
  }, gobj);
23420
23429
  if (!diagram) {
@@ -19818,6 +19818,7 @@ var attrs_table$3 = [
19818
19818
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
19819
19819
  SDATA(data_type_t.DTP_JSON, "descs", 0, null, "Treedb schema: {topic_name: desc}"),
19820
19820
  SDATA(data_type_t.DTP_STRING, "node_route", 0, "", "Hash-route template with a {topic} placeholder: a node click opens that topic (e.g. '#/topics/db/<sel>/{topic}')"),
19821
+ SDATA(data_type_t.DTP_BOOLEAN, "with_node_click", 0, false, "With no `node_route`, PUBLISH a node click as EV_NODE_CLICK instead of dropping it. Opt-in, because a subscriber has to DECLARE the event: the hosts that route by hash, and the ones that want nothing, must not have it appear underneath them"),
19821
19822
  SDATA(data_type_t.DTP_BOOLEAN, "system", 0, false, "Include system topics (__*__) too"),
19822
19823
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTML element"),
19823
19824
  SDATA_END()
@@ -20222,19 +20223,26 @@ function destroy_graph(gobj) {
20222
20223
  * With a `node_route` the click IS a navigation and this view
20223
20224
  * makes it: that is what the route was handed down for.
20224
20225
  *
20225
- * Without one it is still an action, and it belongs to whoever
20226
- * mounted this view — the schema editor draws the same picture
20227
- * inside its own screens, where a topic opens in place and no
20228
- * hash is involved. So the click is published rather than
20229
- * dropped. A host that subscribes must DECLARE EV_NODE_CLICK in
20230
- * its own FSM, as with every event a child publishes.
20226
+ * Without one it is still an action, and it can belong to
20227
+ * whoever mounted this view — the schema editor draws the same
20228
+ * picture inside its own screens, where a topic opens in place
20229
+ * and no hash is involved. That host asks for it with
20230
+ * `with_node_click` and DECLARES EV_NODE_CLICK in its own FSM,
20231
+ * as with every event a child publishes.
20232
+ *
20233
+ * It is opt-in and not the default for exactly that reason: the
20234
+ * CHILD subscription model subscribes the host to ALL of this
20235
+ * view's events, so publishing one unasked turns a click into
20236
+ * "Event NOT DEFINED in state" in every host that never wanted
20237
+ * it — the topics view that mounts this as its schema landing,
20238
+ * and the offline demo that mounts it against a json file.
20231
20239
  ************************************************************/
20232
20240
  function ac_node_click$2(gobj, event, kw, src) {
20233
20241
  let topic = kw && kw.node_id;
20234
20242
  let route = gobj_read_str_attr(gobj, "node_route");
20235
20243
  if (!topic) return 0;
20236
20244
  if (!route) {
20237
- gobj_publish_event(gobj, "EV_NODE_CLICK", { topic });
20245
+ if (gobj_read_bool_attr(gobj, "with_node_click")) gobj_publish_event(gobj, "EV_NODE_CLICK", { topic });
20238
20246
  return 0;
20239
20247
  }
20240
20248
  let href = route.replace("{topic}", topic);
@@ -23402,6 +23410,7 @@ function render_diagram(gobj) {
23402
23410
  subscriber: gobj,
23403
23411
  descs,
23404
23412
  node_route: "",
23413
+ with_node_click: true,
23405
23414
  system: true
23406
23415
  }, gobj);
23407
23416
  if (!diagram) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "6.1.1",
3
+ "version": "6.1.2",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -1389,9 +1389,11 @@ function render_diagram(gobj)
1389
1389
  subscriber: gobj,
1390
1390
  descs: descs,
1391
1391
  /* No `node_route`: this diagram lives inside the editor and
1392
- * a node click is answered here, not by a hash the shell
1393
- * would have to own. */
1394
- node_route: "",
1392
+ * a node click is answered HERE, not by a hash the shell
1393
+ * would have to own — which is what `with_node_click` asks
1394
+ * for, and why EV_NODE_CLICK is declared in this FSM. */
1395
+ node_route: "",
1396
+ with_node_click: true,
1395
1397
  system: true
1396
1398
  },
1397
1399
  gobj
@@ -94,6 +94,7 @@ const attrs_table = [
94
94
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
95
95
  SDATA(data_type_t.DTP_JSON, "descs", 0, null, "Treedb schema: {topic_name: desc}"),
96
96
  SDATA(data_type_t.DTP_STRING, "node_route", 0, "", "Hash-route template with a {topic} placeholder: a node click opens that topic (e.g. '#/topics/db/<sel>/{topic}')"),
97
+ SDATA(data_type_t.DTP_BOOLEAN, "with_node_click", 0, false, "With no `node_route`, PUBLISH a node click as EV_NODE_CLICK instead of dropping it. Opt-in, because a subscriber has to DECLARE the event: the hosts that route by hash, and the ones that want nothing, must not have it appear underneath them"),
97
98
  SDATA(data_type_t.DTP_BOOLEAN, "system", 0, false, "Include system topics (__*__) too"),
98
99
  SDATA(data_type_t.DTP_POINTER, "$container", 0, null, "Root HTML element"),
99
100
  SDATA_END()
@@ -622,12 +623,19 @@ function destroy_graph(gobj)
622
623
  * With a `node_route` the click IS a navigation and this view
623
624
  * makes it: that is what the route was handed down for.
624
625
  *
625
- * Without one it is still an action, and it belongs to whoever
626
- * mounted this view — the schema editor draws the same picture
627
- * inside its own screens, where a topic opens in place and no
628
- * hash is involved. So the click is published rather than
629
- * dropped. A host that subscribes must DECLARE EV_NODE_CLICK in
630
- * its own FSM, as with every event a child publishes.
626
+ * Without one it is still an action, and it can belong to
627
+ * whoever mounted this view — the schema editor draws the same
628
+ * picture inside its own screens, where a topic opens in place
629
+ * and no hash is involved. That host asks for it with
630
+ * `with_node_click` and DECLARES EV_NODE_CLICK in its own FSM,
631
+ * as with every event a child publishes.
632
+ *
633
+ * It is opt-in and not the default for exactly that reason: the
634
+ * CHILD subscription model subscribes the host to ALL of this
635
+ * view's events, so publishing one unasked turns a click into
636
+ * "Event NOT DEFINED in state" in every host that never wanted
637
+ * it — the topics view that mounts this as its schema landing,
638
+ * and the offline demo that mounts it against a json file.
631
639
  ************************************************************/
632
640
  function ac_node_click(gobj, event, kw, src)
633
641
  {
@@ -638,7 +646,9 @@ function ac_node_click(gobj, event, kw, src)
638
646
  return 0;
639
647
  }
640
648
  if(!route) {
641
- gobj_publish_event(gobj, "EV_NODE_CLICK", {topic: topic});
649
+ if(gobj_read_bool_attr(gobj, "with_node_click")) {
650
+ gobj_publish_event(gobj, "EV_NODE_CLICK", {topic: topic});
651
+ }
642
652
  return 0;
643
653
  }
644
654
  let href = route.replace("{topic}", topic);