glassbrain 0.1.2 → 0.1.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/dist/core.js CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  buildModel,
30
30
  changedSubset,
31
31
  checkEdit,
32
+ chromeStyle,
32
33
  cls,
33
34
  countByKind,
34
35
  defaultNodeColor,
@@ -69,7 +70,7 @@ import {
69
70
  untheme,
70
71
  validateModel,
71
72
  validateStructure
72
- } from "./chunks/chunk-UJCALP4P.js";
73
+ } from "./chunks/chunk-VCM766BZ.js";
73
74
  import {
74
75
  EN
75
76
  } from "./chunks/chunk-EJURBBFC.js";
@@ -105,6 +106,7 @@ export {
105
106
  buildModel,
106
107
  changedSubset,
107
108
  checkEdit,
109
+ chromeStyle,
108
110
  cls,
109
111
  countByKind,
110
112
  defaultNodeColor,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  clearLayoutCache,
10
10
  computeLayout,
11
11
  projectPlanes
12
- } from "./chunks/chunk-3CNKH3HB.js";
12
+ } from "./chunks/chunk-CAXDADCO.js";
13
13
  import {
14
14
  CONTENT_SCALE,
15
15
  DARK_THEME,
@@ -40,6 +40,7 @@ import {
40
40
  buildModel,
41
41
  changedSubset,
42
42
  checkEdit,
43
+ chromeStyle,
43
44
  cls,
44
45
  countByKind,
45
46
  defaultNodeColor,
@@ -80,7 +81,7 @@ import {
80
81
  untheme,
81
82
  validateModel,
82
83
  validateStructure
83
- } from "./chunks/chunk-UJCALP4P.js";
84
+ } from "./chunks/chunk-VCM766BZ.js";
84
85
  import {
85
86
  DetailPanel,
86
87
  renderInline,
@@ -127,6 +128,7 @@ export {
127
128
  buildModel,
128
129
  changedSubset,
129
130
  checkEdit,
131
+ chromeStyle,
130
132
  clearLayoutCache,
131
133
  cls,
132
134
  computeLayout,
@@ -5,3 +5,5 @@ export { diffPositions, solveDiffLayout, type DiffSides, type DiffSolve, } from
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
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';
8
+ export { touchGestures } from './react/touch.js';
9
+ export { placePanel } from './react/placement.js';
package/dist/internal.js CHANGED
@@ -32,6 +32,7 @@ import {
32
32
  hittable,
33
33
  idPhase,
34
34
  labelBox,
35
+ placePanel,
35
36
  planLabels,
36
37
  projectPlanes,
37
38
  reachOf,
@@ -39,8 +40,9 @@ import {
39
40
  relaxOverlaps,
40
41
  semanticAlphaOf,
41
42
  shapeOf,
42
- skeletonLineOf
43
- } from "./chunks/chunk-3CNKH3HB.js";
43
+ skeletonLineOf,
44
+ touchGestures
45
+ } from "./chunks/chunk-CAXDADCO.js";
44
46
  import {
45
47
  CONTENT_SCALE,
46
48
  DARK_THEME,
@@ -77,6 +79,7 @@ import {
77
79
  buildModel,
78
80
  changedSubset,
79
81
  checkEdit,
82
+ chromeStyle,
80
83
  cls,
81
84
  countByKind,
82
85
  defaultNodeColor,
@@ -136,7 +139,7 @@ import {
136
139
  untheme,
137
140
  validateModel,
138
141
  validateStructure
139
- } from "./chunks/chunk-UJCALP4P.js";
142
+ } from "./chunks/chunk-VCM766BZ.js";
140
143
  import {
141
144
  DetailPanel,
142
145
  renderInline,
@@ -204,6 +207,7 @@ export {
204
207
  buildModel,
205
208
  changedSubset,
206
209
  checkEdit,
210
+ chromeStyle,
207
211
  clearLayoutCache,
208
212
  clippedLength,
209
213
  cls,
@@ -252,6 +256,7 @@ export {
252
256
  parsePhysical,
253
257
  parseQuery,
254
258
  parseSources,
259
+ placePanel,
255
260
  planLabels,
256
261
  planSkins,
257
262
  planTransition,
@@ -278,6 +283,7 @@ export {
278
283
  stepUnion,
279
284
  themeColor,
280
285
  toPhysical,
286
+ touchGestures,
281
287
  trackAt,
282
288
  trackLin,
283
289
  unionSides,
@@ -74,7 +74,7 @@ export interface GraphCanvasProps {
74
74
  * import { workerPool } from 'glassbrain/layout/worker-pool';
75
75
  * The library does not guess the host's bundler, so the default is the one that always works. */
76
76
  pool?: LayoutRunnerPool;
77
- /** Primitive theme (skeleton color, canvas background…). Pure look: swapping it swaps the stylesheet, no rebuild, no relayout. */
77
+ /** Graph colors and matching controls. Pure look: swapping the theme never rebuilds or relays out the graph. */
78
78
  theme?: GraphTheme;
79
79
  className?: string;
80
80
  style?: CSSProperties;
@@ -2,8 +2,8 @@
2
2
  "use client";
3
3
  import {
4
4
  GraphCanvas
5
- } from "../chunks/chunk-3CNKH3HB.js";
6
- import "../chunks/chunk-UJCALP4P.js";
5
+ } from "../chunks/chunk-CAXDADCO.js";
6
+ import "../chunks/chunk-VCM766BZ.js";
7
7
  import "../chunks/chunk-37BAJC3L.js";
8
8
  import "../chunks/chunk-EJURBBFC.js";
9
9
  import "../chunks/chunk-YGRPNAXE.js";
@@ -0,0 +1,11 @@
1
+ interface InputActions {
2
+ interact(): void;
3
+ cancelFly(): void;
4
+ select(target: any | null): void;
5
+ selectTouch(target: any | null): void;
6
+ hover?(target: any | null): void;
7
+ preview(target: any | null): void;
8
+ focus?(id: string): void;
9
+ }
10
+ export declare function installGraphInput(cy: any, el: HTMLElement, actions: InputActions): () => void;
11
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type RefObject } from 'react';
2
+ export type Side = 'top' | 'bottom';
3
+ export type Align = 'start' | 'end';
4
+ export interface Prefer {
5
+ side: Side;
6
+ align: Align;
7
+ }
8
+ export interface Placement extends Prefer {
9
+ left: number;
10
+ top: number;
11
+ }
12
+ export declare function placePanel(anchor: DOMRect, panel: {
13
+ width: number;
14
+ height: number;
15
+ }, boundary: DOMRect, prefer: Prefer): Placement;
16
+ /** Measure after the panel is in the DOM; until then the caller can keep it hidden. */
17
+ export declare function usePanelPlacement(open: boolean, anchorRef: RefObject<HTMLElement | null>, panelRef: RefObject<HTMLElement | null>, prefer: Prefer, boundaryRef?: RefObject<HTMLElement | null>): Placement | null;
@@ -0,0 +1,29 @@
1
+ import type { Viewport } from './camera.js';
2
+ export interface Point {
3
+ x: number;
4
+ y: number;
5
+ }
6
+ export interface TouchTarget<T> {
7
+ id: string;
8
+ node: boolean;
9
+ value: T;
10
+ }
11
+ export interface TouchActions<T> {
12
+ hit(p: Point): TouchTarget<T> | null;
13
+ preview(target: T | null): void;
14
+ select(target: T | null): void;
15
+ viewport(): Viewport;
16
+ move(view: Viewport): void;
17
+ limits(): {
18
+ min: number;
19
+ max: number;
20
+ };
21
+ interact(): void;
22
+ }
23
+ export declare function touchGestures<T>(actions: TouchActions<T>): {
24
+ down(id: number, point: Point): void;
25
+ move(id: number, point: Point): void;
26
+ up(id: number, point: Point): void;
27
+ cancel(): void;
28
+ dispose(): void;
29
+ };
package/dist/style.d.ts CHANGED
@@ -133,6 +133,11 @@ export declare const DIFF_COLORS: Record<string, string>;
133
133
  * The remaining two rules lift selection / hits back to the top: that is the user's attention right now, ahead of any mark.
134
134
  */
135
135
  export declare function diffStyle(theme?: GraphTheme): any[];
136
+ /** Private fallbacks, scoped to one canvas. Public --gb-* overrides still win, including inherited host styles.
137
+ * Reset them on light canvases so an embedded light graph cannot inherit a dark graph's defaults. */
138
+ export declare function chromeStyle(theme: GraphTheme): {
139
+ colorScheme: string;
140
+ };
136
141
  /** Styles for host UI (toolbar / detail panel). CSS variables the host can override, with defaults,
137
142
  * so an offline single-file page looks good without configuring any. */
138
143
  export declare const GK_CSS: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glassbrain",
3
- "version": "0.1.2",
3
+ "version": "0.1.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",
@@ -94,7 +94,8 @@
94
94
  "cytoscape": "^3.30.0",
95
95
  "cytoscape-cose-bilkent": "^4.1.0",
96
96
  "cytoscape-fcose": "^2.2.0",
97
- "react": ">=18"
97
+ "react": ">=18",
98
+ "react-dom": ">=18"
98
99
  },
99
100
  "devDependencies": {
100
101
  "@types/cytoscape": "^3.21.9",