@yuneta/gobj-ui 7.23.12 → 7.23.13
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 +13 -0
- package/dist/gobj-ui.cjs.js +41 -3
- package/dist/gobj-ui.es.js +41 -3
- package/package.json +1 -1
- package/src/c_yui_treedb_graph.js +64 -2
package/README.md
CHANGED
|
@@ -896,6 +896,19 @@ key. Leaving edition turns it off, and it is not persisted.
|
|
|
896
896
|
|
|
897
897
|
**New key for consumers: `selection mode`.**
|
|
898
898
|
|
|
899
|
+
**The two selects of the toolbar speak the app's language** (`7.23.13`). They
|
|
900
|
+
rendered their raw names — `reading`, `edition`, `dagre`, `manual` — in every
|
|
901
|
+
language, because neither went through `t()` at all: not a missing key, a
|
|
902
|
+
missing call. The label is translated and carries its own `data-i18n`, so it
|
|
903
|
+
follows a language change; the option's `value` is now set EXPLICITLY, because
|
|
904
|
+
an `<option>` with no value answers with its own text and a translated label
|
|
905
|
+
would have sent `"Edición"` to the FSM as the mode to enter.
|
|
906
|
+
|
|
907
|
+
**New keys for consumers: `reading`, `operation`, `writing`, `edition`,
|
|
908
|
+
`manual`, `dagre`, `antv-dagre`, `d3-force`, `force-atlas2`.** A host that adds
|
|
909
|
+
a layout of its own gets its name untranslated, which is what all of them got
|
|
910
|
+
until now.
|
|
911
|
+
|
|
899
912
|
### Tabs opened at runtime, and the two decisions their url costs
|
|
900
913
|
|
|
901
914
|
`yui_tab_routes.js`. A workspace whose tabs are opened by the operator —
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -53136,6 +53136,40 @@ function destroy_ui$1(gobj) {
|
|
|
53136
53136
|
}
|
|
53137
53137
|
}
|
|
53138
53138
|
/************************************************************
|
|
53139
|
+
* The label of an option of the two selects of the toolbar.
|
|
53140
|
+
*
|
|
53141
|
+
* Both of them used to render their RAW names -- `reading`,
|
|
53142
|
+
* `edition`, `dagre`, `manual` -- in every language, because
|
|
53143
|
+
* neither went through `t()` at all. Not a missing key: a
|
|
53144
|
+
* missing call.
|
|
53145
|
+
*
|
|
53146
|
+
* Written as one literal per case, and deliberately not as
|
|
53147
|
+
* `t(name)`: a consumer's `validate-locales.mjs` reads
|
|
53148
|
+
* LITERALS, so a variable key is invisible to it -- the app
|
|
53149
|
+
* ships without the entry and nothing says so, because
|
|
53150
|
+
* i18next answers an unknown key with the key itself, which
|
|
53151
|
+
* is exactly the English word that was there before. The
|
|
53152
|
+
* same reason the keys are listed in the README.
|
|
53153
|
+
*
|
|
53154
|
+
* The default is what a host that adds a layout of its own
|
|
53155
|
+
* gets: the name it chose, which is what all of them got
|
|
53156
|
+
* until now.
|
|
53157
|
+
************************************************************/
|
|
53158
|
+
function option_label(name) {
|
|
53159
|
+
switch (name) {
|
|
53160
|
+
case "reading": return (0, i18next.t)("reading");
|
|
53161
|
+
case "operation": return (0, i18next.t)("operation");
|
|
53162
|
+
case "writing": return (0, i18next.t)("writing");
|
|
53163
|
+
case "edition": return (0, i18next.t)("edition");
|
|
53164
|
+
case "manual": return (0, i18next.t)("manual");
|
|
53165
|
+
case "dagre": return (0, i18next.t)("dagre");
|
|
53166
|
+
case "antv-dagre": return (0, i18next.t)("antv-dagre");
|
|
53167
|
+
case "d3-force": return (0, i18next.t)("d3-force");
|
|
53168
|
+
case "force-atlas2": return (0, i18next.t)("force-atlas2");
|
|
53169
|
+
default: return name;
|
|
53170
|
+
}
|
|
53171
|
+
}
|
|
53172
|
+
/************************************************************
|
|
53139
53173
|
*
|
|
53140
53174
|
************************************************************/
|
|
53141
53175
|
function make_toolbar(gobj) {
|
|
@@ -53178,8 +53212,11 @@ function make_toolbar(gobj) {
|
|
|
53178
53212
|
{ class: "GRAPH_MODE_SELECT" },
|
|
53179
53213
|
modes.map((item) => [
|
|
53180
53214
|
"option",
|
|
53181
|
-
{
|
|
53182
|
-
|
|
53215
|
+
{
|
|
53216
|
+
value: item,
|
|
53217
|
+
"data-i18n": item
|
|
53218
|
+
},
|
|
53219
|
+
option_label(item)
|
|
53183
53220
|
])
|
|
53184
53221
|
]],
|
|
53185
53222
|
{ change: (evt) => {
|
|
@@ -53518,7 +53555,8 @@ function populate_nodes_tree_options(gobj) {
|
|
|
53518
53555
|
for (let name of layout_names) {
|
|
53519
53556
|
let option = document.createElement("option");
|
|
53520
53557
|
option.value = name;
|
|
53521
|
-
option.
|
|
53558
|
+
option.setAttribute("data-i18n", name);
|
|
53559
|
+
option.textContent = option_label(name);
|
|
53522
53560
|
$layout_select.appendChild(option);
|
|
53523
53561
|
}
|
|
53524
53562
|
let current_layout = (0, _yuneta_gobj_js.gobj_read_str_attr)(priv.gobj_nodes_tree, "layout");
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -53123,6 +53123,40 @@ function destroy_ui$1(gobj) {
|
|
|
53123
53123
|
}
|
|
53124
53124
|
}
|
|
53125
53125
|
/************************************************************
|
|
53126
|
+
* The label of an option of the two selects of the toolbar.
|
|
53127
|
+
*
|
|
53128
|
+
* Both of them used to render their RAW names -- `reading`,
|
|
53129
|
+
* `edition`, `dagre`, `manual` -- in every language, because
|
|
53130
|
+
* neither went through `t()` at all. Not a missing key: a
|
|
53131
|
+
* missing call.
|
|
53132
|
+
*
|
|
53133
|
+
* Written as one literal per case, and deliberately not as
|
|
53134
|
+
* `t(name)`: a consumer's `validate-locales.mjs` reads
|
|
53135
|
+
* LITERALS, so a variable key is invisible to it -- the app
|
|
53136
|
+
* ships without the entry and nothing says so, because
|
|
53137
|
+
* i18next answers an unknown key with the key itself, which
|
|
53138
|
+
* is exactly the English word that was there before. The
|
|
53139
|
+
* same reason the keys are listed in the README.
|
|
53140
|
+
*
|
|
53141
|
+
* The default is what a host that adds a layout of its own
|
|
53142
|
+
* gets: the name it chose, which is what all of them got
|
|
53143
|
+
* until now.
|
|
53144
|
+
************************************************************/
|
|
53145
|
+
function option_label(name) {
|
|
53146
|
+
switch (name) {
|
|
53147
|
+
case "reading": return t("reading");
|
|
53148
|
+
case "operation": return t("operation");
|
|
53149
|
+
case "writing": return t("writing");
|
|
53150
|
+
case "edition": return t("edition");
|
|
53151
|
+
case "manual": return t("manual");
|
|
53152
|
+
case "dagre": return t("dagre");
|
|
53153
|
+
case "antv-dagre": return t("antv-dagre");
|
|
53154
|
+
case "d3-force": return t("d3-force");
|
|
53155
|
+
case "force-atlas2": return t("force-atlas2");
|
|
53156
|
+
default: return name;
|
|
53157
|
+
}
|
|
53158
|
+
}
|
|
53159
|
+
/************************************************************
|
|
53126
53160
|
*
|
|
53127
53161
|
************************************************************/
|
|
53128
53162
|
function make_toolbar(gobj) {
|
|
@@ -53165,8 +53199,11 @@ function make_toolbar(gobj) {
|
|
|
53165
53199
|
{ class: "GRAPH_MODE_SELECT" },
|
|
53166
53200
|
modes.map((item) => [
|
|
53167
53201
|
"option",
|
|
53168
|
-
{
|
|
53169
|
-
|
|
53202
|
+
{
|
|
53203
|
+
value: item,
|
|
53204
|
+
"data-i18n": item
|
|
53205
|
+
},
|
|
53206
|
+
option_label(item)
|
|
53170
53207
|
])
|
|
53171
53208
|
]],
|
|
53172
53209
|
{ change: (evt) => {
|
|
@@ -53505,7 +53542,8 @@ function populate_nodes_tree_options(gobj) {
|
|
|
53505
53542
|
for (let name of layout_names) {
|
|
53506
53543
|
let option = document.createElement("option");
|
|
53507
53544
|
option.value = name;
|
|
53508
|
-
option.
|
|
53545
|
+
option.setAttribute("data-i18n", name);
|
|
53546
|
+
option.textContent = option_label(name);
|
|
53509
53547
|
$layout_select.appendChild(option);
|
|
53510
53548
|
}
|
|
53511
53549
|
let current_layout = gobj_read_str_attr(priv.gobj_nodes_tree, "layout");
|
package/package.json
CHANGED
|
@@ -452,6 +452,56 @@ function destroy_ui(gobj)
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
/************************************************************
|
|
456
|
+
* The label of an option of the two selects of the toolbar.
|
|
457
|
+
*
|
|
458
|
+
* Both of them used to render their RAW names -- `reading`,
|
|
459
|
+
* `edition`, `dagre`, `manual` -- in every language, because
|
|
460
|
+
* neither went through `t()` at all. Not a missing key: a
|
|
461
|
+
* missing call.
|
|
462
|
+
*
|
|
463
|
+
* Written as one literal per case, and deliberately not as
|
|
464
|
+
* `t(name)`: a consumer's `validate-locales.mjs` reads
|
|
465
|
+
* LITERALS, so a variable key is invisible to it -- the app
|
|
466
|
+
* ships without the entry and nothing says so, because
|
|
467
|
+
* i18next answers an unknown key with the key itself, which
|
|
468
|
+
* is exactly the English word that was there before. The
|
|
469
|
+
* same reason the keys are listed in the README.
|
|
470
|
+
*
|
|
471
|
+
* The default is what a host that adds a layout of its own
|
|
472
|
+
* gets: the name it chose, which is what all of them got
|
|
473
|
+
* until now.
|
|
474
|
+
************************************************************/
|
|
475
|
+
function option_label(name)
|
|
476
|
+
{
|
|
477
|
+
switch(name) {
|
|
478
|
+
/* Operation modes (`operation_modes` attr). */
|
|
479
|
+
case "reading":
|
|
480
|
+
return t("reading");
|
|
481
|
+
case "operation":
|
|
482
|
+
return t("operation");
|
|
483
|
+
case "writing":
|
|
484
|
+
return t("writing");
|
|
485
|
+
case "edition":
|
|
486
|
+
return t("edition");
|
|
487
|
+
|
|
488
|
+
/* Layouts (`layout_names` of the G6 child). */
|
|
489
|
+
case "manual":
|
|
490
|
+
return t("manual");
|
|
491
|
+
case "dagre":
|
|
492
|
+
return t("dagre");
|
|
493
|
+
case "antv-dagre":
|
|
494
|
+
return t("antv-dagre");
|
|
495
|
+
case "d3-force":
|
|
496
|
+
return t("d3-force");
|
|
497
|
+
case "force-atlas2":
|
|
498
|
+
return t("force-atlas2");
|
|
499
|
+
|
|
500
|
+
default:
|
|
501
|
+
return name;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
455
505
|
/************************************************************
|
|
456
506
|
*
|
|
457
507
|
************************************************************/
|
|
@@ -468,7 +518,14 @@ function make_toolbar(gobj)
|
|
|
468
518
|
* one that draws the create / delete / link affordances. */
|
|
469
519
|
modes = modes.filter(mode => mode !== "edition");
|
|
470
520
|
}
|
|
471
|
-
|
|
521
|
+
/* `value` EXPLICIT, and that is not decoration: an <option>
|
|
522
|
+
* with no value attribute answers with its own TEXT, so the
|
|
523
|
+
* moment the label is translated `evt.target.value` becomes
|
|
524
|
+
* "Edición" and the mode the FSM is told to enter is a word
|
|
525
|
+
* no `switch` of this gclass knows. */
|
|
526
|
+
let mode_options = modes.map(item =>
|
|
527
|
+
['option', {value: item, 'data-i18n': item}, option_label(item)]
|
|
528
|
+
);
|
|
472
529
|
|
|
473
530
|
/*
|
|
474
531
|
* Left: layout and mode selectors
|
|
@@ -876,7 +933,12 @@ function populate_nodes_tree_options(gobj)
|
|
|
876
933
|
for(let name of layout_names) {
|
|
877
934
|
let option = document.createElement('option');
|
|
878
935
|
option.value = name;
|
|
879
|
-
|
|
936
|
+
/* The key travels in the attribute so a language change
|
|
937
|
+
* re-translates it: `refresh_language()` only touches a
|
|
938
|
+
* node that carries its own key, and this select is built
|
|
939
|
+
* once, after the child answers with its layouts. */
|
|
940
|
+
option.setAttribute('data-i18n', name);
|
|
941
|
+
option.textContent = option_label(name);
|
|
880
942
|
$layout_select.appendChild(option);
|
|
881
943
|
}
|
|
882
944
|
// Restore persisted layout selection
|