@yuneta/gobj-ui 7.26.30 → 7.26.32
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 +246 -72
- package/dist/gobj-ui.cjs.js +64 -20
- package/dist/gobj-ui.es.js +64 -20
- package/package.json +1 -1
- package/scripts/validate-locales.mjs +1755 -328
- package/src/c_g6_nodes_tree.js +6 -4
- package/src/c_yui_form.js +17 -4
- package/src/c_yui_treedb_graph.js +6 -3
- package/src/c_yui_treedb_topics.js +6 -3
- package/src/c_yui_window.js +32 -5
- package/src/i18n_key_functions.js +54 -31
- package/src/i18n_key_functions.test.js +461 -49
- package/src/window_layer.wiring.test.js +106 -0
- package/src/yui_table_select.js +20 -13
- package/src/yui_tabulator_i18n.js +10 -2
- package/src/yui_tabulator_i18n.test.js +80 -0
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -5295,10 +5295,12 @@ function name_form_control(parent, control)
|
|
|
5295
5295
|
}
|
|
5296
5296
|
control.id = 'g6-form-control-' + (++form_control_seq);
|
|
5297
5297
|
label.htmlFor = control.id;
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
control.setAttribute('
|
|
5301
|
-
control.setAttribute('data-i18n-
|
|
5298
|
+
/* The label's own key, read back from its DOM: it was read where the
|
|
5299
|
+
* label was built */
|
|
5300
|
+
control.setAttribute('title', t(/* i18n: data */ key));
|
|
5301
|
+
control.setAttribute('data-i18n-title', /* i18n: data */ key);
|
|
5302
|
+
control.setAttribute('aria-label', t(/* i18n: data */ key));
|
|
5303
|
+
control.setAttribute('data-i18n-aria-label', /* i18n: data */ key);
|
|
5302
5304
|
}
|
|
5303
5305
|
|
|
5304
5306
|
function create_form_color_input(parent, value, onInput)
|
package/src/c_yui_form.js
CHANGED
|
@@ -688,6 +688,12 @@ function name_form_control($field, conf)
|
|
|
688
688
|
$control.setAttribute("aria-label", t(key));
|
|
689
689
|
$control.setAttribute("data-i18n-aria-label", key);
|
|
690
690
|
}
|
|
691
|
+
/* And its title, as every control carries: the label sits apart
|
|
692
|
+
* from the box, and a narrow form takes it to another line. */
|
|
693
|
+
if($control && !$control.getAttribute("title")) {
|
|
694
|
+
$control.setAttribute("title", t(key));
|
|
695
|
+
$control.setAttribute("data-i18n-title", key);
|
|
696
|
+
}
|
|
691
697
|
|
|
692
698
|
/* Tom Select HIDES the <select> it is given (`ts-hidden-accessible`)
|
|
693
699
|
* and draws its own text box in front of it. Naming the original
|
|
@@ -700,6 +706,10 @@ function name_form_control($field, conf)
|
|
|
700
706
|
$ts.setAttribute("aria-label", t(key));
|
|
701
707
|
$ts.setAttribute("data-i18n-aria-label", key);
|
|
702
708
|
}
|
|
709
|
+
if($ts && !$ts.getAttribute("title")) {
|
|
710
|
+
$ts.setAttribute("title", t(key));
|
|
711
|
+
$ts.setAttribute("data-i18n-title", key);
|
|
712
|
+
}
|
|
703
713
|
|
|
704
714
|
/* The ✕ of the clear_button plugin is drawn by Tom Select too, with a
|
|
705
715
|
* title written once with t() and no key: named here, after the
|
|
@@ -793,11 +803,12 @@ function build_html_form(gobj, $form, prefix, template)
|
|
|
793
803
|
: [field_desc.name];
|
|
794
804
|
const NO_I18N = "\x00";
|
|
795
805
|
html_field_conf.label = t(label_keys, {defaultValue: field_desc.header});
|
|
806
|
+
/* A column of the template: the host's schema, data */
|
|
796
807
|
html_field_conf.label_i18n =
|
|
797
|
-
(t(field_desc.name, {defaultValue: NO_I18N}) !== NO_I18N)
|
|
808
|
+
(t(/* i18n: data */ field_desc.name, {defaultValue: NO_I18N}) !== NO_I18N)
|
|
798
809
|
? field_desc.name
|
|
799
810
|
: null;
|
|
800
|
-
html_field_conf.placeholder = field_desc.placeholder?t(field_desc.placeholder):'';
|
|
811
|
+
html_field_conf.placeholder = field_desc.placeholder?t(/* i18n: data */ field_desc.placeholder):'';
|
|
801
812
|
|
|
802
813
|
let placeholders = gobj_read_attr(gobj, "placeholders");
|
|
803
814
|
if(placeholders[key]) {
|
|
@@ -2052,6 +2063,8 @@ function create_coordinates(gobj, attrs)
|
|
|
2052
2063
|
* froze in the language it was built in. */
|
|
2053
2064
|
placeholder: t('coordinates...'),
|
|
2054
2065
|
'data-i18n-placeholder': 'coordinates...',
|
|
2066
|
+
title: t('coordinates'),
|
|
2067
|
+
'data-i18n-title': 'coordinates',
|
|
2055
2068
|
'aria-label': t('coordinates'),
|
|
2056
2069
|
'data-i18n-aria-label': 'coordinates'},
|
|
2057
2070
|
'',
|
|
@@ -2237,7 +2250,7 @@ function template2columns(gobj, columns, template, sub_elements)
|
|
|
2237
2250
|
let validator = [];
|
|
2238
2251
|
let column = {
|
|
2239
2252
|
field: field_desc.name,
|
|
2240
|
-
title: t(field_desc.header || field_desc.name),
|
|
2253
|
+
title: t(/* i18n: data */ field_desc.header || field_desc.name), // the host's schema
|
|
2241
2254
|
titleFormatter: text_title_formatter,
|
|
2242
2255
|
editable: get_editable_state,
|
|
2243
2256
|
editor: false,
|
|
@@ -2614,7 +2627,7 @@ function mark_field_validity($input)
|
|
|
2614
2627
|
if($h) {
|
|
2615
2628
|
let key = field_validation_key($input);
|
|
2616
2629
|
if(key) {
|
|
2617
|
-
$h.setAttribute('data-i18n', key);
|
|
2630
|
+
$h.setAttribute('data-i18n', /* i18n: C_YUI_FORM_I18N_KEYS, FORM_JSON_FIELD_I18N_KEYS */ key);
|
|
2618
2631
|
} else {
|
|
2619
2632
|
$h.removeAttribute('data-i18n'); // the browser's own sentence
|
|
2620
2633
|
}
|
|
@@ -1367,7 +1367,9 @@ function answer_print_tranger_refused(gobj, path, answer)
|
|
|
1367
1367
|
|
|
1368
1368
|
/************************************************************
|
|
1369
1369
|
* The text of a transport's refusal: gobj_command() answers a string,
|
|
1370
|
-
* a command response or a number.
|
|
1370
|
+
* a command response or a number. Data only ("" when it says
|
|
1371
|
+
* nothing): the caller writes its own key as the fallback, where
|
|
1372
|
+
* validate-locales reads it.
|
|
1371
1373
|
************************************************************/
|
|
1372
1374
|
function refusal_text(ret)
|
|
1373
1375
|
{
|
|
@@ -1377,7 +1379,7 @@ function refusal_text(ret)
|
|
|
1377
1379
|
if(ret && typeof ret === "object" && typeof ret.comment === "string" && ret.comment) {
|
|
1378
1380
|
return ret.comment;
|
|
1379
1381
|
}
|
|
1380
|
-
return "
|
|
1382
|
+
return "";
|
|
1381
1383
|
}
|
|
1382
1384
|
|
|
1383
1385
|
/************************************************************
|
|
@@ -1412,7 +1414,8 @@ function request_print_tranger(gobj, path)
|
|
|
1412
1414
|
}, gobj);
|
|
1413
1415
|
if(ret) {
|
|
1414
1416
|
log_error(ret);
|
|
1415
|
-
answer_print_tranger_refused(gobj, path,
|
|
1417
|
+
answer_print_tranger_refused(gobj, path,
|
|
1418
|
+
{error: /* i18n: data */ refusal_text(ret) || "print-tranger failed"});
|
|
1416
1419
|
return;
|
|
1417
1420
|
}
|
|
1418
1421
|
if(path) {
|
|
@@ -2230,7 +2230,9 @@ function answer_print_tranger_refused(gobj, path, answer)
|
|
|
2230
2230
|
|
|
2231
2231
|
/************************************************************
|
|
2232
2232
|
* The text of a transport's refusal: gobj_command() answers a string,
|
|
2233
|
-
* a command response or a number.
|
|
2233
|
+
* a command response or a number. Data only ("" when it says
|
|
2234
|
+
* nothing): the caller writes its own key as the fallback, where
|
|
2235
|
+
* validate-locales reads it.
|
|
2234
2236
|
************************************************************/
|
|
2235
2237
|
function refusal_text(ret)
|
|
2236
2238
|
{
|
|
@@ -2240,7 +2242,7 @@ function refusal_text(ret)
|
|
|
2240
2242
|
if(ret && typeof ret === "object" && typeof ret.comment === "string" && ret.comment) {
|
|
2241
2243
|
return ret.comment;
|
|
2242
2244
|
}
|
|
2243
|
-
return "
|
|
2245
|
+
return "";
|
|
2244
2246
|
}
|
|
2245
2247
|
|
|
2246
2248
|
/************************************************************
|
|
@@ -2274,7 +2276,8 @@ function request_print_tranger(gobj, path)
|
|
|
2274
2276
|
}, gobj);
|
|
2275
2277
|
if(ret) {
|
|
2276
2278
|
log_error(ret);
|
|
2277
|
-
answer_print_tranger_refused(gobj, path,
|
|
2279
|
+
answer_print_tranger_refused(gobj, path,
|
|
2280
|
+
{error: /* i18n: data */ refusal_text(ret) || "print-tranger failed"});
|
|
2278
2281
|
return;
|
|
2279
2282
|
}
|
|
2280
2283
|
if(path) {
|
package/src/c_yui_window.js
CHANGED
|
@@ -81,7 +81,7 @@ const MOBILE_MAX = 768;
|
|
|
81
81
|
***************************************************************/
|
|
82
82
|
const attrs_table = [
|
|
83
83
|
SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
|
|
84
|
-
SDATA(data_type_t.DTP_POINTER, "$parent", 0, null, "$container will be appended to $parent if not null, else to document.body"),
|
|
84
|
+
SDATA(data_type_t.DTP_POINTER, "$parent", 0, null, "$container will be appended to $parent if not null, else to the overlay layer of the shell (document.body when there is none)"),
|
|
85
85
|
SDATA(data_type_t.DTP_INTEGER, "x", 0, "300", "X position"),
|
|
86
86
|
SDATA(data_type_t.DTP_INTEGER, "y", 0, "100", "Y position"),
|
|
87
87
|
SDATA(data_type_t.DTP_INTEGER, "width", 0, "700", "Width of the window"),
|
|
@@ -724,11 +724,10 @@ function build_ui(gobj)
|
|
|
724
724
|
refresh_language($container, t);
|
|
725
725
|
|
|
726
726
|
let $parent = gobj_read_attr(gobj, "$parent");
|
|
727
|
-
if(
|
|
728
|
-
$parent
|
|
729
|
-
} else {
|
|
730
|
-
document.body.appendChild($container);
|
|
727
|
+
if(!$parent) {
|
|
728
|
+
$parent = default_parent(gobj);
|
|
731
729
|
}
|
|
730
|
+
$parent.appendChild($container);
|
|
732
731
|
|
|
733
732
|
if (gobj_read_bool_attr(gobj, "openMaximized")) {
|
|
734
733
|
max(gobj);
|
|
@@ -860,6 +859,34 @@ function close_window(gobj)
|
|
|
860
859
|
return {state: "asking", answer: answer};
|
|
861
860
|
}
|
|
862
861
|
|
|
862
|
+
/************************************************************
|
|
863
|
+
* Where a window lives when its host names no `$parent`: the
|
|
864
|
+
* OVERLAY layer of the shell -- above the content, below the
|
|
865
|
+
* toolbar's dropdowns, the dialogs and the toasts.
|
|
866
|
+
*
|
|
867
|
+
* It used to be document.body, and that put every window above
|
|
868
|
+
* the WHOLE shell: `.yui-shell` is position:fixed, a stacking
|
|
869
|
+
* context of its own, so the z-index of its modal layer (99)
|
|
870
|
+
* counted only inside it, and a window at z-index 11 on the body
|
|
871
|
+
* covered it. The confirmation a window's own close asks ("all
|
|
872
|
+
* changes will be lost") opened UNDER the window that asked it,
|
|
873
|
+
* where no click could reach it; a toast, a dropdown of the
|
|
874
|
+
* toolbar, any dialog opened with a window on screen, the same.
|
|
875
|
+
*
|
|
876
|
+
* Inside the layer the dock's z-index still orders the windows
|
|
877
|
+
* among themselves. No shell (a page with windows and no shell):
|
|
878
|
+
* the body, as before.
|
|
879
|
+
************************************************************/
|
|
880
|
+
function default_parent(gobj)
|
|
881
|
+
{
|
|
882
|
+
let shell = yui_shell_of(gobj);
|
|
883
|
+
let layers = shell && shell.priv && shell.priv.layers;
|
|
884
|
+
if(layers && layers.overlay) {
|
|
885
|
+
return layers.overlay;
|
|
886
|
+
}
|
|
887
|
+
return document.body;
|
|
888
|
+
}
|
|
889
|
+
|
|
863
890
|
/************************************************************
|
|
864
891
|
*
|
|
865
892
|
************************************************************/
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
* of the array `actions`
|
|
31
31
|
* A position may also hold DOM or nothing: only
|
|
32
32
|
* a string there is a key. DOM is an array (a
|
|
33
|
-
* createElement2 spec
|
|
33
|
+
* createElement2 spec; an array of string
|
|
34
|
+
* literals is none), a call of createElement2(),
|
|
34
35
|
* createOneHtml() or html_markup() of gobj-js, of
|
|
35
36
|
* text_node() of gobj-ui, of document.createElement()
|
|
36
37
|
* and the like, a const bound to one, a plain `let`
|
|
@@ -39,43 +40,64 @@
|
|
|
39
40
|
*
|
|
40
41
|
* What is read at a position: a string literal, a template with
|
|
41
42
|
* no `${}`, every branch of a `?:`, `||`, `??` (the right one of
|
|
42
|
-
* `&&`), and what the reader follows -- a const to its value
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* a
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
43
|
+
* `&&`), and what the reader follows -- a const to its value (what
|
|
44
|
+
* a destructuring reads from it too), an import of a const or a
|
|
45
|
+
* function of a module the reader reads, a property of a const
|
|
46
|
+
* object or of a copy of one (`{...o}`), the element of a const
|
|
47
|
+
* array a `.map()` or a for...of walks (and what a destructuring
|
|
48
|
+
* reads from it), String(x) and `${x}` as x, the default of a
|
|
49
|
+
* parameter, a call of a function -- of the module or imported --
|
|
50
|
+
* whose every return is one of these (read once; a recursion is
|
|
51
|
+
* not followed). A `let`, a parameter or data is not read: its
|
|
52
|
+
* keys are published in an exported `<NAME>_I18N_KEYS` array (an
|
|
53
|
+
* `export const`, never mutated), and the call is MARKED with a
|
|
54
|
+
* comment right before what it hands over, `i18n: <NAME>_I18N_KEYS`
|
|
55
|
+
* (the list) or `i18n: data` (no key a list can hold). A marked
|
|
56
|
+
* `let` is held to its marker: every literal it is given is read
|
|
57
|
+
* and must be in the list, and one given nothing but literals fails
|
|
58
|
+
* (write it as a const, which the reader follows). A `data` marker
|
|
59
|
+
* on what the reader follows to keys and nothing else -- a
|
|
60
|
+
* literal, a const or a branch that is one, a call that returns
|
|
61
|
+
* literals -- fails too: it claims data where the reader reads a
|
|
62
|
+
* key; and so does one that would hide a key the reader does not
|
|
63
|
+
* read: a call whose returns mix keys with data, an array of
|
|
64
|
+
* string literals.
|
|
65
|
+
*
|
|
66
|
+
* A call reaches a function of this table however it names it:
|
|
67
|
+
* its name, an import under any name, a re-export, a const alias,
|
|
68
|
+
* a map (`API.info(...)`), `.call()`, `.apply()`.
|
|
58
69
|
*
|
|
59
70
|
* The rule, per CALL: a key position given anything else than a
|
|
60
71
|
* literal (or DOM, or nothing), a const the reader follows, a key
|
|
61
72
|
* position of the enclosing table function handed on, or a marked
|
|
62
|
-
* value fails, with the file and the line; a TRANSLATED text
|
|
63
|
-
* t("..."),
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
73
|
+
* value fails, with the file and the line; a TRANSLATED text --
|
|
74
|
+
* t("..."), tr(), an alias of t, `t?.()`, `t.call()` -- fails even
|
|
75
|
+
* marked (it would be translated again, and never change
|
|
76
|
+
* language). A test (i18n_key_functions.test.js) holds the library
|
|
77
|
+
* to it, and validate-locales an app's own code. Publishing a list
|
|
78
|
+
* exempts no module.
|
|
67
79
|
*
|
|
68
|
-
* The table is COMPLETE, and the same test proves
|
|
69
|
-
*
|
|
70
|
-
* -- or what it reads from one
|
|
71
|
-
* `
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
80
|
+
* The table is COMPLETE and CORRECT, and the same test proves both
|
|
81
|
+
* (REV-CLOUD V21.4.1, V22): it finds every function of the library
|
|
82
|
+
* that hands one of its parameters -- or what it reads from one:
|
|
83
|
+
* `opts.title`, `opts?.title`, a destructured `{label}` (in the
|
|
84
|
+
* parameter or in the body), each `items[].name`, `arguments[1]`,
|
|
85
|
+
* `rest[0]`, a copy `{...opts}` -- to a translator, to an `i18n`,
|
|
86
|
+
* `code` or `data-i18n*` value (`el.dataset.i18nTitle` included),
|
|
87
|
+
* or to a key position of a function of this table, and fails on
|
|
88
|
+
* a function missing here; and the same search, started from NO
|
|
89
|
+
* table, must find every entry here, at every position, with the
|
|
90
|
+
* same `exported`: an entry nothing forwards to fails. A function
|
|
91
|
+
* that hands a parameter on through what no position can name --
|
|
92
|
+
* `k.toLowerCase()`, a concatenation or a template, an iteration
|
|
93
|
+
* of `Object.entries(opts)`, a rest parameter walked, `arguments`
|
|
94
|
+
* by a computed index, a parameter an array pattern destructures
|
|
95
|
+
* -- fails too, unless it marks it where it hands it.
|
|
75
96
|
* One called by name goes here, with that position. One nothing
|
|
76
97
|
* calls by name -- an FSM action, a callback, a method -- has no
|
|
77
98
|
* call to read: it marks what it hands on, where it hands it. What
|
|
78
|
-
* a gobj keeps in its `priv
|
|
99
|
+
* a gobj keeps in its `priv`, and what is read from a parameter
|
|
100
|
+
* `gobj` (its attrs), is its own state, never a position.
|
|
79
101
|
*
|
|
80
102
|
* Copyright (c) 2026, ArtGins.
|
|
81
103
|
* All Rights Reserved.
|
|
@@ -140,6 +162,7 @@ export const I18N_KEY_FUNCTIONS = Object.freeze([
|
|
|
140
162
|
keys: ["0.id", "0.roll.label", "0.spec", "0.spec.id"]},
|
|
141
163
|
{module: "c_yui_period.js", name: "build_mode_button", exported: false,
|
|
142
164
|
keys: ["1.id", "1.roll.label", "1.spec", "1.spec.id"]},
|
|
165
|
+
{module: "yui_table_select.js", name: "paint_label", exported: false, keys: ["1"]},
|
|
143
166
|
{module: "c_yui_form.js", name: "cell_icon", exported: false, keys: ["1"]},
|
|
144
167
|
{module: "c_yui_form.js", name: "name_form_control", exported: false, keys: ["1.label_i18n", "1.label"]},
|
|
145
168
|
{module: "c_yui_form.js", name: "create_form_field", exported: false,
|
|
@@ -183,7 +206,7 @@ export const I18N_KEY_FUNCTIONS = Object.freeze([
|
|
|
183
206
|
{module: "c_yui_schema_editor.js", name: "render_import_plan", exported: false,
|
|
184
207
|
keys: ["1.conflicts[].code", "1.writes[].op"]},
|
|
185
208
|
{module: "schema_validate.js", name: "add", exported: false, keys: ["1"]},
|
|
186
|
-
{module: "c_g6_nodes_tree.js", name: "create_floating_icon", exported:
|
|
209
|
+
{module: "c_g6_nodes_tree.js", name: "create_floating_icon", exported: true, keys: ["4"]},
|
|
187
210
|
{module: "c_g6_nodes_tree.js", name: "show_dual_icons", exported: false, keys: ["3", "5"]},
|
|
188
211
|
{module: "c_g6_nodes_tree.js", name: "create_form_label", exported: false, keys: ["1"]},
|
|
189
212
|
{module: "c_g6_nodes_tree.js", name: "create_form_select", exported: false, keys: ["1[].i18n"]},
|