@neta-art/cohub 8.24.0 → 9.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 (159) hide show
  1. package/dist/board/animation.d.ts +57 -181
  2. package/dist/board/animation.js +374 -220
  3. package/dist/board/core/arrow-geometry.d.ts +33 -18
  4. package/dist/board/core/arrow-geometry.js +283 -52
  5. package/dist/board/core/draw-geometry.d.ts +22 -36
  6. package/dist/board/core/draw-geometry.js +148 -85
  7. package/dist/board/core/export-assets.d.ts +3 -6
  8. package/dist/board/core/export-assets.js +0 -2
  9. package/dist/board/core/export-plan.d.ts +12 -63
  10. package/dist/board/core/export-plan.js +55 -94
  11. package/dist/board/core/palette.d.ts +4 -21
  12. package/dist/board/core/palette.js +8 -13
  13. package/dist/board/core/scene.d.ts +33 -0
  14. package/dist/board/core/scene.js +302 -0
  15. package/dist/board/core/shape-definition.d.ts +12 -24
  16. package/dist/board/core/shape-definition.js +0 -19
  17. package/dist/board/core/shape-types.d.ts +6 -120
  18. package/dist/board/core/shape-types.js +5 -5
  19. package/dist/board/core/text-metrics.d.ts +8 -11
  20. package/dist/board/core/text-metrics.js +5 -34
  21. package/dist/board/core/tool-styles.d.ts +6 -16
  22. package/dist/board/core/tool-styles.js +17 -25
  23. package/dist/board/export/index.d.ts +10 -17
  24. package/dist/board/export/index.js +22 -21
  25. package/dist/board/export/scene.d.ts +10 -16
  26. package/dist/board/export/scene.js +17 -30
  27. package/dist/board/geometry.d.ts +27 -56
  28. package/dist/board/geometry.js +7 -67
  29. package/dist/board/headless/index.d.ts +6 -27
  30. package/dist/board/headless/index.js +4 -19
  31. package/dist/board/headless/sketch.d.ts +19 -0
  32. package/dist/board/headless/sketch.js +146 -0
  33. package/dist/board/image-key.d.ts +2 -12
  34. package/dist/board/image-key.js +3 -13
  35. package/dist/board/index.d.ts +18 -20
  36. package/dist/board/index.js +17 -17
  37. package/dist/board/media-playback.d.ts +3 -6
  38. package/dist/board/media-playback.js +6 -6
  39. package/dist/board/presets.d.ts +150 -0
  40. package/dist/board/presets.js +226 -0
  41. package/dist/board/render/board-background.d.ts +5 -3
  42. package/dist/board/render/board-background.js +8 -7
  43. package/dist/board/render/clip.d.ts +14 -0
  44. package/dist/board/render/clip.js +47 -0
  45. package/dist/board/render/index.d.ts +8 -5
  46. package/dist/board/render/index.js +7 -4
  47. package/dist/board/render/media-interaction.d.ts +4 -5
  48. package/dist/board/render/media-interaction.js +1 -2
  49. package/dist/board/render/palette.d.ts +6 -2
  50. package/dist/board/render/palette.js +7 -1
  51. package/dist/board/render/renderers/arrow-card-renderer.js +69 -71
  52. package/dist/board/render/renderers/audio-card-renderer.js +3 -3
  53. package/dist/board/render/renderers/base-card-renderer.d.ts +6 -17
  54. package/dist/board/render/renderers/base-card-renderer.js +1 -24
  55. package/dist/board/render/renderers/board-renderer-registry.d.ts +20 -50
  56. package/dist/board/render/renderers/board-renderer-registry.js +6 -7
  57. package/dist/board/render/renderers/draw-card-renderer.js +89 -56
  58. package/dist/board/render/renderers/effect-card-renderer.d.ts +6 -0
  59. package/dist/board/render/renderers/effect-card-renderer.js +197 -0
  60. package/dist/board/render/renderers/far-plate.d.ts +4 -21
  61. package/dist/board/render/renderers/far-plate.js +15 -34
  62. package/dist/board/render/renderers/file-card-renderer.d.ts +4 -25
  63. package/dist/board/render/renderers/file-card-renderer.js +8 -58
  64. package/dist/board/render/renderers/frame-card-renderer.js +28 -28
  65. package/dist/board/render/renderers/image-card-renderer.d.ts +4 -3
  66. package/dist/board/render/renderers/image-card-renderer.js +0 -9
  67. package/dist/board/render/renderers/shape-card-renderer.d.ts +9 -0
  68. package/dist/board/render/renderers/shape-card-renderer.js +240 -0
  69. package/dist/board/render/renderers/sketch-card-renderer.d.ts +5 -0
  70. package/dist/board/render/renderers/sketch-card-renderer.js +98 -0
  71. package/dist/board/render/renderers/task-card-renderer.d.ts +0 -1
  72. package/dist/board/render/renderers/task-card-renderer.js +14 -16
  73. package/dist/board/render/renderers/text-card-renderer.d.ts +1 -3
  74. package/dist/board/render/renderers/text-card-renderer.js +56 -46
  75. package/dist/board/render/renderers/unknown-card-renderer.js +4 -10
  76. package/dist/board/render/renderers/video-card-renderer.d.ts +4 -2
  77. package/dist/board/render/renderers/video-card-renderer.js +2 -1
  78. package/dist/board/render/sketch-host.d.ts +14 -0
  79. package/dist/board/render/sketch-host.js +216 -0
  80. package/dist/board/render/stroke.d.ts +12 -0
  81. package/dist/board/render/stroke.js +90 -0
  82. package/dist/board/render/text-measurement.d.ts +6 -26
  83. package/dist/board/render/text-measurement.js +11 -30
  84. package/dist/board/replay.d.ts +6 -31
  85. package/dist/board/replay.js +45 -203
  86. package/dist/board/runtime/board-player.d.ts +24 -0
  87. package/dist/board/runtime/board-player.js +161 -0
  88. package/dist/board/task.d.ts +2 -10
  89. package/dist/board/task.js +1 -10
  90. package/dist/chunks/environment.d.ts +2291 -3864
  91. package/dist/chunks/host-bridge.d.ts +253 -0
  92. package/dist/chunks/http.d.ts +233 -58
  93. package/dist/chunks/http.js +1046 -1028
  94. package/dist/chunks/transport.js +113 -59
  95. package/dist/chunks/websocket.d.ts +1 -1
  96. package/dist/chunks/websocket.js +1 -1
  97. package/dist/host-bridge.d.ts +54 -0
  98. package/dist/host-bridge.js +322 -0
  99. package/dist/http.d.ts +3 -3
  100. package/dist/index.d.ts +74 -191
  101. package/dist/index.js +2032 -1186
  102. package/dist/protocol/dist/board-constants.d.ts +1 -29
  103. package/dist/protocol/dist/board-constants.js +2 -115
  104. package/dist/protocol/dist/board-layout.d.ts +59 -0
  105. package/dist/protocol/dist/board-layout.js +482 -0
  106. package/dist/protocol/dist/board-model.d.ts +2052 -0
  107. package/dist/protocol/dist/board-model.js +592 -0
  108. package/dist/protocol/dist/board-patch.d.ts +86 -0
  109. package/dist/protocol/dist/board-patch.js +734 -0
  110. package/dist/protocol/dist/board-schema.d.ts +33 -0
  111. package/dist/protocol/dist/board-schema.js +59 -0
  112. package/dist/protocol/dist/board-upgrade.d.ts +1 -0
  113. package/dist/protocol/dist/board-url.d.ts +1 -3
  114. package/dist/protocol/dist/board-url.js +2 -2
  115. package/dist/protocol/dist/board.d.ts +37 -232
  116. package/dist/protocol/dist/board.js +62 -160
  117. package/dist/protocol/dist/display/actions.d.ts +1 -0
  118. package/dist/protocol/dist/display/index.d.ts +2 -0
  119. package/dist/protocol/dist/index.d.ts +11 -12
  120. package/dist/protocol/dist/model/metrics.d.ts +2 -0
  121. package/dist/protocol/dist/model/session.d.ts +2 -1
  122. package/dist/protocol/dist/realtime/types.d.ts +2 -2
  123. package/dist/protocol/dist/runtime/index.d.ts +1 -0
  124. package/dist/space-picker.d.ts +1 -0
  125. package/dist/space-picker.js +1 -0
  126. package/dist/types.d.ts +2 -5
  127. package/package.json +9 -1
  128. package/dist/board/core/connections.d.ts +0 -108
  129. package/dist/board/core/connections.js +0 -455
  130. package/dist/board/mutation.d.ts +0 -6
  131. package/dist/board/mutation.js +0 -14
  132. package/dist/board/render/connection-layer.d.ts +0 -53
  133. package/dist/board/render/connection-layer.js +0 -375
  134. package/dist/board/render/renderers/geo-card-renderer.d.ts +0 -5
  135. package/dist/board/render/renderers/geo-card-renderer.js +0 -127
  136. package/dist/board/semantic-document.d.ts +0 -37
  137. package/dist/board/semantic-document.js +0 -288
  138. package/dist/board/semantic-mutation.d.ts +0 -10
  139. package/dist/board/semantic-mutation.js +0 -209
  140. package/dist/protocol/dist/board-animation.js +0 -34
  141. package/dist/protocol/dist/board-authoring.d.ts +0 -1326
  142. package/dist/protocol/dist/board-authoring.js +0 -302
  143. package/dist/protocol/dist/board-capability-registry.d.ts +0 -2
  144. package/dist/protocol/dist/board-capability-registry.js +0 -123
  145. package/dist/protocol/dist/board-codec.d.ts +0 -3
  146. package/dist/protocol/dist/board-codec.js +0 -383
  147. package/dist/protocol/dist/board-composition.d.ts +0 -383
  148. package/dist/protocol/dist/board-composition.js +0 -310
  149. package/dist/protocol/dist/board-connection.d.ts +0 -317
  150. package/dist/protocol/dist/board-connection.js +0 -219
  151. package/dist/protocol/dist/board-document.d.ts +0 -1566
  152. package/dist/protocol/dist/board-document.js +0 -456
  153. package/dist/protocol/dist/board-effect.d.ts +0 -96
  154. package/dist/protocol/dist/board-effect.js +0 -54
  155. package/dist/protocol/dist/board-geometry.d.ts +0 -15
  156. package/dist/protocol/dist/board-geometry.js +0 -137
  157. package/dist/protocol/dist/board-node.d.ts +0 -8
  158. package/dist/protocol/dist/board-node.js +0 -252
  159. /package/dist/protocol/dist/{board-animation.d.ts → host-bridge.d.ts} +0 -0
@@ -1,383 +0,0 @@
1
- import { z } from "zod";
2
- //#region ../protocol/dist/board-composition.d.ts
3
- declare const BoardEasingSchema: z.ZodEnum<{
4
- "ease-in-cubic": "ease-in-cubic";
5
- "ease-in-out-cubic": "ease-in-out-cubic";
6
- "ease-in-out-quad": "ease-in-out-quad";
7
- "ease-in-quad": "ease-in-quad";
8
- "ease-out-cubic": "ease-out-cubic";
9
- "ease-out-expo": "ease-out-expo";
10
- "ease-out-quad": "ease-out-quad";
11
- "ease-out-quart": "ease-out-quart";
12
- linear: "linear";
13
- }>;
14
- type BoardEasing = z.infer<typeof BoardEasingSchema>;
15
- declare const BoardAnimationTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
- type: z.ZodLiteral<"item">;
17
- itemId: z.ZodString;
18
- }, z.core.$strict>, z.ZodObject<{
19
- type: z.ZodLiteral<"effect">;
20
- effectId: z.ZodString;
21
- }, z.core.$strict>, z.ZodObject<{
22
- type: z.ZodLiteral<"camera">;
23
- }, z.core.$strict>, z.ZodObject<{
24
- type: z.ZodLiteral<"board">;
25
- }, z.core.$strict>], "type">;
26
- type BoardAnimationTarget = z.infer<typeof BoardAnimationTargetSchema>;
27
- type BoardTrackInterpolation = "linear" | "step";
28
- declare const BoardTrackSchema: z.ZodObject<{
29
- id: z.ZodString;
30
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
31
- type: z.ZodLiteral<"item">;
32
- itemId: z.ZodString;
33
- }, z.core.$strict>, z.ZodObject<{
34
- type: z.ZodLiteral<"effect">;
35
- effectId: z.ZodString;
36
- }, z.core.$strict>, z.ZodObject<{
37
- type: z.ZodLiteral<"camera">;
38
- }, z.core.$strict>, z.ZodObject<{
39
- type: z.ZodLiteral<"board">;
40
- }, z.core.$strict>], "type">;
41
- channel: z.ZodString;
42
- channelVersion: z.ZodDefault<z.ZodNumber>;
43
- interpolation: z.ZodDefault<z.ZodEnum<{
44
- linear: "linear";
45
- step: "step";
46
- }>>;
47
- fill: z.ZodDefault<z.ZodEnum<{
48
- backwards: "backwards";
49
- both: "both";
50
- forwards: "forwards";
51
- none: "none";
52
- }>>;
53
- keyframes: z.ZodArray<z.ZodObject<{
54
- time: z.ZodNumber;
55
- value: z.ZodUnknown;
56
- easing: z.ZodOptional<z.ZodEnum<{
57
- "ease-in-cubic": "ease-in-cubic";
58
- "ease-in-out-cubic": "ease-in-out-cubic";
59
- "ease-in-out-quad": "ease-in-out-quad";
60
- "ease-in-quad": "ease-in-quad";
61
- "ease-out-cubic": "ease-out-cubic";
62
- "ease-out-expo": "ease-out-expo";
63
- "ease-out-quad": "ease-out-quad";
64
- "ease-out-quart": "ease-out-quart";
65
- linear: "linear";
66
- }>>;
67
- }, z.core.$strict>>;
68
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
69
- }, z.core.$strict>;
70
- type BoardTrack = z.infer<typeof BoardTrackSchema>;
71
- declare const BoardProceduralClipSchema: z.ZodObject<{
72
- id: z.ZodString;
73
- kind: z.ZodString;
74
- kindVersion: z.ZodNumber;
75
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
76
- type: z.ZodLiteral<"item">;
77
- itemId: z.ZodString;
78
- }, z.core.$strict>, z.ZodObject<{
79
- type: z.ZodLiteral<"effect">;
80
- effectId: z.ZodString;
81
- }, z.core.$strict>, z.ZodObject<{
82
- type: z.ZodLiteral<"camera">;
83
- }, z.core.$strict>, z.ZodObject<{
84
- type: z.ZodLiteral<"board">;
85
- }, z.core.$strict>], "type">;
86
- start: z.ZodNumber;
87
- duration: z.ZodNumber;
88
- layer: z.ZodDefault<z.ZodEnum<{
89
- behind: "behind";
90
- content: "content";
91
- front: "front";
92
- screen: "screen";
93
- }>>;
94
- fill: z.ZodDefault<z.ZodEnum<{
95
- backwards: "backwards";
96
- both: "both";
97
- forwards: "forwards";
98
- none: "none";
99
- }>>;
100
- easing: z.ZodDefault<z.ZodEnum<{
101
- "ease-in-cubic": "ease-in-cubic";
102
- "ease-in-out-cubic": "ease-in-out-cubic";
103
- "ease-in-out-quad": "ease-in-out-quad";
104
- "ease-in-quad": "ease-in-quad";
105
- "ease-out-cubic": "ease-out-cubic";
106
- "ease-out-expo": "ease-out-expo";
107
- "ease-out-quad": "ease-out-quad";
108
- "ease-out-quart": "ease-out-quart";
109
- linear: "linear";
110
- }>>;
111
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
112
- assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
113
- type: z.ZodEnum<{
114
- extension: "extension";
115
- "space-file": "space-file";
116
- }>;
117
- ref: z.ZodString;
118
- digest: z.ZodOptional<z.ZodString>;
119
- }, z.core.$strict>>>;
120
- seed: z.ZodString;
121
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
122
- }, z.core.$strict>;
123
- type BoardProceduralClip = z.infer<typeof BoardProceduralClipSchema>;
124
- declare const BoardTimelineMarkerSchema: z.ZodObject<{
125
- id: z.ZodString;
126
- time: z.ZodNumber;
127
- duration: z.ZodOptional<z.ZodNumber>;
128
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
129
- }, z.core.$strict>;
130
- type BoardTimelineMarker = z.infer<typeof BoardTimelineMarkerSchema>;
131
- declare const BoardCompositionInputSchema: z.ZodObject<{
132
- id: z.ZodString;
133
- name: z.ZodString;
134
- timeline: z.ZodObject<{
135
- duration: z.ZodNumber;
136
- tracks: z.ZodDefault<z.ZodArray<z.ZodObject<{
137
- id: z.ZodString;
138
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
139
- type: z.ZodLiteral<"item">;
140
- itemId: z.ZodString;
141
- }, z.core.$strict>, z.ZodObject<{
142
- type: z.ZodLiteral<"effect">;
143
- effectId: z.ZodString;
144
- }, z.core.$strict>, z.ZodObject<{
145
- type: z.ZodLiteral<"camera">;
146
- }, z.core.$strict>, z.ZodObject<{
147
- type: z.ZodLiteral<"board">;
148
- }, z.core.$strict>], "type">;
149
- channel: z.ZodString;
150
- channelVersion: z.ZodDefault<z.ZodNumber>;
151
- interpolation: z.ZodDefault<z.ZodEnum<{
152
- linear: "linear";
153
- step: "step";
154
- }>>;
155
- fill: z.ZodDefault<z.ZodEnum<{
156
- backwards: "backwards";
157
- both: "both";
158
- forwards: "forwards";
159
- none: "none";
160
- }>>;
161
- keyframes: z.ZodArray<z.ZodObject<{
162
- time: z.ZodNumber;
163
- value: z.ZodUnknown;
164
- easing: z.ZodOptional<z.ZodEnum<{
165
- "ease-in-cubic": "ease-in-cubic";
166
- "ease-in-out-cubic": "ease-in-out-cubic";
167
- "ease-in-out-quad": "ease-in-out-quad";
168
- "ease-in-quad": "ease-in-quad";
169
- "ease-out-cubic": "ease-out-cubic";
170
- "ease-out-expo": "ease-out-expo";
171
- "ease-out-quad": "ease-out-quad";
172
- "ease-out-quart": "ease-out-quart";
173
- linear: "linear";
174
- }>>;
175
- }, z.core.$strict>>;
176
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
177
- }, z.core.$strict>>>;
178
- clips: z.ZodDefault<z.ZodArray<z.ZodObject<{
179
- id: z.ZodString;
180
- kind: z.ZodString;
181
- kindVersion: z.ZodNumber;
182
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
183
- type: z.ZodLiteral<"item">;
184
- itemId: z.ZodString;
185
- }, z.core.$strict>, z.ZodObject<{
186
- type: z.ZodLiteral<"effect">;
187
- effectId: z.ZodString;
188
- }, z.core.$strict>, z.ZodObject<{
189
- type: z.ZodLiteral<"camera">;
190
- }, z.core.$strict>, z.ZodObject<{
191
- type: z.ZodLiteral<"board">;
192
- }, z.core.$strict>], "type">;
193
- start: z.ZodNumber;
194
- duration: z.ZodNumber;
195
- layer: z.ZodDefault<z.ZodEnum<{
196
- behind: "behind";
197
- content: "content";
198
- front: "front";
199
- screen: "screen";
200
- }>>;
201
- fill: z.ZodDefault<z.ZodEnum<{
202
- backwards: "backwards";
203
- both: "both";
204
- forwards: "forwards";
205
- none: "none";
206
- }>>;
207
- easing: z.ZodDefault<z.ZodEnum<{
208
- "ease-in-cubic": "ease-in-cubic";
209
- "ease-in-out-cubic": "ease-in-out-cubic";
210
- "ease-in-out-quad": "ease-in-out-quad";
211
- "ease-in-quad": "ease-in-quad";
212
- "ease-out-cubic": "ease-out-cubic";
213
- "ease-out-expo": "ease-out-expo";
214
- "ease-out-quad": "ease-out-quad";
215
- "ease-out-quart": "ease-out-quart";
216
- linear: "linear";
217
- }>>;
218
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
219
- assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
220
- type: z.ZodEnum<{
221
- extension: "extension";
222
- "space-file": "space-file";
223
- }>;
224
- ref: z.ZodString;
225
- digest: z.ZodOptional<z.ZodString>;
226
- }, z.core.$strict>>>;
227
- seed: z.ZodString;
228
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
229
- }, z.core.$strict>>>;
230
- markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
231
- id: z.ZodString;
232
- time: z.ZodNumber;
233
- duration: z.ZodOptional<z.ZodNumber>;
234
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
235
- }, z.core.$strict>>>;
236
- }, z.core.$strict>;
237
- playback: z.ZodDefault<z.ZodObject<{
238
- loop: z.ZodDefault<z.ZodBoolean>;
239
- endBehavior: z.ZodDefault<z.ZodEnum<{
240
- hold: "hold";
241
- reset: "reset";
242
- }>>;
243
- reducedMotion: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
244
- mode: z.ZodLiteral<"base">;
245
- }, z.core.$strict>, z.ZodObject<{
246
- mode: z.ZodLiteral<"time">;
247
- time: z.ZodNumber;
248
- }, z.core.$strict>, z.ZodObject<{
249
- mode: z.ZodLiteral<"marker">;
250
- markerId: z.ZodString;
251
- }, z.core.$strict>], "mode">>;
252
- }, z.core.$strict>>;
253
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
254
- }, z.core.$strict>;
255
- type BoardCompositionInput = z.infer<typeof BoardCompositionInputSchema>;
256
- declare const BoardCompositionSchema: z.ZodObject<{
257
- id: z.ZodString;
258
- name: z.ZodString;
259
- timeline: z.ZodObject<{
260
- duration: z.ZodNumber;
261
- tracks: z.ZodDefault<z.ZodArray<z.ZodObject<{
262
- id: z.ZodString;
263
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
264
- type: z.ZodLiteral<"item">;
265
- itemId: z.ZodString;
266
- }, z.core.$strict>, z.ZodObject<{
267
- type: z.ZodLiteral<"effect">;
268
- effectId: z.ZodString;
269
- }, z.core.$strict>, z.ZodObject<{
270
- type: z.ZodLiteral<"camera">;
271
- }, z.core.$strict>, z.ZodObject<{
272
- type: z.ZodLiteral<"board">;
273
- }, z.core.$strict>], "type">;
274
- channel: z.ZodString;
275
- channelVersion: z.ZodDefault<z.ZodNumber>;
276
- interpolation: z.ZodDefault<z.ZodEnum<{
277
- linear: "linear";
278
- step: "step";
279
- }>>;
280
- fill: z.ZodDefault<z.ZodEnum<{
281
- backwards: "backwards";
282
- both: "both";
283
- forwards: "forwards";
284
- none: "none";
285
- }>>;
286
- keyframes: z.ZodArray<z.ZodObject<{
287
- time: z.ZodNumber;
288
- value: z.ZodUnknown;
289
- easing: z.ZodOptional<z.ZodEnum<{
290
- "ease-in-cubic": "ease-in-cubic";
291
- "ease-in-out-cubic": "ease-in-out-cubic";
292
- "ease-in-out-quad": "ease-in-out-quad";
293
- "ease-in-quad": "ease-in-quad";
294
- "ease-out-cubic": "ease-out-cubic";
295
- "ease-out-expo": "ease-out-expo";
296
- "ease-out-quad": "ease-out-quad";
297
- "ease-out-quart": "ease-out-quart";
298
- linear: "linear";
299
- }>>;
300
- }, z.core.$strict>>;
301
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
302
- }, z.core.$strict>>>;
303
- clips: z.ZodDefault<z.ZodArray<z.ZodObject<{
304
- id: z.ZodString;
305
- kind: z.ZodString;
306
- kindVersion: z.ZodNumber;
307
- target: z.ZodDiscriminatedUnion<[z.ZodObject<{
308
- type: z.ZodLiteral<"item">;
309
- itemId: z.ZodString;
310
- }, z.core.$strict>, z.ZodObject<{
311
- type: z.ZodLiteral<"effect">;
312
- effectId: z.ZodString;
313
- }, z.core.$strict>, z.ZodObject<{
314
- type: z.ZodLiteral<"camera">;
315
- }, z.core.$strict>, z.ZodObject<{
316
- type: z.ZodLiteral<"board">;
317
- }, z.core.$strict>], "type">;
318
- start: z.ZodNumber;
319
- duration: z.ZodNumber;
320
- layer: z.ZodDefault<z.ZodEnum<{
321
- behind: "behind";
322
- content: "content";
323
- front: "front";
324
- screen: "screen";
325
- }>>;
326
- fill: z.ZodDefault<z.ZodEnum<{
327
- backwards: "backwards";
328
- both: "both";
329
- forwards: "forwards";
330
- none: "none";
331
- }>>;
332
- easing: z.ZodDefault<z.ZodEnum<{
333
- "ease-in-cubic": "ease-in-cubic";
334
- "ease-in-out-cubic": "ease-in-out-cubic";
335
- "ease-in-out-quad": "ease-in-out-quad";
336
- "ease-in-quad": "ease-in-quad";
337
- "ease-out-cubic": "ease-out-cubic";
338
- "ease-out-expo": "ease-out-expo";
339
- "ease-out-quad": "ease-out-quad";
340
- "ease-out-quart": "ease-out-quart";
341
- linear: "linear";
342
- }>>;
343
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
344
- assetRefs: z.ZodDefault<z.ZodArray<z.ZodObject<{
345
- type: z.ZodEnum<{
346
- extension: "extension";
347
- "space-file": "space-file";
348
- }>;
349
- ref: z.ZodString;
350
- digest: z.ZodOptional<z.ZodString>;
351
- }, z.core.$strict>>>;
352
- seed: z.ZodString;
353
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
354
- }, z.core.$strict>>>;
355
- markers: z.ZodDefault<z.ZodArray<z.ZodObject<{
356
- id: z.ZodString;
357
- time: z.ZodNumber;
358
- duration: z.ZodOptional<z.ZodNumber>;
359
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
360
- }, z.core.$strict>>>;
361
- }, z.core.$strict>;
362
- playback: z.ZodDefault<z.ZodObject<{
363
- loop: z.ZodDefault<z.ZodBoolean>;
364
- endBehavior: z.ZodDefault<z.ZodEnum<{
365
- hold: "hold";
366
- reset: "reset";
367
- }>>;
368
- reducedMotion: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
369
- mode: z.ZodLiteral<"base">;
370
- }, z.core.$strict>, z.ZodObject<{
371
- mode: z.ZodLiteral<"time">;
372
- time: z.ZodNumber;
373
- }, z.core.$strict>, z.ZodObject<{
374
- mode: z.ZodLiteral<"marker">;
375
- markerId: z.ZodString;
376
- }, z.core.$strict>], "mode">>;
377
- }, z.core.$strict>>;
378
- metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
379
- revision: z.ZodDefault<z.ZodNumber>;
380
- }, z.core.$strict>;
381
- type BoardComposition = z.infer<typeof BoardCompositionSchema>;
382
- //#endregion
383
- export { BoardAnimationTarget, BoardAnimationTargetSchema, BoardComposition, BoardCompositionInput, BoardCompositionInputSchema, BoardCompositionSchema, BoardEasing, BoardEasingSchema, BoardProceduralClip, BoardProceduralClipSchema, BoardTimelineMarker, BoardTimelineMarkerSchema, BoardTrack, BoardTrackInterpolation, BoardTrackSchema };
@@ -1,310 +0,0 @@
1
- import { z } from "zod";
2
- //#region ../protocol/dist/board-composition.js
3
- const idSchema = z.string().min(1).max(160);
4
- const finiteSchema = z.number().finite();
5
- const jsonObjectSchema = z.record(z.string(), z.unknown());
6
- const BOARD_EASINGS = [
7
- "linear",
8
- "ease-in-quad",
9
- "ease-out-quad",
10
- "ease-in-out-quad",
11
- "ease-in-cubic",
12
- "ease-out-cubic",
13
- "ease-in-out-cubic",
14
- "ease-out-quart",
15
- "ease-out-expo"
16
- ];
17
- const BoardEasingSchema = z.enum(BOARD_EASINGS);
18
- const BoardAnimationTargetSchema = z.discriminatedUnion("type", [
19
- z.object({
20
- type: z.literal("item"),
21
- itemId: idSchema
22
- }).strict(),
23
- z.object({
24
- type: z.literal("effect"),
25
- effectId: idSchema
26
- }).strict(),
27
- z.object({ type: z.literal("camera") }).strict(),
28
- z.object({ type: z.literal("board") }).strict()
29
- ]);
30
- const vector2Schema = z.object({
31
- x: finiteSchema,
32
- y: finiteSchema
33
- }).strict();
34
- const scaleSchema = z.union([finiteSchema.nonnegative(), z.object({
35
- x: finiteSchema.nonnegative(),
36
- y: finiteSchema.nonnegative()
37
- }).strict()]);
38
- const BOARD_ANIMATION_CHANNELS = {
39
- "transform.translation": {
40
- targets: ["item"],
41
- value: vector2Schema,
42
- interpolations: ["linear", "step"],
43
- coordinateSpace: "world-offset",
44
- unit: "board"
45
- },
46
- "transform.rotation": {
47
- targets: ["item"],
48
- value: finiteSchema,
49
- interpolations: ["linear", "step"],
50
- unit: "radian"
51
- },
52
- "transform.scale": {
53
- targets: ["item"],
54
- value: scaleSchema,
55
- interpolations: ["linear", "step"],
56
- unit: "ratio"
57
- },
58
- "style.opacity": {
59
- targets: ["item"],
60
- value: finiteSchema.min(0).max(1),
61
- interpolations: ["linear", "step"],
62
- unit: "ratio"
63
- }
64
- };
65
- const BoardTrackKeyframeSchema = z.object({
66
- time: finiteSchema.nonnegative(),
67
- value: z.unknown(),
68
- easing: BoardEasingSchema.optional()
69
- }).strict();
70
- const BoardTrackSchema = z.object({
71
- id: idSchema,
72
- target: BoardAnimationTargetSchema,
73
- channel: z.string().min(1).max(160),
74
- channelVersion: z.number().int().positive().default(1),
75
- interpolation: z.enum(["linear", "step"]).default("linear"),
76
- fill: z.enum([
77
- "none",
78
- "backwards",
79
- "forwards",
80
- "both"
81
- ]).default("none"),
82
- keyframes: z.array(BoardTrackKeyframeSchema).min(1).max(1e5),
83
- metadata: jsonObjectSchema.default({})
84
- }).strict().superRefine((track, context) => {
85
- let previous = -1;
86
- for (const [index, keyframe] of track.keyframes.entries()) {
87
- if (keyframe.time <= previous) context.addIssue({
88
- code: "custom",
89
- message: "keyframe times must be strictly increasing",
90
- path: [
91
- "keyframes",
92
- index,
93
- "time"
94
- ]
95
- });
96
- previous = keyframe.time;
97
- }
98
- const channel = BOARD_ANIMATION_CHANNELS[track.channel];
99
- if (!channel) {
100
- if (!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){2,}$/.test(track.channel)) context.addIssue({
101
- code: "custom",
102
- message: `unknown channel: ${track.channel}`,
103
- path: ["channel"]
104
- });
105
- return;
106
- }
107
- if (!channel.targets.includes(track.target.type)) context.addIssue({
108
- code: "custom",
109
- message: `${track.channel} cannot target ${track.target.type}`,
110
- path: ["target"]
111
- });
112
- if (!channel.interpolations.includes(track.interpolation)) context.addIssue({
113
- code: "custom",
114
- message: `${track.channel} does not support ${track.interpolation} interpolation`,
115
- path: ["interpolation"]
116
- });
117
- for (const [index, keyframe] of track.keyframes.entries()) {
118
- const parsed = channel.value.safeParse(keyframe.value);
119
- if (!parsed.success) context.addIssue({
120
- code: "custom",
121
- message: parsed.error.issues[0]?.message ?? `invalid value for ${track.channel}`,
122
- path: [
123
- "keyframes",
124
- index,
125
- "value"
126
- ]
127
- });
128
- }
129
- });
130
- const extensionKindSchema = z.string().regex(/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)+$/).max(160);
131
- const BoardProceduralClipSchema = z.object({
132
- id: idSchema,
133
- kind: extensionKindSchema,
134
- kindVersion: z.number().int().positive(),
135
- target: BoardAnimationTargetSchema,
136
- start: finiteSchema.nonnegative(),
137
- duration: finiteSchema.positive(),
138
- layer: z.enum([
139
- "behind",
140
- "content",
141
- "front",
142
- "screen"
143
- ]).default("content"),
144
- fill: z.enum([
145
- "none",
146
- "backwards",
147
- "forwards",
148
- "both"
149
- ]).default("none"),
150
- easing: BoardEasingSchema.default("linear"),
151
- params: jsonObjectSchema.default({}),
152
- assetRefs: z.array(z.object({
153
- type: z.enum(["space-file", "extension"]),
154
- ref: z.string().min(1).max(4096),
155
- digest: z.string().min(16).max(160).optional()
156
- }).strict()).default([]),
157
- seed: idSchema,
158
- metadata: jsonObjectSchema.default({})
159
- }).strict();
160
- const BoardTimelineMarkerSchema = z.object({
161
- id: idSchema,
162
- time: finiteSchema.nonnegative(),
163
- duration: finiteSchema.nonnegative().optional(),
164
- metadata: jsonObjectSchema.default({})
165
- }).strict();
166
- const BoardTimelineSchema = z.object({
167
- duration: finiteSchema.nonnegative(),
168
- tracks: z.array(BoardTrackSchema).max(5e4).default([]),
169
- clips: z.array(BoardProceduralClipSchema).max(5e4).default([]),
170
- markers: z.array(BoardTimelineMarkerSchema).max(1e4).default([])
171
- }).strict().superRefine((timeline, context) => {
172
- const ids = /* @__PURE__ */ new Set();
173
- const channels = /* @__PURE__ */ new Set();
174
- for (const [index, track] of timeline.tracks.entries()) {
175
- if (ids.has(track.id)) context.addIssue({
176
- code: "custom",
177
- message: `duplicate timeline id: ${track.id}`,
178
- path: [
179
- "tracks",
180
- index,
181
- "id"
182
- ]
183
- });
184
- ids.add(track.id);
185
- const targetId = track.target.type === "item" ? track.target.itemId : track.target.type === "effect" ? track.target.effectId : track.target.type;
186
- const key = `${track.target.type}:${targetId}:${track.channel}`;
187
- if (channels.has(key)) context.addIssue({
188
- code: "custom",
189
- message: `multiple tracks control ${key}`,
190
- path: [
191
- "tracks",
192
- index,
193
- "channel"
194
- ]
195
- });
196
- channels.add(key);
197
- for (const [keyframeIndex, keyframe] of track.keyframes.entries()) if (keyframe.time > timeline.duration) context.addIssue({
198
- code: "custom",
199
- message: "keyframe exceeds timeline duration",
200
- path: [
201
- "tracks",
202
- index,
203
- "keyframes",
204
- keyframeIndex,
205
- "time"
206
- ]
207
- });
208
- }
209
- for (const [index, clip] of timeline.clips.entries()) {
210
- if (ids.has(clip.id)) context.addIssue({
211
- code: "custom",
212
- message: `duplicate timeline id: ${clip.id}`,
213
- path: [
214
- "clips",
215
- index,
216
- "id"
217
- ]
218
- });
219
- ids.add(clip.id);
220
- if (clip.start + clip.duration > timeline.duration) context.addIssue({
221
- code: "custom",
222
- message: "clip exceeds timeline duration",
223
- path: [
224
- "clips",
225
- index,
226
- "duration"
227
- ]
228
- });
229
- }
230
- for (const [index, marker] of timeline.markers.entries()) {
231
- if (ids.has(marker.id)) context.addIssue({
232
- code: "custom",
233
- message: `duplicate timeline id: ${marker.id}`,
234
- path: [
235
- "markers",
236
- index,
237
- "id"
238
- ]
239
- });
240
- ids.add(marker.id);
241
- if (marker.time + (marker.duration ?? 0) > timeline.duration) context.addIssue({
242
- code: "custom",
243
- message: "marker exceeds timeline duration",
244
- path: ["markers", index]
245
- });
246
- }
247
- });
248
- const BoardCompositionPlaybackSchema = z.object({
249
- loop: z.boolean().default(false),
250
- endBehavior: z.enum(["hold", "reset"]).default("hold"),
251
- reducedMotion: z.discriminatedUnion("mode", [
252
- z.object({ mode: z.literal("base") }).strict(),
253
- z.object({
254
- mode: z.literal("time"),
255
- time: finiteSchema.nonnegative()
256
- }).strict(),
257
- z.object({
258
- mode: z.literal("marker"),
259
- markerId: idSchema
260
- }).strict()
261
- ]).default({ mode: "base" })
262
- }).strict();
263
- const compositionFields = {
264
- id: idSchema,
265
- name: z.string().min(1).max(255),
266
- timeline: BoardTimelineSchema,
267
- playback: BoardCompositionPlaybackSchema.default({
268
- loop: false,
269
- endBehavior: "hold",
270
- reducedMotion: { mode: "base" }
271
- }),
272
- metadata: jsonObjectSchema.default({})
273
- };
274
- function validateCompositionFallback(composition, context) {
275
- const fallback = composition.playback.reducedMotion;
276
- if (fallback.mode === "time" && fallback.time > composition.timeline.duration) context.addIssue({
277
- code: "custom",
278
- message: "reduced-motion time exceeds timeline duration",
279
- path: [
280
- "playback",
281
- "reducedMotion",
282
- "time"
283
- ]
284
- });
285
- if (fallback.mode === "marker" && !composition.timeline.markers.some((marker) => marker.id === fallback.markerId)) context.addIssue({
286
- code: "custom",
287
- message: `marker does not exist: ${fallback.markerId}`,
288
- path: [
289
- "playback",
290
- "reducedMotion",
291
- "markerId"
292
- ]
293
- });
294
- }
295
- const BoardCompositionInputSchema = z.object(compositionFields).strict().superRefine(validateCompositionFallback);
296
- const BoardCompositionSchema = z.object({
297
- ...compositionFields,
298
- revision: z.number().int().nonnegative().default(0)
299
- }).strict().superRefine(validateCompositionFallback);
300
- Object.entries(BOARD_ANIMATION_CHANNELS).map(([id, definition]) => ({
301
- id,
302
- version: 1,
303
- targets: definition.targets,
304
- interpolations: definition.interpolations,
305
- ..."coordinateSpace" in definition ? { coordinateSpace: definition.coordinateSpace } : {},
306
- ..."unit" in definition ? { unit: definition.unit } : {},
307
- valueSchema: z.toJSONSchema(definition.value)
308
- }));
309
- //#endregion
310
- export { BOARD_ANIMATION_CHANNELS, BOARD_EASINGS, BoardAnimationTargetSchema, BoardCompositionInputSchema, BoardCompositionPlaybackSchema, BoardCompositionSchema, BoardEasingSchema, BoardProceduralClipSchema, BoardTimelineMarkerSchema, BoardTimelineSchema, BoardTrackSchema };