glassbrain 0.2.0-alpha.6 → 0.2.0-alpha.7

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/core.d.ts CHANGED
@@ -9,3 +9,4 @@ export * from './edit.js';
9
9
  export * from './strings.js';
10
10
  export { DEFAULT_ANIMATE, type AnimateSpec, type TransitionReport } from './animate.js';
11
11
  export { DEFAULT_DIFF_LAYOUT, type DiffLayoutSpec, type DiffLayoutResult } from './layout/diff-layout.js';
12
+ export { kindDistribution, kindHeading, kindSummary, type KindDistribution } from './kinds.js';
package/dist/core.js CHANGED
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  childrenMap,
3
3
  deriveLayers,
4
+ kindDistribution,
5
+ kindHeading,
6
+ kindSummary,
4
7
  layerIndexOf,
5
8
  orderedChildren
6
- } from "./chunks/chunk-M3MAM2VD.js";
9
+ } from "./chunks/chunk-LK77SYCN.js";
7
10
  import {
8
11
  CONTENT_SCALE,
9
12
  DARK_THEME,
@@ -51,6 +54,7 @@ import {
51
54
  isFiltering,
52
55
  isNarrowing,
53
56
  isNodeEl,
57
+ kindTable,
54
58
  mergeSlices,
55
59
  mixHex,
56
60
  nodeClasses,
@@ -78,10 +82,10 @@ import {
78
82
  untheme,
79
83
  validateModel,
80
84
  validateStructure
81
- } from "./chunks/chunk-3SAL4526.js";
85
+ } from "./chunks/chunk-FNTYI7VP.js";
82
86
  import {
83
87
  EN
84
- } from "./chunks/chunk-5DEN6HXJ.js";
88
+ } from "./chunks/chunk-Q35ZKWKF.js";
85
89
  import "./chunks/chunk-ZA47FP7C.js";
86
90
  export {
87
91
  CONTENT_SCALE,
@@ -133,6 +137,10 @@ export {
133
137
  isFiltering,
134
138
  isNarrowing,
135
139
  isNodeEl,
140
+ kindDistribution,
141
+ kindHeading,
142
+ kindSummary,
143
+ kindTable,
136
144
  layerIndexOf,
137
145
  mergeSlices,
138
146
  mixHex,
package/dist/index.js CHANGED
@@ -3,9 +3,12 @@ import "./chunks/chunk-SA6RSWZP.js";
3
3
  import {
4
4
  childrenMap,
5
5
  deriveLayers,
6
+ kindDistribution,
7
+ kindHeading,
8
+ kindSummary,
6
9
  layerIndexOf,
7
10
  orderedChildren
8
- } from "./chunks/chunk-M3MAM2VD.js";
11
+ } from "./chunks/chunk-LK77SYCN.js";
9
12
  import {
10
13
  ALL_CONTROLS,
11
14
  DEFAULT_PLANES,
@@ -14,7 +17,7 @@ import {
14
17
  clearLayoutCache,
15
18
  computeLayout,
16
19
  projectPlanes
17
- } from "./chunks/chunk-LMYD4QHC.js";
20
+ } from "./chunks/chunk-GZSWZSSE.js";
18
21
  import {
19
22
  CONTENT_SCALE,
20
23
  DARK_THEME,
@@ -62,6 +65,7 @@ import {
62
65
  isFiltering,
63
66
  isNarrowing,
64
67
  isNodeEl,
68
+ kindTable,
65
69
  mergeSlices,
66
70
  mixHex,
67
71
  nodeClasses,
@@ -89,15 +93,15 @@ import {
89
93
  untheme,
90
94
  validateModel,
91
95
  validateStructure
92
- } from "./chunks/chunk-3SAL4526.js";
96
+ } from "./chunks/chunk-FNTYI7VP.js";
93
97
  import {
94
98
  DetailPanel,
95
99
  renderInline,
96
100
  renderMarkdown
97
- } from "./chunks/chunk-3P34XHQ2.js";
101
+ } from "./chunks/chunk-3KUNYSJE.js";
98
102
  import {
99
103
  EN
100
- } from "./chunks/chunk-5DEN6HXJ.js";
104
+ } from "./chunks/chunk-Q35ZKWKF.js";
101
105
  import "./chunks/chunk-OE5IRKWZ.js";
102
106
  import "./chunks/chunk-ZA47FP7C.js";
103
107
  export {
@@ -157,6 +161,10 @@ export {
157
161
  isFiltering,
158
162
  isNarrowing,
159
163
  isNodeEl,
164
+ kindDistribution,
165
+ kindHeading,
166
+ kindSummary,
167
+ kindTable,
160
168
  layerIndexOf,
161
169
  mergeSlices,
162
170
  mixHex,
package/dist/internal.js CHANGED
@@ -3,9 +3,12 @@ import "./chunks/chunk-SA6RSWZP.js";
3
3
  import {
4
4
  childrenMap,
5
5
  deriveLayers,
6
+ kindDistribution,
7
+ kindHeading,
8
+ kindSummary,
6
9
  layerIndexOf,
7
10
  orderedChildren
8
- } from "./chunks/chunk-M3MAM2VD.js";
11
+ } from "./chunks/chunk-LK77SYCN.js";
9
12
  import {
10
13
  ALL_CONTROLS,
11
14
  DEFAULT_PLANES,
@@ -48,7 +51,7 @@ import {
48
51
  shapeOf,
49
52
  skeletonLineOf,
50
53
  touchGestures
51
- } from "./chunks/chunk-LMYD4QHC.js";
54
+ } from "./chunks/chunk-GZSWZSSE.js";
52
55
  import {
53
56
  CONTENT_SCALE,
54
57
  DARK_THEME,
@@ -111,6 +114,7 @@ import {
111
114
  isFiltering,
112
115
  isNarrowing,
113
116
  isNodeEl,
117
+ kindTable,
114
118
  leavingOf,
115
119
  makeScore,
116
120
  mergeSlices,
@@ -148,15 +152,15 @@ import {
148
152
  untheme,
149
153
  validateModel,
150
154
  validateStructure
151
- } from "./chunks/chunk-3SAL4526.js";
155
+ } from "./chunks/chunk-FNTYI7VP.js";
152
156
  import {
153
157
  DetailPanel,
154
158
  renderInline,
155
159
  renderMarkdown
156
- } from "./chunks/chunk-3P34XHQ2.js";
160
+ } from "./chunks/chunk-3KUNYSJE.js";
157
161
  import {
158
162
  EN
159
- } from "./chunks/chunk-5DEN6HXJ.js";
163
+ } from "./chunks/chunk-Q35ZKWKF.js";
160
164
  import "./chunks/chunk-OE5IRKWZ.js";
161
165
  import "./chunks/chunk-ZA47FP7C.js";
162
166
  export {
@@ -255,6 +259,10 @@ export {
255
259
  isFiltering,
256
260
  isNarrowing,
257
261
  isNodeEl,
262
+ kindDistribution,
263
+ kindHeading,
264
+ kindSummary,
265
+ kindTable,
258
266
  labelBox,
259
267
  layerIndexOf,
260
268
  leavingOf,
@@ -0,0 +1,23 @@
1
+ /** Vocabulary fragmentation, measured independently for nodes and semantic edges.
2
+ * Hill diversity at q=1/2 gives sparse categories more weight than Shannon diversity.
3
+ * Logarithmic growth avoids allowing thousands of categories in a large graph.
4
+ * This is a readability heuristic, not a test of semantic correctness.
5
+ */
6
+ export declare function kindDistribution(items: readonly {
7
+ kind?: string;
8
+ }[]): {
9
+ total: number;
10
+ typed: number;
11
+ missing: number;
12
+ count: number;
13
+ sizes: {
14
+ kind: string;
15
+ count: number;
16
+ }[];
17
+ effective: number;
18
+ fragmentation: number;
19
+ reason: string | null;
20
+ };
21
+ export type KindDistribution = ReturnType<typeof kindDistribution>;
22
+ export declare function kindHeading(space: 'node' | 'edge', d: KindDistribution): string;
23
+ export declare function kindSummary(space: 'node' | 'edge', d: KindDistribution, labels?: Record<string, string>): string;
package/dist/profile.d.ts CHANGED
@@ -30,7 +30,9 @@ export interface DetailSpec {
30
30
  }
31
31
  export interface GraphIssue {
32
32
  kind: string;
33
- level: 'error' | 'warn';
33
+ level: 'error' | 'warn' | 'info';
34
+ where?: string;
35
+ fix?: string;
34
36
  /** What this category is called (the issues panel groups by it, e.g. "dangling edge"). Defaults to kind. */
35
37
  group?: string;
36
38
  message: string;
@@ -124,6 +126,8 @@ export declare function toBundle(model: GraphModel, profile?: Record<string, unk
124
126
  * **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).
125
127
  * So two edges with the same ends and kind are one edge written twice: only one is drawn, and deleting removes both. */
126
128
  export declare function validateStructure(model: GraphModel): GraphIssue[];
129
+ /** Kind ids are user data, including ordinary strings such as "constructor". */
130
+ export declare function kindTable<T>(...entries: (Record<string, T> | undefined)[]): Record<string, T>;
127
131
  /** Complete a (possibly very sparse) input into a full profile. The defaults are the "generic graph" behavior. */
128
132
  export declare function defineProfile(input: ProfileInput): GraphProfile;
129
133
  /** Zero-configuration profile: reads `{nodes, edges}` directly. */
@@ -2,8 +2,8 @@
2
2
  "use client";
3
3
  import {
4
4
  DetailPanel
5
- } from "../chunks/chunk-3P34XHQ2.js";
6
- import "../chunks/chunk-5DEN6HXJ.js";
5
+ } from "../chunks/chunk-3KUNYSJE.js";
6
+ import "../chunks/chunk-Q35ZKWKF.js";
7
7
  import "../chunks/chunk-ZA47FP7C.js";
8
8
  export {
9
9
  DetailPanel as default
@@ -0,0 +1,11 @@
1
+ import type { Plate } from '../layout/planes.js';
2
+ import { type GraphTheme } from '../style.js';
3
+ import type { Viewport } from './camera.js';
4
+ /** Frost lives below the graph canvases: nodes and text are never blurred. */
5
+ export default function GlassPlanes({ plates, viewport, theme, alpha, hot }: {
6
+ plates: Plate[];
7
+ viewport: Viewport;
8
+ theme: GraphTheme;
9
+ alpha: number;
10
+ hot: string | null;
11
+ }): import("react").JSX.Element;
@@ -88,6 +88,8 @@ export interface GraphCanvasProps {
88
88
  onSelect?: (node: SelectedNode | null) => void;
89
89
  /** Receives the cytoscape instance (for debugging / custom interaction). Called again when the instance is rebuilt. */
90
90
  onReady?: (cy: any) => void;
91
+ /** Complete diagnostics supplied by the host, independent of view filtering. */
92
+ issues?: GraphIssue[];
91
93
  /** Validation results go out; turn showIssues off when the host shows them itself. */
92
94
  onIssues?: (issues: GraphIssue[]) => void;
93
95
  showIssues?: boolean;
@@ -2,10 +2,10 @@
2
2
  "use client";
3
3
  import {
4
4
  GraphCanvas
5
- } from "../chunks/chunk-LMYD4QHC.js";
6
- import "../chunks/chunk-3SAL4526.js";
7
- import "../chunks/chunk-3P34XHQ2.js";
8
- import "../chunks/chunk-5DEN6HXJ.js";
5
+ } from "../chunks/chunk-GZSWZSSE.js";
6
+ import "../chunks/chunk-FNTYI7VP.js";
7
+ import "../chunks/chunk-3KUNYSJE.js";
8
+ import "../chunks/chunk-Q35ZKWKF.js";
9
9
  import "../chunks/chunk-OE5IRKWZ.js";
10
10
  import "../chunks/chunk-ZA47FP7C.js";
11
11
  export {
@@ -10,6 +10,8 @@ export declare const I: {
10
10
  fit: string;
11
11
  more: string;
12
12
  warn: string;
13
+ error: string;
14
+ info: string;
13
15
  arrow: string;
14
16
  stack: string;
15
17
  edit: string;
package/dist/strings.d.ts CHANGED
@@ -30,8 +30,8 @@ export interface GraphStrings {
30
30
  more: string;
31
31
  origins: string;
32
32
  allOrigins: string;
33
- issuesTip: (errors: number, warns: number) => string;
34
- issuesTitle: (errors: number, warns: number) => string;
33
+ issuesTip: (errors: number, warns: number, infos?: number) => string;
34
+ issuesTitle: (errors: number, warns: number, infos?: number) => string;
35
35
  moreItems: (n: number) => string;
36
36
  cameraTip: string;
37
37
  zoomIn: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glassbrain",
3
- "version": "0.2.0-alpha.6",
3
+ "version": "0.2.0-alpha.7",
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",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://unpkg.com/glassbrain/schema/profile.schema.json",
4
4
  "title": "glassbrain profile (_profile.json)",
5
- "description": "The declarative part of a glassbrain profile, as a `_profile.json` next to the graph files. Everything is optional: with no profile a graph still renders (kinds without a color are drawn as skeleton). Layers are not configured here: they are derived from `order` in the graph. Parsers, merge and domain validation are code and live in a TypeScript profile instead.",
5
+ "description": "The declarative part of a glassbrain profile, as a `_profile.json` next to the graph files. Everything is optional: with no profile a graph still renders (kinds without a color are drawn as skeleton). Layers are not configured here: they are derived from the order of children in the graph. Parsers, merge and domain validation are code and live in a TypeScript profile instead.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "nodePalette": {
@@ -42,7 +42,7 @@
42
42
  "properties": {
43
43
  "defaultLayers": {
44
44
  "type": "boolean",
45
- "description": "Open with the layer (2.5D plane) view on when the graph has ordered siblings. Default false."
45
+ "description": "Open with the layer (2.5D plane) view on when the graph has ordered siblings. By default, opens layered when the graph has two or more floors."
46
46
  },
47
47
  "layerColors": {
48
48
  "type": "array",