@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.
- package/README.md +47 -50
- package/dist/board/animation.d.ts +157 -67
- package/dist/board/animation.js +161 -306
- package/dist/board/core/connections.js +4 -4
- package/dist/board/core/export-plan.js +1 -1
- package/dist/board/core/shape-types.js +0 -1
- package/dist/board/geometry.js +4 -4
- package/dist/board/index.d.ts +8 -7
- package/dist/board/index.js +8 -9
- package/dist/board/mutation.d.ts +2 -17
- package/dist/board/mutation.js +2 -93
- package/dist/board/render/renderers/text-card-renderer.js +1 -1
- package/dist/board/semantic-document.d.ts +30 -0
- package/dist/board/semantic-document.js +271 -0
- package/dist/board/semantic-mutation.d.ts +10 -0
- package/dist/board/semantic-mutation.js +203 -0
- package/dist/chunks/http.d.ts +27 -95
- package/dist/chunks/http.js +628 -1610
- package/dist/chunks/transport.js +1 -1
- package/dist/chunks/websocket.d.ts +3462 -533
- package/dist/chunks/websocket.js +1 -1
- package/dist/http.d.ts +3 -3
- package/dist/index.d.ts +158 -299
- package/dist/index.js +1207 -499
- package/dist/protocol/dist/board-authoring.d.ts +1305 -0
- package/dist/protocol/dist/board-authoring.js +291 -0
- package/dist/protocol/dist/board-capability-registry.d.ts +2 -0
- package/dist/protocol/dist/board-capability-registry.js +74 -0
- package/dist/protocol/dist/board-codec.d.ts +2 -0
- package/dist/protocol/dist/board-codec.js +19 -0
- package/dist/protocol/dist/board-composition.d.ts +383 -0
- package/dist/protocol/dist/board-composition.js +310 -0
- package/dist/protocol/dist/board-connection.d.ts +16 -16
- package/dist/protocol/dist/board-connection.js +16 -16
- package/dist/protocol/dist/board-constants.js +0 -25
- package/dist/protocol/dist/board-document.d.ts +34 -3
- package/dist/protocol/dist/board-document.js +3 -1
- package/dist/protocol/dist/board-effect.d.ts +94 -0
- package/dist/protocol/dist/board-effect.js +53 -0
- package/dist/protocol/dist/board-json.js +16 -0
- package/dist/protocol/dist/board-node.d.ts +1 -12
- package/dist/protocol/dist/board-node.js +1 -81
- package/dist/protocol/dist/board.d.ts +42 -245
- package/dist/protocol/dist/board.js +56 -117
- package/dist/protocol/dist/index.d.ts +9 -4
- package/dist/types.d.ts +4 -1
- package/docs/work-runtime-guide.md +19 -3
- package/package.json +2 -2
- package/dist/board/codec.d.ts +0 -27
- package/dist/board/codec.js +0 -277
- package/dist/board/nodes.d.ts +0 -113
- package/dist/board/nodes.js +0 -154
- package/dist/protocol/dist/board-content.js +0 -26
- package/dist/protocol/dist/identifiers.js +0 -10
- package/dist/protocol/dist/index.js +0 -14
- package/dist/protocol/dist/provenance.js +0 -15
- package/dist/protocol/dist/public-identifiers.js +0 -38
- package/dist/protocol/dist/realtime/board-awareness.js +0 -119
- package/dist/protocol/dist/ui-command.js +0 -2
- package/dist/protocol/dist/work-promotion-stats.js +0 -11
- package/dist/protocol/dist/work-surface.js +0 -2
- package/dist/protocol/dist/work-view-stats.js +0 -3
|
@@ -0,0 +1,383 @@
|
|
|
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 };
|
|
@@ -0,0 +1,310 @@
|
|
|
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.positive(), z.object({
|
|
35
|
+
x: finiteSchema.positive(),
|
|
36
|
+
y: finiteSchema.positive()
|
|
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 };
|