@yuneta/gobj-ui 7.26.42 → 7.26.43
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 +227 -36
- package/dist/gobj-ui.cjs.js +768 -191
- package/dist/gobj-ui.es.js +768 -191
- package/package.json +1 -1
- package/scripts/validate-locales.mjs +355 -63
- package/src/c_yui_form.js +261 -154
- package/src/c_yui_node.js +51 -7
- package/src/c_yui_schema_editor.js +49 -3
- package/src/c_yui_shell.css +4 -1
- package/src/c_yui_shell.js +28 -2
- package/src/c_yui_window.js +373 -62
- package/src/c_yui_window_manager.js +74 -2
- package/src/escape_taken.js +58 -0
- package/src/form_close_asks_for_edits.wiring.test.js +6 -3
- package/src/form_json_editor_names.js +3 -1
- package/src/form_json_editor_names.wiring.test.js +8 -4
- package/src/form_json_expand.wiring.test.js +6 -3
- package/src/form_json_field.wiring.test.js +8 -4
- package/src/form_label_i18n.wiring.test.js +10 -5
- package/src/form_table_edits_ask.wiring.test.js +18 -8
- package/src/form_table_rearm.wiring.test.js +13 -5
- package/src/form_table_rows.wiring.test.js +489 -0
- package/src/form_table_validator.wiring.test.js +8 -4
- package/src/form_template_field.wiring.test.js +6 -3
- package/src/g6_long_press_clock.test.js +8 -3
- package/src/i18n_key_functions.js +63 -25
- package/src/i18n_key_functions.test.js +230 -8
- package/src/modal_guard_back.wiring.test.js +53 -0
- package/src/named_controls.wiring.test.js +53 -13
- package/src/node_nav_events.wiring.test.js +93 -1
- package/src/schema_editor_diagram_click.wiring.test.js +277 -0
- package/src/shell_dialog_names.wiring.test.js +149 -0
- package/src/shell_escape_taken.wiring.test.js +142 -0
- package/src/shell_focus_trap.js +30 -2
- package/src/shell_focus_trap.test.js +90 -6
- package/src/shell_modals.js +90 -19
- package/src/table_editor_name.wiring.test.js +10 -5
- package/src/treedb_column_title.wiring.test.js +8 -4
- package/src/treedb_graph_writes.wiring.test.js +6 -3
- package/src/treedb_json_drill.wiring.test.js +6 -3
- package/src/uplot_add_serie.test.js +6 -3
- package/src/uplot_ink.test.js +8 -4
- package/src/window_dialog.wiring.test.js +486 -0
- package/src/window_dock_band.wiring.test.js +189 -0
- package/src/window_rect_rounding.wiring.test.js +121 -0
- package/src/yui_tabulator_i18n.js +31 -1
- package/src/yui_tabulator_i18n.test.js +46 -0
|
@@ -26,6 +26,15 @@
|
|
|
26
26
|
* (`responsive_query`) — so on mobile it lives above
|
|
27
27
|
* the bottom menu instead of covering it.
|
|
28
28
|
*
|
|
29
|
+
* A FLOATING dock that shows says the band it keeps at the top or
|
|
30
|
+
* the foot of the viewport: `--yui-dock-inset-top` /
|
|
31
|
+
* `--yui-dock-inset-bottom` on the root element (publish_dock_band).
|
|
32
|
+
* A window that fills the screen -- the sheet of a phone, a
|
|
33
|
+
* maximized one -- leaves that band free. It used to go under the
|
|
34
|
+
* dock: at a bottom corner the dock covered its foot, at a top
|
|
35
|
+
* corner its ✕ and its minimize (a 'responsive' dock with no
|
|
36
|
+
* `inline_selector` floats on a phone too).
|
|
37
|
+
*
|
|
29
38
|
* Copyright (c) 2026, ArtGins.
|
|
30
39
|
* All Rights Reserved.
|
|
31
40
|
***********************************************************************/
|
|
@@ -175,6 +184,7 @@ function mt_destroy(gobj)
|
|
|
175
184
|
}
|
|
176
185
|
|
|
177
186
|
destroy_dock(gobj);
|
|
187
|
+
publish_dock_band(gobj);
|
|
178
188
|
}
|
|
179
189
|
|
|
180
190
|
|
|
@@ -307,8 +317,10 @@ function ensure_dock_style()
|
|
|
307
317
|
.yui-dock-label { flex: 0 0 auto; }
|
|
308
318
|
/* Split label halves (prefix = DATA, kind = translatable). The
|
|
309
319
|
* separator is CSS, never a text node — same rule as the window
|
|
310
|
-
* title bar (createElement2 trims text nodes).
|
|
311
|
-
|
|
320
|
+
* title bar (createElement2 trims text nodes). Decorative ("/ ''"):
|
|
321
|
+
* the halves NAME the toggle (aria-labelledby), and a reader read
|
|
322
|
+
* the dot into the kind half ("#1 ·demo window"). */
|
|
323
|
+
.yui-dock-label .yui-dock-label-prefix + .yui-dock-label-kind::before { content: " \\00b7 "; content: " \\00b7 " / ""; }
|
|
312
324
|
.yui-dock-close {
|
|
313
325
|
width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
|
|
314
326
|
padding: 0; margin-left: 1px; border: 0; border-radius: 4px;
|
|
@@ -396,6 +408,48 @@ function apply_placement(gobj)
|
|
|
396
408
|
if($dock.parentNode !== target) {
|
|
397
409
|
target.appendChild($dock);
|
|
398
410
|
}
|
|
411
|
+
publish_dock_band(gobj);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/************************************************************
|
|
415
|
+
* Say the band the dock keeps over the windows: a FLOATING
|
|
416
|
+
* dock that shows takes the top or the foot of the viewport,
|
|
417
|
+
* from its edge to its far side. A window that fills the
|
|
418
|
+
* screen leaves it free (C_YUI_WINDOW's fill_work_area()). An
|
|
419
|
+
* inline dock keeps none: it is in the layout. Nor does an
|
|
420
|
+
* empty one, or one that is not drawn.
|
|
421
|
+
************************************************************/
|
|
422
|
+
function publish_dock_band(gobj)
|
|
423
|
+
{
|
|
424
|
+
let $dock = gobj_read_attr(gobj, "$container");
|
|
425
|
+
let top = 0;
|
|
426
|
+
let bottom = 0;
|
|
427
|
+
|
|
428
|
+
if($dock && $dock.parentNode &&
|
|
429
|
+
$dock.classList.contains("yui-dock--floating") &&
|
|
430
|
+
!$dock.classList.contains("is-empty")) {
|
|
431
|
+
let r = $dock.getBoundingClientRect();
|
|
432
|
+
if(r.height > 0) {
|
|
433
|
+
let corner = gobj_read_attr(gobj, "dock_corner") || "bottom-left";
|
|
434
|
+
if(corner.indexOf("top") === 0) {
|
|
435
|
+
top = Math.ceil(r.bottom);
|
|
436
|
+
} else {
|
|
437
|
+
bottom = Math.ceil((window.innerHeight || 0) - r.top);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
let style = document.documentElement.style;
|
|
443
|
+
if(top > 0) {
|
|
444
|
+
style.setProperty("--yui-dock-inset-top", `${top}px`);
|
|
445
|
+
} else {
|
|
446
|
+
style.removeProperty("--yui-dock-inset-top");
|
|
447
|
+
}
|
|
448
|
+
if(bottom > 0) {
|
|
449
|
+
style.setProperty("--yui-dock-inset-bottom", `${bottom}px`);
|
|
450
|
+
} else {
|
|
451
|
+
style.removeProperty("--yui-dock-inset-bottom");
|
|
452
|
+
}
|
|
399
453
|
}
|
|
400
454
|
|
|
401
455
|
/************************************************************
|
|
@@ -506,6 +560,7 @@ function sync_dock_visibility(gobj)
|
|
|
506
560
|
if($dock) {
|
|
507
561
|
$dock.classList.toggle('is-empty', priv.windows.length === 0);
|
|
508
562
|
}
|
|
563
|
+
publish_dock_band(gobj);
|
|
509
564
|
}
|
|
510
565
|
|
|
511
566
|
/************************************************************
|
|
@@ -567,11 +622,19 @@ function minimize_entry(gobj, entry)
|
|
|
567
622
|
/************************************************************
|
|
568
623
|
* Dock chip click: taskbar toggle — restore+focus a
|
|
569
624
|
* minimized/inactive window, minimize the active one.
|
|
625
|
+
*
|
|
626
|
+
* The window brought back takes the keyboard focus too: the
|
|
627
|
+
* reader pressed its chip to go there, and a window is heard
|
|
628
|
+
* (Escape, Tab) only with the focus in it.
|
|
570
629
|
************************************************************/
|
|
571
630
|
function on_chip_click(gobj, entry)
|
|
572
631
|
{
|
|
573
632
|
if(entry.minimized || !entry.$chip.classList.contains('is-active')) {
|
|
574
633
|
focus_entry(gobj, entry);
|
|
634
|
+
let $win = gobj_read_attr(entry.gobj, "$container");
|
|
635
|
+
if($win) {
|
|
636
|
+
$win.focus();
|
|
637
|
+
}
|
|
575
638
|
} else {
|
|
576
639
|
minimize_entry(gobj, entry);
|
|
577
640
|
}
|
|
@@ -738,7 +801,16 @@ function ac_minimize_window(gobj, event, kw, src)
|
|
|
738
801
|
}
|
|
739
802
|
let entry = find_entry(gobj.priv, win);
|
|
740
803
|
if(entry) {
|
|
804
|
+
/* A window hidden with the focus in it drops the focus to
|
|
805
|
+
* <body>: it goes to the chip instead, the way back. */
|
|
806
|
+
let $win = gobj_read_attr(win, "$container");
|
|
807
|
+
let had_focus = !!($win && $win.contains(document.activeElement));
|
|
741
808
|
minimize_entry(gobj, entry);
|
|
809
|
+
let $toggle = had_focus && entry.$chip ?
|
|
810
|
+
entry.$chip.querySelector(".DOCK_CHIP_TOGGLE") : null;
|
|
811
|
+
if($toggle) {
|
|
812
|
+
$toggle.focus();
|
|
813
|
+
}
|
|
742
814
|
}
|
|
743
815
|
return 0;
|
|
744
816
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/***********************************************************************
|
|
2
|
+
* escape_taken.js
|
|
3
|
+
*
|
|
4
|
+
* Whose is an Escape? The overlay around the focus (a window, the
|
|
5
|
+
* shell's dialog on top) closes with it -- unless what the key was
|
|
6
|
+
* typed in took it first:
|
|
7
|
+
*
|
|
8
|
+
* - a handler used it and said so (`preventDefault()`): Tom
|
|
9
|
+
* Select closing its list, the json editor its search box;
|
|
10
|
+
* - an input method is composing (the key cancels the
|
|
11
|
+
* composition);
|
|
12
|
+
* - the element it was typed in is no longer in the document:
|
|
13
|
+
* an inline editor closed with it. Tabulator cancels a cell
|
|
14
|
+
* edit on Escape by removing the box, and says nothing else
|
|
15
|
+
* -- so this is the only trace the key leaves;
|
|
16
|
+
* - it was typed in a search box that holds text: the browser
|
|
17
|
+
* clears the box with it (a default action, not a
|
|
18
|
+
* preventDefault() anyone can see -- and taking the key would
|
|
19
|
+
* prevent it). An empty one gives it on;
|
|
20
|
+
* - it was typed in a text editor (a textarea, a
|
|
21
|
+
* contenteditable): what is being written there is not lost
|
|
22
|
+
* to a key that also means "stop" inside the editor. The
|
|
23
|
+
* overlay is one Tab away.
|
|
24
|
+
*
|
|
25
|
+
* Pure module: an event in, a boolean out.
|
|
26
|
+
*
|
|
27
|
+
* Copyright (c) 2026, ArtGins.
|
|
28
|
+
* All Rights Reserved.
|
|
29
|
+
***********************************************************************/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/***************************************************************
|
|
33
|
+
* True when the Escape `evt` belongs to what it was typed in,
|
|
34
|
+
* and not to the overlay around it.
|
|
35
|
+
***************************************************************/
|
|
36
|
+
export function escape_is_taken(evt)
|
|
37
|
+
{
|
|
38
|
+
if(!evt) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if(evt.defaultPrevented || evt.isComposing) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
let target = evt.target;
|
|
45
|
+
if(!target || target.nodeType !== 1) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
if(target.isConnected === false) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if(target.tagName === "INPUT" && target.type === "search" && target.value) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if(target.tagName === "TEXTAREA" || target.isContentEditable === true) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
@@ -21,9 +21,12 @@ install_dom_double();
|
|
|
21
21
|
|
|
22
22
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
23
23
|
globalThis.ResizeObserver = class {
|
|
24
|
-
observe() {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
observe() {
|
|
25
|
+
}
|
|
26
|
+
unobserve() {
|
|
27
|
+
}
|
|
28
|
+
disconnect() {
|
|
29
|
+
}
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
* Not reached, because the editor gives them no hook: its search
|
|
41
41
|
* box, its repair messages, the tip at the foot of the context
|
|
42
42
|
* menu, and its modals (sort, transform). They stay in its
|
|
43
|
-
* English.
|
|
43
|
+
* English. vanilla-jsoneditor (3.13.0) has no i18n option: they
|
|
44
|
+
* are literals inside its Svelte components, and the only way to
|
|
45
|
+
* them would be rewriting its DOM by its English words.
|
|
44
46
|
*
|
|
45
47
|
* Copyright (c) 2026, ArtGins.
|
|
46
48
|
* All Rights Reserved.
|
|
@@ -26,9 +26,12 @@ install_dom_double();
|
|
|
26
26
|
|
|
27
27
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
28
28
|
globalThis.ResizeObserver = class {
|
|
29
|
-
observe() {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
observe() {
|
|
30
|
+
}
|
|
31
|
+
unobserve() {
|
|
32
|
+
}
|
|
33
|
+
disconnect() {
|
|
34
|
+
}
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -279,7 +282,8 @@ vi.mock("vanilla-jsoneditor", () => ({
|
|
|
279
282
|
set(content) {
|
|
280
283
|
this.content = content;
|
|
281
284
|
},
|
|
282
|
-
destroy() {
|
|
285
|
+
destroy() {
|
|
286
|
+
},
|
|
283
287
|
};
|
|
284
288
|
ed.draw();
|
|
285
289
|
editors.push(ed);
|
|
@@ -33,9 +33,12 @@ if(globalThis.window) {
|
|
|
33
33
|
/* Tabulator watches its table; the document double has no observer. */
|
|
34
34
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
35
35
|
globalThis.ResizeObserver = class {
|
|
36
|
-
observe() {
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
observe() {
|
|
37
|
+
}
|
|
38
|
+
unobserve() {
|
|
39
|
+
}
|
|
40
|
+
disconnect() {
|
|
41
|
+
}
|
|
39
42
|
};
|
|
40
43
|
}
|
|
41
44
|
|
|
@@ -19,9 +19,12 @@ install_dom_double();
|
|
|
19
19
|
|
|
20
20
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
21
21
|
globalThis.ResizeObserver = class {
|
|
22
|
-
observe() {
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
observe() {
|
|
23
|
+
}
|
|
24
|
+
unobserve() {
|
|
25
|
+
}
|
|
26
|
+
disconnect() {
|
|
27
|
+
}
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -38,7 +41,8 @@ vi.mock("vanilla-jsoneditor", () => ({
|
|
|
38
41
|
set(content) {
|
|
39
42
|
this.content = content;
|
|
40
43
|
},
|
|
41
|
-
destroy() {
|
|
44
|
+
destroy() {
|
|
45
|
+
},
|
|
42
46
|
};
|
|
43
47
|
editors.push(ed);
|
|
44
48
|
return ed;
|
|
@@ -26,9 +26,12 @@ install_dom_double();
|
|
|
26
26
|
|
|
27
27
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
28
28
|
globalThis.ResizeObserver = class {
|
|
29
|
-
observe() {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
observe() {
|
|
30
|
+
}
|
|
31
|
+
unobserve() {
|
|
32
|
+
}
|
|
33
|
+
disconnect() {
|
|
34
|
+
}
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -38,8 +41,10 @@ vi.mock("vanilla-jsoneditor", () => ({
|
|
|
38
41
|
get() {
|
|
39
42
|
return {text: ""};
|
|
40
43
|
},
|
|
41
|
-
set() {
|
|
42
|
-
|
|
44
|
+
set() {
|
|
45
|
+
},
|
|
46
|
+
destroy() {
|
|
47
|
+
},
|
|
43
48
|
}),
|
|
44
49
|
}));
|
|
45
50
|
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
*
|
|
19
19
|
* Driven through the real gclass on a document double, with a
|
|
20
20
|
* Tabulator double that, like Tabulator, draws a row (its formatter
|
|
21
|
-
* runs) and says `dataChanged` INSIDE addRow(),
|
|
21
|
+
* runs) and says `dataChanged` INSIDE addRow() and addData(), once
|
|
22
|
+
* per row, synchronously.
|
|
22
23
|
*
|
|
23
24
|
* Copyright (c) 2026, ArtGins.
|
|
24
25
|
* All Rights Reserved.
|
|
@@ -30,9 +31,12 @@ install_dom_double();
|
|
|
30
31
|
|
|
31
32
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
32
33
|
globalThis.ResizeObserver = class {
|
|
33
|
-
observe() {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
observe() {
|
|
35
|
+
}
|
|
36
|
+
unobserve() {
|
|
37
|
+
}
|
|
38
|
+
disconnect() {
|
|
39
|
+
}
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
|
|
@@ -76,7 +80,7 @@ vi.mock("tabulator-tables", () => {
|
|
|
76
80
|
fn([]);
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
|
-
|
|
83
|
+
add(record) {
|
|
80
84
|
/* The row's element lives in the table's, as in Tabulator:
|
|
81
85
|
* a nested table drawn in it is inside the form. */
|
|
82
86
|
const $row = document.createElement("div");
|
|
@@ -87,7 +91,14 @@ vi.mock("tabulator-tables", () => {
|
|
|
87
91
|
}
|
|
88
92
|
this.rows.push(row);
|
|
89
93
|
this.emit("dataChanged");
|
|
90
|
-
return
|
|
94
|
+
return row;
|
|
95
|
+
}
|
|
96
|
+
addRow(record) {
|
|
97
|
+
return Promise.resolve(this.add(record));
|
|
98
|
+
}
|
|
99
|
+
/* Like Tabulator, `dataChanged` once per row, inside the call. */
|
|
100
|
+
addData(records) {
|
|
101
|
+
return Promise.resolve(records.map((record) => this.add(record)));
|
|
91
102
|
}
|
|
92
103
|
/* What the trash of a row ends in (row.delete()). */
|
|
93
104
|
delete_row() {
|
|
@@ -288,8 +299,7 @@ describe("a form that opens changed hears what the reader does to its tables", (
|
|
|
288
299
|
const tables_before = tables.length;
|
|
289
300
|
gobj_send_event(form, "EV_ADD_TABLE_ROW", {
|
|
290
301
|
table_id: alarms.element.yui_table_id,
|
|
291
|
-
record: {}
|
|
292
|
-
loading: false
|
|
302
|
+
record: {}
|
|
293
303
|
}, form);
|
|
294
304
|
expect(alarms.rows.length).toBe(2);
|
|
295
305
|
expect(tables.length).toBe(tables_before + 1); // the new row's triggers table
|
|
@@ -23,9 +23,12 @@ install_dom_double();
|
|
|
23
23
|
|
|
24
24
|
if(typeof globalThis.ResizeObserver === "undefined") {
|
|
25
25
|
globalThis.ResizeObserver = class {
|
|
26
|
-
observe() {
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
observe() {
|
|
27
|
+
}
|
|
28
|
+
unobserve() {
|
|
29
|
+
}
|
|
30
|
+
disconnect() {
|
|
31
|
+
}
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
|
|
@@ -62,6 +65,10 @@ vi.mock("tabulator-tables", () => {
|
|
|
62
65
|
this.added.push(record);
|
|
63
66
|
return Promise.resolve({getElement: () => document.createElement("div")});
|
|
64
67
|
}
|
|
68
|
+
addData(records) {
|
|
69
|
+
this.added.push(...records);
|
|
70
|
+
return Promise.resolve(records.map(() => ({getElement: () => document.createElement("div")})));
|
|
71
|
+
}
|
|
65
72
|
}
|
|
66
73
|
return {TabulatorFull: FakeTabulator, Tabulator: FakeTabulator};
|
|
67
74
|
});
|
|
@@ -80,7 +87,8 @@ beforeAll(async () => {
|
|
|
80
87
|
const i18next = (await import("i18next")).default;
|
|
81
88
|
await i18next.init({lng: "en", resources: {}});
|
|
82
89
|
gobj_start_up(null, null, null, null, null, null, null);
|
|
83
|
-
set_log_callback(() => {
|
|
90
|
+
set_log_callback(() => {
|
|
91
|
+
});
|
|
84
92
|
gclass_create("C_TEST_RA_HOST", [], [["ST_IDLE", []]], {}, 0, [SDATA_END()], {}, 0, 0, 0, 0);
|
|
85
93
|
gclass_create(
|
|
86
94
|
"C_TEST_RA_APP",
|
|
@@ -147,7 +155,7 @@ describe("a form with a table, destroyed right after", () => {
|
|
|
147
155
|
gobj_destroy(form);
|
|
148
156
|
});
|
|
149
157
|
|
|
150
|
-
test("
|
|
158
|
+
test("the loaded rows reach their table through EV_LOAD_TABLE_ROWS's table id", async () => {
|
|
151
159
|
const before = tables.length;
|
|
152
160
|
const {form} = build([{k: "x"}, {k: "y"}]);
|
|
153
161
|
const table = tables.slice(before).find(tb => tb.added.length > 0);
|