@neta-art/cohub 5.3.2 → 5.4.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.
- package/dist/board/codec.d.ts +2 -0
- package/dist/board/codec.js +18 -13
- package/dist/board/core/arrow-geometry.d.ts +23 -0
- package/dist/board/core/arrow-geometry.js +109 -0
- package/dist/board/core/connections.d.ts +83 -0
- package/dist/board/core/connections.js +399 -0
- package/dist/board/core/export-plan.d.ts +15 -4
- package/dist/board/core/export-plan.js +49 -16
- package/dist/board/core/shape-definition.js +1 -1
- package/dist/board/core/shape-types.d.ts +8 -2
- package/dist/board/core/shape-types.js +1 -1
- package/dist/board/core/tool-styles.d.ts +9 -3
- package/dist/board/core/tool-styles.js +10 -6
- package/dist/board/export/index.js +1 -0
- package/dist/board/export/scene.d.ts +3 -0
- package/dist/board/export/scene.js +18 -1
- package/dist/board/index.d.ts +8 -5
- package/dist/board/index.js +8 -5
- package/dist/board/render/connection-layer.d.ts +48 -0
- package/dist/board/render/connection-layer.js +223 -0
- package/dist/board/render/index.d.ts +2 -1
- package/dist/board/render/index.js +3 -2
- package/dist/board/render/renderers/arrow-card-renderer.js +35 -48
- package/dist/chunks/http.d.ts +53 -1
- package/dist/chunks/http.js +287 -1
- package/dist/chunks/websocket.d.ts +296 -57
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +22 -58
- package/dist/protocol/dist/board-connection.d.ts +310 -0
- package/dist/protocol/dist/board-connection.js +215 -0
- package/dist/protocol/dist/board-constants.d.ts +11 -1
- package/dist/protocol/dist/board-constants.js +15 -1
- package/dist/protocol/dist/board-document.d.ts +106 -60
- package/dist/protocol/dist/board-document.js +57 -17
- package/dist/protocol/dist/board.d.ts +1 -0
- package/dist/protocol/dist/board.js +3 -0
- package/dist/protocol/dist/index.d.ts +2 -1
- package/dist/protocol/dist/index.js +2 -1
- package/dist/protocol/dist/realtime/board-awareness.js +15 -15
- package/docs/work-runtime-guide.md +1 -1
- package/package.json +1 -1
- package/dist/board/core/bindings.d.ts +0 -45
- package/dist/board/core/bindings.js +0 -162
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { BoardConnection } from "../../protocol/dist/board-connection.js";
|
|
1
2
|
import { BoardDocument, BoardItem } from "../../protocol/dist/board-document.js";
|
|
2
3
|
import { Rect } from "../geometry.js";
|
|
3
|
-
import { FrameLookup } from "./
|
|
4
|
+
import { FrameLookup } from "./connections.js";
|
|
4
5
|
//#region src/board/core/export-plan.d.ts
|
|
5
6
|
/** What part of the board to capture. */
|
|
6
7
|
type BoardExportRegion =
|
|
@@ -45,6 +46,14 @@ type BoardExportPlan = {
|
|
|
45
46
|
height: number;
|
|
46
47
|
/** Items to draw, in document order. */
|
|
47
48
|
items: BoardItem[];
|
|
49
|
+
/**
|
|
50
|
+
* Connections to draw.
|
|
51
|
+
*
|
|
52
|
+
* A relation is only included when both of its nodes are in `items`: half a
|
|
53
|
+
* connection would render as a line into empty space, which reads as a defect
|
|
54
|
+
* rather than as a clipped edge.
|
|
55
|
+
*/
|
|
56
|
+
connections: BoardConnection[];
|
|
48
57
|
/** True when `scale` had to be reduced to fit the size budget. */
|
|
49
58
|
clamped: boolean;
|
|
50
59
|
};
|
|
@@ -73,12 +82,14 @@ declare const BOARD_EXPORT_DEFAULT_PADDING = 32;
|
|
|
73
82
|
/** Above this, an export is still produced but the caller is warned. */
|
|
74
83
|
declare const BOARD_EXPORT_ITEM_WARN_THRESHOLD = 2000;
|
|
75
84
|
declare function boardFrameLookup(document: BoardDocument): FrameLookup;
|
|
76
|
-
/** Bounds of a single item
|
|
77
|
-
declare function exportItemBounds(item: BoardItem,
|
|
85
|
+
/** Bounds of a single item. Arrows resolve through their own curve geometry. */
|
|
86
|
+
declare function exportItemBounds(item: BoardItem, _getFrame?: FrameLookup): Rect;
|
|
87
|
+
/** Bounds of a connection, resolved against the document's node frames. */
|
|
88
|
+
declare function exportConnectionBounds(connection: BoardConnection, getFrame: FrameLookup): Rect | null;
|
|
78
89
|
/**
|
|
79
90
|
* Resolve a region into a concrete capture plan, or null when there is nothing
|
|
80
91
|
* to draw. Callers treat null as "empty selection", not as an error.
|
|
81
92
|
*/
|
|
82
93
|
declare function planBoardExport(input: BoardExportPlanInput): BoardExportPlan | null;
|
|
83
94
|
//#endregion
|
|
84
|
-
export { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, boardFrameLookup, exportItemBounds, normalizeBoardDocument, planBoardExport };
|
|
95
|
+
export { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, boardFrameLookup, exportConnectionBounds, exportItemBounds, normalizeBoardDocument, planBoardExport };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseBoardDocument } from "../../protocol/dist/board-document.js";
|
|
2
2
|
import { itemBounds, rectsIntersect, unionRects } from "../geometry.js";
|
|
3
|
-
import { arrowBounds } from "./
|
|
3
|
+
import { arrowBounds } from "./arrow-geometry.js";
|
|
4
|
+
import { connectionBounds, resolveConnection } from "./connections.js";
|
|
4
5
|
//#region src/board/core/export-plan.ts
|
|
5
6
|
/**
|
|
6
7
|
* Export planning — pure geometry, no renderer.
|
|
@@ -20,7 +21,7 @@ import { arrowBounds } from "./bindings.js";
|
|
|
20
21
|
* error instead of a render-time crash.
|
|
21
22
|
*/
|
|
22
23
|
function normalizeBoardDocument(document) {
|
|
23
|
-
return
|
|
24
|
+
return parseBoardDocument(document);
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
27
|
* Hard ceilings.
|
|
@@ -40,24 +41,41 @@ function boardFrameLookup(document) {
|
|
|
40
41
|
const frames = new Map(document.items.map((item) => [item.id, item.frame]));
|
|
41
42
|
return (id) => frames.get(id);
|
|
42
43
|
}
|
|
43
|
-
/** Bounds of a single item
|
|
44
|
-
function exportItemBounds(item,
|
|
45
|
-
if (item.type === "arrow") return arrowBounds(item
|
|
44
|
+
/** Bounds of a single item. Arrows resolve through their own curve geometry. */
|
|
45
|
+
function exportItemBounds(item, _getFrame) {
|
|
46
|
+
if (item.type === "arrow") return arrowBounds(item);
|
|
46
47
|
return itemBounds(item.frame);
|
|
47
48
|
}
|
|
49
|
+
/** Bounds of a connection, resolved against the document's node frames. */
|
|
50
|
+
function exportConnectionBounds(connection, getFrame) {
|
|
51
|
+
const resolved = resolveConnection(connection, getFrame);
|
|
52
|
+
return resolved ? connectionBounds(resolved, connection.style.size) : null;
|
|
53
|
+
}
|
|
54
|
+
/** Connections whose endpoints are both inside the given item set. */
|
|
55
|
+
function connectionsWithin(document, items) {
|
|
56
|
+
if (document.connections.length === 0) return [];
|
|
57
|
+
const present = new Set(items.map((item) => item.id));
|
|
58
|
+
return document.connections.filter((connection) => present.has(connection.source.nodeId) && present.has(connection.target.nodeId));
|
|
59
|
+
}
|
|
48
60
|
function resolveRegion(document, region, getFrame) {
|
|
49
61
|
switch (region.kind) {
|
|
50
|
-
case "all":
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
case "all": {
|
|
63
|
+
const connections = document.connections;
|
|
64
|
+
return {
|
|
65
|
+
items: document.items,
|
|
66
|
+
connections,
|
|
67
|
+
rect: unionRects([...document.items.map((item) => exportItemBounds(item)), ...connectionBoundsList(connections, getFrame)]),
|
|
68
|
+
padding: null
|
|
69
|
+
};
|
|
70
|
+
}
|
|
55
71
|
case "items": {
|
|
56
72
|
const wanted = new Set(region.ids);
|
|
57
73
|
const items = document.items.filter((item) => wanted.has(item.id));
|
|
74
|
+
const connections = connectionsWithin(document, items);
|
|
58
75
|
return {
|
|
59
76
|
items,
|
|
60
|
-
|
|
77
|
+
connections,
|
|
78
|
+
rect: unionRects([...items.map((item) => exportItemBounds(item)), ...connectionBoundsList(connections, getFrame)]),
|
|
61
79
|
padding: null
|
|
62
80
|
};
|
|
63
81
|
}
|
|
@@ -65,26 +83,39 @@ function resolveRegion(document, region, getFrame) {
|
|
|
65
83
|
const frame = document.items.find((item) => item.id === region.id);
|
|
66
84
|
if (!frame) return {
|
|
67
85
|
items: [],
|
|
86
|
+
connections: [],
|
|
68
87
|
rect: null,
|
|
69
88
|
padding: null
|
|
70
89
|
};
|
|
71
90
|
const rect = itemBounds(frame.frame);
|
|
91
|
+
const items = document.items.filter((item) => item.id !== region.id && rectsIntersect(exportItemBounds(item), rect));
|
|
72
92
|
return {
|
|
73
|
-
items
|
|
93
|
+
items,
|
|
94
|
+
connections: connectionsWithin(document, items),
|
|
74
95
|
rect,
|
|
75
96
|
padding: 0
|
|
76
97
|
};
|
|
77
98
|
}
|
|
78
99
|
case "rect": {
|
|
79
100
|
const rect = region.rect;
|
|
101
|
+
const items = document.items.filter((item) => rectsIntersect(exportItemBounds(item), rect));
|
|
80
102
|
return {
|
|
81
|
-
items
|
|
103
|
+
items,
|
|
104
|
+
connections: connectionsWithin(document, items),
|
|
82
105
|
rect,
|
|
83
106
|
padding: 0
|
|
84
107
|
};
|
|
85
108
|
}
|
|
86
109
|
}
|
|
87
110
|
}
|
|
111
|
+
function connectionBoundsList(connections, getFrame) {
|
|
112
|
+
const rects = [];
|
|
113
|
+
for (const connection of connections) {
|
|
114
|
+
const bounds = exportConnectionBounds(connection, getFrame);
|
|
115
|
+
if (bounds) rects.push(bounds);
|
|
116
|
+
}
|
|
117
|
+
return rects;
|
|
118
|
+
}
|
|
88
119
|
/**
|
|
89
120
|
* Largest scale that keeps the output inside both the edge and pixel budgets.
|
|
90
121
|
*
|
|
@@ -102,7 +133,8 @@ function clampScale(requested, world, maxEdge, maxPixels) {
|
|
|
102
133
|
* to draw. Callers treat null as "empty selection", not as an error.
|
|
103
134
|
*/
|
|
104
135
|
function planBoardExport(input) {
|
|
105
|
-
const {
|
|
136
|
+
const { region, scale: requestedScale = 2, maxEdge = BOARD_EXPORT_MAX_EDGE, maxPixels = BOARD_EXPORT_MAX_PIXELS } = input;
|
|
137
|
+
const document = normalizeBoardDocument(input.document);
|
|
106
138
|
const resolved = resolveRegion(document, region, boardFrameLookup(document));
|
|
107
139
|
if (!resolved.rect) return null;
|
|
108
140
|
const padding = input.padding ?? resolved.padding ?? 32;
|
|
@@ -121,8 +153,9 @@ function planBoardExport(input) {
|
|
|
121
153
|
width: Math.max(1, Math.floor(world.width * scale)),
|
|
122
154
|
height: Math.max(1, Math.floor(world.height * scale)),
|
|
123
155
|
items: resolved.items,
|
|
156
|
+
connections: resolved.connections,
|
|
124
157
|
clamped: scale < safeRequest - 1e-6
|
|
125
158
|
};
|
|
126
159
|
}
|
|
127
160
|
//#endregion
|
|
128
|
-
export { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, boardFrameLookup, exportItemBounds, normalizeBoardDocument, planBoardExport };
|
|
161
|
+
export { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, boardFrameLookup, exportConnectionBounds, exportItemBounds, normalizeBoardDocument, planBoardExport };
|
|
@@ -49,8 +49,14 @@ type ShapeCapabilities = {
|
|
|
49
49
|
canRotate: boolean;
|
|
50
50
|
/** Supports double-click inline editing. */
|
|
51
51
|
canEdit: boolean;
|
|
52
|
-
/**
|
|
53
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Can be an endpoint of a connection.
|
|
54
|
+
*
|
|
55
|
+
* False for shapes that are themselves annotation strokes (draw, arrow): a
|
|
56
|
+
* relation between two scribbles has no meaning the model could express, and
|
|
57
|
+
* allowing it would produce edges no reader could interpret.
|
|
58
|
+
*/
|
|
59
|
+
canConnect: boolean;
|
|
54
60
|
/** Participates in snapping as a target. */
|
|
55
61
|
canSnap: boolean;
|
|
56
62
|
/** Can be locked against accidental edits. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } from "../../protocol/dist/board-constants.js";
|
|
1
2
|
import { BoardColorId } from "./palette.js";
|
|
2
3
|
import { GeoKind } from "./shape-types.js";
|
|
3
4
|
//#region src/board/core/tool-styles.d.ts
|
|
4
|
-
declare const BOARD_STROKE_MIN_SIZE = 1;
|
|
5
|
-
declare const BOARD_STROKE_MAX_SIZE = 64;
|
|
6
5
|
type BoardToolStyleMap = {
|
|
7
6
|
text: {
|
|
8
7
|
color: BoardColorId;
|
|
@@ -19,6 +18,10 @@ type BoardToolStyleMap = {
|
|
|
19
18
|
color: BoardColorId;
|
|
20
19
|
size: number;
|
|
21
20
|
};
|
|
21
|
+
connection: {
|
|
22
|
+
color: BoardColorId;
|
|
23
|
+
size: number;
|
|
24
|
+
};
|
|
22
25
|
frame: {
|
|
23
26
|
color: BoardColorId;
|
|
24
27
|
};
|
|
@@ -41,11 +44,14 @@ declare const DEFAULT_BOARD_TOOL_STYLES: {
|
|
|
41
44
|
readonly color: "brand";
|
|
42
45
|
readonly size: 2.5;
|
|
43
46
|
};
|
|
47
|
+
readonly connection: {
|
|
48
|
+
readonly color: "neutral";
|
|
49
|
+
readonly size: 2.5;
|
|
50
|
+
};
|
|
44
51
|
readonly frame: {
|
|
45
52
|
readonly color: "neutral";
|
|
46
53
|
};
|
|
47
54
|
};
|
|
48
|
-
declare function clampBoardStrokeSize(size: number): number;
|
|
49
55
|
/** Return a mutable, validated style map for an editor or another Board client. */
|
|
50
56
|
declare function createBoardToolStyles(patch?: BoardToolStylePatch): BoardToolStyleMap;
|
|
51
57
|
//#endregion
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { BOARD_ARROW_STROKE_SIZE } from "../../protocol/dist/board-constants.js";
|
|
1
|
+
import { BOARD_ARROW_STROKE_SIZE, BOARD_CONNECTION_STROKE_SIZE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } from "../../protocol/dist/board-constants.js";
|
|
2
2
|
import { isBoardColorId } from "./palette.js";
|
|
3
3
|
import { isGeoKind } from "./shape-types.js";
|
|
4
4
|
//#region src/board/core/tool-styles.ts
|
|
5
|
-
const BOARD_STROKE_MIN_SIZE = 1;
|
|
6
|
-
const BOARD_STROKE_MAX_SIZE = 64;
|
|
7
5
|
const DEFAULT_BOARD_TOOL_STYLES = {
|
|
8
6
|
text: { color: "neutral" },
|
|
9
7
|
geo: {
|
|
@@ -18,18 +16,20 @@ const DEFAULT_BOARD_TOOL_STYLES = {
|
|
|
18
16
|
color: "brand",
|
|
19
17
|
size: BOARD_ARROW_STROKE_SIZE
|
|
20
18
|
},
|
|
19
|
+
connection: {
|
|
20
|
+
color: "neutral",
|
|
21
|
+
size: BOARD_CONNECTION_STROKE_SIZE
|
|
22
|
+
},
|
|
21
23
|
frame: { color: "neutral" }
|
|
22
24
|
};
|
|
23
25
|
function finiteOr(value, fallback) {
|
|
24
26
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
25
27
|
}
|
|
26
|
-
function clampBoardStrokeSize(size) {
|
|
27
|
-
return Math.min(64, Math.max(1, size));
|
|
28
|
-
}
|
|
29
28
|
/** Return a mutable, validated style map for an editor or another Board client. */
|
|
30
29
|
function createBoardToolStyles(patch = {}) {
|
|
31
30
|
const drawSize = clampBoardStrokeSize(finiteOr(patch.draw?.size, DEFAULT_BOARD_TOOL_STYLES.draw.size));
|
|
32
31
|
const arrowSize = clampBoardStrokeSize(finiteOr(patch.arrow?.size, DEFAULT_BOARD_TOOL_STYLES.arrow.size));
|
|
32
|
+
const connectionSize = clampBoardStrokeSize(finiteOr(patch.connection?.size, DEFAULT_BOARD_TOOL_STYLES.connection.size));
|
|
33
33
|
return {
|
|
34
34
|
text: { color: isBoardColorId(patch.text?.color) ? patch.text.color : DEFAULT_BOARD_TOOL_STYLES.text.color },
|
|
35
35
|
geo: {
|
|
@@ -44,6 +44,10 @@ function createBoardToolStyles(patch = {}) {
|
|
|
44
44
|
color: isBoardColorId(patch.arrow?.color) ? patch.arrow.color : DEFAULT_BOARD_TOOL_STYLES.arrow.color,
|
|
45
45
|
size: arrowSize
|
|
46
46
|
},
|
|
47
|
+
connection: {
|
|
48
|
+
color: isBoardColorId(patch.connection?.color) ? patch.connection.color : DEFAULT_BOARD_TOOL_STYLES.connection.color,
|
|
49
|
+
size: connectionSize
|
|
50
|
+
},
|
|
47
51
|
frame: { color: isBoardColorId(patch.frame?.color) ? patch.frame.color : DEFAULT_BOARD_TOOL_STYLES.frame.color }
|
|
48
52
|
};
|
|
49
53
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BoardConnection } from "../../protocol/dist/board-connection.js";
|
|
1
2
|
import { BoardDocument, BoardItem } from "../../protocol/dist/board-document.js";
|
|
2
3
|
import { Rect } from "../geometry.js";
|
|
3
4
|
import { BoardShapeColors } from "../core/palette.js";
|
|
@@ -9,6 +10,8 @@ type BoardExportSceneInput = {
|
|
|
9
10
|
document: BoardDocument;
|
|
10
11
|
/** Items to draw, in document (z) order. */
|
|
11
12
|
items: BoardItem[];
|
|
13
|
+
/** Connections to draw. Rendered beneath the cards, as in the editor. */
|
|
14
|
+
connections?: readonly BoardConnection[];
|
|
12
15
|
/** World rect being captured; content is translated so it starts at 0,0. */
|
|
13
16
|
world: Rect;
|
|
14
17
|
/** Output pixels per world unit. Drives text rasterisation resolution. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { imageAssetKey } from "../image-key.js";
|
|
2
2
|
import { buildFallbackShapeColors } from "../core/palette.js";
|
|
3
|
+
import { createConnectionLayer } from "../render/connection-layer.js";
|
|
3
4
|
import { defaultBoardPalette } from "../render/palette.js";
|
|
4
5
|
import { getBoardCardRenderer } from "../render/renderers/board-renderer-registry.js";
|
|
5
6
|
import { Container, Graphics } from "pixi.js";
|
|
@@ -54,6 +55,19 @@ function createBoardExportScene(input) {
|
|
|
54
55
|
});
|
|
55
56
|
world.scale.set(input.scale);
|
|
56
57
|
world.position.set(-input.world.x * input.scale, -input.world.y * input.scale);
|
|
58
|
+
const connections = input.connections ?? input.document.connections;
|
|
59
|
+
let connectionLayer = null;
|
|
60
|
+
if (connections.length > 0) {
|
|
61
|
+
const frames = new Map(input.document.items.map((item) => [item.id, item.frame]));
|
|
62
|
+
connectionLayer = createConnectionLayer({ parent: world });
|
|
63
|
+
connectionLayer.sync({
|
|
64
|
+
connections,
|
|
65
|
+
getFrame: (id) => frames.get(id),
|
|
66
|
+
colors: context.colors,
|
|
67
|
+
colorScheme: input.colorScheme,
|
|
68
|
+
zoom: input.scale
|
|
69
|
+
});
|
|
70
|
+
}
|
|
57
71
|
for (const item of input.items) {
|
|
58
72
|
const renderer = getBoardCardRenderer(item, context);
|
|
59
73
|
world.addChild(renderer.create(item, context));
|
|
@@ -62,7 +76,10 @@ function createBoardExportScene(input) {
|
|
|
62
76
|
return {
|
|
63
77
|
root,
|
|
64
78
|
missingImageKeys: [...missing],
|
|
65
|
-
destroy: () =>
|
|
79
|
+
destroy: () => {
|
|
80
|
+
connectionLayer?.destroy();
|
|
81
|
+
root.destroy({ children: true });
|
|
82
|
+
}
|
|
66
83
|
};
|
|
67
84
|
}
|
|
68
85
|
//#endregion
|
package/dist/board/index.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } from "../protocol/dist/board-constants.js";
|
|
2
|
+
import { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle } from "../protocol/dist/board-connection.js";
|
|
1
3
|
import { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BoardManifest, BoardNodeRecord, BoardRecord, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest } from "../protocol/dist/board.js";
|
|
2
4
|
import { BoardExtensionDefinition, BoardExtensionRegistry, BoardPresetDefinition, CompiledSequence, DEFAULT_BOARD_LIMITS, QualityProfile, RenderBounds, TimelineClipInput, TimelineInput, clip, compileSequence, createBoardExtensionRegistry, timeline } from "./animation.js";
|
|
3
|
-
import {
|
|
5
|
+
import { BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, BoardMediaSnapshot, BoardMediaSnapshotSchema, BoardPoint, BoardPointSchema, BoardTextItem, BoardTextItemSchema, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, DrawPoint, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, SpaceFileRef, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections } from "../protocol/dist/board-document.js";
|
|
4
6
|
import { BOARD_NODE_SOURCE, DEFAULT_BOARD_APPEARANCE, ITEM_BASE_KEYS, WireBackedBoardItem, boardBootstrapToDocument, boardNodeToItem, isRecord, nodeInputFromRecord, sourceForItem } from "./codec.js";
|
|
5
7
|
import { CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CornerResizeHandle, EDGE_RESIZE_HANDLES, FIT_PADDING, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, ResizeHandle, ScreenPoint, Size, VIEWPORT_MARGIN_RATIO, WorldPoint, angleFromCenter, clamp, clampZoom, degToRad, expandRect, fitToContent, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, handlePosition, itemBounds, normalizeRotation, normalizeViewport, panBy, pointToWorld, radToDeg, rectCenter, rectContainsPoint, rectsIntersect, resizeFrame, resizeFrameToSize, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, scaleFrames, screenPoint, screenToWorld, selectionBounds, unionRects, visibleWorldRect, worldPoint, worldToScreen, zoomAround } from "./geometry.js";
|
|
6
|
-
import {
|
|
8
|
+
import { ResolvedArrow, arrowBounds, arrowFrame, distanceToArrow, resolveArrow, sampleArrow, translateArrow } from "./core/arrow-geometry.js";
|
|
9
|
+
import { CONNECTION_ENDPOINT_GAP, ConnectionIndex, FrameLookup, ResolvedConnection, ResolvedConnectionEndpoint, anchorToWorld, autoConnectionSide, connectionArrowheads, connectionBounds, connectionHitTest, createConnectionIndex, distanceToConnection, pathMidpoint, resolveConnection, worldToAnchor } from "./core/connections.js";
|
|
7
10
|
import { buildStrokeOutline, computeDrawBounds, distanceToStroke, sampleRadius, simplifyDrawIndices } from "./core/draw-geometry.js";
|
|
8
11
|
import { BOARD_EXPORT_MAX_TEXTURES, BoardExportAssetSelection, selectBoardExportAssets } from "./core/export-assets.js";
|
|
9
|
-
import { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, boardFrameLookup, exportItemBounds, normalizeBoardDocument, planBoardExport } from "./core/export-plan.js";
|
|
12
|
+
import { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, boardFrameLookup, exportConnectionBounds, exportItemBounds, normalizeBoardDocument, planBoardExport } from "./core/export-plan.js";
|
|
10
13
|
import { BoardFileSnapshotFacts, BuildSnapshotInput, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FileAvailability, FilePreviewKind, ResolvedCover, availabilityFromError, buildFileExcerpt, buildFileSnapshot, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, formatFileSize, isFileSnapshotFresh, mergeFileSnapshot, readCoverFromFrontmatter, readTitleFromFrontmatter, resolveCoverRef, resolveSpacePath, shouldFetchFileExcerpt, splitFrontmatter } from "./core/file-preview.js";
|
|
11
14
|
import { BOARD_COLORS, BoardColorEntry, BoardColorId, BoardColorValue, BoardShapeColors, DEFAULT_BOARD_COLOR, boardColorCssVar, buildFallbackShapeColors, isBoardColorId, pickBoardColor, resolveBoardColor } from "./core/palette.js";
|
|
12
15
|
import { ArrowShapeProps, DrawShapeProps, FULL_CAPABILITIES, GEO_KINDS, GeoKind, GeoShapeProps, HandleDragResult, ImageShapeProps, ShapeCapabilities, ShapeGeometry, ShapeHandle, ShapeHandleId, ShapeResizeMode, TextShapeProps, VideoShapeProps, isGeoKind, resizeModeForCapabilities } from "./core/shape-types.js";
|
|
13
16
|
import { ShapeDefinition, definitionForItem, getShapeDefinition, registerShapeDefinition, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, unknownShapeDefinition } from "./core/shape-definition.js";
|
|
14
17
|
import { TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, boardTextLineHeight, clampBoardTextFontSize, measureBoardText, setBoardTextMeasurer } from "./core/text-metrics.js";
|
|
15
|
-
import {
|
|
18
|
+
import { BoardStyledToolId, BoardToolStyleMap, BoardToolStylePatch, DEFAULT_BOARD_TOOL_STYLES, createBoardToolStyles } from "./core/tool-styles.js";
|
|
16
19
|
import { boardImageKeySource, imageAssetKey } from "./image-key.js";
|
|
17
|
-
export {
|
|
20
|
+
export { AUTO_BOARD_CONNECTION_ANCHOR, type ArrowShapeProps, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_NODE_SOURCE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardAppearance, BoardAppearanceSchema, BoardArrowItem, BoardArrowItemSchema, BoardColorEntry, BoardColorId, BoardColorValue, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocument, BoardDocumentSchema, BoardDrawItem, BoardDrawItemSchema, BoardExportAssetSelection, BoardExportPlan, BoardExportPlanInput, BoardExportRegion, BoardExtensionDefinition, BoardExtensionRegistry, BoardFileItem, BoardFileItemSchema, BoardFileSnapshot, BoardFileSnapshotFacts, BoardFileSnapshotSchema, BoardFrame, BoardFrameItem, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItem, BoardGeoItemSchema, BoardImageItem, BoardImageItemSchema, BoardItem, BoardItemSchema, BoardItemStyle, BoardItemStyleSchema, BoardKnownItem, type BoardManifest, BoardMediaSnapshot, BoardMediaSnapshotSchema, type BoardNodeRecord, BoardPoint, BoardPointSchema, BoardPresetDefinition, type BoardRecord, BoardRelationSchema, BoardShapeColors, BoardStyledToolId, BoardTextItem, BoardTextItemSchema, BoardToolStyleMap, BoardToolStylePatch, BoardUnknownItem, BoardVideoItem, BoardVideoItemSchema, BoardViewport, BoardViewportSchema, BuildSnapshotInput, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, CompiledSequence, ConnectionIndex, CornerResizeHandle, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPoint, DrawPointSchema, type DrawShapeProps, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, FileAvailability, FilePreviewKind, FrameLookup, GEO_KINDS, type GeoKind, type GeoShapeProps, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, type HandleDragResult, ITEM_BASE_KEYS, type ImageShapeProps, InvalidBoardFileError, KNOWN_BOARD_ITEM_TYPES, KnownBoardItemType, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, Point, QualityProfile, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, Rect, RenderBounds, ResizeHandle, ResolvedArrow, ResolvedConnection, ResolvedConnectionEndpoint, ResolvedCover, ScreenPoint, type ShapeCapabilities, ShapeDefinition, type ShapeGeometry, type ShapeHandle, type ShapeHandleId, type ShapeResizeMode, Size, SpaceFileRef, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, type TextShapeProps, TimelineClipInput, TimelineInput, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, type VideoShapeProps, WireBackedBoardItem, WorldPoint, anchorToWorld, angleFromCenter, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardBootstrapToDocument, boardColorCssVar, boardFrameLookup, boardImageKeySource, boardNodeToItem, boardTextLineHeight, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, clip, compileSequence, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getShapeDefinition, handlePosition, imageAssetKey, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isRecord, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, nodeInputFromRecord, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeRotation, normalizeViewport, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, pathMidpoint, pickBoardColor, planBoardExport, pointToWorld, radToDeg, readCoverFromFrontmatter, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectsIntersect, registerShapeDefinition, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleRadius, scaleFrames, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, sourceForItem, splitFrontmatter, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
|
package/dist/board/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, clampBoardStrokeSize } from "../protocol/dist/board-constants.js";
|
|
1
2
|
import { BoardExtensionRegistry, DEFAULT_BOARD_LIMITS, clip, compileSequence, createBoardExtensionRegistry, timeline } from "./animation.js";
|
|
3
|
+
import { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle } from "../protocol/dist/board-connection.js";
|
|
2
4
|
import { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest } from "../protocol/dist/board.js";
|
|
3
|
-
import {
|
|
5
|
+
import { BoardAppearanceSchema, BoardArrowItemSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, DrawPointSchema, KNOWN_BOARD_ITEM_TYPES, SpaceFileRefSchema, UNKNOWN_BOARD_ITEM_TYPE, isFileBackedItem, isMediaItem, isUnknownItem, parseBoardDocument, parseBoardItemLoose, unknownRealType, withResolvedConnections } from "../protocol/dist/board-document.js";
|
|
4
6
|
import { TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, boardTextLineHeight, clampBoardTextFontSize, measureBoardText, setBoardTextMeasurer } from "./core/text-metrics.js";
|
|
5
7
|
import { BOARD_NODE_SOURCE, DEFAULT_BOARD_APPEARANCE, ITEM_BASE_KEYS, boardBootstrapToDocument, boardNodeToItem, isRecord, nodeInputFromRecord, sourceForItem } from "./codec.js";
|
|
6
8
|
import { CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, EDGE_RESIZE_HANDLES, FIT_PADDING, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, VIEWPORT_MARGIN_RATIO, angleFromCenter, clamp, clampZoom, degToRad, expandRect, fitToContent, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, handlePosition, itemBounds, normalizeRotation, normalizeViewport, panBy, pointToWorld, radToDeg, rectCenter, rectContainsPoint, rectsIntersect, resizeFrame, resizeFrameToSize, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, scaleFrames, screenPoint, screenToWorld, selectionBounds, unionRects, visibleWorldRect, worldPoint, worldToScreen, zoomAround } from "./geometry.js";
|
|
7
9
|
import { boardImageKeySource, imageAssetKey } from "./image-key.js";
|
|
8
|
-
import {
|
|
10
|
+
import { arrowBounds, arrowFrame, distanceToArrow, resolveArrow, sampleArrow, translateArrow } from "./core/arrow-geometry.js";
|
|
11
|
+
import { CONNECTION_ENDPOINT_GAP, anchorToWorld, autoConnectionSide, connectionArrowheads, connectionBounds, connectionHitTest, createConnectionIndex, distanceToConnection, pathMidpoint, resolveConnection, worldToAnchor } from "./core/connections.js";
|
|
9
12
|
import { buildStrokeOutline, computeDrawBounds, distanceToStroke, sampleRadius, simplifyDrawIndices } from "./core/draw-geometry.js";
|
|
10
13
|
import { BOARD_EXPORT_MAX_TEXTURES, selectBoardExportAssets } from "./core/export-assets.js";
|
|
11
|
-
import { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, boardFrameLookup, exportItemBounds, normalizeBoardDocument, planBoardExport } from "./core/export-plan.js";
|
|
14
|
+
import { BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, boardFrameLookup, exportConnectionBounds, exportItemBounds, normalizeBoardDocument, planBoardExport } from "./core/export-plan.js";
|
|
12
15
|
import { FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, availabilityFromError, buildFileExcerpt, buildFileSnapshot, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, formatFileSize, isFileSnapshotFresh, mergeFileSnapshot, readCoverFromFrontmatter, readTitleFromFrontmatter, resolveCoverRef, resolveSpacePath, shouldFetchFileExcerpt, splitFrontmatter } from "./core/file-preview.js";
|
|
13
16
|
import { BOARD_COLORS, DEFAULT_BOARD_COLOR, boardColorCssVar, buildFallbackShapeColors, isBoardColorId, pickBoardColor, resolveBoardColor } from "./core/palette.js";
|
|
14
17
|
import { FULL_CAPABILITIES, GEO_KINDS, isGeoKind, resizeModeForCapabilities } from "./core/shape-types.js";
|
|
15
18
|
import { definitionForItem, getShapeDefinition, registerShapeDefinition, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, unknownShapeDefinition } from "./core/shape-definition.js";
|
|
16
|
-
import {
|
|
17
|
-
export {
|
|
19
|
+
import { DEFAULT_BOARD_TOOL_STYLES, createBoardToolStyles } from "./core/tool-styles.js";
|
|
20
|
+
export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_COLORS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_DOCUMENT_KIND, BOARD_EXPORT_DEFAULT_PADDING, BOARD_EXPORT_DEFAULT_SCALE, BOARD_EXPORT_ITEM_WARN_THRESHOLD, BOARD_EXPORT_MAX_EDGE, BOARD_EXPORT_MAX_PIXELS, BOARD_EXPORT_MAX_TEXTURES, BOARD_EXTENSION, BOARD_NODE_SOURCE, BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardAppearanceSchema, BoardArrowItemSchema, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardDocumentSchema, BoardDrawItemSchema, BoardExtensionRegistry, BoardFileItemSchema, BoardFileSnapshotSchema, BoardFrameItemSchema, BoardFrameSchema, BoardGeoItemSchema, BoardImageItemSchema, BoardItemSchema, BoardItemStyleSchema, BoardMediaSnapshotSchema, BoardPointSchema, BoardRelationSchema, BoardTextItemSchema, BoardVideoItemSchema, BoardViewportSchema, CONNECTION_ENDPOINT_GAP, CORNER_RESIZE_HANDLES, CORNER_ROTATION_ZONE_WIDTH, DEFAULT_BOARD_APPEARANCE, DEFAULT_BOARD_COLOR, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_LIMITS, DEFAULT_BOARD_RELATION, DEFAULT_BOARD_TOOL_STYLES, DrawPointSchema, EDGE_RESIZE_HANDLES, FILE_EXCERPT_MAX_BYTES, FILE_EXCERPT_MAX_CHARS, FIT_PADDING, FULL_CAPABILITIES, GEO_KINDS, HANDLE_DIRECTION, HANDLE_HIT_RADIUS, ITEM_BASE_KEYS, InvalidBoardFileError, KNOWN_BOARD_ITEM_TYPES, MAX_BOARD_ZOOM, MIN_BOARD_ZOOM, MIN_ITEM_SIZE, RESIZE_HANDLES, ROTATION_HANDLE_OFFSET, SpaceFileRefSchema, TEXT_FONT_FAMILY, TEXT_FONT_SIZE, TEXT_LINE_HEIGHT, TEXT_MAX_FONT_SIZE, TEXT_MIN_FONT_SIZE, UNKNOWN_BOARD_ITEM_TYPE, VIEWPORT_MARGIN_RATIO, anchorToWorld, angleFromCenter, arrowBounds, arrowFrame, autoConnectionSide, availabilityFromError, boardBootstrapToDocument, boardColorCssVar, boardFrameLookup, boardImageKeySource, boardNodeToItem, boardTextLineHeight, buildFallbackShapeColors, buildFileExcerpt, buildFileSnapshot, buildStrokeOutline, clamp, clampBoardStrokeSize, clampBoardTextFontSize, clampZoom, clip, compileSequence, computeDrawBounds, connectionArrowheads, connectionBounds, connectionHitTest, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, createBoardExtensionRegistry, createBoardToolStyles, createConnectionIndex, definitionForItem, degToRad, distanceToArrow, distanceToConnection, distanceToStroke, expandRect, exportConnectionBounds, exportItemBounds, fileBaseName, filePreviewKind, filePreviewMemoKey, filePreviewScope, fileTypeLabel, fitToContent, flipBoardConnection, formatFileSize, frameContainsPoint, frameCornerRotationHandleAt, frameCorners, frameEdgeHandleAt, frameHandlePosition, frameRayIntersection, frameRect, getShapeDefinition, handlePosition, imageAssetKey, isBoardColorId, isBoardPath, isFileBackedItem, isFileSnapshotFresh, isGeoKind, isMediaItem, isRecord, isUnknownItem, itemBounds, measureBoardText, mergeFileSnapshot, nodeInputFromRecord, normalizeBoardConnectionStyle, normalizeBoardDocument, normalizeRotation, normalizeViewport, panBy, parseBoardDocument, parseBoardItemLoose, parseBoardManifest, pathMidpoint, pickBoardColor, planBoardExport, pointToWorld, radToDeg, readCoverFromFrontmatter, readTitleFromFrontmatter, rectCenter, rectContainsPoint, rectsIntersect, registerShapeDefinition, resizeFrame, resizeFrameToSize, resizeModeForCapabilities, resolveArrow, resolveBoardColor, resolveConnection, resolveCoverRef, resolveSpacePath, rotateFrames, rotatePointAround, rotationHandleAnchor, rotationHandlePosition, sampleArrow, sampleRadius, scaleFrames, screenPoint, screenToWorld, selectBoardExportAssets, selectionBounds, serializeBoardManifest, setBoardTextMeasurer, shapeBounds, shapeCapabilities, shapeHandles, shapeHitTest, shapeResizeMode, shouldFetchFileExcerpt, simplifyDrawIndices, sourceForItem, splitFrontmatter, timeline, translateArrow, unionRects, unknownRealType, unknownShapeDefinition, visibleWorldRect, withResolvedConnections, worldPoint, worldToAnchor, worldToScreen, zoomAround };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BoardConnection } from "../../protocol/dist/board-connection.js";
|
|
2
|
+
import { BoardFrame } from "../../protocol/dist/board-document.js";
|
|
3
|
+
import { FrameLookup, ResolvedConnection } from "../core/connections.js";
|
|
4
|
+
import { BoardShapeColors } from "../core/palette.js";
|
|
5
|
+
import { Container } from "pixi.js";
|
|
6
|
+
//#region src/board/render/connection-layer.d.ts
|
|
7
|
+
type ConnectionRenderInput = {
|
|
8
|
+
connections: readonly BoardConnection[];
|
|
9
|
+
getFrame: FrameLookup;
|
|
10
|
+
colors: BoardShapeColors;
|
|
11
|
+
colorScheme: "dark" | "light";
|
|
12
|
+
zoom: number;
|
|
13
|
+
/** Connections drawn in their selected state. */
|
|
14
|
+
selectedIds?: ReadonlySet<string>;
|
|
15
|
+
/** Connection under the pointer, if any. */
|
|
16
|
+
hoveredId?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Ids to skip because the host is drawing them itself this frame (e.g. a live
|
|
19
|
+
* drag preview on the interaction overlay). Skipping avoids the doubled stroke
|
|
20
|
+
* of a preview drawn over its own committed geometry.
|
|
21
|
+
*/
|
|
22
|
+
skipIds?: ReadonlySet<string>;
|
|
23
|
+
};
|
|
24
|
+
type ConnectionLayer = {
|
|
25
|
+
/** Redraw every connection. Cheap: one Graphics, batched. */
|
|
26
|
+
sync: (input: ConnectionRenderInput) => void;
|
|
27
|
+
/** Resolved geometry from the last sync, for hit testing and overlays. */
|
|
28
|
+
resolved: (connectionId: string) => ResolvedConnection | null;
|
|
29
|
+
/**
|
|
30
|
+
* The display objects this layer owns, so a host can place them in its own
|
|
31
|
+
* z-ordering scheme without the layer needing to know about it.
|
|
32
|
+
*/
|
|
33
|
+
readonly children: readonly Container[];
|
|
34
|
+
destroy: () => void;
|
|
35
|
+
};
|
|
36
|
+
declare function createConnectionLayer(options: {
|
|
37
|
+
/** World-space container the layer attaches to. */
|
|
38
|
+
parent: Container;
|
|
39
|
+
/** zIndex applied to the layer's display objects once they exist. */
|
|
40
|
+
zIndex?: number;
|
|
41
|
+
}): ConnectionLayer;
|
|
42
|
+
/** Frame lookup over a plain item list, for hosts without an index. */
|
|
43
|
+
declare function framesFromItems(items: readonly {
|
|
44
|
+
id: string;
|
|
45
|
+
frame: BoardFrame;
|
|
46
|
+
}[]): FrameLookup;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { ConnectionLayer, ConnectionRenderInput, createConnectionLayer, framesFromItems };
|