glassbrain 0.2.0-alpha.4 → 0.2.0-alpha.6
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 +18 -8
- package/dist/adapters.js +25 -1
- package/dist/chunks/{chunk-3JGZ27DC.js → chunk-3P34XHQ2.js} +4 -3
- package/dist/chunks/{chunk-SEOAVI3E.js → chunk-3SAL4526.js} +259 -94
- package/dist/chunks/{chunk-ISWKAU5G.js → chunk-5DEN6HXJ.js} +1 -3
- package/dist/chunks/{chunk-R2CQA4OJ.js → chunk-LMYD4QHC.js} +107 -163
- package/dist/chunks/{chunk-G7XWVKHN.js → chunk-M3MAM2VD.js} +5 -4
- package/dist/chunks/{chunk-YGRPNAXE.js → chunk-OE5IRKWZ.js} +8 -1
- package/dist/cli/glassbrain.js +438 -272
- package/dist/cli/viewer.js +45 -45
- package/dist/core.js +7 -5
- package/dist/edit.d.ts +5 -3
- package/dist/elements.d.ts +2 -0
- package/dist/index.js +10 -8
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +12 -8
- package/dist/layers.d.ts +1 -1
- 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/model.d.ts +15 -5
- package/dist/paint.d.ts +2 -0
- package/dist/profile.d.ts +9 -1
- package/dist/react/DetailPanel.js +2 -2
- package/dist/react/GraphCanvas.d.ts +5 -2
- package/dist/react/GraphCanvas.js +5 -5
- package/dist/react/Toolbar.d.ts +2 -1
- package/dist/tree.d.ts +11 -0
- package/package.json +1 -1
- package/schema/graph.schema.json +125 -23
package/dist/core.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
deriveLayers,
|
|
4
4
|
layerIndexOf,
|
|
5
5
|
orderedChildren
|
|
6
|
-
} from "./chunks/chunk-
|
|
6
|
+
} from "./chunks/chunk-M3MAM2VD.js";
|
|
7
7
|
import {
|
|
8
8
|
CONTENT_SCALE,
|
|
9
9
|
DARK_THEME,
|
|
@@ -43,8 +43,8 @@ import {
|
|
|
43
43
|
defineProfile,
|
|
44
44
|
diffModels,
|
|
45
45
|
diffStyle,
|
|
46
|
+
edgeKindClass,
|
|
46
47
|
edgesOf,
|
|
47
|
-
encodeParent,
|
|
48
48
|
graphStyle,
|
|
49
49
|
hasChanges,
|
|
50
50
|
indexModel,
|
|
@@ -72,15 +72,16 @@ import {
|
|
|
72
72
|
skeletonColor,
|
|
73
73
|
stepUnion,
|
|
74
74
|
themeColor,
|
|
75
|
+
toBundle,
|
|
75
76
|
toPhysical,
|
|
76
77
|
unionSides,
|
|
77
78
|
untheme,
|
|
78
79
|
validateModel,
|
|
79
80
|
validateStructure
|
|
80
|
-
} from "./chunks/chunk-
|
|
81
|
+
} from "./chunks/chunk-3SAL4526.js";
|
|
81
82
|
import {
|
|
82
83
|
EN
|
|
83
|
-
} from "./chunks/chunk-
|
|
84
|
+
} from "./chunks/chunk-5DEN6HXJ.js";
|
|
84
85
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
85
86
|
export {
|
|
86
87
|
CONTENT_SCALE,
|
|
@@ -124,8 +125,8 @@ export {
|
|
|
124
125
|
deriveLayers,
|
|
125
126
|
diffModels,
|
|
126
127
|
diffStyle,
|
|
128
|
+
edgeKindClass,
|
|
127
129
|
edgesOf,
|
|
128
|
-
encodeParent,
|
|
129
130
|
graphStyle,
|
|
130
131
|
hasChanges,
|
|
131
132
|
indexModel,
|
|
@@ -155,6 +156,7 @@ export {
|
|
|
155
156
|
skeletonColor,
|
|
156
157
|
stepUnion,
|
|
157
158
|
themeColor,
|
|
159
|
+
toBundle,
|
|
158
160
|
toPhysical,
|
|
159
161
|
unionSides,
|
|
160
162
|
untheme,
|
package/dist/edit.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type GraphEdge, type GraphModel } from './model.js';
|
|
|
2
2
|
import type { GraphProfile } from './profile.js';
|
|
3
3
|
/** What can be changed on a node. `parent: null` = move to the top level. */
|
|
4
4
|
export interface NodeFields {
|
|
5
|
+
/** Insert before this sibling; null appends. Native UI uses this instead of numeric order. */
|
|
6
|
+
before?: string | null;
|
|
5
7
|
label?: string;
|
|
6
8
|
kind?: string;
|
|
7
9
|
parent?: string | null;
|
|
@@ -38,7 +40,7 @@ export type EditOp =
|
|
|
38
40
|
op: 'removeEdge';
|
|
39
41
|
edge: EdgeRef;
|
|
40
42
|
};
|
|
41
|
-
export type EditError = '
|
|
43
|
+
export type EditError = 'invalid-position' | 'order-invalid' | 'id-empty' | 'id-taken' | 'no-node' | 'no-parent' | 'cycle' | 'has-children' | 'no-endpoint' | 'self-loop' | 'edge-exists' | 'no-edge';
|
|
42
44
|
/** Whether this op can be applied. null = yes; otherwise the reason (the UI looks it up in `strings.error`). */
|
|
43
45
|
export declare function checkEdit(model: GraphModel, op: EditOp): EditError | null;
|
|
44
46
|
/** How many edges hang on a node (the ones that go with it when it is deleted). */
|
|
@@ -57,5 +59,5 @@ export declare function applyEdits(model: GraphModel, ops: EditOp[], profile?: G
|
|
|
57
59
|
error: EditError;
|
|
58
60
|
}[];
|
|
59
61
|
};
|
|
60
|
-
/** Native CLI edits
|
|
61
|
-
export declare
|
|
62
|
+
/** Native CLI edits keep stable ids and valid forest placements. */
|
|
63
|
+
export declare const checkNativeEdit: typeof checkEdit;
|
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
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
deriveLayers,
|
|
6
6
|
layerIndexOf,
|
|
7
7
|
orderedChildren
|
|
8
|
-
} from "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-M3MAM2VD.js";
|
|
9
9
|
import {
|
|
10
10
|
ALL_CONTROLS,
|
|
11
11
|
DEFAULT_PLANES,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
clearLayoutCache,
|
|
15
15
|
computeLayout,
|
|
16
16
|
projectPlanes
|
|
17
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-LMYD4QHC.js";
|
|
18
18
|
import {
|
|
19
19
|
CONTENT_SCALE,
|
|
20
20
|
DARK_THEME,
|
|
@@ -54,8 +54,8 @@ import {
|
|
|
54
54
|
defineProfile,
|
|
55
55
|
diffModels,
|
|
56
56
|
diffStyle,
|
|
57
|
+
edgeKindClass,
|
|
57
58
|
edgesOf,
|
|
58
|
-
encodeParent,
|
|
59
59
|
graphStyle,
|
|
60
60
|
hasChanges,
|
|
61
61
|
indexModel,
|
|
@@ -83,21 +83,22 @@ import {
|
|
|
83
83
|
skeletonColor,
|
|
84
84
|
stepUnion,
|
|
85
85
|
themeColor,
|
|
86
|
+
toBundle,
|
|
86
87
|
toPhysical,
|
|
87
88
|
unionSides,
|
|
88
89
|
untheme,
|
|
89
90
|
validateModel,
|
|
90
91
|
validateStructure
|
|
91
|
-
} from "./chunks/chunk-
|
|
92
|
+
} from "./chunks/chunk-3SAL4526.js";
|
|
92
93
|
import {
|
|
93
94
|
DetailPanel,
|
|
94
95
|
renderInline,
|
|
95
96
|
renderMarkdown
|
|
96
|
-
} from "./chunks/chunk-
|
|
97
|
+
} from "./chunks/chunk-3P34XHQ2.js";
|
|
97
98
|
import {
|
|
98
99
|
EN
|
|
99
|
-
} from "./chunks/chunk-
|
|
100
|
-
import "./chunks/chunk-
|
|
100
|
+
} from "./chunks/chunk-5DEN6HXJ.js";
|
|
101
|
+
import "./chunks/chunk-OE5IRKWZ.js";
|
|
101
102
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
102
103
|
export {
|
|
103
104
|
ALL_CONTROLS,
|
|
@@ -148,8 +149,8 @@ export {
|
|
|
148
149
|
deriveLayers,
|
|
149
150
|
diffModels,
|
|
150
151
|
diffStyle,
|
|
152
|
+
edgeKindClass,
|
|
151
153
|
edgesOf,
|
|
152
|
-
encodeParent,
|
|
153
154
|
graphStyle,
|
|
154
155
|
hasChanges,
|
|
155
156
|
indexModel,
|
|
@@ -182,6 +183,7 @@ export {
|
|
|
182
183
|
skeletonColor,
|
|
183
184
|
stepUnion,
|
|
184
185
|
themeColor,
|
|
186
|
+
toBundle,
|
|
185
187
|
toPhysical,
|
|
186
188
|
unionSides,
|
|
187
189
|
untheme,
|
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
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
deriveLayers,
|
|
6
6
|
layerIndexOf,
|
|
7
7
|
orderedChildren
|
|
8
|
-
} from "./chunks/chunk-
|
|
8
|
+
} from "./chunks/chunk-M3MAM2VD.js";
|
|
9
9
|
import {
|
|
10
10
|
ALL_CONTROLS,
|
|
11
11
|
DEFAULT_PLANES,
|
|
@@ -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-LMYD4QHC.js";
|
|
51
52
|
import {
|
|
52
53
|
CONTENT_SCALE,
|
|
53
54
|
DARK_THEME,
|
|
@@ -100,9 +101,9 @@ import {
|
|
|
100
101
|
easeOutBack,
|
|
101
102
|
easeOutCubic,
|
|
102
103
|
edgeFade,
|
|
104
|
+
edgeKindClass,
|
|
103
105
|
edgeTraffic,
|
|
104
106
|
edgesOf,
|
|
105
|
-
encodeParent,
|
|
106
107
|
fadeAt,
|
|
107
108
|
graphStyle,
|
|
108
109
|
hasChanges,
|
|
@@ -139,6 +140,7 @@ import {
|
|
|
139
140
|
solveDiffLayout,
|
|
140
141
|
stepUnion,
|
|
141
142
|
themeColor,
|
|
143
|
+
toBundle,
|
|
142
144
|
toPhysical,
|
|
143
145
|
trackAt,
|
|
144
146
|
trackLin,
|
|
@@ -146,16 +148,16 @@ import {
|
|
|
146
148
|
untheme,
|
|
147
149
|
validateModel,
|
|
148
150
|
validateStructure
|
|
149
|
-
} from "./chunks/chunk-
|
|
151
|
+
} from "./chunks/chunk-3SAL4526.js";
|
|
150
152
|
import {
|
|
151
153
|
DetailPanel,
|
|
152
154
|
renderInline,
|
|
153
155
|
renderMarkdown
|
|
154
|
-
} from "./chunks/chunk-
|
|
156
|
+
} from "./chunks/chunk-3P34XHQ2.js";
|
|
155
157
|
import {
|
|
156
158
|
EN
|
|
157
|
-
} from "./chunks/chunk-
|
|
158
|
-
import "./chunks/chunk-
|
|
159
|
+
} from "./chunks/chunk-5DEN6HXJ.js";
|
|
160
|
+
import "./chunks/chunk-OE5IRKWZ.js";
|
|
159
161
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
160
162
|
export {
|
|
161
163
|
ALL_CONTROLS,
|
|
@@ -237,9 +239,10 @@ export {
|
|
|
237
239
|
easeOutBack,
|
|
238
240
|
easeOutCubic,
|
|
239
241
|
edgeFade,
|
|
242
|
+
edgeKindClass,
|
|
243
|
+
edgeKindHidden,
|
|
240
244
|
edgeTraffic,
|
|
241
245
|
edgesOf,
|
|
242
|
-
encodeParent,
|
|
243
246
|
fadeAt,
|
|
244
247
|
focusAlphaOf,
|
|
245
248
|
gapOf,
|
|
@@ -295,6 +298,7 @@ export {
|
|
|
295
298
|
solveDiffLayout,
|
|
296
299
|
stepUnion,
|
|
297
300
|
themeColor,
|
|
301
|
+
toBundle,
|
|
298
302
|
toPhysical,
|
|
299
303
|
touchGestures,
|
|
300
304
|
trackAt,
|
package/dist/layers.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface DerivedLayers {
|
|
|
9
9
|
anchor?: string;
|
|
10
10
|
}
|
|
11
11
|
/** Ordered children of `id`, or null when that run is not ordered (all of them carry a distinct order, or none does). */
|
|
12
|
-
export declare function orderedChildren(children: Gy, id: string): GraphNode[] | null;
|
|
12
|
+
export declare function orderedChildren(children: Gy, id: string, unordered?: boolean): GraphNode[] | null;
|
|
13
13
|
type Gy = Map<string, GraphNode[]>;
|
|
14
14
|
export declare function childrenMap(model: GraphModel): Gy;
|
|
15
15
|
export declare function deriveLayers(model: GraphModel, colors?: string[], force?: boolean): DerivedLayers;
|
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/model.d.ts
CHANGED
|
@@ -7,8 +7,9 @@ export interface GraphNode {
|
|
|
7
7
|
/** Compound parent node id: expresses "nested inside", the only source of structural hierarchy. */
|
|
8
8
|
parent?: string;
|
|
9
9
|
/** Position among its siblings: every child of a parent carries one, or none does. **The file format writes it as the
|
|
10
|
-
*
|
|
11
|
-
* reads it clockwise,
|
|
10
|
+
* position in `children`** (1-based; retained only in the runtime model). The layout
|
|
11
|
+
* reads it clockwise, unless the parent has data.unordered === true. Unordered groups retain
|
|
12
|
+
* these positions for editing/export, but do not use them for layout, floors or positional diffs. */
|
|
12
13
|
order?: number;
|
|
13
14
|
/** **Where it hung in the previous version** (filled by `diffModels`, only `moved` nodes in a union have it).
|
|
14
15
|
*
|
|
@@ -49,7 +50,16 @@ export interface GraphEdge {
|
|
|
49
50
|
data?: Record<string, unknown>;
|
|
50
51
|
}
|
|
51
52
|
/** A fragment parsed from one piece of raw data. One file = one slice. */
|
|
53
|
+
export interface NodeDeclaration {
|
|
54
|
+
id: string;
|
|
55
|
+
fields: Record<string, unknown>;
|
|
56
|
+
children?: string[];
|
|
57
|
+
path: string;
|
|
58
|
+
}
|
|
52
59
|
export interface GraphSlice {
|
|
60
|
+
/** Native tree declarations, before defaults and field composition. */
|
|
61
|
+
declarations?: NodeDeclaration[];
|
|
62
|
+
rootIds?: string[];
|
|
53
63
|
origin: string;
|
|
54
64
|
title: string;
|
|
55
65
|
nodes: GraphNode[];
|
|
@@ -67,6 +77,8 @@ export interface GraphModel {
|
|
|
67
77
|
errors: {
|
|
68
78
|
origin: string;
|
|
69
79
|
message: string;
|
|
80
|
+
code?: 'schema' | 'field-conflict' | 'children-conflict' | 'parent-error';
|
|
81
|
+
node?: string;
|
|
70
82
|
}[];
|
|
71
83
|
/** id → node (built at construction; do not build your own). */
|
|
72
84
|
index: Map<string, GraphNode>;
|
|
@@ -76,7 +88,7 @@ export interface GraphModel {
|
|
|
76
88
|
export declare const EMPTY_MODEL: GraphModel;
|
|
77
89
|
/** Build a model from bare nodes/edges (builds the index). profile.merge implementations nearly all end with it. */
|
|
78
90
|
export declare function buildModel(nodes: GraphNode[], edges: GraphEdge[], errors?: GraphModel['errors']): GraphModel;
|
|
79
|
-
/**
|
|
91
|
+
/** Native trees compose explicit fields by id; custom profile parsers can supply runtime slices. */
|
|
80
92
|
export declare function mergeSlices(slices: GraphSlice[]): GraphModel;
|
|
81
93
|
/** Add one to a source list (order kept, deduplicated). Needed all over the merge stage. */
|
|
82
94
|
export declare function addOrigin(list: string[] | undefined, origin: string | undefined): string[];
|
|
@@ -95,5 +107,3 @@ export interface GraphIndex {
|
|
|
95
107
|
export declare function indexModel(model: GraphModel): GraphIndex;
|
|
96
108
|
/** The sources that appear in the model (data for the subgraph / view dropdown). */
|
|
97
109
|
export declare function originsOf(model: GraphModel): string[];
|
|
98
|
-
/** Canonical decimal encoding: Number.toString uses exponents for tiny/large orders. */
|
|
99
|
-
export declare function encodeParent(parent: string | null | undefined, order?: number): string | null;
|
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';
|
package/dist/profile.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface GraphProfile {
|
|
|
44
44
|
id: string;
|
|
45
45
|
/** Parse one piece of raw data. Return null = not recognized (silently skipped, not counted as broken). */
|
|
46
46
|
parse(origin: string, text: string): GraphSlice | null;
|
|
47
|
-
/** Slices → model. Default mergeSlices (
|
|
47
|
+
/** Slices → model. Default mergeSlices (native declarations compose by id). */
|
|
48
48
|
merge(slices: GraphSlice[]): GraphModel;
|
|
49
49
|
layers: LayerSpec[];
|
|
50
50
|
/** Which layer a node belongs to. Defaults to node.layer, then to the first layer. */
|
|
@@ -111,6 +111,14 @@ export declare function toPhysical(model: GraphModel): {
|
|
|
111
111
|
nodes: Record<string, unknown>[];
|
|
112
112
|
edges: Record<string, unknown>[];
|
|
113
113
|
};
|
|
114
|
+
/** Portable page export: preserve the profile and include colours for every depth of the tree. */
|
|
115
|
+
export declare function toBundle(model: GraphModel, profile?: Record<string, unknown> | null): {
|
|
116
|
+
nodes: Record<string, unknown>[];
|
|
117
|
+
edges: Record<string, unknown>[];
|
|
118
|
+
profile: {
|
|
119
|
+
nodePalette: Record<string, string>;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
114
122
|
/** Generic validation: the few things true of any graph (dangling edges, duplicate ids, duplicate edges). Domain checks are added separately.
|
|
115
123
|
*
|
|
116
124
|
* **An edge is defined by its two ends + kind** (compare and edit both use this; `id` is only the name of the primitive on screen).
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import {
|
|
4
4
|
DetailPanel
|
|
5
|
-
} from "../chunks/chunk-
|
|
6
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-3P34XHQ2.js";
|
|
6
|
+
import "../chunks/chunk-5DEN6HXJ.js";
|
|
7
7
|
import "../chunks/chunk-ZA47FP7C.js";
|
|
8
8
|
export {
|
|
9
9
|
DetailPanel as default
|
|
@@ -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-
|
|
7
|
-
import "../chunks/chunk-
|
|
8
|
-
import "../chunks/chunk-
|
|
9
|
-
import "../chunks/chunk-
|
|
5
|
+
} from "../chunks/chunk-LMYD4QHC.js";
|
|
6
|
+
import "../chunks/chunk-3SAL4526.js";
|
|
7
|
+
import "../chunks/chunk-3P34XHQ2.js";
|
|
8
|
+
import "../chunks/chunk-5DEN6HXJ.js";
|
|
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/dist/tree.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Native ordered tree fragments. Collect facts by id before materializing a forest. */
|
|
2
|
+
import { type GraphModel, type GraphNode, type GraphSlice, type NodeDeclaration } from './model.js';
|
|
3
|
+
export declare function treeDeclarations(raw: unknown, origin: string): Pick<GraphSlice, 'declarations' | 'rootIds' | 'error'>;
|
|
4
|
+
/** Own fields only: descendants must never be copied into an ancestor's diff payload. */
|
|
5
|
+
export declare function treeNodes(declarations?: NodeDeclaration[]): GraphNode[];
|
|
6
|
+
export declare function composeTrees(input: GraphSlice[]): GraphModel;
|
|
7
|
+
/** Complete snapshots only. Never export a conflict's diagnostic first value as accepted knowledge. */
|
|
8
|
+
export declare function serializeTree(model: GraphModel): {
|
|
9
|
+
nodes: Record<string, unknown>[];
|
|
10
|
+
edges: Record<string, unknown>[];
|
|
11
|
+
};
|
package/package.json
CHANGED