@luciole-sh/flow-graph 0.0.0-stage → 0.1.0

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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +671 -2
  3. package/dist/Flow.d.ts +41 -0
  4. package/dist/Flow.d.ts.map +1 -0
  5. package/dist/Flow.js +489 -0
  6. package/dist/Flow.js.map +1 -0
  7. package/dist/components.d.ts +28 -0
  8. package/dist/components.d.ts.map +1 -0
  9. package/dist/components.js +100 -0
  10. package/dist/components.js.map +1 -0
  11. package/dist/frame.d.ts +68 -0
  12. package/dist/frame.d.ts.map +1 -0
  13. package/dist/frame.js +136 -0
  14. package/dist/frame.js.map +1 -0
  15. package/dist/geometry.d.ts +60 -0
  16. package/dist/geometry.d.ts.map +1 -0
  17. package/dist/geometry.js +205 -0
  18. package/dist/geometry.js.map +1 -0
  19. package/dist/hooks.d.ts +56 -0
  20. package/dist/hooks.d.ts.map +1 -0
  21. package/dist/hooks.js +65 -0
  22. package/dist/hooks.js.map +1 -0
  23. package/dist/index.d.ts +15 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +14 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/keymap.d.ts +11 -0
  28. package/dist/keymap.d.ts.map +1 -0
  29. package/dist/keymap.js +42 -0
  30. package/dist/keymap.js.map +1 -0
  31. package/dist/navigation.d.ts +32 -0
  32. package/dist/navigation.d.ts.map +1 -0
  33. package/dist/navigation.js +68 -0
  34. package/dist/navigation.js.map +1 -0
  35. package/dist/nodes.d.ts +18 -0
  36. package/dist/nodes.d.ts.map +1 -0
  37. package/dist/nodes.js +46 -0
  38. package/dist/nodes.js.map +1 -0
  39. package/dist/raster.d.ts +112 -0
  40. package/dist/raster.d.ts.map +1 -0
  41. package/dist/raster.js +370 -0
  42. package/dist/raster.js.map +1 -0
  43. package/dist/store.d.ts +104 -0
  44. package/dist/store.d.ts.map +1 -0
  45. package/dist/store.js +186 -0
  46. package/dist/store.js.map +1 -0
  47. package/dist/theme.d.ts +25 -0
  48. package/dist/theme.d.ts.map +1 -0
  49. package/dist/theme.js +39 -0
  50. package/dist/theme.js.map +1 -0
  51. package/dist/types.d.ts +140 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +2 -0
  54. package/dist/types.js.map +1 -0
  55. package/dist/vendor/xyflow/LICENSE +21 -0
  56. package/dist/vendor/xyflow/bezier.d.ts +26 -0
  57. package/dist/vendor/xyflow/bezier.d.ts.map +1 -0
  58. package/dist/vendor/xyflow/bezier.js +47 -0
  59. package/dist/vendor/xyflow/bezier.js.map +1 -0
  60. package/dist/vendor/xyflow/changes.d.ts +9 -0
  61. package/dist/vendor/xyflow/changes.d.ts.map +1 -0
  62. package/dist/vendor/xyflow/changes.js +133 -0
  63. package/dist/vendor/xyflow/changes.js.map +1 -0
  64. package/dist/vendor/xyflow/smoothstep.d.ts +17 -0
  65. package/dist/vendor/xyflow/smoothstep.d.ts.map +1 -0
  66. package/dist/vendor/xyflow/smoothstep.js +166 -0
  67. package/dist/vendor/xyflow/smoothstep.js.map +1 -0
  68. package/package.json +61 -4
  69. package/src/Flow.tsx +684 -0
  70. package/src/components.tsx +180 -0
  71. package/src/frame.ts +203 -0
  72. package/src/geometry.ts +274 -0
  73. package/src/hooks.tsx +121 -0
  74. package/src/index.ts +21 -0
  75. package/src/keymap.tsx +45 -0
  76. package/src/navigation.ts +86 -0
  77. package/src/nodes.tsx +86 -0
  78. package/src/raster.ts +453 -0
  79. package/src/store.ts +240 -0
  80. package/src/theme.ts +61 -0
  81. package/src/types.ts +130 -0
  82. package/src/vendor/xyflow/LICENSE +21 -0
  83. package/src/vendor/xyflow/README.md +20 -0
  84. package/src/vendor/xyflow/bezier.ts +102 -0
  85. package/src/vendor/xyflow/changes.ts +177 -0
  86. package/src/vendor/xyflow/smoothstep.ts +219 -0
  87. package/tsconfig.json +22 -0
@@ -0,0 +1,56 @@
1
+ import { type Dispatch, type ReactNode, type SetStateAction } from "react";
2
+ import { FlowStore } from "./store.ts";
3
+ import type { Detail, Edge, EdgeChange, Node, NodeChange, Viewport, XY } from "./types.ts";
4
+ export declare const StoreContext: import("react").Context<FlowStore | null>;
5
+ /** The node a `<Handle>` belongs to. */
6
+ export declare const NodeIdContext: import("react").Context<string | null>;
7
+ /**
8
+ * Shares one canvas's store with components outside `<Flow>` (a side panel that calls
9
+ * `fitView`, a toolbar): wrap both in it. Without it, `<Flow>` keeps its own.
10
+ */
11
+ export declare function FlowProvider({ children, defaultViewport, fitView, }: {
12
+ children: ReactNode;
13
+ defaultViewport?: Viewport;
14
+ fitView?: boolean;
15
+ }): ReactNode;
16
+ export declare function useStore(): FlowStore;
17
+ /** Re-renders on every change of the store; returns it. */
18
+ export declare function useStoreVersion(): FlowStore;
19
+ /** `useState` for nodes, with the `onNodesChange` that applies the canvas's changes. */
20
+ export declare function useNodesState<N extends Node = Node>(initial: N[]): [N[], Dispatch<SetStateAction<N[]>>, (changes: NodeChange<N>[]) => void];
21
+ /** `useState` for edges, with the `onEdgesChange` that applies the canvas's changes. */
22
+ export declare function useEdgesState<E extends Edge = Edge>(initial: E[]): [E[], Dispatch<SetStateAction<E[]>>, (changes: EdgeChange<E>[]) => void];
23
+ export type FlowInstance = {
24
+ getNodes(): readonly Node[];
25
+ getNode(id: string): Node | undefined;
26
+ getEdges(): readonly Edge[];
27
+ getViewport(): Viewport;
28
+ setViewport(viewport: Viewport): void;
29
+ /** The closest zoom level at which every node is seen, centered. */
30
+ fitView(): void;
31
+ zoomIn(): void;
32
+ zoomOut(): void;
33
+ /** Centers the view on a point in flow coordinates. */
34
+ setCenter(point: XY, zoom?: number): void;
35
+ /** Pans just enough to show node `id`. */
36
+ reveal(id: string): void;
37
+ /** Proposes removing these nodes (with their edges) and edges. */
38
+ deleteElements(elements: {
39
+ nodes?: readonly string[];
40
+ edges?: readonly string[];
41
+ }): void;
42
+ /** Proposes selecting exactly these nodes and edges. */
43
+ select(elements: {
44
+ nodes?: readonly string[];
45
+ edges?: readonly string[];
46
+ }): void;
47
+ /** The canvas point at the center of the view, in flow coordinates. */
48
+ center(): XY;
49
+ };
50
+ /** The canvas's controls, for a component inside `<Flow>` or `<FlowProvider>`. */
51
+ export declare function useFlow(): FlowInstance;
52
+ /** The viewport and the detail it draws nodes at, re-rendering when they change. */
53
+ export declare function useViewport(): Viewport & {
54
+ detail: Detail;
55
+ };
56
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAG3F,eAAO,MAAM,YAAY,2CAAwC,CAAC;AAClE,wCAAwC;AACxC,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,eAAe,EACf,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,aAGA;AAED,wBAAgB,QAAQ,IAAI,SAAS,CAIpC;AAED,2DAA2D;AAC3D,wBAAgB,eAAe,IAAI,SAAS,CAI3C;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,EACjD,OAAO,EAAE,CAAC,EAAE,GACX,CAAC,CAAC,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,O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,EAAE,CAAC;CACd,CAAC;AAEF,kFAAkF;AAClF,wBAAgB,OAAO,IAAI,YAAY,CAmBtC;AAED,oFAAoF;AACpF,wBAAgB,WAAW,IAAI,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAG3D"}
package/dist/hooks.js ADDED
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useState, useSyncExternalStore, } from "react";
3
+ import { FlowStore } from "./store.js";
4
+ import { applyEdgeChanges, applyNodeChanges } from "./vendor/xyflow/changes.js";
5
+ export const StoreContext = createContext(null);
6
+ /** The node a `<Handle>` belongs to. */
7
+ export const NodeIdContext = createContext(null);
8
+ /**
9
+ * Shares one canvas's store with components outside `<Flow>` (a side panel that calls
10
+ * `fitView`, a toolbar): wrap both in it. Without it, `<Flow>` keeps its own.
11
+ */
12
+ export function FlowProvider({ children, defaultViewport, fitView, }) {
13
+ const [store] = useState(() => new FlowStore({ viewport: defaultViewport, fitView }));
14
+ return _jsx(StoreContext.Provider, { value: store, children: children });
15
+ }
16
+ export function useStore() {
17
+ const store = useContext(StoreContext);
18
+ if (!store)
19
+ throw new Error("useFlow and the canvas components need a <Flow> or <FlowProvider>");
20
+ return store;
21
+ }
22
+ /** Re-renders on every change of the store; returns it. */
23
+ export function useStoreVersion() {
24
+ const store = useStore();
25
+ useSyncExternalStore(store.subscribe, store.getVersion);
26
+ return store;
27
+ }
28
+ /** `useState` for nodes, with the `onNodesChange` that applies the canvas's changes. */
29
+ export function useNodesState(initial) {
30
+ const [nodes, setNodes] = useState(initial);
31
+ const onNodesChange = useCallback((changes) => setNodes((current) => applyNodeChanges(changes, current)), []);
32
+ return [nodes, setNodes, onNodesChange];
33
+ }
34
+ /** `useState` for edges, with the `onEdgesChange` that applies the canvas's changes. */
35
+ export function useEdgesState(initial) {
36
+ const [edges, setEdges] = useState(initial);
37
+ const onEdgesChange = useCallback((changes) => setEdges((current) => applyEdgeChanges(changes, current)), []);
38
+ return [edges, setEdges, onEdgesChange];
39
+ }
40
+ /** The canvas's controls, for a component inside `<Flow>` or `<FlowProvider>`. */
41
+ export function useFlow() {
42
+ const store = useStore();
43
+ const [instance] = useState(() => ({
44
+ getNodes: () => store.nodes,
45
+ getNode: (id) => store.nodes.find((n) => n.id === id),
46
+ getEdges: () => store.edges,
47
+ getViewport: () => store.viewport,
48
+ setViewport: (viewport) => store.setViewport(viewport),
49
+ fitView: () => store.fitView(),
50
+ zoomIn: () => store.zoom(1),
51
+ zoomOut: () => store.zoom(-1),
52
+ setCenter: (point, zoom) => store.setCenter(point, zoom),
53
+ reveal: (id) => store.reveal(id),
54
+ deleteElements: (elements) => store.deleteElements(elements),
55
+ select: (elements) => store.select(elements),
56
+ center: () => store.toFlow({ x: Math.floor(store.size.width / 2), y: Math.floor(store.size.height / 2) }),
57
+ }));
58
+ return instance;
59
+ }
60
+ /** The viewport and the detail it draws nodes at, re-rendering when they change. */
61
+ export function useViewport() {
62
+ const store = useStoreVersion();
63
+ return { ...store.viewport, detail: store.detail };
64
+ }
65
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,QAAQ,EACR,oBAAoB,GAIrB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEhF,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAmB,IAAI,CAAC,CAAC;AAClE,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAgB,IAAI,CAAC,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,eAAe,EACf,OAAO,GA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D,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC5C,MAAM,EAAE,GAAG,EAAE,CACX,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;KAC9F,CAAC,CAAC,CAAC;IACJ,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,OAAO,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AACrD,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `@luciole-sh/flow-graph`: node graphs in the terminal, after React Flow. Use it in a Client
3
+ * Component (`"use client"`): pan, zoom, drag and selection stay on the Client.
4
+ */
5
+ export { Flow, type FlowProps } from "./Flow.tsx";
6
+ export { Background, Controls, MiniMap, Panel, type PanelPosition } from "./components.tsx";
7
+ export { DefaultNode, GroupNode, Handle } from "./nodes.tsx";
8
+ export { FlowProvider, useEdgesState, useFlow, useNodesState, useViewport, type FlowInstance, } from "./hooks.tsx";
9
+ export { addEdge, applyEdgeChanges, applyNodeChanges, getEdgeId } from "./vendor/xyflow/changes.ts";
10
+ export { composeFrame, hitTest, type EdgeRoute, type EdgeType, type Frame } from "./frame.ts";
11
+ export { ZOOMS, detailFor, fitViewport, flowBounds } from "./geometry.ts";
12
+ export { Grid, type BackgroundVariant, type EdgeStyle } from "./raster.ts";
13
+ export { defaultTheme, type FlowTheme } from "./theme.ts";
14
+ export type * from "./types.ts";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,YAAY,EACZ,aAAa,EACb,OAAO,EACP,aAAa,EACb,WAAW,EACX,KAAK,YAAY,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAC1D,mBAAmB,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `@luciole-sh/flow-graph`: node graphs in the terminal, after React Flow. Use it in a Client
3
+ * Component (`"use client"`): pan, zoom, drag and selection stay on the Client.
4
+ */
5
+ export { Flow } from "./Flow.js";
6
+ export { Background, Controls, MiniMap, Panel } from "./components.js";
7
+ export { DefaultNode, GroupNode, Handle } from "./nodes.js";
8
+ export { FlowProvider, useEdgesState, useFlow, useNodesState, useViewport, } from "./hooks.js";
9
+ export { addEdge, applyEdgeChanges, applyNodeChanges, getEdgeId } from "./vendor/xyflow/changes.js";
10
+ export { composeFrame, hitTest } from "./frame.js";
11
+ export { ZOOMS, detailFor, fitViewport, flowBounds } from "./geometry.js";
12
+ export { Grid } from "./raster.js";
13
+ export { defaultTheme } from "./theme.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,IAAI,EAAkB,MAAM,WAAY,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAsB,MAAM,iBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,YAAa,CAAC;AAC7D,OAAO,EACL,YAAY,EACZ,aAAa,EACb,OAAO,EACP,aAAa,EACb,WAAW,GAEZ,MAAM,YAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,OAAO,EAA6C,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,IAAI,EAA0C,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAkB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * The canvas's bindings go through `useBindings` in every case. Inside the application's
4
+ * `<KeymapProvider>` (luciole's Shell installs one), they join its layers: `<KeyHelp>`
5
+ * lists them, and the application's own layers can shadow them. Without one, the canvas
6
+ * provides a keymap of its own on the renderer.
7
+ */
8
+ export declare function FlowKeymap({ children }: {
9
+ children: ReactNode;
10
+ }): ReactNode;
11
+ //# sourceMappingURL=keymap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../src/keymap.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAiCjD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,aAK/D"}
package/dist/keymap.js ADDED
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { createDefaultOpenTuiKeymap } from "@opentui/keymap/opentui";
4
+ import { KeymapProvider, useKeymap } from "@opentui/keymap/react";
5
+ import { useRenderer } from "@opentui/react";
6
+ /**
7
+ * The keymap of the application's `<KeymapProvider>`, or null without one.
8
+ * `@opentui/keymap/react` exports no context, only `useKeymap`, which throws when there is
9
+ * no provider: the throw comes after its `useContext`, so hooks keep their order.
10
+ */
11
+ function useOptionalKeymap() {
12
+ try {
13
+ return useKeymap();
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ }
19
+ // A keymap listens to its renderer for good (it has no dispose): one per renderer, shared
20
+ // by every canvas that has no provider, however often they mount.
21
+ const ownKeymaps = new WeakMap();
22
+ function keymapFor(renderer) {
23
+ const known = ownKeymaps.get(renderer);
24
+ if (known)
25
+ return known;
26
+ const keymap = createDefaultOpenTuiKeymap(renderer);
27
+ ownKeymaps.set(renderer, keymap);
28
+ return keymap;
29
+ }
30
+ /**
31
+ * The canvas's bindings go through `useBindings` in every case. Inside the application's
32
+ * `<KeymapProvider>` (luciole's Shell installs one), they join its layers: `<KeyHelp>`
33
+ * lists them, and the application's own layers can shadow them. Without one, the canvas
34
+ * provides a keymap of its own on the renderer.
35
+ */
36
+ export function FlowKeymap({ children }) {
37
+ const outer = useOptionalKeymap();
38
+ const renderer = useRenderer();
39
+ const [own] = useState(() => (outer ? null : keymapFor(renderer)));
40
+ return own ? _jsx(KeymapProvider, { keymap: own, children: children }) : children;
41
+ }
42
+ //# sourceMappingURL=keymap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keymap.js","sourceRoot":"","sources":["../src/keymap.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAI7C;;;;GAIG;AACH,SAAS,iBAAiB;IACxB,IAAI,CAAC;QACH,OAAO,SAAS,EAAE,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,0FAA0F;AAC1F,kEAAkE;AAClE,MAAM,UAAU,GAAG,IAAI,OAAO,EAA8B,CAAC;AAC7D,SAAS,SAAS,CAAC,QAAqB;IACtC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,MAAM,GAAG,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IACpD,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,QAAQ,EAA2B;IAC9D,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnE,OAAO,GAAG,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,MAAM,EAAE,GAAG,YAAG,QAAQ,GAAkB,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnF,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Moving the selection with the keyboard: in reading order (columns left to right, a
3
+ * column top to bottom, as a left-to-right flow reads), along the edges (downstream,
4
+ * upstream), among siblings, or to the nearest node on one side. Pure functions of the
5
+ * graph and the nodes' positions.
6
+ */
7
+ import type { Edge, Node, Position, XY } from "./types.ts";
8
+ type Located = {
9
+ id: string;
10
+ at: XY;
11
+ };
12
+ /** Selectable, visible nodes with their positions, in reading order. */
13
+ export declare function readingOrder(nodes: readonly Node[], positions: ReadonlyMap<string, XY>): {
14
+ id: string;
15
+ at: XY;
16
+ }[];
17
+ /** The next (`1`) or previous (`-1`) node after `current` in reading order, cycling. */
18
+ export declare function cycle(order: readonly Located[], current: string | undefined, step: 1 | -1): string | undefined;
19
+ /** The first node `current`'s edges lead to (`down`) or come from (`up`), top first. */
20
+ export declare function follow(edges: readonly Edge[], order: readonly Located[], current: string, direction: "down" | "up"): string;
21
+ /**
22
+ * The next (`1`) or previous (`-1`) sibling of `current`: another node an upstream node
23
+ * of `current` leads to, top to bottom, cycling.
24
+ */
25
+ export declare function sibling(edges: readonly Edge[], order: readonly Located[], current: string, step: 1 | -1): string | undefined;
26
+ /**
27
+ * The nearest node on `side` of `current`: within a 45° cone first, by distance with rows
28
+ * counted twice (a row is about two columns tall).
29
+ */
30
+ export declare function nearest(order: readonly Located[], current: string, side: Position): string | undefined;
31
+ export {};
32
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAE3D,KAAK,OAAO,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,EAAE,CAAA;CAAE,CAAC;AAKtC,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;;;IAKtF;AAED,wFAAwF;AACxF,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,sBAKzF;AAED,wFAAwF;AACxF,wBAAgB,MAAM,CACpB,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,IAAI,UAQzB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,sBAWb;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,sBAgBjF"}
@@ -0,0 +1,68 @@
1
+ const byColumn = (a, b) => a.at.x - b.at.x || a.at.y - b.at.y;
2
+ const byRow = (a, b) => a.at.y - b.at.y || a.at.x - b.at.x;
3
+ /** Selectable, visible nodes with their positions, in reading order. */
4
+ export function readingOrder(nodes, positions) {
5
+ return nodes
6
+ .filter((n) => !n.hidden && n.selectable !== false && n.type !== "group")
7
+ .map((n) => ({ id: n.id, at: positions.get(n.id) ?? n.position }))
8
+ .sort(byColumn);
9
+ }
10
+ /** The next (`1`) or previous (`-1`) node after `current` in reading order, cycling. */
11
+ export function cycle(order, current, step) {
12
+ if (order.length === 0)
13
+ return undefined;
14
+ const index = order.findIndex((n) => n.id === current);
15
+ if (index < 0)
16
+ return (step === 1 ? order[0] : order.at(-1))?.id;
17
+ return order[(index + step + order.length) % order.length]?.id;
18
+ }
19
+ /** The first node `current`'s edges lead to (`down`) or come from (`up`), top first. */
20
+ export function follow(edges, order, current, direction) {
21
+ const ids = new Set(edges
22
+ .filter((e) => !e.hidden && (direction === "down" ? e.source : e.target) === current)
23
+ .map((e) => (direction === "down" ? e.target : e.source)));
24
+ return order.filter((n) => ids.has(n.id)).sort(byRow)[0]?.id;
25
+ }
26
+ /**
27
+ * The next (`1`) or previous (`-1`) sibling of `current`: another node an upstream node
28
+ * of `current` leads to, top to bottom, cycling.
29
+ */
30
+ export function sibling(edges, order, current, step) {
31
+ const parents = new Set(edges.filter((e) => e.target === current).map((e) => e.source));
32
+ const ids = new Set(edges.filter((e) => parents.has(e.source)).map((e) => e.target));
33
+ // A root's siblings are the other roots.
34
+ if (parents.size === 0) {
35
+ const targets = new Set(edges.map((e) => e.target));
36
+ for (const n of order)
37
+ if (!targets.has(n.id))
38
+ ids.add(n.id);
39
+ }
40
+ const list = order.filter((n) => ids.has(n.id)).sort(byRow);
41
+ return list.length > 1 ? cycle(list, current, step) : undefined;
42
+ }
43
+ /**
44
+ * The nearest node on `side` of `current`: within a 45° cone first, by distance with rows
45
+ * counted twice (a row is about two columns tall).
46
+ */
47
+ export function nearest(order, current, side) {
48
+ const from = order.find((n) => n.id === current);
49
+ if (!from)
50
+ return undefined;
51
+ let best;
52
+ for (const n of order) {
53
+ if (n.id === current)
54
+ continue;
55
+ const dx = n.at.x - from.at.x;
56
+ const dy = (n.at.y - from.at.y) * 2;
57
+ const forward = side === "right" ? dx : side === "left" ? -dx : side === "bottom" ? dy : -dy;
58
+ const across = side === "left" || side === "right" ? Math.abs(dy) : Math.abs(dx);
59
+ if (forward <= 0)
60
+ continue;
61
+ // Outside the cone costs as much again as the distance across.
62
+ const score = forward + across * (across > forward ? 2 : 1);
63
+ if (!best || score < best.score)
64
+ best = { id: n.id, score };
65
+ }
66
+ return best?.id;
67
+ }
68
+ //# sourceMappingURL=navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAUA,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChF,MAAM,KAAK,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,KAAsB,EAAE,SAAkC;IACrF,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,UAAU,KAAK,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;SACxE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SACjE,IAAI,CAAC,QAAQ,CAAC,CAAC;AACpB,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,KAAK,CAAC,KAAyB,EAAE,OAA2B,EAAE,IAAY;IACxF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,MA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K,EAAE,CAAC;IAC9D,CAAC;IACD,OAAO,IAAI,EAAE,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { HandleType, NodeComponent, NodeProps, Position } from "./types.ts";
2
+ /**
3
+ * Declares where a node's edges attach: a node component renders one per handle. It
4
+ * draws nothing itself: the canvas marks handles on the node's border when useful (the
5
+ * selected node's sources, every target while connecting). Handles sharing a side are
6
+ * spread along it, in the order they are rendered.
7
+ */
8
+ export declare function Handle({ type, position, id, }: {
9
+ type: HandleType;
10
+ position: Position;
11
+ id?: string | null;
12
+ }): null;
13
+ /** A label in a rounded box, one row tall; its label only when compact. */
14
+ export declare function DefaultNode({ data, id, selected, detail, connectTarget, type }: NodeProps): import("react").ReactNode;
15
+ /** A frame other nodes sit in (`parentId`), sized by the node's `width` and `height`. */
16
+ export declare function GroupNode({ data, id, selected, detail, width, height }: NodeProps): import("react").ReactNode;
17
+ export declare const builtinNodeTypes: Record<string, NodeComponent>;
18
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjF;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,EAAS,GACV,EAAE;IACD,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,QAUA;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,SAAS,6BA6BzF;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,6BAajF;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAK1D,CAAC"}
package/dist/nodes.js ADDED
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { useContext, useEffect, useId } from "react";
3
+ import { labelOf } from "./geometry.js";
4
+ import { NodeIdContext, useStore } from "./hooks.js";
5
+ import { useFlowTheme } from "./theme.js";
6
+ /**
7
+ * Declares where a node's edges attach: a node component renders one per handle. It
8
+ * draws nothing itself: the canvas marks handles on the node's border when useful (the
9
+ * selected node's sources, every target while connecting). Handles sharing a side are
10
+ * spread along it, in the order they are rendered.
11
+ */
12
+ export function Handle({ type, position, id = null, }) {
13
+ const nodeId = useContext(NodeIdContext);
14
+ const store = useStore();
15
+ const key = useId();
16
+ useEffect(() => {
17
+ if (!nodeId)
18
+ return;
19
+ store.addHandle(nodeId, key, { id, type, position });
20
+ return () => store.removeHandle(nodeId, key);
21
+ }, [store, nodeId, key, id, type, position]);
22
+ return null;
23
+ }
24
+ /** A label in a rounded box, one row tall; its label only when compact. */
25
+ export function DefaultNode({ data, id, selected, detail, connectTarget, type }) {
26
+ const theme = useFlowTheme();
27
+ const label = labelOf({ id, data, position: { x: 0, y: 0 } });
28
+ const color = selected ? theme.selected : connectTarget ? theme.connect : theme.border;
29
+ if (detail === "compact")
30
+ return (_jsx("text", { selectable: false, wrapMode: "none", fg: selected || connectTarget ? color : theme.text, bg: theme.panelBg, children: ` ${label} ` }));
31
+ // An input starts the flow and an output ends it: their border says so.
32
+ return (_jsx("box", { border: true, borderStyle: type === "input" ? "double" : type === "output" ? "heavy" : "rounded", borderColor: color, paddingX: 1, backgroundColor: theme.panelBg, children: _jsx("text", { selectable: false, fg: theme.text, wrapMode: "none", children: label }) }));
33
+ }
34
+ /** A frame other nodes sit in (`parentId`), sized by the node's `width` and `height`. */
35
+ export function GroupNode({ data, id, selected, detail, width, height }) {
36
+ const theme = useFlowTheme();
37
+ const label = labelOf({ id, data, position: { x: 0, y: 0 } });
38
+ return (_jsx("box", { width: width, height: height, border: true, borderStyle: "single", borderColor: selected ? theme.selected : theme.group, title: detail === "full" ? ` ${label} ` : undefined }));
39
+ }
40
+ export const builtinNodeTypes = {
41
+ default: DefaultNode,
42
+ input: DefaultNode,
43
+ output: DefaultNode,
44
+ group: GroupNode,
45
+ };
46
+ //# sourceMappingURL=nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../src/nodes.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,EAAE,GAAG,IAAI,GAKV;IACC,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC;IACpB,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrD,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,QAA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FAAyF;AACzF,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAa;IAChF,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9D,OAAO,CACL,cACE,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,QACN,WAAW,EAAC,QAAQ,EACpB,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EACpD,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,GACnD,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAkC;IAC7D,OAAO,EAAE,WAAW;IACpB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,SAAS;CACjB,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Edges drawn on the cell grid. Orthogonal paths (step, smoothstep, aligned straight
3
+ * edges) set four direction bits per cell; the bits of every edge in a cell are merged,
4
+ * so a fork reads `├`, two lines meeting `┼`, and a crossing is a `┼` too. Curves
5
+ * (bezier) and slanted straight lines are drawn in braille dots, two by four per cell.
6
+ * Pure: the canvas copies the grid into OpenTUI's buffer, tests print it.
7
+ */
8
+ import type { Position, Rect, XY } from "./types.ts";
9
+ export type Role = "edge" | "selected" | "animated" | "label" | "marker" | "background" | "handle";
10
+ export type Cell = {
11
+ char: string;
12
+ role: Role;
13
+ /** An explicit color, over the role's. */
14
+ color?: string;
15
+ /** The edge this cell belongs to, for hit testing. */
16
+ owner?: string;
17
+ };
18
+ /** An arrow pointing into a node, by the side of the node it enters. */
19
+ export declare const ARROW_INTO: Record<Position, string>;
20
+ export type EdgeStyle = "smoothstep" | "step" | "straight" | "bezier";
21
+ /** An edge, placed: both ends are anchor cells, just outside their nodes. */
22
+ export type EdgeDraw = {
23
+ id: string;
24
+ style: EdgeStyle;
25
+ source: XY;
26
+ sourcePosition: Position;
27
+ target: XY;
28
+ targetPosition: Position;
29
+ label?: string;
30
+ animated?: boolean;
31
+ selected?: boolean;
32
+ markerEnd?: boolean;
33
+ markerStart?: boolean;
34
+ color?: string;
35
+ /** For custom edge types: the path's corner points, drawn orthogonally. */
36
+ points?: readonly XY[];
37
+ /** Overrides the role its state gives it (the connection being made). */
38
+ role?: Role;
39
+ };
40
+ type BoxCell = {
41
+ mask: number;
42
+ rounded: boolean;
43
+ role: Role;
44
+ color?: string;
45
+ owner?: string;
46
+ /** Index along its edge, for the runner of an animated edge. */
47
+ index: number;
48
+ edges: number;
49
+ };
50
+ type DotCell = {
51
+ bits: number;
52
+ role: Role;
53
+ color?: string;
54
+ owner?: string;
55
+ index?: number;
56
+ };
57
+ export declare class Grid {
58
+ readonly width: number;
59
+ readonly height: number;
60
+ private readonly cells;
61
+ private readonly boxes;
62
+ private readonly dots;
63
+ constructor(width: number, height: number);
64
+ inside(x: number, y: number): boolean;
65
+ get(x: number, y: number): Cell | undefined;
66
+ set(x: number, y: number, cell: Cell): void;
67
+ /** Writes `text` from (x, y) on, clipped to the grid. */
68
+ text(x: number, y: number, text: string, cell: Omit<Cell, "char">): void;
69
+ /** Adds direction bits to a box cell; the last writer's role and color win. */
70
+ box(x: number, y: number, bits: number, style: Omit<BoxCell, "mask" | "edges">): void;
71
+ /** Sets one braille dot at dot coordinates (two per cell across, four down). */
72
+ dot(dx: number, dy: number, style: Omit<DotCell, "bits">): void;
73
+ /**
74
+ * Turns direction bits and dots into characters. Box lines win over dots, and cells
75
+ * already set (markers, labels) win over both.
76
+ */
77
+ resolve(phase?: number): this;
78
+ /** Rows of text, trailing blanks trimmed: what tests compare. */
79
+ lines(): string[];
80
+ /** Each cell that holds something, row by row. */
81
+ entries(): Generator<[number, number, Cell]>;
82
+ }
83
+ /** Rounds corner points and makes each pair of consecutive points share an axis. */
84
+ export declare function orthogonal(points: readonly XY[]): XY[];
85
+ /** The cells an orthogonal path goes through, in order, both ends included. */
86
+ export declare function pathCells(points: readonly XY[]): XY[];
87
+ /** The corner points of a step edge between two anchor cells. */
88
+ export declare function stepPoints(draw: EdgeDraw): {
89
+ points: XY[];
90
+ label: XY;
91
+ };
92
+ /** A cubic bezier's four points between two anchor cells, after xyflow's controls. */
93
+ export declare function bezierControls(draw: EdgeDraw): [XY, XY, XY, XY];
94
+ /** Draws one edge into `grid`; returns where its label goes. */
95
+ export declare function drawEdge(grid: Grid, draw: EdgeDraw): XY;
96
+ /** An edge's label, centered on `at`, over the lines. */
97
+ export declare function drawLabel(grid: Grid, at: XY, text: string, owner: string): void;
98
+ export type BackgroundVariant = "dots" | "lines" | "cross";
99
+ /** Background marks every `gap` flow cells, following the viewport, in the empty cells. */
100
+ export declare function drawBackground(grid: Grid, viewport: {
101
+ x: number;
102
+ y: number;
103
+ zoom: number;
104
+ }, variant: BackgroundVariant, gap: XY): void;
105
+ /** Draws `rects` and a viewport outline, in braille, scaled into `grid`. */
106
+ export declare function drawMiniMap(grid: Grid, world: Rect, rects: readonly {
107
+ rect: Rect;
108
+ role: Role;
109
+ color?: string;
110
+ }[], view: Rect): (cell: XY) => XY;
111
+ export {};
112
+ //# sourceMappingURL=raster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raster.d.ts","sourceRoot":"","sources":["../src/raster.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAIrD,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OA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