@yuneta/gobj-ui 7.23.22 → 7.23.24

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.
@@ -10924,7 +10924,11 @@ function build_graph$3(gobj) {
10924
10924
  }
10925
10925
  },
10926
10926
  layout: layout_cfg.g6_layout,
10927
- behaviors: ["drag-canvas", "zoom-canvas"]
10927
+ behaviors: [
10928
+ "drag-canvas",
10929
+ "zoom-canvas",
10930
+ "drag-element"
10931
+ ]
10928
10932
  });
10929
10933
  if (priv.theme) graph.setTheme(priv.theme);
10930
10934
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
@@ -11188,6 +11192,12 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
11188
11192
  ${content_html}
11189
11193
  </div>`;
11190
11194
  let ports = [];
11195
+ if (parent_id) ports.push({
11196
+ key: "in",
11197
+ placement: [.5, 0],
11198
+ fill: colors.border,
11199
+ stroke: colors.border
11200
+ });
11191
11201
  for (let pending of pending_complex) {
11192
11202
  let child_colors = json_card_style((0, _yuneta_gobj_js.is_object)(pending.value) ? GROUP_COLORS.dict : GROUP_COLORS.list, dark);
11193
11203
  let row_mid = CARD_HEADER_H$1 + pending.row * CARD_ROW_H$1 + CARD_ROW_H$1 / 2;
@@ -11223,7 +11233,12 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
11223
11233
  target: group_id,
11224
11234
  style: {
11225
11235
  stroke: colors.border,
11226
- lineWidth: 1
11236
+ lineWidth: 1,
11237
+ endArrow: true,
11238
+ endArrowSize: 8,
11239
+ endArrowFill: colors.border,
11240
+ endArrowStroke: colors.border,
11241
+ targetPort: "in"
11227
11242
  }
11228
11243
  };
11229
11244
  if (parent_port) edge.style.sourcePort = parent_port;
@@ -13412,7 +13427,7 @@ function build_ui$8(gobj) {
13412
13427
  {
13413
13428
  id: priv.canvas_id,
13414
13429
  class: "gobj-tree-container",
13415
- style: "height:100%; min-height:0; border: 1px solid var(--bulma-border-weak); border-radius:0.2rem;"
13430
+ style: "height:100%; min-height:0; border: 1px solid var(--bulma-border-weak); border-radius:0.2rem; touch-action:none; -webkit-user-select:none; user-select:none;"
13416
13431
  },
13417
13432
  []
13418
13433
  ]]
@@ -13604,7 +13619,11 @@ function build_graph$2(gobj) {
13604
13619
  }
13605
13620
  },
13606
13621
  layout: layout_cfg.g6_layout,
13607
- behaviors: ["drag-canvas", "zoom-canvas"]
13622
+ behaviors: [
13623
+ "drag-canvas",
13624
+ "zoom-canvas",
13625
+ "drag-element"
13626
+ ]
13608
13627
  });
13609
13628
  if (priv.theme) graph.setTheme(priv.theme);
13610
13629
  graph.on("aftertransform", () => {
@@ -10919,7 +10919,11 @@ function build_graph$3(gobj) {
10919
10919
  }
10920
10920
  },
10921
10921
  layout: layout_cfg.g6_layout,
10922
- behaviors: ["drag-canvas", "zoom-canvas"]
10922
+ behaviors: [
10923
+ "drag-canvas",
10924
+ "zoom-canvas",
10925
+ "drag-element"
10926
+ ]
10923
10927
  });
10924
10928
  if (priv.theme) graph.setTheme(priv.theme);
10925
10929
  graph.on(NodeEvent.CLICK, (evt) => {
@@ -11183,6 +11187,12 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
11183
11187
  ${content_html}
11184
11188
  </div>`;
11185
11189
  let ports = [];
11190
+ if (parent_id) ports.push({
11191
+ key: "in",
11192
+ placement: [.5, 0],
11193
+ fill: colors.border,
11194
+ stroke: colors.border
11195
+ });
11186
11196
  for (let pending of pending_complex) {
11187
11197
  let child_colors = json_card_style(is_object(pending.value) ? GROUP_COLORS.dict : GROUP_COLORS.list, dark);
11188
11198
  let row_mid = CARD_HEADER_H$1 + pending.row * CARD_ROW_H$1 + CARD_ROW_H$1 / 2;
@@ -11218,7 +11228,12 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
11218
11228
  target: group_id,
11219
11229
  style: {
11220
11230
  stroke: colors.border,
11221
- lineWidth: 1
11231
+ lineWidth: 1,
11232
+ endArrow: true,
11233
+ endArrowSize: 8,
11234
+ endArrowFill: colors.border,
11235
+ endArrowStroke: colors.border,
11236
+ targetPort: "in"
11222
11237
  }
11223
11238
  };
11224
11239
  if (parent_port) edge.style.sourcePort = parent_port;
@@ -13407,7 +13422,7 @@ function build_ui$8(gobj) {
13407
13422
  {
13408
13423
  id: priv.canvas_id,
13409
13424
  class: "gobj-tree-container",
13410
- style: "height:100%; min-height:0; border: 1px solid var(--bulma-border-weak); border-radius:0.2rem;"
13425
+ style: "height:100%; min-height:0; border: 1px solid var(--bulma-border-weak); border-radius:0.2rem; touch-action:none; -webkit-user-select:none; user-select:none;"
13411
13426
  },
13412
13427
  []
13413
13428
  ]]
@@ -13599,7 +13614,11 @@ function build_graph$2(gobj) {
13599
13614
  }
13600
13615
  },
13601
13616
  layout: layout_cfg.g6_layout,
13602
- behaviors: ["drag-canvas", "zoom-canvas"]
13617
+ behaviors: [
13618
+ "drag-canvas",
13619
+ "zoom-canvas",
13620
+ "drag-element"
13621
+ ]
13603
13622
  });
13604
13623
  if (priv.theme) graph.setTheme(priv.theme);
13605
13624
  graph.on("aftertransform", () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.22",
3
+ "version": "7.23.24",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -407,7 +407,13 @@ function build_ui(gobj)
407
407
  ['div', {class: 'C_YUI_GOBJ_TREE_JS', style: 'height:100%; display:flex; flex-direction:column; position:relative;'}, [
408
408
  ['div', {class: 'is-flex-grow-0 is-flex toolbar_yui_gobj_tree'}, $toolbar],
409
409
  ['div', {class: 'is-flex-grow-1', style: 'height:100%; min-height:0; overflow:hidden;'}, [
410
- ['div', {id: priv.canvas_id, class: 'gobj-tree-container', style: 'height:100%; min-height:0; border: 1px solid var(--bulma-border-weak); border-radius:0.2rem;'}, [
410
+ /* `touch-action` and `user-select` inline because this gclass loads no
411
+ * stylesheet of its own: G6 puts `touch-action: none` on its canvas and
412
+ * nothing on the html nodes over it, so without this a finger dragging a
413
+ * card makes a page scroll and stops dead after ~20px; and a card is
414
+ * text, so a mouse drag would start a selection. Same two rules
415
+ * `lib_graph.css` carries for the treedb graph. */
416
+ ['div', {id: priv.canvas_id, class: 'gobj-tree-container', style: 'height:100%; min-height:0; border: 1px solid var(--bulma-border-weak); border-radius:0.2rem; touch-action:none; -webkit-user-select:none; user-select:none;'}, [
411
417
  ]]
412
418
  ]]
413
419
  ]]
@@ -650,6 +656,13 @@ function build_graph(gobj)
650
656
  behaviors: [
651
657
  'drag-canvas',
652
658
  'zoom-canvas',
659
+ /* Move a card by dragging it. The position is not kept --
660
+ * this tree is rebuilt from the live gobj tree on every
661
+ * refresh -- and it is still worth having: pulling two
662
+ * cards apart to read the lines between them is the whole
663
+ * use of it. `enable` REPLACES a behavior's default rather
664
+ * than adding to it, so it is not passed. */
665
+ 'drag-element',
653
666
  ],
654
667
  });
655
668
 
@@ -293,6 +293,33 @@
293
293
  z-index: 1;
294
294
  }
295
295
 
296
+ /*
297
+ * The graph mount, once its cards can be DRAGGED.
298
+ *
299
+ * Two problems, both of them the browser's rather than G6's, and both
300
+ * already paid for once in the treedb graph (`lib_graph.css`):
301
+ *
302
+ * G6 puts `touch-action: none` on its CANVAS and NOTHING on the html
303
+ * nodes, which are ordinary DIVs layered over it. So a finger landing
304
+ * on a card made a page scroll: two `pointermove`s through, then the
305
+ * browser decided the gesture was a scroll and killed the stream with
306
+ * `pointercancel` -- the card followed for about 20px and stopped dead
307
+ * while the page slid.
308
+ *
309
+ * And a card is text: dragging one starts a text selection, and the
310
+ * wash stays until the next click somewhere else. Nothing on this
311
+ * canvas is prose.
312
+ *
313
+ * On the CONTAINER and not the cards: every layer G6 stacks in here is
314
+ * a DIV over a canvas that already refuses the browser's gestures, and
315
+ * they have to agree.
316
+ */
317
+ .C_YUI_JSON .json-graph-container {
318
+ touch-action: none;
319
+ -webkit-user-select: none;
320
+ user-select: none;
321
+ }
322
+
296
323
  /*
297
324
  * Disable any transition a host stylesheet might inject.
298
325
  */
@@ -694,6 +694,20 @@ function build_graph(gobj)
694
694
  behaviors: [
695
695
  'drag-canvas',
696
696
  'zoom-canvas',
697
+ /*
698
+ * Move a card by dragging it. The position is NOT kept:
699
+ * the graph is rebuilt from the document on every refresh,
700
+ * fold and layout change, and there is nothing here to
701
+ * save it to -- this is a viewer over a value somebody
702
+ * handed it, not a document of its own. Deliberate: being
703
+ * able to pull two cards apart to read the lines between
704
+ * them is worth having even when it lasts one session.
705
+ *
706
+ * No `enable`: a behavior's `enable` REPLACES the default,
707
+ * it does not add to it, and the default here is exactly
708
+ * what is wanted.
709
+ */
710
+ 'drag-element',
697
711
  ],
698
712
  });
699
713
 
@@ -1181,6 +1195,28 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
1181
1195
  * the one thing the port can say that the row does not.
1182
1196
  */
1183
1197
  let ports = [];
1198
+
1199
+ /*
1200
+ * The port a line ARRIVES at: one per card, above the title and
1201
+ * centred, and only on a card that has a parent -- the root
1202
+ * receives nothing, so a dot there would mark a door onto nothing.
1203
+ *
1204
+ * One and not one-per-parent because a card has exactly ONE parent
1205
+ * in a JSON document: what varies is which key of that parent it
1206
+ * hangs from, and that is what the source ports say.
1207
+ *
1208
+ * Keyed `in` with no prefix, which is why the key ports carry one:
1209
+ * no `p_<key>` can ever collide with it.
1210
+ */
1211
+ if(parent_id) {
1212
+ ports.push({
1213
+ key: "in",
1214
+ placement: [0.5, 0],
1215
+ fill: colors.border,
1216
+ stroke: colors.border,
1217
+ });
1218
+ }
1219
+
1184
1220
  for(let pending of pending_complex) {
1185
1221
  let child_colors = json_card_style(
1186
1222
  is_object(pending.value)? GROUP_COLORS.dict: GROUP_COLORS.list, dark
@@ -1224,6 +1260,23 @@ function build_json_nodes(gobj, path, kw, nodes, edges, parent_id, parent_port)
1224
1260
  style: {
1225
1261
  stroke: colors.border,
1226
1262
  lineWidth: 1,
1263
+ /*
1264
+ * Said on the EDGE and not left to the graph's element
1265
+ * default: a per-element `style` is what the reader of
1266
+ * this code sees, and an arrow that lives somewhere
1267
+ * else is an arrow nobody can find when it stops
1268
+ * being drawn.
1269
+ *
1270
+ * Filled with the line's own colour, because an
1271
+ * arrowhead in the default fill is a black triangle on
1272
+ * a teal line in light and an invisible one in dark.
1273
+ */
1274
+ endArrow: true,
1275
+ endArrowSize: 8,
1276
+ endArrowFill: colors.border,
1277
+ endArrowStroke: colors.border,
1278
+ /* It lands on the card's `in` port, above the title. */
1279
+ targetPort: "in",
1227
1280
  }
1228
1281
  };
1229
1282
  if(parent_port) {