glassbrain 0.2.0-alpha.2 → 0.2.0-alpha.4
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 +19 -11
- package/dist/adapters/graphify.d.ts +3 -0
- package/dist/adapters/understand.d.ts +3 -0
- package/dist/adapters.js +18 -3
- package/dist/chunks/{chunk-ZHPUQDOJ.js → chunk-3JGZ27DC.js} +10 -1
- package/dist/chunks/chunk-G7XWVKHN.js +66 -0
- package/dist/chunks/{chunk-F3DN7SLR.js → chunk-ISWKAU5G.js} +9 -1
- package/dist/chunks/{chunk-TM27EXYP.js → chunk-R2CQA4OJ.js} +136 -31
- package/dist/chunks/{chunk-7R6PO7AE.js → chunk-SEOAVI3E.js} +82 -18
- package/dist/cli/glassbrain.js +784 -541
- package/dist/cli/viewer.js +47 -44
- package/dist/core.d.ts +1 -0
- package/dist/core.js +16 -3
- package/dist/edit.d.ts +4 -1
- package/dist/index.js +18 -5
- package/dist/internal.js +18 -5
- package/dist/layers.d.ts +1 -3
- package/dist/layout/order.d.ts +0 -1
- package/dist/model.d.ts +5 -2
- package/dist/react/DetailPanel.d.ts +2 -0
- package/dist/react/DetailPanel.js +2 -2
- package/dist/react/GraphCanvas.d.ts +9 -2
- package/dist/react/GraphCanvas.js +4 -4
- package/dist/react/Toolbar.d.ts +4 -1
- package/dist/strings.d.ts +4 -0
- package/package.json +3 -2
- package/schema/graph.schema.json +3 -4
- package/README.zh-CN.md +0 -938
- package/dist/chunks/chunk-LEYJCT6O.js +0 -0
package/dist/core.d.ts
CHANGED
package/dist/core.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
childrenMap,
|
|
3
|
+
deriveLayers,
|
|
4
|
+
layerIndexOf,
|
|
5
|
+
orderedChildren
|
|
6
|
+
} from "./chunks/chunk-G7XWVKHN.js";
|
|
2
7
|
import {
|
|
3
8
|
CONTENT_SCALE,
|
|
4
9
|
DARK_THEME,
|
|
@@ -29,6 +34,7 @@ import {
|
|
|
29
34
|
buildModel,
|
|
30
35
|
changedSubset,
|
|
31
36
|
checkEdit,
|
|
37
|
+
checkNativeEdit,
|
|
32
38
|
chromeStyle,
|
|
33
39
|
cls,
|
|
34
40
|
countByKind,
|
|
@@ -38,6 +44,7 @@ import {
|
|
|
38
44
|
diffModels,
|
|
39
45
|
diffStyle,
|
|
40
46
|
edgesOf,
|
|
47
|
+
encodeParent,
|
|
41
48
|
graphStyle,
|
|
42
49
|
hasChanges,
|
|
43
50
|
indexModel,
|
|
@@ -70,10 +77,10 @@ import {
|
|
|
70
77
|
untheme,
|
|
71
78
|
validateModel,
|
|
72
79
|
validateStructure
|
|
73
|
-
} from "./chunks/chunk-
|
|
80
|
+
} from "./chunks/chunk-SEOAVI3E.js";
|
|
74
81
|
import {
|
|
75
82
|
EN
|
|
76
|
-
} from "./chunks/chunk-
|
|
83
|
+
} from "./chunks/chunk-ISWKAU5G.js";
|
|
77
84
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
78
85
|
export {
|
|
79
86
|
CONTENT_SCALE,
|
|
@@ -106,26 +113,32 @@ export {
|
|
|
106
113
|
buildModel,
|
|
107
114
|
changedSubset,
|
|
108
115
|
checkEdit,
|
|
116
|
+
checkNativeEdit,
|
|
117
|
+
childrenMap,
|
|
109
118
|
chromeStyle,
|
|
110
119
|
cls,
|
|
111
120
|
countByKind,
|
|
112
121
|
defaultNodeColor,
|
|
113
122
|
defaultProfile,
|
|
114
123
|
defineProfile,
|
|
124
|
+
deriveLayers,
|
|
115
125
|
diffModels,
|
|
116
126
|
diffStyle,
|
|
117
127
|
edgesOf,
|
|
128
|
+
encodeParent,
|
|
118
129
|
graphStyle,
|
|
119
130
|
hasChanges,
|
|
120
131
|
indexModel,
|
|
121
132
|
isFiltering,
|
|
122
133
|
isNarrowing,
|
|
123
134
|
isNodeEl,
|
|
135
|
+
layerIndexOf,
|
|
124
136
|
mergeSlices,
|
|
125
137
|
mixHex,
|
|
126
138
|
nodeClasses,
|
|
127
139
|
nodeDiameter,
|
|
128
140
|
nodeWeight,
|
|
141
|
+
orderedChildren,
|
|
129
142
|
originView,
|
|
130
143
|
originsOf,
|
|
131
144
|
originsOfNode,
|
package/dist/edit.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface NodeFields {
|
|
|
5
5
|
label?: string;
|
|
6
6
|
kind?: string;
|
|
7
7
|
parent?: string | null;
|
|
8
|
+
order?: number | null;
|
|
8
9
|
data?: Record<string, unknown>;
|
|
9
10
|
}
|
|
10
11
|
export interface EdgeRef {
|
|
@@ -37,7 +38,7 @@ export type EditOp =
|
|
|
37
38
|
op: 'removeEdge';
|
|
38
39
|
edge: EdgeRef;
|
|
39
40
|
};
|
|
40
|
-
export type EditError = 'id-empty' | 'id-taken' | 'no-node' | 'no-parent' | 'cycle' | 'has-children' | 'no-endpoint' | 'self-loop' | 'edge-exists' | 'no-edge';
|
|
41
|
+
export type EditError = 'id-format' | 'multiple-roots' | 'order-mixed' | 'order-invalid' | 'id-empty' | 'id-taken' | 'no-node' | 'no-parent' | 'cycle' | 'has-children' | 'no-endpoint' | 'self-loop' | 'edge-exists' | 'no-edge';
|
|
41
42
|
/** Whether this op can be applied. null = yes; otherwise the reason (the UI looks it up in `strings.error`). */
|
|
42
43
|
export declare function checkEdit(model: GraphModel, op: EditOp): EditError | null;
|
|
43
44
|
/** How many edges hang on a node (the ones that go with it when it is deleted). */
|
|
@@ -56,3 +57,5 @@ export declare function applyEdits(model: GraphModel, ops: EditOp[], profile?: G
|
|
|
56
57
|
error: EditError;
|
|
57
58
|
}[];
|
|
58
59
|
};
|
|
60
|
+
/** Native CLI edits must remain exportable under the parent/order contract. */
|
|
61
|
+
export declare function checkNativeEdit(model: GraphModel, op: EditOp): EditError | null;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import "./chunks/chunk-SA6RSWZP.js";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
childrenMap,
|
|
5
|
+
deriveLayers,
|
|
6
|
+
layerIndexOf,
|
|
7
|
+
orderedChildren
|
|
8
|
+
} from "./chunks/chunk-G7XWVKHN.js";
|
|
4
9
|
import {
|
|
5
10
|
ALL_CONTROLS,
|
|
6
11
|
DEFAULT_PLANES,
|
|
@@ -9,7 +14,7 @@ import {
|
|
|
9
14
|
clearLayoutCache,
|
|
10
15
|
computeLayout,
|
|
11
16
|
projectPlanes
|
|
12
|
-
} from "./chunks/chunk-
|
|
17
|
+
} from "./chunks/chunk-R2CQA4OJ.js";
|
|
13
18
|
import {
|
|
14
19
|
CONTENT_SCALE,
|
|
15
20
|
DARK_THEME,
|
|
@@ -40,6 +45,7 @@ import {
|
|
|
40
45
|
buildModel,
|
|
41
46
|
changedSubset,
|
|
42
47
|
checkEdit,
|
|
48
|
+
checkNativeEdit,
|
|
43
49
|
chromeStyle,
|
|
44
50
|
cls,
|
|
45
51
|
countByKind,
|
|
@@ -49,6 +55,7 @@ import {
|
|
|
49
55
|
diffModels,
|
|
50
56
|
diffStyle,
|
|
51
57
|
edgesOf,
|
|
58
|
+
encodeParent,
|
|
52
59
|
graphStyle,
|
|
53
60
|
hasChanges,
|
|
54
61
|
indexModel,
|
|
@@ -81,15 +88,15 @@ import {
|
|
|
81
88
|
untheme,
|
|
82
89
|
validateModel,
|
|
83
90
|
validateStructure
|
|
84
|
-
} from "./chunks/chunk-
|
|
91
|
+
} from "./chunks/chunk-SEOAVI3E.js";
|
|
85
92
|
import {
|
|
86
93
|
DetailPanel,
|
|
87
94
|
renderInline,
|
|
88
95
|
renderMarkdown
|
|
89
|
-
} from "./chunks/chunk-
|
|
96
|
+
} from "./chunks/chunk-3JGZ27DC.js";
|
|
90
97
|
import {
|
|
91
98
|
EN
|
|
92
|
-
} from "./chunks/chunk-
|
|
99
|
+
} from "./chunks/chunk-ISWKAU5G.js";
|
|
93
100
|
import "./chunks/chunk-YGRPNAXE.js";
|
|
94
101
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
95
102
|
export {
|
|
@@ -128,6 +135,8 @@ export {
|
|
|
128
135
|
buildModel,
|
|
129
136
|
changedSubset,
|
|
130
137
|
checkEdit,
|
|
138
|
+
checkNativeEdit,
|
|
139
|
+
childrenMap,
|
|
131
140
|
chromeStyle,
|
|
132
141
|
clearLayoutCache,
|
|
133
142
|
cls,
|
|
@@ -136,20 +145,24 @@ export {
|
|
|
136
145
|
defaultNodeColor,
|
|
137
146
|
defaultProfile,
|
|
138
147
|
defineProfile,
|
|
148
|
+
deriveLayers,
|
|
139
149
|
diffModels,
|
|
140
150
|
diffStyle,
|
|
141
151
|
edgesOf,
|
|
152
|
+
encodeParent,
|
|
142
153
|
graphStyle,
|
|
143
154
|
hasChanges,
|
|
144
155
|
indexModel,
|
|
145
156
|
isFiltering,
|
|
146
157
|
isNarrowing,
|
|
147
158
|
isNodeEl,
|
|
159
|
+
layerIndexOf,
|
|
148
160
|
mergeSlices,
|
|
149
161
|
mixHex,
|
|
150
162
|
nodeClasses,
|
|
151
163
|
nodeDiameter,
|
|
152
164
|
nodeWeight,
|
|
165
|
+
orderedChildren,
|
|
153
166
|
originView,
|
|
154
167
|
originsOf,
|
|
155
168
|
originsOfNode,
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import "./chunks/chunk-SA6RSWZP.js";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
childrenMap,
|
|
5
|
+
deriveLayers,
|
|
6
|
+
layerIndexOf,
|
|
7
|
+
orderedChildren
|
|
8
|
+
} from "./chunks/chunk-G7XWVKHN.js";
|
|
4
9
|
import {
|
|
5
10
|
ALL_CONTROLS,
|
|
6
11
|
DEFAULT_PLANES,
|
|
@@ -42,7 +47,7 @@ import {
|
|
|
42
47
|
shapeOf,
|
|
43
48
|
skeletonLineOf,
|
|
44
49
|
touchGestures
|
|
45
|
-
} from "./chunks/chunk-
|
|
50
|
+
} from "./chunks/chunk-R2CQA4OJ.js";
|
|
46
51
|
import {
|
|
47
52
|
CONTENT_SCALE,
|
|
48
53
|
DARK_THEME,
|
|
@@ -79,6 +84,7 @@ import {
|
|
|
79
84
|
buildModel,
|
|
80
85
|
changedSubset,
|
|
81
86
|
checkEdit,
|
|
87
|
+
checkNativeEdit,
|
|
82
88
|
chromeStyle,
|
|
83
89
|
cls,
|
|
84
90
|
countByKind,
|
|
@@ -96,6 +102,7 @@ import {
|
|
|
96
102
|
edgeFade,
|
|
97
103
|
edgeTraffic,
|
|
98
104
|
edgesOf,
|
|
105
|
+
encodeParent,
|
|
99
106
|
fadeAt,
|
|
100
107
|
graphStyle,
|
|
101
108
|
hasChanges,
|
|
@@ -139,15 +146,15 @@ import {
|
|
|
139
146
|
untheme,
|
|
140
147
|
validateModel,
|
|
141
148
|
validateStructure
|
|
142
|
-
} from "./chunks/chunk-
|
|
149
|
+
} from "./chunks/chunk-SEOAVI3E.js";
|
|
143
150
|
import {
|
|
144
151
|
DetailPanel,
|
|
145
152
|
renderInline,
|
|
146
153
|
renderMarkdown
|
|
147
|
-
} from "./chunks/chunk-
|
|
154
|
+
} from "./chunks/chunk-3JGZ27DC.js";
|
|
148
155
|
import {
|
|
149
156
|
EN
|
|
150
|
-
} from "./chunks/chunk-
|
|
157
|
+
} from "./chunks/chunk-ISWKAU5G.js";
|
|
151
158
|
import "./chunks/chunk-YGRPNAXE.js";
|
|
152
159
|
import "./chunks/chunk-ZA47FP7C.js";
|
|
153
160
|
export {
|
|
@@ -207,6 +214,8 @@ export {
|
|
|
207
214
|
buildModel,
|
|
208
215
|
changedSubset,
|
|
209
216
|
checkEdit,
|
|
217
|
+
checkNativeEdit,
|
|
218
|
+
childrenMap,
|
|
210
219
|
chromeStyle,
|
|
211
220
|
clearLayoutCache,
|
|
212
221
|
clippedLength,
|
|
@@ -216,6 +225,7 @@ export {
|
|
|
216
225
|
defaultNodeColor,
|
|
217
226
|
defaultProfile,
|
|
218
227
|
defineProfile,
|
|
228
|
+
deriveLayers,
|
|
219
229
|
detailed,
|
|
220
230
|
diffModels,
|
|
221
231
|
diffPositions,
|
|
@@ -229,6 +239,7 @@ export {
|
|
|
229
239
|
edgeFade,
|
|
230
240
|
edgeTraffic,
|
|
231
241
|
edgesOf,
|
|
242
|
+
encodeParent,
|
|
232
243
|
fadeAt,
|
|
233
244
|
focusAlphaOf,
|
|
234
245
|
gapOf,
|
|
@@ -242,6 +253,7 @@ export {
|
|
|
242
253
|
isNarrowing,
|
|
243
254
|
isNodeEl,
|
|
244
255
|
labelBox,
|
|
256
|
+
layerIndexOf,
|
|
245
257
|
leavingOf,
|
|
246
258
|
makeScore,
|
|
247
259
|
mergeSlices,
|
|
@@ -249,6 +261,7 @@ export {
|
|
|
249
261
|
nodeClasses,
|
|
250
262
|
nodeDiameter,
|
|
251
263
|
nodeWeight,
|
|
264
|
+
orderedChildren,
|
|
252
265
|
originView,
|
|
253
266
|
originsOf,
|
|
254
267
|
originsOfNode,
|
package/dist/layers.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { GraphModel, GraphNode } from './model.js';
|
|
2
2
|
import type { LayerSpec } from './profile.js';
|
|
3
|
-
/** Beyond this many ordered children the planes stop being an outline and become a stack of cards. */
|
|
4
|
-
export declare const MAX_DERIVED_LAYERS = 8;
|
|
5
3
|
export interface DerivedLayers {
|
|
6
4
|
/** Empty when the graph has no ordered siblings at the top of a single root. */
|
|
7
5
|
layers: LayerSpec[];
|
|
@@ -14,7 +12,7 @@ export interface DerivedLayers {
|
|
|
14
12
|
export declare function orderedChildren(children: Gy, id: string): GraphNode[] | null;
|
|
15
13
|
type Gy = Map<string, GraphNode[]>;
|
|
16
14
|
export declare function childrenMap(model: GraphModel): Gy;
|
|
17
|
-
export declare function deriveLayers(model: GraphModel, colors?: string[]): DerivedLayers;
|
|
15
|
+
export declare function deriveLayers(model: GraphModel, colors?: string[], force?: boolean): DerivedLayers;
|
|
18
16
|
/** Layers in reading order for a node id, for messages and the outline. */
|
|
19
17
|
export declare function layerIndexOf(derived: DerivedLayers, id: string): number;
|
|
20
18
|
export {};
|
package/dist/layout/order.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export interface OrderInfo {
|
|
|
10
10
|
/** At least one run is numbered (otherwise there is nothing to do). */
|
|
11
11
|
any: boolean;
|
|
12
12
|
}
|
|
13
|
-
/** Read `order` off the elements. Returns null when nothing is numbered: the layout then stays exactly as it was. */
|
|
14
13
|
export declare function readOrder(elements: CyElement[]): OrderInfo | null;
|
|
15
14
|
/** Pre-solve positions: ordered runs on arcs (clockwise, first at 12 o'clock), the rest by hash. */
|
|
16
15
|
export declare function orderSeed(elements: CyElement[], info: OrderInfo): Positions;
|
package/dist/model.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export interface GraphNode {
|
|
|
6
6
|
kind?: string;
|
|
7
7
|
/** Compound parent node id: expresses "nested inside", the only source of structural hierarchy. */
|
|
8
8
|
parent?: string;
|
|
9
|
-
/** Position among its siblings: every child of a parent carries one, or none does. The
|
|
10
|
-
*
|
|
9
|
+
/** Position among its siblings: every child of a parent carries one, or none does. **The file format writes it as the
|
|
10
|
+
* `@<order>` tail of `parent`** (`"<id>@<order>"`; `@-1` means explicitly unordered and parses to undefined). The layout
|
|
11
|
+
* reads it clockwise, and a run of ordered siblings is what opens the layer view. */
|
|
11
12
|
order?: number;
|
|
12
13
|
/** **Where it hung in the previous version** (filled by `diffModels`, only `moved` nodes in a union have it).
|
|
13
14
|
*
|
|
@@ -94,3 +95,5 @@ export interface GraphIndex {
|
|
|
94
95
|
export declare function indexModel(model: GraphModel): GraphIndex;
|
|
95
96
|
/** The sources that appear in the model (data for the subgraph / view dropdown). */
|
|
96
97
|
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;
|
|
@@ -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-3JGZ27DC.js";
|
|
6
|
+
import "../chunks/chunk-ISWKAU5G.js";
|
|
7
7
|
import "../chunks/chunk-ZA47FP7C.js";
|
|
8
8
|
export {
|
|
9
9
|
DetailPanel as default
|
|
@@ -28,7 +28,7 @@ import { type ControlId } from './Toolbar.js';
|
|
|
28
28
|
import { type SelectedNode } from './DetailPanel.js';
|
|
29
29
|
import { type RenderEditor } from './EditPanel.js';
|
|
30
30
|
import { type GraphLook } from './Legend.js';
|
|
31
|
-
import { type EditOp } from '../edit.js';
|
|
31
|
+
import { type EditError, type EditOp } from '../edit.js';
|
|
32
32
|
import { type GraphStrings } from '../strings.js';
|
|
33
33
|
/** Where a layout came from (as `onLayout` reports it):
|
|
34
34
|
* `preset` the host's `layout` covered everything · `cache` nothing was computed, an existing result was reused (local cache, or the one already on screen) ·
|
|
@@ -187,11 +187,18 @@ export interface GraphCanvasProps {
|
|
|
187
187
|
* with `applyEdit` to its own model and passes it back, and the transition shows the change. Not editable in compare mode. See edit.ts.
|
|
188
188
|
*/
|
|
189
189
|
onEdit?: (op: EditOp) => void;
|
|
190
|
+
/** Full editable graph when the drawn model omits a layer anchor. */
|
|
191
|
+
editModel?: GraphModel;
|
|
192
|
+
validateEdit?: (op: EditOp) => EditError | null;
|
|
190
193
|
/** Replace the free-form part of the edit panel (label / kind / data, JSON) with the host's own editor. */
|
|
191
194
|
renderEditor?: RenderEditor;
|
|
192
|
-
/** "
|
|
195
|
+
/** "Re-structure" in ⋯: the host re-hangs and renumbers the graph (see cli/restructure.ts) and hands back a new model.
|
|
193
196
|
* Without it the item is absent. Pure callback: the library never edits. */
|
|
194
197
|
onRestructure?: () => void;
|
|
198
|
+
/** Why the layer button is grey. The button is always shown; this text goes in its popover. */
|
|
199
|
+
layerIssue?: string;
|
|
200
|
+
/** "Open the floors anyway" in that popover: the host rebuilds its profile with layers forced on. */
|
|
201
|
+
onForceLayers?: () => void;
|
|
195
202
|
/**
|
|
196
203
|
* How markdown in details (rendered by default) resolves relative URLs: images, links. Return null = cannot resolve
|
|
197
204
|
* (link keeps only its text, image is not drawn). E.g. data extracted from a repository's docs resolves to that repository's raw file URLs.
|
|
@@ -2,10 +2,10 @@
|
|
|
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-
|
|
5
|
+
} from "../chunks/chunk-R2CQA4OJ.js";
|
|
6
|
+
import "../chunks/chunk-SEOAVI3E.js";
|
|
7
|
+
import "../chunks/chunk-3JGZ27DC.js";
|
|
8
|
+
import "../chunks/chunk-ISWKAU5G.js";
|
|
9
9
|
import "../chunks/chunk-YGRPNAXE.js";
|
|
10
10
|
import "../chunks/chunk-ZA47FP7C.js";
|
|
11
11
|
export {
|
package/dist/react/Toolbar.d.ts
CHANGED
|
@@ -37,8 +37,11 @@ export interface ToolbarProps {
|
|
|
37
37
|
onAdd?: (what: 'node' | 'edge') => void;
|
|
38
38
|
/** "Relayout" in ⋯: another arrangement of the same data. Without it the item is absent. */
|
|
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
|
+
/** Why the layer button is grey (it is always shown). `onForceLayers` adds "open the floors anyway". */
|
|
43
|
+
layerIssue?: string;
|
|
44
|
+
onForceLayers?: () => void;
|
|
42
45
|
}
|
|
43
46
|
export default function Toolbar(p: ToolbarProps): import("react").JSX.Element;
|
|
44
47
|
export declare function ZoomDock(p: {
|
package/dist/strings.d.ts
CHANGED
|
@@ -24,6 +24,9 @@ export interface GraphStrings {
|
|
|
24
24
|
stackLayer: (layer: string, on: boolean) => string;
|
|
25
25
|
stack: string;
|
|
26
26
|
stackTip: (on: boolean) => string;
|
|
27
|
+
layersOff: string;
|
|
28
|
+
forceLayers: string;
|
|
29
|
+
ok: string;
|
|
27
30
|
more: string;
|
|
28
31
|
origins: string;
|
|
29
32
|
allOrigins: string;
|
|
@@ -37,6 +40,7 @@ export interface GraphStrings {
|
|
|
37
40
|
legend: string;
|
|
38
41
|
/** Names of the two legend entries without a kind name, and their tooltips. */
|
|
39
42
|
legendPlainName: string;
|
|
43
|
+
noColor: string;
|
|
40
44
|
legendPlain: string;
|
|
41
45
|
legendContainsName: string;
|
|
42
46
|
legendContains: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glassbrain",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.4",
|
|
4
4
|
"description": "Know what your agent knows: open, diff and review the knowledge graphs agents write. Plain JSON in, one html file out.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"knowledge-graph",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"demo:public": "node demo/build.mjs --public",
|
|
89
89
|
"bench": "node demo/build.mjs && node scripts/bench.mjs",
|
|
90
90
|
"pretest": "npm run build",
|
|
91
|
-
"test": "node --test \"test/*.test.ts\""
|
|
91
|
+
"test": "node --test \"test/*.test.ts\"",
|
|
92
|
+
"release:alpha": "node scripts/release-alpha.mjs"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"cytoscape": "^3.30.0",
|
package/schema/graph.schema.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://unpkg.com/glassbrain/schema/graph.schema.json",
|
|
4
4
|
"title": "glassbrain graph",
|
|
5
|
-
"description": "One file of a glassbrain knowledge graph. A graph is nodes plus edges; structure comes from `parent` (containment), not from edges. Every node carries `parent`:
|
|
5
|
+
"description": "One file of a glassbrain knowledge graph. A graph is nodes plus edges; structure comes from `parent` (containment), not from edges. Every node carries `parent`: null for the root, otherwise `\"<id>@<order>\"` where `order` is a positive number or -1 for explicitly unordered. Several files in one folder are merged into one graph (same id = same node). Unknown fields are kept and shown in the detail panel.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"anyOf": [{ "required": ["nodes"] }, { "required": ["edges"] }],
|
|
8
8
|
"properties": {
|
|
@@ -22,12 +22,11 @@
|
|
|
22
22
|
"type": "object",
|
|
23
23
|
"required": ["id", "parent"],
|
|
24
24
|
"properties": {
|
|
25
|
-
"id": { "type": ["string", "number"], "description": "Stable identity. Keep it the same across versions: that is how a diff knows it is the same thing." },
|
|
25
|
+
"id": { "type": ["string", "number"], "pattern": "^[^\\s@]{1,80}$", "description": "Stable identity. Keep it the same across versions: that is how a diff knows it is the same thing. No `@` and no whitespace, at most 80 characters; prefer a short code (`a-z0-9_`, under 20)." },
|
|
26
26
|
"label": { "type": "string", "description": "Display name. Falls back to `name`, then `id`." },
|
|
27
27
|
"name": { "type": "string", "description": "Alias of `label`." },
|
|
28
28
|
"kind": { "type": "string", "description": "What sort of thing this is. Colors come from the profile's `nodePalette[kind]`; kinds not in the palette are drawn as skeleton." },
|
|
29
|
-
"parent": { "type": ["string", "null"], "description": "
|
|
30
|
-
"order": { "type": "number", "exclusiveMinimum": 0, "description": "Position among its siblings (1, 2, 3…; 3.5 inserts between 3 and 4). Either every child of a parent has one or none does, and no two siblings share one." },
|
|
29
|
+
"parent": { "type": ["string", "null"], "pattern": "^[^\\s@]{1,80}@(-1|[1-9]\\d*(\\.\\d+)?|0\\.\\d*[1-9]\\d*)$", "description": "`\"<id>@<order>\"`: the id of the node this one sits inside, then its position among the siblings (1, 2, 3…; 3.5 inserts between 3 and 4), or -1 for explicitly unordered. null for the root. Required: the only source of structure, and the layout, the layers and the outline are all built from it." },
|
|
31
30
|
"flags": { "type": "array", "items": { "type": "string" }, "description": "Boolean markers; each becomes a CSS-like class. A flag listed in the profile's `placeholderFlags` draws the node as a placeholder." },
|
|
32
31
|
"description": { "type": "string", "description": "Markdown shown in the detail panel. `[text](node:<id>)` links jump to another node." }
|
|
33
32
|
},
|