@neta-art/cohub 5.10.0 → 7.0.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 (62) hide show
  1. package/README.md +47 -50
  2. package/dist/board/animation.d.ts +157 -67
  3. package/dist/board/animation.js +161 -306
  4. package/dist/board/core/connections.js +4 -4
  5. package/dist/board/core/export-plan.js +1 -1
  6. package/dist/board/core/shape-types.js +0 -1
  7. package/dist/board/geometry.js +4 -4
  8. package/dist/board/index.d.ts +8 -7
  9. package/dist/board/index.js +8 -9
  10. package/dist/board/mutation.d.ts +2 -17
  11. package/dist/board/mutation.js +2 -93
  12. package/dist/board/render/renderers/text-card-renderer.js +1 -1
  13. package/dist/board/semantic-document.d.ts +30 -0
  14. package/dist/board/semantic-document.js +271 -0
  15. package/dist/board/semantic-mutation.d.ts +10 -0
  16. package/dist/board/semantic-mutation.js +203 -0
  17. package/dist/chunks/http.d.ts +27 -95
  18. package/dist/chunks/http.js +628 -1610
  19. package/dist/chunks/transport.js +1 -1
  20. package/dist/chunks/websocket.d.ts +3462 -533
  21. package/dist/chunks/websocket.js +1 -1
  22. package/dist/http.d.ts +3 -3
  23. package/dist/index.d.ts +158 -299
  24. package/dist/index.js +1207 -499
  25. package/dist/protocol/dist/board-authoring.d.ts +1305 -0
  26. package/dist/protocol/dist/board-authoring.js +291 -0
  27. package/dist/protocol/dist/board-capability-registry.d.ts +2 -0
  28. package/dist/protocol/dist/board-capability-registry.js +74 -0
  29. package/dist/protocol/dist/board-codec.d.ts +2 -0
  30. package/dist/protocol/dist/board-codec.js +19 -0
  31. package/dist/protocol/dist/board-composition.d.ts +383 -0
  32. package/dist/protocol/dist/board-composition.js +310 -0
  33. package/dist/protocol/dist/board-connection.d.ts +16 -16
  34. package/dist/protocol/dist/board-connection.js +16 -16
  35. package/dist/protocol/dist/board-constants.js +0 -25
  36. package/dist/protocol/dist/board-document.d.ts +34 -3
  37. package/dist/protocol/dist/board-document.js +3 -1
  38. package/dist/protocol/dist/board-effect.d.ts +94 -0
  39. package/dist/protocol/dist/board-effect.js +53 -0
  40. package/dist/protocol/dist/board-json.js +16 -0
  41. package/dist/protocol/dist/board-node.d.ts +1 -12
  42. package/dist/protocol/dist/board-node.js +1 -81
  43. package/dist/protocol/dist/board.d.ts +42 -245
  44. package/dist/protocol/dist/board.js +56 -117
  45. package/dist/protocol/dist/index.d.ts +9 -4
  46. package/dist/types.d.ts +4 -1
  47. package/docs/work-runtime-guide.md +19 -3
  48. package/package.json +2 -2
  49. package/dist/board/codec.d.ts +0 -27
  50. package/dist/board/codec.js +0 -277
  51. package/dist/board/nodes.d.ts +0 -113
  52. package/dist/board/nodes.js +0 -154
  53. package/dist/protocol/dist/board-content.js +0 -26
  54. package/dist/protocol/dist/identifiers.js +0 -10
  55. package/dist/protocol/dist/index.js +0 -14
  56. package/dist/protocol/dist/provenance.js +0 -15
  57. package/dist/protocol/dist/public-identifiers.js +0 -38
  58. package/dist/protocol/dist/realtime/board-awareness.js +0 -119
  59. package/dist/protocol/dist/ui-command.js +0 -2
  60. package/dist/protocol/dist/work-promotion-stats.js +0 -11
  61. package/dist/protocol/dist/work-surface.js +0 -2
  62. package/dist/protocol/dist/work-view-stats.js +0 -3
@@ -1,113 +0,0 @@
1
- import { BoardColorId, BoardGeoKind, BoardNodeValidationDiagnostic } from "../protocol/dist/board-node.js";
2
- import { BoardNodeInput } from "../protocol/dist/board.js";
3
- import "../protocol/dist/index.js";
4
- import { BoardAudioItem, BoardFileSnapshot, BoardMediaSnapshot, BoardTaskSnapshot } from "../protocol/dist/board-document.js";
5
- //#region src/board/nodes.d.ts
6
- type BoardNodeFrameInput = {
7
- x: number;
8
- y: number;
9
- width: number;
10
- height: number;
11
- rotation?: number;
12
- };
13
- type BoardNodeSpecBase = {
14
- id: string;
15
- parentId?: string | null;
16
- orderKey?: string | null;
17
- style?: Record<string, unknown>;
18
- };
19
- type BoardBoxNodeSpec = BoardNodeSpecBase & {
20
- frame: BoardNodeFrameInput;
21
- };
22
- type BoardMediaNodeSpec = BoardBoxNodeSpec & {
23
- path: string;
24
- snapshot?: BoardMediaSnapshot;
25
- };
26
- type BoardNodeSpec = (BoardBoxNodeSpec & {
27
- type: "text";
28
- text?: string;
29
- color?: BoardColorId;
30
- fontSize?: number;
31
- }) | (BoardBoxNodeSpec & {
32
- type: "geo";
33
- geo?: BoardGeoKind;
34
- text?: string;
35
- color?: BoardColorId;
36
- fillOpacity?: number;
37
- }) | (BoardNodeSpecBase & {
38
- type: "draw";
39
- /** Raw world-space samples. Stored points are converted to frame-local space. */
40
- points: Array<{
41
- x: number;
42
- y: number;
43
- p?: number;
44
- }>;
45
- color?: BoardColorId;
46
- size?: number;
47
- }) | (BoardNodeSpecBase & {
48
- type: "arrow";
49
- start: {
50
- x: number;
51
- y: number;
52
- };
53
- end: {
54
- x: number;
55
- y: number;
56
- };
57
- bend?: number;
58
- color?: BoardColorId;
59
- size?: number;
60
- arrowStart?: boolean;
61
- arrowEnd?: boolean;
62
- label?: string;
63
- }) | (BoardBoxNodeSpec & {
64
- type: "frame";
65
- label?: string;
66
- color?: BoardColorId;
67
- }) | (BoardMediaNodeSpec & {
68
- type: "image";
69
- crop?: {
70
- x: number;
71
- y: number;
72
- w: number;
73
- h: number;
74
- };
75
- }) | (BoardMediaNodeSpec & {
76
- type: "video";
77
- }) | (Omit<BoardMediaNodeSpec, "snapshot"> & {
78
- type: "audio";
79
- snapshot?: BoardAudioItem["snapshot"];
80
- }) | (BoardBoxNodeSpec & {
81
- type: "file";
82
- path: string;
83
- snapshot?: BoardFileSnapshot;
84
- }) | (BoardBoxNodeSpec & {
85
- type: "task";
86
- taskRunId: string;
87
- snapshot: BoardTaskSnapshot;
88
- });
89
- declare class BoardInputError extends Error {
90
- readonly code = "INVALID_BOARD_NODE";
91
- readonly diagnostics: BoardNodeValidationDiagnostic[];
92
- readonly body: {
93
- code: "INVALID_BOARD_NODE";
94
- message: string;
95
- diagnostics: BoardNodeValidationDiagnostic[];
96
- };
97
- constructor(diagnostics: BoardNodeValidationDiagnostic[]);
98
- }
99
- /**
100
- * Create one validated wire node from semantic Board input.
101
- *
102
- * Box nodes take an explicit world-space frame. Draw samples and arrow endpoints
103
- * take world coordinates; the builder derives their frame and local storage form.
104
- */
105
- declare function createBoardNode(spec: BoardNodeSpec): BoardNodeInput;
106
- declare function validateBoardNodes(nodes: readonly BoardNodeInput[], path?: string): BoardNodeValidationDiagnostic[];
107
- declare function assertBoardNodes(nodes: readonly BoardNodeInput[], path?: string): void;
108
- declare function assertBoardTransactionNodeCreates(operations: ReadonlyArray<{
109
- type: string;
110
- payload: unknown;
111
- }>): void;
112
- //#endregion
113
- export { BoardInputError, BoardNodeFrameInput, BoardNodeSpec, assertBoardNodes, assertBoardTransactionNodeCreates, createBoardNode, validateBoardNodes };
@@ -1,154 +0,0 @@
1
- import "../protocol/dist/board-constants.js";
2
- import { validateBoardNodeInput } from "../protocol/dist/board-node.js";
3
- import "../protocol/dist/index.js";
4
- import { computeDrawBounds } from "./core/draw-geometry.js";
5
- //#region src/board/nodes.ts
6
- var BoardInputError = class extends Error {
7
- code = "INVALID_BOARD_NODE";
8
- diagnostics;
9
- body;
10
- constructor(diagnostics) {
11
- const message = diagnostics[0]?.message ?? "Invalid Board node";
12
- super(message);
13
- this.name = "BoardInputError";
14
- this.diagnostics = diagnostics;
15
- this.body = {
16
- code: this.code,
17
- message,
18
- diagnostics
19
- };
20
- }
21
- };
22
- function baseNode(spec, frame) {
23
- return {
24
- nodeId: spec.id,
25
- type: spec.type,
26
- parentId: spec.parentId ?? null,
27
- orderKey: spec.orderKey ?? null,
28
- x: frame.x,
29
- y: frame.y,
30
- width: frame.width,
31
- height: frame.height,
32
- rotation: frame.rotation ?? 0,
33
- refKind: null,
34
- refPath: null,
35
- refUrl: null,
36
- view: {},
37
- style: spec.style ?? {},
38
- data: {}
39
- };
40
- }
41
- function arrowFrame(start, end) {
42
- const padding = 16;
43
- return {
44
- x: Math.min(start.x, end.x) - padding,
45
- y: Math.min(start.y, end.y) - padding,
46
- width: Math.max(1, Math.abs(end.x - start.x) + padding * 2),
47
- height: Math.max(1, Math.abs(end.y - start.y) + padding * 2)
48
- };
49
- }
50
- /**
51
- * Create one validated wire node from semantic Board input.
52
- *
53
- * Box nodes take an explicit world-space frame. Draw samples and arrow endpoints
54
- * take world coordinates; the builder derives their frame and local storage form.
55
- */
56
- function createBoardNode(spec) {
57
- let node;
58
- if (spec.type === "draw") {
59
- const size = spec.size ?? 4;
60
- const worldPoints = spec.points.map((point) => ({
61
- x: point.x,
62
- y: point.y,
63
- p: point.p ?? .5
64
- }));
65
- const bounds = computeDrawBounds(worldPoints, size);
66
- node = baseNode(spec, bounds);
67
- node.data = {
68
- points: worldPoints.map((point) => ({
69
- x: point.x - bounds.x,
70
- y: point.y - bounds.y,
71
- p: point.p
72
- })),
73
- color: spec.color ?? "brand",
74
- size
75
- };
76
- } else if (spec.type === "arrow") {
77
- node = baseNode(spec, arrowFrame(spec.start, spec.end));
78
- node.data = {
79
- start: spec.start,
80
- end: spec.end,
81
- bend: spec.bend ?? 0,
82
- color: spec.color ?? "brand",
83
- size: spec.size ?? 2.5,
84
- arrowStart: spec.arrowStart ?? false,
85
- arrowEnd: spec.arrowEnd ?? true,
86
- label: spec.label ?? ""
87
- };
88
- } else {
89
- node = baseNode(spec, spec.frame);
90
- switch (spec.type) {
91
- case "text":
92
- node.data = {
93
- text: spec.text ?? "",
94
- color: spec.color ?? "neutral",
95
- fontSize: spec.fontSize ?? 24
96
- };
97
- break;
98
- case "geo":
99
- node.data = {
100
- geo: spec.geo ?? "rectangle",
101
- text: spec.text ?? "",
102
- color: spec.color ?? "brand",
103
- fillOpacity: spec.fillOpacity ?? 0
104
- };
105
- break;
106
- case "frame":
107
- node.data = {
108
- label: spec.label ?? "Frame",
109
- color: spec.color ?? "neutral"
110
- };
111
- break;
112
- case "image":
113
- node.refKind = "space_file";
114
- node.refPath = spec.path;
115
- node.view = spec.snapshot ?? {};
116
- node.data = spec.crop ? { crop: spec.crop } : {};
117
- break;
118
- case "video":
119
- case "audio":
120
- node.refKind = "space_file";
121
- node.refPath = spec.path;
122
- node.view = spec.snapshot ?? {};
123
- break;
124
- case "file":
125
- node.refKind = "space_file";
126
- node.refPath = spec.path;
127
- node.view = spec.snapshot ?? {};
128
- break;
129
- case "task":
130
- node.view = spec.snapshot;
131
- node.data = { taskRunId: spec.taskRunId };
132
- break;
133
- }
134
- }
135
- assertBoardNodes([node]);
136
- return node;
137
- }
138
- function validateBoardNodes(nodes, path = "nodes") {
139
- return nodes.flatMap((node, index) => validateBoardNodeInput(node, `${path}.${index}`));
140
- }
141
- function assertBoardNodes(nodes, path = "nodes") {
142
- const diagnostics = validateBoardNodes(nodes, path);
143
- if (diagnostics.length > 0) throw new BoardInputError(diagnostics);
144
- }
145
- function assertBoardTransactionNodeCreates(operations) {
146
- const diagnostics = operations.flatMap((operation, index) => {
147
- if (operation.type !== "node.create") return [];
148
- const payload = operation.payload;
149
- return payload.node ? validateBoardNodeInput(payload.node, `operations.${index}.payload.node`) : [];
150
- });
151
- if (diagnostics.length > 0) throw new BoardInputError(diagnostics);
152
- }
153
- //#endregion
154
- export { BoardInputError, assertBoardNodes, assertBoardTransactionNodeCreates, createBoardNode, validateBoardNodes };
@@ -1,26 +0,0 @@
1
- import { z } from "zod";
2
- //#region ../protocol/dist/board-content.js
3
- const BOARD_CONTENT_KINDS = [
4
- "text",
5
- "image",
6
- "video",
7
- "audio",
8
- "file",
9
- "json",
10
- "collection"
11
- ];
12
- const BoardContentKindSchema = z.enum(BOARD_CONTENT_KINDS);
13
- const BoardPortSchema = z.object({
14
- id: z.string().min(1).max(120),
15
- kind: BoardContentKindSchema,
16
- role: z.string().min(1).max(80).optional(),
17
- required: z.boolean().optional(),
18
- multiple: z.boolean().optional(),
19
- maxItems: z.number().int().positive().optional()
20
- }).strict();
21
- z.object({
22
- inputs: z.array(BoardPortSchema),
23
- outputs: z.array(BoardPortSchema)
24
- }).strict();
25
- //#endregion
26
- export { BOARD_CONTENT_KINDS, BoardContentKindSchema, BoardPortSchema };
@@ -1,10 +0,0 @@
1
- //#region ../protocol/dist/identifiers.js
2
- const UUID_SHAPE_PATTERN = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
3
- const UUID_PATTERN = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}";
4
- const SHORT_UUID_PATTERN = "[0-9a-fA-F]{32}";
5
- const UUID_OR_SHORT_UUID_PATTERN = `^(?:${UUID_PATTERN}|${SHORT_UUID_PATTERN})$`;
6
- new RegExp(`^${UUID_SHAPE_PATTERN}$`);
7
- new RegExp(`^${UUID_PATTERN}$`);
8
- new RegExp(UUID_OR_SHORT_UUID_PATTERN);
9
- //#endregion
10
- export { SHORT_UUID_PATTERN, UUID_OR_SHORT_UUID_PATTERN, UUID_PATTERN, UUID_SHAPE_PATTERN };
@@ -1,14 +0,0 @@
1
- import "./board-constants.js";
2
- 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 "./board-connection.js";
3
- import { BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BOARD_MANIFEST_KIND, BoardAssetRefSchema, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, BoardCameraStateSchema, BoardClipSchema, BoardEffectSchema, BoardKeyframeSchema, BoardManifestSchema, BoardNodeInputSchema, BoardSequenceSchema, BoardTargetSchema, InvalidBoardFileError, isBoardPath, parseBoardManifest, serializeBoardManifest } from "./board.js";
4
- import { BOARD_CONTENT_KINDS, BoardContentKindSchema, BoardPortSchema } from "./board-content.js";
5
- import { BOARD_COLOR_IDS, BOARD_GEO_KINDS, BOARD_NATIVE_NODE_TYPES, BoardColorIdSchema, BoardGeoKindSchema, validateBoardNodeInput } from "./board-node.js";
6
- import { BoardAwarenessDrawPointSchema, BoardAwarenessFrameSchema, BoardAwarenessGestureSchema, BoardAwarenessNodePreviewSchema, BoardAwarenessPointSchema, BoardAwarenessStateUpdateSchema, BoardAwarenessUpdateSchema } from "./realtime/board-awareness.js";
7
- import { SHORT_UUID_PATTERN, UUID_OR_SHORT_UUID_PATTERN, UUID_PATTERN, UUID_SHAPE_PATTERN } from "./identifiers.js";
8
- import { COHUB_SOURCE_HEADER } from "./provenance.js";
9
- import { RESERVED_PLATFORM_PATH_SEGMENTS } from "./public-identifiers.js";
10
- import "./ui-command.js";
11
- import "./work-surface.js";
12
- import "./work-view-stats.js";
13
- import { WORK_PROMOTION_EVENT_KEYS } from "./work-promotion-stats.js";
14
- export { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_COLOR_IDS, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BOARD_CONTENT_KINDS, BOARD_DOCUMENT_KIND, BOARD_EXTENSION, BOARD_GEO_KINDS, BOARD_MANIFEST_KIND, BOARD_NATIVE_NODE_TYPES, BoardAssetRefSchema, BoardAwarenessDrawPointSchema, BoardAwarenessFrameSchema, BoardAwarenessGestureSchema, BoardAwarenessNodePreviewSchema, BoardAwarenessPointSchema, BoardAwarenessStateUpdateSchema, BoardAwarenessUpdateSchema, BoardCameraFocusParamsSchema, BoardCameraFocusSchema, BoardCameraStateSchema, BoardClipSchema, BoardColorIdSchema, BoardConnectionAnchorSchema, BoardConnectionEndpointSchema, BoardConnectionPatchSchema, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardContentKindSchema, BoardEffectSchema, BoardGeoKindSchema, BoardKeyframeSchema, BoardManifestSchema, BoardNodeInputSchema, BoardPortSchema, BoardRelationSchema, BoardSequenceSchema, BoardTargetSchema, COHUB_SOURCE_HEADER, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, InvalidBoardFileError, RESERVED_PLATFORM_PATH_SEGMENTS, SHORT_UUID_PATTERN, UUID_OR_SHORT_UUID_PATTERN, UUID_PATTERN, UUID_SHAPE_PATTERN, WORK_PROMOTION_EVENT_KEYS, connectionNodeIds, connectionOtherNodeId, connectionTouchesNode, createBoardConnection, flipBoardConnection, isBoardPath, normalizeBoardConnectionStyle, parseBoardManifest, serializeBoardManifest, validateBoardNodeInput };
@@ -1,15 +0,0 @@
1
- import "./identifiers.js";
2
- //#region ../protocol/dist/provenance.js
3
- /** Request provenance via X-Cohub-Source-* headers. Never used for authorization. */
4
- const COHUB_SOURCE_HEADER = {
5
- space: "X-Cohub-Source-Space",
6
- session: "X-Cohub-Source-Session",
7
- turn: "X-Cohub-Source-Turn",
8
- toolCall: "X-Cohub-Source-Tool-Call",
9
- client: "X-Cohub-Source-Client",
10
- sandboxVersion: "X-Cohub-Source-Sandbox",
11
- via: "X-Cohub-Source-Via"
12
- };
13
- Object.values(COHUB_SOURCE_HEADER);
14
- //#endregion
15
- export { COHUB_SOURCE_HEADER };
@@ -1,38 +0,0 @@
1
- //#region ../protocol/dist/public-identifiers.js
2
- /**
3
- * Platform-owned path segments that must not be newly assigned to public
4
- * identities. Existing stored values remain readable through parse helpers.
5
- */
6
- const RESERVED_PLATFORM_PATH_SEGMENTS = Object.freeze([
7
- "admin",
8
- "api",
9
- "assets",
10
- "auth",
11
- "callback",
12
- "changelog",
13
- "docs",
14
- "explore",
15
- "invite",
16
- "landing",
17
- "login",
18
- "logout",
19
- "new",
20
- "org",
21
- "pricing",
22
- "pwa",
23
- "referrals",
24
- "sessions",
25
- "settings",
26
- "spaces",
27
- "static",
28
- "teams",
29
- "trending",
30
- "u",
31
- "user",
32
- "users",
33
- "work-auth"
34
- ]);
35
- new Set(RESERVED_PLATFORM_PATH_SEGMENTS);
36
- [...RESERVED_PLATFORM_PATH_SEGMENTS];
37
- //#endregion
38
- export { RESERVED_PLATFORM_PATH_SEGMENTS };
@@ -1,119 +0,0 @@
1
- import { BOARD_ARROW_STROKE_SIZE, BOARD_CONNECTION_STROKE_SIZE } from "../board-constants.js";
2
- import { z } from "zod";
3
- //#region ../protocol/dist/realtime/board-awareness.js
4
- const idSchema = z.string().min(1).max(160);
5
- const finiteSchema = z.number().finite();
6
- const BoardAwarenessPointSchema = z.object({
7
- x: finiteSchema,
8
- y: finiteSchema
9
- });
10
- const BoardAwarenessDrawPointSchema = BoardAwarenessPointSchema.extend({ p: finiteSchema.min(0).max(1) });
11
- const BoardAwarenessFrameSchema = z.object({
12
- x: finiteSchema,
13
- y: finiteSchema,
14
- width: finiteSchema.positive(),
15
- height: finiteSchema.positive(),
16
- rotation: finiteSchema
17
- });
18
- const BoardAwarenessNodePreviewSchema = z.object({
19
- nodeId: idSchema,
20
- frame: BoardAwarenessFrameSchema,
21
- /** Live endpoints of a free arrow being dragged. */
22
- arrow: z.object({
23
- start: BoardAwarenessPointSchema,
24
- end: BoardAwarenessPointSchema,
25
- bend: finiteSchema
26
- }).optional()
27
- });
28
- const BoardAwarenessStateUpdateSchema = z.object({
29
- type: z.literal("state"),
30
- client: z.object({ formFactor: z.enum(["desktop", "mobile"]) }).optional(),
31
- cursor: BoardAwarenessPointSchema.extend({ pointerType: z.enum([
32
- "mouse",
33
- "pen",
34
- "touch"
35
- ]) }).nullable(),
36
- tool: z.string().min(1).max(40),
37
- selection: z.object({
38
- ids: z.array(idSchema).max(64),
39
- count: z.number().int().nonnegative().max(5e4),
40
- bounds: BoardAwarenessFrameSchema.nullable()
41
- }),
42
- editingId: idSchema.nullable()
43
- });
44
- const BoardAwarenessGestureSchema = z.discriminatedUnion("kind", [
45
- z.object({
46
- kind: z.literal("draw"),
47
- id: idSchema,
48
- nodeId: idSchema,
49
- color: z.string().min(1).max(64),
50
- size: finiteSchema.positive().max(256),
51
- from: z.number().int().nonnegative().max(1e5),
52
- points: z.array(BoardAwarenessDrawPointSchema).min(1).max(64)
53
- }),
54
- z.object({
55
- kind: z.literal("arrow"),
56
- id: idSchema,
57
- nodeId: idSchema,
58
- start: BoardAwarenessPointSchema,
59
- current: BoardAwarenessPointSchema,
60
- color: z.string().min(1).max(64),
61
- size: finiteSchema.positive().max(256).default(BOARD_ARROW_STROKE_SIZE)
62
- }),
63
- z.object({
64
- kind: z.literal("box"),
65
- id: idSchema,
66
- nodeId: idSchema,
67
- shape: z.enum(["geo", "frame"]),
68
- start: BoardAwarenessPointSchema,
69
- current: BoardAwarenessPointSchema,
70
- color: z.string().min(1).max(64),
71
- geo: z.string().min(1).max(40)
72
- }),
73
- z.object({
74
- kind: z.literal("connection"),
75
- id: idSchema,
76
- sourceNodeId: idSchema,
77
- targetNodeId: idSchema.nullable(),
78
- current: BoardAwarenessPointSchema,
79
- color: z.string().min(1).max(64),
80
- size: finiteSchema.positive().max(256).default(BOARD_CONNECTION_STROKE_SIZE)
81
- }),
82
- z.object({
83
- kind: z.literal("transform"),
84
- id: idSchema,
85
- mode: z.enum([
86
- "translate",
87
- "resize",
88
- "rotate",
89
- "arrow",
90
- "connection"
91
- ]),
92
- nodes: z.array(BoardAwarenessNodePreviewSchema).max(64),
93
- bounds: BoardAwarenessFrameSchema.nullable()
94
- })
95
- ]);
96
- const BoardAwarenessUpdateSchema = z.discriminatedUnion("type", [
97
- BoardAwarenessStateUpdateSchema,
98
- z.object({
99
- type: z.literal("gesture"),
100
- gesture: BoardAwarenessGestureSchema
101
- }),
102
- z.object({
103
- type: z.literal("gesture.end"),
104
- gestureId: idSchema,
105
- resultingNodeIds: z.array(idSchema).max(64)
106
- }),
107
- z.object({
108
- type: z.literal("gesture.cancel"),
109
- gestureId: idSchema
110
- })
111
- ]);
112
- z.object({
113
- spaceId: z.string().uuid(),
114
- boardId: z.string().uuid(),
115
- seq: z.number().int().nonnegative(),
116
- update: BoardAwarenessUpdateSchema
117
- });
118
- //#endregion
119
- export { BoardAwarenessDrawPointSchema, BoardAwarenessFrameSchema, BoardAwarenessGestureSchema, BoardAwarenessNodePreviewSchema, BoardAwarenessPointSchema, BoardAwarenessStateUpdateSchema, BoardAwarenessUpdateSchema };
@@ -1,2 +0,0 @@
1
- import "./identifiers.js";
2
- export {};
@@ -1,11 +0,0 @@
1
- import "./identifiers.js";
2
- const WORK_PROMOTION_EVENT_KEYS = [
3
- "landing",
4
- "ready",
5
- "registration_completed",
6
- "paywall_viewed",
7
- "checkout_started"
8
- ];
9
- new Set(WORK_PROMOTION_EVENT_KEYS);
10
- //#endregion
11
- export { WORK_PROMOTION_EVENT_KEYS };
@@ -1,2 +0,0 @@
1
- import "./ui-command.js";
2
- export {};
@@ -1,3 +0,0 @@
1
- import "./identifiers.js";
2
- //#endregion
3
- export {};