@yuneta/gobj-ui 7.23.39 → 7.23.40

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.
@@ -10921,10 +10921,6 @@ function make_toolbar$5(gobj) {
10921
10921
  "span",
10922
10922
  { class: "JSON_GRAPH_FIND_COUNT" },
10923
10923
  ""
10924
- ], [
10925
- "span",
10926
- { i18n: "matches" },
10927
- "matches"
10928
10924
  ]]
10929
10925
  ]]);
10930
10926
  let center_items = [];
@@ -11450,7 +11446,7 @@ function update_find_result$1(gobj) {
11450
11446
  priv.$find_count.textContent = "";
11451
11447
  return;
11452
11448
  }
11453
- priv.$find_count.textContent = String(priv.match_count);
11449
+ priv.$find_count.textContent = (0, i18next.t)("matches", { count: priv.match_count });
11454
11450
  priv.$find_result.classList.remove("is-hidden");
11455
11451
  }
11456
11452
  /************************************************************
@@ -17368,10 +17364,6 @@ function make_find_items(gobj) {
17368
17364
  "span",
17369
17365
  { class: "GOBJ_TREE_FIND_COUNT" },
17370
17366
  ""
17371
- ], [
17372
- "span",
17373
- { i18n: "matches" },
17374
- (0, i18next.t)("matches")
17375
17367
  ]]
17376
17368
  ]];
17377
17369
  }
@@ -17404,7 +17396,7 @@ function update_find_result(gobj) {
17404
17396
  priv.$find_count.textContent = "";
17405
17397
  return;
17406
17398
  }
17407
- priv.$find_count.textContent = String(priv.match_count);
17399
+ priv.$find_count.textContent = (0, i18next.t)("matches", { count: priv.match_count });
17408
17400
  priv.$find_result.classList.remove("is-hidden");
17409
17401
  }
17410
17402
  function make_toolbar$1(gobj) {
@@ -18650,6 +18642,7 @@ function ac_language_changed$3(gobj, event, kw, src) {
18650
18642
  if ($container) (0, _yuneta_gobj_js.refresh_language)($container, i18next.t);
18651
18643
  hide_popover(gobj);
18652
18644
  refresh_tree(gobj);
18645
+ update_find_result(gobj);
18653
18646
  return 0;
18654
18647
  }
18655
18648
  /***************************
@@ -20164,11 +20157,7 @@ function build_body(shell, t) {
20164
20157
  let $count = (0, _yuneta_gobj_js.createElement2)([
20165
20158
  "span",
20166
20159
  { class: "ROUTEMAP_COUNT is-size-7 has-text-grey is-hidden" },
20167
- [$count_n, [
20168
- "span",
20169
- { i18n: "matches" },
20170
- "matches"
20171
- ]]
20160
+ [$count_n]
20172
20161
  ]);
20173
20162
  let $refs_input = (0, _yuneta_gobj_js.createElement2)(["input", {
20174
20163
  class: "ROUTEMAP_REFS_INPUT",
@@ -20206,7 +20195,7 @@ function build_body(shell, t) {
20206
20195
  if ($root_li) filter_li($root_li, q, false, __show_refs__);
20207
20196
  if (q === "") $count.classList.add("is-hidden");
20208
20197
  else {
20209
- $count_n.textContent = $tree.querySelectorAll(".ROUTEMAP_MATCH").length;
20198
+ $count_n.textContent = t("matches", { count: $tree.querySelectorAll(".ROUTEMAP_MATCH").length });
20210
20199
  $count.classList.remove("is-hidden");
20211
20200
  }
20212
20201
  };
@@ -58140,10 +58129,6 @@ function make_toolbar(gobj) {
58140
58129
  "span",
58141
58130
  { class: "GRAPH_FIND_COUNT" },
58142
58131
  ""
58143
- ], [
58144
- "span",
58145
- { i18n: "matches" },
58146
- "matches"
58147
58132
  ]]
58148
58133
  ]]
58149
58134
  ],
@@ -59199,7 +59184,7 @@ function ac_find_result(gobj, event, kw, src) {
59199
59184
  $count.textContent = "";
59200
59185
  return 0;
59201
59186
  }
59202
- $count.textContent = String(kw && kw.matches || 0);
59187
+ $count.textContent = (0, i18next.t)("matches", { count: kw && kw.matches || 0 });
59203
59188
  $result.classList.remove("is-hidden");
59204
59189
  return 0;
59205
59190
  }
@@ -10916,10 +10916,6 @@ function make_toolbar$5(gobj) {
10916
10916
  "span",
10917
10917
  { class: "JSON_GRAPH_FIND_COUNT" },
10918
10918
  ""
10919
- ], [
10920
- "span",
10921
- { i18n: "matches" },
10922
- "matches"
10923
10919
  ]]
10924
10920
  ]]);
10925
10921
  let center_items = [];
@@ -11445,7 +11441,7 @@ function update_find_result$1(gobj) {
11445
11441
  priv.$find_count.textContent = "";
11446
11442
  return;
11447
11443
  }
11448
- priv.$find_count.textContent = String(priv.match_count);
11444
+ priv.$find_count.textContent = t("matches", { count: priv.match_count });
11449
11445
  priv.$find_result.classList.remove("is-hidden");
11450
11446
  }
11451
11447
  /************************************************************
@@ -17363,10 +17359,6 @@ function make_find_items(gobj) {
17363
17359
  "span",
17364
17360
  { class: "GOBJ_TREE_FIND_COUNT" },
17365
17361
  ""
17366
- ], [
17367
- "span",
17368
- { i18n: "matches" },
17369
- t("matches")
17370
17362
  ]]
17371
17363
  ]];
17372
17364
  }
@@ -17399,7 +17391,7 @@ function update_find_result(gobj) {
17399
17391
  priv.$find_count.textContent = "";
17400
17392
  return;
17401
17393
  }
17402
- priv.$find_count.textContent = String(priv.match_count);
17394
+ priv.$find_count.textContent = t("matches", { count: priv.match_count });
17403
17395
  priv.$find_result.classList.remove("is-hidden");
17404
17396
  }
17405
17397
  function make_toolbar$1(gobj) {
@@ -18645,6 +18637,7 @@ function ac_language_changed$3(gobj, event, kw, src) {
18645
18637
  if ($container) refresh_language($container, t);
18646
18638
  hide_popover(gobj);
18647
18639
  refresh_tree(gobj);
18640
+ update_find_result(gobj);
18648
18641
  return 0;
18649
18642
  }
18650
18643
  /***************************
@@ -20159,11 +20152,7 @@ function build_body(shell, t) {
20159
20152
  let $count = createElement2([
20160
20153
  "span",
20161
20154
  { class: "ROUTEMAP_COUNT is-size-7 has-text-grey is-hidden" },
20162
- [$count_n, [
20163
- "span",
20164
- { i18n: "matches" },
20165
- "matches"
20166
- ]]
20155
+ [$count_n]
20167
20156
  ]);
20168
20157
  let $refs_input = createElement2(["input", {
20169
20158
  class: "ROUTEMAP_REFS_INPUT",
@@ -20201,7 +20190,7 @@ function build_body(shell, t) {
20201
20190
  if ($root_li) filter_li($root_li, q, false, __show_refs__);
20202
20191
  if (q === "") $count.classList.add("is-hidden");
20203
20192
  else {
20204
- $count_n.textContent = $tree.querySelectorAll(".ROUTEMAP_MATCH").length;
20193
+ $count_n.textContent = t("matches", { count: $tree.querySelectorAll(".ROUTEMAP_MATCH").length });
20205
20194
  $count.classList.remove("is-hidden");
20206
20195
  }
20207
20196
  };
@@ -58135,10 +58124,6 @@ function make_toolbar(gobj) {
58135
58124
  "span",
58136
58125
  { class: "GRAPH_FIND_COUNT" },
58137
58126
  ""
58138
- ], [
58139
- "span",
58140
- { i18n: "matches" },
58141
- "matches"
58142
58127
  ]]
58143
58128
  ]]
58144
58129
  ],
@@ -59194,7 +59179,7 @@ function ac_find_result(gobj, event, kw, src) {
59194
59179
  $count.textContent = "";
59195
59180
  return 0;
59196
59181
  }
59197
- $count.textContent = String(kw && kw.matches || 0);
59182
+ $count.textContent = t("matches", { count: kw && kw.matches || 0 });
59198
59183
  $result.classList.remove("is-hidden");
59199
59184
  return 0;
59200
59185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.39",
3
+ "version": "7.23.40",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -914,16 +914,25 @@ function make_find_items(gobj)
914
914
 
915
915
  return [
916
916
  $find_control,
917
- /* Two spans, not one string: the number is DATA and "matches"
918
- * is the word, so a language switch re-translates the half that
919
- * is a word. `display:flex` inline and NOT the `is-flex` helper
920
- * -- both Bulma helpers carry !important, so `is-hidden is-flex`
921
- * on one element is decided by stylesheet order. */
917
+ /* ONE counted span, not a number beside a word: "1 matches"
918
+ * is what two spans always produce, because nothing there can
919
+ * see the count. `t(key, {count})` picks `matches_one` for
920
+ * one and falls back to the base key for the rest, in both
921
+ * languages.
922
+ *
923
+ * And NO `i18n` attribute on it: refresh_language()
924
+ * re-translates whatever carries one by calling t() WITHOUT
925
+ * the count, which would put the plural back over the
926
+ * singular. A counted word is re-rendered by its owner
927
+ * instead -- which is why the language action below repaints
928
+ * this chip. */
929
+ /* `display:flex` inline and NOT the `is-flex` helper -- both
930
+ * Bulma helpers carry !important, so `is-hidden is-flex` on one
931
+ * element is decided by stylesheet order. */
922
932
  ['div', {class: 'GOBJ_TREE_FIND_RESULT is-hidden',
923
933
  style: 'display:flex; align-items:center; gap:.3rem; ' +
924
934
  'margin-right:.5rem; font-size:.85rem;'}, [
925
- ['span', {class: 'GOBJ_TREE_FIND_COUNT'}, ''],
926
- ['span', {i18n: 'matches'}, t('matches')]
935
+ ['span', {class: 'GOBJ_TREE_FIND_COUNT'}, '']
927
936
  ]]
928
937
  ];
929
938
  }
@@ -964,7 +973,7 @@ function update_find_result(gobj)
964
973
  priv.$find_count.textContent = "";
965
974
  return;
966
975
  }
967
- priv.$find_count.textContent = String(priv.match_count);
976
+ priv.$find_count.textContent = t("matches", {count: priv.match_count});
968
977
  priv.$find_result.classList.remove("is-hidden");
969
978
  }
970
979
 
@@ -2834,6 +2843,9 @@ function ac_language_changed(gobj, event, kw, src)
2834
2843
  }
2835
2844
  hide_popover(gobj);
2836
2845
  refresh_tree(gobj);
2846
+ /* The count chip carries a COUNTED word, which has no key for
2847
+ * refresh_language() to re-translate: its owner has to repaint it. */
2848
+ update_find_result(gobj);
2837
2849
  return 0;
2838
2850
  }
2839
2851
 
@@ -599,17 +599,25 @@ function make_toolbar(gobj)
599
599
  */
600
600
  let left_items = yui_graph_fold_items(gobj, toolbar_wide).concat([
601
601
  $find_control,
602
- /* Two spans, not one string: the number is DATA and "matches"
603
- * is the word, so a language switch re-translates the half that
604
- * is a word. `display:flex` inline and NOT the `is-flex`
605
- * helper — both Bulma helpers carry !important, so
606
- * `is-hidden is-flex` on one element is decided by stylesheet
607
- * order. */
602
+ /* ONE counted span, not a number beside a word: "1 matches"
603
+ * is what two spans always produce, because nothing there can
604
+ * see the count. `t(key, {count})` picks `matches_one` for
605
+ * one and falls back to the base key for the rest, in both
606
+ * languages.
607
+ *
608
+ * And NO `i18n` attribute on it: refresh_language()
609
+ * re-translates whatever carries one by calling t() WITHOUT
610
+ * the count, which would put the plural back over the
611
+ * singular. Nothing re-translates it, so it is repainted on
612
+ * the next find -- which is the next keystroke, and it is
613
+ * hidden while the box is empty. */
614
+ /* `display:flex` inline and NOT the `is-flex` helper — both
615
+ * Bulma helpers carry !important, so `is-hidden is-flex` on one
616
+ * element is decided by stylesheet order. */
608
617
  ['div', {class: 'JSON_GRAPH_FIND_RESULT is-hidden',
609
618
  style: 'display:flex; align-items:center; gap:.3rem; ' +
610
619
  'margin-right:.5rem; font-size:.85rem;'}, [
611
- ['span', {class: 'JSON_GRAPH_FIND_COUNT'}, ''],
612
- ['span', {i18n: 'matches'}, 'matches']
620
+ ['span', {class: 'JSON_GRAPH_FIND_COUNT'}, '']
613
621
  ]]
614
622
  ]);
615
623
  let center_items = [];
@@ -1537,7 +1545,7 @@ function update_find_result(gobj)
1537
1545
  priv.$find_count.textContent = "";
1538
1546
  return;
1539
1547
  }
1540
- priv.$find_count.textContent = String(priv.match_count);
1548
+ priv.$find_count.textContent = t("matches", {count: priv.match_count});
1541
1549
  priv.$find_result.classList.remove("is-hidden");
1542
1550
  }
1543
1551
 
@@ -649,9 +649,14 @@ function make_toolbar(gobj)
649
649
 
650
650
  let center_items = [
651
651
  $find_control,
652
- /* Two spans, not one string: the number is DATA and "matches" is
653
- * the word, so a language switch re-translates the half that is a
654
- * word. Spaced with CSS because createElement2 trims text nodes. */
652
+ /* ONE counted span, not a number beside a word: "1 matches" is
653
+ * what two spans always produce, because nothing there can see
654
+ * the count. `t(key, {count})` picks `matches_one` for one and
655
+ * falls back to the base key for the rest, in both languages.
656
+ * No `i18n` attribute on it: refresh_language() would call t()
657
+ * WITHOUT the count and put the plural back over the singular.
658
+ * Nothing re-translates it, so it is repainted on the next
659
+ * find, and it is hidden while the box is empty. */
655
660
  /* `display:flex` inline and NOT the `is-flex` helper: both Bulma
656
661
  * helpers carry !important, so `is-hidden is-flex` on one element
657
662
  * is decided by whichever lands later in the stylesheet — and the
@@ -661,8 +666,7 @@ function make_toolbar(gobj)
661
666
  ['div', {class: 'GRAPH_FIND_RESULT is-hidden',
662
667
  style: 'display:flex; align-items:center; gap:.3rem; ' +
663
668
  'margin-right:.5rem; font-size:.85rem;'}, [
664
- ['span', {class: 'GRAPH_FIND_COUNT'}, ''],
665
- ['span', {i18n: 'matches'}, 'matches']
669
+ ['span', {class: 'GRAPH_FIND_COUNT'}, '']
666
670
  ]]
667
671
  ];
668
672
 
@@ -2485,7 +2489,7 @@ function ac_find_result(gobj, event, kw, src)
2485
2489
  return 0;
2486
2490
  }
2487
2491
 
2488
- $count.textContent = String((kw && kw.matches) || 0);
2492
+ $count.textContent = t("matches", {count: (kw && kw.matches) || 0});
2489
2493
  $result.classList.remove("is-hidden");
2490
2494
  return 0;
2491
2495
  }
@@ -257,11 +257,19 @@ function build_body(shell, t)
257
257
  );
258
258
  attach_clear($search_ctrl, $search);
259
259
 
260
- /* Live match counter next to the filter. */
260
+ /* Live match counter next to the filter.
261
+ *
262
+ * ONE counted span, not a number beside a word: "1 matches" is what
263
+ * two spans always produce, because nothing there can see the
264
+ * count. `t(key, {count})` picks `matches_one` for one and falls
265
+ * back to the base key for the rest. No `i18n` attribute on it --
266
+ * refresh_language() would call t() WITHOUT the count and put the
267
+ * plural back over the singular -- so the filter, which runs on
268
+ * every keystroke, is what repaints it. */
261
269
  let $count_n = createElement2(["span", {class: "ROUTEMAP_COUNT_N"}, ""]);
262
270
  let $count = createElement2(
263
271
  ["span", {class: "ROUTEMAP_COUNT is-size-7 has-text-grey is-hidden"},
264
- [$count_n, ["span", {i18n: "matches"}, "matches"]]]
272
+ [$count_n]]
265
273
  );
266
274
  /* References are hidden by default and revealed by this toggle.
267
275
  * Remembered for the page session (not localStorage): it is a
@@ -294,7 +302,9 @@ function build_body(shell, t)
294
302
  if(q === "") {
295
303
  $count.classList.add("is-hidden");
296
304
  } else {
297
- $count_n.textContent = $tree.querySelectorAll(".ROUTEMAP_MATCH").length;
305
+ $count_n.textContent = t("matches", {
306
+ count: $tree.querySelectorAll(".ROUTEMAP_MATCH").length
307
+ });
298
308
  $count.classList.remove("is-hidden");
299
309
  }
300
310
  };