@yuneta/gobj-ui 7.26.7 → 7.26.9
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 +53 -0
- package/dist/gobj-ui.cjs.js +534 -232
- package/dist/gobj-ui.es.js +534 -232
- package/package.json +2 -2
- package/src/c_g6_nodes_tree.js +65 -31
- package/src/c_yui_form.js +230 -63
- package/src/c_yui_gclass.js +23 -22
- package/src/c_yui_gobj_tree_js.js +13 -9
- package/src/c_yui_json.js +7 -6
- package/src/c_yui_json_graph.js +8 -7
- package/src/c_yui_json_pad.js +2 -1
- package/src/c_yui_map.js +25 -1
- package/src/c_yui_nav.js +9 -8
- package/src/c_yui_schema_editor.js +25 -24
- package/src/c_yui_shell.js +64 -3
- package/src/c_yui_treedb_topic_with_form.js +26 -21
- package/src/c_yui_treedb_topics.js +17 -16
- package/src/c_yui_window.js +73 -32
- package/src/c_yui_window_manager.js +3 -2
- package/src/form_json_field.js +10 -3
- package/src/form_json_field.test.js +6 -0
- package/src/form_json_field.wiring.test.js +1 -1
- package/src/form_table_rearm.wiring.test.js +158 -0
- package/src/form_toolbar_plan.js +5 -5
- package/src/g6_event_kw.js +36 -0
- package/src/map_stop_windows.wiring.test.js +112 -0
- package/src/nav_cards_helpers.js +2 -1
- package/src/nav_cards_helpers.test.js +7 -3
- package/src/overlay_marker_after_back.wiring.test.js +212 -0
- package/src/schema_to_c.js +10 -0
- package/src/schema_to_c.test.js +8 -1
- package/src/shell_modals.js +7 -5
- package/src/shell_route_map.js +12 -13
- package/src/treedb_topics_transport.wiring.test.js +26 -0
- package/src/vite_plugin_yuneta_html.test.js +94 -0
- package/src/window_show.wiring.test.js +83 -0
- package/src/window_veto_back.wiring.test.js +35 -0
- package/src/yui_asset.js +3 -2
- package/src/yui_data_color.js +33 -0
- package/src/yui_data_color.test.js +27 -0
- package/src/yui_dev.js +15 -13
- package/src/yui_frontend_view.js +4 -4
- package/src/yui_gclass_view.js +3 -3
- package/src/yui_text.js +43 -0
- package/src/yui_text.test.js +67 -0
- package/vite-plugin-yuneta-html.js +24 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuneta/gobj-ui",
|
|
3
|
-
"version": "7.26.
|
|
3
|
+
"version": "7.26.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/gobj-ui.cjs.js",
|
|
6
6
|
"module": "dist/gobj-ui.es.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@rollup/plugin-terser": "^1.0.0",
|
|
32
32
|
"@vitest/coverage-v8": "^4.1.10",
|
|
33
|
-
"@yuneta/gobj-js": "^7.
|
|
33
|
+
"@yuneta/gobj-js": "^7.26.2",
|
|
34
34
|
"vite": "^8.3.3",
|
|
35
35
|
"vitest": "^4.1.10"
|
|
36
36
|
},
|
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -176,6 +176,8 @@ import {
|
|
|
176
176
|
import {yui_theme_now, yui_watch_theme} from "./yui_theme.js";
|
|
177
177
|
import {yui_shell_of} from "./c_yui_shell.js";
|
|
178
178
|
import {yui_shell_show_error} from "./shell_modals.js";
|
|
179
|
+
import {g6_event_kw} from "./g6_event_kw.js";
|
|
180
|
+
import {css_color_or_null} from "./yui_data_color.js";
|
|
179
181
|
|
|
180
182
|
/***************************************************************
|
|
181
183
|
* YuiToolbar — G6 Toolbar subclass that adds per-item className
|
|
@@ -473,6 +475,7 @@ SDATA_END()
|
|
|
473
475
|
];
|
|
474
476
|
|
|
475
477
|
let PRIVATE_DATA = {
|
|
478
|
+
_drag_unwire: null, // removes the document listeners of a drag in flight
|
|
476
479
|
/*---------------- camera anchor ----------------*/
|
|
477
480
|
anchor_id: "", // the node the camera keeps in the middle
|
|
478
481
|
anchor_state: "off", // "off" | "arming" | "on"
|
|
@@ -717,6 +720,11 @@ function mt_destroy(gobj)
|
|
|
717
720
|
|
|
718
721
|
uninstall_fold_listener(gobj);
|
|
719
722
|
|
|
723
|
+
if(priv._drag_unwire) {
|
|
724
|
+
priv._drag_unwire(); // a resize or a link drag still in flight
|
|
725
|
+
priv._drag_unwire = null;
|
|
726
|
+
}
|
|
727
|
+
|
|
720
728
|
if(priv._on_pointerdown_focus) {
|
|
721
729
|
priv.$container.removeEventListener(
|
|
722
730
|
"pointerdown", priv._on_pointerdown_focus, true
|
|
@@ -1059,30 +1067,6 @@ function build_graph(gobj)
|
|
|
1059
1067
|
});
|
|
1060
1068
|
}
|
|
1061
1069
|
|
|
1062
|
-
/************************************************************
|
|
1063
|
-
* A G6 event, as PLAIN JSON.
|
|
1064
|
-
*
|
|
1065
|
-
* A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
|
|
1066
|
-
* G6 / @antv/g event is circular: serializing one THROWS, so the
|
|
1067
|
-
* first thing a kw carrying `evt` breaks is the trace the FSM
|
|
1068
|
-
* exists to feed. It also drags a live graph element into a
|
|
1069
|
-
* message that may be read after that element is gone.
|
|
1070
|
-
*
|
|
1071
|
-
* What the actions read of it is an id and three scalars. The
|
|
1072
|
-
* event itself never leaves the callback that received it.
|
|
1073
|
-
************************************************************/
|
|
1074
|
-
function g6_event_kw(evt)
|
|
1075
|
-
{
|
|
1076
|
-
let target = (evt && evt.target)? evt.target : null;
|
|
1077
|
-
let client = (evt && evt.client)? evt.client : null;
|
|
1078
|
-
|
|
1079
|
-
return {
|
|
1080
|
-
id: (target && target.id)? String(target.id) : "",
|
|
1081
|
-
shift: !!(evt && evt.shiftKey),
|
|
1082
|
-
client_x: (client && typeof client.x === "number")? client.x : 0,
|
|
1083
|
-
client_y: (client && typeof client.y === "number")? client.y : 0
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
1070
|
|
|
1087
1071
|
/************************************************************
|
|
1088
1072
|
* Configure G6 event handlers
|
|
@@ -2312,6 +2296,23 @@ function topic_defaults_of(gobj, topic_name)
|
|
|
2312
2296
|
topic_props.defaults : null;
|
|
2313
2297
|
}
|
|
2314
2298
|
|
|
2299
|
+
/************************************************************
|
|
2300
|
+
* A colour read from DATA (a `__graphs__` record), or null.
|
|
2301
|
+
* It is written into a card's html (see yui_data_color.js): a
|
|
2302
|
+
* refused value logs, and the node wears the topic's colour.
|
|
2303
|
+
************************************************************/
|
|
2304
|
+
function data_color(gobj, value)
|
|
2305
|
+
{
|
|
2306
|
+
if(value === undefined || value === null || value === "") {
|
|
2307
|
+
return null;
|
|
2308
|
+
}
|
|
2309
|
+
let color = css_color_or_null(value);
|
|
2310
|
+
if(!color) {
|
|
2311
|
+
log_warning(`${gobj_short_name(gobj)}: colour refused, not a css colour: ${JSON.stringify(value)}`);
|
|
2312
|
+
}
|
|
2313
|
+
return color;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2315
2316
|
/************************************************************
|
|
2316
2317
|
* What a node is PAINTED with: its own colours, then the
|
|
2317
2318
|
* topic's default, then the topic's colour.
|
|
@@ -2329,8 +2330,10 @@ function node_paint_of(gobj, desc, geometry)
|
|
|
2329
2330
|
{
|
|
2330
2331
|
let defaults = topic_defaults_of(gobj, desc.topic_name);
|
|
2331
2332
|
let g = is_object(geometry)? geometry : {};
|
|
2332
|
-
let fill =
|
|
2333
|
-
|
|
2333
|
+
let fill = data_color(gobj, g.fill) ||
|
|
2334
|
+
data_color(gobj, defaults && defaults.fill) || desc.color;
|
|
2335
|
+
let stroke = data_color(gobj, g.stroke) ||
|
|
2336
|
+
data_color(gobj, defaults && defaults.stroke) || getStrokeColor(fill);
|
|
2334
2337
|
let line_width = g.lineWidth || (defaults && defaults.lineWidth) || 1;
|
|
2335
2338
|
return {fill: fill, stroke: stroke, lineWidth: line_width};
|
|
2336
2339
|
}
|
|
@@ -5292,7 +5295,9 @@ function select_node(gobj, node_id)
|
|
|
5292
5295
|
history_pause(gobj);
|
|
5293
5296
|
try {
|
|
5294
5297
|
graph.setElementState(node_id, ['selected']);
|
|
5295
|
-
} catch(e) {
|
|
5298
|
+
} catch(e) {
|
|
5299
|
+
log_warning(`${gobj_short_name(gobj)}: node state not set: ${e}`);
|
|
5300
|
+
}
|
|
5296
5301
|
priv._selected_node_id = node_id;
|
|
5297
5302
|
paint_selection(gobj, [node_id]);
|
|
5298
5303
|
|
|
@@ -5336,7 +5341,9 @@ function deselect_node(gobj)
|
|
|
5336
5341
|
states[id] = [];
|
|
5337
5342
|
}
|
|
5338
5343
|
graph.setElementState(states);
|
|
5339
|
-
} catch(e) {
|
|
5344
|
+
} catch(e) {
|
|
5345
|
+
log_warning(`${gobj_short_name(gobj)}: node states not cleared: ${e}`);
|
|
5346
|
+
}
|
|
5340
5347
|
priv._selected_node_id = null;
|
|
5341
5348
|
paint_selection(gobj, []);
|
|
5342
5349
|
|
|
@@ -5645,6 +5652,13 @@ function start_node_resize(gobj, e, mx, my)
|
|
|
5645
5652
|
document.addEventListener('pointermove', onPointerMove);
|
|
5646
5653
|
document.addEventListener('pointerup', onPointerUp);
|
|
5647
5654
|
document.addEventListener('pointercancel', onPointerCancel);
|
|
5655
|
+
/* A view destroyed in the middle of the drag takes them off too
|
|
5656
|
+
* (mt_destroy): they are closures over this gobj, on `document`. */
|
|
5657
|
+
gobj.priv._drag_unwire = function() {
|
|
5658
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
5659
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
5660
|
+
document.removeEventListener('pointercancel', onPointerCancel);
|
|
5661
|
+
};
|
|
5648
5662
|
}
|
|
5649
5663
|
|
|
5650
5664
|
/************************************************************
|
|
@@ -6534,6 +6548,13 @@ function start_link_drag(gobj, e)
|
|
|
6534
6548
|
document.addEventListener('pointermove', onPointerMove);
|
|
6535
6549
|
document.addEventListener('pointerup', onPointerUp);
|
|
6536
6550
|
document.addEventListener('pointercancel', onPointerCancel);
|
|
6551
|
+
/* A view destroyed in the middle of the drag takes them off too
|
|
6552
|
+
* (mt_destroy): they are closures over this gobj, on `document`. */
|
|
6553
|
+
gobj.priv._drag_unwire = function() {
|
|
6554
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
6555
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
6556
|
+
document.removeEventListener('pointercancel', onPointerCancel);
|
|
6557
|
+
};
|
|
6537
6558
|
}
|
|
6538
6559
|
|
|
6539
6560
|
/************************************************************
|
|
@@ -6812,6 +6833,13 @@ function start_port_resize(gobj, e)
|
|
|
6812
6833
|
document.addEventListener('pointermove', onPointerMove);
|
|
6813
6834
|
document.addEventListener('pointerup', onPointerUp);
|
|
6814
6835
|
document.addEventListener('pointercancel', onPointerCancel);
|
|
6836
|
+
/* A view destroyed in the middle of the drag takes them off too
|
|
6837
|
+
* (mt_destroy): they are closures over this gobj, on `document`. */
|
|
6838
|
+
gobj.priv._drag_unwire = function() {
|
|
6839
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
6840
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
6841
|
+
document.removeEventListener('pointercancel', onPointerCancel);
|
|
6842
|
+
};
|
|
6815
6843
|
}
|
|
6816
6844
|
|
|
6817
6845
|
/************************************************************
|
|
@@ -6830,7 +6858,9 @@ function select_edge(gobj, edge_id)
|
|
|
6830
6858
|
history_pause(gobj);
|
|
6831
6859
|
try {
|
|
6832
6860
|
graph.setElementState(edge_id, ['selected']);
|
|
6833
|
-
} catch(e) {
|
|
6861
|
+
} catch(e) {
|
|
6862
|
+
log_warning(`${gobj_short_name(gobj)}: edge state not set: ${e}`);
|
|
6863
|
+
}
|
|
6834
6864
|
|
|
6835
6865
|
show_edge_icon(gobj);
|
|
6836
6866
|
|
|
@@ -6852,7 +6882,9 @@ function deselect_edge(gobj)
|
|
|
6852
6882
|
history_pause(gobj);
|
|
6853
6883
|
try {
|
|
6854
6884
|
graph.setElementState(priv._selected_edge_id, []);
|
|
6855
|
-
} catch(e) {
|
|
6885
|
+
} catch(e) {
|
|
6886
|
+
log_warning(`${gobj_short_name(gobj)}: edge state not cleared: ${e}`);
|
|
6887
|
+
}
|
|
6856
6888
|
priv._selected_edge_id = null;
|
|
6857
6889
|
|
|
6858
6890
|
graph_draw(gobj).then(() => {
|
|
@@ -6991,7 +7023,9 @@ function show_edge_popover(gobj)
|
|
|
6991
7023
|
history_pause(gobj);
|
|
6992
7024
|
try {
|
|
6993
7025
|
graph.setElementState(edge_id, []);
|
|
6994
|
-
} catch(e) {
|
|
7026
|
+
} catch(e) {
|
|
7027
|
+
log_warning(`${gobj_short_name(gobj)}: edge state not cleared for the style preview: ${e}`);
|
|
7028
|
+
}
|
|
6995
7029
|
graph_draw(gobj).then(() => {
|
|
6996
7030
|
history_resume(gobj);
|
|
6997
7031
|
});
|