glassbrain 0.2.0-alpha.4 → 0.2.0-alpha.5
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 +5 -1
- package/dist/chunks/{chunk-SEOAVI3E.js → chunk-F4HDKER4.js} +6 -4
- package/dist/chunks/{chunk-YGRPNAXE.js → chunk-OE5IRKWZ.js} +8 -1
- package/dist/chunks/{chunk-R2CQA4OJ.js → chunk-WUBELTBU.js} +85 -142
- package/dist/cli/glassbrain.js +9 -0
- package/dist/cli/viewer.js +44 -44
- package/dist/core.js +3 -1
- package/dist/elements.d.ts +2 -0
- package/dist/index.js +5 -3
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +7 -3
- package/dist/layout/engine.d.ts +3 -1
- package/dist/layout/inline-pool.js +1 -1
- package/dist/layout/order.d.ts +9 -5
- package/dist/layout/worker.js +7 -1
- package/dist/paint.d.ts +2 -0
- package/dist/react/GraphCanvas.d.ts +5 -2
- package/dist/react/GraphCanvas.js +3 -3
- package/dist/react/Toolbar.d.ts +2 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
defineProfile,
|
|
44
44
|
diffModels,
|
|
45
45
|
diffStyle,
|
|
46
|
+
edgeKindClass,
|
|
46
47
|
edgesOf,
|
|
47
48
|
encodeParent,
|
|
48
49
|
graphStyle,
|
|
@@ -77,7 +78,7 @@ import {
|
|
|
77
78
|
untheme,
|
|
78
79
|
validateModel,
|
|
79
80
|
validateStructure
|
|
80
|
-
} from "./chunks/chunk-
|
|
81
|
+
} from "./chunks/chunk-F4HDKER4.js";
|
|
81
82
|
import {
|
|
82
83
|
EN
|
|
83
84
|
} from "./chunks/chunk-ISWKAU5G.js";
|
|
@@ -124,6 +125,7 @@ export {
|
|
|
124
125
|
deriveLayers,
|
|
125
126
|
diffModels,
|
|
126
127
|
diffStyle,
|
|
128
|
+
edgeKindClass,
|
|
127
129
|
edgesOf,
|
|
128
130
|
encodeParent,
|
|
129
131
|
graphStyle,
|
package/dist/elements.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare const RESERVED_CLASSES: readonly ["container", "crosslayer", "con
|
|
|
12
12
|
* must build selectors with the same rule, or input like "a kind with a space" would compute two different
|
|
13
13
|
* names in two places, and neither would select the other. */
|
|
14
14
|
export declare const cls: (s: string) => string;
|
|
15
|
+
/** Legacy semantic contains must never acquire the structural skeleton class. */
|
|
16
|
+
export declare const edgeKindClass: (kind: string) => string;
|
|
15
17
|
/**
|
|
16
18
|
* A node's **skin**: what it looks like is decided entirely by this class string (kind / flags / container or not /
|
|
17
19
|
* the profile's own part).
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
clearLayoutCache,
|
|
15
15
|
computeLayout,
|
|
16
16
|
projectPlanes
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-WUBELTBU.js";
|
|
18
18
|
import {
|
|
19
19
|
CONTENT_SCALE,
|
|
20
20
|
DARK_THEME,
|
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
defineProfile,
|
|
55
55
|
diffModels,
|
|
56
56
|
diffStyle,
|
|
57
|
+
edgeKindClass,
|
|
57
58
|
edgesOf,
|
|
58
59
|
encodeParent,
|
|
59
60
|
graphStyle,
|
|
@@ -88,7 +89,7 @@ import {
|
|
|
88
89
|
untheme,
|
|
89
90
|
validateModel,
|
|
90
91
|
validateStructure
|
|
91
|
-
} from "./chunks/chunk-
|
|
92
|
+
} from "./chunks/chunk-F4HDKER4.js";
|
|
92
93
|
import {
|
|
93
94
|
DetailPanel,
|
|
94
95
|
renderInline,
|
|
@@ -97,7 +98,7 @@ import {
|
|
|
97
98
|
import {
|
|
98
99
|
EN
|
|
99
100
|
} from "./chunks/chunk-ISWKAU5G.js";
|
|
100
|
-
import "./chunks/chunk-
|
|
101
|
+
import "./chunks/chunk-OE5IRKWZ.js";
|
|
101
102
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
102
103
|
export {
|
|
103
104
|
ALL_CONTROLS,
|
|
@@ -148,6 +149,7 @@ export {
|
|
|
148
149
|
deriveLayers,
|
|
149
150
|
diffModels,
|
|
150
151
|
diffStyle,
|
|
152
|
+
edgeKindClass,
|
|
151
153
|
edgesOf,
|
|
152
154
|
encodeParent,
|
|
153
155
|
graphStyle,
|
package/dist/internal.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { default as DiffOverlay, type DiffOverlayProps, type DiffGeometry, type
|
|
|
4
4
|
export { diffPositions, solveDiffLayout, type DiffSides, type DiffSolve, } from './layout/diff-layout.js';
|
|
5
5
|
export { relaxOverlaps, relaxNodes, type RelaxNode } from './layout/relax.js';
|
|
6
6
|
export { planLabels, labelBox, idPhase, type LabelInput, type LabelPlan, type LabelSide, type ReadabilityOptions, } from './layout/readability.js';
|
|
7
|
-
export { shapeOf, arrowOf, type Shape as PaintShape, type Arrow as PaintArrow, dotOf, gapOf, skeletonLineOf, semanticAlphaOf, clippedLength, hazeOf, detailed, reachOf, hittable, focusAlphaOf, MIN_DOT, MIN_LINE, SKEL_FLOOR, SEM_W, SEM_INK, SEM_BOOST, DETAIL_LEAF, GAP, HOVER_DIM, HOLD_LEAF, NODE_SLACK, EDGE_REACH, FOCUS_INK, } from './paint.js';
|
|
7
|
+
export { edgeKindHidden, shapeOf, arrowOf, type Shape as PaintShape, type Arrow as PaintArrow, dotOf, gapOf, skeletonLineOf, semanticAlphaOf, clippedLength, hazeOf, detailed, reachOf, hittable, focusAlphaOf, MIN_DOT, MIN_LINE, SKEL_FLOOR, SEM_W, SEM_INK, SEM_BOOST, DETAIL_LEAF, GAP, HOVER_DIM, HOLD_LEAF, NODE_SLACK, EDGE_REACH, FOCUS_INK, } from './paint.js';
|
|
8
8
|
export { touchGestures } from './react/touch.js';
|
|
9
9
|
export { placePanel } from './react/placement.js';
|
package/dist/internal.js
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
computeLayout,
|
|
32
32
|
detailed,
|
|
33
33
|
dotOf,
|
|
34
|
+
edgeKindHidden,
|
|
34
35
|
focusAlphaOf,
|
|
35
36
|
gapOf,
|
|
36
37
|
hazeOf,
|
|
@@ -47,7 +48,7 @@ import {
|
|
|
47
48
|
shapeOf,
|
|
48
49
|
skeletonLineOf,
|
|
49
50
|
touchGestures
|
|
50
|
-
} from "./chunks/chunk-
|
|
51
|
+
} from "./chunks/chunk-WUBELTBU.js";
|
|
51
52
|
import {
|
|
52
53
|
CONTENT_SCALE,
|
|
53
54
|
DARK_THEME,
|
|
@@ -100,6 +101,7 @@ import {
|
|
|
100
101
|
easeOutBack,
|
|
101
102
|
easeOutCubic,
|
|
102
103
|
edgeFade,
|
|
104
|
+
edgeKindClass,
|
|
103
105
|
edgeTraffic,
|
|
104
106
|
edgesOf,
|
|
105
107
|
encodeParent,
|
|
@@ -146,7 +148,7 @@ import {
|
|
|
146
148
|
untheme,
|
|
147
149
|
validateModel,
|
|
148
150
|
validateStructure
|
|
149
|
-
} from "./chunks/chunk-
|
|
151
|
+
} from "./chunks/chunk-F4HDKER4.js";
|
|
150
152
|
import {
|
|
151
153
|
DetailPanel,
|
|
152
154
|
renderInline,
|
|
@@ -155,7 +157,7 @@ import {
|
|
|
155
157
|
import {
|
|
156
158
|
EN
|
|
157
159
|
} from "./chunks/chunk-ISWKAU5G.js";
|
|
158
|
-
import "./chunks/chunk-
|
|
160
|
+
import "./chunks/chunk-OE5IRKWZ.js";
|
|
159
161
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
160
162
|
export {
|
|
161
163
|
ALL_CONTROLS,
|
|
@@ -237,6 +239,8 @@ export {
|
|
|
237
239
|
easeOutBack,
|
|
238
240
|
easeOutCubic,
|
|
239
241
|
edgeFade,
|
|
242
|
+
edgeKindClass,
|
|
243
|
+
edgeKindHidden,
|
|
240
244
|
edgeTraffic,
|
|
241
245
|
edgesOf,
|
|
242
246
|
encodeParent,
|
package/dist/layout/engine.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ export interface LayoutRequest {
|
|
|
32
32
|
*
|
|
33
33
|
* The cost is that layout becomes **path dependent**: going step1 → step2 and step4 → step2, the same data
|
|
34
34
|
* gets two different layouts. That is a real cost, but within one session layout is stable (see lastByNs),
|
|
35
|
-
* and results go into the cache, so the same structure hits it the second time and never drifts
|
|
35
|
+
* and results go into the cache, so the same structure hits it the second time and never drifts. "Relayout" discards
|
|
36
|
+
* this continuation seed and rebuilds the forest's sector seed (ordered siblings keep their order).
|
|
36
37
|
*
|
|
37
38
|
* **All three places need it; miss one and the seed is wasted:**
|
|
38
39
|
* ① inside components: member coordinates as the force start
|
|
@@ -42,6 +43,7 @@ export interface LayoutRequest {
|
|
|
42
43
|
*/
|
|
43
44
|
seed?: Positions;
|
|
44
45
|
onProgress?: (done: number, total: number) => void;
|
|
46
|
+
/** Bypass cached coordinates and rebuild the sector seed, ignoring continuation coordinates. */
|
|
45
47
|
force?: boolean;
|
|
46
48
|
/** Cache partition: the same structure stores each solving mode separately (`layoutMode` fresh / continue).
|
|
47
49
|
* Without it, after one pass with continue, switching back to fresh would still show the continue result: "a free solve by content,
|
package/dist/layout/order.d.ts
CHANGED
|
@@ -7,11 +7,15 @@ export interface OrderInfo {
|
|
|
7
7
|
orderedKids: Map<string, string[]>;
|
|
8
8
|
/** Every node id, for subtree walks. */
|
|
9
9
|
nodeIds: Set<string>;
|
|
10
|
-
/** At least one run is numbered
|
|
10
|
+
/** At least one run is numbered; unnumbered runs still receive sectors. */
|
|
11
11
|
any: boolean;
|
|
12
12
|
}
|
|
13
|
+
/** Read the forest for sector seeding, including graphs with no numbered siblings. */
|
|
13
14
|
export declare function readOrder(elements: CyElement[]): OrderInfo | null;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
type Dimensions = Record<string, {
|
|
16
|
+
w: number;
|
|
17
|
+
h: number;
|
|
18
|
+
}>;
|
|
19
|
+
/** Sector assignment constrains only the seed; the force solver owns the final positions. */
|
|
20
|
+
export declare function orderSeed(elements: CyElement[], info: OrderInfo, dims?: Dimensions, random?: () => number): Positions;
|
|
21
|
+
export {};
|
package/dist/layout/worker.js
CHANGED
|
@@ -37,7 +37,13 @@ function runLayoutJob(job) {
|
|
|
37
37
|
return new Promise((resolve, reject) => {
|
|
38
38
|
let cy;
|
|
39
39
|
try {
|
|
40
|
-
cy = cytoscape({
|
|
40
|
+
cy = cytoscape({
|
|
41
|
+
headless: true,
|
|
42
|
+
styleEnabled: true,
|
|
43
|
+
elements: job.elements,
|
|
44
|
+
style: GEOMETRY_STYLE,
|
|
45
|
+
layout: { name: "preset", fit: false }
|
|
46
|
+
});
|
|
41
47
|
} catch (err) {
|
|
42
48
|
reject(err);
|
|
43
49
|
return;
|
package/dist/paint.d.ts
CHANGED
|
@@ -51,6 +51,8 @@ export declare const reachOf: (vis: number, lineW: number, touch?: boolean, base
|
|
|
51
51
|
export declare const hittable: (reach: number) => boolean;
|
|
52
52
|
/** Up close or not (dashes, semantic edge arrows). */
|
|
53
53
|
export declare const detailed: (leafPx: number) => boolean;
|
|
54
|
+
/** Relationship filters never hide the parent skeleton, even in legacy graphs with a contains kind. */
|
|
55
|
+
export declare const edgeKindHidden: (skeleton: boolean, kind: string, hidden: ReadonlySet<string>) => boolean;
|
|
54
56
|
/** Shapes and arrow heads the painter can draw. Hosts drawing marks "like on the graph" (a legend, say) follow these two mappings. */
|
|
55
57
|
export type Shape = 'circle' | 'hexagon' | 'diamond' | 'rect';
|
|
56
58
|
export type Arrow = 'none' | 'triangle' | 'tee';
|
|
@@ -120,10 +120,11 @@ export interface GraphCanvasProps {
|
|
|
120
120
|
layout?: Positions | null;
|
|
121
121
|
/**
|
|
122
122
|
* How ③ solves:
|
|
123
|
-
* `'fresh'` (default) **full recompute
|
|
123
|
+
* `'fresh'` (default) **full recompute** from sampled sectors: ordered siblings follow their numbers; others shuffle sectors.
|
|
124
124
|
* `'continue'` **continue**: also a full recompute, but starting from existing coordinates (this frame on screen, gaps filled from the preset)
|
|
125
|
-
* instead of
|
|
125
|
+
* instead of rebuilding sectors. Missing coordinates are filled from the sector seed.
|
|
126
126
|
* Only decides the first time: the result goes into the cache (each mode separately), so the same structure hits the cache next time and never drifts.
|
|
127
|
+
* Re-layout always bypasses saved coordinates and rebuilds sectors, regardless of this mode.
|
|
127
128
|
*/
|
|
128
129
|
layoutMode?: 'fresh' | 'continue';
|
|
129
130
|
/** Called once per layout produced (including "Relayout" in the canvas menu): flat coordinates, and where they came from.
|
|
@@ -195,6 +196,8 @@ export interface GraphCanvasProps {
|
|
|
195
196
|
/** "Re-structure" in ⋯: the host re-hangs and renumbers the graph (see cli/restructure.ts) and hands back a new model.
|
|
196
197
|
* Without it the item is absent. Pure callback: the library never edits. */
|
|
197
198
|
onRestructure?: () => void;
|
|
199
|
+
/** Optional inline content under Re-structure in the existing toolbar popup. */
|
|
200
|
+
restructureContent?: ReactNode;
|
|
198
201
|
/** Why the layer button is grey. The button is always shown; this text goes in its popover. */
|
|
199
202
|
layerIssue?: string;
|
|
200
203
|
/** "Open the floors anyway" in that popover: the host rebuilds its profile with layers forced on. */
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
4
|
GraphCanvas
|
|
5
|
-
} from "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-WUBELTBU.js";
|
|
6
|
+
import "../chunks/chunk-F4HDKER4.js";
|
|
7
7
|
import "../chunks/chunk-3JGZ27DC.js";
|
|
8
8
|
import "../chunks/chunk-ISWKAU5G.js";
|
|
9
|
-
import "../chunks/chunk-
|
|
9
|
+
import "../chunks/chunk-OE5IRKWZ.js";
|
|
10
10
|
import "../chunks/chunk-ZA47FP7C.js";
|
|
11
11
|
export {
|
|
12
12
|
GraphCanvas as default
|
package/dist/react/Toolbar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RefObject } from 'react';
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
2
|
import type { GraphIssue, LayerSpec } from '../profile.js';
|
|
3
3
|
import { type GraphView } from '../view.js';
|
|
4
4
|
export type ControlId = 'search' | 'origins' | 'layers' | 'relayout' | 'zoom';
|
|
@@ -39,6 +39,7 @@ export interface ToolbarProps {
|
|
|
39
39
|
onRelayout?: () => void;
|
|
40
40
|
/** "Re-structure" in ⋯: repair containment and ordering while preserving content. Without it the item is absent. */
|
|
41
41
|
onRestructure?: () => void;
|
|
42
|
+
restructureContent?: ReactNode;
|
|
42
43
|
/** Why the layer button is grey (it is always shown). `onForceLayers` adds "open the floors anyway". */
|
|
43
44
|
layerIssue?: string;
|
|
44
45
|
onForceLayers?: () => void;
|
package/package.json
CHANGED