@yuneta/gobj-ui 7.23.7 → 7.23.8

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.
@@ -9912,24 +9912,17 @@ function destroy_ui$6(gobj) {
9912
9912
  function make_toolbar$3(gobj) {
9913
9913
  let priv = gobj.priv;
9914
9914
  let toolbar_wide = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "wide");
9915
- let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([[
9916
- "div",
9915
+ let $find_input = (0, _yuneta_gobj_js.createElement2)([
9916
+ "input",
9917
9917
  {
9918
- class: "JSON_GRAPH_FIND control has-icons-left",
9919
- style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
9920
- },
9921
- [["input", {
9922
9918
  class: "JSON_GRAPH_FIND_INPUT input",
9923
9919
  type: "text",
9924
9920
  placeholder: (0, i18next.t)("search"),
9925
9921
  "data-i18n-placeholder": "search",
9926
9922
  "aria-label": (0, i18next.t)("search"),
9927
9923
  "data-i18n-aria-label": "search"
9928
- }], [
9929
- "span",
9930
- { class: "icon is-left" },
9931
- [["i", { class: "yi-magnifying-glass" }]]
9932
- ]],
9924
+ },
9925
+ [],
9933
9926
  { input: (evt) => {
9934
9927
  evt.stopPropagation();
9935
9928
  let text = evt.target.value.trim();
@@ -9939,7 +9932,21 @@ function make_toolbar$3(gobj) {
9939
9932
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_FIND_NODES", { text }, gobj);
9940
9933
  }, 250);
9941
9934
  } }
9942
- ], [
9935
+ ]);
9936
+ let $find_control = (0, _yuneta_gobj_js.createElement2)([
9937
+ "div",
9938
+ {
9939
+ class: "JSON_GRAPH_FIND control has-icons-left",
9940
+ style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
9941
+ },
9942
+ [$find_input, [
9943
+ "span",
9944
+ { class: "icon is-left" },
9945
+ [["i", { class: "yi-magnifying-glass" }]]
9946
+ ]]
9947
+ ]);
9948
+ attach_clear($find_control, $find_input);
9949
+ let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([$find_control, [
9943
9950
  "div",
9944
9951
  {
9945
9952
  class: "JSON_GRAPH_FIND_RESULT is-hidden",
@@ -11240,14 +11247,10 @@ function make_toolbar$2(gobj) {
11240
11247
  [["i", { class: "yi-magnifying-glass" }]]
11241
11248
  ]]
11242
11249
  ]);
11250
+ left_items.push(icon_button(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"), icon_button(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"));
11243
11251
  attach_clear($search_control, $search_input);
11244
11252
  left_items.push($search_control);
11245
- let right_items = [
11246
- view_mode_switch(gobj),
11247
- icon_button(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"),
11248
- icon_button(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"),
11249
- icon_button(gobj, "yi-copy", "EV_COPY_ALL", "copy json")
11250
- ];
11253
+ let right_items = [view_mode_switch(gobj), icon_button(gobj, "yi-copy", "EV_COPY_ALL", "copy json")];
11251
11254
  const $toolbar = yui_toolbar({}, [
11252
11255
  [
11253
11256
  "div",
@@ -52600,24 +52603,17 @@ function make_toolbar(gobj) {
52600
52603
  } }
52601
52604
  ]
52602
52605
  ];
52603
- let center_items = [[
52604
- "div",
52606
+ let $find_input = (0, _yuneta_gobj_js.createElement2)([
52607
+ "input",
52605
52608
  {
52606
- class: "GRAPH_FIND control has-icons-left",
52607
- style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
52608
- },
52609
- [["input", {
52610
52609
  class: "GRAPH_FIND_INPUT input",
52611
52610
  type: "text",
52612
52611
  placeholder: (0, i18next.t)("search"),
52613
52612
  "data-i18n-placeholder": "search",
52614
52613
  "aria-label": (0, i18next.t)("search"),
52615
52614
  "data-i18n-aria-label": "search"
52616
- }], [
52617
- "span",
52618
- { class: "icon is-left" },
52619
- [["i", { class: "yi-magnifying-glass" }]]
52620
- ]],
52615
+ },
52616
+ [],
52621
52617
  { input: (evt) => {
52622
52618
  evt.stopPropagation();
52623
52619
  let text = evt.target.value.trim();
@@ -52627,22 +52623,20 @@ function make_toolbar(gobj) {
52627
52623
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_FIND_NODES", { text }, gobj);
52628
52624
  }, 250);
52629
52625
  } }
52630
- ], [
52626
+ ]);
52627
+ let $find_control = (0, _yuneta_gobj_js.createElement2)([
52631
52628
  "div",
52632
52629
  {
52633
- class: "GRAPH_FIND_RESULT is-hidden",
52634
- style: "display:flex; align-items:center; gap:.3rem; margin-right:.5rem; font-size:.85rem;"
52630
+ class: "GRAPH_FIND control has-icons-left",
52631
+ style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
52635
52632
  },
52636
- [[
52637
- "span",
52638
- { class: "GRAPH_FIND_COUNT" },
52639
- ""
52640
- ], [
52633
+ [$find_input, [
52641
52634
  "span",
52642
- { i18n: "matches" },
52643
- "matches"
52635
+ { class: "icon is-left" },
52636
+ [["i", { class: "yi-magnifying-glass" }]]
52644
52637
  ]]
52645
- ]];
52638
+ ]);
52639
+ attach_clear($find_control, $find_input);
52646
52640
  const $toolbar_header = yui_toolbar({}, [
52647
52641
  [
52648
52642
  "div",
@@ -52652,7 +52646,22 @@ function make_toolbar(gobj) {
52652
52646
  [
52653
52647
  "div",
52654
52648
  { class: "yui-horizontal-toolbar-section center" },
52655
- center_items
52649
+ [$find_control, [
52650
+ "div",
52651
+ {
52652
+ class: "GRAPH_FIND_RESULT is-hidden",
52653
+ style: "display:flex; align-items:center; gap:.3rem; margin-right:.5rem; font-size:.85rem;"
52654
+ },
52655
+ [[
52656
+ "span",
52657
+ { class: "GRAPH_FIND_COUNT" },
52658
+ ""
52659
+ ], [
52660
+ "span",
52661
+ { i18n: "matches" },
52662
+ "matches"
52663
+ ]]
52664
+ ]]
52656
52665
  ],
52657
52666
  [
52658
52667
  "div",
@@ -9907,24 +9907,17 @@ function destroy_ui$6(gobj) {
9907
9907
  function make_toolbar$3(gobj) {
9908
9908
  let priv = gobj.priv;
9909
9909
  let toolbar_wide = gobj_read_attr(gobj, "wide");
9910
- let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([[
9911
- "div",
9910
+ let $find_input = createElement2([
9911
+ "input",
9912
9912
  {
9913
- class: "JSON_GRAPH_FIND control has-icons-left",
9914
- style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
9915
- },
9916
- [["input", {
9917
9913
  class: "JSON_GRAPH_FIND_INPUT input",
9918
9914
  type: "text",
9919
9915
  placeholder: t("search"),
9920
9916
  "data-i18n-placeholder": "search",
9921
9917
  "aria-label": t("search"),
9922
9918
  "data-i18n-aria-label": "search"
9923
- }], [
9924
- "span",
9925
- { class: "icon is-left" },
9926
- [["i", { class: "yi-magnifying-glass" }]]
9927
- ]],
9919
+ },
9920
+ [],
9928
9921
  { input: (evt) => {
9929
9922
  evt.stopPropagation();
9930
9923
  let text = evt.target.value.trim();
@@ -9934,7 +9927,21 @@ function make_toolbar$3(gobj) {
9934
9927
  gobj_send_event(gobj, "EV_FIND_NODES", { text }, gobj);
9935
9928
  }, 250);
9936
9929
  } }
9937
- ], [
9930
+ ]);
9931
+ let $find_control = createElement2([
9932
+ "div",
9933
+ {
9934
+ class: "JSON_GRAPH_FIND control has-icons-left",
9935
+ style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
9936
+ },
9937
+ [$find_input, [
9938
+ "span",
9939
+ { class: "icon is-left" },
9940
+ [["i", { class: "yi-magnifying-glass" }]]
9941
+ ]]
9942
+ ]);
9943
+ attach_clear($find_control, $find_input);
9944
+ let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([$find_control, [
9938
9945
  "div",
9939
9946
  {
9940
9947
  class: "JSON_GRAPH_FIND_RESULT is-hidden",
@@ -11235,14 +11242,10 @@ function make_toolbar$2(gobj) {
11235
11242
  [["i", { class: "yi-magnifying-glass" }]]
11236
11243
  ]]
11237
11244
  ]);
11245
+ left_items.push(icon_button(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"), icon_button(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"));
11238
11246
  attach_clear($search_control, $search_input);
11239
11247
  left_items.push($search_control);
11240
- let right_items = [
11241
- view_mode_switch(gobj),
11242
- icon_button(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"),
11243
- icon_button(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"),
11244
- icon_button(gobj, "yi-copy", "EV_COPY_ALL", "copy json")
11245
- ];
11248
+ let right_items = [view_mode_switch(gobj), icon_button(gobj, "yi-copy", "EV_COPY_ALL", "copy json")];
11246
11249
  const $toolbar = yui_toolbar({}, [
11247
11250
  [
11248
11251
  "div",
@@ -52587,24 +52590,17 @@ function make_toolbar(gobj) {
52587
52590
  } }
52588
52591
  ]
52589
52592
  ];
52590
- let center_items = [[
52591
- "div",
52593
+ let $find_input = createElement2([
52594
+ "input",
52592
52595
  {
52593
- class: "GRAPH_FIND control has-icons-left",
52594
- style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
52595
- },
52596
- [["input", {
52597
52596
  class: "GRAPH_FIND_INPUT input",
52598
52597
  type: "text",
52599
52598
  placeholder: t("search"),
52600
52599
  "data-i18n-placeholder": "search",
52601
52600
  "aria-label": t("search"),
52602
52601
  "data-i18n-aria-label": "search"
52603
- }], [
52604
- "span",
52605
- { class: "icon is-left" },
52606
- [["i", { class: "yi-magnifying-glass" }]]
52607
- ]],
52602
+ },
52603
+ [],
52608
52604
  { input: (evt) => {
52609
52605
  evt.stopPropagation();
52610
52606
  let text = evt.target.value.trim();
@@ -52614,22 +52610,20 @@ function make_toolbar(gobj) {
52614
52610
  gobj_send_event(gobj, "EV_FIND_NODES", { text }, gobj);
52615
52611
  }, 250);
52616
52612
  } }
52617
- ], [
52613
+ ]);
52614
+ let $find_control = createElement2([
52618
52615
  "div",
52619
52616
  {
52620
- class: "GRAPH_FIND_RESULT is-hidden",
52621
- style: "display:flex; align-items:center; gap:.3rem; margin-right:.5rem; font-size:.85rem;"
52617
+ class: "GRAPH_FIND control has-icons-left",
52618
+ style: "margin-right:.5rem; max-width:12rem; min-width:7rem;"
52622
52619
  },
52623
- [[
52624
- "span",
52625
- { class: "GRAPH_FIND_COUNT" },
52626
- ""
52627
- ], [
52620
+ [$find_input, [
52628
52621
  "span",
52629
- { i18n: "matches" },
52630
- "matches"
52622
+ { class: "icon is-left" },
52623
+ [["i", { class: "yi-magnifying-glass" }]]
52631
52624
  ]]
52632
- ]];
52625
+ ]);
52626
+ attach_clear($find_control, $find_input);
52633
52627
  const $toolbar_header = yui_toolbar({}, [
52634
52628
  [
52635
52629
  "div",
@@ -52639,7 +52633,22 @@ function make_toolbar(gobj) {
52639
52633
  [
52640
52634
  "div",
52641
52635
  { class: "yui-horizontal-toolbar-section center" },
52642
- center_items
52636
+ [$find_control, [
52637
+ "div",
52638
+ {
52639
+ class: "GRAPH_FIND_RESULT is-hidden",
52640
+ style: "display:flex; align-items:center; gap:.3rem; margin-right:.5rem; font-size:.85rem;"
52641
+ },
52642
+ [[
52643
+ "span",
52644
+ { class: "GRAPH_FIND_COUNT" },
52645
+ ""
52646
+ ], [
52647
+ "span",
52648
+ { i18n: "matches" },
52649
+ "matches"
52650
+ ]]
52651
+ ]]
52643
52652
  ],
52644
52653
  [
52645
52654
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.7",
3
+ "version": "7.23.8",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
package/src/c_yui_json.js CHANGED
@@ -365,14 +365,20 @@ function make_toolbar(gobj)
365
365
  $search_input,
366
366
  ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
367
367
  ]]);
368
+ /* The GLOBAL fold leads the row, ahead of the find box — the same
369
+ * place both graphs put theirs. It opens the whole document; the
370
+ * per-row toggles live in the rows. */
371
+ left_items.push(
372
+ icon_button(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"),
373
+ icon_button(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all")
374
+ );
375
+
368
376
  attach_clear($search_control, $search_input);
369
377
  left_items.push($search_control);
370
378
 
371
379
  let right_items = [
372
380
  view_mode_switch(gobj),
373
- icon_button(gobj, "yi-chevron-right", "EV_EXPAND_ALL", "expand loaded"),
374
- icon_button(gobj, "yi-chevron-right", "EV_COLLAPSE_ALL", "collapse all"),
375
- icon_button(gobj, "yi-copy", "EV_COPY_ALL", "copy json"),
381
+ icon_button(gobj, "yi-copy", "EV_COPY_ALL", "copy json"),
376
382
  ];
377
383
 
378
384
  const $toolbar = yui_toolbar({}, [
@@ -47,6 +47,7 @@ import {
47
47
  } from "@yuneta/gobj-js";
48
48
 
49
49
  import {yui_toolbar} from "./yui_toolbar.js";
50
+ import {attach_clear} from "./yui_inputs.js";
50
51
  import {
51
52
  yui_graph_camera_items,
52
53
  yui_graph_fold_items,
@@ -478,27 +479,25 @@ function make_toolbar(gobj)
478
479
  * looks the same whether nothing matched or the match was already
479
480
  * on screen.
480
481
  */
481
- let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([
482
- ['div', {class: 'JSON_GRAPH_FIND control has-icons-left',
483
- style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
484
- ['input', {
485
- class: 'JSON_GRAPH_FIND_INPUT input',
486
- type: 'text',
487
- /* A placeholder is not a text node, so the data-i18n
488
- * walk cannot reach it: it needs its own key. */
489
- placeholder: t('search'),
490
- 'data-i18n-placeholder': 'search',
491
- 'aria-label': t('search'),
492
- 'data-i18n-aria-label': 'search'
493
- }],
494
- ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
495
- ], {
482
+ /* Materialised, not a spec: attach_clear() hangs the NORM clear (✕)
483
+ * on a real element. Clearing dispatches a synthetic `input`, which
484
+ * goes through the same rate-limited handler and fires EV_FIND_NODES
485
+ * with an empty term — the box and the highlight clear together. */
486
+ let $find_input = createElement2(
487
+ ['input', {
488
+ class: 'JSON_GRAPH_FIND_INPUT input',
489
+ type: 'text',
490
+ /* A placeholder is not a text node, so the data-i18n walk
491
+ * cannot reach it: it needs its own key. */
492
+ placeholder: t('search'),
493
+ 'data-i18n-placeholder': 'search',
494
+ 'aria-label': t('search'),
495
+ 'data-i18n-aria-label': 'search'
496
+ }, [], {
496
497
  /* Rate-limited, not delayed for effect: every keystroke
497
498
  * REBUILDS the cards — an html node paints no G6 state, so
498
499
  * the highlight has to live in the card's own markup — and
499
- * the first letter typed can match most of a document.
500
- * Input plumbing: the action still crosses the FSM, just
501
- * not once per keystroke. */
500
+ * the first letter typed can match most of a document. */
502
501
  input: (evt) => {
503
502
  evt.stopPropagation();
504
503
  let text = evt.target.value.trim();
@@ -510,13 +509,32 @@ function make_toolbar(gobj)
510
509
  gobj_send_event(gobj, "EV_FIND_NODES", {text: text}, gobj);
511
510
  }, 250);
512
511
  }
513
- }],
512
+ }]);
513
+
514
+ let $find_control = createElement2(
515
+ ['div', {class: 'JSON_GRAPH_FIND control has-icons-left',
516
+ style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
517
+ $find_input,
518
+ ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
519
+ ]]);
520
+ attach_clear($find_control, $find_input);
521
+
522
+ /*
523
+ * Left: the global fold leads the row, then find a node.
524
+ *
525
+ * A graph of a large document has no other way in — the only way to
526
+ * locate a key was to read every card. The count SAYS how many
527
+ * matched, because a graph that did not move looks the same whether
528
+ * nothing matched or the match was already on screen.
529
+ */
530
+ let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([
531
+ $find_control,
514
532
  /* Two spans, not one string: the number is DATA and "matches"
515
533
  * is the word, so a language switch re-translates the half that
516
- * is a word. Spaced with CSS because createElement2 trims text
517
- * nodes. `display:flex` inline and NOT the `is-flex` helper —
518
- * both Bulma helpers carry !important, so `is-hidden is-flex` on
519
- * one element is decided by stylesheet order. */
534
+ * is a word. `display:flex` inline and NOT the `is-flex`
535
+ * helper — both Bulma helpers carry !important, so
536
+ * `is-hidden is-flex` on one element is decided by stylesheet
537
+ * order. */
520
538
  ['div', {class: 'JSON_GRAPH_FIND_RESULT is-hidden',
521
539
  style: 'display:flex; align-items:center; gap:.3rem; ' +
522
540
  'margin-right:.5rem; font-size:.85rem;'}, [
@@ -78,6 +78,7 @@ import {
78
78
  } from "@yuneta/gobj-js";
79
79
 
80
80
  import {yui_toolbar} from "./yui_toolbar.js";
81
+ import {attach_clear} from "./yui_inputs.js";
81
82
  import {register_c_g6_nodes_tree} from "./c_g6_nodes_tree.js";
82
83
  import {
83
84
  removeChildElements,
@@ -548,23 +549,21 @@ function make_toolbar(gobj)
548
549
  * not move looks the same whether nothing matched or the match was
549
550
  * already on screen.
550
551
  */
551
- let center_items = [
552
- ['div', {class: 'GRAPH_FIND control has-icons-left',
553
- style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
554
- ['input', {
555
- class: 'GRAPH_FIND_INPUT input',
556
- type: 'text',
557
- /* A placeholder is not a text node, so the data-i18n walk
558
- * cannot reach it: it needs its own key. */
559
- placeholder: t('search'),
560
- 'data-i18n-placeholder': 'search',
561
- 'aria-label': t('search'),
562
- 'data-i18n-aria-label': 'search'
563
- }],
564
- ['span', {class: 'icon is-left'}, [
565
- ['i', {class: 'yi-magnifying-glass'}]
566
- ]]
567
- ], {
552
+ /* Materialised, not a spec: attach_clear() hangs the NORM clear (✕)
553
+ * on a real element. Clearing dispatches a synthetic `input`, which
554
+ * goes through the same rate-limited handler and fires EV_FIND_NODES
555
+ * with an empty term — the box and the highlight clear together. */
556
+ let $find_input = createElement2(
557
+ ['input', {
558
+ class: 'GRAPH_FIND_INPUT input',
559
+ type: 'text',
560
+ /* A placeholder is not a text node, so the data-i18n walk
561
+ * cannot reach it: it needs its own key. */
562
+ placeholder: t('search'),
563
+ 'data-i18n-placeholder': 'search',
564
+ 'aria-label': t('search'),
565
+ 'data-i18n-aria-label': 'search'
566
+ }, [], {
568
567
  /* Rate-limited, not delayed for effect: a match repaints the
569
568
  * cards it lands on, and on a large treedb the first letter
570
569
  * typed can match hundreds. This is input plumbing — the
@@ -581,7 +580,18 @@ function make_toolbar(gobj)
581
580
  gobj_send_event(gobj, "EV_FIND_NODES", {text: text}, gobj);
582
581
  }, 250);
583
582
  }
584
- }],
583
+ }]);
584
+
585
+ let $find_control = createElement2(
586
+ ['div', {class: 'GRAPH_FIND control has-icons-left',
587
+ style: 'margin-right:.5rem; max-width:12rem; min-width:7rem;'}, [
588
+ $find_input,
589
+ ['span', {class: 'icon is-left'}, [['i', {class: 'yi-magnifying-glass'}]]]
590
+ ]]);
591
+ attach_clear($find_control, $find_input);
592
+
593
+ let center_items = [
594
+ $find_control,
585
595
  /* Two spans, not one string: the number is DATA and "matches" is
586
596
  * the word, so a language switch re-translates the half that is a
587
597
  * word. Spaced with CSS because createElement2 trims text nodes. */