@yuneta/gobj-ui 7.31.5 → 7.31.6

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
@@ -973,6 +973,19 @@ It needs the descriptor to carry `pkey2s`, which `tranger2_topic_desc()` only
973
973
  clones from **SDK > 7.13.0**. Against an older node the desc has no `pkey2s`, the
974
974
  label falls back to the id, and nothing else changes.
975
975
 
976
+ ### A topic is shown by its own name, never translated
977
+
978
+ The treedb views name each topic as the schema has it: its tab, its card, the
979
+ title of its info panel, the buttons of the dialog that asks which linked
980
+ topic to open, and the parent-filter chip. The name is an identifier, the one
981
+ the relations of a card (`↑ parents places`), the graph, the commands and the
982
+ backend use, so a translation of it in one place and the raw name in the next
983
+ reads as two different topics. Up to 7.31.5 those five places passed the name
984
+ through `t()`, and an app whose locale had a key `places: "sitios"` showed a
985
+ tab `sitios` beside a topic actually called `sites`. A locale key that matches
986
+ a topic name is now unused by the library (the validator does not complain
987
+ about it); the app may keep it for its own screens.
988
+
976
989
  ### Which backend a view browses: `source_url`
977
990
 
978
991
  `C_YUI_TREEDB_TOPICS` takes an optional **`source_url`** string and prints it in
@@ -58233,10 +58233,8 @@ function add_tab(gobj, gobj2, id, text, icon) {
58233
58233
  { class: "" },
58234
58234
  [["a", {
58235
58235
  href: id,
58236
- title: (0, i18next.t)(text),
58237
- "data-i18n-title": text,
58238
- "aria-label": (0, i18next.t)(text),
58239
- "data-i18n-aria-label": text
58236
+ title: text,
58237
+ "aria-label": text
58240
58238
  }]]
58241
58239
  ]);
58242
58240
  $tabs.appendChild($item);
@@ -58252,13 +58250,9 @@ function add_tab(gobj, gobj2, id, text, icon) {
58252
58250
  ]));
58253
58251
  $a.appendChild((0, _yuneta_gobj_js.createElement2)([
58254
58252
  "span",
58255
- {
58256
- i18n: text,
58257
- class: ""
58258
- },
58253
+ { class: "" },
58259
58254
  text_node(text)
58260
58255
  ]));
58261
- (0, _yuneta_gobj_js.refresh_language)($a, i18next.t);
58262
58256
  $a.addEventListener("click", function(ev) {
58263
58257
  ev.preventDefault();
58264
58258
  select_topic_by_id(gobj, id);
@@ -58437,10 +58431,8 @@ function add_topic_card(gobj, id, text, icon, desc) {
58437
58431
  class: "yui-nav-item yui-nav-card TREEDB_TOPIC_CARD",
58438
58432
  href: "#",
58439
58433
  "data-topic-href": id,
58440
- title: (0, i18next.t)(text),
58441
- "data-i18n-title": text,
58442
- "aria-label": (0, i18next.t)(text),
58443
- "data-i18n-aria-label": text
58434
+ title: text,
58435
+ "aria-label": text
58444
58436
  },
58445
58437
  [[
58446
58438
  "span",
@@ -58451,10 +58443,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
58451
58443
  }]]
58452
58444
  ], [
58453
58445
  "span",
58454
- {
58455
- class: "yui-nav-label",
58456
- i18n: text
58457
- },
58446
+ { class: "yui-nav-label" },
58458
58447
  text_node(text)
58459
58448
  ]]
58460
58449
  ]);
@@ -58480,10 +58469,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
58480
58469
  [
58481
58470
  [
58482
58471
  "span",
58483
- {
58484
- class: "TREEDB_TOPIC_CARD_NAME",
58485
- i18n: text
58486
- },
58472
+ { class: "TREEDB_TOPIC_CARD_NAME" },
58487
58473
  text_node(text)
58488
58474
  ],
58489
58475
  ...topic_card_meta(desc),
@@ -58777,7 +58763,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
58777
58763
  [["i", { class: "yi-circle-info" }]]
58778
58764
  ], [
58779
58765
  "span",
58780
- { i18n: `${topic}` },
58766
+ {},
58781
58767
  text_node(topic)
58782
58768
  ]]
58783
58769
  ]]
@@ -63331,14 +63317,12 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
63331
63317
  {
63332
63318
  class: "button HOOK_CHOICE_TOPIC",
63333
63319
  type: "button",
63334
- title: (0, i18next.t)(tg.topic_name),
63335
- "data-i18n-title": tg.topic_name,
63336
- "aria-label": (0, i18next.t)(tg.topic_name),
63337
- "data-i18n-aria-label": tg.topic_name
63320
+ title: tg.topic_name,
63321
+ "aria-label": tg.topic_name
63338
63322
  },
63339
63323
  [[
63340
63324
  "span",
63341
- { i18n: tg.topic_name },
63325
+ {},
63342
63326
  text_node(tg.topic_name)
63343
63327
  ]],
63344
63328
  { click: () => {
@@ -63438,8 +63422,7 @@ function render_parent_filter(gobj) {
63438
63422
  return;
63439
63423
  }
63440
63424
  let $topic = $chip.querySelector(".PARENT_FILTER_TOPIC");
63441
- $topic.setAttribute("data-i18n", pf.parent_topic);
63442
- $topic.textContent = (0, i18next.t)(pf.parent_topic);
63425
+ $topic.textContent = pf.parent_topic;
63443
63426
  $chip.querySelector(".PARENT_FILTER_ID").textContent = pf.parent_id;
63444
63427
  $chip.classList.remove("is-hidden");
63445
63428
  }
@@ -58228,10 +58228,8 @@ function add_tab(gobj, gobj2, id, text, icon) {
58228
58228
  { class: "" },
58229
58229
  [["a", {
58230
58230
  href: id,
58231
- title: t(text),
58232
- "data-i18n-title": text,
58233
- "aria-label": t(text),
58234
- "data-i18n-aria-label": text
58231
+ title: text,
58232
+ "aria-label": text
58235
58233
  }]]
58236
58234
  ]);
58237
58235
  $tabs.appendChild($item);
@@ -58247,13 +58245,9 @@ function add_tab(gobj, gobj2, id, text, icon) {
58247
58245
  ]));
58248
58246
  $a.appendChild(createElement2([
58249
58247
  "span",
58250
- {
58251
- i18n: text,
58252
- class: ""
58253
- },
58248
+ { class: "" },
58254
58249
  text_node(text)
58255
58250
  ]));
58256
- refresh_language($a, t);
58257
58251
  $a.addEventListener("click", function(ev) {
58258
58252
  ev.preventDefault();
58259
58253
  select_topic_by_id(gobj, id);
@@ -58432,10 +58426,8 @@ function add_topic_card(gobj, id, text, icon, desc) {
58432
58426
  class: "yui-nav-item yui-nav-card TREEDB_TOPIC_CARD",
58433
58427
  href: "#",
58434
58428
  "data-topic-href": id,
58435
- title: t(text),
58436
- "data-i18n-title": text,
58437
- "aria-label": t(text),
58438
- "data-i18n-aria-label": text
58429
+ title: text,
58430
+ "aria-label": text
58439
58431
  },
58440
58432
  [[
58441
58433
  "span",
@@ -58446,10 +58438,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
58446
58438
  }]]
58447
58439
  ], [
58448
58440
  "span",
58449
- {
58450
- class: "yui-nav-label",
58451
- i18n: text
58452
- },
58441
+ { class: "yui-nav-label" },
58453
58442
  text_node(text)
58454
58443
  ]]
58455
58444
  ]);
@@ -58475,10 +58464,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
58475
58464
  [
58476
58465
  [
58477
58466
  "span",
58478
- {
58479
- class: "TREEDB_TOPIC_CARD_NAME",
58480
- i18n: text
58481
- },
58467
+ { class: "TREEDB_TOPIC_CARD_NAME" },
58482
58468
  text_node(text)
58483
58469
  ],
58484
58470
  ...topic_card_meta(desc),
@@ -58772,7 +58758,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
58772
58758
  [["i", { class: "yi-circle-info" }]]
58773
58759
  ], [
58774
58760
  "span",
58775
- { i18n: `${topic}` },
58761
+ {},
58776
58762
  text_node(topic)
58777
58763
  ]]
58778
58764
  ]]
@@ -63326,14 +63312,12 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
63326
63312
  {
63327
63313
  class: "button HOOK_CHOICE_TOPIC",
63328
63314
  type: "button",
63329
- title: t(tg.topic_name),
63330
- "data-i18n-title": tg.topic_name,
63331
- "aria-label": t(tg.topic_name),
63332
- "data-i18n-aria-label": tg.topic_name
63315
+ title: tg.topic_name,
63316
+ "aria-label": tg.topic_name
63333
63317
  },
63334
63318
  [[
63335
63319
  "span",
63336
- { i18n: tg.topic_name },
63320
+ {},
63337
63321
  text_node(tg.topic_name)
63338
63322
  ]],
63339
63323
  { click: () => {
@@ -63433,8 +63417,7 @@ function render_parent_filter(gobj) {
63433
63417
  return;
63434
63418
  }
63435
63419
  let $topic = $chip.querySelector(".PARENT_FILTER_TOPIC");
63436
- $topic.setAttribute("data-i18n", pf.parent_topic);
63437
- $topic.textContent = t(pf.parent_topic);
63420
+ $topic.textContent = pf.parent_topic;
63438
63421
  $chip.querySelector(".PARENT_FILTER_ID").textContent = pf.parent_id;
63439
63422
  $chip.classList.remove("is-hidden");
63440
63423
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.31.5",
3
+ "version": "7.31.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/gobj-ui.cjs.js",
@@ -3232,18 +3232,17 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook)
3232
3232
  log_error(`${gobj_short_name(gobj)}: no shell, cannot ask which topic to open`);
3233
3233
  return;
3234
3234
  }
3235
- /* The topic names are KEYS, translated like the tabs that name them. */
3235
+ /* The topic names are shown as the schema has them, untranslated,
3236
+ * like the tabs that name them. */
3236
3237
  let $body = createElement2(
3237
3238
  ['div', {class: 'TREEDB_HOOK_CHOICE'}, targets.map((tg) => {
3238
3239
  return ['button', {
3239
3240
  class: 'button HOOK_CHOICE_TOPIC',
3240
3241
  type: 'button',
3241
- title: t(tg.topic_name),
3242
- 'data-i18n-title': tg.topic_name,
3243
- 'aria-label': t(tg.topic_name),
3244
- 'data-i18n-aria-label': tg.topic_name
3242
+ title: tg.topic_name,
3243
+ 'aria-label': tg.topic_name
3245
3244
  }, [
3246
- ['span', {i18n: tg.topic_name}, text_node(tg.topic_name)]
3245
+ ['span', {}, text_node(tg.topic_name)]
3247
3246
  ], {
3248
3247
  click: () => {
3249
3248
  gobj_send_event(gobj, "EV_CHOOSE_LINKED", {
@@ -3372,8 +3371,7 @@ function render_parent_filter(gobj)
3372
3371
  return;
3373
3372
  }
3374
3373
  let $topic = $chip.querySelector(".PARENT_FILTER_TOPIC");
3375
- $topic.setAttribute("data-i18n", pf.parent_topic);
3376
- $topic.textContent = t(pf.parent_topic);
3374
+ $topic.textContent = pf.parent_topic;
3377
3375
  $chip.querySelector(".PARENT_FILTER_ID").textContent = pf.parent_id;
3378
3376
  $chip.classList.remove("is-hidden");
3379
3377
  }
@@ -4716,7 +4714,7 @@ function ac_show_hook_data(gobj, event, kw, src)
4716
4714
  String(kw.row_id), kw.col_id);
4717
4715
  return 0;
4718
4716
  }
4719
- open_hook_choice_dialog(gobj, /* i18n: data */ targets, String(kw.row_id), kw.col_id); // the schema's topics
4717
+ open_hook_choice_dialog(gobj, targets, String(kw.row_id), kw.col_id);
4720
4718
  return 0;
4721
4719
  }
4722
4720
 
@@ -594,13 +594,12 @@ function add_tab(gobj, gobj2, id, text, icon)
594
594
  /*
595
595
  * Create li a
596
596
  */
597
- /* A tab is a control: its title and its name, each with its key
598
- * (the topic's), as every control of the library carries. */
597
+ /* A tab is a control: it carries a title and a name. Both are the
598
+ * topic's own name, untranslated: it is the schema's identifier, the
599
+ * one the relations, the graph and the backend speak. */
599
600
  let $item = createElement2(
600
601
  ['li', {class: ''}, [ // is-active
601
- ['a', {href: id,
602
- title: t(text), 'data-i18n-title': text,
603
- 'aria-label': t(text), 'data-i18n-aria-label': text}]
602
+ ['a', {href: id, title: text, 'aria-label': text}]
604
603
  ]]
605
604
  );
606
605
  $tabs.appendChild($item);
@@ -628,19 +627,9 @@ function add_tab(gobj, gobj2, id, text, icon)
628
627
  * TAB: Add text
629
628
  */
630
629
  $a.appendChild(
631
- createElement2(['span', {i18n: text, class: ''}, text_node(text)])
630
+ createElement2(['span', {class: ''}, text_node(text)])
632
631
  );
633
632
 
634
- /*
635
- * Translate the tab NOW. The span carries data-i18n but its
636
- * initial text is the raw key (the topic_name). Tabs are built
637
- * lazily when topic descriptions arrive from the backend —
638
- * AFTER the host's one-time refresh_language($container,t) —
639
- * so without this they stay as raw keys ("groups", …).
640
- * `t` is the i18next translator already imported here.
641
- */
642
- refresh_language($a, t);
643
-
644
633
  /*
645
634
  * Self-contained tab navigation. The `href` is kept only as a
646
635
  * stable id (remove_tab selects by it); intercept the click so
@@ -827,11 +816,10 @@ function add_topic_card(gobj, id, text, icon, desc)
827
816
  let $card = createElement2(
828
817
  ['a', {class: 'yui-nav-item yui-nav-card TREEDB_TOPIC_CARD',
829
818
  href: '#', 'data-topic-href': id,
830
- title: t(text), 'data-i18n-title': text,
831
- 'aria-label': t(text), 'data-i18n-aria-label': text}, [
819
+ title: text, 'aria-label': text}, [
832
820
  ['span', {class: 'icon is-medium'}, [['i', {class: icon || 'yi-table',
833
821
  'aria-hidden': 'true'}]]],
834
- ['span', {class: 'yui-nav-label', i18n: text}, text_node(text)]
822
+ ['span', {class: 'yui-nav-label'}, text_node(text)]
835
823
  ]]
836
824
  );
837
825
  $card.addEventListener("click", function(ev) {
@@ -868,7 +856,7 @@ function add_topic_card(gobj, id, text, icon, desc)
868
856
 
869
857
  let $card = createElement2(
870
858
  ['div', {class: 'TREEDB_TOPIC_CARD', 'data-topic': topic}, [
871
- ['span', {class: 'TREEDB_TOPIC_CARD_NAME', i18n: text}, text_node(text)],
859
+ ['span', {class: 'TREEDB_TOPIC_CARD_NAME'}, text_node(text)],
872
860
  ...topic_card_meta(desc),
873
861
  ['div', {class: 'TREEDB_TOPIC_CARD_ACTIONS'}, actions]
874
862
  ]]
@@ -1218,7 +1206,7 @@ function build_topic_info_panel(gobj, $info, topic, desc)
1218
1206
  ["h3", {class: "TREEDB_TOPIC_INFO_TITLE title is-5"}, [
1219
1207
  ["span", {class: "icon-text"}, [
1220
1208
  ["span", {class: "icon"}, [["i", {class: "yi-circle-info"}]]],
1221
- ["span", {i18n: `${topic}`}, text_node(topic)]
1209
+ ["span", {}, text_node(topic)]
1222
1210
  ]]
1223
1211
  ]],
1224
1212
  ["table", {class: "table is-narrow TREEDB_TOPIC_INFO_META mb-4"}, [
@@ -1374,9 +1362,8 @@ function process_treedb_descs(gobj)
1374
1362
  );
1375
1363
 
1376
1364
  // TODO get icon from remote config
1377
- /* `key` is a topic of the backend's schema: data */
1378
- add_tab(gobj, gobj_topic_form, id, /* i18n: data */ key, "yi-table");
1379
- add_topic_card(gobj, id, /* i18n: data */ key, "yi-table", desc);
1365
+ add_tab(gobj, gobj_topic_form, id, key, "yi-table");
1366
+ add_topic_card(gobj, id, key, "yi-table", desc);
1380
1367
 
1381
1368
  gobj_start(gobj_topic_form);
1382
1369
  }
@@ -1397,7 +1384,7 @@ function process_treedb_descs(gobj)
1397
1384
  if(gobj.priv._pending_info) {
1398
1385
  let ti = gobj.priv._pending_info;
1399
1386
  gobj.priv._pending_info = null;
1400
- show_topic_info(gobj, /* i18n: data */ ti); // a topic name
1387
+ show_topic_info(gobj, ti);
1401
1388
  } else if(href && href.indexOf("?") >= 0) {
1402
1389
  gobj_send_event(gobj, "EV_SHOW", {href: href}, gobj);
1403
1390
  } else {
@@ -2764,7 +2751,7 @@ function ac_show(gobj, event, kw, src)
2764
2751
  ************************************************************/
2765
2752
  function ac_show_topic_info(gobj, event, kw, src)
2766
2753
  {
2767
- show_topic_info(gobj, /* i18n: data */ kw && kw.topic); // a topic name
2754
+ show_topic_info(gobj, kw && kw.topic);
2768
2755
  return 0;
2769
2756
  }
2770
2757
 
@@ -202,18 +202,12 @@ export const I18N_KEY_FUNCTIONS = Object.freeze([
202
202
  {module: "c_yui_treedb_topics.js", name: "card_action_anchor", exported: false, keys: ["2"]},
203
203
  {module: "c_yui_treedb_topics.js", name: "push_meta", exported: false, keys: ["0"]},
204
204
  {module: "c_yui_treedb_topics.js", name: "relation", exported: false, keys: ["1"]},
205
- {module: "c_yui_treedb_topics.js", name: "add_tab", exported: false, keys: ["3"]},
206
- {module: "c_yui_treedb_topics.js", name: "add_topic_card", exported: false, keys: ["2"]},
207
- {module: "c_yui_treedb_topics.js", name: "show_topic_info", exported: false, keys: ["1"]},
208
- {module: "c_yui_treedb_topics.js", name: "build_topic_info_panel", exported: false, keys: ["2"]},
209
205
  {module: "c_yui_treedb_topic_with_form.js", name: "confirm_then", exported: false, keys: ["1"]},
210
206
  {module: "c_yui_treedb_topic_with_form.js", name: "present_json_popup", exported: false,
211
207
  keys: ["1", "2.title"]},
212
208
  {module: "c_yui_treedb_topic_with_form.js", name: "col_title_formatter", exported: false, keys: ["1.id"]},
213
209
  {module: "c_yui_treedb_topic_with_form.js", name: "open_cell_json_dialog", exported: false, keys: ["2"]},
214
210
  {module: "c_yui_treedb_topic_with_form.js", name: "open_cell_file_dialog", exported: false, keys: ["2"]},
215
- {module: "c_yui_treedb_topic_with_form.js", name: "open_hook_choice_dialog", exported: false,
216
- keys: ["1[].topic_name"]},
217
211
  {module: "c_yui_schema_editor.js", name: "show_notice", exported: false, keys: ["1", "2"]},
218
212
  {module: "c_yui_schema_editor.js", name: "toolbar_button", exported: false, keys: ["2"]},
219
213
  {module: "c_yui_schema_editor.js", name: "row_icon", exported: false, keys: ["3"]},
@@ -1207,11 +1207,13 @@ describe("every forwarder is in the table", () => {
1207
1207
  });
1208
1208
 
1209
1209
  test("the 17 functions that were missing are found, with the table as it was", () => {
1210
+ /* Three of the 17 are gone: add_tab, add_topic_card and
1211
+ * build_topic_info_panel stopped translating the topic name (7.31.6),
1212
+ * so they hand no key on any more. */
1210
1213
  let names = ["name_form_control", "create_form_field", "item_li", "item_iconbar",
1211
1214
  "build_toolbar_action_item", "build_toolbar_brand_item", "build_toolbar_avatar_item",
1212
1215
  "build_toolbar_connection_item", "open_toolbar_dropdown", "build_dropdown_row",
1213
- "col_title_formatter", "add_tab", "add_topic_card", "build_topic_info_panel",
1214
- "card_descriptor", "render_node"];
1216
+ "col_title_formatter", "card_descriptor", "render_node"];
1215
1217
  let before = I18N_KEY_FUNCTIONS.filter((e) => !names.includes(e.name));
1216
1218
  let found = find_forwarders(MODULES, ast_of, before);
1217
1219
  let missing = new Set(found.missing.map((m) => m.name));
@@ -287,7 +287,7 @@ describe("the buttons of a file field", () => {
287
287
  });
288
288
 
289
289
  describe("a topic tab of the treedb view", () => {
290
- test("carries a title and an aria-label, with the topic as key", () => {
290
+ test("carries a title and an aria-label: the topic's own name, never translated", () => {
291
291
  const remote = gobj_create_service(`tremote${++seq}`, "C_TEST_NAMED_REMOTE", {}, yuno);
292
292
  gobj_change_state(remote, "ST_SESSION");
293
293
  expect(gobj_current_state(remote)).toBe("ST_SESSION");
@@ -309,7 +309,13 @@ describe("a topic tab of the treedb view", () => {
309
309
  }, remote);
310
310
 
311
311
  const $tab = gobj_read_attr(topics, "$container").querySelector(`a[href="ttopics${seq}?users"]`);
312
- expect_named($tab, "users");
312
+ expect(!!$tab, "the tab is drawn").toBe(true);
313
+ expect($tab.getAttribute("title")).toBe("users");
314
+ expect($tab.getAttribute("aria-label")).toBe("users");
315
+ expect($tab.hasAttribute("data-i18n-title")).toBe(false);
316
+ expect($tab.hasAttribute("data-i18n-aria-label")).toBe(false);
317
+ expect($tab.querySelector("[data-i18n]")).toBe(null);
318
+ expect($tab.textContent.trim()).toBe("users");
313
319
  });
314
320
  });
315
321