@yuneta/gobj-ui 7.27.25 → 7.27.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.25",
3
+ "version": "7.27.27",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@rollup/plugin-terser": "^1.0.0",
45
- "@vitest/coverage-v8": "^4.1.10",
46
- "@yuneta/gobj-js": "^7.26.28",
45
+ "@vitest/coverage-v8": "^5.0.5",
46
+ "@yuneta/gobj-js": "^7.27.0",
47
47
  "vite": "^8.3.4",
48
- "vitest": "^4.1.10"
48
+ "vitest": "^5.0.5"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@antv/g6": "^5.1.0",
@@ -159,7 +159,7 @@ import {
159
159
  Polyline,
160
160
  } from '@antv/g6';
161
161
 
162
- import {Circle as CircleGeometry, Rect as RectGeometry} from '@antv/g';
162
+ import {Circle as CircleGeometry} from '@antv/g';
163
163
  import {t} from "i18next";
164
164
 
165
165
  import {inject_svg_icons} from "./lib_icons.js";
@@ -179,6 +179,11 @@ import {yui_shell_show_error} from "./shell_modals.js";
179
179
  import {g6_event_kw} from "./g6_event_kw.js";
180
180
  import {css_color_or_null} from "./yui_data_color.js";
181
181
  import {keep_canvas_tab_order} from "./g6_canvas_tab_order.js";
182
+ import {
183
+ yui_graph_minimap_options,
184
+ yui_graph_minimap_block,
185
+ yui_graph_minimap_repaint,
186
+ } from "./yui_graph_minimap.js";
182
187
 
183
188
  /***************************************************************
184
189
  * The markup of one toolbar item. Everything that goes into it is
@@ -8051,13 +8056,8 @@ function auto_layout(gobj)
8051
8056
  ************************************************************/
8052
8057
  function repaint_minimap(gobj)
8053
8058
  {
8054
- let plugin = graph_get_plugin(gobj, "minimap");
8055
- if(!plugin || plugin.destroyed) {
8056
- return;
8057
- }
8058
8059
  try {
8059
- plugin.renderMinimap();
8060
- plugin.renderMask();
8060
+ yui_graph_minimap_repaint(graph_get_plugin(gobj, "minimap"));
8061
8061
  } catch(e) {
8062
8062
  log_error(`${gobj_short_name(gobj)}: repaint_minimap failed: ${e}`);
8063
8063
  }
@@ -8107,97 +8107,37 @@ function refresh_minimap(gobj)
8107
8107
  graph_add_plugin(
8108
8108
  gobj,
8109
8109
  "minimap",
8110
- {
8111
- size: [200, 140],
8112
- position: "bottom-left",
8113
- /*
8114
- * The anchor has to be CSS, not the pixels G6 computes.
8115
- *
8116
- * `createPluginCanvas` turns `position` into `left`/`top`
8117
- * in PIXELS, once, from the canvas size at creation
8118
- * (`xRatio * (W - width)`). The container then grows --
8119
- * full screen, a window resize, a panel closing -- and the
8120
- * minimap stays at the `top` it was given: measured going
8121
- * full screen, `top` was still `511px` over a container
8122
- * that had become 768 tall, which put it floating halfway
8123
- * up the left edge, on top of the graph it is there to
8124
- * explain.
8125
- *
8126
- * `containerStyle` is merged AFTER those pixels, so
8127
- * `top: auto` + `bottom` is a real anchor the browser
8128
- * keeps for every size the container ever takes.
8129
- *
8130
- * And it follows the theme: G6's default is a `#fff` box
8131
- * with a `#ddd` border in BOTH themes, which over a
8132
- * near-black canvas is the brightest thing on screen.
8133
- */
8134
- containerStyle: {
8135
- top: "auto",
8136
- bottom: "12px",
8137
- left: "12px",
8138
- background: "var(--bulma-scheme-main, #fff)",
8139
- /* A mid grey and not a `--bulma-border-*` token: those
8140
- * are made for a line INSIDE a surface, and this one has
8141
- * to separate a floating panel from the CANVAS behind
8142
- * it -- which is near-black in one scheme and white in
8143
- * the other. `border-weak` was 1.43:1 over the dark
8144
- * canvas and 1.18 over the light one; every border token
8145
- * fails at least one of them. This one is 4.6 on both.
8146
- * (The box-shadow below separates it only where there
8147
- * is light to cast a shadow on.) */
8148
- border: "1px solid var(--bulma-text-weak, #94a3b8)",
8149
- borderRadius: "6px",
8150
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
8151
- },
8152
- /* The viewport rectangle: G6 washes it in black, which is
8153
- * invisible over a dark minimap. A link-coloured outline
8154
- * reads on both. */
8155
- maskStyle: {
8156
- border: "2px solid var(--bulma-link-on-scheme, var(--bulma-link, #3b82f6))",
8157
- background: "rgba(59, 130, 246, 0.12)",
8158
- },
8159
- shape: (id, element_type, element) => {
8160
- if(element_type !== "node") {
8161
- return element; /* edges clone themselves fine */
8162
- }
8163
- try {
8164
- let nd = graph.getNodeData(id);
8165
- let size = (nd && nd.style && nd.style.size) || [120, 60];
8166
- /* The topic's colour PUSHED TOWARDS THE SURFACE, the
8167
- * same treatment a port's rim takes: a block here is
8168
- * the topic colour on the panel's own background, and
8169
- * on the light scheme the palette's yellow was 1.61:1
8170
- * on white -- a minimap whose content could not be
8171
- * told from its paper. 3.80 in light, 9.11 in dark. */
8172
- let color = port_rim(
8173
- (nd && nd.data && nd.data.desc && nd.data.desc.color) || "#94a3b8",
8174
- priv.theme
8175
- );
8176
- if(is_more_node(nd)) {
8177
- /* A `+N` chip is a cut, not a card: quieter than a
8178
- * block, and still visible. The slate had to become
8179
- * a DARK slate on a white panel -- raising the alpha
8180
- * of the light one only ever reached 1.86. */
8181
- color = (priv.theme === "dark")
8182
- ? "rgba(148, 163, 184, 0.60)" /* 3.35:1 */
8183
- : "rgba(71, 85, 105, 0.65)"; /* 3.19:1 */
8184
- }
8185
- return new RectGeometry({
8186
- style: {
8187
- x: -size[0] / 2,
8188
- y: -size[1] / 2,
8189
- width: size[0],
8190
- height: size[1],
8191
- fill: color,
8192
- radius: 4
8193
- }
8194
- });
8195
- } catch(e) {
8196
- log_error(`${gobj_short_name(gobj)}: minimap shape failed: ${e}`);
8197
- return element;
8110
+ yui_graph_minimap_options((id, element_type, element) => {
8111
+ if(element_type !== "node") {
8112
+ return element; /* edges clone themselves fine */
8113
+ }
8114
+ try {
8115
+ let nd = graph.getNodeData(id);
8116
+ /* The topic's colour PUSHED TOWARDS THE SURFACE, the
8117
+ * same treatment a port's rim takes: a block here is
8118
+ * the topic colour on the panel's own background, and
8119
+ * on the light scheme the palette's yellow was 1.61:1
8120
+ * on white -- a minimap whose content could not be
8121
+ * told from its paper. 3.80 in light, 9.11 in dark. */
8122
+ let color = port_rim(
8123
+ (nd && nd.data && nd.data.desc && nd.data.desc.color) || "#94a3b8",
8124
+ priv.theme
8125
+ );
8126
+ if(is_more_node(nd)) {
8127
+ /* A `+N` chip is a cut, not a card: quieter than a
8128
+ * block, and still visible. The slate had to become
8129
+ * a DARK slate on a white panel -- raising the alpha
8130
+ * of the light one only ever reached 1.86. */
8131
+ color = (priv.theme === "dark")
8132
+ ? "rgba(148, 163, 184, 0.60)" /* 3.35:1 */
8133
+ : "rgba(71, 85, 105, 0.65)"; /* 3.19:1 */
8198
8134
  }
8135
+ return yui_graph_minimap_block(nd, color);
8136
+ } catch(e) {
8137
+ log_error(`${gobj_short_name(gobj)}: minimap shape failed: ${e}`);
8138
+ return element;
8199
8139
  }
8200
- }
8140
+ })
8201
8141
  );
8202
8142
  }
8203
8143
 
@@ -16,6 +16,12 @@
16
16
  * picked to stay legible on both grounds.
17
17
  */
18
18
  .C_YUI_GCLASS {
19
+ /* The layout follows the VIEWER's width, not the screen's: a 720px
20
+ * window on a 1440px screen is a narrow viewer, and a media query
21
+ * gave it two columns of 330px with the attrs table scrolling
22
+ * sideways inside one of them. */
23
+ container-type: inline-size;
24
+ container-name: gclass-viewer;
19
25
  --gclass-attrs: #2D4EC8;
20
26
  --gclass-cmds: #0E6F63;
21
27
  --gclass-fsm: #6B4FA8;
@@ -75,19 +81,42 @@
75
81
  }
76
82
 
77
83
  /*
78
- * The header: the name, and the two numbers a reader asks for before
79
- * anything else.
84
+ * The header: the name, how many gobjs of it there are, the instance
85
+ * the reader came from and its state; then the methods.
80
86
  */
81
87
  .C_YUI_GCLASS .GCLASS_HEAD {
82
88
  display: flex;
83
- flex-wrap: wrap;
84
- align-items: baseline;
85
- gap: .35rem .6rem;
89
+ flex-direction: column;
90
+ gap: .4rem;
86
91
  padding-bottom: .6rem;
87
92
  margin-bottom: .8rem;
88
93
  border-bottom: 1px solid var(--gclass-rule);
89
94
  }
90
95
 
96
+ .C_YUI_GCLASS .GCLASS_HEAD_ROW {
97
+ display: flex;
98
+ flex-wrap: wrap;
99
+ align-items: baseline;
100
+ gap: .35rem .6rem;
101
+ }
102
+
103
+ .C_YUI_GCLASS .GCLASS_HEAD_LABEL {
104
+ font-size: .64rem;
105
+ font-weight: 700;
106
+ letter-spacing: .12em;
107
+ text-transform: uppercase;
108
+ color: var(--gclass-muted);
109
+ }
110
+
111
+ .C_YUI_GCLASS .GCLASS_CURRENT_INSTANCE {
112
+ font-family: var(--gclass-mono);
113
+ margin-right: .35rem;
114
+ }
115
+
116
+ .C_YUI_GCLASS .GCLASS_CURRENT_INSTANCE::after {
117
+ content: ":";
118
+ }
119
+
91
120
  .C_YUI_GCLASS .GCLASS_NAME {
92
121
  font-family: var(--gclass-mono);
93
122
  font-size: 1.05rem;
@@ -109,38 +138,34 @@
109
138
  }
110
139
 
111
140
  /*
112
- * Two columns while there is room for two: the machine grows sideways
113
- * and everything else grows downwards, so they are the two that must
114
- * not share a column. Below the breakpoint they stack, which is also
115
- * the order they are written in.
141
+ * The SHORT zones (the machine, the trace levels) side by side when
142
+ * the viewer has room for two; the long tables (attrs, commands)
143
+ * always across the whole width, where a description fits beside its
144
+ * name. In graph mode the machine takes the width and its pair goes
145
+ * under it.
116
146
  */
117
- .C_YUI_GCLASS .GCLASS_COLS {
147
+ .C_YUI_GCLASS .GCLASS_PAIR {
118
148
  display: grid;
119
149
  grid-template-columns: minmax(0, 1fr);
120
150
  gap: 1.2rem;
151
+ margin-bottom: 1.2rem;
152
+ align-items: start;
121
153
  }
122
154
 
123
- @media (min-width: 900px) {
124
- .C_YUI_GCLASS .GCLASS_COLS {
125
- grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
155
+ @container gclass-viewer (min-width: 70rem) {
156
+ .C_YUI_GCLASS .GCLASS_PAIR {
157
+ grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
126
158
  }
127
159
 
128
- /* In graph mode the machine is above, across the whole width, and
129
- * what is left stacks in one column. */
130
- .C_YUI_GCLASS .GCLASS_COLS.is-stacked {
160
+ .C_YUI_GCLASS .GCLASS_PAIR.is-stacked {
131
161
  grid-template-columns: minmax(0, 1fr);
132
162
  }
133
163
  }
134
164
 
135
165
  .C_YUI_GCLASS .GCLASS_FULL {
136
- margin-bottom: 1.2rem;
137
- }
138
-
139
- .C_YUI_GCLASS .GCLASS_COL {
140
166
  display: flex;
141
167
  flex-direction: column;
142
- gap: 1.1rem;
143
- min-width: 0;
168
+ gap: 1.2rem;
144
169
  }
145
170
 
146
171
  /*
@@ -270,6 +295,56 @@
270
295
 
271
296
  .C_YUI_GCLASS .GCLASS_CELL_TYPE { white-space: nowrap; }
272
297
 
298
+ /* The flags of one attr on ONE line: wrapped, each one took a line
299
+ * and every row with two flags was twice as tall as its neighbours. */
300
+ .C_YUI_GCLASS .GCLASS_CELL_FLAGS { white-space: nowrap; }
301
+
302
+ .C_YUI_GCLASS .GCLASS_CELL_BOX {
303
+ width: 1%;
304
+ text-align: center;
305
+ white-space: nowrap;
306
+ }
307
+
308
+ .C_YUI_GCLASS .GCLASS_TRACE_GROUP td {
309
+ padding-top: .6rem;
310
+ font-size: .64rem;
311
+ font-weight: 700;
312
+ letter-spacing: .12em;
313
+ text-transform: uppercase;
314
+ color: var(--gclass-muted);
315
+ border-bottom: 0;
316
+ }
317
+
318
+ .C_YUI_GCLASS .GCLASS_TRACE_ORIGIN {
319
+ margin-left: .45rem;
320
+ font-weight: 400;
321
+ color: var(--gclass-muted);
322
+ }
323
+
324
+ .C_YUI_GCLASS .GCLASS_TRACES_NOTE {
325
+ margin: .45rem 0 .3rem;
326
+ font-size: .76rem;
327
+ color: var(--gclass-muted);
328
+ }
329
+
330
+ .C_YUI_GCLASS .GCLASS_SHOW_ALL {
331
+ margin-top: .5rem;
332
+ }
333
+
334
+ .C_YUI_GCLASS .GCLASS_PUBLISHED {
335
+ width: auto;
336
+ }
337
+
338
+ .C_YUI_GCLASS .GCLASS_PUB_FLAGS .GCLASS_CHIP {
339
+ background: none;
340
+ padding: 0;
341
+ }
342
+
343
+ .C_YUI_GCLASS .GCLASS_PUB_FLAGS .GCLASS_CHIP + .GCLASS_CHIP::before {
344
+ content: "· ";
345
+ color: var(--gclass-muted);
346
+ }
347
+
273
348
  .C_YUI_GCLASS .GCLASS_CMD_SECTION td {
274
349
  padding-top: .7rem;
275
350
  font-size: .64rem;
@@ -475,6 +550,13 @@
475
550
  width: auto;
476
551
  }
477
552
 
553
+ /* The same mark the matrix draws, in the colour it draws it. */
554
+ .C_YUI_GCLASS .GCLASS_LEGEND_SWATCH.is-unnamed {
555
+ border-color: transparent;
556
+ color: var(--gclass-fsm);
557
+ width: auto;
558
+ }
559
+
478
560
  .C_YUI_GCLASS .GCLASS_PUB_EVENT { color: var(--gclass-cmds); }
479
561
 
480
562
  /*