glassbrain 0.2.0-alpha.6 → 0.2.0-alpha.8

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.
Files changed (45) hide show
  1. package/README.md +6 -7
  2. package/dist/chunks/{chunk-LMYD4QHC.js → chunk-3CNHFYHG.js} +1329 -1610
  3. package/dist/chunks/chunk-7PWRJEZT.js +35 -0
  4. package/dist/chunks/chunk-CHOCJIOD.js +1340 -0
  5. package/dist/chunks/chunk-DHYIMBHU.js +960 -0
  6. package/dist/chunks/{chunk-3SAL4526.js → chunk-NDUF3CBQ.js} +349 -989
  7. package/dist/cli/glassbrain.js +441 -230
  8. package/dist/cli/viewer.js +228 -194
  9. package/dist/core.d.ts +2 -0
  10. package/dist/core.js +54 -26
  11. package/dist/diff.d.ts +9 -1
  12. package/dist/edit.d.ts +10 -0
  13. package/dist/index.js +63 -35
  14. package/dist/internal.d.ts +1 -0
  15. package/dist/internal.js +103 -73
  16. package/dist/kinds.d.ts +23 -0
  17. package/dist/layers.d.ts +3 -1
  18. package/dist/lint-report.d.ts +70 -0
  19. package/dist/profile.d.ts +15 -3
  20. package/dist/react/DetailPanel.d.ts +31 -1
  21. package/dist/react/DetailPanel.js +8 -4
  22. package/dist/react/EdgeMark.d.ts +22 -0
  23. package/dist/react/EditPanel.d.ts +6 -6
  24. package/dist/react/GraphCanvas.d.ts +18 -5
  25. package/dist/react/GraphCanvas.js +4 -4
  26. package/dist/react/Inspector.d.ts +72 -0
  27. package/dist/react/ObjectRef.d.ts +12 -0
  28. package/dist/react/Toolbar.d.ts +10 -3
  29. package/dist/react/ZoomBoundary.d.ts +4 -0
  30. package/dist/react/camera.d.ts +7 -0
  31. package/dist/react/i18n.d.ts +2 -2
  32. package/dist/react/icons.d.ts +7 -1
  33. package/dist/react/input.d.ts +5 -3
  34. package/dist/react/useSubgraph.d.ts +15 -0
  35. package/dist/shell.d.ts +1 -0
  36. package/dist/strings.d.ts +24 -3
  37. package/dist/style.d.ts +2 -0
  38. package/dist/subgraph.d.ts +13 -0
  39. package/dist/tree.d.ts +1 -0
  40. package/dist/view.d.ts +3 -1
  41. package/package.json +1 -1
  42. package/schema/profile.schema.json +2 -2
  43. package/dist/chunks/chunk-3P34XHQ2.js +0 -244
  44. package/dist/chunks/chunk-5DEN6HXJ.js +0 -99
  45. package/dist/chunks/chunk-M3MAM2VD.js +0 -67
package/dist/core.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './model.js';
2
2
  export * from './profile.js';
3
3
  export * from './layers.js';
4
4
  export * from './view.js';
5
+ export * from './subgraph.js';
5
6
  export * from './elements.js';
6
7
  export * from './style.js';
7
8
  export * from './diff.js';
@@ -9,3 +10,4 @@ export * from './edit.js';
9
10
  export * from './strings.js';
10
11
  export { DEFAULT_ANIMATE, type AnimateSpec, type TransitionReport } from './animate.js';
11
12
  export { DEFAULT_DIFF_LAYOUT, type DiffLayoutSpec, type DiffLayoutResult } from './layout/diff-layout.js';
13
+ export { kindDistribution, kindHeading, kindSummary, type KindDistribution } from './kinds.js';
package/dist/core.js CHANGED
@@ -1,21 +1,49 @@
1
1
  import {
2
+ kindDistribution,
3
+ kindHeading,
4
+ kindSummary
5
+ } from "./chunks/chunk-7PWRJEZT.js";
6
+ import {
7
+ DEFAULT_ANIMATE,
8
+ DEFAULT_DIFF_LAYOUT,
9
+ FULL_VIEW,
2
10
  childrenMap,
11
+ defaultProfile,
12
+ defineProfile,
3
13
  deriveLayers,
14
+ isFiltering,
15
+ isNarrowing,
16
+ kindTable,
4
17
  layerIndexOf,
5
- orderedChildren
6
- } from "./chunks/chunk-M3MAM2VD.js";
18
+ layerView,
19
+ orderedChildren,
20
+ originView,
21
+ parsePhysical,
22
+ parseQuery,
23
+ parseSources,
24
+ planeView,
25
+ projectSubgraph,
26
+ queryMarker,
27
+ resolveView,
28
+ searchNodes,
29
+ subgraphFloors,
30
+ toBundle,
31
+ toPhysical,
32
+ validateModel,
33
+ validateModelBySource,
34
+ validateStructure
35
+ } from "./chunks/chunk-DHYIMBHU.js";
7
36
  import {
8
37
  CONTENT_SCALE,
9
38
  DARK_THEME,
10
- DEFAULT_ANIMATE,
11
- DEFAULT_DIFF_LAYOUT,
12
39
  DIFF_COLORS,
13
40
  DIFF_FLAG,
14
41
  DIFF_INK,
15
42
  EDGE_W,
16
43
  EMPTY_MODEL,
17
- FULL_VIEW,
44
+ EN,
18
45
  GK_CSS,
46
+ HOVER_FADE_MS,
19
47
  KEPT_FLAG,
20
48
  LABEL_MAX_EM,
21
49
  LIGHT_THEME,
@@ -39,49 +67,35 @@ import {
39
67
  cls,
40
68
  countByKind,
41
69
  defaultNodeColor,
42
- defaultProfile,
43
- defineProfile,
44
70
  diffModels,
45
71
  diffStyle,
72
+ edgeContent,
73
+ edgeContentChanged,
74
+ edgeKey,
46
75
  edgeKindClass,
47
76
  edgesOf,
48
77
  graphStyle,
49
78
  hasChanges,
50
79
  indexModel,
51
- isFiltering,
52
- isNarrowing,
53
80
  isNodeEl,
54
81
  mergeSlices,
55
82
  mixHex,
56
83
  nodeClasses,
57
84
  nodeDiameter,
58
85
  nodeWeight,
59
- originView,
60
86
  originsOf,
61
87
  originsOfNode,
62
88
  paletteStyle,
63
- parsePhysical,
64
- parseQuery,
65
- parseSources,
66
- planeView,
67
89
  plateColors,
68
- queryMarker,
69
- resolveView,
70
- searchNodes,
90
+ sameEdge,
71
91
  shareT,
72
92
  skeletonColor,
93
+ stable,
73
94
  stepUnion,
74
95
  themeColor,
75
- toBundle,
76
- toPhysical,
77
96
  unionSides,
78
- untheme,
79
- validateModel,
80
- validateStructure
81
- } from "./chunks/chunk-3SAL4526.js";
82
- import {
83
- EN
84
- } from "./chunks/chunk-5DEN6HXJ.js";
97
+ untheme
98
+ } from "./chunks/chunk-NDUF3CBQ.js";
85
99
  import "./chunks/chunk-ZA47FP7C.js";
86
100
  export {
87
101
  CONTENT_SCALE,
@@ -96,6 +110,7 @@ export {
96
110
  EN,
97
111
  FULL_VIEW,
98
112
  GK_CSS,
113
+ HOVER_FADE_MS,
99
114
  KEPT_FLAG,
100
115
  LABEL_MAX_EM,
101
116
  LIGHT_THEME,
@@ -125,6 +140,9 @@ export {
125
140
  deriveLayers,
126
141
  diffModels,
127
142
  diffStyle,
143
+ edgeContent,
144
+ edgeContentChanged,
145
+ edgeKey,
128
146
  edgeKindClass,
129
147
  edgesOf,
130
148
  graphStyle,
@@ -133,7 +151,12 @@ export {
133
151
  isFiltering,
134
152
  isNarrowing,
135
153
  isNodeEl,
154
+ kindDistribution,
155
+ kindHeading,
156
+ kindSummary,
157
+ kindTable,
136
158
  layerIndexOf,
159
+ layerView,
137
160
  mergeSlices,
138
161
  mixHex,
139
162
  nodeClasses,
@@ -149,17 +172,22 @@ export {
149
172
  parseSources,
150
173
  planeView,
151
174
  plateColors,
175
+ projectSubgraph,
152
176
  queryMarker,
153
177
  resolveView,
178
+ sameEdge,
154
179
  searchNodes,
155
180
  shareT,
156
181
  skeletonColor,
182
+ stable,
157
183
  stepUnion,
184
+ subgraphFloors,
158
185
  themeColor,
159
186
  toBundle,
160
187
  toPhysical,
161
188
  unionSides,
162
189
  untheme,
163
190
  validateModel,
191
+ validateModelBySource,
164
192
  validateStructure
165
193
  };
package/dist/diff.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type GraphModel, type GraphNode } from './model.js';
1
+ import { type GraphEdge, type GraphModel, type GraphNode } from './model.js';
2
2
  export type ChangeKind = 'added' | 'removed' | 'changed' | 'moved' | 'merged';
3
3
  /** Change mark -> node flag (and so a cytoscape class). The `gb-` prefix is reserved by the core. */
4
4
  export declare const DIFF_FLAG: Record<ChangeKind, string>;
@@ -53,6 +53,8 @@ export interface NodeChange {
53
53
  amount?: number;
54
54
  }
55
55
  export interface GraphDelta {
56
+ /** Preserve identity and field rules when comparing a projection of these versions. */
57
+ options?: DiffOptions;
56
58
  /** The union model. Nodes carry diff flags; layout and rendering only ever see this one. */
57
59
  model: GraphModel;
58
60
  changes: NodeChange[];
@@ -80,7 +82,13 @@ export interface GraphDelta {
80
82
  */
81
83
  before: GraphModel;
82
84
  after: GraphModel;
85
+ ignore?: string[];
83
86
  }
87
+ export declare const stable: (v: unknown, ignore: Set<string>) => string;
88
+ export declare const edgeKey: (e: GraphEdge) => string;
89
+ /** Endpoints and kind form the identity. Native input also carries them in the raw record. */
90
+ export declare function edgeContent(edge: GraphEdge): Record<string, unknown>;
91
+ export declare function edgeContentChanged(before: GraphEdge, after: GraphEdge, ignore: Set<string>): boolean;
84
92
  /**
85
93
  * Two model versions -> union model + change list.
86
94
  *
package/dist/edit.d.ts CHANGED
@@ -36,11 +36,21 @@ export type EditOp =
36
36
  } | {
37
37
  op: 'addEdge';
38
38
  edge: EdgeFields;
39
+ origin?: string;
40
+ } | {
41
+ op: 'updateEdge';
42
+ edge: EdgeRef;
43
+ set: Partial<EdgeRef & {
44
+ label: string;
45
+ }>;
39
46
  } | {
40
47
  op: 'removeEdge';
41
48
  edge: EdgeRef;
42
49
  };
43
50
  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';
51
+ /** An edge is defined by its two ends + kind (as in compare; `id` takes no part). Several with the same ends and kind are one edge written several times,
52
+ * deleted together; validation reports such duplicates (see `validateStructure`). */
53
+ export declare const sameEdge: (e: GraphEdge, r: EdgeRef) => boolean;
44
54
  /** Whether this op can be applied. null = yes; otherwise the reason (the UI looks it up in `strings.error`). */
45
55
  export declare function checkEdit(model: GraphModel, op: EditOp): EditError | null;
46
56
  /** How many edges hang on a node (the ones that go with it when it is deleted). */
package/dist/index.js CHANGED
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
  import "./chunks/chunk-SA6RSWZP.js";
3
3
  import {
4
- childrenMap,
5
- deriveLayers,
6
- layerIndexOf,
7
- orderedChildren
8
- } from "./chunks/chunk-M3MAM2VD.js";
4
+ kindDistribution,
5
+ kindHeading,
6
+ kindSummary
7
+ } from "./chunks/chunk-7PWRJEZT.js";
9
8
  import {
10
9
  ALL_CONTROLS,
11
10
  DEFAULT_PLANES,
@@ -14,19 +13,53 @@ import {
14
13
  clearLayoutCache,
15
14
  computeLayout,
16
15
  projectPlanes
17
- } from "./chunks/chunk-LMYD4QHC.js";
16
+ } from "./chunks/chunk-3CNHFYHG.js";
18
17
  import {
19
- CONTENT_SCALE,
20
- DARK_THEME,
21
18
  DEFAULT_ANIMATE,
22
19
  DEFAULT_DIFF_LAYOUT,
20
+ FULL_VIEW,
21
+ childrenMap,
22
+ defaultProfile,
23
+ defineProfile,
24
+ deriveLayers,
25
+ isFiltering,
26
+ isNarrowing,
27
+ kindTable,
28
+ layerIndexOf,
29
+ layerView,
30
+ orderedChildren,
31
+ originView,
32
+ parsePhysical,
33
+ parseQuery,
34
+ parseSources,
35
+ planeView,
36
+ projectSubgraph,
37
+ queryMarker,
38
+ resolveView,
39
+ searchNodes,
40
+ subgraphFloors,
41
+ toBundle,
42
+ toPhysical,
43
+ validateModel,
44
+ validateModelBySource,
45
+ validateStructure
46
+ } from "./chunks/chunk-DHYIMBHU.js";
47
+ import {
48
+ DetailPanel,
49
+ renderInline,
50
+ renderMarkdown
51
+ } from "./chunks/chunk-CHOCJIOD.js";
52
+ import {
53
+ CONTENT_SCALE,
54
+ DARK_THEME,
23
55
  DIFF_COLORS,
24
56
  DIFF_FLAG,
25
57
  DIFF_INK,
26
58
  EDGE_W,
27
59
  EMPTY_MODEL,
28
- FULL_VIEW,
60
+ EN,
29
61
  GK_CSS,
62
+ HOVER_FADE_MS,
30
63
  KEPT_FLAG,
31
64
  LABEL_MAX_EM,
32
65
  LIGHT_THEME,
@@ -50,54 +83,35 @@ import {
50
83
  cls,
51
84
  countByKind,
52
85
  defaultNodeColor,
53
- defaultProfile,
54
- defineProfile,
55
86
  diffModels,
56
87
  diffStyle,
88
+ edgeContent,
89
+ edgeContentChanged,
90
+ edgeKey,
57
91
  edgeKindClass,
58
92
  edgesOf,
59
93
  graphStyle,
60
94
  hasChanges,
61
95
  indexModel,
62
- isFiltering,
63
- isNarrowing,
64
96
  isNodeEl,
65
97
  mergeSlices,
66
98
  mixHex,
67
99
  nodeClasses,
68
100
  nodeDiameter,
69
101
  nodeWeight,
70
- originView,
71
102
  originsOf,
72
103
  originsOfNode,
73
104
  paletteStyle,
74
- parsePhysical,
75
- parseQuery,
76
- parseSources,
77
- planeView,
78
105
  plateColors,
79
- queryMarker,
80
- resolveView,
81
- searchNodes,
106
+ sameEdge,
82
107
  shareT,
83
108
  skeletonColor,
109
+ stable,
84
110
  stepUnion,
85
111
  themeColor,
86
- toBundle,
87
- toPhysical,
88
112
  unionSides,
89
- untheme,
90
- validateModel,
91
- validateStructure
92
- } from "./chunks/chunk-3SAL4526.js";
93
- import {
94
- DetailPanel,
95
- renderInline,
96
- renderMarkdown
97
- } from "./chunks/chunk-3P34XHQ2.js";
98
- import {
99
- EN
100
- } from "./chunks/chunk-5DEN6HXJ.js";
113
+ untheme
114
+ } from "./chunks/chunk-NDUF3CBQ.js";
101
115
  import "./chunks/chunk-OE5IRKWZ.js";
102
116
  import "./chunks/chunk-ZA47FP7C.js";
103
117
  export {
@@ -117,6 +131,7 @@ export {
117
131
  FULL_VIEW,
118
132
  GK_CSS,
119
133
  GraphCanvas,
134
+ HOVER_FADE_MS,
120
135
  KEPT_FLAG,
121
136
  LABEL_MAX_EM,
122
137
  LIGHT_THEME,
@@ -149,6 +164,9 @@ export {
149
164
  deriveLayers,
150
165
  diffModels,
151
166
  diffStyle,
167
+ edgeContent,
168
+ edgeContentChanged,
169
+ edgeKey,
152
170
  edgeKindClass,
153
171
  edgesOf,
154
172
  graphStyle,
@@ -157,7 +175,12 @@ export {
157
175
  isFiltering,
158
176
  isNarrowing,
159
177
  isNodeEl,
178
+ kindDistribution,
179
+ kindHeading,
180
+ kindSummary,
181
+ kindTable,
160
182
  layerIndexOf,
183
+ layerView,
161
184
  mergeSlices,
162
185
  mixHex,
163
186
  nodeClasses,
@@ -174,19 +197,24 @@ export {
174
197
  planeView,
175
198
  plateColors,
176
199
  projectPlanes,
200
+ projectSubgraph,
177
201
  queryMarker,
178
202
  renderInline,
179
203
  renderMarkdown,
180
204
  resolveView,
205
+ sameEdge,
181
206
  searchNodes,
182
207
  shareT,
183
208
  skeletonColor,
209
+ stable,
184
210
  stepUnion,
211
+ subgraphFloors,
185
212
  themeColor,
186
213
  toBundle,
187
214
  toPhysical,
188
215
  unionSides,
189
216
  untheme,
190
217
  validateModel,
218
+ validateModelBySource,
191
219
  validateStructure
192
220
  };
@@ -7,3 +7,4 @@ export { planLabels, labelBox, idPhase, type LabelInput, type LabelPlan, type La
7
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';
10
+ export { frameTranslation } from './react/camera.js';