@yuneta/gobj-ui 7.26.5 → 7.26.7

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 CHANGED
@@ -13,6 +13,17 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
13
13
  > routing contract (URL = source of truth, push/replace history, the
14
14
  > position/preference/transient litmus).
15
15
  >
16
+ > **Peer floors today** (`package.json`): `@yuneta/gobj-js` `^7.22.2`,
17
+ > `@antv/g6` `^5.1.0`, `bulma` `^1.0.4`, `i18next` `^26.3.6`, `maplibre-gl`
18
+ > `^6.11.2`, `tabulator-tables` `^6.5.3`, `tom-select` `^2.6.2`, `uplot`
19
+ > `^1.6.32`, `vanilla-jsoneditor` `^3.13.0`. The notices below say when and why
20
+ > each floor moved; the list above is what a consumer must meet now.
21
+ >
22
+ > **BREAKING (7.23.172):** the peer floor of `@yuneta/gobj-js` rose to
23
+ > `^7.22.0`. The Developer window turns the runtime's trace bits on and off and
24
+ > never reads a message to decide what to show; it needs the trace API of that
25
+ > gobj-js. See the CHANGELOG entry.
26
+ >
16
27
  > **BREAKING (7.0.0):** a **dependency-only major** — no component API moved.
17
28
  > The `maplibre-gl` peer floor rises to `^6.4.1`, which is where `DOM.sanitize`
18
29
  > stops leaving dangerous attributes behind when several sit next to each other.
@@ -68,28 +79,24 @@ Published as `@yuneta/gobj-ui`. Built on top of [`@yuneta/gobj-js`](https://gith
68
79
  This repository carries **two parallel lines** with different layouts and
69
80
  consumers. They are independent snapshots (no shared git ancestry):
70
81
 
71
- | Line | Branch | Tag | Layout | Consumed by | How | Status |
72
- |------|--------|-----|--------|-------------|-----|--------|
73
- | **v2** | `main` | `2.0.0`+ | `src/` subdir | **gui_agent**, **gui_treedb** | local `file:` dep on the yunetas submodule | active development |
74
- | **v2** | `main` | `2.0.0`+ | `src/` subdir | **wattyzer** | published npm `@yuneta/gobj-ui@^5.0.0` (dist-tag `latest`) | active development |
75
- | **v1** | `v1` | `1.0.1` | `src/` subdir | **estadodelaire**, **hidraulia** | published npm `@yuneta/gobj-ui@^1.0.1` (dist-tag `legacy`) | frozen, maintenance-only |
82
+ | Line | Branch | Latest tag | Layout | Consumed by | How | Status |
83
+ |------|--------|------------|--------|-------------|-----|--------|
84
+ | **v2** | `main` | `7.26.x` | `src/` subdir | **gui_agent**, **gui_treedb**, **wattyzer**, the **yunovatios** GUIs | published npm `@yuneta/gobj-ui` (dist-tag `latest`) | active development |
85
+ | **v1** | `v1` | `1.0.4` | `src/` subdir | **estadodelaire**, **hidraulia** | published npm `@yuneta/gobj-ui@^1.0.4` (dist-tag `legacy`) | frozen, maintenance-only |
76
86
 
77
87
  - **v2 / `main`** is the active development line: the declarative shell
78
- (legacy-stack-free since `3.0.0`). It is embedded as a git submodule in **yunetas** at
79
- `kernel/js/gobj-ui`, and the in-repo JS yunos
80
- (**`yunos/js/gui_agent`**, **`yunos/js/gui_treedb`**) consume that checkout as a
81
- `file:` dependency (`@yuneta/gobj-ui` → `../../../kernel/js/gobj-ui`), importing
82
- by package specifier (`@yuneta/gobj-ui/src/*.js`, exports map `"./src/*"`; the
83
- `index.js` barrel and the vite plugin stay at the package root).
84
- **wattyzer takes the same line from the registry** (since 2026-07-25): the
85
- published tarball ships `src/`, `index.js` and the vite plugin, so the import
86
- specifiers are identical — but library work only reaches it after a
87
- `npm publish` and a range bump on its side. Two consequences worth knowing:
88
- a fix cannot be validated in wattyzer before it is released, and wattyzer is
89
- the consumer that proves the **tarball** is complete, not just the checkout.
88
+ (legacy-stack-free since `3.0.0`). It is embedded as a git submodule in
89
+ **yunetas** at `kernel/js/gobj-ui`, and **every app takes it from the npm
90
+ registry** (since 2026-08-03 there is no `file:` consumer left). Apps import
91
+ by package specifier (`@yuneta/gobj-ui/src/*.js`, exports map `"./src/*"`;
92
+ the `index.js` barrel and the vite plugin stay at the package root), and the
93
+ published tarball ships `src/`, `index.js` and the vite plugin. So library
94
+ work reaches an app only after a `npm publish` and a range bump on its side
95
+ (`npm run deploy-round` does the round). `test-app/` is the one exception:
96
+ it consumes the working tree (`file:..`), which is what it is for.
90
97
  - **v1 / `v1`** is the frozen legacy-only stack (the declarative shell is not on
91
98
  this line). It is **published to npm**; estadodelaire and hidraulia depend on
92
- `@yuneta/gobj-ui@^1.0.0` from the registry. Land only maintenance fixes here,
99
+ `@yuneta/gobj-ui@^1.0.4` from the registry. Land only maintenance fixes here,
93
100
  then `npm publish` a new `1.x`.
94
101
 
95
102
  All new feature work lands on `main`/v2.
@@ -97,15 +104,15 @@ All new feature work lands on `main`/v2.
97
104
  ## Usage
98
105
 
99
106
  ```bash
100
- # v2 (active): clone yunetas with submodules; the in-repo yunos pick it up via file:
107
+ # v2 (active): every app installs the published package
108
+ npm install @yuneta/gobj-ui@latest
109
+
110
+ # working on the library itself: clone yunetas with submodules
101
111
  git clone --recurse-submodules <yunetas>
102
112
  git submodule update --init kernel/js/gobj-ui # yunetas tracks main/v2
103
113
 
104
- # v2 from the registry (wattyzer, and any out-of-tree consumer)
105
- npm install @yuneta/gobj-ui@^5.0.0
106
-
107
- # v1 (frozen): consumers just install the published package
108
- npm install @yuneta/gobj-ui@^1.0.0
114
+ # v1 (frozen): consumers install the legacy line
115
+ npm install @yuneta/gobj-ui@legacy
109
116
  ```
110
117
 
111
118
  Edit v2 from the yunetas `kernel/js/gobj-ui` checkout, commit on `main` in this
@@ -2716,6 +2723,73 @@ The user needs the `read` permission of that service. The service is not the
2716
2723
  one the connection was opened for, so a user who is not root must also hold a
2717
2724
  role in it, or the ievent gate refuses to route the command there.
2718
2725
 
2726
+ ### Icons a user adds — `__icons__` and `yui_icons_*`
2727
+
2728
+ The icon set of the library (`yui_icons.css`) is fixed: a CSS mask per glyph,
2729
+ shipped with the package. A user adds icons of their own as DATA. Every treedb
2730
+ has the system topic **`__icons__`** (SDK 7.26.7+): one node per icon, its `id`
2731
+ the name and `svg` the drawing. A column flagged `icon` then names it as
2732
+ **`yi-u-<id>`**:
2733
+
2734
+ ```c
2735
+ /* In the schema of the topic that shows an icon */
2736
+ 'icon': {
2737
+ 'header': 'Icon',
2738
+ 'type': 'string',
2739
+ 'flag': ['icon', 'writable', 'persistent']
2740
+ }
2741
+ ```
2742
+
2743
+ ```json
2744
+ {"id": "transformer", "svg": "<svg viewBox='0 0 24 24'><path d='M4 4h16v16H4z'/></svg>"}
2745
+ ```
2746
+
2747
+ A row of that topic with `"icon": "yi-u-transformer"` shows that drawing.
2748
+
2749
+ - **`yi-u-` is the user's namespace.** No icon of the library uses it, so a
2750
+ user icon can never replace one -- not today, and not when the library adds
2751
+ an icon of the same name. The name is `[a-z0-9]` words joined by `-`.
2752
+ - **The drawing is a MASK**, like the library's: painted with `currentColor`,
2753
+ one colour, the shapes' alpha only. A multicolour svg comes out as a
2754
+ silhouette.
2755
+ - **The svg is rebuilt, never inserted.** `yui_svg_sanitize()` parses it and
2756
+ writes a new one from the shapes alone (`path`, `circle`, `rect`, `ellipse`,
2757
+ `line`, `polyline`, `polygon`, `g`) and their geometric and stroke
2758
+ attributes. Script, `foreignObject`, `image`, `use`, styles, handlers and any
2759
+ `url(...)` value are left out. It is done where the svg is DRAWN, because any
2760
+ writer with the right to write a node can write one. Up to 32 KB.
2761
+
2762
+ **Who loads them.** `C_YUI_TREEDB_TOPICS` does it for you: it shows
2763
+ `__icons__` as a tab even when `system` is false (the only `__` topic it
2764
+ shows), reads it whole (never by pages), and hands every load and write to the
2765
+ registry. An app that does not mount that view feeds the registry itself, from
2766
+ its own `nodes` answer and `EV_TREEDB_NODE_*` subscription:
2767
+
2768
+ ```js
2769
+ import {yui_icons_set_user, yui_icons_put_user, yui_icons_remove_user}
2770
+ from "@yuneta/gobj-ui/src/lib_icons.js";
2771
+ import {yui_shell_icons_changed} from "@yuneta/gobj-ui/src/c_yui_shell.js";
2772
+
2773
+ yui_icons_set_user(nodes); // the whole of __icons__
2774
+ yui_shell_icons_changed(shell); // EV_ICONS_CHANGED: views redraw
2775
+ ```
2776
+
2777
+ **Redraw.** A class name picks its icon up by itself once the rule exists. The
2778
+ icon cell of a table does not: it decides when it is drawn whether a name is an
2779
+ icon at all (an unknown name is shown in grey). So the shell publishes
2780
+ **`EV_ICONS_CHANGED`**, and `C_YUI_TREEDB_TOPIC_WITH_FORM` redraws its `icon`
2781
+ cells on it.
2782
+
2783
+ **Editing.** In the form, an `icon` column is a picker that draws every icon
2784
+ beside its name: the library's, then the user's (`yui_icons_list()`). The
2785
+ `svg` of `__icons__` is a text area with the icon it makes below it, redrawn
2786
+ as it is typed, naming what the sanitizer left out. In the table, the `svg`
2787
+ cell shows the icon, not its source, and is never edited in place.
2788
+
2789
+ **i18n keys** the app's locales must carry: `__icons__` (the tab), `left
2790
+ out`, and the five causes of `svg_error_text()` -- `empty svg`, `svg too big`,
2791
+ `not an svg document`, `svg without size`, `svg without shapes`.
2792
+
2719
2793
  ### JSON viewer — `setup_json_pad`
2720
2794
 
2721
2795
  `setup_json_pad(self)` opens a **blank JSON pad** (`C_YUI_JSON_PAD`) in a
@@ -3206,6 +3280,46 @@ metadata (`__md_treedb__`).
3206
3280
 
3207
3281
  ## Conventions
3208
3282
 
3283
+ ### The GUI rules a consumer inherits
3284
+
3285
+ This library draws for several apps, so its rules are theirs too. The full
3286
+ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
3287
+
3288
+ - **Every action goes through the FSM.** A DOM callback only sends an event;
3289
+ the work is in the action, where the `machine` trace sees it.
3290
+ - **A `kw` is plain JSON.** Never a gobj, a widget or a DOM node: the trace
3291
+ dumps the kw, and those objects are circular. Pass an identity (`{id}`)
3292
+ and resolve it in the action.
3293
+
3294
+ ```js
3295
+ graph.on(NodeEvent.CLICK, (evt) => {
3296
+ gobj_send_event(gobj, "EV_NODE_CLICK", {id: String(evt.target.id)}, gobj);
3297
+ });
3298
+ ```
3299
+ - **Every control has a `title` and an `aria-label`, each with its key**
3300
+ (`data-i18n-title`, `data-i18n-aria-label`); see the i18n section below.
3301
+ - **No transitions or animations.** A menu, popover or state change appears
3302
+ at once; a third-party transition is overridden with
3303
+ `transition: none !important`.
3304
+ - **Icon-only buttons are decided at design time, against the longest
3305
+ locale**, never measured at run time: `<span class="is-hidden-mobile">`
3306
+ around the label when the row would not fit at ~360px.
3307
+ - **One icon shape per meaning** (chevron = open/close one thing, shafted
3308
+ arrow = step or back, tree box = one level, double chevron = all). Never
3309
+ reuse a glyph because it is there.
3310
+ - **Bulma helpers carry `!important`** (`.is-hidden`, `.is-flex`): toggle
3311
+ `is-hidden`, or use `style.setProperty('display', 'none', 'important')`.
3312
+
3313
+ ### Releasing
3314
+
3315
+ `npm run build && npm test`, then `npm publish`. A published version reaches
3316
+ an app only through **`npm run deploy-round`**: it waits for the registry to
3317
+ serve the version, then per app raises the range, installs, builds, deploys
3318
+ and reads back the bundle each host serves (`--check` only reads back,
3319
+ `--only <name>` does one app, `--no-wait` skips the registry). The private
3320
+ consumers are listed in `~/.yuneta/gobj-ui-consumers.json` (see
3321
+ `scripts/gobj-ui-consumers.example.json`); the demo (`test-app/`) is built in.
3322
+
3209
3323
  ### Colour: a brand token as INK takes `-on-scheme`, as a FILL it does not
3210
3324
 
3211
3325
  A Bulma brand colour (`--bulma-link`, `--bulma-danger`, …) is built to carry
@@ -3320,7 +3434,9 @@ yui_shell_translate(shell, $el); // LIBRARY-built DOM, right after building it
3320
3434
 
3321
3435
  and **app view gclasses translate their own DOM** — they own a `t`, so they call
3322
3436
  `refresh_language($container, t)` at the end of their build (this is why the
3323
- shell does not translate a mounted view: see `mount_view` in `c_yui_shell.js`).
3437
+ shell does not translate a mounted view: see `build_view_gobj()` in
3438
+ `c_yui_shell.js`, which translates only the section-index `C_YUI_NAV` it
3439
+ synthesizes itself).
3324
3440
  `yui_shell_translate` is a no-op when the app registered no translator, so
3325
3441
  behaviour is unchanged for apps that never call `yui_shell_set_translator`.
3326
3442