@yuneta/gobj-ui 7.26.4 → 7.26.6
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 +67 -0
- package/dist/gobj-ui.cjs.js +744 -187
- package/dist/gobj-ui.es.js +735 -188
- package/index.js +13 -1
- package/package.json +1 -1
- package/src/c_yui_form.js +147 -8
- package/src/c_yui_schema_editor.js +23 -1
- package/src/c_yui_shell.js +28 -0
- package/src/c_yui_treedb_topic_with_form.js +78 -2
- package/src/c_yui_treedb_topics.js +77 -7
- package/src/lib_icons.js +395 -0
- package/src/lib_icons.test.js +214 -0
- package/src/yui_icons.css +20 -0
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -2608,6 +2608,7 @@ function create_gclass$22(gclass_name) {
|
|
|
2608
2608
|
["EV_ROUTE_REQUESTED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
2609
2609
|
["EV_ROUTE_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
2610
2610
|
["EV_LANGUAGE_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
2611
|
+
["EV_ICONS_CHANGED", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_PUBLIC_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS],
|
|
2611
2612
|
["EV_CONNECTION_STATE", _yuneta_gobj_js.event_flag_t.EVF_OUTPUT_EVENT | _yuneta_gobj_js.event_flag_t.EVF_NO_WARN_SUBS]
|
|
2612
2613
|
];
|
|
2613
2614
|
__gclass__$22 = (0, _yuneta_gobj_js.gclass_create)(gclass_name, event_types, states, gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, _yuneta_gobj_js.gclass_flag_t.gcflag_no_check_output_events);
|
|
@@ -2911,6 +2912,22 @@ function yui_shell_translate(shell_gobj, $el) {
|
|
|
2911
2912
|
(0, _yuneta_gobj_js.refresh_language)($el, priv.translator);
|
|
2912
2913
|
}
|
|
2913
2914
|
/************************************************************
|
|
2915
|
+
* The user icons changed (lib_icons.js: yui_icons_set_user,
|
|
2916
|
+
* yui_icons_put_user, yui_icons_remove_user): PUBLISH it, so
|
|
2917
|
+
* the views that decided at render time whether a name is an
|
|
2918
|
+
* icon draw it again.
|
|
2919
|
+
*
|
|
2920
|
+
* The registry is a module and knows no shell; the view that
|
|
2921
|
+
* fed it calls this.
|
|
2922
|
+
************************************************************/
|
|
2923
|
+
function yui_shell_icons_changed(shell_gobj) {
|
|
2924
|
+
if (!shell_gobj || !(0, _yuneta_gobj_js.is_gobj)(shell_gobj)) {
|
|
2925
|
+
(0, _yuneta_gobj_js.log_error)("yui_shell_icons_changed(): no shell");
|
|
2926
|
+
return;
|
|
2927
|
+
}
|
|
2928
|
+
(0, _yuneta_gobj_js.gobj_publish_event)(shell_gobj, "EV_ICONS_CHANGED", {});
|
|
2929
|
+
}
|
|
2930
|
+
/************************************************************
|
|
2914
2931
|
* Set the backend-connection state painted by every
|
|
2915
2932
|
* type:"connection" toolbar item. Host/event-driven: the
|
|
2916
2933
|
* app calls this from its transport handlers (EV_ON_OPEN →
|
|
@@ -7090,6 +7107,496 @@ function yui_watch_theme(gobj, event = "EV_THEME") {
|
|
|
7090
7107
|
}
|
|
7091
7108
|
} };
|
|
7092
7109
|
}
|
|
7110
|
+
//#endregion
|
|
7111
|
+
//#region src/lib_icons.js
|
|
7112
|
+
/*********************************************************
|
|
7113
|
+
* lib_icons.js
|
|
7114
|
+
*
|
|
7115
|
+
* Two icon systems are managed here:
|
|
7116
|
+
*
|
|
7117
|
+
* 1. FA-style CSS icons (yui_icons.css)
|
|
7118
|
+
* Usage: <i class="yi-save"></i>
|
|
7119
|
+
* Color: inherits currentColor from parent via CSS mask.
|
|
7120
|
+
*
|
|
7121
|
+
* 2. SVG symbol icons for G6 toolbar (and any other component
|
|
7122
|
+
* that uses <use xlink:href="#id">).
|
|
7123
|
+
* Symbols are injected once into the DOM.
|
|
7124
|
+
* All symbol ids are prefixed with "g6-icon-" to avoid
|
|
7125
|
+
* conflicts with other DOM elements.
|
|
7126
|
+
* Icon paths come from:
|
|
7127
|
+
* fontawesome-free-7.1.0-web/sprites/solid.svg
|
|
7128
|
+
*
|
|
7129
|
+
* G6 toolbar items are managed via CSS class names (className
|
|
7130
|
+
* field in getItems()) using YuiToolbar in c_g6_nodes_tree.js.
|
|
7131
|
+
* This lets lib_graph.js state functions (set_submit_state,
|
|
7132
|
+
* disableElements, …) work on toolbar icons exactly like on
|
|
7133
|
+
* regular Bulma/FA buttons — no icon-specific helpers needed.
|
|
7134
|
+
*
|
|
7135
|
+
* 3. User icons: the icons a user adds as DATA, one node of the
|
|
7136
|
+
* treedb system topic `__icons__` each (id = name, svg = drawing).
|
|
7137
|
+
* They join system 1 at run time: each becomes a rule
|
|
7138
|
+
* `.yi-u-<id>::before` in a stylesheet of their own, so every
|
|
7139
|
+
* component that draws an icon by class name draws them too.
|
|
7140
|
+
* `yi-u-` is the user's namespace, and the reason a user icon can
|
|
7141
|
+
* never replace an icon of the library.
|
|
7142
|
+
*
|
|
7143
|
+
* Copyright (c) 2025-2026, ArtGins.
|
|
7144
|
+
* All Rights Reserved.
|
|
7145
|
+
*********************************************************/
|
|
7146
|
+
var CUSTOM_SVG_ICONS_ID = "g6-custom-svgicons";
|
|
7147
|
+
var ICONS = `<svg xmlns="http://www.w3.org/2000/svg">
|
|
7148
|
+
<!-- magnifying-glass-plus -->
|
|
7149
|
+
<symbol id="g6-icon-zoom-in" viewBox="0 0 512 512">
|
|
7150
|
+
<path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376C296.3 401.1 253.9 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208zM208 112c-13.3 0-24 10.7-24 24l0 48-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l48 0 0 48c0 13.3 10.7 24 24 24s24-10.7 24-24l0-48 48 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-48c0-13.3-10.7-24-24-24z"/>
|
|
7151
|
+
</symbol>
|
|
7152
|
+
<!-- magnifying-glass-minus -->
|
|
7153
|
+
<symbol id="g6-icon-zoom-out" viewBox="0 0 512 512">
|
|
7154
|
+
<path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376C296.3 401.1 253.9 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z"/>
|
|
7155
|
+
</symbol>
|
|
7156
|
+
<!-- house (reset zoom: back to original 100% view) -->
|
|
7157
|
+
<symbol id="g6-icon-home" viewBox="0 0 512 512">
|
|
7158
|
+
<path fill="currentColor" d="M277.8 8.6c-12.3-11.4-31.3-11.4-43.5 0l-224 208c-9.6 9-12.8 22.9-8 35.1S18.8 272 32 272l16 0 0 176c0 35.3 28.7 64 64 64l288 0c35.3 0 64-28.7 64-64l0-176 16 0c13.2 0 25-8.1 29.8-20.3s1.6-26.2-8-35.1l-224-208zM240 320l32 0c26.5 0 48 21.5 48 48l0 96-128 0 0-96c0-26.5 21.5-48 48-48z"/>
|
|
7159
|
+
</symbol>
|
|
7160
|
+
<!-- expand (zoom to fit) -->
|
|
7161
|
+
<symbol id="g6-icon-fit" viewBox="0 0 448 512">
|
|
7162
|
+
<path fill="currentColor" d="M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"/>
|
|
7163
|
+
</symbol>
|
|
7164
|
+
<!-- fit to selection: the same corner brackets as the fit icon,
|
|
7165
|
+
around a marked object. The two sit side by side in the
|
|
7166
|
+
toolbar and have to read as a family, which a borrowed glyph
|
|
7167
|
+
would not. (No backticks in here: the sprite lives inside a
|
|
7168
|
+
template literal.) -->
|
|
7169
|
+
<symbol id="g6-icon-fit-selection" viewBox="0 0 448 512">
|
|
7170
|
+
<path fill="currentColor" d="M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"/>
|
|
7171
|
+
<rect fill="currentColor" x="144" y="176" width="160" height="160" rx="24"/>
|
|
7172
|
+
</symbol>
|
|
7173
|
+
<!-- crosshairs (center) -->
|
|
7174
|
+
<symbol id="g6-icon-center" viewBox="0 0 576 512">
|
|
7175
|
+
<path fill="currentColor" d="M288-16c17.7 0 32 14.3 32 32l0 18.3c98.1 14 175.7 91.6 189.7 189.7l18.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-18.3 0c-14 98.1-91.6 175.7-189.7 189.7l0 18.3c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.3C157.9 463.7 80.3 386.1 66.3 288L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l18.3 0C80.3 125.9 157.9 48.3 256 34.3L256 16c0-17.7 14.3-32 32-32zM131.2 288c12.7 62.7 62.1 112.1 124.8 124.8l0-12.8c0-17.7 14.3-32 32-32s32 14.3 32 32l0 12.8c62.7-12.7 112.1-62.1 124.8-124.8L432 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l12.8 0C432.1 161.3 382.7 111.9 320 99.2l0 12.8c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-12.8C193.3 111.9 143.9 161.3 131.2 224l12.8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-12.8 0zM288 208a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"/>
|
|
7176
|
+
</symbol>
|
|
7177
|
+
<!-- up-right-and-down-left-from-center (enter fullscreen) -->
|
|
7178
|
+
<symbol id="g6-icon-fullscreen" viewBox="0 0 512 512">
|
|
7179
|
+
<path fill="currentColor" d="M344 0L488 0c13.3 0 24 10.7 24 24l0 144c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87-39-39c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512L24 512c-13.3 0-24-10.7-24-24L0 344c0-9.7 5.8-18.5 14.8-22.2S34.1 320.2 41 327l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2S177.7 512 168 512z"/>
|
|
7180
|
+
</symbol>
|
|
7181
|
+
<!-- down-left-and-up-right-to-center (exit fullscreen) -->
|
|
7182
|
+
<symbol id="g6-icon-fullscreen-exit" viewBox="0 0 512 512">
|
|
7183
|
+
<path fill="currentColor" d="M439.5 7c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2S450.2 240 440.5 240l-144 0c-13.3 0-24-10.7-24-24l0-144c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87zM72.5 272l144 0c13.3 0 24 10.7 24 24l0 144c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87-39-39c-6.9-6.9-8.9-17.2-5.2-26.2S62.8 272 72.5 272z"/>
|
|
7184
|
+
</symbol>
|
|
7185
|
+
<!-- arrow-rotate-left (undo) -->
|
|
7186
|
+
<symbol id="g6-icon-undo" viewBox="0 0 512 512">
|
|
7187
|
+
<path fill="currentColor" d="M256 64c-56.8 0-107.9 24.7-143.1 64l47.1 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 192c-17.7 0-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0S64 14.3 64 32l0 54.7C110.9 33.6 179.5 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-87 0-163.9-43.4-210.1-109.7-10.1-14.5-6.6-34.4 7.9-44.6s34.4-6.6 44.6 7.9c34.8 49.8 92.4 82.3 157.6 82.3 106 0 192-86 192-192S362 64 256 64z"/>
|
|
7188
|
+
</symbol>
|
|
7189
|
+
<!-- arrow-rotate-right (redo) -->
|
|
7190
|
+
<symbol id="g6-icon-redo" viewBox="0 0 512 512">
|
|
7191
|
+
<path fill="currentColor" d="M436.7 74.7L448 85.4 448 32c0-17.7 14.3-32 32-32s32 14.3 32 32l0 128c0 17.7-14.3 32-32 32l-128 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l47.9 0-7.6-7.2c-.2-.2-.4-.4-.6-.6-75-75-196.5-75-271.5 0s-75 196.5 0 271.5 196.5 75 271.5 0c8.2-8.2 15.5-16.9 21.9-26.1 10.1-14.5 30.1-18 44.6-7.9s18 30.1 7.9 44.6c-8.5 12.2-18.2 23.8-29.1 34.7-100 100-262.1 100-362 0S-25 175 75 75c99.9-99.9 261.7-100 361.7-.3z"/>
|
|
7192
|
+
</symbol>
|
|
7193
|
+
<!-- pen (edit node) -->
|
|
7194
|
+
<symbol id="g6-icon-edit" viewBox="0 0 512 512">
|
|
7195
|
+
<path fill="currentColor" d="M352.9 21.2L308 66.1 445.9 204 490.8 159.1C504.4 145.6 512 127.2 512 108s-7.6-37.6-21.2-51.1L455.1 21.2C441.6 7.6 423.2 0 404 0s-37.6 7.6-51.1 21.2zM274.1 100L58.9 315.1c-10.7 10.7-18.5 24.1-22.6 38.7L.9 481.6c-2.3 8.3 0 17.3 6.2 23.4s15.1 8.5 23.4 6.2l127.8-35.5c14.6-4.1 27.9-11.8 38.7-22.6L412 237.9 274.1 100z"/>
|
|
7196
|
+
</symbol>
|
|
7197
|
+
<!-- trash-can (delete) -->
|
|
7198
|
+
<symbol id="g6-icon-delete" viewBox="0 0 448 512">
|
|
7199
|
+
<path fill="currentColor" d="M136.7 5.9C141.1-7.2 153.3-16 167.1-16l113.9 0c13.8 0 26 8.8 30.4 21.9L320 32 416 32c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 8.7-26.1zM32 144l384 0 0 304c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-304zm88 64c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24zm104 0c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24zm104 0c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24z"/>
|
|
7200
|
+
</symbol>
|
|
7201
|
+
<!-- link (link nodes) -->
|
|
7202
|
+
<symbol id="g6-icon-link" viewBox="0 0 576 512">
|
|
7203
|
+
<path fill="currentColor" d="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z"/>
|
|
7204
|
+
</symbol>
|
|
7205
|
+
<!-- link-slash (unlink) -->
|
|
7206
|
+
<symbol id="g6-icon-unlink" viewBox="0 0 576 512">
|
|
7207
|
+
<path fill="currentColor" d="M41-24.9c-9.4-9.4-24.6-9.4-33.9 0S-2.3-.3 7 9.1l528 528c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-122-122c4.2-3.4 8.3-7.1 12.1-10.9l71.1-71.1c29.3-29.3 45.8-69.1 45.8-110.6 0-86.4-70-156.5-156.5-156.5-37.3 0-73.1 13.3-101.3 37.2 20.3 10.1 38.7 23.5 54.5 39.5 14.1-8.3 30.2-12.7 46.8-12.7 51.1 0 92.5 41.4 92.5 92.5 0 24.5-9.7 48-27.1 65.4l-71.1 71.1c-3.9 3.9-8.1 7.4-12.6 10.5l-47.5-47.5c16.5-.9 29.7-14.4 30.2-31.1 0-1.3 0-2.6 0-3.9 0-86.3-69.9-156.9-156.5-156.9-19.2 0-37.9 3.5-55.5 10.2L41-24.9zM225.9 160c.6 0 1.1 0 1.7 0 15.1 0 29.5 3.7 42.1 10.2 1.8 1.2 3.6 2.3 5.5 3.1 26.8 16.3 44.8 45.9 44.8 79.6 0 .4 0 .8 0 1.2L225.9 160zM346.2 416L192 261.8c1.2 84.6 69.6 152.9 154.1 154.1zM139.7 209.5l-45.3-45.3-48.6 48.6c-29.3 29.3-45.8 69.1-45.8 110.6 0 86.4 70 156.5 156.5 156.5 37.2 0 73.1-13.3 101.3-37.2-20.3-10.1-38.8-23.5-54.6-39.5-14 8.2-30.1 12.6-46.7 12.6-51.1 0-92.5-41.4-92.5-92.5 0-24.5 9.7-48 27.1-65.4l48.6-48.6z"/>
|
|
7208
|
+
</symbol>
|
|
7209
|
+
<!-- play (run node) -->
|
|
7210
|
+
<symbol id="g6-icon-run" viewBox="0 0 448 512">
|
|
7211
|
+
<path fill="currentColor" d="M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z"/>
|
|
7212
|
+
</symbol>
|
|
7213
|
+
<!-- clone (copy size to other nodes/ports) -->
|
|
7214
|
+
<symbol id="g6-icon-resize" viewBox="0 0 512 512">
|
|
7215
|
+
<path fill="currentColor" d="M288 448l-224 0 0-224 48 0 0-64-48 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l224 0c35.3 0 64-28.7 64-64l0-48-64 0 0 48zm-64-96l224 0c35.3 0 64-28.7 64-64l0-224c0-35.3-28.7-64-64-64L224 0c-35.3 0-64 28.7-64 64l0 224c0 35.3 28.7 64 64 64z"/>
|
|
7216
|
+
</symbol>
|
|
7217
|
+
<!-- plus (create node). Deliberately NOT the FA7 solid plus:
|
|
7218
|
+
its arms are ~14% of the width and read thin next to the
|
|
7219
|
+
other solid glyphs. Bold geometric plus (~23% arm
|
|
7220
|
+
thickness) with long arms (32..480) so it reads as a "+",
|
|
7221
|
+
not a stubby Red-Cross square. -->
|
|
7222
|
+
<symbol id="g6-icon-plus" viewBox="0 0 512 512">
|
|
7223
|
+
<path fill="currentColor" d="M316 32 L316 196 L480 196 L480 316 L316 316 L316 480 L196 480 L196 316 L32 316 L32 196 L196 196 L196 32 Z"/>
|
|
7224
|
+
</symbol>
|
|
7225
|
+
<!-- ellipsis-vertical (unfold the floating toolbar).
|
|
7226
|
+
The strip it stands for is a vertical stack, and a vertical
|
|
7227
|
+
ellipsis is what "there is more of this here" is drawn as
|
|
7228
|
+
everywhere else. -->
|
|
7229
|
+
<symbol id="g6-icon-toolbar-show" viewBox="0 0 128 512">
|
|
7230
|
+
<path fill="currentColor" d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/>
|
|
7231
|
+
</symbol>
|
|
7232
|
+
<!-- xmark (fold the floating toolbar away).
|
|
7233
|
+
Not a chevron: the two toolbars sit on OPPOSITE edges, so a
|
|
7234
|
+
direction would point the wrong way on one of them. What the
|
|
7235
|
+
button does is close an overlay, and that is an x. -->
|
|
7236
|
+
<symbol id="g6-icon-toolbar-hide" viewBox="0 0 384 512">
|
|
7237
|
+
<path fill="currentColor" d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/>
|
|
7238
|
+
</symbol>
|
|
7239
|
+
<!-- dashed marquee (selection mode).
|
|
7240
|
+
The band ITSELF, because that is what the button turns on: a
|
|
7241
|
+
drag on the canvas draws one and a tap picks a card. Not the
|
|
7242
|
+
fit-to-selection glyph next to it in the other toolbar -- that
|
|
7243
|
+
one is solid brackets around a solid object and means "put the
|
|
7244
|
+
camera on what is picked", which is the opposite end of the
|
|
7245
|
+
gesture. Dashes: 16 segments of 59 with gaps of 36 over a
|
|
7246
|
+
perimeter of 1520, so they land on the corners. -->
|
|
7247
|
+
<symbol id="g6-icon-select-mode" viewBox="0 0 512 512">
|
|
7248
|
+
<rect x="46" y="86" width="420" height="340" fill="none"
|
|
7249
|
+
stroke="currentColor" stroke-width="40"
|
|
7250
|
+
stroke-dasharray="59 36"/>
|
|
7251
|
+
</symbol>
|
|
7252
|
+
<!-- location-crosshairs (anchor the camera on one element).
|
|
7253
|
+
The SAME path as the DOM toolbars and their yi-location-crosshairs
|
|
7254
|
+
mask: the two toolbars sit in one console, and a control that
|
|
7255
|
+
does one thing has to be drawn one way. -->
|
|
7256
|
+
<symbol id="g6-icon-anchor" viewBox="0 0 576 512">
|
|
7257
|
+
<path fill="currentColor" d="M288-16c17.7 0 32 14.3 32 32l0 18.3c98.1 14 175.7 91.6 189.7 189.7l18.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-18.3 0c-14 98.1-91.6 175.7-189.7 189.7l0 18.3c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.3C157.9 463.7 80.3 386.1 66.3 288L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l18.3 0C80.3 125.9 157.9 48.3 256 34.3L256 16c0-17.7 14.3-32 32-32zM128 256a160 160 0 1 0 320 0 160 160 0 1 0 -320 0zm160-96a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"/>
|
|
7258
|
+
</symbol>
|
|
7259
|
+
<!-- floppy-disk (save) -->
|
|
7260
|
+
<symbol id="g6-icon-save" viewBox="0 0 448 512">
|
|
7261
|
+
<path fill="currentColor" d="M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-242.7c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32L64 32zm32 96c0-17.7 14.3-32 32-32l160 0c17.7 0 32 14.3 32 32l0 64c0 17.7-14.3 32-32 32l-160 0c-17.7 0-32-14.3-32-32l0-64zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"/>
|
|
7262
|
+
</symbol>
|
|
7263
|
+
</svg>`;
|
|
7264
|
+
function inject_svg_icons() {
|
|
7265
|
+
if (document.getElementById(CUSTOM_SVG_ICONS_ID)) return;
|
|
7266
|
+
const div = document.createElement("div");
|
|
7267
|
+
div.id = CUSTOM_SVG_ICONS_ID;
|
|
7268
|
+
div.style.display = "none";
|
|
7269
|
+
div.innerHTML = ICONS;
|
|
7270
|
+
document.body.appendChild(div);
|
|
7271
|
+
}
|
|
7272
|
+
var __icon_defined__ = {};
|
|
7273
|
+
function yui_icon_is_defined(name) {
|
|
7274
|
+
if (!name || typeof name !== "string") return false;
|
|
7275
|
+
if (__icon_defined__[name] !== void 0) return __icon_defined__[name];
|
|
7276
|
+
let defined = false;
|
|
7277
|
+
try {
|
|
7278
|
+
const el = document.createElement("i");
|
|
7279
|
+
el.className = name;
|
|
7280
|
+
el.style.position = "absolute";
|
|
7281
|
+
el.style.visibility = "hidden";
|
|
7282
|
+
el.style.pointerEvents = "none";
|
|
7283
|
+
document.body.appendChild(el);
|
|
7284
|
+
const st = window.getComputedStyle(el, "::before");
|
|
7285
|
+
const mask = st.maskImage || st.webkitMaskImage || "";
|
|
7286
|
+
defined = !!mask && mask !== "none";
|
|
7287
|
+
document.body.removeChild(el);
|
|
7288
|
+
} catch (e) {
|
|
7289
|
+
defined = false;
|
|
7290
|
+
}
|
|
7291
|
+
__icon_defined__[name] = defined;
|
|
7292
|
+
return defined;
|
|
7293
|
+
}
|
|
7294
|
+
/************************************************************
|
|
7295
|
+
*
|
|
7296
|
+
* User icons
|
|
7297
|
+
*
|
|
7298
|
+
************************************************************/
|
|
7299
|
+
var ICONS_TOPIC = "__icons__";
|
|
7300
|
+
var ICONS_SVG_COL = "svg";
|
|
7301
|
+
var USER_ICON_PREFIX = "yi-u-";
|
|
7302
|
+
var USER_ICON_ID_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
7303
|
+
var USER_ICON_MAX_SVG = 32768;
|
|
7304
|
+
var USER_ICONS_STYLE_ID = "yui-user-icons";
|
|
7305
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
7306
|
+
var SVG_ELEMENTS = [
|
|
7307
|
+
"svg",
|
|
7308
|
+
"g",
|
|
7309
|
+
"path",
|
|
7310
|
+
"circle",
|
|
7311
|
+
"ellipse",
|
|
7312
|
+
"rect",
|
|
7313
|
+
"line",
|
|
7314
|
+
"polyline",
|
|
7315
|
+
"polygon"
|
|
7316
|
+
];
|
|
7317
|
+
var SVG_ATTRIBUTES = [
|
|
7318
|
+
"d",
|
|
7319
|
+
"cx",
|
|
7320
|
+
"cy",
|
|
7321
|
+
"r",
|
|
7322
|
+
"rx",
|
|
7323
|
+
"ry",
|
|
7324
|
+
"x",
|
|
7325
|
+
"y",
|
|
7326
|
+
"x1",
|
|
7327
|
+
"y1",
|
|
7328
|
+
"x2",
|
|
7329
|
+
"y2",
|
|
7330
|
+
"width",
|
|
7331
|
+
"height",
|
|
7332
|
+
"points",
|
|
7333
|
+
"transform",
|
|
7334
|
+
"fill",
|
|
7335
|
+
"fill-rule",
|
|
7336
|
+
"fill-opacity",
|
|
7337
|
+
"clip-rule",
|
|
7338
|
+
"opacity",
|
|
7339
|
+
"stroke",
|
|
7340
|
+
"stroke-width",
|
|
7341
|
+
"stroke-linecap",
|
|
7342
|
+
"stroke-linejoin",
|
|
7343
|
+
"stroke-miterlimit",
|
|
7344
|
+
"stroke-opacity",
|
|
7345
|
+
"stroke-dasharray"
|
|
7346
|
+
];
|
|
7347
|
+
var SVG_VALUE_RE = /^[a-zA-Z0-9\s.,#%()+-]*$/;
|
|
7348
|
+
var __user_icons__ = /* @__PURE__ */ new Map();
|
|
7349
|
+
/************************************************************
|
|
7350
|
+
* Is this field the drawing of an icon of __icons__?
|
|
7351
|
+
* The form edits it as a text area with a preview, and the
|
|
7352
|
+
* table shows the icon instead of the svg source.
|
|
7353
|
+
************************************************************/
|
|
7354
|
+
function yui_icons_is_svg_field(topic_name, field_name) {
|
|
7355
|
+
return topic_name === "__icons__" && field_name === ICONS_SVG_COL;
|
|
7356
|
+
}
|
|
7357
|
+
/************************************************************
|
|
7358
|
+
* The class of the user icon named `id`.
|
|
7359
|
+
************************************************************/
|
|
7360
|
+
function yui_user_icon_class(id) {
|
|
7361
|
+
return USER_ICON_PREFIX + id;
|
|
7362
|
+
}
|
|
7363
|
+
/************************************************************
|
|
7364
|
+
* Rebuild an svg from its SHAPES only.
|
|
7365
|
+
*
|
|
7366
|
+
* Return {svg, dropped} -- svg is the clean markup, dropped the
|
|
7367
|
+
* names of what was left out -- or {error} when there is
|
|
7368
|
+
* nothing to draw. The error is one of a FIXED set, so a GUI
|
|
7369
|
+
* can translate it: "empty svg", "svg too big", "not an svg
|
|
7370
|
+
* document", "svg without size", "svg without shapes". The markup is never inserted anywhere as
|
|
7371
|
+
* it came: it is parsed, and a new one is written from the
|
|
7372
|
+
* elements and attributes allowed above.
|
|
7373
|
+
************************************************************/
|
|
7374
|
+
function yui_svg_sanitize(svg_text) {
|
|
7375
|
+
if (typeof svg_text !== "string" || !svg_text.trim()) return { error: "empty svg" };
|
|
7376
|
+
if (svg_text.length > USER_ICON_MAX_SVG) return { error: "svg too big" };
|
|
7377
|
+
let doc;
|
|
7378
|
+
try {
|
|
7379
|
+
doc = new DOMParser().parseFromString(svg_text, "image/svg+xml");
|
|
7380
|
+
} catch (e) {
|
|
7381
|
+
return { error: "not an svg document" };
|
|
7382
|
+
}
|
|
7383
|
+
let root = doc && doc.documentElement;
|
|
7384
|
+
if (!root || root.getElementsByTagName("parsererror").length > 0) return { error: "not an svg document" };
|
|
7385
|
+
return rebuild_svg_from_shapes(root);
|
|
7386
|
+
}
|
|
7387
|
+
/************************************************************
|
|
7388
|
+
* The second half of yui_svg_sanitize(), on a PARSED tree:
|
|
7389
|
+
* anything with `localName`, `attributes` ({name, localName,
|
|
7390
|
+
* prefix, value}), `children` and `getAttribute()` -- a DOM
|
|
7391
|
+
* element, or the plain objects a test builds.
|
|
7392
|
+
************************************************************/
|
|
7393
|
+
function rebuild_svg_from_shapes(root) {
|
|
7394
|
+
if (!root || root.localName !== "svg") return { error: "not an svg document" };
|
|
7395
|
+
let dropped = /* @__PURE__ */ new Set();
|
|
7396
|
+
let shapes = 0;
|
|
7397
|
+
function value_is_safe(value) {
|
|
7398
|
+
return SVG_VALUE_RE.test(value) && !/url\s*\(/i.test(value);
|
|
7399
|
+
}
|
|
7400
|
+
function clean_attrs(el, allowed) {
|
|
7401
|
+
let out = "";
|
|
7402
|
+
for (const attr of Array.from(el.attributes || [])) {
|
|
7403
|
+
let name = attr.localName || attr.name;
|
|
7404
|
+
if (attr.prefix || !allowed.includes(name)) {
|
|
7405
|
+
if (name !== "xmlns" && attr.prefix !== "xmlns") dropped.add(`@${attr.name}`);
|
|
7406
|
+
continue;
|
|
7407
|
+
}
|
|
7408
|
+
let value = String(attr.value).trim();
|
|
7409
|
+
if (!value_is_safe(value)) {
|
|
7410
|
+
dropped.add(`@${attr.name}`);
|
|
7411
|
+
continue;
|
|
7412
|
+
}
|
|
7413
|
+
out += ` ${name}="${value}"`;
|
|
7414
|
+
}
|
|
7415
|
+
return out;
|
|
7416
|
+
}
|
|
7417
|
+
function clean_node(el) {
|
|
7418
|
+
let name = el.localName;
|
|
7419
|
+
if (!SVG_ELEMENTS.includes(name) || name === "svg") {
|
|
7420
|
+
dropped.add(name);
|
|
7421
|
+
return "";
|
|
7422
|
+
}
|
|
7423
|
+
if (name !== "g") shapes++;
|
|
7424
|
+
let inner = "";
|
|
7425
|
+
for (const child of Array.from(el.children || [])) inner += clean_node(child);
|
|
7426
|
+
return `<${name}${clean_attrs(el, SVG_ATTRIBUTES)}>${inner}</${name}>`;
|
|
7427
|
+
}
|
|
7428
|
+
let view_box = (root.getAttribute("viewBox") || "").trim();
|
|
7429
|
+
if (!/^-?[\d.]+([\s,]+-?[\d.]+){3}$/.test(view_box)) {
|
|
7430
|
+
let w = parseFloat(root.getAttribute("width"));
|
|
7431
|
+
let h = parseFloat(root.getAttribute("height"));
|
|
7432
|
+
if (!(w > 0 && h > 0)) return { error: "svg without size" };
|
|
7433
|
+
view_box = `0 0 ${w} ${h}`;
|
|
7434
|
+
}
|
|
7435
|
+
const ROOT_ATTRIBUTES = [
|
|
7436
|
+
"fill",
|
|
7437
|
+
"fill-rule",
|
|
7438
|
+
"stroke",
|
|
7439
|
+
"stroke-width",
|
|
7440
|
+
"stroke-linecap",
|
|
7441
|
+
"stroke-linejoin"
|
|
7442
|
+
];
|
|
7443
|
+
let root_attrs = "";
|
|
7444
|
+
for (const name of ROOT_ATTRIBUTES) {
|
|
7445
|
+
let value = (root.getAttribute(name) || "").trim();
|
|
7446
|
+
if (value && value_is_safe(value)) root_attrs += ` ${name}="${value}"`;
|
|
7447
|
+
else if (value) dropped.add(`@${name}`);
|
|
7448
|
+
}
|
|
7449
|
+
for (const attr of Array.from(root.attributes || [])) {
|
|
7450
|
+
let name = attr.localName || attr.name;
|
|
7451
|
+
if (attr.prefix === "xmlns" || name === "xmlns" || [
|
|
7452
|
+
"viewBox",
|
|
7453
|
+
"width",
|
|
7454
|
+
"height",
|
|
7455
|
+
"version"
|
|
7456
|
+
].includes(name) || !attr.prefix && ROOT_ATTRIBUTES.includes(name)) continue;
|
|
7457
|
+
dropped.add(`@${attr.name}`);
|
|
7458
|
+
}
|
|
7459
|
+
let inner = "";
|
|
7460
|
+
for (const child of Array.from(root.children || [])) inner += clean_node(child);
|
|
7461
|
+
if (shapes === 0) return { error: "svg without shapes" };
|
|
7462
|
+
return {
|
|
7463
|
+
svg: `<svg xmlns="${SVG_NS}" viewBox="${view_box}"${root_attrs}>${inner}</svg>`,
|
|
7464
|
+
dropped: Array.from(dropped)
|
|
7465
|
+
};
|
|
7466
|
+
}
|
|
7467
|
+
/************************************************************
|
|
7468
|
+
* The CSS `url(...)` of an svg, to be used as a mask.
|
|
7469
|
+
* Every character that could end the string or the url is
|
|
7470
|
+
* percent-encoded.
|
|
7471
|
+
************************************************************/
|
|
7472
|
+
function svg_mask_url(svg) {
|
|
7473
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
7474
|
+
}
|
|
7475
|
+
/************************************************************
|
|
7476
|
+
* An element that shows an svg as an icon, before it is
|
|
7477
|
+
* registered (a form preview, a cell of __icons__ itself).
|
|
7478
|
+
* Return {element} or {error}.
|
|
7479
|
+
************************************************************/
|
|
7480
|
+
function yui_svg_icon_element(svg_text) {
|
|
7481
|
+
let clean = yui_svg_sanitize(svg_text);
|
|
7482
|
+
if (clean.error) return { error: clean.error };
|
|
7483
|
+
let el = document.createElement("span");
|
|
7484
|
+
el.className = "USER_ICON_PREVIEW";
|
|
7485
|
+
let mask = svg_mask_url(clean.svg);
|
|
7486
|
+
el.style.setProperty("-webkit-mask-image", mask);
|
|
7487
|
+
el.style.setProperty("mask-image", mask);
|
|
7488
|
+
return {
|
|
7489
|
+
element: el,
|
|
7490
|
+
dropped: clean.dropped
|
|
7491
|
+
};
|
|
7492
|
+
}
|
|
7493
|
+
/************************************************************
|
|
7494
|
+
* Write the stylesheet of the user icons again, from the map.
|
|
7495
|
+
************************************************************/
|
|
7496
|
+
function rebuild_user_icons_stylesheet() {
|
|
7497
|
+
let css = "";
|
|
7498
|
+
for (const [id, icon] of __user_icons__) css += `.${yui_user_icon_class(id)}::before {-webkit-mask-image: ${icon.mask}; mask-image: ${icon.mask};}\n`;
|
|
7499
|
+
try {
|
|
7500
|
+
let el = document.getElementById(USER_ICONS_STYLE_ID);
|
|
7501
|
+
if (!el) {
|
|
7502
|
+
el = document.createElement("style");
|
|
7503
|
+
el.id = USER_ICONS_STYLE_ID;
|
|
7504
|
+
document.head.appendChild(el);
|
|
7505
|
+
}
|
|
7506
|
+
el.textContent = css;
|
|
7507
|
+
} catch (e) {
|
|
7508
|
+
(0, _yuneta_gobj_js.log_error)(`user icons: cannot write the stylesheet: ${e}`);
|
|
7509
|
+
}
|
|
7510
|
+
for (const name of Object.keys(__icon_defined__)) if (name.startsWith("yi-u-")) delete __icon_defined__[name];
|
|
7511
|
+
}
|
|
7512
|
+
/************************************************************
|
|
7513
|
+
* Validate one node of __icons__.
|
|
7514
|
+
* Return the entry to keep, or null (warning logged).
|
|
7515
|
+
************************************************************/
|
|
7516
|
+
function user_icon_entry(node) {
|
|
7517
|
+
let id = node && node.id;
|
|
7518
|
+
if (typeof id !== "string" || !USER_ICON_ID_RE.test(id)) {
|
|
7519
|
+
(0, _yuneta_gobj_js.log_warning)(`user icons: bad icon name '${id}': lowercase letters, digits and '-' only`);
|
|
7520
|
+
return null;
|
|
7521
|
+
}
|
|
7522
|
+
let clean = yui_svg_sanitize(node.svg);
|
|
7523
|
+
if (clean.error) {
|
|
7524
|
+
(0, _yuneta_gobj_js.log_warning)(`user icons: icon '${id}' not drawn: ${clean.error}`);
|
|
7525
|
+
return null;
|
|
7526
|
+
}
|
|
7527
|
+
return {
|
|
7528
|
+
svg: clean.svg,
|
|
7529
|
+
mask: svg_mask_url(clean.svg)
|
|
7530
|
+
};
|
|
7531
|
+
}
|
|
7532
|
+
/************************************************************
|
|
7533
|
+
* Replace every user icon with the nodes of __icons__.
|
|
7534
|
+
* Return the number of icons registered.
|
|
7535
|
+
************************************************************/
|
|
7536
|
+
function yui_icons_set_user(nodes) {
|
|
7537
|
+
__user_icons__.clear();
|
|
7538
|
+
if (Array.isArray(nodes)) for (const node of nodes) {
|
|
7539
|
+
let entry = user_icon_entry(node);
|
|
7540
|
+
if (entry) __user_icons__.set(node.id, entry);
|
|
7541
|
+
}
|
|
7542
|
+
else if (nodes) (0, _yuneta_gobj_js.log_error)(`user icons: the nodes of ${ICONS_TOPIC} must be a list`);
|
|
7543
|
+
rebuild_user_icons_stylesheet();
|
|
7544
|
+
return __user_icons__.size;
|
|
7545
|
+
}
|
|
7546
|
+
/************************************************************
|
|
7547
|
+
* A node of __icons__ was created or updated.
|
|
7548
|
+
* Return true if the icon is drawn.
|
|
7549
|
+
************************************************************/
|
|
7550
|
+
function yui_icons_put_user(node) {
|
|
7551
|
+
let entry = user_icon_entry(node);
|
|
7552
|
+
if (entry) __user_icons__.set(node.id, entry);
|
|
7553
|
+
else if (node && typeof node.id === "string") __user_icons__.delete(node.id);
|
|
7554
|
+
rebuild_user_icons_stylesheet();
|
|
7555
|
+
return !!entry;
|
|
7556
|
+
}
|
|
7557
|
+
/************************************************************
|
|
7558
|
+
* A node of __icons__ was deleted.
|
|
7559
|
+
************************************************************/
|
|
7560
|
+
function yui_icons_remove_user(id) {
|
|
7561
|
+
__user_icons__.delete(id);
|
|
7562
|
+
rebuild_user_icons_stylesheet();
|
|
7563
|
+
}
|
|
7564
|
+
/************************************************************
|
|
7565
|
+
* Every icon a user can choose: the library's, read from the
|
|
7566
|
+
* loaded stylesheets (an app may extend yui_icons.css, so it
|
|
7567
|
+
* is asked, not listed), then the user's.
|
|
7568
|
+
* Return [{name, user}], each half sorted by name.
|
|
7569
|
+
************************************************************/
|
|
7570
|
+
function yui_icons_list() {
|
|
7571
|
+
let library = /* @__PURE__ */ new Set();
|
|
7572
|
+
try {
|
|
7573
|
+
for (const sheet of Array.from(document.styleSheets || [])) {
|
|
7574
|
+
if (sheet.ownerNode && sheet.ownerNode.id === USER_ICONS_STYLE_ID) continue;
|
|
7575
|
+
let rules;
|
|
7576
|
+
try {
|
|
7577
|
+
rules = sheet.cssRules;
|
|
7578
|
+
} catch (e) {
|
|
7579
|
+
continue;
|
|
7580
|
+
}
|
|
7581
|
+
for (const rule of Array.from(rules || [])) {
|
|
7582
|
+
let selector = rule.selectorText || "";
|
|
7583
|
+
for (const m of selector.matchAll(/\.(yi-[a-z0-9-]+)::?before/g)) if (!m[1].startsWith("yi-u-")) library.add(m[1]);
|
|
7584
|
+
}
|
|
7585
|
+
}
|
|
7586
|
+
} catch (e) {
|
|
7587
|
+
(0, _yuneta_gobj_js.log_error)(`user icons: cannot read the stylesheets: ${e}`);
|
|
7588
|
+
}
|
|
7589
|
+
let list = Array.from(library).sort().map((name) => ({
|
|
7590
|
+
name,
|
|
7591
|
+
user: false
|
|
7592
|
+
}));
|
|
7593
|
+
let users = Array.from(__user_icons__.keys()).sort();
|
|
7594
|
+
for (const id of users) list.push({
|
|
7595
|
+
name: yui_user_icon_class(id),
|
|
7596
|
+
user: true
|
|
7597
|
+
});
|
|
7598
|
+
return list;
|
|
7599
|
+
}
|
|
7093
7600
|
/************************************************************
|
|
7094
7601
|
* JSON type discriminator (viewer vocabulary)
|
|
7095
7602
|
************************************************************/
|
|
@@ -7913,6 +8420,7 @@ function build_form(gobj) {
|
|
|
7913
8420
|
function build_html_form(gobj, $form, prefix, template) {
|
|
7914
8421
|
Object.entries(template).forEach(([key, value]) => {
|
|
7915
8422
|
const field_desc = (0, _yuneta_gobj_js.template_get_field_desc)(key, value);
|
|
8423
|
+
if (!prefix && yui_icons_is_svg_field((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"), field_desc.name)) field_desc.type = "svg";
|
|
7916
8424
|
let html_field_conf = build_form_field_conf(gobj, field_desc);
|
|
7917
8425
|
html_field_conf.name = field_desc.name;
|
|
7918
8426
|
let topic_name = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name");
|
|
@@ -8010,8 +8518,17 @@ function build_form_field_conf(gobj, field_desc) {
|
|
|
8010
8518
|
case "file":
|
|
8011
8519
|
field_conf.tag = "file";
|
|
8012
8520
|
break;
|
|
8013
|
-
case "image":
|
|
8014
8521
|
case "icon":
|
|
8522
|
+
field_conf.tag = "select2";
|
|
8523
|
+
field_conf.options = yui_icons_list().map((icon) => icon.name);
|
|
8524
|
+
break;
|
|
8525
|
+
case "svg":
|
|
8526
|
+
field_conf.tag = "textarea";
|
|
8527
|
+
field_conf.extras.rows = 6;
|
|
8528
|
+
field_conf.extras.spellcheck = "false";
|
|
8529
|
+
field_conf.extras.class = "textarea is-family-monospace";
|
|
8530
|
+
break;
|
|
8531
|
+
case "image":
|
|
8015
8532
|
case "string":
|
|
8016
8533
|
field_conf.tag = "input";
|
|
8017
8534
|
field_conf.inputType = "text";
|
|
@@ -8536,6 +9053,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
8536
9053
|
else if (required) attrs.required = "";
|
|
8537
9054
|
$extend = (0, _yuneta_gobj_js.createElement2)(["textarea", attrs]);
|
|
8538
9055
|
$control.appendChild($extend);
|
|
9056
|
+
if (field_desc.type === "svg") attach_svg_preview(gobj, $control, $extend);
|
|
8539
9057
|
break;
|
|
8540
9058
|
}
|
|
8541
9059
|
case "select": {
|
|
@@ -8574,6 +9092,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
8574
9092
|
(0, _yuneta_gobj_js.log_error)((0, _yuneta_gobj_js.sprintf)("%s: select2 field '%s' options not an array (type=%s, real_type=%s); rendering empty", (0, _yuneta_gobj_js.gobj_short_name)(gobj), name, field_desc.type, field_desc.real_type));
|
|
8575
9093
|
opts = [];
|
|
8576
9094
|
}
|
|
9095
|
+
let is_icon = field_desc.type === "icon";
|
|
8577
9096
|
let extend = [
|
|
8578
9097
|
"select",
|
|
8579
9098
|
{
|
|
@@ -8581,7 +9100,11 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
8581
9100
|
class: "",
|
|
8582
9101
|
multiple: true
|
|
8583
9102
|
},
|
|
8584
|
-
opts.map((option) => [
|
|
9103
|
+
opts.map((option) => is_icon ? [
|
|
9104
|
+
"option",
|
|
9105
|
+
{ value: option },
|
|
9106
|
+
option
|
|
9107
|
+
] : [
|
|
8585
9108
|
"option",
|
|
8586
9109
|
{
|
|
8587
9110
|
value: option,
|
|
@@ -8595,7 +9118,8 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
|
|
|
8595
9118
|
$extend.tom_select = new tom_select.default($extend, {
|
|
8596
9119
|
allowEmptyOption: true,
|
|
8597
9120
|
placeholder,
|
|
8598
|
-
maxItems: field_desc.type === "fkey" && field_desc.real_type === "string" ? 1 : null,
|
|
9121
|
+
maxItems: is_icon || field_desc.type === "fkey" && field_desc.real_type === "string" ? 1 : null,
|
|
9122
|
+
render: is_icon ? icon_select_render() : void 0,
|
|
8599
9123
|
plugins: {
|
|
8600
9124
|
"clear_button": { "title": (0, i18next.t)("remove all selected options") },
|
|
8601
9125
|
"no_active_items": {},
|
|
@@ -8763,6 +9287,71 @@ function attach_color_value($control, $input) {
|
|
|
8763
9287
|
$control.appendChild($value);
|
|
8764
9288
|
}
|
|
8765
9289
|
/******************************************************************
|
|
9290
|
+
* How the icon picker draws a name: the icon, then the name.
|
|
9291
|
+
* The names come from yui_icons_list() -- class names, already
|
|
9292
|
+
* [a-z0-9-] -- and are escaped anyway, because they are written
|
|
9293
|
+
* as markup.
|
|
9294
|
+
******************************************************************/
|
|
9295
|
+
function icon_select_render() {
|
|
9296
|
+
function draw(data, escape) {
|
|
9297
|
+
return `<div class="ICON_SELECT_ITEM"><span class="icon"><i class="${escape(data.value)}" aria-hidden="true"></i></span><span>${escape(data.text)}</span></div>`;
|
|
9298
|
+
}
|
|
9299
|
+
return {
|
|
9300
|
+
option: draw,
|
|
9301
|
+
item: draw
|
|
9302
|
+
};
|
|
9303
|
+
}
|
|
9304
|
+
/******************************************************************
|
|
9305
|
+
* Why a drawing cannot be an icon, in the reader's language.
|
|
9306
|
+
* The causes are the fixed set yui_svg_sanitize() answers, each
|
|
9307
|
+
* written here as a literal t() so validate-locales sees it.
|
|
9308
|
+
******************************************************************/
|
|
9309
|
+
function svg_error_text(error) {
|
|
9310
|
+
switch (error) {
|
|
9311
|
+
case "empty svg": return (0, i18next.t)("empty svg");
|
|
9312
|
+
case "svg too big": return (0, i18next.t)("svg too big");
|
|
9313
|
+
case "not an svg document": return (0, i18next.t)("not an svg document");
|
|
9314
|
+
case "svg without size": return (0, i18next.t)("svg without size");
|
|
9315
|
+
case "svg without shapes": return (0, i18next.t)("svg without shapes");
|
|
9316
|
+
default:
|
|
9317
|
+
(0, _yuneta_gobj_js.log_error)(`svg_error_text(): unknown cause '${error}'`);
|
|
9318
|
+
return error;
|
|
9319
|
+
}
|
|
9320
|
+
}
|
|
9321
|
+
/******************************************************************
|
|
9322
|
+
* The icon a drawing (`svg` of __icons__) makes, below its text
|
|
9323
|
+
* area, redrawn as it is typed: what is saved is what the app
|
|
9324
|
+
* will show. A drawing that cannot be drawn says why, and what
|
|
9325
|
+
* the sanitizer left out is named.
|
|
9326
|
+
******************************************************************/
|
|
9327
|
+
function attach_svg_preview(gobj, $control, $textarea) {
|
|
9328
|
+
let $preview = (0, _yuneta_gobj_js.createElement2)([
|
|
9329
|
+
"div",
|
|
9330
|
+
{ class: "SVG_PREVIEW is-flex is-align-items-center mt-2" },
|
|
9331
|
+
[["span", { class: "SVG_PREVIEW_ICON icon is-large is-size-3" }], ["span", { class: "SVG_PREVIEW_NOTE is-size-7 yui-text-quiet ml-2" }]]
|
|
9332
|
+
]);
|
|
9333
|
+
$control.appendChild($preview);
|
|
9334
|
+
let $icon = $preview.querySelector(".SVG_PREVIEW_ICON");
|
|
9335
|
+
let $note = $preview.querySelector(".SVG_PREVIEW_NOTE");
|
|
9336
|
+
function redraw() {
|
|
9337
|
+
$icon.replaceChildren();
|
|
9338
|
+
$note.textContent = "";
|
|
9339
|
+
if (!$textarea.value || !$textarea.value.trim()) return;
|
|
9340
|
+
let preview = yui_svg_icon_element($textarea.value);
|
|
9341
|
+
if (preview.error) {
|
|
9342
|
+
$note.textContent = svg_error_text(preview.error);
|
|
9343
|
+
return;
|
|
9344
|
+
}
|
|
9345
|
+
$icon.appendChild(preview.element);
|
|
9346
|
+
if (preview.dropped && preview.dropped.length > 0) $note.textContent = `${(0, i18next.t)("left out")}: ${preview.dropped.join(" ")}`;
|
|
9347
|
+
}
|
|
9348
|
+
$textarea.yui_svg_preview = redraw;
|
|
9349
|
+
$textarea.addEventListener("input", function() {
|
|
9350
|
+
redraw();
|
|
9351
|
+
(0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
|
|
9352
|
+
});
|
|
9353
|
+
}
|
|
9354
|
+
/******************************************************************
|
|
8766
9355
|
* `readonly` is an attribute of a TEXT control and of nothing else.
|
|
8767
9356
|
*
|
|
8768
9357
|
* A `<select>` ignores it. So does a checkbox, and so does a radio:
|
|
@@ -9277,7 +9866,10 @@ function clear_data(gobj, $form) {
|
|
|
9277
9866
|
else if ($input.type === "radio") $input.checked = false;
|
|
9278
9867
|
else if ($input.type === "datetime-local") $input.value = null;
|
|
9279
9868
|
else if ($input.type === "select-multiple") $input.tom_select.clear();
|
|
9280
|
-
else
|
|
9869
|
+
else {
|
|
9870
|
+
$input.value = null;
|
|
9871
|
+
if ($input.yui_svg_preview) $input.yui_svg_preview();
|
|
9872
|
+
}
|
|
9281
9873
|
}
|
|
9282
9874
|
});
|
|
9283
9875
|
$form.querySelectorAll(".FILE_FIELD").forEach(($file) => {
|
|
@@ -9378,12 +9970,17 @@ function set_form_values(gobj, template, $form, record) {
|
|
|
9378
9970
|
break;
|
|
9379
9971
|
case "textarea":
|
|
9380
9972
|
$input.value = value;
|
|
9973
|
+
if ($input.yui_svg_preview) $input.yui_svg_preview();
|
|
9381
9974
|
break;
|
|
9382
9975
|
case "select":
|
|
9383
9976
|
$input.value = value;
|
|
9384
9977
|
break;
|
|
9385
9978
|
case "select2":
|
|
9386
9979
|
$input.tom_select.clear();
|
|
9980
|
+
if (field_desc && field_desc.type === "icon" && (0, _yuneta_gobj_js.is_string)(value) && value && !$input.tom_select.options[value]) $input.tom_select.addOption({
|
|
9981
|
+
value,
|
|
9982
|
+
text: value
|
|
9983
|
+
});
|
|
9387
9984
|
$input.tom_select.setValue(value);
|
|
9388
9985
|
break;
|
|
9389
9986
|
case "checkbox":
|
|
@@ -9480,6 +10077,7 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
|
|
|
9480
10077
|
case "color":
|
|
9481
10078
|
case "image":
|
|
9482
10079
|
case "icon":
|
|
10080
|
+
case "svg":
|
|
9483
10081
|
case "tel":
|
|
9484
10082
|
case "template":
|
|
9485
10083
|
case "table":
|
|
@@ -9570,11 +10168,14 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
|
|
|
9570
10168
|
default: (0, _yuneta_gobj_js.log_error)("incompatible type for time: " + real_type);
|
|
9571
10169
|
}
|
|
9572
10170
|
break;
|
|
10171
|
+
case "icon":
|
|
10172
|
+
if (Array.isArray(value)) value = value.length > 0 ? value[0] : "";
|
|
10173
|
+
break;
|
|
9573
10174
|
case "date":
|
|
9574
10175
|
case "color":
|
|
9575
10176
|
case "image":
|
|
9576
|
-
case "
|
|
9577
|
-
case "
|
|
10177
|
+
case "tel":
|
|
10178
|
+
case "svg": break;
|
|
9578
10179
|
case "template":
|
|
9579
10180
|
if ((0, _yuneta_gobj_js.is_string)(value)) try {
|
|
9580
10181
|
value = JSON.parse(value);
|
|
@@ -24817,6 +25418,43 @@ function request_treedb_descs$1(gobj) {
|
|
|
24817
25418
|
if (ret) (0, _yuneta_gobj_js.log_error)(ret);
|
|
24818
25419
|
}
|
|
24819
25420
|
/************************************************************
|
|
25421
|
+
* A user view shows the topics of the user and, of the system
|
|
25422
|
+
* topics, only __icons__: its nodes are what the user ADDS to
|
|
25423
|
+
* the app (the icons a column `icon` can name), so editing them
|
|
25424
|
+
* is the user's business. The other `__` topics are the
|
|
25425
|
+
* treedb's own bookkeeping.
|
|
25426
|
+
************************************************************/
|
|
25427
|
+
function topic_is_shown(topic_name) {
|
|
25428
|
+
return topic_name.substring(0, 2) !== "__" || topic_name === "__icons__";
|
|
25429
|
+
}
|
|
25430
|
+
/************************************************************
|
|
25431
|
+
* The nodes of __icons__ are the user icons of the app: each
|
|
25432
|
+
* load and each write of them goes to the icon registry
|
|
25433
|
+
* (lib_icons.js), and the shell tells the views that decided
|
|
25434
|
+
* at render time whether a name was an icon.
|
|
25435
|
+
*
|
|
25436
|
+
* how: "load" (nodes = the whole topic), "put" (one node
|
|
25437
|
+
* created or updated) or "remove" (one node deleted).
|
|
25438
|
+
************************************************************/
|
|
25439
|
+
function feed_user_icons(gobj, how, nodes) {
|
|
25440
|
+
switch (how) {
|
|
25441
|
+
case "load":
|
|
25442
|
+
yui_icons_set_user(nodes);
|
|
25443
|
+
break;
|
|
25444
|
+
case "put":
|
|
25445
|
+
for (const node of nodes) yui_icons_put_user(node);
|
|
25446
|
+
break;
|
|
25447
|
+
case "remove":
|
|
25448
|
+
for (const node of nodes) if (node && typeof node.id === "string") yui_icons_remove_user(node.id);
|
|
25449
|
+
break;
|
|
25450
|
+
default:
|
|
25451
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: feed_user_icons(): unknown '${how}'`);
|
|
25452
|
+
return;
|
|
25453
|
+
}
|
|
25454
|
+
let shell = yui_shell_of(gobj);
|
|
25455
|
+
if (shell) yui_shell_icons_changed(shell);
|
|
25456
|
+
}
|
|
25457
|
+
/************************************************************
|
|
24820
25458
|
* Response of remote command
|
|
24821
25459
|
************************************************************/
|
|
24822
25460
|
function process_treedb_descs$1(gobj) {
|
|
@@ -24826,7 +25464,7 @@ function process_treedb_descs$1(gobj) {
|
|
|
24826
25464
|
let treedb_name = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name");
|
|
24827
25465
|
let readonly = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "readonly");
|
|
24828
25466
|
for (const [key, desc] of Object.entries(descs)) {
|
|
24829
|
-
if (system
|
|
25467
|
+
if (!system && !topic_is_shown(key)) continue;
|
|
24830
25468
|
let kw_topic_form = {
|
|
24831
25469
|
subscriber: gobj,
|
|
24832
25470
|
readonly,
|
|
@@ -24835,7 +25473,7 @@ function process_treedb_descs$1(gobj) {
|
|
|
24835
25473
|
treedb_name,
|
|
24836
25474
|
topic_name: key,
|
|
24837
25475
|
desc,
|
|
24838
|
-
with_remote_paging: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_remote_paging"),
|
|
25476
|
+
with_remote_paging: key !== "__icons__" && (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_remote_paging"),
|
|
24839
25477
|
page_size: (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "page_size"),
|
|
24840
25478
|
with_selection_bar: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_selection_bar"),
|
|
24841
25479
|
form_waits_for_answer: true
|
|
@@ -24887,7 +25525,7 @@ function register_sub_routes$1(gobj) {
|
|
|
24887
25525
|
gclass: "C_YUI_TREEDB_SCHEMA"
|
|
24888
25526
|
});
|
|
24889
25527
|
if ((0, _yuneta_gobj_js.is_object)(descs)) for (let topic of Object.keys(descs)) {
|
|
24890
|
-
if (!system && topic
|
|
25528
|
+
if (!system && !topic_is_shown(topic)) continue;
|
|
24891
25529
|
nodes.push({
|
|
24892
25530
|
route: base + "/" + topic,
|
|
24893
25531
|
label: topic,
|
|
@@ -25488,6 +26126,7 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
|
|
|
25488
26126
|
}, gobj);
|
|
25489
26127
|
} else {
|
|
25490
26128
|
forget_topic_rereads(gobj, topic_name);
|
|
26129
|
+
if (topic_name === "__icons__") feed_user_icons(gobj, "load", answer.rows);
|
|
25491
26130
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj_topic_form, "EV_LOAD_NODES", answer.rows, gobj);
|
|
25492
26131
|
}
|
|
25493
26132
|
}
|
|
@@ -25736,6 +26375,7 @@ function ac_treedb_node_created$1(gobj, event, kw, src) {
|
|
|
25736
26375
|
let topic_name = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw, "topic_name", "", 0);
|
|
25737
26376
|
let node = (0, _yuneta_gobj_js.kw_get_dict_value)(gobj, kw, "node", null, 0);
|
|
25738
26377
|
if (treedb_name === (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name")) {
|
|
26378
|
+
if (topic_name === "__icons__") feed_user_icons(gobj, "put", [node]);
|
|
25739
26379
|
let gobj_formtable = get_gobj_formtable(gobj, topic_name);
|
|
25740
26380
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj_formtable, "EV_LOAD_NODE_CREATED", [node], gobj);
|
|
25741
26381
|
}
|
|
@@ -25749,6 +26389,7 @@ function ac_treedb_node_updated$1(gobj, event, kw, src) {
|
|
|
25749
26389
|
let topic_name = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw, "topic_name", "", 0);
|
|
25750
26390
|
let node = (0, _yuneta_gobj_js.kw_get_dict_value)(gobj, kw, "node", null, 0);
|
|
25751
26391
|
if (treedb_name === (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name")) {
|
|
26392
|
+
if (topic_name === "__icons__") feed_user_icons(gobj, "put", [node]);
|
|
25752
26393
|
let gobj_formtable = get_gobj_formtable(gobj, topic_name);
|
|
25753
26394
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj_formtable, "EV_LOAD_NODE_UPDATED", [node], gobj);
|
|
25754
26395
|
}
|
|
@@ -25783,6 +26424,7 @@ function ac_treedb_node_deleted$1(gobj, event, kw, src) {
|
|
|
25783
26424
|
let topic_name = (0, _yuneta_gobj_js.kw_get_str)(gobj, kw, "topic_name", "", 0);
|
|
25784
26425
|
let node = (0, _yuneta_gobj_js.kw_get_dict_value)(gobj, kw, "node", null, 0);
|
|
25785
26426
|
if (treedb_name === (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name")) {
|
|
26427
|
+
if (topic_name === "__icons__") feed_user_icons(gobj, "remove", [node]);
|
|
25786
26428
|
let gobj_formtable = get_gobj_formtable(gobj, topic_name);
|
|
25787
26429
|
(0, _yuneta_gobj_js.gobj_send_event)(gobj_formtable, "EV_NODE_DELETED", [node], gobj);
|
|
25788
26430
|
}
|
|
@@ -26654,182 +27296,6 @@ function yui_table_filter_clear(table) {
|
|
|
26654
27296
|
});
|
|
26655
27297
|
}
|
|
26656
27298
|
//#endregion
|
|
26657
|
-
//#region src/lib_icons.js
|
|
26658
|
-
/*********************************************************
|
|
26659
|
-
* lib_icons.js
|
|
26660
|
-
*
|
|
26661
|
-
* Two icon systems are managed here:
|
|
26662
|
-
*
|
|
26663
|
-
* 1. FA-style CSS icons (yui_icons.css)
|
|
26664
|
-
* Usage: <i class="yi-save"></i>
|
|
26665
|
-
* Color: inherits currentColor from parent via CSS mask.
|
|
26666
|
-
*
|
|
26667
|
-
* 2. SVG symbol icons for G6 toolbar (and any other component
|
|
26668
|
-
* that uses <use xlink:href="#id">).
|
|
26669
|
-
* Symbols are injected once into the DOM.
|
|
26670
|
-
* All symbol ids are prefixed with "g6-icon-" to avoid
|
|
26671
|
-
* conflicts with other DOM elements.
|
|
26672
|
-
* Icon paths come from:
|
|
26673
|
-
* fontawesome-free-7.1.0-web/sprites/solid.svg
|
|
26674
|
-
*
|
|
26675
|
-
* G6 toolbar items are managed via CSS class names (className
|
|
26676
|
-
* field in getItems()) using YuiToolbar in c_g6_nodes_tree.js.
|
|
26677
|
-
* This lets lib_graph.js state functions (set_submit_state,
|
|
26678
|
-
* disableElements, …) work on toolbar icons exactly like on
|
|
26679
|
-
* regular Bulma/FA buttons — no icon-specific helpers needed.
|
|
26680
|
-
*
|
|
26681
|
-
* Copyright (c) 2025-2026, ArtGins.
|
|
26682
|
-
* All Rights Reserved.
|
|
26683
|
-
*********************************************************/
|
|
26684
|
-
var CUSTOM_SVG_ICONS_ID = "g6-custom-svgicons";
|
|
26685
|
-
var ICONS = `<svg xmlns="http://www.w3.org/2000/svg">
|
|
26686
|
-
<!-- magnifying-glass-plus -->
|
|
26687
|
-
<symbol id="g6-icon-zoom-in" viewBox="0 0 512 512">
|
|
26688
|
-
<path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376C296.3 401.1 253.9 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208zM208 112c-13.3 0-24 10.7-24 24l0 48-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l48 0 0 48c0 13.3 10.7 24 24 24s24-10.7 24-24l0-48 48 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-48c0-13.3-10.7-24-24-24z"/>
|
|
26689
|
-
</symbol>
|
|
26690
|
-
<!-- magnifying-glass-minus -->
|
|
26691
|
-
<symbol id="g6-icon-zoom-out" viewBox="0 0 512 512">
|
|
26692
|
-
<path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376C296.3 401.1 253.9 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24l144 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-144 0z"/>
|
|
26693
|
-
</symbol>
|
|
26694
|
-
<!-- house (reset zoom: back to original 100% view) -->
|
|
26695
|
-
<symbol id="g6-icon-home" viewBox="0 0 512 512">
|
|
26696
|
-
<path fill="currentColor" d="M277.8 8.6c-12.3-11.4-31.3-11.4-43.5 0l-224 208c-9.6 9-12.8 22.9-8 35.1S18.8 272 32 272l16 0 0 176c0 35.3 28.7 64 64 64l288 0c35.3 0 64-28.7 64-64l0-176 16 0c13.2 0 25-8.1 29.8-20.3s1.6-26.2-8-35.1l-224-208zM240 320l32 0c26.5 0 48 21.5 48 48l0 96-128 0 0-96c0-26.5 21.5-48 48-48z"/>
|
|
26697
|
-
</symbol>
|
|
26698
|
-
<!-- expand (zoom to fit) -->
|
|
26699
|
-
<symbol id="g6-icon-fit" viewBox="0 0 448 512">
|
|
26700
|
-
<path fill="currentColor" d="M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"/>
|
|
26701
|
-
</symbol>
|
|
26702
|
-
<!-- fit to selection: the same corner brackets as the fit icon,
|
|
26703
|
-
around a marked object. The two sit side by side in the
|
|
26704
|
-
toolbar and have to read as a family, which a borrowed glyph
|
|
26705
|
-
would not. (No backticks in here: the sprite lives inside a
|
|
26706
|
-
template literal.) -->
|
|
26707
|
-
<symbol id="g6-icon-fit-selection" viewBox="0 0 448 512">
|
|
26708
|
-
<path fill="currentColor" d="M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z"/>
|
|
26709
|
-
<rect fill="currentColor" x="144" y="176" width="160" height="160" rx="24"/>
|
|
26710
|
-
</symbol>
|
|
26711
|
-
<!-- crosshairs (center) -->
|
|
26712
|
-
<symbol id="g6-icon-center" viewBox="0 0 576 512">
|
|
26713
|
-
<path fill="currentColor" d="M288-16c17.7 0 32 14.3 32 32l0 18.3c98.1 14 175.7 91.6 189.7 189.7l18.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-18.3 0c-14 98.1-91.6 175.7-189.7 189.7l0 18.3c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.3C157.9 463.7 80.3 386.1 66.3 288L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l18.3 0C80.3 125.9 157.9 48.3 256 34.3L256 16c0-17.7 14.3-32 32-32zM131.2 288c12.7 62.7 62.1 112.1 124.8 124.8l0-12.8c0-17.7 14.3-32 32-32s32 14.3 32 32l0 12.8c62.7-12.7 112.1-62.1 124.8-124.8L432 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l12.8 0C432.1 161.3 382.7 111.9 320 99.2l0 12.8c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-12.8C193.3 111.9 143.9 161.3 131.2 224l12.8 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-12.8 0zM288 208a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"/>
|
|
26714
|
-
</symbol>
|
|
26715
|
-
<!-- up-right-and-down-left-from-center (enter fullscreen) -->
|
|
26716
|
-
<symbol id="g6-icon-fullscreen" viewBox="0 0 512 512">
|
|
26717
|
-
<path fill="currentColor" d="M344 0L488 0c13.3 0 24 10.7 24 24l0 144c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87-39-39c-6.9-6.9-8.9-17.2-5.2-26.2S334.3 0 344 0zM168 512L24 512c-13.3 0-24-10.7-24-24L0 344c0-9.7 5.8-18.5 14.8-22.2S34.1 320.2 41 327l39 39 87-87c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2S177.7 512 168 512z"/>
|
|
26718
|
-
</symbol>
|
|
26719
|
-
<!-- down-left-and-up-right-to-center (exit fullscreen) -->
|
|
26720
|
-
<symbol id="g6-icon-fullscreen-exit" viewBox="0 0 512 512">
|
|
26721
|
-
<path fill="currentColor" d="M439.5 7c9.4-9.4 24.6-9.4 33.9 0l32 32c9.4 9.4 9.4 24.6 0 33.9l-87 87 39 39c6.9 6.9 8.9 17.2 5.2 26.2S450.2 240 440.5 240l-144 0c-13.3 0-24-10.7-24-24l0-144c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2l39 39 87-87zM72.5 272l144 0c13.3 0 24 10.7 24 24l0 144c0 9.7-5.8 18.5-14.8 22.2s-19.3 1.7-26.2-5.2l-39-39-87 87c-9.4 9.4-24.6 9.4-33.9 0l-32-32c-9.4-9.4-9.4-24.6 0-33.9l87-87-39-39c-6.9-6.9-8.9-17.2-5.2-26.2S62.8 272 72.5 272z"/>
|
|
26722
|
-
</symbol>
|
|
26723
|
-
<!-- arrow-rotate-left (undo) -->
|
|
26724
|
-
<symbol id="g6-icon-undo" viewBox="0 0 512 512">
|
|
26725
|
-
<path fill="currentColor" d="M256 64c-56.8 0-107.9 24.7-143.1 64l47.1 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 192c-17.7 0-32-14.3-32-32L0 32C0 14.3 14.3 0 32 0S64 14.3 64 32l0 54.7C110.9 33.6 179.5 0 256 0 397.4 0 512 114.6 512 256S397.4 512 256 512c-87 0-163.9-43.4-210.1-109.7-10.1-14.5-6.6-34.4 7.9-44.6s34.4-6.6 44.6 7.9c34.8 49.8 92.4 82.3 157.6 82.3 106 0 192-86 192-192S362 64 256 64z"/>
|
|
26726
|
-
</symbol>
|
|
26727
|
-
<!-- arrow-rotate-right (redo) -->
|
|
26728
|
-
<symbol id="g6-icon-redo" viewBox="0 0 512 512">
|
|
26729
|
-
<path fill="currentColor" d="M436.7 74.7L448 85.4 448 32c0-17.7 14.3-32 32-32s32 14.3 32 32l0 128c0 17.7-14.3 32-32 32l-128 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l47.9 0-7.6-7.2c-.2-.2-.4-.4-.6-.6-75-75-196.5-75-271.5 0s-75 196.5 0 271.5 196.5 75 271.5 0c8.2-8.2 15.5-16.9 21.9-26.1 10.1-14.5 30.1-18 44.6-7.9s18 30.1 7.9 44.6c-8.5 12.2-18.2 23.8-29.1 34.7-100 100-262.1 100-362 0S-25 175 75 75c99.9-99.9 261.7-100 361.7-.3z"/>
|
|
26730
|
-
</symbol>
|
|
26731
|
-
<!-- pen (edit node) -->
|
|
26732
|
-
<symbol id="g6-icon-edit" viewBox="0 0 512 512">
|
|
26733
|
-
<path fill="currentColor" d="M352.9 21.2L308 66.1 445.9 204 490.8 159.1C504.4 145.6 512 127.2 512 108s-7.6-37.6-21.2-51.1L455.1 21.2C441.6 7.6 423.2 0 404 0s-37.6 7.6-51.1 21.2zM274.1 100L58.9 315.1c-10.7 10.7-18.5 24.1-22.6 38.7L.9 481.6c-2.3 8.3 0 17.3 6.2 23.4s15.1 8.5 23.4 6.2l127.8-35.5c14.6-4.1 27.9-11.8 38.7-22.6L412 237.9 274.1 100z"/>
|
|
26734
|
-
</symbol>
|
|
26735
|
-
<!-- trash-can (delete) -->
|
|
26736
|
-
<symbol id="g6-icon-delete" viewBox="0 0 448 512">
|
|
26737
|
-
<path fill="currentColor" d="M136.7 5.9C141.1-7.2 153.3-16 167.1-16l113.9 0c13.8 0 26 8.8 30.4 21.9L320 32 416 32c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l96 0 8.7-26.1zM32 144l384 0 0 304c0 35.3-28.7 64-64 64L96 512c-35.3 0-64-28.7-64-64l0-304zm88 64c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24zm104 0c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24zm104 0c-13.3 0-24 10.7-24 24l0 192c0 13.3 10.7 24 24 24s24-10.7 24-24l0-192c0-13.3-10.7-24-24-24z"/>
|
|
26738
|
-
</symbol>
|
|
26739
|
-
<!-- link (link nodes) -->
|
|
26740
|
-
<symbol id="g6-icon-link" viewBox="0 0 576 512">
|
|
26741
|
-
<path fill="currentColor" d="M419.5 96c-16.6 0-32.7 4.5-46.8 12.7-15.8-16-34.2-29.4-54.5-39.5 28.2-24 64.1-37.2 101.3-37.2 86.4 0 156.5 70 156.5 156.5 0 41.5-16.5 81.3-45.8 110.6l-71.1 71.1c-29.3 29.3-69.1 45.8-110.6 45.8-86.4 0-156.5-70-156.5-156.5 0-1.5 0-3 .1-4.5 .5-17.7 15.2-31.6 32.9-31.1s31.6 15.2 31.1 32.9c0 .9 0 1.8 0 2.6 0 51.1 41.4 92.5 92.5 92.5 24.5 0 48-9.7 65.4-27.1l71.1-71.1c17.3-17.3 27.1-40.9 27.1-65.4 0-51.1-41.4-92.5-92.5-92.5zM275.2 173.3c-1.9-.8-3.8-1.9-5.5-3.1-12.6-6.5-27-10.2-42.1-10.2-24.5 0-48 9.7-65.4 27.1L91.1 258.2c-17.3 17.3-27.1 40.9-27.1 65.4 0 51.1 41.4 92.5 92.5 92.5 16.5 0 32.6-4.4 46.7-12.6 15.8 16 34.2 29.4 54.6 39.5-28.2 23.9-64 37.2-101.3 37.2-86.4 0-156.5-70-156.5-156.5 0-41.5 16.5-81.3 45.8-110.6l71.1-71.1c29.3-29.3 69.1-45.8 110.6-45.8 86.6 0 156.5 70.6 156.5 156.9 0 1.3 0 2.6 0 3.9-.4 17.7-15.1 31.6-32.8 31.2s-31.6-15.1-31.2-32.8c0-.8 0-1.5 0-2.3 0-33.7-18-63.3-44.8-79.6z"/>
|
|
26742
|
-
</symbol>
|
|
26743
|
-
<!-- link-slash (unlink) -->
|
|
26744
|
-
<symbol id="g6-icon-unlink" viewBox="0 0 576 512">
|
|
26745
|
-
<path fill="currentColor" d="M41-24.9c-9.4-9.4-24.6-9.4-33.9 0S-2.3-.3 7 9.1l528 528c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-122-122c4.2-3.4 8.3-7.1 12.1-10.9l71.1-71.1c29.3-29.3 45.8-69.1 45.8-110.6 0-86.4-70-156.5-156.5-156.5-37.3 0-73.1 13.3-101.3 37.2 20.3 10.1 38.7 23.5 54.5 39.5 14.1-8.3 30.2-12.7 46.8-12.7 51.1 0 92.5 41.4 92.5 92.5 0 24.5-9.7 48-27.1 65.4l-71.1 71.1c-3.9 3.9-8.1 7.4-12.6 10.5l-47.5-47.5c16.5-.9 29.7-14.4 30.2-31.1 0-1.3 0-2.6 0-3.9 0-86.3-69.9-156.9-156.5-156.9-19.2 0-37.9 3.5-55.5 10.2L41-24.9zM225.9 160c.6 0 1.1 0 1.7 0 15.1 0 29.5 3.7 42.1 10.2 1.8 1.2 3.6 2.3 5.5 3.1 26.8 16.3 44.8 45.9 44.8 79.6 0 .4 0 .8 0 1.2L225.9 160zM346.2 416L192 261.8c1.2 84.6 69.6 152.9 154.1 154.1zM139.7 209.5l-45.3-45.3-48.6 48.6c-29.3 29.3-45.8 69.1-45.8 110.6 0 86.4 70 156.5 156.5 156.5 37.2 0 73.1-13.3 101.3-37.2-20.3-10.1-38.8-23.5-54.6-39.5-14 8.2-30.1 12.6-46.7 12.6-51.1 0-92.5-41.4-92.5-92.5 0-24.5 9.7-48 27.1-65.4l48.6-48.6z"/>
|
|
26746
|
-
</symbol>
|
|
26747
|
-
<!-- play (run node) -->
|
|
26748
|
-
<symbol id="g6-icon-run" viewBox="0 0 448 512">
|
|
26749
|
-
<path fill="currentColor" d="M91.2 36.9c-12.4-6.8-27.4-6.5-39.6 .7S32 57.9 32 72l0 368c0 14.1 7.5 27.2 19.6 34.4s27.2 7.5 39.6 .7l336-184c12.8-7 20.8-20.5 20.8-35.1s-8-28.1-20.8-35.1l-336-184z"/>
|
|
26750
|
-
</symbol>
|
|
26751
|
-
<!-- clone (copy size to other nodes/ports) -->
|
|
26752
|
-
<symbol id="g6-icon-resize" viewBox="0 0 512 512">
|
|
26753
|
-
<path fill="currentColor" d="M288 448l-224 0 0-224 48 0 0-64-48 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l224 0c35.3 0 64-28.7 64-64l0-48-64 0 0 48zm-64-96l224 0c35.3 0 64-28.7 64-64l0-224c0-35.3-28.7-64-64-64L224 0c-35.3 0-64 28.7-64 64l0 224c0 35.3 28.7 64 64 64z"/>
|
|
26754
|
-
</symbol>
|
|
26755
|
-
<!-- plus (create node). Deliberately NOT the FA7 solid plus:
|
|
26756
|
-
its arms are ~14% of the width and read thin next to the
|
|
26757
|
-
other solid glyphs. Bold geometric plus (~23% arm
|
|
26758
|
-
thickness) with long arms (32..480) so it reads as a "+",
|
|
26759
|
-
not a stubby Red-Cross square. -->
|
|
26760
|
-
<symbol id="g6-icon-plus" viewBox="0 0 512 512">
|
|
26761
|
-
<path fill="currentColor" d="M316 32 L316 196 L480 196 L480 316 L316 316 L316 480 L196 480 L196 316 L32 316 L32 196 L196 196 L196 32 Z"/>
|
|
26762
|
-
</symbol>
|
|
26763
|
-
<!-- ellipsis-vertical (unfold the floating toolbar).
|
|
26764
|
-
The strip it stands for is a vertical stack, and a vertical
|
|
26765
|
-
ellipsis is what "there is more of this here" is drawn as
|
|
26766
|
-
everywhere else. -->
|
|
26767
|
-
<symbol id="g6-icon-toolbar-show" viewBox="0 0 128 512">
|
|
26768
|
-
<path fill="currentColor" d="M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z"/>
|
|
26769
|
-
</symbol>
|
|
26770
|
-
<!-- xmark (fold the floating toolbar away).
|
|
26771
|
-
Not a chevron: the two toolbars sit on OPPOSITE edges, so a
|
|
26772
|
-
direction would point the wrong way on one of them. What the
|
|
26773
|
-
button does is close an overlay, and that is an x. -->
|
|
26774
|
-
<symbol id="g6-icon-toolbar-hide" viewBox="0 0 384 512">
|
|
26775
|
-
<path fill="currentColor" d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"/>
|
|
26776
|
-
</symbol>
|
|
26777
|
-
<!-- dashed marquee (selection mode).
|
|
26778
|
-
The band ITSELF, because that is what the button turns on: a
|
|
26779
|
-
drag on the canvas draws one and a tap picks a card. Not the
|
|
26780
|
-
fit-to-selection glyph next to it in the other toolbar -- that
|
|
26781
|
-
one is solid brackets around a solid object and means "put the
|
|
26782
|
-
camera on what is picked", which is the opposite end of the
|
|
26783
|
-
gesture. Dashes: 16 segments of 59 with gaps of 36 over a
|
|
26784
|
-
perimeter of 1520, so they land on the corners. -->
|
|
26785
|
-
<symbol id="g6-icon-select-mode" viewBox="0 0 512 512">
|
|
26786
|
-
<rect x="46" y="86" width="420" height="340" fill="none"
|
|
26787
|
-
stroke="currentColor" stroke-width="40"
|
|
26788
|
-
stroke-dasharray="59 36"/>
|
|
26789
|
-
</symbol>
|
|
26790
|
-
<!-- location-crosshairs (anchor the camera on one element).
|
|
26791
|
-
The SAME path as the DOM toolbars and their yi-location-crosshairs
|
|
26792
|
-
mask: the two toolbars sit in one console, and a control that
|
|
26793
|
-
does one thing has to be drawn one way. -->
|
|
26794
|
-
<symbol id="g6-icon-anchor" viewBox="0 0 576 512">
|
|
26795
|
-
<path fill="currentColor" d="M288-16c17.7 0 32 14.3 32 32l0 18.3c98.1 14 175.7 91.6 189.7 189.7l18.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-18.3 0c-14 98.1-91.6 175.7-189.7 189.7l0 18.3c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-18.3C157.9 463.7 80.3 386.1 66.3 288L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l18.3 0C80.3 125.9 157.9 48.3 256 34.3L256 16c0-17.7 14.3-32 32-32zM128 256a160 160 0 1 0 320 0 160 160 0 1 0 -320 0zm160-96a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"/>
|
|
26796
|
-
</symbol>
|
|
26797
|
-
<!-- floppy-disk (save) -->
|
|
26798
|
-
<symbol id="g6-icon-save" viewBox="0 0 448 512">
|
|
26799
|
-
<path fill="currentColor" d="M64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-242.7c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32L64 32zm32 96c0-17.7 14.3-32 32-32l160 0c17.7 0 32 14.3 32 32l0 64c0 17.7-14.3 32-32 32l-160 0c-17.7 0-32-14.3-32-32l0-64zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"/>
|
|
26800
|
-
</symbol>
|
|
26801
|
-
</svg>`;
|
|
26802
|
-
function inject_svg_icons() {
|
|
26803
|
-
if (document.getElementById(CUSTOM_SVG_ICONS_ID)) return;
|
|
26804
|
-
const div = document.createElement("div");
|
|
26805
|
-
div.id = CUSTOM_SVG_ICONS_ID;
|
|
26806
|
-
div.style.display = "none";
|
|
26807
|
-
div.innerHTML = ICONS;
|
|
26808
|
-
document.body.appendChild(div);
|
|
26809
|
-
}
|
|
26810
|
-
var __icon_defined__ = {};
|
|
26811
|
-
function yui_icon_is_defined(name) {
|
|
26812
|
-
if (!name || typeof name !== "string") return false;
|
|
26813
|
-
if (__icon_defined__[name] !== void 0) return __icon_defined__[name];
|
|
26814
|
-
let defined = false;
|
|
26815
|
-
try {
|
|
26816
|
-
const el = document.createElement("i");
|
|
26817
|
-
el.className = name;
|
|
26818
|
-
el.style.position = "absolute";
|
|
26819
|
-
el.style.visibility = "hidden";
|
|
26820
|
-
el.style.pointerEvents = "none";
|
|
26821
|
-
document.body.appendChild(el);
|
|
26822
|
-
const st = window.getComputedStyle(el, "::before");
|
|
26823
|
-
const mask = st.maskImage || st.webkitMaskImage || "";
|
|
26824
|
-
defined = !!mask && mask !== "none";
|
|
26825
|
-
document.body.removeChild(el);
|
|
26826
|
-
} catch (e) {
|
|
26827
|
-
defined = false;
|
|
26828
|
-
}
|
|
26829
|
-
__icon_defined__[name] = defined;
|
|
26830
|
-
return defined;
|
|
26831
|
-
}
|
|
26832
|
-
//#endregion
|
|
26833
27299
|
//#region src/yui_row_search.js
|
|
26834
27300
|
/***********************************************************************
|
|
26835
27301
|
* yui_row_search.js
|
|
@@ -27445,7 +27911,10 @@ function mt_create$5(gobj) {
|
|
|
27445
27911
|
***************************************************************/
|
|
27446
27912
|
function mt_start$5(gobj) {
|
|
27447
27913
|
let shell = yui_shell_of(gobj);
|
|
27448
|
-
if (shell)
|
|
27914
|
+
if (shell) {
|
|
27915
|
+
(0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
27916
|
+
(0, _yuneta_gobj_js.gobj_subscribe_event)(shell, "EV_ICONS_CHANGED", {}, gobj);
|
|
27917
|
+
}
|
|
27449
27918
|
create_tabulator(gobj);
|
|
27450
27919
|
}
|
|
27451
27920
|
/***************************************************************
|
|
@@ -27453,7 +27922,10 @@ function mt_start$5(gobj) {
|
|
|
27453
27922
|
***************************************************************/
|
|
27454
27923
|
function mt_stop$5(gobj) {
|
|
27455
27924
|
let shell = yui_shell_of(gobj);
|
|
27456
|
-
if (shell)
|
|
27925
|
+
if (shell) {
|
|
27926
|
+
(0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
|
|
27927
|
+
(0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_ICONS_CHANGED", {}, gobj);
|
|
27928
|
+
}
|
|
27457
27929
|
close_form_dialog(gobj);
|
|
27458
27930
|
close_schema_dialog(gobj);
|
|
27459
27931
|
close_cell_json_dialog(gobj);
|
|
@@ -28170,7 +28642,13 @@ function create_tabulator(gobj) {
|
|
|
28170
28642
|
let formatterParams;
|
|
28171
28643
|
const field_desc = (0, _yuneta_gobj_js.treedb_get_field_desc)(col);
|
|
28172
28644
|
if (field_desc.is_hidden) continue;
|
|
28645
|
+
if (yui_icons_is_svg_field((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "topic_name"), col.id)) field_desc.type = "svg";
|
|
28173
28646
|
switch (field_desc.type) {
|
|
28647
|
+
case "svg":
|
|
28648
|
+
hozAlign = "center";
|
|
28649
|
+
vertAlign = "middle";
|
|
28650
|
+
colFormatter = svg_cell_formatter;
|
|
28651
|
+
break;
|
|
28174
28652
|
case "hook":
|
|
28175
28653
|
hozAlign = "center";
|
|
28176
28654
|
cellClick = function(e, cell) {
|
|
@@ -28559,6 +29037,30 @@ function icon_formatter(cell) {
|
|
|
28559
29037
|
}]);
|
|
28560
29038
|
}
|
|
28561
29039
|
/************************************************************
|
|
29040
|
+
* Cell of the drawing of a user icon (`svg` of __icons__): the
|
|
29041
|
+
* icon itself, as the app will draw it. A drawing that cannot
|
|
29042
|
+
* be drawn says why, in plain grey -- the same honest half as
|
|
29043
|
+
* an unknown icon name in icon_formatter.
|
|
29044
|
+
************************************************************/
|
|
29045
|
+
function svg_cell_formatter(cell) {
|
|
29046
|
+
let svg = cell.getValue();
|
|
29047
|
+
if (!(0, _yuneta_gobj_js.is_string)(svg) || (0, _yuneta_gobj_js.empty_string)(svg)) return "";
|
|
29048
|
+
let preview = yui_svg_icon_element(svg);
|
|
29049
|
+
if (preview.error) {
|
|
29050
|
+
let text = svg_error_text(preview.error);
|
|
29051
|
+
return (0, _yuneta_gobj_js.createElement2)([
|
|
29052
|
+
"span",
|
|
29053
|
+
{
|
|
29054
|
+
class: "ICON_CELL_UNKNOWN is-size-7 yui-text-quiet",
|
|
29055
|
+
title: text
|
|
29056
|
+
},
|
|
29057
|
+
text
|
|
29058
|
+
]);
|
|
29059
|
+
}
|
|
29060
|
+
preview.element.classList.add("ICON_CELL");
|
|
29061
|
+
return preview.element;
|
|
29062
|
+
}
|
|
29063
|
+
/************************************************************
|
|
28562
29064
|
* Cell of a col holding a JSON document (dict/list/blob/
|
|
28563
29065
|
* template/coordinates/…): a one-line truncated preview,
|
|
28564
29066
|
* marked as a link because the click opens the whole value
|
|
@@ -29786,6 +30288,24 @@ function ac_language_changed$4(gobj, event, kw, src) {
|
|
|
29786
30288
|
}
|
|
29787
30289
|
return 0;
|
|
29788
30290
|
}
|
|
30291
|
+
/************************************************************
|
|
30292
|
+
* The user icons changed (published by the shell): the cells
|
|
30293
|
+
* of an `icon` column decided when they were drawn whether
|
|
30294
|
+
* their name was an icon, so they are drawn again.
|
|
30295
|
+
************************************************************/
|
|
30296
|
+
function ac_icons_changed(gobj, event, kw, src) {
|
|
30297
|
+
let tabulator = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "tabulator");
|
|
30298
|
+
if (!tabulator) return 0;
|
|
30299
|
+
let desc = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "desc");
|
|
30300
|
+
if ((desc && Array.isArray(desc.cols) ? desc.cols : []).filter((col) => col && col.id && (0, _yuneta_gobj_js.treedb_get_field_desc)(col).type === "icon").length === 0) return 0;
|
|
30301
|
+
try {
|
|
30302
|
+
for (const row of tabulator.getRows()) row.reformat();
|
|
30303
|
+
} catch (e) {
|
|
30304
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot redraw the icon cells: ${e}`);
|
|
30305
|
+
return -1;
|
|
30306
|
+
}
|
|
30307
|
+
return 0;
|
|
30308
|
+
}
|
|
29789
30309
|
function ac_load_nodes(gobj, event, kw, src) {
|
|
29790
30310
|
let data = kw;
|
|
29791
30311
|
if (!(0, _yuneta_gobj_js.is_array)(data)) {
|
|
@@ -30906,6 +31426,11 @@ function create_gclass$5(gclass_name) {
|
|
|
30906
31426
|
ac_language_changed$4,
|
|
30907
31427
|
null
|
|
30908
31428
|
],
|
|
31429
|
+
[
|
|
31430
|
+
"EV_ICONS_CHANGED",
|
|
31431
|
+
ac_icons_changed,
|
|
31432
|
+
null
|
|
31433
|
+
],
|
|
30909
31434
|
[
|
|
30910
31435
|
"EV_LOAD_NODES",
|
|
30911
31436
|
ac_load_nodes,
|
|
@@ -31144,6 +31669,7 @@ function create_gclass$5(gclass_name) {
|
|
|
31144
31669
|
]]];
|
|
31145
31670
|
const event_types = [
|
|
31146
31671
|
["EV_LANGUAGE_CHANGED", 0],
|
|
31672
|
+
["EV_ICONS_CHANGED", 0],
|
|
31147
31673
|
["EV_LOAD_NODES", 0],
|
|
31148
31674
|
["EV_LOAD_NODE_CREATED", 0],
|
|
31149
31675
|
["EV_LOAD_NODE_UPDATED", 0],
|
|
@@ -76294,8 +76820,29 @@ function ac_select_topic(gobj, event, kw, src) {
|
|
|
76294
76820
|
go(gobj, gobj.priv.treedb_id, kw.topic, false, true);
|
|
76295
76821
|
return reload_after_move(gobj);
|
|
76296
76822
|
}
|
|
76823
|
+
/***************************************************************
|
|
76824
|
+
* «←»: where browser Back goes, the route before this one.
|
|
76825
|
+
*
|
|
76826
|
+
* It went UP a level (columns -> topics -> treedbs) whatever came
|
|
76827
|
+
* before, and Back undoes the last move: after two topics opened from
|
|
76828
|
+
* the diagram, Back returned to the first one and the arrow to the
|
|
76829
|
+
* treedb (2026-10-10). The rule is that both land on the same place.
|
|
76830
|
+
*
|
|
76831
|
+
* The exception to "this view navigates nothing itself" is this one
|
|
76832
|
+
* control, like the topics view's arrow: it asks the shell, which is
|
|
76833
|
+
* what remembers. Only with a route of its own: mounted without one
|
|
76834
|
+
* (in a window), the route before is the APP's, behind the editor, and
|
|
76835
|
+
* the arrow keeps going up a level. Up a level too when the page has
|
|
76836
|
+
* not moved.
|
|
76837
|
+
***************************************************************/
|
|
76297
76838
|
function ac_back(gobj, event, kw, src) {
|
|
76298
76839
|
let priv = gobj.priv;
|
|
76840
|
+
let shell = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "base_route") ? yui_shell_of(gobj) : null;
|
|
76841
|
+
let came_from = shell ? yui_shell_previous_route(shell) : "";
|
|
76842
|
+
if (came_from) {
|
|
76843
|
+
yui_shell_navigate(shell, came_from, { push: true });
|
|
76844
|
+
return 0;
|
|
76845
|
+
}
|
|
76299
76846
|
if (priv.diagram || priv.topic_name) go(gobj, priv.treedb_id, "", false, true);
|
|
76300
76847
|
else go(gobj, "", "", false, true);
|
|
76301
76848
|
return reload_after_move(gobj);
|
|
@@ -80670,7 +81217,9 @@ function setup_json_pad(self) {
|
|
|
80670
81217
|
}
|
|
80671
81218
|
//#endregion
|
|
80672
81219
|
exports.EditControl = EditControl;
|
|
81220
|
+
exports.ICONS_TOPIC = ICONS_TOPIC;
|
|
80673
81221
|
exports.MarkerControl = MarkerControl;
|
|
81222
|
+
exports.USER_ICON_PREFIX = USER_ICON_PREFIX;
|
|
80674
81223
|
exports.YUI_FILE_ACCEPT = YUI_FILE_ACCEPT;
|
|
80675
81224
|
exports.YUI_PERIODS = YUI_PERIODS;
|
|
80676
81225
|
exports.YUI_PERIODS_DEFAULT = YUI_PERIODS_DEFAULT;
|
|
@@ -80749,6 +81298,11 @@ exports.yui_file_read = yui_file_read;
|
|
|
80749
81298
|
exports.yui_file_sha256 = yui_file_sha256;
|
|
80750
81299
|
exports.yui_file_size_label = yui_file_size_label;
|
|
80751
81300
|
exports.yui_files_manifest = yui_files_manifest;
|
|
81301
|
+
exports.yui_icon_is_defined = yui_icon_is_defined;
|
|
81302
|
+
exports.yui_icons_list = yui_icons_list;
|
|
81303
|
+
exports.yui_icons_put_user = yui_icons_put_user;
|
|
81304
|
+
exports.yui_icons_remove_user = yui_icons_remove_user;
|
|
81305
|
+
exports.yui_icons_set_user = yui_icons_set_user;
|
|
80752
81306
|
exports.yui_is_dark = yui_is_dark;
|
|
80753
81307
|
exports.yui_mount_service_view = yui_mount_service_view;
|
|
80754
81308
|
exports.yui_shell_close_drawer = yui_shell_close_drawer;
|
|
@@ -80778,8 +81332,11 @@ exports.yui_shell_show_route_map = yui_shell_show_route_map;
|
|
|
80778
81332
|
exports.yui_shell_show_warning = yui_shell_show_warning;
|
|
80779
81333
|
exports.yui_shell_toggle_drawer = yui_shell_toggle_drawer;
|
|
80780
81334
|
exports.yui_shell_unpark_route = yui_shell_unpark_route;
|
|
81335
|
+
exports.yui_svg_icon_element = yui_svg_icon_element;
|
|
81336
|
+
exports.yui_svg_sanitize = yui_svg_sanitize;
|
|
80781
81337
|
exports.yui_theme_now = yui_theme_now;
|
|
80782
81338
|
exports.yui_toolbar = yui_toolbar;
|
|
81339
|
+
exports.yui_user_icon_class = yui_user_icon_class;
|
|
80783
81340
|
exports.yui_watch_theme = yui_watch_theme;
|
|
80784
81341
|
|
|
80785
81342
|
//# sourceMappingURL=gobj-ui.cjs.js.map
|