@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.
@@ -2603,6 +2603,7 @@ function create_gclass$22(gclass_name) {
2603
2603
  ["EV_ROUTE_REQUESTED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
2604
2604
  ["EV_ROUTE_CHANGED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
2605
2605
  ["EV_LANGUAGE_CHANGED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
2606
+ ["EV_ICONS_CHANGED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
2606
2607
  ["EV_CONNECTION_STATE", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_NO_WARN_SUBS]
2607
2608
  ];
2608
2609
  __gclass__$22 = gclass_create(gclass_name, event_types, states, gmt$22, 0, attrs_table$22, PRIVATE_DATA$22, 0, 0, 0, gclass_flag_t.gcflag_no_check_output_events);
@@ -2906,6 +2907,22 @@ function yui_shell_translate(shell_gobj, $el) {
2906
2907
  refresh_language($el, priv.translator);
2907
2908
  }
2908
2909
  /************************************************************
2910
+ * The user icons changed (lib_icons.js: yui_icons_set_user,
2911
+ * yui_icons_put_user, yui_icons_remove_user): PUBLISH it, so
2912
+ * the views that decided at render time whether a name is an
2913
+ * icon draw it again.
2914
+ *
2915
+ * The registry is a module and knows no shell; the view that
2916
+ * fed it calls this.
2917
+ ************************************************************/
2918
+ function yui_shell_icons_changed(shell_gobj) {
2919
+ if (!shell_gobj || !is_gobj(shell_gobj)) {
2920
+ log_error("yui_shell_icons_changed(): no shell");
2921
+ return;
2922
+ }
2923
+ gobj_publish_event(shell_gobj, "EV_ICONS_CHANGED", {});
2924
+ }
2925
+ /************************************************************
2909
2926
  * Set the backend-connection state painted by every
2910
2927
  * type:"connection" toolbar item. Host/event-driven: the
2911
2928
  * app calls this from its transport handlers (EV_ON_OPEN →
@@ -7085,6 +7102,496 @@ function yui_watch_theme(gobj, event = "EV_THEME") {
7085
7102
  }
7086
7103
  } };
7087
7104
  }
7105
+ //#endregion
7106
+ //#region src/lib_icons.js
7107
+ /*********************************************************
7108
+ * lib_icons.js
7109
+ *
7110
+ * Two icon systems are managed here:
7111
+ *
7112
+ * 1. FA-style CSS icons (yui_icons.css)
7113
+ * Usage: <i class="yi-save"></i>
7114
+ * Color: inherits currentColor from parent via CSS mask.
7115
+ *
7116
+ * 2. SVG symbol icons for G6 toolbar (and any other component
7117
+ * that uses <use xlink:href="#id">).
7118
+ * Symbols are injected once into the DOM.
7119
+ * All symbol ids are prefixed with "g6-icon-" to avoid
7120
+ * conflicts with other DOM elements.
7121
+ * Icon paths come from:
7122
+ * fontawesome-free-7.1.0-web/sprites/solid.svg
7123
+ *
7124
+ * G6 toolbar items are managed via CSS class names (className
7125
+ * field in getItems()) using YuiToolbar in c_g6_nodes_tree.js.
7126
+ * This lets lib_graph.js state functions (set_submit_state,
7127
+ * disableElements, …) work on toolbar icons exactly like on
7128
+ * regular Bulma/FA buttons — no icon-specific helpers needed.
7129
+ *
7130
+ * 3. User icons: the icons a user adds as DATA, one node of the
7131
+ * treedb system topic `__icons__` each (id = name, svg = drawing).
7132
+ * They join system 1 at run time: each becomes a rule
7133
+ * `.yi-u-<id>::before` in a stylesheet of their own, so every
7134
+ * component that draws an icon by class name draws them too.
7135
+ * `yi-u-` is the user's namespace, and the reason a user icon can
7136
+ * never replace an icon of the library.
7137
+ *
7138
+ * Copyright (c) 2025-2026, ArtGins.
7139
+ * All Rights Reserved.
7140
+ *********************************************************/
7141
+ var CUSTOM_SVG_ICONS_ID = "g6-custom-svgicons";
7142
+ var ICONS = `<svg xmlns="http://www.w3.org/2000/svg">
7143
+ <!-- magnifying-glass-plus -->
7144
+ <symbol id="g6-icon-zoom-in" viewBox="0 0 512 512">
7145
+ <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"/>
7146
+ </symbol>
7147
+ <!-- magnifying-glass-minus -->
7148
+ <symbol id="g6-icon-zoom-out" viewBox="0 0 512 512">
7149
+ <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"/>
7150
+ </symbol>
7151
+ <!-- house (reset zoom: back to original 100% view) -->
7152
+ <symbol id="g6-icon-home" viewBox="0 0 512 512">
7153
+ <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"/>
7154
+ </symbol>
7155
+ <!-- expand (zoom to fit) -->
7156
+ <symbol id="g6-icon-fit" viewBox="0 0 448 512">
7157
+ <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"/>
7158
+ </symbol>
7159
+ <!-- fit to selection: the same corner brackets as the fit icon,
7160
+ around a marked object. The two sit side by side in the
7161
+ toolbar and have to read as a family, which a borrowed glyph
7162
+ would not. (No backticks in here: the sprite lives inside a
7163
+ template literal.) -->
7164
+ <symbol id="g6-icon-fit-selection" viewBox="0 0 448 512">
7165
+ <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"/>
7166
+ <rect fill="currentColor" x="144" y="176" width="160" height="160" rx="24"/>
7167
+ </symbol>
7168
+ <!-- crosshairs (center) -->
7169
+ <symbol id="g6-icon-center" viewBox="0 0 576 512">
7170
+ <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"/>
7171
+ </symbol>
7172
+ <!-- up-right-and-down-left-from-center (enter fullscreen) -->
7173
+ <symbol id="g6-icon-fullscreen" viewBox="0 0 512 512">
7174
+ <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"/>
7175
+ </symbol>
7176
+ <!-- down-left-and-up-right-to-center (exit fullscreen) -->
7177
+ <symbol id="g6-icon-fullscreen-exit" viewBox="0 0 512 512">
7178
+ <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"/>
7179
+ </symbol>
7180
+ <!-- arrow-rotate-left (undo) -->
7181
+ <symbol id="g6-icon-undo" viewBox="0 0 512 512">
7182
+ <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"/>
7183
+ </symbol>
7184
+ <!-- arrow-rotate-right (redo) -->
7185
+ <symbol id="g6-icon-redo" viewBox="0 0 512 512">
7186
+ <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"/>
7187
+ </symbol>
7188
+ <!-- pen (edit node) -->
7189
+ <symbol id="g6-icon-edit" viewBox="0 0 512 512">
7190
+ <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"/>
7191
+ </symbol>
7192
+ <!-- trash-can (delete) -->
7193
+ <symbol id="g6-icon-delete" viewBox="0 0 448 512">
7194
+ <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"/>
7195
+ </symbol>
7196
+ <!-- link (link nodes) -->
7197
+ <symbol id="g6-icon-link" viewBox="0 0 576 512">
7198
+ <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"/>
7199
+ </symbol>
7200
+ <!-- link-slash (unlink) -->
7201
+ <symbol id="g6-icon-unlink" viewBox="0 0 576 512">
7202
+ <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"/>
7203
+ </symbol>
7204
+ <!-- play (run node) -->
7205
+ <symbol id="g6-icon-run" viewBox="0 0 448 512">
7206
+ <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"/>
7207
+ </symbol>
7208
+ <!-- clone (copy size to other nodes/ports) -->
7209
+ <symbol id="g6-icon-resize" viewBox="0 0 512 512">
7210
+ <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"/>
7211
+ </symbol>
7212
+ <!-- plus (create node). Deliberately NOT the FA7 solid plus:
7213
+ its arms are ~14% of the width and read thin next to the
7214
+ other solid glyphs. Bold geometric plus (~23% arm
7215
+ thickness) with long arms (32..480) so it reads as a "+",
7216
+ not a stubby Red-Cross square. -->
7217
+ <symbol id="g6-icon-plus" viewBox="0 0 512 512">
7218
+ <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"/>
7219
+ </symbol>
7220
+ <!-- ellipsis-vertical (unfold the floating toolbar).
7221
+ The strip it stands for is a vertical stack, and a vertical
7222
+ ellipsis is what "there is more of this here" is drawn as
7223
+ everywhere else. -->
7224
+ <symbol id="g6-icon-toolbar-show" viewBox="0 0 128 512">
7225
+ <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"/>
7226
+ </symbol>
7227
+ <!-- xmark (fold the floating toolbar away).
7228
+ Not a chevron: the two toolbars sit on OPPOSITE edges, so a
7229
+ direction would point the wrong way on one of them. What the
7230
+ button does is close an overlay, and that is an x. -->
7231
+ <symbol id="g6-icon-toolbar-hide" viewBox="0 0 384 512">
7232
+ <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"/>
7233
+ </symbol>
7234
+ <!-- dashed marquee (selection mode).
7235
+ The band ITSELF, because that is what the button turns on: a
7236
+ drag on the canvas draws one and a tap picks a card. Not the
7237
+ fit-to-selection glyph next to it in the other toolbar -- that
7238
+ one is solid brackets around a solid object and means "put the
7239
+ camera on what is picked", which is the opposite end of the
7240
+ gesture. Dashes: 16 segments of 59 with gaps of 36 over a
7241
+ perimeter of 1520, so they land on the corners. -->
7242
+ <symbol id="g6-icon-select-mode" viewBox="0 0 512 512">
7243
+ <rect x="46" y="86" width="420" height="340" fill="none"
7244
+ stroke="currentColor" stroke-width="40"
7245
+ stroke-dasharray="59 36"/>
7246
+ </symbol>
7247
+ <!-- location-crosshairs (anchor the camera on one element).
7248
+ The SAME path as the DOM toolbars and their yi-location-crosshairs
7249
+ mask: the two toolbars sit in one console, and a control that
7250
+ does one thing has to be drawn one way. -->
7251
+ <symbol id="g6-icon-anchor" viewBox="0 0 576 512">
7252
+ <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"/>
7253
+ </symbol>
7254
+ <!-- floppy-disk (save) -->
7255
+ <symbol id="g6-icon-save" viewBox="0 0 448 512">
7256
+ <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"/>
7257
+ </symbol>
7258
+ </svg>`;
7259
+ function inject_svg_icons() {
7260
+ if (document.getElementById(CUSTOM_SVG_ICONS_ID)) return;
7261
+ const div = document.createElement("div");
7262
+ div.id = CUSTOM_SVG_ICONS_ID;
7263
+ div.style.display = "none";
7264
+ div.innerHTML = ICONS;
7265
+ document.body.appendChild(div);
7266
+ }
7267
+ var __icon_defined__ = {};
7268
+ function yui_icon_is_defined(name) {
7269
+ if (!name || typeof name !== "string") return false;
7270
+ if (__icon_defined__[name] !== void 0) return __icon_defined__[name];
7271
+ let defined = false;
7272
+ try {
7273
+ const el = document.createElement("i");
7274
+ el.className = name;
7275
+ el.style.position = "absolute";
7276
+ el.style.visibility = "hidden";
7277
+ el.style.pointerEvents = "none";
7278
+ document.body.appendChild(el);
7279
+ const st = window.getComputedStyle(el, "::before");
7280
+ const mask = st.maskImage || st.webkitMaskImage || "";
7281
+ defined = !!mask && mask !== "none";
7282
+ document.body.removeChild(el);
7283
+ } catch (e) {
7284
+ defined = false;
7285
+ }
7286
+ __icon_defined__[name] = defined;
7287
+ return defined;
7288
+ }
7289
+ /************************************************************
7290
+ *
7291
+ * User icons
7292
+ *
7293
+ ************************************************************/
7294
+ var ICONS_TOPIC = "__icons__";
7295
+ var ICONS_SVG_COL = "svg";
7296
+ var USER_ICON_PREFIX = "yi-u-";
7297
+ var USER_ICON_ID_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7298
+ var USER_ICON_MAX_SVG = 32768;
7299
+ var USER_ICONS_STYLE_ID = "yui-user-icons";
7300
+ var SVG_NS = "http://www.w3.org/2000/svg";
7301
+ var SVG_ELEMENTS = [
7302
+ "svg",
7303
+ "g",
7304
+ "path",
7305
+ "circle",
7306
+ "ellipse",
7307
+ "rect",
7308
+ "line",
7309
+ "polyline",
7310
+ "polygon"
7311
+ ];
7312
+ var SVG_ATTRIBUTES = [
7313
+ "d",
7314
+ "cx",
7315
+ "cy",
7316
+ "r",
7317
+ "rx",
7318
+ "ry",
7319
+ "x",
7320
+ "y",
7321
+ "x1",
7322
+ "y1",
7323
+ "x2",
7324
+ "y2",
7325
+ "width",
7326
+ "height",
7327
+ "points",
7328
+ "transform",
7329
+ "fill",
7330
+ "fill-rule",
7331
+ "fill-opacity",
7332
+ "clip-rule",
7333
+ "opacity",
7334
+ "stroke",
7335
+ "stroke-width",
7336
+ "stroke-linecap",
7337
+ "stroke-linejoin",
7338
+ "stroke-miterlimit",
7339
+ "stroke-opacity",
7340
+ "stroke-dasharray"
7341
+ ];
7342
+ var SVG_VALUE_RE = /^[a-zA-Z0-9\s.,#%()+-]*$/;
7343
+ var __user_icons__ = /* @__PURE__ */ new Map();
7344
+ /************************************************************
7345
+ * Is this field the drawing of an icon of __icons__?
7346
+ * The form edits it as a text area with a preview, and the
7347
+ * table shows the icon instead of the svg source.
7348
+ ************************************************************/
7349
+ function yui_icons_is_svg_field(topic_name, field_name) {
7350
+ return topic_name === "__icons__" && field_name === ICONS_SVG_COL;
7351
+ }
7352
+ /************************************************************
7353
+ * The class of the user icon named `id`.
7354
+ ************************************************************/
7355
+ function yui_user_icon_class(id) {
7356
+ return USER_ICON_PREFIX + id;
7357
+ }
7358
+ /************************************************************
7359
+ * Rebuild an svg from its SHAPES only.
7360
+ *
7361
+ * Return {svg, dropped} -- svg is the clean markup, dropped the
7362
+ * names of what was left out -- or {error} when there is
7363
+ * nothing to draw. The error is one of a FIXED set, so a GUI
7364
+ * can translate it: "empty svg", "svg too big", "not an svg
7365
+ * document", "svg without size", "svg without shapes". The markup is never inserted anywhere as
7366
+ * it came: it is parsed, and a new one is written from the
7367
+ * elements and attributes allowed above.
7368
+ ************************************************************/
7369
+ function yui_svg_sanitize(svg_text) {
7370
+ if (typeof svg_text !== "string" || !svg_text.trim()) return { error: "empty svg" };
7371
+ if (svg_text.length > USER_ICON_MAX_SVG) return { error: "svg too big" };
7372
+ let doc;
7373
+ try {
7374
+ doc = new DOMParser().parseFromString(svg_text, "image/svg+xml");
7375
+ } catch (e) {
7376
+ return { error: "not an svg document" };
7377
+ }
7378
+ let root = doc && doc.documentElement;
7379
+ if (!root || root.getElementsByTagName("parsererror").length > 0) return { error: "not an svg document" };
7380
+ return rebuild_svg_from_shapes(root);
7381
+ }
7382
+ /************************************************************
7383
+ * The second half of yui_svg_sanitize(), on a PARSED tree:
7384
+ * anything with `localName`, `attributes` ({name, localName,
7385
+ * prefix, value}), `children` and `getAttribute()` -- a DOM
7386
+ * element, or the plain objects a test builds.
7387
+ ************************************************************/
7388
+ function rebuild_svg_from_shapes(root) {
7389
+ if (!root || root.localName !== "svg") return { error: "not an svg document" };
7390
+ let dropped = /* @__PURE__ */ new Set();
7391
+ let shapes = 0;
7392
+ function value_is_safe(value) {
7393
+ return SVG_VALUE_RE.test(value) && !/url\s*\(/i.test(value);
7394
+ }
7395
+ function clean_attrs(el, allowed) {
7396
+ let out = "";
7397
+ for (const attr of Array.from(el.attributes || [])) {
7398
+ let name = attr.localName || attr.name;
7399
+ if (attr.prefix || !allowed.includes(name)) {
7400
+ if (name !== "xmlns" && attr.prefix !== "xmlns") dropped.add(`@${attr.name}`);
7401
+ continue;
7402
+ }
7403
+ let value = String(attr.value).trim();
7404
+ if (!value_is_safe(value)) {
7405
+ dropped.add(`@${attr.name}`);
7406
+ continue;
7407
+ }
7408
+ out += ` ${name}="${value}"`;
7409
+ }
7410
+ return out;
7411
+ }
7412
+ function clean_node(el) {
7413
+ let name = el.localName;
7414
+ if (!SVG_ELEMENTS.includes(name) || name === "svg") {
7415
+ dropped.add(name);
7416
+ return "";
7417
+ }
7418
+ if (name !== "g") shapes++;
7419
+ let inner = "";
7420
+ for (const child of Array.from(el.children || [])) inner += clean_node(child);
7421
+ return `<${name}${clean_attrs(el, SVG_ATTRIBUTES)}>${inner}</${name}>`;
7422
+ }
7423
+ let view_box = (root.getAttribute("viewBox") || "").trim();
7424
+ if (!/^-?[\d.]+([\s,]+-?[\d.]+){3}$/.test(view_box)) {
7425
+ let w = parseFloat(root.getAttribute("width"));
7426
+ let h = parseFloat(root.getAttribute("height"));
7427
+ if (!(w > 0 && h > 0)) return { error: "svg without size" };
7428
+ view_box = `0 0 ${w} ${h}`;
7429
+ }
7430
+ const ROOT_ATTRIBUTES = [
7431
+ "fill",
7432
+ "fill-rule",
7433
+ "stroke",
7434
+ "stroke-width",
7435
+ "stroke-linecap",
7436
+ "stroke-linejoin"
7437
+ ];
7438
+ let root_attrs = "";
7439
+ for (const name of ROOT_ATTRIBUTES) {
7440
+ let value = (root.getAttribute(name) || "").trim();
7441
+ if (value && value_is_safe(value)) root_attrs += ` ${name}="${value}"`;
7442
+ else if (value) dropped.add(`@${name}`);
7443
+ }
7444
+ for (const attr of Array.from(root.attributes || [])) {
7445
+ let name = attr.localName || attr.name;
7446
+ if (attr.prefix === "xmlns" || name === "xmlns" || [
7447
+ "viewBox",
7448
+ "width",
7449
+ "height",
7450
+ "version"
7451
+ ].includes(name) || !attr.prefix && ROOT_ATTRIBUTES.includes(name)) continue;
7452
+ dropped.add(`@${attr.name}`);
7453
+ }
7454
+ let inner = "";
7455
+ for (const child of Array.from(root.children || [])) inner += clean_node(child);
7456
+ if (shapes === 0) return { error: "svg without shapes" };
7457
+ return {
7458
+ svg: `<svg xmlns="${SVG_NS}" viewBox="${view_box}"${root_attrs}>${inner}</svg>`,
7459
+ dropped: Array.from(dropped)
7460
+ };
7461
+ }
7462
+ /************************************************************
7463
+ * The CSS `url(...)` of an svg, to be used as a mask.
7464
+ * Every character that could end the string or the url is
7465
+ * percent-encoded.
7466
+ ************************************************************/
7467
+ function svg_mask_url(svg) {
7468
+ return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
7469
+ }
7470
+ /************************************************************
7471
+ * An element that shows an svg as an icon, before it is
7472
+ * registered (a form preview, a cell of __icons__ itself).
7473
+ * Return {element} or {error}.
7474
+ ************************************************************/
7475
+ function yui_svg_icon_element(svg_text) {
7476
+ let clean = yui_svg_sanitize(svg_text);
7477
+ if (clean.error) return { error: clean.error };
7478
+ let el = document.createElement("span");
7479
+ el.className = "USER_ICON_PREVIEW";
7480
+ let mask = svg_mask_url(clean.svg);
7481
+ el.style.setProperty("-webkit-mask-image", mask);
7482
+ el.style.setProperty("mask-image", mask);
7483
+ return {
7484
+ element: el,
7485
+ dropped: clean.dropped
7486
+ };
7487
+ }
7488
+ /************************************************************
7489
+ * Write the stylesheet of the user icons again, from the map.
7490
+ ************************************************************/
7491
+ function rebuild_user_icons_stylesheet() {
7492
+ let css = "";
7493
+ for (const [id, icon] of __user_icons__) css += `.${yui_user_icon_class(id)}::before {-webkit-mask-image: ${icon.mask}; mask-image: ${icon.mask};}\n`;
7494
+ try {
7495
+ let el = document.getElementById(USER_ICONS_STYLE_ID);
7496
+ if (!el) {
7497
+ el = document.createElement("style");
7498
+ el.id = USER_ICONS_STYLE_ID;
7499
+ document.head.appendChild(el);
7500
+ }
7501
+ el.textContent = css;
7502
+ } catch (e) {
7503
+ log_error(`user icons: cannot write the stylesheet: ${e}`);
7504
+ }
7505
+ for (const name of Object.keys(__icon_defined__)) if (name.startsWith("yi-u-")) delete __icon_defined__[name];
7506
+ }
7507
+ /************************************************************
7508
+ * Validate one node of __icons__.
7509
+ * Return the entry to keep, or null (warning logged).
7510
+ ************************************************************/
7511
+ function user_icon_entry(node) {
7512
+ let id = node && node.id;
7513
+ if (typeof id !== "string" || !USER_ICON_ID_RE.test(id)) {
7514
+ log_warning(`user icons: bad icon name '${id}': lowercase letters, digits and '-' only`);
7515
+ return null;
7516
+ }
7517
+ let clean = yui_svg_sanitize(node.svg);
7518
+ if (clean.error) {
7519
+ log_warning(`user icons: icon '${id}' not drawn: ${clean.error}`);
7520
+ return null;
7521
+ }
7522
+ return {
7523
+ svg: clean.svg,
7524
+ mask: svg_mask_url(clean.svg)
7525
+ };
7526
+ }
7527
+ /************************************************************
7528
+ * Replace every user icon with the nodes of __icons__.
7529
+ * Return the number of icons registered.
7530
+ ************************************************************/
7531
+ function yui_icons_set_user(nodes) {
7532
+ __user_icons__.clear();
7533
+ if (Array.isArray(nodes)) for (const node of nodes) {
7534
+ let entry = user_icon_entry(node);
7535
+ if (entry) __user_icons__.set(node.id, entry);
7536
+ }
7537
+ else if (nodes) log_error(`user icons: the nodes of ${ICONS_TOPIC} must be a list`);
7538
+ rebuild_user_icons_stylesheet();
7539
+ return __user_icons__.size;
7540
+ }
7541
+ /************************************************************
7542
+ * A node of __icons__ was created or updated.
7543
+ * Return true if the icon is drawn.
7544
+ ************************************************************/
7545
+ function yui_icons_put_user(node) {
7546
+ let entry = user_icon_entry(node);
7547
+ if (entry) __user_icons__.set(node.id, entry);
7548
+ else if (node && typeof node.id === "string") __user_icons__.delete(node.id);
7549
+ rebuild_user_icons_stylesheet();
7550
+ return !!entry;
7551
+ }
7552
+ /************************************************************
7553
+ * A node of __icons__ was deleted.
7554
+ ************************************************************/
7555
+ function yui_icons_remove_user(id) {
7556
+ __user_icons__.delete(id);
7557
+ rebuild_user_icons_stylesheet();
7558
+ }
7559
+ /************************************************************
7560
+ * Every icon a user can choose: the library's, read from the
7561
+ * loaded stylesheets (an app may extend yui_icons.css, so it
7562
+ * is asked, not listed), then the user's.
7563
+ * Return [{name, user}], each half sorted by name.
7564
+ ************************************************************/
7565
+ function yui_icons_list() {
7566
+ let library = /* @__PURE__ */ new Set();
7567
+ try {
7568
+ for (const sheet of Array.from(document.styleSheets || [])) {
7569
+ if (sheet.ownerNode && sheet.ownerNode.id === USER_ICONS_STYLE_ID) continue;
7570
+ let rules;
7571
+ try {
7572
+ rules = sheet.cssRules;
7573
+ } catch (e) {
7574
+ continue;
7575
+ }
7576
+ for (const rule of Array.from(rules || [])) {
7577
+ let selector = rule.selectorText || "";
7578
+ for (const m of selector.matchAll(/\.(yi-[a-z0-9-]+)::?before/g)) if (!m[1].startsWith("yi-u-")) library.add(m[1]);
7579
+ }
7580
+ }
7581
+ } catch (e) {
7582
+ log_error(`user icons: cannot read the stylesheets: ${e}`);
7583
+ }
7584
+ let list = Array.from(library).sort().map((name) => ({
7585
+ name,
7586
+ user: false
7587
+ }));
7588
+ let users = Array.from(__user_icons__.keys()).sort();
7589
+ for (const id of users) list.push({
7590
+ name: yui_user_icon_class(id),
7591
+ user: true
7592
+ });
7593
+ return list;
7594
+ }
7088
7595
  /************************************************************
7089
7596
  * JSON type discriminator (viewer vocabulary)
7090
7597
  ************************************************************/
@@ -7908,6 +8415,7 @@ function build_form(gobj) {
7908
8415
  function build_html_form(gobj, $form, prefix, template) {
7909
8416
  Object.entries(template).forEach(([key, value]) => {
7910
8417
  const field_desc = template_get_field_desc(key, value);
8418
+ if (!prefix && yui_icons_is_svg_field(gobj_read_str_attr(gobj, "topic_name"), field_desc.name)) field_desc.type = "svg";
7911
8419
  let html_field_conf = build_form_field_conf(gobj, field_desc);
7912
8420
  html_field_conf.name = field_desc.name;
7913
8421
  let topic_name = gobj_read_str_attr(gobj, "topic_name");
@@ -8005,8 +8513,17 @@ function build_form_field_conf(gobj, field_desc) {
8005
8513
  case "file":
8006
8514
  field_conf.tag = "file";
8007
8515
  break;
8008
- case "image":
8009
8516
  case "icon":
8517
+ field_conf.tag = "select2";
8518
+ field_conf.options = yui_icons_list().map((icon) => icon.name);
8519
+ break;
8520
+ case "svg":
8521
+ field_conf.tag = "textarea";
8522
+ field_conf.extras.rows = 6;
8523
+ field_conf.extras.spellcheck = "false";
8524
+ field_conf.extras.class = "textarea is-family-monospace";
8525
+ break;
8526
+ case "image":
8010
8527
  case "string":
8011
8528
  field_conf.tag = "input";
8012
8529
  field_conf.inputType = "text";
@@ -8531,6 +9048,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8531
9048
  else if (required) attrs.required = "";
8532
9049
  $extend = createElement2(["textarea", attrs]);
8533
9050
  $control.appendChild($extend);
9051
+ if (field_desc.type === "svg") attach_svg_preview(gobj, $control, $extend);
8534
9052
  break;
8535
9053
  }
8536
9054
  case "select": {
@@ -8569,6 +9087,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8569
9087
  log_error(sprintf("%s: select2 field '%s' options not an array (type=%s, real_type=%s); rendering empty", gobj_short_name(gobj), name, field_desc.type, field_desc.real_type));
8570
9088
  opts = [];
8571
9089
  }
9090
+ let is_icon = field_desc.type === "icon";
8572
9091
  let extend = [
8573
9092
  "select",
8574
9093
  {
@@ -8576,7 +9095,11 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8576
9095
  class: "",
8577
9096
  multiple: true
8578
9097
  },
8579
- opts.map((option) => [
9098
+ opts.map((option) => is_icon ? [
9099
+ "option",
9100
+ { value: option },
9101
+ option
9102
+ ] : [
8580
9103
  "option",
8581
9104
  {
8582
9105
  value: option,
@@ -8590,7 +9113,8 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8590
9113
  $extend.tom_select = new TomSelect($extend, {
8591
9114
  allowEmptyOption: true,
8592
9115
  placeholder,
8593
- maxItems: field_desc.type === "fkey" && field_desc.real_type === "string" ? 1 : null,
9116
+ maxItems: is_icon || field_desc.type === "fkey" && field_desc.real_type === "string" ? 1 : null,
9117
+ render: is_icon ? icon_select_render() : void 0,
8594
9118
  plugins: {
8595
9119
  "clear_button": { "title": t("remove all selected options") },
8596
9120
  "no_active_items": {},
@@ -8758,6 +9282,71 @@ function attach_color_value($control, $input) {
8758
9282
  $control.appendChild($value);
8759
9283
  }
8760
9284
  /******************************************************************
9285
+ * How the icon picker draws a name: the icon, then the name.
9286
+ * The names come from yui_icons_list() -- class names, already
9287
+ * [a-z0-9-] -- and are escaped anyway, because they are written
9288
+ * as markup.
9289
+ ******************************************************************/
9290
+ function icon_select_render() {
9291
+ function draw(data, escape) {
9292
+ 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>`;
9293
+ }
9294
+ return {
9295
+ option: draw,
9296
+ item: draw
9297
+ };
9298
+ }
9299
+ /******************************************************************
9300
+ * Why a drawing cannot be an icon, in the reader's language.
9301
+ * The causes are the fixed set yui_svg_sanitize() answers, each
9302
+ * written here as a literal t() so validate-locales sees it.
9303
+ ******************************************************************/
9304
+ function svg_error_text(error) {
9305
+ switch (error) {
9306
+ case "empty svg": return t("empty svg");
9307
+ case "svg too big": return t("svg too big");
9308
+ case "not an svg document": return t("not an svg document");
9309
+ case "svg without size": return t("svg without size");
9310
+ case "svg without shapes": return t("svg without shapes");
9311
+ default:
9312
+ log_error(`svg_error_text(): unknown cause '${error}'`);
9313
+ return error;
9314
+ }
9315
+ }
9316
+ /******************************************************************
9317
+ * The icon a drawing (`svg` of __icons__) makes, below its text
9318
+ * area, redrawn as it is typed: what is saved is what the app
9319
+ * will show. A drawing that cannot be drawn says why, and what
9320
+ * the sanitizer left out is named.
9321
+ ******************************************************************/
9322
+ function attach_svg_preview(gobj, $control, $textarea) {
9323
+ let $preview = createElement2([
9324
+ "div",
9325
+ { class: "SVG_PREVIEW is-flex is-align-items-center mt-2" },
9326
+ [["span", { class: "SVG_PREVIEW_ICON icon is-large is-size-3" }], ["span", { class: "SVG_PREVIEW_NOTE is-size-7 yui-text-quiet ml-2" }]]
9327
+ ]);
9328
+ $control.appendChild($preview);
9329
+ let $icon = $preview.querySelector(".SVG_PREVIEW_ICON");
9330
+ let $note = $preview.querySelector(".SVG_PREVIEW_NOTE");
9331
+ function redraw() {
9332
+ $icon.replaceChildren();
9333
+ $note.textContent = "";
9334
+ if (!$textarea.value || !$textarea.value.trim()) return;
9335
+ let preview = yui_svg_icon_element($textarea.value);
9336
+ if (preview.error) {
9337
+ $note.textContent = svg_error_text(preview.error);
9338
+ return;
9339
+ }
9340
+ $icon.appendChild(preview.element);
9341
+ if (preview.dropped && preview.dropped.length > 0) $note.textContent = `${t("left out")}: ${preview.dropped.join(" ")}`;
9342
+ }
9343
+ $textarea.yui_svg_preview = redraw;
9344
+ $textarea.addEventListener("input", function() {
9345
+ redraw();
9346
+ gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
9347
+ });
9348
+ }
9349
+ /******************************************************************
8761
9350
  * `readonly` is an attribute of a TEXT control and of nothing else.
8762
9351
  *
8763
9352
  * A `<select>` ignores it. So does a checkbox, and so does a radio:
@@ -9272,7 +9861,10 @@ function clear_data(gobj, $form) {
9272
9861
  else if ($input.type === "radio") $input.checked = false;
9273
9862
  else if ($input.type === "datetime-local") $input.value = null;
9274
9863
  else if ($input.type === "select-multiple") $input.tom_select.clear();
9275
- else $input.value = null;
9864
+ else {
9865
+ $input.value = null;
9866
+ if ($input.yui_svg_preview) $input.yui_svg_preview();
9867
+ }
9276
9868
  }
9277
9869
  });
9278
9870
  $form.querySelectorAll(".FILE_FIELD").forEach(($file) => {
@@ -9373,12 +9965,17 @@ function set_form_values(gobj, template, $form, record) {
9373
9965
  break;
9374
9966
  case "textarea":
9375
9967
  $input.value = value;
9968
+ if ($input.yui_svg_preview) $input.yui_svg_preview();
9376
9969
  break;
9377
9970
  case "select":
9378
9971
  $input.value = value;
9379
9972
  break;
9380
9973
  case "select2":
9381
9974
  $input.tom_select.clear();
9975
+ if (field_desc && field_desc.type === "icon" && is_string(value) && value && !$input.tom_select.options[value]) $input.tom_select.addOption({
9976
+ value,
9977
+ text: value
9978
+ });
9382
9979
  $input.tom_select.setValue(value);
9383
9980
  break;
9384
9981
  case "checkbox":
@@ -9475,6 +10072,7 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
9475
10072
  case "color":
9476
10073
  case "image":
9477
10074
  case "icon":
10075
+ case "svg":
9478
10076
  case "tel":
9479
10077
  case "template":
9480
10078
  case "table":
@@ -9565,11 +10163,14 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
9565
10163
  default: log_error("incompatible type for time: " + real_type);
9566
10164
  }
9567
10165
  break;
10166
+ case "icon":
10167
+ if (Array.isArray(value)) value = value.length > 0 ? value[0] : "";
10168
+ break;
9568
10169
  case "date":
9569
10170
  case "color":
9570
10171
  case "image":
9571
- case "icon":
9572
- case "tel": break;
10172
+ case "tel":
10173
+ case "svg": break;
9573
10174
  case "template":
9574
10175
  if (is_string(value)) try {
9575
10176
  value = JSON.parse(value);
@@ -24812,6 +25413,43 @@ function request_treedb_descs$1(gobj) {
24812
25413
  if (ret) log_error(ret);
24813
25414
  }
24814
25415
  /************************************************************
25416
+ * A user view shows the topics of the user and, of the system
25417
+ * topics, only __icons__: its nodes are what the user ADDS to
25418
+ * the app (the icons a column `icon` can name), so editing them
25419
+ * is the user's business. The other `__` topics are the
25420
+ * treedb's own bookkeeping.
25421
+ ************************************************************/
25422
+ function topic_is_shown(topic_name) {
25423
+ return topic_name.substring(0, 2) !== "__" || topic_name === "__icons__";
25424
+ }
25425
+ /************************************************************
25426
+ * The nodes of __icons__ are the user icons of the app: each
25427
+ * load and each write of them goes to the icon registry
25428
+ * (lib_icons.js), and the shell tells the views that decided
25429
+ * at render time whether a name was an icon.
25430
+ *
25431
+ * how: "load" (nodes = the whole topic), "put" (one node
25432
+ * created or updated) or "remove" (one node deleted).
25433
+ ************************************************************/
25434
+ function feed_user_icons(gobj, how, nodes) {
25435
+ switch (how) {
25436
+ case "load":
25437
+ yui_icons_set_user(nodes);
25438
+ break;
25439
+ case "put":
25440
+ for (const node of nodes) yui_icons_put_user(node);
25441
+ break;
25442
+ case "remove":
25443
+ for (const node of nodes) if (node && typeof node.id === "string") yui_icons_remove_user(node.id);
25444
+ break;
25445
+ default:
25446
+ log_error(`${gobj_short_name(gobj)}: feed_user_icons(): unknown '${how}'`);
25447
+ return;
25448
+ }
25449
+ let shell = yui_shell_of(gobj);
25450
+ if (shell) yui_shell_icons_changed(shell);
25451
+ }
25452
+ /************************************************************
24815
25453
  * Response of remote command
24816
25454
  ************************************************************/
24817
25455
  function process_treedb_descs$1(gobj) {
@@ -24821,7 +25459,7 @@ function process_treedb_descs$1(gobj) {
24821
25459
  let treedb_name = gobj_read_str_attr(gobj, "treedb_name");
24822
25460
  let readonly = gobj_read_bool_attr(gobj, "readonly");
24823
25461
  for (const [key, desc] of Object.entries(descs)) {
24824
- if (system) {} else if (key.substring(0, 2) === "__") continue;
25462
+ if (!system && !topic_is_shown(key)) continue;
24825
25463
  let kw_topic_form = {
24826
25464
  subscriber: gobj,
24827
25465
  readonly,
@@ -24830,7 +25468,7 @@ function process_treedb_descs$1(gobj) {
24830
25468
  treedb_name,
24831
25469
  topic_name: key,
24832
25470
  desc,
24833
- with_remote_paging: gobj_read_bool_attr(gobj, "with_remote_paging"),
25471
+ with_remote_paging: key !== "__icons__" && gobj_read_bool_attr(gobj, "with_remote_paging"),
24834
25472
  page_size: gobj_read_integer_attr(gobj, "page_size"),
24835
25473
  with_selection_bar: gobj_read_bool_attr(gobj, "with_selection_bar"),
24836
25474
  form_waits_for_answer: true
@@ -24882,7 +25520,7 @@ function register_sub_routes$1(gobj) {
24882
25520
  gclass: "C_YUI_TREEDB_SCHEMA"
24883
25521
  });
24884
25522
  if (is_object(descs)) for (let topic of Object.keys(descs)) {
24885
- if (!system && topic.substring(0, 2) === "__") continue;
25523
+ if (!system && !topic_is_shown(topic)) continue;
24886
25524
  nodes.push({
24887
25525
  route: base + "/" + topic,
24888
25526
  label: topic,
@@ -25483,6 +26121,7 @@ function ac_mt_command_answer$2(gobj, event, kw, src) {
25483
26121
  }, gobj);
25484
26122
  } else {
25485
26123
  forget_topic_rereads(gobj, topic_name);
26124
+ if (topic_name === "__icons__") feed_user_icons(gobj, "load", answer.rows);
25486
26125
  gobj_send_event(gobj_topic_form, "EV_LOAD_NODES", answer.rows, gobj);
25487
26126
  }
25488
26127
  }
@@ -25731,6 +26370,7 @@ function ac_treedb_node_created$1(gobj, event, kw, src) {
25731
26370
  let topic_name = kw_get_str(gobj, kw, "topic_name", "", 0);
25732
26371
  let node = kw_get_dict_value(gobj, kw, "node", null, 0);
25733
26372
  if (treedb_name === gobj_read_str_attr(gobj, "treedb_name")) {
26373
+ if (topic_name === "__icons__") feed_user_icons(gobj, "put", [node]);
25734
26374
  let gobj_formtable = get_gobj_formtable(gobj, topic_name);
25735
26375
  gobj_send_event(gobj_formtable, "EV_LOAD_NODE_CREATED", [node], gobj);
25736
26376
  }
@@ -25744,6 +26384,7 @@ function ac_treedb_node_updated$1(gobj, event, kw, src) {
25744
26384
  let topic_name = kw_get_str(gobj, kw, "topic_name", "", 0);
25745
26385
  let node = kw_get_dict_value(gobj, kw, "node", null, 0);
25746
26386
  if (treedb_name === gobj_read_str_attr(gobj, "treedb_name")) {
26387
+ if (topic_name === "__icons__") feed_user_icons(gobj, "put", [node]);
25747
26388
  let gobj_formtable = get_gobj_formtable(gobj, topic_name);
25748
26389
  gobj_send_event(gobj_formtable, "EV_LOAD_NODE_UPDATED", [node], gobj);
25749
26390
  }
@@ -25778,6 +26419,7 @@ function ac_treedb_node_deleted$1(gobj, event, kw, src) {
25778
26419
  let topic_name = kw_get_str(gobj, kw, "topic_name", "", 0);
25779
26420
  let node = kw_get_dict_value(gobj, kw, "node", null, 0);
25780
26421
  if (treedb_name === gobj_read_str_attr(gobj, "treedb_name")) {
26422
+ if (topic_name === "__icons__") feed_user_icons(gobj, "remove", [node]);
25781
26423
  let gobj_formtable = get_gobj_formtable(gobj, topic_name);
25782
26424
  gobj_send_event(gobj_formtable, "EV_NODE_DELETED", [node], gobj);
25783
26425
  }
@@ -26649,182 +27291,6 @@ function yui_table_filter_clear(table) {
26649
27291
  });
26650
27292
  }
26651
27293
  //#endregion
26652
- //#region src/lib_icons.js
26653
- /*********************************************************
26654
- * lib_icons.js
26655
- *
26656
- * Two icon systems are managed here:
26657
- *
26658
- * 1. FA-style CSS icons (yui_icons.css)
26659
- * Usage: <i class="yi-save"></i>
26660
- * Color: inherits currentColor from parent via CSS mask.
26661
- *
26662
- * 2. SVG symbol icons for G6 toolbar (and any other component
26663
- * that uses <use xlink:href="#id">).
26664
- * Symbols are injected once into the DOM.
26665
- * All symbol ids are prefixed with "g6-icon-" to avoid
26666
- * conflicts with other DOM elements.
26667
- * Icon paths come from:
26668
- * fontawesome-free-7.1.0-web/sprites/solid.svg
26669
- *
26670
- * G6 toolbar items are managed via CSS class names (className
26671
- * field in getItems()) using YuiToolbar in c_g6_nodes_tree.js.
26672
- * This lets lib_graph.js state functions (set_submit_state,
26673
- * disableElements, …) work on toolbar icons exactly like on
26674
- * regular Bulma/FA buttons — no icon-specific helpers needed.
26675
- *
26676
- * Copyright (c) 2025-2026, ArtGins.
26677
- * All Rights Reserved.
26678
- *********************************************************/
26679
- var CUSTOM_SVG_ICONS_ID = "g6-custom-svgicons";
26680
- var ICONS = `<svg xmlns="http://www.w3.org/2000/svg">
26681
- <!-- magnifying-glass-plus -->
26682
- <symbol id="g6-icon-zoom-in" viewBox="0 0 512 512">
26683
- <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"/>
26684
- </symbol>
26685
- <!-- magnifying-glass-minus -->
26686
- <symbol id="g6-icon-zoom-out" viewBox="0 0 512 512">
26687
- <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"/>
26688
- </symbol>
26689
- <!-- house (reset zoom: back to original 100% view) -->
26690
- <symbol id="g6-icon-home" viewBox="0 0 512 512">
26691
- <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"/>
26692
- </symbol>
26693
- <!-- expand (zoom to fit) -->
26694
- <symbol id="g6-icon-fit" viewBox="0 0 448 512">
26695
- <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"/>
26696
- </symbol>
26697
- <!-- fit to selection: the same corner brackets as the fit icon,
26698
- around a marked object. The two sit side by side in the
26699
- toolbar and have to read as a family, which a borrowed glyph
26700
- would not. (No backticks in here: the sprite lives inside a
26701
- template literal.) -->
26702
- <symbol id="g6-icon-fit-selection" viewBox="0 0 448 512">
26703
- <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"/>
26704
- <rect fill="currentColor" x="144" y="176" width="160" height="160" rx="24"/>
26705
- </symbol>
26706
- <!-- crosshairs (center) -->
26707
- <symbol id="g6-icon-center" viewBox="0 0 576 512">
26708
- <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"/>
26709
- </symbol>
26710
- <!-- up-right-and-down-left-from-center (enter fullscreen) -->
26711
- <symbol id="g6-icon-fullscreen" viewBox="0 0 512 512">
26712
- <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"/>
26713
- </symbol>
26714
- <!-- down-left-and-up-right-to-center (exit fullscreen) -->
26715
- <symbol id="g6-icon-fullscreen-exit" viewBox="0 0 512 512">
26716
- <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"/>
26717
- </symbol>
26718
- <!-- arrow-rotate-left (undo) -->
26719
- <symbol id="g6-icon-undo" viewBox="0 0 512 512">
26720
- <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"/>
26721
- </symbol>
26722
- <!-- arrow-rotate-right (redo) -->
26723
- <symbol id="g6-icon-redo" viewBox="0 0 512 512">
26724
- <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"/>
26725
- </symbol>
26726
- <!-- pen (edit node) -->
26727
- <symbol id="g6-icon-edit" viewBox="0 0 512 512">
26728
- <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"/>
26729
- </symbol>
26730
- <!-- trash-can (delete) -->
26731
- <symbol id="g6-icon-delete" viewBox="0 0 448 512">
26732
- <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"/>
26733
- </symbol>
26734
- <!-- link (link nodes) -->
26735
- <symbol id="g6-icon-link" viewBox="0 0 576 512">
26736
- <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"/>
26737
- </symbol>
26738
- <!-- link-slash (unlink) -->
26739
- <symbol id="g6-icon-unlink" viewBox="0 0 576 512">
26740
- <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"/>
26741
- </symbol>
26742
- <!-- play (run node) -->
26743
- <symbol id="g6-icon-run" viewBox="0 0 448 512">
26744
- <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"/>
26745
- </symbol>
26746
- <!-- clone (copy size to other nodes/ports) -->
26747
- <symbol id="g6-icon-resize" viewBox="0 0 512 512">
26748
- <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"/>
26749
- </symbol>
26750
- <!-- plus (create node). Deliberately NOT the FA7 solid plus:
26751
- its arms are ~14% of the width and read thin next to the
26752
- other solid glyphs. Bold geometric plus (~23% arm
26753
- thickness) with long arms (32..480) so it reads as a "+",
26754
- not a stubby Red-Cross square. -->
26755
- <symbol id="g6-icon-plus" viewBox="0 0 512 512">
26756
- <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"/>
26757
- </symbol>
26758
- <!-- ellipsis-vertical (unfold the floating toolbar).
26759
- The strip it stands for is a vertical stack, and a vertical
26760
- ellipsis is what "there is more of this here" is drawn as
26761
- everywhere else. -->
26762
- <symbol id="g6-icon-toolbar-show" viewBox="0 0 128 512">
26763
- <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"/>
26764
- </symbol>
26765
- <!-- xmark (fold the floating toolbar away).
26766
- Not a chevron: the two toolbars sit on OPPOSITE edges, so a
26767
- direction would point the wrong way on one of them. What the
26768
- button does is close an overlay, and that is an x. -->
26769
- <symbol id="g6-icon-toolbar-hide" viewBox="0 0 384 512">
26770
- <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"/>
26771
- </symbol>
26772
- <!-- dashed marquee (selection mode).
26773
- The band ITSELF, because that is what the button turns on: a
26774
- drag on the canvas draws one and a tap picks a card. Not the
26775
- fit-to-selection glyph next to it in the other toolbar -- that
26776
- one is solid brackets around a solid object and means "put the
26777
- camera on what is picked", which is the opposite end of the
26778
- gesture. Dashes: 16 segments of 59 with gaps of 36 over a
26779
- perimeter of 1520, so they land on the corners. -->
26780
- <symbol id="g6-icon-select-mode" viewBox="0 0 512 512">
26781
- <rect x="46" y="86" width="420" height="340" fill="none"
26782
- stroke="currentColor" stroke-width="40"
26783
- stroke-dasharray="59 36"/>
26784
- </symbol>
26785
- <!-- location-crosshairs (anchor the camera on one element).
26786
- The SAME path as the DOM toolbars and their yi-location-crosshairs
26787
- mask: the two toolbars sit in one console, and a control that
26788
- does one thing has to be drawn one way. -->
26789
- <symbol id="g6-icon-anchor" viewBox="0 0 576 512">
26790
- <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"/>
26791
- </symbol>
26792
- <!-- floppy-disk (save) -->
26793
- <symbol id="g6-icon-save" viewBox="0 0 448 512">
26794
- <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"/>
26795
- </symbol>
26796
- </svg>`;
26797
- function inject_svg_icons() {
26798
- if (document.getElementById(CUSTOM_SVG_ICONS_ID)) return;
26799
- const div = document.createElement("div");
26800
- div.id = CUSTOM_SVG_ICONS_ID;
26801
- div.style.display = "none";
26802
- div.innerHTML = ICONS;
26803
- document.body.appendChild(div);
26804
- }
26805
- var __icon_defined__ = {};
26806
- function yui_icon_is_defined(name) {
26807
- if (!name || typeof name !== "string") return false;
26808
- if (__icon_defined__[name] !== void 0) return __icon_defined__[name];
26809
- let defined = false;
26810
- try {
26811
- const el = document.createElement("i");
26812
- el.className = name;
26813
- el.style.position = "absolute";
26814
- el.style.visibility = "hidden";
26815
- el.style.pointerEvents = "none";
26816
- document.body.appendChild(el);
26817
- const st = window.getComputedStyle(el, "::before");
26818
- const mask = st.maskImage || st.webkitMaskImage || "";
26819
- defined = !!mask && mask !== "none";
26820
- document.body.removeChild(el);
26821
- } catch (e) {
26822
- defined = false;
26823
- }
26824
- __icon_defined__[name] = defined;
26825
- return defined;
26826
- }
26827
- //#endregion
26828
27294
  //#region src/yui_row_search.js
26829
27295
  /***********************************************************************
26830
27296
  * yui_row_search.js
@@ -27440,7 +27906,10 @@ function mt_create$5(gobj) {
27440
27906
  ***************************************************************/
27441
27907
  function mt_start$5(gobj) {
27442
27908
  let shell = yui_shell_of(gobj);
27443
- if (shell) gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
27909
+ if (shell) {
27910
+ gobj_subscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
27911
+ gobj_subscribe_event(shell, "EV_ICONS_CHANGED", {}, gobj);
27912
+ }
27444
27913
  create_tabulator(gobj);
27445
27914
  }
27446
27915
  /***************************************************************
@@ -27448,7 +27917,10 @@ function mt_start$5(gobj) {
27448
27917
  ***************************************************************/
27449
27918
  function mt_stop$5(gobj) {
27450
27919
  let shell = yui_shell_of(gobj);
27451
- if (shell) gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
27920
+ if (shell) {
27921
+ gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
27922
+ gobj_unsubscribe_event(shell, "EV_ICONS_CHANGED", {}, gobj);
27923
+ }
27452
27924
  close_form_dialog(gobj);
27453
27925
  close_schema_dialog(gobj);
27454
27926
  close_cell_json_dialog(gobj);
@@ -28165,7 +28637,13 @@ function create_tabulator(gobj) {
28165
28637
  let formatterParams;
28166
28638
  const field_desc = treedb_get_field_desc(col);
28167
28639
  if (field_desc.is_hidden) continue;
28640
+ if (yui_icons_is_svg_field(gobj_read_str_attr(gobj, "topic_name"), col.id)) field_desc.type = "svg";
28168
28641
  switch (field_desc.type) {
28642
+ case "svg":
28643
+ hozAlign = "center";
28644
+ vertAlign = "middle";
28645
+ colFormatter = svg_cell_formatter;
28646
+ break;
28169
28647
  case "hook":
28170
28648
  hozAlign = "center";
28171
28649
  cellClick = function(e, cell) {
@@ -28554,6 +29032,30 @@ function icon_formatter(cell) {
28554
29032
  }]);
28555
29033
  }
28556
29034
  /************************************************************
29035
+ * Cell of the drawing of a user icon (`svg` of __icons__): the
29036
+ * icon itself, as the app will draw it. A drawing that cannot
29037
+ * be drawn says why, in plain grey -- the same honest half as
29038
+ * an unknown icon name in icon_formatter.
29039
+ ************************************************************/
29040
+ function svg_cell_formatter(cell) {
29041
+ let svg = cell.getValue();
29042
+ if (!is_string(svg) || empty_string(svg)) return "";
29043
+ let preview = yui_svg_icon_element(svg);
29044
+ if (preview.error) {
29045
+ let text = svg_error_text(preview.error);
29046
+ return createElement2([
29047
+ "span",
29048
+ {
29049
+ class: "ICON_CELL_UNKNOWN is-size-7 yui-text-quiet",
29050
+ title: text
29051
+ },
29052
+ text
29053
+ ]);
29054
+ }
29055
+ preview.element.classList.add("ICON_CELL");
29056
+ return preview.element;
29057
+ }
29058
+ /************************************************************
28557
29059
  * Cell of a col holding a JSON document (dict/list/blob/
28558
29060
  * template/coordinates/…): a one-line truncated preview,
28559
29061
  * marked as a link because the click opens the whole value
@@ -29781,6 +30283,24 @@ function ac_language_changed$4(gobj, event, kw, src) {
29781
30283
  }
29782
30284
  return 0;
29783
30285
  }
30286
+ /************************************************************
30287
+ * The user icons changed (published by the shell): the cells
30288
+ * of an `icon` column decided when they were drawn whether
30289
+ * their name was an icon, so they are drawn again.
30290
+ ************************************************************/
30291
+ function ac_icons_changed(gobj, event, kw, src) {
30292
+ let tabulator = gobj_read_attr(gobj, "tabulator");
30293
+ if (!tabulator) return 0;
30294
+ let desc = gobj_read_attr(gobj, "desc");
30295
+ if ((desc && Array.isArray(desc.cols) ? desc.cols : []).filter((col) => col && col.id && treedb_get_field_desc(col).type === "icon").length === 0) return 0;
30296
+ try {
30297
+ for (const row of tabulator.getRows()) row.reformat();
30298
+ } catch (e) {
30299
+ log_error(`${gobj_short_name(gobj)}: cannot redraw the icon cells: ${e}`);
30300
+ return -1;
30301
+ }
30302
+ return 0;
30303
+ }
29784
30304
  function ac_load_nodes(gobj, event, kw, src) {
29785
30305
  let data = kw;
29786
30306
  if (!is_array(data)) {
@@ -30901,6 +31421,11 @@ function create_gclass$5(gclass_name) {
30901
31421
  ac_language_changed$4,
30902
31422
  null
30903
31423
  ],
31424
+ [
31425
+ "EV_ICONS_CHANGED",
31426
+ ac_icons_changed,
31427
+ null
31428
+ ],
30904
31429
  [
30905
31430
  "EV_LOAD_NODES",
30906
31431
  ac_load_nodes,
@@ -31139,6 +31664,7 @@ function create_gclass$5(gclass_name) {
31139
31664
  ]]];
31140
31665
  const event_types = [
31141
31666
  ["EV_LANGUAGE_CHANGED", 0],
31667
+ ["EV_ICONS_CHANGED", 0],
31142
31668
  ["EV_LOAD_NODES", 0],
31143
31669
  ["EV_LOAD_NODE_CREATED", 0],
31144
31670
  ["EV_LOAD_NODE_UPDATED", 0],
@@ -76289,8 +76815,29 @@ function ac_select_topic(gobj, event, kw, src) {
76289
76815
  go(gobj, gobj.priv.treedb_id, kw.topic, false, true);
76290
76816
  return reload_after_move(gobj);
76291
76817
  }
76818
+ /***************************************************************
76819
+ * «←»: where browser Back goes, the route before this one.
76820
+ *
76821
+ * It went UP a level (columns -> topics -> treedbs) whatever came
76822
+ * before, and Back undoes the last move: after two topics opened from
76823
+ * the diagram, Back returned to the first one and the arrow to the
76824
+ * treedb (2026-10-10). The rule is that both land on the same place.
76825
+ *
76826
+ * The exception to "this view navigates nothing itself" is this one
76827
+ * control, like the topics view's arrow: it asks the shell, which is
76828
+ * what remembers. Only with a route of its own: mounted without one
76829
+ * (in a window), the route before is the APP's, behind the editor, and
76830
+ * the arrow keeps going up a level. Up a level too when the page has
76831
+ * not moved.
76832
+ ***************************************************************/
76292
76833
  function ac_back(gobj, event, kw, src) {
76293
76834
  let priv = gobj.priv;
76835
+ let shell = gobj_read_attr(gobj, "base_route") ? yui_shell_of(gobj) : null;
76836
+ let came_from = shell ? yui_shell_previous_route(shell) : "";
76837
+ if (came_from) {
76838
+ yui_shell_navigate(shell, came_from, { push: true });
76839
+ return 0;
76840
+ }
76294
76841
  if (priv.diagram || priv.topic_name) go(gobj, priv.treedb_id, "", false, true);
76295
76842
  else go(gobj, "", "", false, true);
76296
76843
  return reload_after_move(gobj);
@@ -80664,6 +81211,6 @@ function setup_json_pad(self) {
80664
81211
  return win;
80665
81212
  }
80666
81213
  //#endregion
80667
- export { EditControl, MarkerControl, YUI_FILE_ACCEPT, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_fsm_graph, register_c_yui_gclass, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_json_pad, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_schema_editor, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_pressed_state, set_submit_state, setup_dev, setup_frontend_view, setup_json_pad, toggleClasses, yui_array_buffer_to_base64, yui_asset_element, yui_asset_id, yui_asset_ids, yui_asset_missing, yui_asset_src, yui_file_control, yui_file_id_label, yui_file_read, yui_file_sha256, yui_file_size_label, yui_files_manifest, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_theme_now, yui_toolbar, yui_watch_theme };
81214
+ export { EditControl, ICONS_TOPIC, MarkerControl, USER_ICON_PREFIX, YUI_FILE_ACCEPT, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_fsm_graph, register_c_yui_gclass, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_json_pad, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_schema_editor, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_pressed_state, set_submit_state, setup_dev, setup_frontend_view, setup_json_pad, toggleClasses, yui_array_buffer_to_base64, yui_asset_element, yui_asset_id, yui_asset_ids, yui_asset_missing, yui_asset_src, yui_file_control, yui_file_id_label, yui_file_read, yui_file_sha256, yui_file_size_label, yui_files_manifest, yui_icon_is_defined, yui_icons_list, yui_icons_put_user, yui_icons_remove_user, yui_icons_set_user, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_svg_icon_element, yui_svg_sanitize, yui_theme_now, yui_toolbar, yui_user_icon_class, yui_watch_theme };
80668
81215
 
80669
81216
  //# sourceMappingURL=gobj-ui.es.js.map