glassbrain 0.1.3 → 0.2.0-alpha.1

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
@@ -70,7 +70,7 @@ import {
70
70
  untheme,
71
71
  validateModel,
72
72
  validateStructure
73
- } from "./chunks/chunk-W357BGA7.js";
73
+ } from "./chunks/chunk-VCM766BZ.js";
74
74
  import {
75
75
  EN
76
76
  } from "./chunks/chunk-EJURBBFC.js";
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  clearLayoutCache,
10
10
  computeLayout,
11
11
  projectPlanes
12
- } from "./chunks/chunk-RHWFMVQU.js";
12
+ } from "./chunks/chunk-CAXDADCO.js";
13
13
  import {
14
14
  CONTENT_SCALE,
15
15
  DARK_THEME,
@@ -81,7 +81,7 @@ import {
81
81
  untheme,
82
82
  validateModel,
83
83
  validateStructure
84
- } from "./chunks/chunk-W357BGA7.js";
84
+ } from "./chunks/chunk-VCM766BZ.js";
85
85
  import {
86
86
  DetailPanel,
87
87
  renderInline,
@@ -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-RHWFMVQU.js";
43
+ skeletonLineOf,
44
+ touchGestures
45
+ } from "./chunks/chunk-CAXDADCO.js";
44
46
  import {
45
47
  CONTENT_SCALE,
46
48
  DARK_THEME,
@@ -137,7 +139,7 @@ import {
137
139
  untheme,
138
140
  validateModel,
139
141
  validateStructure
140
- } from "./chunks/chunk-W357BGA7.js";
142
+ } from "./chunks/chunk-VCM766BZ.js";
141
143
  import {
142
144
  DetailPanel,
143
145
  renderInline,
@@ -254,6 +256,7 @@ export {
254
256
  parsePhysical,
255
257
  parseQuery,
256
258
  parseSources,
259
+ placePanel,
257
260
  planLabels,
258
261
  planSkins,
259
262
  planTransition,
@@ -280,6 +283,7 @@ export {
280
283
  stepUnion,
281
284
  themeColor,
282
285
  toPhysical,
286
+ touchGestures,
283
287
  trackAt,
284
288
  trackLin,
285
289
  unionSides,
@@ -2,8 +2,8 @@
2
2
  "use client";
3
3
  import {
4
4
  GraphCanvas
5
- } from "../chunks/chunk-RHWFMVQU.js";
6
- import "../chunks/chunk-W357BGA7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glassbrain",
3
- "version": "0.1.3",
3
+ "version": "0.2.0-alpha.1",
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",