@yuneta/gobj-ui 7.26.9 → 7.26.10
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 +33 -0
- package/dist/gobj-ui.cjs.js +53 -23
- package/dist/gobj-ui.es.js +54 -24
- package/package.json +7 -3
- package/src/c_yui_form.js +8 -7
- package/src/c_yui_window.js +12 -10
- package/src/c_yui_window_manager.js +58 -6
- package/src/window_show.wiring.test.js +50 -3
package/README.md
CHANGED
|
@@ -3322,6 +3322,39 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
|
|
|
3322
3322
|
columns.push({field: "x", title: header, titleFormatter: text_title_formatter});
|
|
3323
3323
|
```
|
|
3324
3324
|
|
|
3325
|
+
- **Markup is said out loud: `html_markup()`.** Deliberate markup (an icon,
|
|
3326
|
+
an svg) goes into a description wrapped in `html_markup()` (gobj-js
|
|
3327
|
+
7.26.3+), never as a bare string, in the content slot or in a list of
|
|
3328
|
+
children:
|
|
3329
|
+
|
|
3330
|
+
```js
|
|
3331
|
+
import {html_markup} from "@yuneta/gobj-js";
|
|
3332
|
+
createElement2(["span", {class: "icon"}, html_markup('<i class="yi-copy"></i>')]);
|
|
3333
|
+
```
|
|
3334
|
+
|
|
3335
|
+
This library passes every markup it builds through `html_markup()`, so it
|
|
3336
|
+
renders the same with **`set_strings_are_text(true)`** (gobj-js), the mode in
|
|
3337
|
+
which a plain string is ALWAYS text and a datum that starts with `<` can no
|
|
3338
|
+
longer run. The test-app runs in that mode. An app turns it on at startup,
|
|
3339
|
+
before it builds anything, once its own code is migrated:
|
|
3340
|
+
|
|
3341
|
+
1. Run the static check on the app's sources:
|
|
3342
|
+
`node node_modules/@yuneta/gobj-ui/scripts/check-markup-strings.mjs src`
|
|
3343
|
+
(it needs `acorn`). It lists a markup string literal in a description
|
|
3344
|
+
(`literal`, wrap it in `html_markup()`), markup built with values
|
|
3345
|
+
(`built`, build the element with `createElement2()` and pass the value
|
|
3346
|
+
as text) and a markup string in a list of children (`in-list`, which is
|
|
3347
|
+
text since gobj-js 7.26.2). It cannot see a variable that holds a
|
|
3348
|
+
string.
|
|
3349
|
+
2. Call `set_strings_are_text(true)` before the first `createElement2()`.
|
|
3350
|
+
3. Walk the app and read the console: each string that starts with `<` is
|
|
3351
|
+
logged once (*"use html_markup() if it is markup"*). A logged string is
|
|
3352
|
+
either a deliberate markup not migrated yet (wrap it) or a datum that
|
|
3353
|
+
used to run as html (keep it as text).
|
|
3354
|
+
|
|
3355
|
+
`npm run check-markup` runs the check here, and `prebuild` / `pretest` run
|
|
3356
|
+
it, so a new markup literal fails the build.
|
|
3357
|
+
|
|
3325
3358
|
### `index.html`: title, metadata and the Content-Security-Policy
|
|
3326
3359
|
|
|
3327
3360
|
The vite plugin `yunetaHtmlPlugin` (`vite-plugin-yuneta-html.js`) fills
|
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -3740,11 +3740,11 @@ function mt_create$21(gobj) {
|
|
|
3740
3740
|
let $c = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
3741
3741
|
if ($c) $c.addEventListener("pointerdown", function() {
|
|
3742
3742
|
let m = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
|
|
3743
|
-
if (m) (0, _yuneta_gobj_js.gobj_send_event)(m, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
|
|
3743
|
+
if (m) (0, _yuneta_gobj_js.gobj_send_event)(m, "EV_FOCUS_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
|
|
3744
3744
|
}, true);
|
|
3745
3745
|
let chip_title = composed_title(gobj);
|
|
3746
3746
|
(0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_REGISTER_WINDOW", {
|
|
3747
|
-
window: gobj,
|
|
3747
|
+
window: (0, _yuneta_gobj_js.gobj_full_name)(gobj),
|
|
3748
3748
|
title: chip_title ? chip_title : (0, _yuneta_gobj_js.gobj_short_name)(gobj),
|
|
3749
3749
|
title_key: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title") || "",
|
|
3750
3750
|
title_kind_text: (0, _yuneta_gobj_js.empty_string)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title")) ? "" : (0, i18next.t)((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title")),
|
|
@@ -3763,7 +3763,7 @@ function mt_create$21(gobj) {
|
|
|
3763
3763
|
***************************************************************/
|
|
3764
3764
|
function mt_destroy$21(gobj) {
|
|
3765
3765
|
let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
|
|
3766
|
-
if (manager) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: gobj }, gobj);
|
|
3766
|
+
if (manager) (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_UNREGISTER_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
|
|
3767
3767
|
let back_overlay = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay");
|
|
3768
3768
|
if (back_overlay) {
|
|
3769
3769
|
let shell = yui_shell_of(gobj);
|
|
@@ -3931,7 +3931,7 @@ function do_minimize(gobj) {
|
|
|
3931
3931
|
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimize without a window manager`);
|
|
3932
3932
|
return;
|
|
3933
3933
|
}
|
|
3934
|
-
(0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_MINIMIZE_WINDOW", { window: gobj }, gobj);
|
|
3934
|
+
(0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_MINIMIZE_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
|
|
3935
3935
|
}
|
|
3936
3936
|
/************************************************************
|
|
3937
3937
|
* Build UI
|
|
@@ -4032,7 +4032,7 @@ function build_ui$18(gobj) {
|
|
|
4032
4032
|
"data-i18n-aria-label": "minimize",
|
|
4033
4033
|
style: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showMin") && (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager") ? "" : "display:none;"
|
|
4034
4034
|
},
|
|
4035
|
-
WC_MIN,
|
|
4035
|
+
(0, _yuneta_gobj_js.html_markup)(WC_MIN),
|
|
4036
4036
|
{ click: (evt) => {
|
|
4037
4037
|
evt.stopPropagation();
|
|
4038
4038
|
do_minimize(gobj);
|
|
@@ -4049,7 +4049,7 @@ function build_ui$18(gobj) {
|
|
|
4049
4049
|
"data-i18n-aria-label": "maximize",
|
|
4050
4050
|
style: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showMax") ? "" : "display:none;"
|
|
4051
4051
|
},
|
|
4052
|
-
WC_MAX,
|
|
4052
|
+
(0, _yuneta_gobj_js.html_markup)(WC_MAX),
|
|
4053
4053
|
{ click: (evt) => {
|
|
4054
4054
|
evt.stopPropagation();
|
|
4055
4055
|
toggle(gobj);
|
|
@@ -4065,7 +4065,7 @@ function build_ui$18(gobj) {
|
|
|
4065
4065
|
"aria-label": (0, i18next.t)("close"),
|
|
4066
4066
|
"data-i18n-aria-label": "close"
|
|
4067
4067
|
},
|
|
4068
|
-
WC_CLOSE,
|
|
4068
|
+
(0, _yuneta_gobj_js.html_markup)(WC_CLOSE),
|
|
4069
4069
|
{ click: (evt) => {
|
|
4070
4070
|
evt.stopPropagation();
|
|
4071
4071
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CLOSE_WINDOW", {}, gobj);
|
|
@@ -4140,7 +4140,7 @@ function build_ui$18(gobj) {
|
|
|
4140
4140
|
[[
|
|
4141
4141
|
"span",
|
|
4142
4142
|
{ style: "display:inline-block;height:1.4em; width:1.4em;" },
|
|
4143
|
-
"<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>"
|
|
4143
|
+
(0, _yuneta_gobj_js.html_markup)("<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>")
|
|
4144
4144
|
]],
|
|
4145
4145
|
{ pointerdown: (evt) => {
|
|
4146
4146
|
rsStart(gobj, evt);
|
|
@@ -4170,7 +4170,7 @@ function build_ui$18(gobj) {
|
|
|
4170
4170
|
[[
|
|
4171
4171
|
"span",
|
|
4172
4172
|
{ style: "display:inline-block;height:1.4em; width:1.4em;" },
|
|
4173
|
-
"<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>"
|
|
4173
|
+
(0, _yuneta_gobj_js.html_markup)("<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>")
|
|
4174
4174
|
]],
|
|
4175
4175
|
{ pointerdown: (evt) => {
|
|
4176
4176
|
rsStart(gobj, evt);
|
|
@@ -4527,7 +4527,7 @@ function ac_refresh$11(gobj, event, kw, src) {
|
|
|
4527
4527
|
function ac_show$15(gobj, event, kw, src) {
|
|
4528
4528
|
let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
|
|
4529
4529
|
if (manager) {
|
|
4530
|
-
(0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
|
|
4530
|
+
(0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_FOCUS_WINDOW", { window: (0, _yuneta_gobj_js.gobj_full_name)(gobj) }, gobj);
|
|
4531
4531
|
return 0;
|
|
4532
4532
|
}
|
|
4533
4533
|
let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
|
|
@@ -4876,6 +4876,29 @@ function chip_lead(icon) {
|
|
|
4876
4876
|
/************************************************************
|
|
4877
4877
|
* Find a registry entry by its window gobj.
|
|
4878
4878
|
************************************************************/
|
|
4879
|
+
/************************************************************
|
|
4880
|
+
* The window an event is about. A kw is plain json (the machine
|
|
4881
|
+
* trace dumps it), so the window travels in it as its FULL NAME,
|
|
4882
|
+
* which the trace can print, and the gobj is the event's src --
|
|
4883
|
+
* every sender is the window itself. Up to 7.26.9 the kw carried
|
|
4884
|
+
* the gobj; that is still taken, with a warning, for this release.
|
|
4885
|
+
************************************************************/
|
|
4886
|
+
var warned_gobj_in_kw = false;
|
|
4887
|
+
function window_of(gobj, event, kw, src) {
|
|
4888
|
+
let w = kw && kw.window;
|
|
4889
|
+
if ((0, _yuneta_gobj_js.is_gobj)(w)) {
|
|
4890
|
+
if (!warned_gobj_in_kw) {
|
|
4891
|
+
warned_gobj_in_kw = true;
|
|
4892
|
+
(0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
|
|
4893
|
+
}
|
|
4894
|
+
return w;
|
|
4895
|
+
}
|
|
4896
|
+
if (!(0, _yuneta_gobj_js.is_gobj)(src) || (0, _yuneta_gobj_js.gobj_full_name)(src) !== w) {
|
|
4897
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: ${event}: window '${w}' is not the src of the event (${(0, _yuneta_gobj_js.is_gobj)(src) ? (0, _yuneta_gobj_js.gobj_full_name)(src) : String(src)})`);
|
|
4898
|
+
return null;
|
|
4899
|
+
}
|
|
4900
|
+
return src;
|
|
4901
|
+
}
|
|
4879
4902
|
function find_entry(priv, win) {
|
|
4880
4903
|
for (let e of priv.windows) if (e.gobj === win) return e;
|
|
4881
4904
|
return null;
|
|
@@ -4948,8 +4971,9 @@ function on_chip_click(gobj, entry) {
|
|
|
4948
4971
|
************************************************************/
|
|
4949
4972
|
function ac_register_window(gobj, event, kw, src) {
|
|
4950
4973
|
let priv = gobj.priv;
|
|
4951
|
-
let win = kw
|
|
4952
|
-
if (!win
|
|
4974
|
+
let win = window_of(gobj, event, kw, src);
|
|
4975
|
+
if (!win) return -1;
|
|
4976
|
+
if (find_entry(priv, win)) return 0;
|
|
4953
4977
|
apply_placement(gobj);
|
|
4954
4978
|
let title = kw.title || (0, _yuneta_gobj_js.gobj_name)(win) || "window";
|
|
4955
4979
|
let title_key = kw.title_key || "";
|
|
@@ -5004,7 +5028,7 @@ function ac_register_window(gobj, event, kw, src) {
|
|
|
5004
5028
|
"aria-label": (0, i18next.t)("close"),
|
|
5005
5029
|
"data-i18n-aria-label": "close"
|
|
5006
5030
|
},
|
|
5007
|
-
WC_X,
|
|
5031
|
+
(0, _yuneta_gobj_js.html_markup)(WC_X),
|
|
5008
5032
|
{ click: (evt) => {
|
|
5009
5033
|
evt.stopPropagation();
|
|
5010
5034
|
(0, _yuneta_gobj_js.gobj_send_event)(entry.gobj, "EV_CLOSE_WINDOW", {}, gobj);
|
|
@@ -5039,7 +5063,9 @@ function ac_register_window(gobj, event, kw, src) {
|
|
|
5039
5063
|
************************************************************/
|
|
5040
5064
|
function ac_unregister_window(gobj, event, kw, src) {
|
|
5041
5065
|
let priv = gobj.priv;
|
|
5042
|
-
let
|
|
5066
|
+
let win = window_of(gobj, event, kw, src);
|
|
5067
|
+
if (!win) return -1;
|
|
5068
|
+
let entry = find_entry(priv, win);
|
|
5043
5069
|
if (!entry) return 0;
|
|
5044
5070
|
if (entry.$chip && entry.$chip.parentNode) entry.$chip.parentNode.removeChild(entry.$chip);
|
|
5045
5071
|
priv.windows = priv.windows.filter((e) => e !== entry);
|
|
@@ -5050,7 +5076,9 @@ function ac_unregister_window(gobj, event, kw, src) {
|
|
|
5050
5076
|
* EV_MINIMIZE_WINDOW { window }
|
|
5051
5077
|
************************************************************/
|
|
5052
5078
|
function ac_minimize_window(gobj, event, kw, src) {
|
|
5053
|
-
let
|
|
5079
|
+
let win = window_of(gobj, event, kw, src);
|
|
5080
|
+
if (!win) return -1;
|
|
5081
|
+
let entry = find_entry(gobj.priv, win);
|
|
5054
5082
|
if (entry) minimize_entry(gobj, entry);
|
|
5055
5083
|
return 0;
|
|
5056
5084
|
}
|
|
@@ -5058,7 +5086,9 @@ function ac_minimize_window(gobj, event, kw, src) {
|
|
|
5058
5086
|
* EV_FOCUS_WINDOW { window }
|
|
5059
5087
|
************************************************************/
|
|
5060
5088
|
function ac_focus_window(gobj, event, kw, src) {
|
|
5061
|
-
let
|
|
5089
|
+
let win = window_of(gobj, event, kw, src);
|
|
5090
|
+
if (!win) return -1;
|
|
5091
|
+
let entry = find_entry(gobj.priv, win);
|
|
5062
5092
|
if (entry) focus_entry(gobj, entry);
|
|
5063
5093
|
return 0;
|
|
5064
5094
|
}
|
|
@@ -8445,7 +8475,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8445
8475
|
[[
|
|
8446
8476
|
"span",
|
|
8447
8477
|
{ class: "icon m-0" },
|
|
8448
|
-
"<i class=\"yi-floppy-disk\"></i>"
|
|
8478
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-floppy-disk\"></i>")
|
|
8449
8479
|
], [
|
|
8450
8480
|
"span",
|
|
8451
8481
|
{
|
|
@@ -8472,7 +8502,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8472
8502
|
[[
|
|
8473
8503
|
"span",
|
|
8474
8504
|
{ class: "icon m-0" },
|
|
8475
|
-
"<i class=\"yi-arrow-rotate-left\"></i>"
|
|
8505
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-arrow-rotate-left\"></i>")
|
|
8476
8506
|
], [
|
|
8477
8507
|
"span",
|
|
8478
8508
|
{
|
|
@@ -8498,7 +8528,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8498
8528
|
[[
|
|
8499
8529
|
"span",
|
|
8500
8530
|
{ class: "icon m-0" },
|
|
8501
|
-
"<i class=\"yi-broom-wide\"></i>"
|
|
8531
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-broom-wide\"></i>")
|
|
8502
8532
|
], [
|
|
8503
8533
|
"span",
|
|
8504
8534
|
{
|
|
@@ -8524,7 +8554,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8524
8554
|
[[
|
|
8525
8555
|
"span",
|
|
8526
8556
|
{ class: "icon m-0" },
|
|
8527
|
-
"<i class=\"yi-copy\"></i>"
|
|
8557
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-copy\"></i>")
|
|
8528
8558
|
], [
|
|
8529
8559
|
"span",
|
|
8530
8560
|
{
|
|
@@ -8550,7 +8580,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8550
8580
|
[[
|
|
8551
8581
|
"span",
|
|
8552
8582
|
{ class: "icon m-0" },
|
|
8553
|
-
"<i class=\"yi-paste\"></i>"
|
|
8583
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-paste\"></i>")
|
|
8554
8584
|
], [
|
|
8555
8585
|
"span",
|
|
8556
8586
|
{
|
|
@@ -9322,7 +9352,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
9322
9352
|
[[
|
|
9323
9353
|
"span",
|
|
9324
9354
|
{ class: "icon m-0" },
|
|
9325
|
-
"<i class=\"yi-plus\"></i>"
|
|
9355
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-plus\"></i>")
|
|
9326
9356
|
], [
|
|
9327
9357
|
"span",
|
|
9328
9358
|
{
|
|
@@ -9876,7 +9906,7 @@ function create_coordinates(gobj, attrs) {
|
|
|
9876
9906
|
], [
|
|
9877
9907
|
"span",
|
|
9878
9908
|
{ class: "icon is-left is-clickable" },
|
|
9879
|
-
"<i class=\"yi-location-crosshairs\"></i>",
|
|
9909
|
+
(0, _yuneta_gobj_js.html_markup)("<i class=\"yi-location-crosshairs\"></i>"),
|
|
9880
9910
|
{ "click": function(evt) {
|
|
9881
9911
|
evt.stopPropagation();
|
|
9882
9912
|
getLocation(gobj, this.closest(".control").querySelector("input"));
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
|
|
1
|
+
import { SDATA, SDATA_END, clean_name, createElement2, createOneHtml, create_template_record, data_type_t, debounce, delete_from_list, duplicate_objects, empty_json, empty_string, escapeHtml, event_flag_t, flat_diff, gclass_create, gclass_find_by_name, gclass_flag_t, getPositionRelativeToBody, gobj_bottom_gobj, gobj_change_state, gobj_command, gobj_create, gobj_create_pure_child, gobj_create_service, gobj_current_state, gobj_destroy, gobj_find_child, gobj_find_service, gobj_full_name, gobj_gclass_name, gobj_get_gclass_trace_level2, gobj_global_trace_level, gobj_global_trace_no_level, gobj_has_event, gobj_is_destroying, gobj_is_playing, gobj_is_pure_child, gobj_is_running, gobj_is_service, gobj_is_volatil, gobj_match_children, gobj_name, gobj_parent, gobj_post_event, gobj_publish_event, gobj_read_attr, gobj_read_bool_attr, gobj_read_integer_attr, gobj_read_pointer_attr, gobj_read_str_attr, gobj_save_persistent_attrs, gobj_send_event, gobj_set_trace_machine_format, gobj_short_name, gobj_start, gobj_start_tree, gobj_stop, gobj_stop_children, gobj_subscribe_event, gobj_unsubscribe_event, gobj_write_attr, gobj_write_bool_attr, gobj_write_integer_attr, gobj_write_str_attr, gobj_yuno, gobj_yuno_name, html_markup, is_array, is_boolean, is_date, is_gobj, is_null, is_number, is_object, is_string, json2flat, json_deep_copy, json_is_identical, json_object_size, json_object_update, json_object_update_missing, json_size, kw_clone_by_keys, kw_flag_t, kw_get_dict, kw_get_dict_value, kw_get_int, kw_get_local_storage_value, kw_get_str, kw_has_key, kw_set_dict_value, kw_set_local_storage_value, kwid_find_one_record, kwid_new_dict, log_error, log_warning, msg_iev_get_stack, parseBoolean, parseSVG, refresh_language, safeSrc, sdata_flag_t, set_console_log_enabled, set_log_callback, sprintf, str_in_list, template_get_field_desc, trace_level_t, trace_msg, treedb_decoder_fkey, treedb_encoder_fkey, treedb_get_field_desc, treedb_hook_data_size } from "@yuneta/gobj-js";
|
|
2
2
|
import i18next, { t } from "i18next";
|
|
3
3
|
import TomSelect from "tom-select";
|
|
4
4
|
import { createJSONEditor } from "vanilla-jsoneditor";
|
|
@@ -3735,11 +3735,11 @@ function mt_create$21(gobj) {
|
|
|
3735
3735
|
let $c = gobj_read_attr(gobj, "$container");
|
|
3736
3736
|
if ($c) $c.addEventListener("pointerdown", function() {
|
|
3737
3737
|
let m = gobj_read_pointer_attr(gobj, "manager");
|
|
3738
|
-
if (m) gobj_send_event(m, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
|
|
3738
|
+
if (m) gobj_send_event(m, "EV_FOCUS_WINDOW", { window: gobj_full_name(gobj) }, gobj);
|
|
3739
3739
|
}, true);
|
|
3740
3740
|
let chip_title = composed_title(gobj);
|
|
3741
3741
|
gobj_send_event(manager, "EV_REGISTER_WINDOW", {
|
|
3742
|
-
window: gobj,
|
|
3742
|
+
window: gobj_full_name(gobj),
|
|
3743
3743
|
title: chip_title ? chip_title : gobj_short_name(gobj),
|
|
3744
3744
|
title_key: gobj_read_str_attr(gobj, "title") || "",
|
|
3745
3745
|
title_kind_text: empty_string(gobj_read_str_attr(gobj, "title")) ? "" : t(gobj_read_str_attr(gobj, "title")),
|
|
@@ -3758,7 +3758,7 @@ function mt_create$21(gobj) {
|
|
|
3758
3758
|
***************************************************************/
|
|
3759
3759
|
function mt_destroy$21(gobj) {
|
|
3760
3760
|
let manager = gobj_read_pointer_attr(gobj, "manager");
|
|
3761
|
-
if (manager) gobj_send_event(manager, "EV_UNREGISTER_WINDOW", { window: gobj }, gobj);
|
|
3761
|
+
if (manager) gobj_send_event(manager, "EV_UNREGISTER_WINDOW", { window: gobj_full_name(gobj) }, gobj);
|
|
3762
3762
|
let back_overlay = gobj_read_attr(gobj, "back_overlay");
|
|
3763
3763
|
if (back_overlay) {
|
|
3764
3764
|
let shell = yui_shell_of(gobj);
|
|
@@ -3926,7 +3926,7 @@ function do_minimize(gobj) {
|
|
|
3926
3926
|
log_error(`${gobj_short_name(gobj)}: minimize without a window manager`);
|
|
3927
3927
|
return;
|
|
3928
3928
|
}
|
|
3929
|
-
gobj_send_event(manager, "EV_MINIMIZE_WINDOW", { window: gobj }, gobj);
|
|
3929
|
+
gobj_send_event(manager, "EV_MINIMIZE_WINDOW", { window: gobj_full_name(gobj) }, gobj);
|
|
3930
3930
|
}
|
|
3931
3931
|
/************************************************************
|
|
3932
3932
|
* Build UI
|
|
@@ -4027,7 +4027,7 @@ function build_ui$18(gobj) {
|
|
|
4027
4027
|
"data-i18n-aria-label": "minimize",
|
|
4028
4028
|
style: gobj_read_bool_attr(gobj, "showMin") && gobj_read_pointer_attr(gobj, "manager") ? "" : "display:none;"
|
|
4029
4029
|
},
|
|
4030
|
-
WC_MIN,
|
|
4030
|
+
html_markup(WC_MIN),
|
|
4031
4031
|
{ click: (evt) => {
|
|
4032
4032
|
evt.stopPropagation();
|
|
4033
4033
|
do_minimize(gobj);
|
|
@@ -4044,7 +4044,7 @@ function build_ui$18(gobj) {
|
|
|
4044
4044
|
"data-i18n-aria-label": "maximize",
|
|
4045
4045
|
style: gobj_read_bool_attr(gobj, "showMax") ? "" : "display:none;"
|
|
4046
4046
|
},
|
|
4047
|
-
WC_MAX,
|
|
4047
|
+
html_markup(WC_MAX),
|
|
4048
4048
|
{ click: (evt) => {
|
|
4049
4049
|
evt.stopPropagation();
|
|
4050
4050
|
toggle(gobj);
|
|
@@ -4060,7 +4060,7 @@ function build_ui$18(gobj) {
|
|
|
4060
4060
|
"aria-label": t("close"),
|
|
4061
4061
|
"data-i18n-aria-label": "close"
|
|
4062
4062
|
},
|
|
4063
|
-
WC_CLOSE,
|
|
4063
|
+
html_markup(WC_CLOSE),
|
|
4064
4064
|
{ click: (evt) => {
|
|
4065
4065
|
evt.stopPropagation();
|
|
4066
4066
|
gobj_send_event(gobj, "EV_CLOSE_WINDOW", {}, gobj);
|
|
@@ -4135,7 +4135,7 @@ function build_ui$18(gobj) {
|
|
|
4135
4135
|
[[
|
|
4136
4136
|
"span",
|
|
4137
4137
|
{ style: "display:inline-block;height:1.4em; width:1.4em;" },
|
|
4138
|
-
"<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>"
|
|
4138
|
+
html_markup("<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>")
|
|
4139
4139
|
]],
|
|
4140
4140
|
{ pointerdown: (evt) => {
|
|
4141
4141
|
rsStart(gobj, evt);
|
|
@@ -4165,7 +4165,7 @@ function build_ui$18(gobj) {
|
|
|
4165
4165
|
[[
|
|
4166
4166
|
"span",
|
|
4167
4167
|
{ style: "display:inline-block;height:1.4em; width:1.4em;" },
|
|
4168
|
-
"<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>"
|
|
4168
|
+
html_markup("<svg viewBox=\"0 0 500 500\"><path d=\"m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z\" fill=\"var(--bulma-text)\" stroke-width=\"33.78\"/></svg>")
|
|
4169
4169
|
]],
|
|
4170
4170
|
{ pointerdown: (evt) => {
|
|
4171
4171
|
rsStart(gobj, evt);
|
|
@@ -4522,7 +4522,7 @@ function ac_refresh$11(gobj, event, kw, src) {
|
|
|
4522
4522
|
function ac_show$15(gobj, event, kw, src) {
|
|
4523
4523
|
let manager = gobj_read_pointer_attr(gobj, "manager");
|
|
4524
4524
|
if (manager) {
|
|
4525
|
-
gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
|
|
4525
|
+
gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj_full_name(gobj) }, gobj);
|
|
4526
4526
|
return 0;
|
|
4527
4527
|
}
|
|
4528
4528
|
let $container = gobj_read_attr(gobj, "$container");
|
|
@@ -4871,6 +4871,29 @@ function chip_lead(icon) {
|
|
|
4871
4871
|
/************************************************************
|
|
4872
4872
|
* Find a registry entry by its window gobj.
|
|
4873
4873
|
************************************************************/
|
|
4874
|
+
/************************************************************
|
|
4875
|
+
* The window an event is about. A kw is plain json (the machine
|
|
4876
|
+
* trace dumps it), so the window travels in it as its FULL NAME,
|
|
4877
|
+
* which the trace can print, and the gobj is the event's src --
|
|
4878
|
+
* every sender is the window itself. Up to 7.26.9 the kw carried
|
|
4879
|
+
* the gobj; that is still taken, with a warning, for this release.
|
|
4880
|
+
************************************************************/
|
|
4881
|
+
var warned_gobj_in_kw = false;
|
|
4882
|
+
function window_of(gobj, event, kw, src) {
|
|
4883
|
+
let w = kw && kw.window;
|
|
4884
|
+
if (is_gobj(w)) {
|
|
4885
|
+
if (!warned_gobj_in_kw) {
|
|
4886
|
+
warned_gobj_in_kw = true;
|
|
4887
|
+
log_warning(`${gobj_short_name(gobj)}: ${event} carries the window gobj in its kw: send {window: gobj_full_name(window)} from the window`);
|
|
4888
|
+
}
|
|
4889
|
+
return w;
|
|
4890
|
+
}
|
|
4891
|
+
if (!is_gobj(src) || gobj_full_name(src) !== w) {
|
|
4892
|
+
log_error(`${gobj_short_name(gobj)}: ${event}: window '${w}' is not the src of the event (${is_gobj(src) ? gobj_full_name(src) : String(src)})`);
|
|
4893
|
+
return null;
|
|
4894
|
+
}
|
|
4895
|
+
return src;
|
|
4896
|
+
}
|
|
4874
4897
|
function find_entry(priv, win) {
|
|
4875
4898
|
for (let e of priv.windows) if (e.gobj === win) return e;
|
|
4876
4899
|
return null;
|
|
@@ -4943,8 +4966,9 @@ function on_chip_click(gobj, entry) {
|
|
|
4943
4966
|
************************************************************/
|
|
4944
4967
|
function ac_register_window(gobj, event, kw, src) {
|
|
4945
4968
|
let priv = gobj.priv;
|
|
4946
|
-
let win = kw
|
|
4947
|
-
if (!win
|
|
4969
|
+
let win = window_of(gobj, event, kw, src);
|
|
4970
|
+
if (!win) return -1;
|
|
4971
|
+
if (find_entry(priv, win)) return 0;
|
|
4948
4972
|
apply_placement(gobj);
|
|
4949
4973
|
let title = kw.title || gobj_name(win) || "window";
|
|
4950
4974
|
let title_key = kw.title_key || "";
|
|
@@ -4999,7 +5023,7 @@ function ac_register_window(gobj, event, kw, src) {
|
|
|
4999
5023
|
"aria-label": t("close"),
|
|
5000
5024
|
"data-i18n-aria-label": "close"
|
|
5001
5025
|
},
|
|
5002
|
-
WC_X,
|
|
5026
|
+
html_markup(WC_X),
|
|
5003
5027
|
{ click: (evt) => {
|
|
5004
5028
|
evt.stopPropagation();
|
|
5005
5029
|
gobj_send_event(entry.gobj, "EV_CLOSE_WINDOW", {}, gobj);
|
|
@@ -5034,7 +5058,9 @@ function ac_register_window(gobj, event, kw, src) {
|
|
|
5034
5058
|
************************************************************/
|
|
5035
5059
|
function ac_unregister_window(gobj, event, kw, src) {
|
|
5036
5060
|
let priv = gobj.priv;
|
|
5037
|
-
let
|
|
5061
|
+
let win = window_of(gobj, event, kw, src);
|
|
5062
|
+
if (!win) return -1;
|
|
5063
|
+
let entry = find_entry(priv, win);
|
|
5038
5064
|
if (!entry) return 0;
|
|
5039
5065
|
if (entry.$chip && entry.$chip.parentNode) entry.$chip.parentNode.removeChild(entry.$chip);
|
|
5040
5066
|
priv.windows = priv.windows.filter((e) => e !== entry);
|
|
@@ -5045,7 +5071,9 @@ function ac_unregister_window(gobj, event, kw, src) {
|
|
|
5045
5071
|
* EV_MINIMIZE_WINDOW { window }
|
|
5046
5072
|
************************************************************/
|
|
5047
5073
|
function ac_minimize_window(gobj, event, kw, src) {
|
|
5048
|
-
let
|
|
5074
|
+
let win = window_of(gobj, event, kw, src);
|
|
5075
|
+
if (!win) return -1;
|
|
5076
|
+
let entry = find_entry(gobj.priv, win);
|
|
5049
5077
|
if (entry) minimize_entry(gobj, entry);
|
|
5050
5078
|
return 0;
|
|
5051
5079
|
}
|
|
@@ -5053,7 +5081,9 @@ function ac_minimize_window(gobj, event, kw, src) {
|
|
|
5053
5081
|
* EV_FOCUS_WINDOW { window }
|
|
5054
5082
|
************************************************************/
|
|
5055
5083
|
function ac_focus_window(gobj, event, kw, src) {
|
|
5056
|
-
let
|
|
5084
|
+
let win = window_of(gobj, event, kw, src);
|
|
5085
|
+
if (!win) return -1;
|
|
5086
|
+
let entry = find_entry(gobj.priv, win);
|
|
5057
5087
|
if (entry) focus_entry(gobj, entry);
|
|
5058
5088
|
return 0;
|
|
5059
5089
|
}
|
|
@@ -8440,7 +8470,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8440
8470
|
[[
|
|
8441
8471
|
"span",
|
|
8442
8472
|
{ class: "icon m-0" },
|
|
8443
|
-
"<i class=\"yi-floppy-disk\"></i>"
|
|
8473
|
+
html_markup("<i class=\"yi-floppy-disk\"></i>")
|
|
8444
8474
|
], [
|
|
8445
8475
|
"span",
|
|
8446
8476
|
{
|
|
@@ -8467,7 +8497,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8467
8497
|
[[
|
|
8468
8498
|
"span",
|
|
8469
8499
|
{ class: "icon m-0" },
|
|
8470
|
-
"<i class=\"yi-arrow-rotate-left\"></i>"
|
|
8500
|
+
html_markup("<i class=\"yi-arrow-rotate-left\"></i>")
|
|
8471
8501
|
], [
|
|
8472
8502
|
"span",
|
|
8473
8503
|
{
|
|
@@ -8493,7 +8523,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8493
8523
|
[[
|
|
8494
8524
|
"span",
|
|
8495
8525
|
{ class: "icon m-0" },
|
|
8496
|
-
"<i class=\"yi-broom-wide\"></i>"
|
|
8526
|
+
html_markup("<i class=\"yi-broom-wide\"></i>")
|
|
8497
8527
|
], [
|
|
8498
8528
|
"span",
|
|
8499
8529
|
{
|
|
@@ -8519,7 +8549,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8519
8549
|
[[
|
|
8520
8550
|
"span",
|
|
8521
8551
|
{ class: "icon m-0" },
|
|
8522
|
-
"<i class=\"yi-copy\"></i>"
|
|
8552
|
+
html_markup("<i class=\"yi-copy\"></i>")
|
|
8523
8553
|
], [
|
|
8524
8554
|
"span",
|
|
8525
8555
|
{
|
|
@@ -8545,7 +8575,7 @@ function toolbar_button$1(gobj, name) {
|
|
|
8545
8575
|
[[
|
|
8546
8576
|
"span",
|
|
8547
8577
|
{ class: "icon m-0" },
|
|
8548
|
-
"<i class=\"yi-paste\"></i>"
|
|
8578
|
+
html_markup("<i class=\"yi-paste\"></i>")
|
|
8549
8579
|
], [
|
|
8550
8580
|
"span",
|
|
8551
8581
|
{
|
|
@@ -9317,7 +9347,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
9317
9347
|
[[
|
|
9318
9348
|
"span",
|
|
9319
9349
|
{ class: "icon m-0" },
|
|
9320
|
-
"<i class=\"yi-plus\"></i>"
|
|
9350
|
+
html_markup("<i class=\"yi-plus\"></i>")
|
|
9321
9351
|
], [
|
|
9322
9352
|
"span",
|
|
9323
9353
|
{
|
|
@@ -9871,7 +9901,7 @@ function create_coordinates(gobj, attrs) {
|
|
|
9871
9901
|
], [
|
|
9872
9902
|
"span",
|
|
9873
9903
|
{ class: "icon is-left is-clickable" },
|
|
9874
|
-
"<i class=\"yi-location-crosshairs\"></i>",
|
|
9904
|
+
html_markup("<i class=\"yi-location-crosshairs\"></i>"),
|
|
9875
9905
|
{ "click": function(evt) {
|
|
9876
9906
|
evt.stopPropagation();
|
|
9877
9907
|
getLocation(gobj, this.closest(".control").querySelector("input"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -24,19 +24,23 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "vite build",
|
|
26
26
|
"test": "vitest run",
|
|
27
|
+
"check-markup": "node scripts/check-markup-strings.mjs",
|
|
28
|
+
"prebuild": "npm run check-markup",
|
|
29
|
+
"pretest": "npm run check-markup",
|
|
27
30
|
"deploy-round": "node scripts/deploy-round.mjs",
|
|
28
31
|
"prepublishOnly": "npm run build"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
34
|
"@rollup/plugin-terser": "^1.0.0",
|
|
32
35
|
"@vitest/coverage-v8": "^4.1.10",
|
|
33
|
-
"@yuneta/gobj-js": "^7.26.
|
|
36
|
+
"@yuneta/gobj-js": "^7.26.3",
|
|
37
|
+
"acorn": "^8.19.0",
|
|
34
38
|
"vite": "^8.3.3",
|
|
35
39
|
"vitest": "^4.1.10"
|
|
36
40
|
},
|
|
37
41
|
"peerDependencies": {
|
|
38
42
|
"@antv/g6": "^5.1.0",
|
|
39
|
-
"@yuneta/gobj-js": "^7.
|
|
43
|
+
"@yuneta/gobj-js": "^7.26.3",
|
|
40
44
|
"bulma": "^1.0.4",
|
|
41
45
|
"i18next": "^26.3.6",
|
|
42
46
|
"maplibre-gl": "^6.11.2",
|
package/src/c_yui_form.js
CHANGED
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
treedb_decoder_fkey,
|
|
49
49
|
gclass_find_by_name,
|
|
50
50
|
gobj_is_destroying,
|
|
51
|
+
html_markup,
|
|
51
52
|
} from "@yuneta/gobj-js";
|
|
52
53
|
|
|
53
54
|
import {t} from "i18next";
|
|
@@ -384,7 +385,7 @@ function toolbar_button(gobj, name)
|
|
|
384
385
|
switch(name) {
|
|
385
386
|
case "save":
|
|
386
387
|
return ['button', {class: 'button p-1 button-save', title: t('save'), 'data-i18n-title': 'save', 'aria-label': t('save'), 'data-i18n-aria-label': 'save', disabled: true}, [
|
|
387
|
-
['span', {class: 'icon m-0'}, '<i class="yi-floppy-disk"></i>'],
|
|
388
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-floppy-disk"></i>')],
|
|
388
389
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'save'}, 'save']
|
|
389
390
|
], {
|
|
390
391
|
click: function(evt) {
|
|
@@ -394,7 +395,7 @@ function toolbar_button(gobj, name)
|
|
|
394
395
|
}];
|
|
395
396
|
case "undo":
|
|
396
397
|
return ['button', {class: 'button p-1 button-undo', title: t('undo'), 'data-i18n-title': 'undo', 'aria-label': t('undo'), 'data-i18n-aria-label': 'undo', disabled: true}, [
|
|
397
|
-
['span', {class: 'icon m-0'}, '<i class="yi-arrow-rotate-left"></i>'],
|
|
398
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-arrow-rotate-left"></i>')],
|
|
398
399
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'undo'}, 'undo']
|
|
399
400
|
], {
|
|
400
401
|
click: function(evt) {
|
|
@@ -404,7 +405,7 @@ function toolbar_button(gobj, name)
|
|
|
404
405
|
}];
|
|
405
406
|
case "clear":
|
|
406
407
|
return ['button', {class: 'button p-1 button-clear', title: t('clear'), 'data-i18n-title': 'clear', 'aria-label': t('clear'), 'data-i18n-aria-label': 'clear'}, [
|
|
407
|
-
['span', {class: 'icon m-0'}, '<i class="yi-broom-wide"></i>'],
|
|
408
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-broom-wide"></i>')],
|
|
408
409
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'clear'}, 'clear']
|
|
409
410
|
], {
|
|
410
411
|
click: function(evt) {
|
|
@@ -414,7 +415,7 @@ function toolbar_button(gobj, name)
|
|
|
414
415
|
}];
|
|
415
416
|
case "copy":
|
|
416
417
|
return ['button', {class: 'button p-1 button-copy', title: t('copy'), 'data-i18n-title': 'copy', 'aria-label': t('copy'), 'data-i18n-aria-label': 'copy'}, [
|
|
417
|
-
['span', {class: 'icon m-0'}, '<i class="yi-copy"></i>'],
|
|
418
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-copy"></i>')],
|
|
418
419
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'copy'}, 'copy']
|
|
419
420
|
], {click: function(evt) {
|
|
420
421
|
evt.stopPropagation();
|
|
@@ -423,7 +424,7 @@ function toolbar_button(gobj, name)
|
|
|
423
424
|
}];
|
|
424
425
|
case "paste":
|
|
425
426
|
return ['button', {class: 'button p-1 button-paste', title: t('paste'), 'data-i18n-title': 'paste', 'aria-label': t('paste'), 'data-i18n-aria-label': 'paste'}, [
|
|
426
|
-
['span', {class: 'icon m-0'}, '<i class="yi-paste"></i>'],
|
|
427
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-paste"></i>')],
|
|
427
428
|
['span', {class: 'is-hidden-mobile pl-1 pr-1', i18n: 'paste'}, 'paste']
|
|
428
429
|
], {click: async function(evt) {
|
|
429
430
|
evt.stopPropagation();
|
|
@@ -1379,7 +1380,7 @@ function create_form_field(
|
|
|
1379
1380
|
['button', {class: 'button p-1',
|
|
1380
1381
|
title: t('add'), 'data-i18n-title': 'add',
|
|
1381
1382
|
'aria-label': t('add'), 'data-i18n-aria-label': 'add'}, [
|
|
1382
|
-
['span', {class: 'icon m-0'}, '<i class="yi-plus"></i>'],
|
|
1383
|
+
['span', {class: 'icon m-0'}, html_markup('<i class="yi-plus"></i>')],
|
|
1383
1384
|
['span', {class: 'p-1 pr-2 is-hidden-mobile', i18n: 'add'}, 'add'],
|
|
1384
1385
|
], {
|
|
1385
1386
|
click: function(evt) {
|
|
@@ -2063,7 +2064,7 @@ function create_coordinates(gobj, attrs)
|
|
|
2063
2064
|
{
|
|
2064
2065
|
class: 'icon is-left is-clickable'
|
|
2065
2066
|
},
|
|
2066
|
-
'<i class="yi-location-crosshairs"></i>',
|
|
2067
|
+
html_markup('<i class="yi-location-crosshairs"></i>'),
|
|
2067
2068
|
{
|
|
2068
2069
|
'click': function (evt) {
|
|
2069
2070
|
evt.stopPropagation();
|
package/src/c_yui_window.js
CHANGED
|
@@ -42,6 +42,8 @@ import {
|
|
|
42
42
|
gobj_is_destroying,
|
|
43
43
|
refresh_language,
|
|
44
44
|
empty_string,
|
|
45
|
+
gobj_full_name,
|
|
46
|
+
html_markup,
|
|
45
47
|
} from "@yuneta/gobj-js";
|
|
46
48
|
|
|
47
49
|
import {t} from "i18next";
|
|
@@ -163,7 +165,7 @@ function mt_create(gobj)
|
|
|
163
165
|
$c.addEventListener("pointerdown", function() {
|
|
164
166
|
let m = gobj_read_pointer_attr(gobj, "manager");
|
|
165
167
|
if(m) {
|
|
166
|
-
gobj_send_event(m, "EV_FOCUS_WINDOW", {window: gobj}, gobj);
|
|
168
|
+
gobj_send_event(m, "EV_FOCUS_WINDOW", {window: gobj_full_name(gobj)}, gobj);
|
|
167
169
|
}
|
|
168
170
|
}, true);
|
|
169
171
|
}
|
|
@@ -175,7 +177,7 @@ function mt_create(gobj)
|
|
|
175
177
|
* own), `title_prefix` the DATA half, never translated. */
|
|
176
178
|
let chip_title = composed_title(gobj);
|
|
177
179
|
gobj_send_event(manager, "EV_REGISTER_WINDOW", {
|
|
178
|
-
window: gobj,
|
|
180
|
+
window: gobj_full_name(gobj),
|
|
179
181
|
title: chip_title ? chip_title : gobj_short_name(gobj),
|
|
180
182
|
title_key: gobj_read_str_attr(gobj, "title") || "",
|
|
181
183
|
title_kind_text: empty_string(gobj_read_str_attr(gobj, "title"))
|
|
@@ -215,7 +217,7 @@ function mt_destroy(gobj)
|
|
|
215
217
|
{
|
|
216
218
|
let manager = gobj_read_pointer_attr(gobj, "manager");
|
|
217
219
|
if(manager) {
|
|
218
|
-
gobj_send_event(manager, "EV_UNREGISTER_WINDOW", {window: gobj}, gobj);
|
|
220
|
+
gobj_send_event(manager, "EV_UNREGISTER_WINDOW", {window: gobj_full_name(gobj)}, gobj);
|
|
219
221
|
}
|
|
220
222
|
|
|
221
223
|
/* Retire the overlay-history entry, if this was a Back-dismissable
|
|
@@ -415,7 +417,7 @@ function do_minimize(gobj)
|
|
|
415
417
|
log_error(`${gobj_short_name(gobj)}: minimize without a window manager`);
|
|
416
418
|
return;
|
|
417
419
|
}
|
|
418
|
-
gobj_send_event(manager, "EV_MINIMIZE_WINDOW", {window: gobj}, gobj);
|
|
420
|
+
gobj_send_event(manager, "EV_MINIMIZE_WINDOW", {window: gobj_full_name(gobj)}, gobj);
|
|
419
421
|
}
|
|
420
422
|
|
|
421
423
|
/************************************************************
|
|
@@ -553,7 +555,7 @@ function build_ui(gobj)
|
|
|
553
555
|
'aria-label': t('minimize'), 'data-i18n-aria-label': 'minimize',
|
|
554
556
|
style: (gobj_read_bool_attr(gobj, "showMin") &&
|
|
555
557
|
gobj_read_pointer_attr(gobj, "manager")) ? '' : 'display:none;',
|
|
556
|
-
}, WC_MIN, {
|
|
558
|
+
}, html_markup(WC_MIN), {
|
|
557
559
|
click: (evt) => {
|
|
558
560
|
evt.stopPropagation();
|
|
559
561
|
do_minimize(gobj);
|
|
@@ -567,7 +569,7 @@ function build_ui(gobj)
|
|
|
567
569
|
title: t('maximize'), 'data-i18n-title': 'maximize',
|
|
568
570
|
'aria-label': t('maximize'), 'data-i18n-aria-label': 'maximize',
|
|
569
571
|
style: gobj_read_bool_attr(gobj, "showMax") ? '' : 'display:none;',
|
|
570
|
-
}, WC_MAX, {
|
|
572
|
+
}, html_markup(WC_MAX), {
|
|
571
573
|
click: (evt) => {
|
|
572
574
|
evt.stopPropagation();
|
|
573
575
|
toggle(gobj);
|
|
@@ -580,7 +582,7 @@ function build_ui(gobj)
|
|
|
580
582
|
class: 'WINDOW_CLOSE yui-wc wc-close', type: 'button',
|
|
581
583
|
title: t('close'), 'data-i18n-title': 'close',
|
|
582
584
|
'aria-label': t('close'), 'data-i18n-aria-label': 'close',
|
|
583
|
-
}, WC_CLOSE, {
|
|
585
|
+
}, html_markup(WC_CLOSE), {
|
|
584
586
|
click: (evt) => {
|
|
585
587
|
evt.stopPropagation();
|
|
586
588
|
gobj_send_event(gobj, "EV_CLOSE_WINDOW", {}, gobj);
|
|
@@ -672,7 +674,7 @@ function build_ui(gobj)
|
|
|
672
674
|
"box-sizing": "border-box",
|
|
673
675
|
}
|
|
674
676
|
}, [
|
|
675
|
-
['span', {style: 'display:inline-block;height:1.4em; width:1.4em;'}, '<svg viewBox="0 0 500 500"><path d="m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z" fill="var(--bulma-text)" stroke-width="33.78"/></svg>']
|
|
677
|
+
['span', {style: 'display:inline-block;height:1.4em; width:1.4em;'}, html_markup('<svg viewBox="0 0 500 500"><path d="m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z" fill="var(--bulma-text)" stroke-width="33.78"/></svg>')]
|
|
676
678
|
|
|
677
679
|
], {
|
|
678
680
|
pointerdown: (evt) => {
|
|
@@ -706,7 +708,7 @@ function build_ui(gobj)
|
|
|
706
708
|
{
|
|
707
709
|
style: 'display:inline-block;height:1.4em; width:1.4em;'
|
|
708
710
|
},
|
|
709
|
-
'<svg viewBox="0 0 500 500"><path d="m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z" fill="var(--bulma-text)" stroke-width="33.78"/></svg>'
|
|
711
|
+
html_markup('<svg viewBox="0 0 500 500"><path d="m427.87 493.69a33.778 33.78 0 0 1-23.882-57.661l33.778-33.78a33.799 33.8 0 0 1 47.83 47.763l-33.778 33.78a33.778 33.78 0 0 1-23.882 9.8976zm-190.44 0a33.778 33.78 0 0 1-23.882-57.661l224.22-224.23a33.799 33.8 0 0 1 47.83 47.763l-224.22 224.23a33.778 33.78 0 0 1-23.882 9.8976zm-197.26 0a33.778 33.78 0 0 1-23.882-57.661l421.46-421.47a33.786 33.786 0 1 1 47.797 47.763l-421.49 421.47a33.778 33.78 0 0 1-23.882 9.8976z" fill="var(--bulma-text)" stroke-width="33.78"/></svg>')
|
|
710
712
|
]
|
|
711
713
|
|
|
712
714
|
], {
|
|
@@ -1240,7 +1242,7 @@ function ac_show(gobj, event, kw, src)
|
|
|
1240
1242
|
* moved to the top of its layer. */
|
|
1241
1243
|
let manager = gobj_read_pointer_attr(gobj, "manager");
|
|
1242
1244
|
if(manager) {
|
|
1243
|
-
gobj_send_event(manager, "EV_FOCUS_WINDOW", {window: gobj}, gobj);
|
|
1245
|
+
gobj_send_event(manager, "EV_FOCUS_WINDOW", {window: gobj_full_name(gobj)}, gobj);
|
|
1244
1246
|
return 0;
|
|
1245
1247
|
}
|
|
1246
1248
|
let $container = gobj_read_attr(gobj, "$container");
|
|
@@ -35,6 +35,10 @@ import {
|
|
|
35
35
|
data_type_t,
|
|
36
36
|
gclass_create,
|
|
37
37
|
log_error,
|
|
38
|
+
log_warning,
|
|
39
|
+
is_gobj,
|
|
40
|
+
gobj_full_name,
|
|
41
|
+
gobj_short_name,
|
|
38
42
|
gobj_read_pointer_attr,
|
|
39
43
|
gobj_subscribe_event,
|
|
40
44
|
gobj_send_event,
|
|
@@ -42,6 +46,7 @@ import {
|
|
|
42
46
|
gobj_write_attr,
|
|
43
47
|
gobj_read_attr,
|
|
44
48
|
gobj_name,
|
|
49
|
+
html_markup,
|
|
45
50
|
} from "@yuneta/gobj-js";
|
|
46
51
|
|
|
47
52
|
import {t} from "i18next";
|
|
@@ -342,6 +347,38 @@ function chip_lead(icon)
|
|
|
342
347
|
/************************************************************
|
|
343
348
|
* Find a registry entry by its window gobj.
|
|
344
349
|
************************************************************/
|
|
350
|
+
/************************************************************
|
|
351
|
+
* The window an event is about. A kw is plain json (the machine
|
|
352
|
+
* trace dumps it), so the window travels in it as its FULL NAME,
|
|
353
|
+
* which the trace can print, and the gobj is the event's src --
|
|
354
|
+
* every sender is the window itself. Up to 7.26.9 the kw carried
|
|
355
|
+
* the gobj; that is still taken, with a warning, for this release.
|
|
356
|
+
************************************************************/
|
|
357
|
+
let warned_gobj_in_kw = false;
|
|
358
|
+
|
|
359
|
+
function window_of(gobj, event, kw, src)
|
|
360
|
+
{
|
|
361
|
+
let w = kw && kw.window;
|
|
362
|
+
if(is_gobj(w)) {
|
|
363
|
+
if(!warned_gobj_in_kw) {
|
|
364
|
+
warned_gobj_in_kw = true;
|
|
365
|
+
log_warning(
|
|
366
|
+
`${gobj_short_name(gobj)}: ${event} carries the window gobj ` +
|
|
367
|
+
`in its kw: send {window: gobj_full_name(window)} from the window`
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
return w;
|
|
371
|
+
}
|
|
372
|
+
if(!is_gobj(src) || gobj_full_name(src) !== w) {
|
|
373
|
+
log_error(
|
|
374
|
+
`${gobj_short_name(gobj)}: ${event}: window '${w}' is not the ` +
|
|
375
|
+
`src of the event (${is_gobj(src) ? gobj_full_name(src) : String(src)})`
|
|
376
|
+
);
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
return src;
|
|
380
|
+
}
|
|
381
|
+
|
|
345
382
|
function find_entry(priv, win)
|
|
346
383
|
{
|
|
347
384
|
for(let e of priv.windows) {
|
|
@@ -457,8 +494,11 @@ function ac_register_window(gobj, event, kw, src)
|
|
|
457
494
|
{
|
|
458
495
|
let priv = gobj.priv;
|
|
459
496
|
|
|
460
|
-
let win = kw
|
|
461
|
-
if(!win
|
|
497
|
+
let win = window_of(gobj, event, kw, src);
|
|
498
|
+
if(!win) {
|
|
499
|
+
return -1; // Error already logged
|
|
500
|
+
}
|
|
501
|
+
if(find_entry(priv, win)) {
|
|
462
502
|
return 0;
|
|
463
503
|
}
|
|
464
504
|
|
|
@@ -501,7 +541,7 @@ function ac_register_window(gobj, event, kw, src)
|
|
|
501
541
|
['span', {class: 'yui-dock-label'}, label_items],
|
|
502
542
|
['button', {class: 'yui-dock-close', type: 'button',
|
|
503
543
|
title: t('close'), 'data-i18n-title': 'close',
|
|
504
|
-
'aria-label': t('close'), 'data-i18n-aria-label': 'close'}, WC_X, {
|
|
544
|
+
'aria-label': t('close'), 'data-i18n-aria-label': 'close'}, html_markup(WC_X), {
|
|
505
545
|
click: (evt) => {
|
|
506
546
|
evt.stopPropagation();
|
|
507
547
|
gobj_send_event(entry.gobj, "EV_CLOSE_WINDOW", {}, gobj);
|
|
@@ -547,7 +587,11 @@ function ac_unregister_window(gobj, event, kw, src)
|
|
|
547
587
|
{
|
|
548
588
|
let priv = gobj.priv;
|
|
549
589
|
|
|
550
|
-
let
|
|
590
|
+
let win = window_of(gobj, event, kw, src);
|
|
591
|
+
if(!win) {
|
|
592
|
+
return -1; // Error already logged
|
|
593
|
+
}
|
|
594
|
+
let entry = find_entry(priv, win);
|
|
551
595
|
if(!entry) {
|
|
552
596
|
return 0;
|
|
553
597
|
}
|
|
@@ -564,7 +608,11 @@ function ac_unregister_window(gobj, event, kw, src)
|
|
|
564
608
|
************************************************************/
|
|
565
609
|
function ac_minimize_window(gobj, event, kw, src)
|
|
566
610
|
{
|
|
567
|
-
let
|
|
611
|
+
let win = window_of(gobj, event, kw, src);
|
|
612
|
+
if(!win) {
|
|
613
|
+
return -1; // Error already logged
|
|
614
|
+
}
|
|
615
|
+
let entry = find_entry(gobj.priv, win);
|
|
568
616
|
if(entry) {
|
|
569
617
|
minimize_entry(gobj, entry);
|
|
570
618
|
}
|
|
@@ -576,7 +624,11 @@ function ac_minimize_window(gobj, event, kw, src)
|
|
|
576
624
|
************************************************************/
|
|
577
625
|
function ac_focus_window(gobj, event, kw, src)
|
|
578
626
|
{
|
|
579
|
-
let
|
|
627
|
+
let win = window_of(gobj, event, kw, src);
|
|
628
|
+
if(!win) {
|
|
629
|
+
return -1; // Error already logged
|
|
630
|
+
}
|
|
631
|
+
let entry = find_entry(gobj.priv, win);
|
|
580
632
|
if(entry) {
|
|
581
633
|
focus_entry(gobj, entry);
|
|
582
634
|
}
|
|
@@ -22,8 +22,8 @@ if(typeof globalThis.matchMedia === "undefined") {
|
|
|
22
22
|
const {
|
|
23
23
|
SDATA_END, gclass_create,
|
|
24
24
|
gobj_start_up, gobj_create_yuno, gobj_create, gobj_create_service,
|
|
25
|
-
gobj_start, gobj_read_attr, gobj_send_event,
|
|
26
|
-
set_log_callback,
|
|
25
|
+
gobj_start, gobj_read_attr, gobj_send_event, gobj_full_name,
|
|
26
|
+
set_log_callback, set_strings_are_text,
|
|
27
27
|
} = await import("@yuneta/gobj-js");
|
|
28
28
|
const {register_c_yui_window} = await import("./c_yui_window.js");
|
|
29
29
|
const {register_c_yui_window_manager} = await import("./c_yui_window_manager.js");
|
|
@@ -73,11 +73,58 @@ describe("EV_SHOW", () => {
|
|
|
73
73
|
gobj_start(w);
|
|
74
74
|
const $w = gobj_read_attr(w, "$container");
|
|
75
75
|
|
|
76
|
-
gobj_send_event(dock, "EV_MINIMIZE_WINDOW", {window: w}, w);
|
|
76
|
+
gobj_send_event(dock, "EV_MINIMIZE_WINDOW", {window: gobj_full_name(w)}, w);
|
|
77
77
|
expect($w.style.getPropertyValue("display")).toBe("none");
|
|
78
78
|
|
|
79
79
|
gobj_send_event(w, "EV_SHOW", {}, yuno);
|
|
80
80
|
expect($w.style.getPropertyValue("display")).toBe("");
|
|
81
81
|
expect(errors()).toEqual([]);
|
|
82
82
|
});
|
|
83
|
+
|
|
84
|
+
test("the dock's events carry the window's NAME, plain json; the gobj is the src", () => {
|
|
85
|
+
const dock = gobj_create_service("name_dock", "C_YUI_WINDOW_MANAGER", {}, yuno);
|
|
86
|
+
gobj_start(dock);
|
|
87
|
+
const w = gobj_create_service("name_w", "C_YUI_WINDOW",
|
|
88
|
+
{header: "w", body: ["div", {}, "w"], manager: dock}, yuno);
|
|
89
|
+
gobj_start(w);
|
|
90
|
+
const $w = gobj_read_attr(w, "$container");
|
|
91
|
+
|
|
92
|
+
/* What the window itself sent to register is json. */
|
|
93
|
+
expect(dock.priv.windows.some((e) => e.gobj === w)).toBe(true);
|
|
94
|
+
|
|
95
|
+
/* A name that is not the src's is refused, loudly. */
|
|
96
|
+
logged.length = 0;
|
|
97
|
+
gobj_send_event(dock, "EV_MINIMIZE_WINDOW", {window: "someone^else"}, w);
|
|
98
|
+
expect($w.style.getPropertyValue("display")).toBe("");
|
|
99
|
+
expect(errors().some((m) => m.includes("is not the src"))).toBe(true);
|
|
100
|
+
|
|
101
|
+
/* The old form (the gobj in the kw) still works, with a warning. */
|
|
102
|
+
logged.length = 0;
|
|
103
|
+
gobj_send_event(dock, "EV_MINIMIZE_WINDOW", {window: w}, w);
|
|
104
|
+
expect($w.style.getPropertyValue("display")).toBe("none");
|
|
105
|
+
expect(errors()).toEqual([]);
|
|
106
|
+
expect(logged.some((l) => l.level === "warning" && l.msg.includes("gobj_full_name"))).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("with plain strings as TEXT (set_strings_are_text) the controls are still svg", () => {
|
|
110
|
+
set_strings_are_text(true);
|
|
111
|
+
try {
|
|
112
|
+
logged.length = 0;
|
|
113
|
+
const dock = gobj_create_service("strict_dock", "C_YUI_WINDOW_MANAGER", {}, yuno);
|
|
114
|
+
gobj_start(dock);
|
|
115
|
+
const w = gobj_create_service("strict_w", "C_YUI_WINDOW",
|
|
116
|
+
{header: "w", body: ["div", {}, "w"], manager: dock}, yuno);
|
|
117
|
+
gobj_start(w);
|
|
118
|
+
const $w = gobj_read_attr(w, "$container");
|
|
119
|
+
for(const cls of ["wc-min", "wc-max", "wc-close"]) {
|
|
120
|
+
const $b = $w.querySelector(`.yui-wc.${cls}`);
|
|
121
|
+
expect($b, cls).not.toBe(null);
|
|
122
|
+
expect($b.textContent.includes("<svg"), cls).toBe(false);
|
|
123
|
+
expect($b.querySelector("svg"), cls).not.toBe(null);
|
|
124
|
+
}
|
|
125
|
+
expect(logged.some((l) => l.msg.includes("html_markup"))).toBe(false);
|
|
126
|
+
} finally {
|
|
127
|
+
set_strings_are_text(false);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
83
130
|
});
|