@yuneta/gobj-ui 7.23.90 → 7.23.92
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/dist/gobj-ui.cjs.js +108 -21
- package/dist/gobj-ui.es.js +108 -21
- package/package.json +1 -1
- package/src/c_g6_nodes_tree.js +162 -22
package/dist/gobj-ui.cjs.js
CHANGED
|
@@ -54572,8 +54572,16 @@ ensure_pinch_zoom_patch();
|
|
|
54572
54572
|
* Constants
|
|
54573
54573
|
***************************************************************/
|
|
54574
54574
|
var GCLASS_NAME$4 = "C_G6_NODES_TREE";
|
|
54575
|
-
var
|
|
54576
|
-
var
|
|
54575
|
+
var HIGHLIGHT_COLOR_DARK = "#f0a020";
|
|
54576
|
+
var HIGHLIGHT_COLOR_LIGHT = "#b45309";
|
|
54577
|
+
var HIGHLIGHT_HALO_DARK = "rgba(240,160,32,0.35)";
|
|
54578
|
+
var HIGHLIGHT_HALO_LIGHT = "rgba(180,83,9,0.35)";
|
|
54579
|
+
function highlight_color(theme) {
|
|
54580
|
+
return theme === "dark" ? HIGHLIGHT_COLOR_DARK : HIGHLIGHT_COLOR_LIGHT;
|
|
54581
|
+
}
|
|
54582
|
+
function highlight_halo(theme) {
|
|
54583
|
+
return theme === "dark" ? HIGHLIGHT_HALO_DARK : HIGHLIGHT_HALO_LIGHT;
|
|
54584
|
+
}
|
|
54577
54585
|
var SELECT_RING = "rgba(59,130,246,0.95)";
|
|
54578
54586
|
var PORT_R_ENTITY = 14;
|
|
54579
54587
|
var PORT_R_CHILD = 8;
|
|
@@ -55491,6 +55499,53 @@ function calculate_hooks_fkeys_counter(desc) {
|
|
|
55491
55499
|
/************************************************************
|
|
55492
55500
|
* Build ports for a topic desc
|
|
55493
55501
|
************************************************************/
|
|
55502
|
+
/************************************************************
|
|
55503
|
+
* Mix two colours the way `color-mix(in srgb, a p%, b)` does,
|
|
55504
|
+
* in JS.
|
|
55505
|
+
*
|
|
55506
|
+
* The cards are html and can say `color-mix()`; a PORT is drawn
|
|
55507
|
+
* on the canvas by `@antv/g`, which parses a colour string and
|
|
55508
|
+
* knows nothing about CSS functions -- so the same arithmetic
|
|
55509
|
+
* has to happen here.
|
|
55510
|
+
************************************************************/
|
|
55511
|
+
function mix_colors(a, p, b) {
|
|
55512
|
+
let rgb = (c) => {
|
|
55513
|
+
if (c.charAt(0) === "#") {
|
|
55514
|
+
let h = c.slice(1);
|
|
55515
|
+
if (h.length === 3) h = h.split("").map((x) => x + x).join("");
|
|
55516
|
+
return [
|
|
55517
|
+
0,
|
|
55518
|
+
2,
|
|
55519
|
+
4
|
|
55520
|
+
].map((i) => parseInt(h.slice(i, i + 2), 16));
|
|
55521
|
+
}
|
|
55522
|
+
return (c.match(/[\d.]+/g) || []).map(Number).slice(0, 3);
|
|
55523
|
+
};
|
|
55524
|
+
let A = rgb(a);
|
|
55525
|
+
let B = rgb(b);
|
|
55526
|
+
return `rgb(${A.map((v, i) => Math.round(v * p + B[i] * (1 - p))).join(",")})`;
|
|
55527
|
+
}
|
|
55528
|
+
/************************************************************
|
|
55529
|
+
* The rim of a port.
|
|
55530
|
+
*
|
|
55531
|
+
* A port is a knob half on a CARD and half on the canvas, and
|
|
55532
|
+
* the card is a tint of a topic colour -- so a port of that
|
|
55533
|
+
* same topic used to sit on its own colour: 2.62:1 against the
|
|
55534
|
+
* card in dark, 1.54 in light, where a graphical object needs
|
|
55535
|
+
* 3:1 to be told from what is next to it. The FILL keeps saying
|
|
55536
|
+
* which topic links there; the rim is what separates it, and it
|
|
55537
|
+
* is the port's own colour pushed towards the surface -- 60% of
|
|
55538
|
+
* the hue is enough to clear 3:1 on both grounds in both
|
|
55539
|
+
* themes (4.49 / 3.64 against the card, 9.11 / 3.80 against the
|
|
55540
|
+
* canvas) and little enough to keep the hue.
|
|
55541
|
+
*
|
|
55542
|
+
* It used to be `getStrokeColor(color)` called with no theme,
|
|
55543
|
+
* which is its LIGHT branch always: a rim darkened by 20% of a
|
|
55544
|
+
* colour, on a card of the same colour.
|
|
55545
|
+
************************************************************/
|
|
55546
|
+
function port_rim(color, theme) {
|
|
55547
|
+
return mix_colors(color, .6, theme === "dark" ? "#ffffff" : "#0f172a");
|
|
55548
|
+
}
|
|
55494
55549
|
function build_ports(gobj, desc) {
|
|
55495
55550
|
let priv = gobj.priv;
|
|
55496
55551
|
let top_ports = [];
|
|
@@ -55509,7 +55564,7 @@ function build_ports(gobj, desc) {
|
|
|
55509
55564
|
port = {
|
|
55510
55565
|
key: col.id,
|
|
55511
55566
|
fill: child_desc ? child_desc.color : desc.color,
|
|
55512
|
-
stroke:
|
|
55567
|
+
stroke: port_rim(child_desc ? child_desc.color : desc.color, priv.theme)
|
|
55513
55568
|
};
|
|
55514
55569
|
bottom_ports.push(port);
|
|
55515
55570
|
}
|
|
@@ -55518,7 +55573,7 @@ function build_ports(gobj, desc) {
|
|
|
55518
55573
|
port = {
|
|
55519
55574
|
key: col.id,
|
|
55520
55575
|
fill: desc.color,
|
|
55521
|
-
stroke:
|
|
55576
|
+
stroke: port_rim(desc.color, priv.theme)
|
|
55522
55577
|
};
|
|
55523
55578
|
top_ports.push(port);
|
|
55524
55579
|
}
|
|
@@ -55879,7 +55934,8 @@ function node_figure_of(gobj, desc, geometry) {
|
|
|
55879
55934
|
* flags {highlight, selected, anchored}
|
|
55880
55935
|
************************************************************/
|
|
55881
55936
|
function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
55882
|
-
let
|
|
55937
|
+
let priv = gobj.priv;
|
|
55938
|
+
let dark = priv.theme === "dark";
|
|
55883
55939
|
let f = flags || {};
|
|
55884
55940
|
let tier = desc.node_treedb_type;
|
|
55885
55941
|
let side = SHAPE_SIZE[tier] || SHAPE_SIZE.hierarchical;
|
|
@@ -55893,7 +55949,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
|
55893
55949
|
line_width = 3;
|
|
55894
55950
|
}
|
|
55895
55951
|
if (f.highlight) {
|
|
55896
|
-
stroke =
|
|
55952
|
+
stroke = highlight_color(priv.theme);
|
|
55897
55953
|
line_width = 3;
|
|
55898
55954
|
}
|
|
55899
55955
|
let dash = [];
|
|
@@ -55910,7 +55966,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
|
55910
55966
|
lineWidth: line_width,
|
|
55911
55967
|
lineDash: dash,
|
|
55912
55968
|
halo: !!f.highlight,
|
|
55913
|
-
haloStroke:
|
|
55969
|
+
haloStroke: highlight_halo(priv.theme),
|
|
55914
55970
|
haloLineWidth: 8,
|
|
55915
55971
|
port: false,
|
|
55916
55972
|
ports: [],
|
|
@@ -58920,12 +58976,13 @@ function auto_layout(gobj) {
|
|
|
58920
58976
|
* Its shapes are drawn by hand. G6's minimap clones each element's key
|
|
58921
58977
|
* shape into its own canvas, and every node here is an `html` node
|
|
58922
58978
|
* whose key shape is a DOM element — the same reason the `active`
|
|
58923
|
-
* state never painted (see
|
|
58979
|
+
* state never painted (see highlight_color()). A block in the topic's
|
|
58924
58980
|
* colour is also what a minimap of cards SHOULD show: at that scale a
|
|
58925
58981
|
* card is a rectangle anyway.
|
|
58926
58982
|
************************************************************/
|
|
58927
58983
|
function refresh_minimap(gobj) {
|
|
58928
|
-
let
|
|
58984
|
+
let priv = gobj.priv;
|
|
58985
|
+
let graph = priv.graph;
|
|
58929
58986
|
if (!graph) return;
|
|
58930
58987
|
let threshold = (0, _yuneta_gobj_js.gobj_read_integer_attr)(gobj, "minimap_min_nodes");
|
|
58931
58988
|
let n = 0;
|
|
@@ -58948,12 +59005,12 @@ function refresh_minimap(gobj) {
|
|
|
58948
59005
|
bottom: "12px",
|
|
58949
59006
|
left: "12px",
|
|
58950
59007
|
background: "var(--bulma-scheme-main, #fff)",
|
|
58951
|
-
border: "1px solid var(--bulma-
|
|
59008
|
+
border: "1px solid var(--bulma-text-weak, #94a3b8)",
|
|
58952
59009
|
borderRadius: "6px",
|
|
58953
59010
|
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)"
|
|
58954
59011
|
},
|
|
58955
59012
|
maskStyle: {
|
|
58956
|
-
border: "2px solid var(--bulma-link, #3b82f6)",
|
|
59013
|
+
border: "2px solid var(--bulma-link-on-scheme, var(--bulma-link, #3b82f6))",
|
|
58957
59014
|
background: "rgba(59, 130, 246, 0.12)"
|
|
58958
59015
|
},
|
|
58959
59016
|
shape: (id, element_type, element) => {
|
|
@@ -58961,8 +59018,8 @@ function refresh_minimap(gobj) {
|
|
|
58961
59018
|
try {
|
|
58962
59019
|
let nd = graph.getNodeData(id);
|
|
58963
59020
|
let size = nd && nd.style && nd.style.size || [120, 60];
|
|
58964
|
-
let color = nd && nd.data && nd.data.desc && nd.data.desc.color || "#94a3b8";
|
|
58965
|
-
if (is_more_node(nd)) color = "rgba(148, 163, 184, 0.
|
|
59021
|
+
let color = port_rim(nd && nd.data && nd.data.desc && nd.data.desc.color || "#94a3b8", priv.theme);
|
|
59022
|
+
if (is_more_node(nd)) color = priv.theme === "dark" ? "rgba(148, 163, 184, 0.60)" : "rgba(71, 85, 105, 0.65)";
|
|
58966
59023
|
return new Rect({ style: {
|
|
58967
59024
|
x: -size[0] / 2,
|
|
58968
59025
|
y: -size[1] / 2,
|
|
@@ -59143,9 +59200,9 @@ function refresh_default_edges_theme(gobj, theme) {
|
|
|
59143
59200
|
function anchor_outline(anchored) {
|
|
59144
59201
|
return anchored ? "outline: 3px dashed #fa8c16; outline-offset: 2px;" : "";
|
|
59145
59202
|
}
|
|
59146
|
-
function ring_shadow(highlight, selected, base_shadow) {
|
|
59203
|
+
function ring_shadow(highlight, selected, base_shadow, theme) {
|
|
59147
59204
|
let rings = [];
|
|
59148
|
-
if (highlight) rings.push(`0 0 0 4px ${
|
|
59205
|
+
if (highlight) rings.push(`0 0 0 4px ${highlight_halo(theme)}`);
|
|
59149
59206
|
if (selected) rings.push(`0 0 0 ${highlight ? "7px" : "3px"} ${SELECT_RING}`);
|
|
59150
59207
|
if (base_shadow) rings.push(base_shadow);
|
|
59151
59208
|
if (!rings.length) return "";
|
|
@@ -59160,10 +59217,10 @@ function ring_shadow(highlight, selected, base_shadow) {
|
|
|
59160
59217
|
function build_chip_innerHTML(color, theme, icon, label, key, highlight, selected, anchored) {
|
|
59161
59218
|
let title = key || label;
|
|
59162
59219
|
let dark = theme === "dark";
|
|
59163
|
-
let bg = dark ? `color-mix(in srgb, ${color}
|
|
59220
|
+
let bg = dark ? `color-mix(in srgb, ${color} 25%, #2c3542)` : `color-mix(in srgb, ${color} 10%, ${dark ? "#1b2230" : "#ffffff"})`;
|
|
59164
59221
|
let border = dark ? `color-mix(in srgb, ${color} 85%, #ffffff)` : color;
|
|
59165
59222
|
let text_color = dark ? "#e8eaed" : "#0f172a";
|
|
59166
|
-
if (highlight) border =
|
|
59223
|
+
if (highlight) border = highlight_color(theme);
|
|
59167
59224
|
let icon_html = "";
|
|
59168
59225
|
if (icon) icon_html = `<img src="${(0, _yuneta_gobj_js.safeSrc)(icon)}" alt="" style="
|
|
59169
59226
|
width: 16px; height: 16px; object-fit: contain;
|
|
@@ -59176,7 +59233,7 @@ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selecte
|
|
|
59176
59233
|
height: 100%;
|
|
59177
59234
|
background: ${bg};
|
|
59178
59235
|
border: ${highlight ? "3px" : "1px"} solid ${border};
|
|
59179
|
-
${ring_shadow(highlight, selected, "")}
|
|
59236
|
+
${ring_shadow(highlight, selected, "", theme)}
|
|
59180
59237
|
${anchor_outline(anchored)}
|
|
59181
59238
|
border-radius: 8px;
|
|
59182
59239
|
color: ${text_color};
|
|
@@ -59218,7 +59275,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
|
|
|
59218
59275
|
border_style = "solid";
|
|
59219
59276
|
}
|
|
59220
59277
|
if (highlight) {
|
|
59221
|
-
border =
|
|
59278
|
+
border = highlight_color(theme);
|
|
59222
59279
|
border_style = "solid";
|
|
59223
59280
|
}
|
|
59224
59281
|
let title_color = dark ? "#e8eaed" : "#0f172a";
|
|
@@ -59251,7 +59308,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
|
|
|
59251
59308
|
background: ${bg};
|
|
59252
59309
|
border: ${highlight ? "3px" : "1.5px"} ${border_style} ${border};
|
|
59253
59310
|
border-radius: 10px;
|
|
59254
|
-
${ring_shadow(highlight, selected, shadow)}
|
|
59311
|
+
${ring_shadow(highlight, selected, shadow, theme)}
|
|
59255
59312
|
${anchor_outline(anchored)}
|
|
59256
59313
|
color: ${title_color};
|
|
59257
59314
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -60392,7 +60449,7 @@ async function reconcile_fold_apply(gobj, opts, visible) {
|
|
|
60392
60449
|
sourcePort: p.hook,
|
|
60393
60450
|
lineWidth: 1,
|
|
60394
60451
|
lineDash: [4, 3],
|
|
60395
|
-
stroke: dark ? "#8b94a3" : "#
|
|
60452
|
+
stroke: dark ? "#8b94a3" : "#6b7280",
|
|
60396
60453
|
startArrow: false,
|
|
60397
60454
|
endArrow: false
|
|
60398
60455
|
},
|
|
@@ -60459,6 +60516,31 @@ function ac_language_changed$3(gobj, event, kw, src) {
|
|
|
60459
60516
|
return 0;
|
|
60460
60517
|
}
|
|
60461
60518
|
/************************************************************
|
|
60519
|
+
* The rims of every port, on a theme change.
|
|
60520
|
+
*
|
|
60521
|
+
* A rim is half of the surface it sits on (see port_rim), so it
|
|
60522
|
+
* belongs to the theme -- and it lives in each node's
|
|
60523
|
+
* `style.ports`, which is the one place refresh_html_nodes_theme()
|
|
60524
|
+
* does not reach: it rebuilds the html INSIDE a card.
|
|
60525
|
+
************************************************************/
|
|
60526
|
+
function refresh_port_rims(gobj, theme) {
|
|
60527
|
+
let graph = gobj.priv.graph;
|
|
60528
|
+
if (!graph) return;
|
|
60529
|
+
let updates = [];
|
|
60530
|
+
for (let nd of graph.getNodeData() || []) {
|
|
60531
|
+
if (!nd || !nd.style || !(0, _yuneta_gobj_js.is_array)(nd.style.ports) || !nd.style.ports.length) continue;
|
|
60532
|
+
updates.push({
|
|
60533
|
+
id: nd.id,
|
|
60534
|
+
style: { ports: nd.style.ports.map((p) => Object.assign({}, p, { stroke: port_rim(p.fill, theme) })) }
|
|
60535
|
+
});
|
|
60536
|
+
}
|
|
60537
|
+
if (updates.length) try {
|
|
60538
|
+
graph.updateNodeData(updates);
|
|
60539
|
+
} catch (e) {
|
|
60540
|
+
(0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot repaint the port rims: ${e}`);
|
|
60541
|
+
}
|
|
60542
|
+
}
|
|
60543
|
+
/************************************************************
|
|
60462
60544
|
* Repaint the `+N` chips (theme or language changed).
|
|
60463
60545
|
************************************************************/
|
|
60464
60546
|
function repaint_more_chips(gobj) {
|
|
@@ -60780,7 +60862,12 @@ function ac_theme$1(gobj, event, kw, src) {
|
|
|
60780
60862
|
});
|
|
60781
60863
|
refresh_html_nodes_theme(gobj, theme);
|
|
60782
60864
|
refresh_default_edges_theme(gobj, theme);
|
|
60865
|
+
refresh_port_rims(gobj, theme);
|
|
60783
60866
|
repaint_more_chips(gobj);
|
|
60867
|
+
if (graph_get_plugin(gobj, "minimap")) {
|
|
60868
|
+
graph_remove_plugin(gobj, "minimap");
|
|
60869
|
+
refresh_minimap(gobj);
|
|
60870
|
+
}
|
|
60784
60871
|
graph_draw(gobj).then(() => {
|
|
60785
60872
|
update_history_buttons(gobj);
|
|
60786
60873
|
});
|
package/dist/gobj-ui.es.js
CHANGED
|
@@ -54567,8 +54567,16 @@ ensure_pinch_zoom_patch();
|
|
|
54567
54567
|
* Constants
|
|
54568
54568
|
***************************************************************/
|
|
54569
54569
|
var GCLASS_NAME$4 = "C_G6_NODES_TREE";
|
|
54570
|
-
var
|
|
54571
|
-
var
|
|
54570
|
+
var HIGHLIGHT_COLOR_DARK = "#f0a020";
|
|
54571
|
+
var HIGHLIGHT_COLOR_LIGHT = "#b45309";
|
|
54572
|
+
var HIGHLIGHT_HALO_DARK = "rgba(240,160,32,0.35)";
|
|
54573
|
+
var HIGHLIGHT_HALO_LIGHT = "rgba(180,83,9,0.35)";
|
|
54574
|
+
function highlight_color(theme) {
|
|
54575
|
+
return theme === "dark" ? HIGHLIGHT_COLOR_DARK : HIGHLIGHT_COLOR_LIGHT;
|
|
54576
|
+
}
|
|
54577
|
+
function highlight_halo(theme) {
|
|
54578
|
+
return theme === "dark" ? HIGHLIGHT_HALO_DARK : HIGHLIGHT_HALO_LIGHT;
|
|
54579
|
+
}
|
|
54572
54580
|
var SELECT_RING = "rgba(59,130,246,0.95)";
|
|
54573
54581
|
var PORT_R_ENTITY = 14;
|
|
54574
54582
|
var PORT_R_CHILD = 8;
|
|
@@ -55486,6 +55494,53 @@ function calculate_hooks_fkeys_counter(desc) {
|
|
|
55486
55494
|
/************************************************************
|
|
55487
55495
|
* Build ports for a topic desc
|
|
55488
55496
|
************************************************************/
|
|
55497
|
+
/************************************************************
|
|
55498
|
+
* Mix two colours the way `color-mix(in srgb, a p%, b)` does,
|
|
55499
|
+
* in JS.
|
|
55500
|
+
*
|
|
55501
|
+
* The cards are html and can say `color-mix()`; a PORT is drawn
|
|
55502
|
+
* on the canvas by `@antv/g`, which parses a colour string and
|
|
55503
|
+
* knows nothing about CSS functions -- so the same arithmetic
|
|
55504
|
+
* has to happen here.
|
|
55505
|
+
************************************************************/
|
|
55506
|
+
function mix_colors(a, p, b) {
|
|
55507
|
+
let rgb = (c) => {
|
|
55508
|
+
if (c.charAt(0) === "#") {
|
|
55509
|
+
let h = c.slice(1);
|
|
55510
|
+
if (h.length === 3) h = h.split("").map((x) => x + x).join("");
|
|
55511
|
+
return [
|
|
55512
|
+
0,
|
|
55513
|
+
2,
|
|
55514
|
+
4
|
|
55515
|
+
].map((i) => parseInt(h.slice(i, i + 2), 16));
|
|
55516
|
+
}
|
|
55517
|
+
return (c.match(/[\d.]+/g) || []).map(Number).slice(0, 3);
|
|
55518
|
+
};
|
|
55519
|
+
let A = rgb(a);
|
|
55520
|
+
let B = rgb(b);
|
|
55521
|
+
return `rgb(${A.map((v, i) => Math.round(v * p + B[i] * (1 - p))).join(",")})`;
|
|
55522
|
+
}
|
|
55523
|
+
/************************************************************
|
|
55524
|
+
* The rim of a port.
|
|
55525
|
+
*
|
|
55526
|
+
* A port is a knob half on a CARD and half on the canvas, and
|
|
55527
|
+
* the card is a tint of a topic colour -- so a port of that
|
|
55528
|
+
* same topic used to sit on its own colour: 2.62:1 against the
|
|
55529
|
+
* card in dark, 1.54 in light, where a graphical object needs
|
|
55530
|
+
* 3:1 to be told from what is next to it. The FILL keeps saying
|
|
55531
|
+
* which topic links there; the rim is what separates it, and it
|
|
55532
|
+
* is the port's own colour pushed towards the surface -- 60% of
|
|
55533
|
+
* the hue is enough to clear 3:1 on both grounds in both
|
|
55534
|
+
* themes (4.49 / 3.64 against the card, 9.11 / 3.80 against the
|
|
55535
|
+
* canvas) and little enough to keep the hue.
|
|
55536
|
+
*
|
|
55537
|
+
* It used to be `getStrokeColor(color)` called with no theme,
|
|
55538
|
+
* which is its LIGHT branch always: a rim darkened by 20% of a
|
|
55539
|
+
* colour, on a card of the same colour.
|
|
55540
|
+
************************************************************/
|
|
55541
|
+
function port_rim(color, theme) {
|
|
55542
|
+
return mix_colors(color, .6, theme === "dark" ? "#ffffff" : "#0f172a");
|
|
55543
|
+
}
|
|
55489
55544
|
function build_ports(gobj, desc) {
|
|
55490
55545
|
let priv = gobj.priv;
|
|
55491
55546
|
let top_ports = [];
|
|
@@ -55504,7 +55559,7 @@ function build_ports(gobj, desc) {
|
|
|
55504
55559
|
port = {
|
|
55505
55560
|
key: col.id,
|
|
55506
55561
|
fill: child_desc ? child_desc.color : desc.color,
|
|
55507
|
-
stroke:
|
|
55562
|
+
stroke: port_rim(child_desc ? child_desc.color : desc.color, priv.theme)
|
|
55508
55563
|
};
|
|
55509
55564
|
bottom_ports.push(port);
|
|
55510
55565
|
}
|
|
@@ -55513,7 +55568,7 @@ function build_ports(gobj, desc) {
|
|
|
55513
55568
|
port = {
|
|
55514
55569
|
key: col.id,
|
|
55515
55570
|
fill: desc.color,
|
|
55516
|
-
stroke:
|
|
55571
|
+
stroke: port_rim(desc.color, priv.theme)
|
|
55517
55572
|
};
|
|
55518
55573
|
top_ports.push(port);
|
|
55519
55574
|
}
|
|
@@ -55874,7 +55929,8 @@ function node_figure_of(gobj, desc, geometry) {
|
|
|
55874
55929
|
* flags {highlight, selected, anchored}
|
|
55875
55930
|
************************************************************/
|
|
55876
55931
|
function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
55877
|
-
let
|
|
55932
|
+
let priv = gobj.priv;
|
|
55933
|
+
let dark = priv.theme === "dark";
|
|
55878
55934
|
let f = flags || {};
|
|
55879
55935
|
let tier = desc.node_treedb_type;
|
|
55880
55936
|
let side = SHAPE_SIZE[tier] || SHAPE_SIZE.hierarchical;
|
|
@@ -55888,7 +55944,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
|
55888
55944
|
line_width = 3;
|
|
55889
55945
|
}
|
|
55890
55946
|
if (f.highlight) {
|
|
55891
|
-
stroke =
|
|
55947
|
+
stroke = highlight_color(priv.theme);
|
|
55892
55948
|
line_width = 3;
|
|
55893
55949
|
}
|
|
55894
55950
|
let dash = [];
|
|
@@ -55905,7 +55961,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags) {
|
|
|
55905
55961
|
lineWidth: line_width,
|
|
55906
55962
|
lineDash: dash,
|
|
55907
55963
|
halo: !!f.highlight,
|
|
55908
|
-
haloStroke:
|
|
55964
|
+
haloStroke: highlight_halo(priv.theme),
|
|
55909
55965
|
haloLineWidth: 8,
|
|
55910
55966
|
port: false,
|
|
55911
55967
|
ports: [],
|
|
@@ -58915,12 +58971,13 @@ function auto_layout(gobj) {
|
|
|
58915
58971
|
* Its shapes are drawn by hand. G6's minimap clones each element's key
|
|
58916
58972
|
* shape into its own canvas, and every node here is an `html` node
|
|
58917
58973
|
* whose key shape is a DOM element — the same reason the `active`
|
|
58918
|
-
* state never painted (see
|
|
58974
|
+
* state never painted (see highlight_color()). A block in the topic's
|
|
58919
58975
|
* colour is also what a minimap of cards SHOULD show: at that scale a
|
|
58920
58976
|
* card is a rectangle anyway.
|
|
58921
58977
|
************************************************************/
|
|
58922
58978
|
function refresh_minimap(gobj) {
|
|
58923
|
-
let
|
|
58979
|
+
let priv = gobj.priv;
|
|
58980
|
+
let graph = priv.graph;
|
|
58924
58981
|
if (!graph) return;
|
|
58925
58982
|
let threshold = gobj_read_integer_attr(gobj, "minimap_min_nodes");
|
|
58926
58983
|
let n = 0;
|
|
@@ -58943,12 +59000,12 @@ function refresh_minimap(gobj) {
|
|
|
58943
59000
|
bottom: "12px",
|
|
58944
59001
|
left: "12px",
|
|
58945
59002
|
background: "var(--bulma-scheme-main, #fff)",
|
|
58946
|
-
border: "1px solid var(--bulma-
|
|
59003
|
+
border: "1px solid var(--bulma-text-weak, #94a3b8)",
|
|
58947
59004
|
borderRadius: "6px",
|
|
58948
59005
|
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)"
|
|
58949
59006
|
},
|
|
58950
59007
|
maskStyle: {
|
|
58951
|
-
border: "2px solid var(--bulma-link, #3b82f6)",
|
|
59008
|
+
border: "2px solid var(--bulma-link-on-scheme, var(--bulma-link, #3b82f6))",
|
|
58952
59009
|
background: "rgba(59, 130, 246, 0.12)"
|
|
58953
59010
|
},
|
|
58954
59011
|
shape: (id, element_type, element) => {
|
|
@@ -58956,8 +59013,8 @@ function refresh_minimap(gobj) {
|
|
|
58956
59013
|
try {
|
|
58957
59014
|
let nd = graph.getNodeData(id);
|
|
58958
59015
|
let size = nd && nd.style && nd.style.size || [120, 60];
|
|
58959
|
-
let color = nd && nd.data && nd.data.desc && nd.data.desc.color || "#94a3b8";
|
|
58960
|
-
if (is_more_node(nd)) color = "rgba(148, 163, 184, 0.
|
|
59016
|
+
let color = port_rim(nd && nd.data && nd.data.desc && nd.data.desc.color || "#94a3b8", priv.theme);
|
|
59017
|
+
if (is_more_node(nd)) color = priv.theme === "dark" ? "rgba(148, 163, 184, 0.60)" : "rgba(71, 85, 105, 0.65)";
|
|
58961
59018
|
return new Rect({ style: {
|
|
58962
59019
|
x: -size[0] / 2,
|
|
58963
59020
|
y: -size[1] / 2,
|
|
@@ -59138,9 +59195,9 @@ function refresh_default_edges_theme(gobj, theme) {
|
|
|
59138
59195
|
function anchor_outline(anchored) {
|
|
59139
59196
|
return anchored ? "outline: 3px dashed #fa8c16; outline-offset: 2px;" : "";
|
|
59140
59197
|
}
|
|
59141
|
-
function ring_shadow(highlight, selected, base_shadow) {
|
|
59198
|
+
function ring_shadow(highlight, selected, base_shadow, theme) {
|
|
59142
59199
|
let rings = [];
|
|
59143
|
-
if (highlight) rings.push(`0 0 0 4px ${
|
|
59200
|
+
if (highlight) rings.push(`0 0 0 4px ${highlight_halo(theme)}`);
|
|
59144
59201
|
if (selected) rings.push(`0 0 0 ${highlight ? "7px" : "3px"} ${SELECT_RING}`);
|
|
59145
59202
|
if (base_shadow) rings.push(base_shadow);
|
|
59146
59203
|
if (!rings.length) return "";
|
|
@@ -59155,10 +59212,10 @@ function ring_shadow(highlight, selected, base_shadow) {
|
|
|
59155
59212
|
function build_chip_innerHTML(color, theme, icon, label, key, highlight, selected, anchored) {
|
|
59156
59213
|
let title = key || label;
|
|
59157
59214
|
let dark = theme === "dark";
|
|
59158
|
-
let bg = dark ? `color-mix(in srgb, ${color}
|
|
59215
|
+
let bg = dark ? `color-mix(in srgb, ${color} 25%, #2c3542)` : `color-mix(in srgb, ${color} 10%, ${dark ? "#1b2230" : "#ffffff"})`;
|
|
59159
59216
|
let border = dark ? `color-mix(in srgb, ${color} 85%, #ffffff)` : color;
|
|
59160
59217
|
let text_color = dark ? "#e8eaed" : "#0f172a";
|
|
59161
|
-
if (highlight) border =
|
|
59218
|
+
if (highlight) border = highlight_color(theme);
|
|
59162
59219
|
let icon_html = "";
|
|
59163
59220
|
if (icon) icon_html = `<img src="${safeSrc(icon)}" alt="" style="
|
|
59164
59221
|
width: 16px; height: 16px; object-fit: contain;
|
|
@@ -59171,7 +59228,7 @@ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selecte
|
|
|
59171
59228
|
height: 100%;
|
|
59172
59229
|
background: ${bg};
|
|
59173
59230
|
border: ${highlight ? "3px" : "1px"} solid ${border};
|
|
59174
|
-
${ring_shadow(highlight, selected, "")}
|
|
59231
|
+
${ring_shadow(highlight, selected, "", theme)}
|
|
59175
59232
|
${anchor_outline(anchored)}
|
|
59176
59233
|
border-radius: 8px;
|
|
59177
59234
|
color: ${text_color};
|
|
@@ -59213,7 +59270,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
|
|
|
59213
59270
|
border_style = "solid";
|
|
59214
59271
|
}
|
|
59215
59272
|
if (highlight) {
|
|
59216
|
-
border =
|
|
59273
|
+
border = highlight_color(theme);
|
|
59217
59274
|
border_style = "solid";
|
|
59218
59275
|
}
|
|
59219
59276
|
let title_color = dark ? "#e8eaed" : "#0f172a";
|
|
@@ -59246,7 +59303,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
|
|
|
59246
59303
|
background: ${bg};
|
|
59247
59304
|
border: ${highlight ? "3px" : "1.5px"} ${border_style} ${border};
|
|
59248
59305
|
border-radius: 10px;
|
|
59249
|
-
${ring_shadow(highlight, selected, shadow)}
|
|
59306
|
+
${ring_shadow(highlight, selected, shadow, theme)}
|
|
59250
59307
|
${anchor_outline(anchored)}
|
|
59251
59308
|
color: ${title_color};
|
|
59252
59309
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -60387,7 +60444,7 @@ async function reconcile_fold_apply(gobj, opts, visible) {
|
|
|
60387
60444
|
sourcePort: p.hook,
|
|
60388
60445
|
lineWidth: 1,
|
|
60389
60446
|
lineDash: [4, 3],
|
|
60390
|
-
stroke: dark ? "#8b94a3" : "#
|
|
60447
|
+
stroke: dark ? "#8b94a3" : "#6b7280",
|
|
60391
60448
|
startArrow: false,
|
|
60392
60449
|
endArrow: false
|
|
60393
60450
|
},
|
|
@@ -60454,6 +60511,31 @@ function ac_language_changed$3(gobj, event, kw, src) {
|
|
|
60454
60511
|
return 0;
|
|
60455
60512
|
}
|
|
60456
60513
|
/************************************************************
|
|
60514
|
+
* The rims of every port, on a theme change.
|
|
60515
|
+
*
|
|
60516
|
+
* A rim is half of the surface it sits on (see port_rim), so it
|
|
60517
|
+
* belongs to the theme -- and it lives in each node's
|
|
60518
|
+
* `style.ports`, which is the one place refresh_html_nodes_theme()
|
|
60519
|
+
* does not reach: it rebuilds the html INSIDE a card.
|
|
60520
|
+
************************************************************/
|
|
60521
|
+
function refresh_port_rims(gobj, theme) {
|
|
60522
|
+
let graph = gobj.priv.graph;
|
|
60523
|
+
if (!graph) return;
|
|
60524
|
+
let updates = [];
|
|
60525
|
+
for (let nd of graph.getNodeData() || []) {
|
|
60526
|
+
if (!nd || !nd.style || !is_array(nd.style.ports) || !nd.style.ports.length) continue;
|
|
60527
|
+
updates.push({
|
|
60528
|
+
id: nd.id,
|
|
60529
|
+
style: { ports: nd.style.ports.map((p) => Object.assign({}, p, { stroke: port_rim(p.fill, theme) })) }
|
|
60530
|
+
});
|
|
60531
|
+
}
|
|
60532
|
+
if (updates.length) try {
|
|
60533
|
+
graph.updateNodeData(updates);
|
|
60534
|
+
} catch (e) {
|
|
60535
|
+
log_error(`${gobj_short_name(gobj)}: cannot repaint the port rims: ${e}`);
|
|
60536
|
+
}
|
|
60537
|
+
}
|
|
60538
|
+
/************************************************************
|
|
60457
60539
|
* Repaint the `+N` chips (theme or language changed).
|
|
60458
60540
|
************************************************************/
|
|
60459
60541
|
function repaint_more_chips(gobj) {
|
|
@@ -60775,7 +60857,12 @@ function ac_theme$1(gobj, event, kw, src) {
|
|
|
60775
60857
|
});
|
|
60776
60858
|
refresh_html_nodes_theme(gobj, theme);
|
|
60777
60859
|
refresh_default_edges_theme(gobj, theme);
|
|
60860
|
+
refresh_port_rims(gobj, theme);
|
|
60778
60861
|
repaint_more_chips(gobj);
|
|
60862
|
+
if (graph_get_plugin(gobj, "minimap")) {
|
|
60863
|
+
graph_remove_plugin(gobj, "minimap");
|
|
60864
|
+
refresh_minimap(gobj);
|
|
60865
|
+
}
|
|
60779
60866
|
graph_draw(gobj).then(() => {
|
|
60780
60867
|
update_history_buttons(gobj);
|
|
60781
60868
|
});
|
package/package.json
CHANGED
package/src/c_g6_nodes_tree.js
CHANGED
|
@@ -240,8 +240,27 @@ const GCLASS_NAME = "C_G6_NODES_TREE";
|
|
|
240
240
|
* is an `html` node, whose key shape is a DOM element — the state's
|
|
241
241
|
* `stroke` / `halo` have nothing to paint on and the amber never
|
|
242
242
|
* appeared, for the topic focus either. */
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
/* The mark of a focused topic and of a find: one amber for a
|
|
244
|
+
* near-black canvas (8.41:1) which on a WHITE one is 2.15 -- under
|
|
245
|
+
* the 3:1 a graphical mark needs, and this one is the whole answer
|
|
246
|
+
* to "which nodes matched". The light scheme takes the same hue
|
|
247
|
+
* burnt down (5.02:1); the halo follows it at the same alpha. Same
|
|
248
|
+
* rule as a brand colour used as ink: the colour that carries a
|
|
249
|
+
* mark is not one colour, it is one per scheme. */
|
|
250
|
+
const HIGHLIGHT_COLOR_DARK = "#f0a020";
|
|
251
|
+
const HIGHLIGHT_COLOR_LIGHT = "#b45309";
|
|
252
|
+
const HIGHLIGHT_HALO_DARK = "rgba(240,160,32,0.35)";
|
|
253
|
+
const HIGHLIGHT_HALO_LIGHT = "rgba(180,83,9,0.35)";
|
|
254
|
+
|
|
255
|
+
function highlight_color(theme)
|
|
256
|
+
{
|
|
257
|
+
return (theme === "dark")? HIGHLIGHT_COLOR_DARK : HIGHLIGHT_COLOR_LIGHT;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function highlight_halo(theme)
|
|
261
|
+
{
|
|
262
|
+
return (theme === "dark")? HIGHLIGHT_HALO_DARK : HIGHLIGHT_HALO_LIGHT;
|
|
263
|
+
}
|
|
245
264
|
|
|
246
265
|
/*
|
|
247
266
|
* The selection ring. Deliberately NOT the amber of the highlight:
|
|
@@ -1807,6 +1826,56 @@ function calculate_hooks_fkeys_counter(desc)
|
|
|
1807
1826
|
/************************************************************
|
|
1808
1827
|
* Build ports for a topic desc
|
|
1809
1828
|
************************************************************/
|
|
1829
|
+
/************************************************************
|
|
1830
|
+
* Mix two colours the way `color-mix(in srgb, a p%, b)` does,
|
|
1831
|
+
* in JS.
|
|
1832
|
+
*
|
|
1833
|
+
* The cards are html and can say `color-mix()`; a PORT is drawn
|
|
1834
|
+
* on the canvas by `@antv/g`, which parses a colour string and
|
|
1835
|
+
* knows nothing about CSS functions -- so the same arithmetic
|
|
1836
|
+
* has to happen here.
|
|
1837
|
+
************************************************************/
|
|
1838
|
+
function mix_colors(a, p, b)
|
|
1839
|
+
{
|
|
1840
|
+
let rgb = (c) => {
|
|
1841
|
+
if(c.charAt(0) === "#") {
|
|
1842
|
+
let h = c.slice(1);
|
|
1843
|
+
if(h.length === 3) {
|
|
1844
|
+
h = h.split("").map((x) => x + x).join("");
|
|
1845
|
+
}
|
|
1846
|
+
return [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16));
|
|
1847
|
+
}
|
|
1848
|
+
let n = (c.match(/[\d.]+/g) || []).map(Number);
|
|
1849
|
+
return n.slice(0, 3);
|
|
1850
|
+
};
|
|
1851
|
+
let A = rgb(a);
|
|
1852
|
+
let B = rgb(b);
|
|
1853
|
+
return `rgb(${A.map((v, i) => Math.round(v * p + B[i] * (1 - p))).join(",")})`;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
/************************************************************
|
|
1857
|
+
* The rim of a port.
|
|
1858
|
+
*
|
|
1859
|
+
* A port is a knob half on a CARD and half on the canvas, and
|
|
1860
|
+
* the card is a tint of a topic colour -- so a port of that
|
|
1861
|
+
* same topic used to sit on its own colour: 2.62:1 against the
|
|
1862
|
+
* card in dark, 1.54 in light, where a graphical object needs
|
|
1863
|
+
* 3:1 to be told from what is next to it. The FILL keeps saying
|
|
1864
|
+
* which topic links there; the rim is what separates it, and it
|
|
1865
|
+
* is the port's own colour pushed towards the surface -- 60% of
|
|
1866
|
+
* the hue is enough to clear 3:1 on both grounds in both
|
|
1867
|
+
* themes (4.49 / 3.64 against the card, 9.11 / 3.80 against the
|
|
1868
|
+
* canvas) and little enough to keep the hue.
|
|
1869
|
+
*
|
|
1870
|
+
* It used to be `getStrokeColor(color)` called with no theme,
|
|
1871
|
+
* which is its LIGHT branch always: a rim darkened by 20% of a
|
|
1872
|
+
* colour, on a card of the same colour.
|
|
1873
|
+
************************************************************/
|
|
1874
|
+
function port_rim(color, theme)
|
|
1875
|
+
{
|
|
1876
|
+
return mix_colors(color, 0.6, (theme === "dark")? "#ffffff" : "#0f172a");
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1810
1879
|
function build_ports(gobj, desc)
|
|
1811
1880
|
{
|
|
1812
1881
|
let priv = gobj.priv;
|
|
@@ -1833,7 +1902,7 @@ function build_ports(gobj, desc)
|
|
|
1833
1902
|
port = {
|
|
1834
1903
|
key: col.id,
|
|
1835
1904
|
fill: child_desc?child_desc.color:desc.color,
|
|
1836
|
-
stroke:
|
|
1905
|
+
stroke: port_rim(child_desc?child_desc.color:desc.color, priv.theme),
|
|
1837
1906
|
};
|
|
1838
1907
|
bottom_ports.push(port);
|
|
1839
1908
|
}
|
|
@@ -1844,7 +1913,7 @@ function build_ports(gobj, desc)
|
|
|
1844
1913
|
port = {
|
|
1845
1914
|
key: col.id,
|
|
1846
1915
|
fill: desc.color,
|
|
1847
|
-
stroke:
|
|
1916
|
+
stroke: port_rim(desc.color, priv.theme),
|
|
1848
1917
|
};
|
|
1849
1918
|
top_ports.push(port);
|
|
1850
1919
|
break;
|
|
@@ -2374,7 +2443,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags)
|
|
|
2374
2443
|
line_width = 3;
|
|
2375
2444
|
}
|
|
2376
2445
|
if(f.highlight) {
|
|
2377
|
-
stroke =
|
|
2446
|
+
stroke = highlight_color(priv.theme);
|
|
2378
2447
|
line_width = 3;
|
|
2379
2448
|
}
|
|
2380
2449
|
/* Dashed says "structural", as the extended card does; the
|
|
@@ -2396,7 +2465,7 @@ function figure_shape_of(gobj, desc, record, geometry, flags)
|
|
|
2396
2465
|
lineWidth: line_width,
|
|
2397
2466
|
lineDash: dash,
|
|
2398
2467
|
halo: !!f.highlight,
|
|
2399
|
-
haloStroke:
|
|
2468
|
+
haloStroke: highlight_halo(priv.theme),
|
|
2400
2469
|
haloLineWidth: 8,
|
|
2401
2470
|
port: false,
|
|
2402
2471
|
ports: [],
|
|
@@ -6854,7 +6923,7 @@ function auto_layout(gobj)
|
|
|
6854
6923
|
* Its shapes are drawn by hand. G6's minimap clones each element's key
|
|
6855
6924
|
* shape into its own canvas, and every node here is an `html` node
|
|
6856
6925
|
* whose key shape is a DOM element — the same reason the `active`
|
|
6857
|
-
* state never painted (see
|
|
6926
|
+
* state never painted (see highlight_color()). A block in the topic's
|
|
6858
6927
|
* colour is also what a minimap of cards SHOULD show: at that scale a
|
|
6859
6928
|
* card is a rectangle anyway.
|
|
6860
6929
|
************************************************************/
|
|
@@ -6916,7 +6985,16 @@ function refresh_minimap(gobj)
|
|
|
6916
6985
|
bottom: "12px",
|
|
6917
6986
|
left: "12px",
|
|
6918
6987
|
background: "var(--bulma-scheme-main, #fff)",
|
|
6919
|
-
|
|
6988
|
+
/* A mid grey and not a `--bulma-border-*` token: those
|
|
6989
|
+
* are made for a line INSIDE a surface, and this one has
|
|
6990
|
+
* to separate a floating panel from the CANVAS behind
|
|
6991
|
+
* it -- which is near-black in one scheme and white in
|
|
6992
|
+
* the other. `border-weak` was 1.43:1 over the dark
|
|
6993
|
+
* canvas and 1.18 over the light one; every border token
|
|
6994
|
+
* fails at least one of them. This one is 4.6 on both.
|
|
6995
|
+
* (The box-shadow below separates it only where there
|
|
6996
|
+
* is light to cast a shadow on.) */
|
|
6997
|
+
border: "1px solid var(--bulma-text-weak, #94a3b8)",
|
|
6920
6998
|
borderRadius: "6px",
|
|
6921
6999
|
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)",
|
|
6922
7000
|
},
|
|
@@ -6924,7 +7002,7 @@ function refresh_minimap(gobj)
|
|
|
6924
7002
|
* invisible over a dark minimap. A link-coloured outline
|
|
6925
7003
|
* reads on both. */
|
|
6926
7004
|
maskStyle: {
|
|
6927
|
-
border: "2px solid var(--bulma-link, #3b82f6)",
|
|
7005
|
+
border: "2px solid var(--bulma-link-on-scheme, var(--bulma-link, #3b82f6))",
|
|
6928
7006
|
background: "rgba(59, 130, 246, 0.12)",
|
|
6929
7007
|
},
|
|
6930
7008
|
shape: (id, element_type, element) => {
|
|
@@ -6934,12 +7012,24 @@ function refresh_minimap(gobj)
|
|
|
6934
7012
|
try {
|
|
6935
7013
|
let nd = graph.getNodeData(id);
|
|
6936
7014
|
let size = (nd && nd.style && nd.style.size) || [120, 60];
|
|
6937
|
-
|
|
6938
|
-
|
|
7015
|
+
/* The topic's colour PUSHED TOWARDS THE SURFACE, the
|
|
7016
|
+
* same treatment a port's rim takes: a block here is
|
|
7017
|
+
* the topic colour on the panel's own background, and
|
|
7018
|
+
* on the light scheme the palette's yellow was 1.61:1
|
|
7019
|
+
* on white -- a minimap whose content could not be
|
|
7020
|
+
* told from its paper. 3.80 in light, 9.11 in dark. */
|
|
7021
|
+
let color = port_rim(
|
|
7022
|
+
(nd && nd.data && nd.data.desc && nd.data.desc.color) || "#94a3b8",
|
|
7023
|
+
priv.theme
|
|
7024
|
+
);
|
|
6939
7025
|
if(is_more_node(nd)) {
|
|
6940
|
-
/* A `+N` chip is a cut, not a card: a
|
|
6941
|
-
*
|
|
6942
|
-
|
|
7026
|
+
/* A `+N` chip is a cut, not a card: quieter than a
|
|
7027
|
+
* block, and still visible. The slate had to become
|
|
7028
|
+
* a DARK slate on a white panel -- raising the alpha
|
|
7029
|
+
* of the light one only ever reached 1.86. */
|
|
7030
|
+
color = (priv.theme === "dark")
|
|
7031
|
+
? "rgba(148, 163, 184, 0.60)" /* 3.35:1 */
|
|
7032
|
+
: "rgba(71, 85, 105, 0.65)"; /* 3.19:1 */
|
|
6943
7033
|
}
|
|
6944
7034
|
return new RectGeometry({
|
|
6945
7035
|
style: {
|
|
@@ -7194,12 +7284,12 @@ function anchor_outline(anchored)
|
|
|
7194
7284
|
return anchored? "outline: 3px dashed #fa8c16; outline-offset: 2px;" : "";
|
|
7195
7285
|
}
|
|
7196
7286
|
|
|
7197
|
-
function ring_shadow(highlight, selected, base_shadow)
|
|
7287
|
+
function ring_shadow(highlight, selected, base_shadow, theme)
|
|
7198
7288
|
{
|
|
7199
7289
|
let rings = [];
|
|
7200
7290
|
|
|
7201
7291
|
if(highlight) {
|
|
7202
|
-
rings.push(`0 0 0 4px ${
|
|
7292
|
+
rings.push(`0 0 0 4px ${highlight_halo(theme)}`);
|
|
7203
7293
|
}
|
|
7204
7294
|
if(selected) {
|
|
7205
7295
|
rings.push(`0 0 0 ${highlight? "7px" : "3px"} ${SELECT_RING}`);
|
|
@@ -7225,15 +7315,18 @@ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selecte
|
|
|
7225
7315
|
let title = key || label;
|
|
7226
7316
|
let dark = (theme === "dark");
|
|
7227
7317
|
let surface = dark ? "#1b2230" : "#ffffff";
|
|
7318
|
+
/* The same 25% as the card (build_node_innerHTML): a leaf chip and
|
|
7319
|
+
* the card it hangs from are side by side, and two tints of one
|
|
7320
|
+
* colour read as two topics. */
|
|
7228
7321
|
let bg = dark
|
|
7229
|
-
? `color-mix(in srgb, ${color}
|
|
7322
|
+
? `color-mix(in srgb, ${color} 25%, #2c3542)`
|
|
7230
7323
|
: `color-mix(in srgb, ${color} 10%, ${surface})`;
|
|
7231
7324
|
let border = dark
|
|
7232
7325
|
? `color-mix(in srgb, ${color} 85%, #ffffff)`
|
|
7233
7326
|
: color;
|
|
7234
7327
|
let text_color = dark ? "#e8eaed" : "#0f172a";
|
|
7235
7328
|
if(highlight) {
|
|
7236
|
-
border =
|
|
7329
|
+
border = highlight_color(theme);
|
|
7237
7330
|
}
|
|
7238
7331
|
|
|
7239
7332
|
let icon_html = "";
|
|
@@ -7251,7 +7344,7 @@ function build_chip_innerHTML(color, theme, icon, label, key, highlight, selecte
|
|
|
7251
7344
|
height: 100%;
|
|
7252
7345
|
background: ${bg};
|
|
7253
7346
|
border: ${highlight? "3px" : "1px"} solid ${border};
|
|
7254
|
-
${ring_shadow(highlight, selected, "")}
|
|
7347
|
+
${ring_shadow(highlight, selected, "", theme)}
|
|
7255
7348
|
${anchor_outline(anchored)}
|
|
7256
7349
|
border-radius: 8px;
|
|
7257
7350
|
color: ${text_color};
|
|
@@ -7312,7 +7405,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
|
|
|
7312
7405
|
border_style = "solid";
|
|
7313
7406
|
}
|
|
7314
7407
|
if(highlight) {
|
|
7315
|
-
border =
|
|
7408
|
+
border = highlight_color(theme);
|
|
7316
7409
|
border_style = "solid";
|
|
7317
7410
|
}
|
|
7318
7411
|
let title_color = dark ? "#e8eaed" : "#0f172a";
|
|
@@ -7365,7 +7458,7 @@ function build_node_innerHTML(color, theme, icon, label, topic_name, structural,
|
|
|
7365
7458
|
background: ${bg};
|
|
7366
7459
|
border: ${highlight? "3px" : "1.5px"} ${border_style} ${border};
|
|
7367
7460
|
border-radius: 10px;
|
|
7368
|
-
${ring_shadow(highlight, selected, shadow)}
|
|
7461
|
+
${ring_shadow(highlight, selected, shadow, theme)}
|
|
7369
7462
|
${anchor_outline(anchored)}
|
|
7370
7463
|
color: ${title_color};
|
|
7371
7464
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -9084,7 +9177,11 @@ async function reconcile_fold_apply(gobj, opts, visible)
|
|
|
9084
9177
|
sourcePort: p.hook,
|
|
9085
9178
|
lineWidth: 1,
|
|
9086
9179
|
lineDash: [4, 3],
|
|
9087
|
-
|
|
9180
|
+
/* The same grey as a cross link (refresh_default_edges_theme):
|
|
9181
|
+
* `#94a3b8` on a white canvas is 2.56:1, under the 3:1 a
|
|
9182
|
+
* line needs to be seen at all. The DASH is what says
|
|
9183
|
+
* this one leads to a cut, not the colour. */
|
|
9184
|
+
stroke: dark? '#8b94a3' : '#6b7280',
|
|
9088
9185
|
startArrow: false,
|
|
9089
9186
|
endArrow: false,
|
|
9090
9187
|
},
|
|
@@ -9173,6 +9270,40 @@ function ac_language_changed(gobj, event, kw, src)
|
|
|
9173
9270
|
return 0;
|
|
9174
9271
|
}
|
|
9175
9272
|
|
|
9273
|
+
/************************************************************
|
|
9274
|
+
* The rims of every port, on a theme change.
|
|
9275
|
+
*
|
|
9276
|
+
* A rim is half of the surface it sits on (see port_rim), so it
|
|
9277
|
+
* belongs to the theme -- and it lives in each node's
|
|
9278
|
+
* `style.ports`, which is the one place refresh_html_nodes_theme()
|
|
9279
|
+
* does not reach: it rebuilds the html INSIDE a card.
|
|
9280
|
+
************************************************************/
|
|
9281
|
+
function refresh_port_rims(gobj, theme)
|
|
9282
|
+
{
|
|
9283
|
+
let priv = gobj.priv;
|
|
9284
|
+
let graph = priv.graph;
|
|
9285
|
+
|
|
9286
|
+
if(!graph) {
|
|
9287
|
+
return;
|
|
9288
|
+
}
|
|
9289
|
+
let updates = [];
|
|
9290
|
+
for(let nd of (graph.getNodeData() || [])) {
|
|
9291
|
+
if(!nd || !nd.style || !is_array(nd.style.ports) || !nd.style.ports.length) {
|
|
9292
|
+
continue;
|
|
9293
|
+
}
|
|
9294
|
+
updates.push({id: nd.id, style: {ports: nd.style.ports.map((p) =>
|
|
9295
|
+
Object.assign({}, p, {stroke: port_rim(p.fill, theme)})
|
|
9296
|
+
)}});
|
|
9297
|
+
}
|
|
9298
|
+
if(updates.length) {
|
|
9299
|
+
try {
|
|
9300
|
+
graph.updateNodeData(updates);
|
|
9301
|
+
} catch(e) {
|
|
9302
|
+
log_error(`${gobj_short_name(gobj)}: cannot repaint the port rims: ${e}`);
|
|
9303
|
+
}
|
|
9304
|
+
}
|
|
9305
|
+
}
|
|
9306
|
+
|
|
9176
9307
|
/************************************************************
|
|
9177
9308
|
* Repaint the `+N` chips (theme or language changed).
|
|
9178
9309
|
************************************************************/
|
|
@@ -9696,8 +9827,17 @@ function ac_theme(gobj, event, kw, src)
|
|
|
9696
9827
|
|
|
9697
9828
|
refresh_html_nodes_theme(gobj, theme);
|
|
9698
9829
|
refresh_default_edges_theme(gobj, theme);
|
|
9830
|
+
refresh_port_rims(gobj, theme);
|
|
9699
9831
|
repaint_more_chips(gobj);
|
|
9700
9832
|
|
|
9833
|
+
/* The minimap paints its blocks from the theme (see its `shape`),
|
|
9834
|
+
* and it is created ONCE: rebuilt, or it keeps the colours of the
|
|
9835
|
+
* scheme it was born in. */
|
|
9836
|
+
if(graph_get_plugin(gobj, "minimap")) {
|
|
9837
|
+
graph_remove_plugin(gobj, "minimap");
|
|
9838
|
+
refresh_minimap(gobj);
|
|
9839
|
+
}
|
|
9840
|
+
|
|
9701
9841
|
graph_draw(gobj).then(() => {
|
|
9702
9842
|
// Restore toolbar icon states lost when G6 re-renders the DOM
|
|
9703
9843
|
update_history_buttons(gobj);
|