@yuneta/gobj-ui 7.23.130 → 7.23.132

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
@@ -2290,6 +2290,56 @@ too; the shell's stylesheet raises Bulma's 30% alpha to 70% (2.47:1 → 7.96 in
2290
2290
  dark) where Bulma declares the variable, since a `:root` override does not
2291
2291
  reach it.
2292
2292
 
2293
+ ### A control without a name is a bug: `title` + `aria-label`, always
2294
+
2295
+ **Every control this library draws — and every control an app draws with it —
2296
+ carries a `title` AND an `aria-label`, and both are translatable.** A control
2297
+ is any `input`, `select`, `textarea`, `button`, or anything that behaves as
2298
+ one. All four attributes are written where the control is built:
2299
+
2300
+ ```js
2301
+ ['button', {class: 'FOO_SAVE button',
2302
+ title: t('save'), 'data-i18n-title': 'save',
2303
+ 'aria-label': t('save'), 'data-i18n-aria-label': 'save'}, …]
2304
+ ```
2305
+
2306
+ It is a floor, not a preference. The ecosystem was swept against it — the
2307
+ deployed page of six SPAs, read control by control — and the target is **zero
2308
+ controls without a name**. Three things it exists to stop, each of which
2309
+ shipped:
2310
+
2311
+ | What looks like a name | Why it is not |
2312
+ |---|---|
2313
+ | A `<label>` **beside** the control (Bulma's `field`) | No `for`, no wrapping: it names the box for the eye and for nothing else |
2314
+ | `<label for="x">` over a control carrying only `name="x"` | `for` matches an **`id`**, which the control does not have — correct-looking source, no association |
2315
+ | A `placeholder` | Gone the moment something is typed; a reader need not announce it |
2316
+ | The visible text | Disappears with `is-hidden-mobile`; and where the text is the STATE (`on`/`off`), it does not say what the control DOES |
2317
+
2318
+ A `<label>` that **wraps** its control is the one shape that needs no
2319
+ `aria-label` — the label IS the accessible name. And a **literal**
2320
+ `aria-label` next to a visible `i18n` label is worse than none: it OVERRIDES
2321
+ the translated text for a reader.
2322
+
2323
+ Two things carry no attribute anyone can set, and are named after the render
2324
+ instead — and again on every rebuild, because a name written onto a widget's
2325
+ DOM is a race with the next one:
2326
+
2327
+ - **What a widget draws for itself**: Tabulator's header filters and its
2328
+ row-selection checkbox (`yui_tabulator_name_filters` /
2329
+ `yui_tabulator_name_row_selects`, hung off `columnsLoaded` and
2330
+ `renderComplete`), Tom Select's box in front of the `<select>` it hides
2331
+ (`name_form_control`).
2332
+ - **An `<option>`**, which is text like any other: it carries `data-i18n`,
2333
+ with `value` kept explicit — a translated option with no value tells the FSM
2334
+ to enter a mode that does not exist.
2335
+
2336
+ **How to check it.** Not with a grep: dump `title`/`aria-label` from the
2337
+ DEPLOYED DOM, resolve each control's name the way a reader does (`aria-label`
2338
+ → `label[for]` → a wrapping `<label>` → the text → `title` → `placeholder`),
2339
+ then switch language and diff. A key that arrives as a VARIABLE — from a data
2340
+ table, a helper's argument, a local alias of `t()` — is invisible to
2341
+ `validate-locales` and shows up only there.
2342
+
2293
2343
  ### i18n: a string must be able to CHANGE language, not just be translated once
2294
2344
 
2295
2345
  Passing a string through `t()` is **not** enough. `refresh_language()` only
@@ -18318,6 +18318,7 @@ function get_node_category(d) {
18318
18318
  ***************************************************************/
18319
18319
  var LAYOUTS = {
18320
18320
  "vertical": {
18321
+ key: "vertical tree",
18321
18322
  label: "Vertical",
18322
18323
  orientation: "V",
18323
18324
  compact: false,
@@ -18325,6 +18326,7 @@ var LAYOUTS = {
18325
18326
  edge_type: "cubic-vertical"
18326
18327
  },
18327
18328
  "vertical-compact": {
18329
+ key: "vertical tree compact",
18328
18330
  label: "Vertical compact",
18329
18331
  orientation: "V",
18330
18332
  compact: true,
@@ -18332,6 +18334,7 @@ var LAYOUTS = {
18332
18334
  edge_type: "cubic-vertical"
18333
18335
  },
18334
18336
  "horizontal": {
18337
+ key: "horizontal tree",
18335
18338
  label: "Horizontal",
18336
18339
  orientation: "H",
18337
18340
  compact: false,
@@ -18339,6 +18342,7 @@ var LAYOUTS = {
18339
18342
  edge_type: "cubic-horizontal"
18340
18343
  },
18341
18344
  "horizontal-compact": {
18345
+ key: "horizontal tree compact",
18342
18346
  label: "Horizontal compact",
18343
18347
  orientation: "H",
18344
18348
  compact: true,
@@ -18346,6 +18350,7 @@ var LAYOUTS = {
18346
18350
  edge_type: "cubic-horizontal"
18347
18351
  },
18348
18352
  "lanes-v": {
18353
+ key: "lanes vertical",
18349
18354
  label: "Lanes vertical",
18350
18355
  orientation: "V",
18351
18356
  compact: true,
@@ -18353,6 +18358,7 @@ var LAYOUTS = {
18353
18358
  edge_type: "polyline"
18354
18359
  },
18355
18360
  "lanes-h": {
18361
+ key: "lanes horizontal",
18356
18362
  label: "Lanes horizontal",
18357
18363
  orientation: "H",
18358
18364
  compact: true,
@@ -18360,6 +18366,7 @@ var LAYOUTS = {
18360
18366
  edge_type: "polyline"
18361
18367
  },
18362
18368
  "dagre-tb": {
18369
+ key: "dagre top-down",
18363
18370
  label: "Dagre (top → bottom)",
18364
18371
  orientation: "V",
18365
18372
  compact: true,
@@ -18372,6 +18379,7 @@ var LAYOUTS = {
18372
18379
  edge_type: "polyline"
18373
18380
  },
18374
18381
  "dagre-lr": {
18382
+ key: "dagre left-right",
18375
18383
  label: "Dagre (left → right)",
18376
18384
  orientation: "H",
18377
18385
  compact: true,
@@ -18740,12 +18748,16 @@ function make_toolbar$1(gobj) {
18740
18748
  center_items.push(yui_graph_refresh_item(gobj, toolbar_wide));
18741
18749
  let options = [];
18742
18750
  for (let key of Object.keys(LAYOUTS)) {
18743
- let opt_attrs = { value: key };
18751
+ let i18n_key = LAYOUTS[key].key;
18752
+ let opt_attrs = {
18753
+ value: key,
18754
+ "data-i18n": i18n_key
18755
+ };
18744
18756
  if (key === current_layout) opt_attrs.selected = "selected";
18745
18757
  options.push([
18746
18758
  "option",
18747
18759
  opt_attrs,
18748
- LAYOUTS[key].label
18760
+ (0, i18next.t)(i18n_key)
18749
18761
  ]);
18750
18762
  }
18751
18763
  let $wrap = (0, _yuneta_gobj_js.createElement2)([
@@ -18313,6 +18313,7 @@ function get_node_category(d) {
18313
18313
  ***************************************************************/
18314
18314
  var LAYOUTS = {
18315
18315
  "vertical": {
18316
+ key: "vertical tree",
18316
18317
  label: "Vertical",
18317
18318
  orientation: "V",
18318
18319
  compact: false,
@@ -18320,6 +18321,7 @@ var LAYOUTS = {
18320
18321
  edge_type: "cubic-vertical"
18321
18322
  },
18322
18323
  "vertical-compact": {
18324
+ key: "vertical tree compact",
18323
18325
  label: "Vertical compact",
18324
18326
  orientation: "V",
18325
18327
  compact: true,
@@ -18327,6 +18329,7 @@ var LAYOUTS = {
18327
18329
  edge_type: "cubic-vertical"
18328
18330
  },
18329
18331
  "horizontal": {
18332
+ key: "horizontal tree",
18330
18333
  label: "Horizontal",
18331
18334
  orientation: "H",
18332
18335
  compact: false,
@@ -18334,6 +18337,7 @@ var LAYOUTS = {
18334
18337
  edge_type: "cubic-horizontal"
18335
18338
  },
18336
18339
  "horizontal-compact": {
18340
+ key: "horizontal tree compact",
18337
18341
  label: "Horizontal compact",
18338
18342
  orientation: "H",
18339
18343
  compact: true,
@@ -18341,6 +18345,7 @@ var LAYOUTS = {
18341
18345
  edge_type: "cubic-horizontal"
18342
18346
  },
18343
18347
  "lanes-v": {
18348
+ key: "lanes vertical",
18344
18349
  label: "Lanes vertical",
18345
18350
  orientation: "V",
18346
18351
  compact: true,
@@ -18348,6 +18353,7 @@ var LAYOUTS = {
18348
18353
  edge_type: "polyline"
18349
18354
  },
18350
18355
  "lanes-h": {
18356
+ key: "lanes horizontal",
18351
18357
  label: "Lanes horizontal",
18352
18358
  orientation: "H",
18353
18359
  compact: true,
@@ -18355,6 +18361,7 @@ var LAYOUTS = {
18355
18361
  edge_type: "polyline"
18356
18362
  },
18357
18363
  "dagre-tb": {
18364
+ key: "dagre top-down",
18358
18365
  label: "Dagre (top → bottom)",
18359
18366
  orientation: "V",
18360
18367
  compact: true,
@@ -18367,6 +18374,7 @@ var LAYOUTS = {
18367
18374
  edge_type: "polyline"
18368
18375
  },
18369
18376
  "dagre-lr": {
18377
+ key: "dagre left-right",
18370
18378
  label: "Dagre (left → right)",
18371
18379
  orientation: "H",
18372
18380
  compact: true,
@@ -18735,12 +18743,16 @@ function make_toolbar$1(gobj) {
18735
18743
  center_items.push(yui_graph_refresh_item(gobj, toolbar_wide));
18736
18744
  let options = [];
18737
18745
  for (let key of Object.keys(LAYOUTS)) {
18738
- let opt_attrs = { value: key };
18746
+ let i18n_key = LAYOUTS[key].key;
18747
+ let opt_attrs = {
18748
+ value: key,
18749
+ "data-i18n": i18n_key
18750
+ };
18739
18751
  if (key === current_layout) opt_attrs.selected = "selected";
18740
18752
  options.push([
18741
18753
  "option",
18742
18754
  opt_attrs,
18743
- LAYOUTS[key].label
18755
+ t(i18n_key)
18744
18756
  ]);
18745
18757
  }
18746
18758
  let $wrap = createElement2([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.130",
3
+ "version": "7.23.132",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -448,8 +448,16 @@ function get_node_category(d)
448
448
  * g6_layout: G6 layout config object applied to the graph
449
449
  * edge_type: matching G6 edge type
450
450
  ***************************************************************/
451
+ /* `key` is the i18n key of the layout and `label` its reference ENGLISH
452
+ * wording -- the value a consumer's `en` bundle carries for that key.
453
+ *
454
+ * The keys are SHARED with the JSON graph's own picker (`vertical tree`,
455
+ * `dagre top-down`, `dagre left-right`): the two graphs sit side by side
456
+ * in the same console, so the same layout must be called the same thing
457
+ * in both -- the toolbar vocabulary rule, applied to a select. */
451
458
  const LAYOUTS = {
452
459
  "vertical": {
460
+ key: "vertical tree",
453
461
  label: "Vertical",
454
462
  orientation: "V",
455
463
  compact: false,
@@ -457,6 +465,7 @@ const LAYOUTS = {
457
465
  edge_type: 'cubic-vertical',
458
466
  },
459
467
  "vertical-compact": {
468
+ key: "vertical tree compact",
460
469
  label: "Vertical compact",
461
470
  orientation: "V",
462
471
  compact: true,
@@ -464,6 +473,7 @@ const LAYOUTS = {
464
473
  edge_type: 'cubic-vertical',
465
474
  },
466
475
  "horizontal": {
476
+ key: "horizontal tree",
467
477
  label: "Horizontal",
468
478
  orientation: "H",
469
479
  compact: false,
@@ -471,6 +481,7 @@ const LAYOUTS = {
471
481
  edge_type: 'cubic-horizontal',
472
482
  },
473
483
  "horizontal-compact": {
484
+ key: "horizontal tree compact",
474
485
  label: "Horizontal compact",
475
486
  orientation: "H",
476
487
  compact: true,
@@ -478,6 +489,7 @@ const LAYOUTS = {
478
489
  edge_type: 'cubic-horizontal',
479
490
  },
480
491
  "lanes-v": {
492
+ key: "lanes vertical",
481
493
  label: "Lanes vertical",
482
494
  orientation: "V",
483
495
  compact: true,
@@ -485,6 +497,7 @@ const LAYOUTS = {
485
497
  edge_type: 'polyline',
486
498
  },
487
499
  "lanes-h": {
500
+ key: "lanes horizontal",
488
501
  label: "Lanes horizontal",
489
502
  orientation: "H",
490
503
  compact: true,
@@ -492,6 +505,7 @@ const LAYOUTS = {
492
505
  edge_type: 'polyline',
493
506
  },
494
507
  "dagre-tb": {
508
+ key: "dagre top-down",
495
509
  label: "Dagre (top → bottom)",
496
510
  orientation: "V",
497
511
  compact: true,
@@ -499,6 +513,7 @@ const LAYOUTS = {
499
513
  edge_type: 'polyline',
500
514
  },
501
515
  "dagre-lr": {
516
+ key: "dagre left-right",
502
517
  label: "Dagre (left → right)",
503
518
  orientation: "H",
504
519
  compact: true,
@@ -1015,13 +1030,20 @@ function make_toolbar(gobj)
1015
1030
  /*
1016
1031
  * Layout selector
1017
1032
  */
1033
+ /* An <option> is text like any other, and it was the only text of
1034
+ * this window that stayed English: the labels were written into
1035
+ * LAYOUTS and put straight on the node. The KEY is the layout id --
1036
+ * the same choice the treedb graph makes for its own layouts -- and
1037
+ * `value` stays explicit, or a translated option would tell the FSM
1038
+ * to enter a layout called "Vertical compacto". */
1018
1039
  let options = [];
1019
1040
  for(let key of Object.keys(LAYOUTS)) {
1020
- let opt_attrs = {value: key};
1041
+ let i18n_key = LAYOUTS[key].key;
1042
+ let opt_attrs = {value: key, 'data-i18n': i18n_key};
1021
1043
  if(key === current_layout) {
1022
1044
  opt_attrs.selected = "selected";
1023
1045
  }
1024
- options.push(['option', opt_attrs, LAYOUTS[key].label]);
1046
+ options.push(['option', opt_attrs, t(i18n_key)]);
1025
1047
  }
1026
1048
 
1027
1049
  /* `.select` on the WRAPPER and not on the control: Bulma styles
package/src/yui_dev.js CHANGED
@@ -67,17 +67,25 @@ const TRAFFIC_TS_FIELDS = {
67
67
  * label translated once at build time would come back in English at
68
68
  * the first click. */
69
69
  /* ⚠️ The keys of this window are a BLIND SPOT for a consumer's
70
- * `validate-locales`: the table below and the `mk_expand` / `mk_dir` /
71
- * `mk_out` helpers pass their key as a VARIABLE, so a scan of `t("…")`
70
+ * `validate-locales`: the table below and the `grp` / `mk_view` /
71
+ * `mk_expand` / `mk_dir` / `mk_out` helpers pass their key as a
72
+ * VARIABLE, and `OUT_TITLES` holds three more in a lookup table --
73
+ * so they, so a scan of `t("…")`
72
74
  * sees none of them and reports OK with the whole window in English --
73
75
  * which is how it shipped in gui_agent and gui_treedb. The full set a
74
76
  * consumer must define, kept here so it can be copied:
75
77
  *
76
- * automata, creation, start / stop, subscriptions, i18n, traffic,
77
- * no poll, output, window, console, both, view, detailed, expanded,
78
- * name only, expand, schema, data, metadata, show, outgoing,
79
- * incoming, errors, find, log, traces, developer, yuno monitor,
80
- * copied, muted, unmute
78
+ * automata, both, browser console only, clear,
79
+ * clear captured traffic, compact, console, copied, copy,
80
+ * copy visible traffic to clipboard, creation, data, detailed,
81
+ * dev window and browser console, dev window only, developer,
82
+ * errors, expand, expanded, filter events / payload, find,
83
+ * hide the timers and the recurring traffic, i18n, incoming, log,
84
+ * machine trace shape, metadata, mute this message, muted,
85
+ * name only, no poll, outgoing, output, periodic, schema, show,
86
+ * show this section in the expanded view, simple mach,
87
+ * start / stop, subscriptions, traces, traffic, unmute, view,
88
+ * window, yuno monitor
81
89
  *
82
90
  * wattyzer and the yunovatios GUIs carry them; check a new consumer
83
91
  * against this list, and confirm it by DUMPING the window. */