@cueframe/kernel 0.2.57 → 0.2.58
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/THIRD_PARTY_NOTICES.md +111 -0
- package/dist/_members/component-runtime/template/bind.d.ts +22 -0
- package/dist/_members/component-runtime/template/bind.d.ts.map +1 -0
- package/dist/_members/component-runtime/template/extract.d.ts +31 -0
- package/dist/_members/component-runtime/template/extract.d.ts.map +1 -0
- package/dist/_members/component-runtime/template/index.d.ts +5 -0
- package/dist/_members/component-runtime/template/index.d.ts.map +1 -0
- package/dist/_members/component-runtime/template/schema.d.ts +1580 -0
- package/dist/_members/component-runtime/template/schema.d.ts.map +1 -0
- package/dist/_members/component-runtime/template/testing/fixtures.d.ts +33 -0
- package/dist/_members/component-runtime/template/testing/fixtures.d.ts.map +1 -0
- package/dist/_members/component-runtime/template/testing/index.d.ts +3 -0
- package/dist/_members/component-runtime/template/testing/index.d.ts.map +1 -0
- package/dist/_members/component-runtime/template/testing/templateApplyContract.d.ts +54 -0
- package/dist/_members/component-runtime/template/testing/templateApplyContract.d.ts.map +1 -0
- package/dist/_members/composition/primitive-catalog/index.d.ts +2 -1
- package/dist/_members/composition/primitive-catalog/types.d.ts +3 -1
- package/dist/_members/composition/validators/brandKit.d.ts +7 -0
- package/dist/_members/composition/validators/brandKitBody.d.ts +543 -0
- package/dist/_members/errors/registry.d.ts +36 -0
- package/dist/_members/mcp/server.d.ts +5 -2
- package/dist/_members/primitives/backgrounds/dynamic-grid/config.d.ts +1 -1
- package/dist/_members/primitives/effects/blur/config.d.ts +1 -1
- package/dist/_members/primitives/effects/color-grade/config.d.ts +2 -2
- package/dist/_members/primitives/effects/grain/config.d.ts +3 -3
- package/dist/_members/primitives/effects/particles/config.d.ts +2 -2
- package/dist/_members/primitives/effects/stage-camera/config.d.ts +6 -6
- package/dist/_members/primitives/effects/vignette/config.d.ts +1 -1
- package/dist/_members/primitives/layouts/flex-layout/config.d.ts +3 -3
- package/dist/_members/primitives/layouts/picture-in-picture/config.d.ts +2 -2
- package/dist/_members/primitives/lib/types.d.ts +1 -1
- package/dist/_members/primitives/scenes/device-showcase/config.d.ts +7 -7
- package/dist/_members/primitives/text/cinematic-title/config.d.ts +3 -3
- package/dist/_members/primitives/text/karaoke/config.d.ts +1 -1
- package/dist/_members/primitives/text/kinetic-type/config.d.ts +3 -3
- package/dist/_members/primitives/text/stat-counter/config.d.ts +1 -1
- package/dist/_members/primitives/text/text-effect/config.d.ts +2 -2
- package/dist/_members/primitives/transitions/grid-pixelate-wipe/config.d.ts +1 -1
- package/dist/_members/primitives/ui-blocks/badge-pop/config.d.ts +3 -3
- package/dist/_members/primitives/ui-blocks/terminal-simulator/config.d.ts +2 -2
- package/dist/_members/primitives/ui-blocks/toast-notification/config.d.ts +2 -2
- package/dist/authoring/build-tools.js +5 -4
- package/dist/authoring/context.js +2 -1
- package/dist/authoring/tools.js +4 -3
- package/dist/authoring.js +7 -6
- package/dist/{chunk-R7G2PNEZ.js → chunk-2L33CKIY.js} +11 -13
- package/dist/{chunk-N54EGUVM.js → chunk-3VLDQE26.js} +1 -1
- package/dist/{chunk-7AZLFN26.js → chunk-4NIJWK45.js} +20 -12
- package/dist/{chunk-KSRFYFUZ.js → chunk-5T655LYZ.js} +1 -1
- package/dist/{chunk-RERR5JLM.js → chunk-6UZYUWBX.js} +1 -1
- package/dist/{chunk-LBN5KQC6.js → chunk-7EDLPIUN.js} +3 -3
- package/dist/{chunk-MZB4ZXYW.js → chunk-7NIOFHMH.js} +1 -1
- package/dist/{chunk-E63UEO5C.js → chunk-AK5QBHOB.js} +6 -0
- package/dist/{chunk-BDFAA747.js → chunk-GQ6XGAFB.js} +1 -1
- package/dist/chunk-IG3YAOUZ.js +418 -0
- package/dist/{chunk-Z4G3VM3H.js → chunk-JN3GF36B.js} +1 -1
- package/dist/{chunk-DV7ZFVL4.js → chunk-MFMR3LHO.js} +1 -1
- package/dist/{chunk-JPMVNMF3.js → chunk-MNO6AO2J.js} +1 -1
- package/dist/{chunk-VXGA7LQQ.js → chunk-NVXSKKRN.js} +2 -2
- package/dist/chunk-PWWZTY3G.js +254 -0
- package/dist/chunk-REST55RC.js +366 -0
- package/dist/chunk-TR53N6HB.js +196 -0
- package/dist/{chunk-4PV3UYJF.js → chunk-UXRSEMJJ.js} +201 -201
- package/dist/component-runtime/template/testing.d.ts +1 -0
- package/dist/component-runtime/template/testing.js +380 -0
- package/dist/component-runtime/template.d.ts +1 -0
- package/dist/component-runtime/template.js +99 -0
- package/dist/compose.js +20 -20
- package/dist/composition/floors.js +1 -1
- package/dist/composition/ops.js +2 -1
- package/dist/composition/primitive-catalog.js +3 -1
- package/dist/composition/projection.js +2 -2
- package/dist/composition/validators/brand-kit-body.d.ts +1 -0
- package/dist/composition/validators/brand-kit-body.js +17 -0
- package/dist/composition/validators.js +10 -6
- package/dist/composition-ops.js +7 -6
- package/dist/composition.js +12 -8
- package/dist/{context-6HPUO36M.js → context-4WSFPRLX.js} +2 -1
- package/dist/core/render.js +4 -4
- package/dist/core/select.js +2 -2
- package/dist/core.js +4 -4
- package/dist/director/ai-sdk.js +3 -3
- package/dist/director/domain.js +2 -2
- package/dist/director.js +3 -3
- package/dist/errors.js +1 -1
- package/dist/mcp/adapter.js +3 -3
- package/dist/mcp/server.js +3 -26
- package/dist/mcp.js +3 -26
- package/dist/nle-export.js +1 -1
- package/dist/primitives/captions.js +3 -3
- package/dist/primitives.js +18 -18
- package/dist/render-harness/cardAssetAdmission.js +2 -2
- package/dist/render-harness/cardFonts.js +2 -2
- package/dist/render-harness/renderInputAssets.js +2 -2
- package/dist/render-harness.js +8 -8
- package/dist/src-ZP6727AA.js +70 -0
- package/package.json +22 -10
- package/dist/chunk-AXRSCHQX.js +0 -661
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bindTemplate,
|
|
3
|
+
findReferences,
|
|
4
|
+
parseTemplateDocument
|
|
5
|
+
} from "../../chunk-REST55RC.js";
|
|
6
|
+
import "../../chunk-TR53N6HB.js";
|
|
7
|
+
import {
|
|
8
|
+
CANVAS2D_COMPONENT_MANIFEST_V2
|
|
9
|
+
} from "../../chunk-EC6VFQE6.js";
|
|
10
|
+
import "../../chunk-IG3YAOUZ.js";
|
|
11
|
+
import "../../chunk-PWWZTY3G.js";
|
|
12
|
+
import "../../chunk-UFD4EZHM.js";
|
|
13
|
+
import "../../chunk-WPZKOVYF.js";
|
|
14
|
+
import "../../chunk-B7J5UUUV.js";
|
|
15
|
+
import {
|
|
16
|
+
CURRENT_MATTE_BAKE_VERSION
|
|
17
|
+
} from "../../chunk-7NIOFHMH.js";
|
|
18
|
+
import "../../chunk-DKBFAQCW.js";
|
|
19
|
+
import "../../chunk-WREYUH2E.js";
|
|
20
|
+
import "../../chunk-ILO4NEZ3.js";
|
|
21
|
+
import "../../chunk-AK5QBHOB.js";
|
|
22
|
+
import "../../chunk-VG2ND6PX.js";
|
|
23
|
+
import {
|
|
24
|
+
parseSceneShotSpecV2
|
|
25
|
+
} from "../../chunk-CL5Y6V6K.js";
|
|
26
|
+
import "../../chunk-2L7PYYJK.js";
|
|
27
|
+
import "../../chunk-OOL7ZUG7.js";
|
|
28
|
+
import "../../chunk-2ESYSVXG.js";
|
|
29
|
+
|
|
30
|
+
// ../execution/component-runtime/src/template/testing/fixtures.ts
|
|
31
|
+
function minimalTemplate() {
|
|
32
|
+
return {
|
|
33
|
+
v: 1,
|
|
34
|
+
slug: "warp",
|
|
35
|
+
name: "Warp",
|
|
36
|
+
composition: { v: 1, format: { aspectRatio: "16:9", fps: 30, resolution: "fhd" }, tracks: [
|
|
37
|
+
{ id: "video", kind: "video", name: "Source", contents: [
|
|
38
|
+
{
|
|
39
|
+
id: "main",
|
|
40
|
+
kind: "video",
|
|
41
|
+
startTime: 0,
|
|
42
|
+
duration: 8,
|
|
43
|
+
source: { kind: "media", mediaId: "{{source}}", trim: { start: 4, end: 12 }, muted: false }
|
|
44
|
+
}
|
|
45
|
+
] }
|
|
46
|
+
] },
|
|
47
|
+
parameters: [{ name: "source", type: "media", kind: "video", required: true }],
|
|
48
|
+
components: {}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function withComponent(doc, opts = {}) {
|
|
52
|
+
const { slot, slotKind } = opts;
|
|
53
|
+
doc.components.c1 = {
|
|
54
|
+
source: {
|
|
55
|
+
version: 2,
|
|
56
|
+
componentId: "c1",
|
|
57
|
+
tsxSource: "export default () => null;",
|
|
58
|
+
manifest: { ...CANVAS2D_COMPONENT_MANIFEST_V2, assets: slot ? { [slot]: { kind: slotKind ?? "image", required: true } } : {} }
|
|
59
|
+
},
|
|
60
|
+
name: "C1",
|
|
61
|
+
description: "fixture component",
|
|
62
|
+
category: "text",
|
|
63
|
+
propSchema: { type: "object" }
|
|
64
|
+
};
|
|
65
|
+
doc.composition.tracks.push({ id: "comp", kind: "overlay", name: "C", contents: [{
|
|
66
|
+
id: "c",
|
|
67
|
+
kind: "overlay",
|
|
68
|
+
startTime: 0,
|
|
69
|
+
duration: 2,
|
|
70
|
+
source: { kind: "component", componentId: "c1", props: {}, ...slot ? { assets: { [slot]: `{{${slot}}}` } } : {} }
|
|
71
|
+
}] });
|
|
72
|
+
return doc;
|
|
73
|
+
}
|
|
74
|
+
function sceneWithImageSlot(slot) {
|
|
75
|
+
return parseSceneShotSpecV2({
|
|
76
|
+
version: 2,
|
|
77
|
+
referenceSize: { width: 1920, height: 1080 },
|
|
78
|
+
environment: { kind: "photographic-studio-v1" },
|
|
79
|
+
backdrop: { kind: "solid", color: "#000000" },
|
|
80
|
+
layers: [{
|
|
81
|
+
kind: "page",
|
|
82
|
+
id: "p",
|
|
83
|
+
transform: { position: [0, 0, 0], rotation: [0, 0, 0], scale: 1 },
|
|
84
|
+
width: 720,
|
|
85
|
+
height: 900,
|
|
86
|
+
surfaces: { content: { source: "image", assetSlot: slot } }
|
|
87
|
+
}]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
var video = (durationSec = 30) => ({ mediaId: "m1", kind: "video", durationSec });
|
|
91
|
+
var withTrack = (doc, track) => {
|
|
92
|
+
doc.composition.tracks.push(track);
|
|
93
|
+
return doc;
|
|
94
|
+
};
|
|
95
|
+
var overlay = (params) => ({ id: "t", kind: "overlay", name: "T", contents: [{
|
|
96
|
+
id: "o",
|
|
97
|
+
kind: "overlay",
|
|
98
|
+
startTime: 0,
|
|
99
|
+
duration: 2,
|
|
100
|
+
source: { kind: "overlay", primitiveId: "heroText", params }
|
|
101
|
+
}] });
|
|
102
|
+
var withParams = (doc, ...ps) => {
|
|
103
|
+
doc.parameters.push(...ps);
|
|
104
|
+
return doc;
|
|
105
|
+
};
|
|
106
|
+
var TEMPLATE_BINDING_FIXTURES = [
|
|
107
|
+
{
|
|
108
|
+
name: "minimal-video",
|
|
109
|
+
doc: minimalTemplate,
|
|
110
|
+
media: { source: video() },
|
|
111
|
+
expect: { at: [["tracks.0.contents.0.source.mediaId", "m1"]] }
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "text-inline-and-whole-leaf",
|
|
115
|
+
doc: () => withTrack(
|
|
116
|
+
withParams(minimalTemplate(), { name: "title", type: "string", required: true }, { name: "size", type: "number", required: true }),
|
|
117
|
+
overlay({ text: "Hi {{title}}!", fontSizePct: "{{size}}" })
|
|
118
|
+
),
|
|
119
|
+
values: { title: "Sam", size: 27 },
|
|
120
|
+
media: { source: video() },
|
|
121
|
+
expect: { at: [["tracks.1.contents.0.source.params", { text: "Hi Sam!", fontSizePct: 27 }]] }
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "escaped-brace",
|
|
125
|
+
doc: () => withTrack(minimalTemplate(), overlay({ text: "\\{{not a ref}}" })),
|
|
126
|
+
media: { source: video() },
|
|
127
|
+
expect: { at: [["tracks.1.contents.0.source.params.text", "{{not a ref}}"]] }
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "image-swap-strips-trim",
|
|
131
|
+
doc: () => {
|
|
132
|
+
const doc = minimalTemplate();
|
|
133
|
+
doc.parameters[0] = { name: "logo", type: "media", kind: "image", required: true };
|
|
134
|
+
doc.composition.tracks[0] = { id: "img", kind: "image", name: "Logo", contents: [{
|
|
135
|
+
id: "l",
|
|
136
|
+
kind: "image",
|
|
137
|
+
startTime: 0,
|
|
138
|
+
duration: 3,
|
|
139
|
+
fit: "contain",
|
|
140
|
+
source: { kind: "media", mediaId: "{{logo}}", trim: { start: 0, end: 3 }, playbackRate: 1 }
|
|
141
|
+
}] };
|
|
142
|
+
return doc;
|
|
143
|
+
},
|
|
144
|
+
media: { logo: { mediaId: "m2", kind: "image" } },
|
|
145
|
+
expect: { at: [["tracks.0.contents.0.fit", "contain"], ["tracks.0.contents.0.source.trim", void 0], ["tracks.0.contents.0.source.playbackRate", void 0]] }
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "missing-required",
|
|
149
|
+
doc: minimalTemplate,
|
|
150
|
+
media: {},
|
|
151
|
+
expect: { error: { code: "template_values_invalid", fields: [{ param: "source", reason: "required" }] } }
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "kind-mismatch",
|
|
155
|
+
doc: minimalTemplate,
|
|
156
|
+
media: { source: { mediaId: "m1", kind: "image" } },
|
|
157
|
+
expect: { error: { code: "template_media_kind_mismatch" } }
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "short-media",
|
|
161
|
+
doc: minimalTemplate,
|
|
162
|
+
media: { source: video(10) },
|
|
163
|
+
expect: { error: { code: "template_values_invalid", fields: [{ param: "source", reason: "media is 10s, template trims to 12s" }] } }
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "short-media-no-trim",
|
|
167
|
+
doc: () => {
|
|
168
|
+
const doc = minimalTemplate();
|
|
169
|
+
delete doc.composition.tracks[0].contents[0].source.trim;
|
|
170
|
+
return doc;
|
|
171
|
+
},
|
|
172
|
+
media: { source: video(5) },
|
|
173
|
+
expect: { error: { code: "template_values_invalid", fields: [{ param: "source", reason: "media is 5s, clip needs 8s" }] } }
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "asset-slot-image",
|
|
177
|
+
doc: () => withParams(withComponent(minimalTemplate(), { slot: "screen", slotKind: "image" }), { name: "screen", type: "media", kind: "image", required: true }),
|
|
178
|
+
media: { source: video(), screen: { mediaId: "m9", kind: "image" } },
|
|
179
|
+
expect: { at: [["tracks.1.contents.0.source.assets", { screen: "m9" }]] }
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "asset-slot-kind-mismatch",
|
|
183
|
+
doc: () => withParams(withComponent(minimalTemplate(), { slot: "screen", slotKind: "image" }), { name: "screen", type: "media", kind: "image", required: true }),
|
|
184
|
+
media: { source: video(), screen: { mediaId: "m9", kind: "video" } },
|
|
185
|
+
expect: { error: { code: "template_media_kind_mismatch" } }
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "scene-shot-slot",
|
|
189
|
+
doc: () => withTrack(
|
|
190
|
+
withParams(minimalTemplate(), { name: "shot", type: "media", kind: "image", required: true }),
|
|
191
|
+
{ id: "s", kind: "overlay", name: "S", contents: [{
|
|
192
|
+
id: "sc",
|
|
193
|
+
kind: "overlay",
|
|
194
|
+
startTime: 0,
|
|
195
|
+
duration: 4,
|
|
196
|
+
source: { kind: "component", componentId: "scene-x", props: { scene: sceneWithImageSlot("shot") }, assets: { shot: "{{shot}}" } }
|
|
197
|
+
}] }
|
|
198
|
+
),
|
|
199
|
+
media: { source: video(), shot: { mediaId: "m5", kind: "image" } },
|
|
200
|
+
expect: { at: [["tracks.1.contents.0.source.assets", { shot: "m5" }]] }
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "undeclared-reference",
|
|
204
|
+
doc: () => withTrack(minimalTemplate(), overlay({ text: "{{nope}}" })),
|
|
205
|
+
media: { source: video() },
|
|
206
|
+
expect: { error: { code: "template_parameter_undeclared" } }
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "misplaced-reference",
|
|
210
|
+
doc: () => {
|
|
211
|
+
const doc = withParams(minimalTemplate(), { name: "len", type: "number", required: true });
|
|
212
|
+
doc.composition.tracks[0].contents[0].duration = "{{len}}";
|
|
213
|
+
return doc;
|
|
214
|
+
},
|
|
215
|
+
values: { len: 8 },
|
|
216
|
+
media: { source: video() },
|
|
217
|
+
expect: { error: { code: "template_values_invalid" } }
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "preset-base-with-override",
|
|
221
|
+
doc: () => {
|
|
222
|
+
const doc = withParams(minimalTemplate(), { name: "title", type: "string", required: true }, { name: "layout", type: "enum", required: true, options: ["split", "stacked"] });
|
|
223
|
+
doc.presets = { warm: { label: "Warm", values: { title: "Warm", layout: "split" } } };
|
|
224
|
+
return withTrack(doc, overlay({ text: "{{title}}", layout: "{{layout}}" }));
|
|
225
|
+
},
|
|
226
|
+
values: { title: "Mine" },
|
|
227
|
+
preset: "warm",
|
|
228
|
+
media: { source: video() },
|
|
229
|
+
expect: { at: [["tracks.1.contents.0.source.params", { text: "Mine", layout: "split" }]] }
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "unknown-preset",
|
|
233
|
+
doc: minimalTemplate,
|
|
234
|
+
preset: "nope",
|
|
235
|
+
media: { source: video() },
|
|
236
|
+
expect: { error: { code: "template_values_invalid", fields: [{ param: "preset", reason: "unknown preset nope" }] } }
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "enum-outside-options",
|
|
240
|
+
doc: () => withParams(minimalTemplate(), { name: "layout", type: "enum", required: true, options: ["split"] }),
|
|
241
|
+
values: { layout: "stacked" },
|
|
242
|
+
media: { source: video() },
|
|
243
|
+
expect: { error: { code: "template_values_invalid", fields: [{ param: "layout", reason: "expected one of split" }] } }
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "boolean-whole-leaf-and-inline",
|
|
247
|
+
doc: () => withTrack(withParams(minimalTemplate(), { name: "on", type: "boolean", required: true }), overlay({ show: "{{on}}", note: "on={{on}}" })),
|
|
248
|
+
values: { on: "true" },
|
|
249
|
+
media: { source: video() },
|
|
250
|
+
expect: { at: [["tracks.1.contents.0.source.params", { show: true, note: "on=true" }]] }
|
|
251
|
+
}
|
|
252
|
+
];
|
|
253
|
+
function readFixturePath(value, path) {
|
|
254
|
+
return path.split(".").reduce((v, key) => v == null ? void 0 : v[key], value);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// ../execution/component-runtime/src/template/testing/templateApplyContract.ts
|
|
258
|
+
var kit = (name) => ({
|
|
259
|
+
kitId: "ignored",
|
|
260
|
+
name,
|
|
261
|
+
colors: { primary: "#111111", secondary: "#222222", accent: "#f7c948", background: "#000000", text: "#ffffff" },
|
|
262
|
+
headingFont: { fontFamily: "Inter", fontWeight: 700 },
|
|
263
|
+
bodyFont: { fontFamily: "Inter", fontWeight: 400 }
|
|
264
|
+
});
|
|
265
|
+
function contractDoc() {
|
|
266
|
+
const doc = minimalTemplate();
|
|
267
|
+
doc.parameters.push({ name: "title", type: "string", required: true, default: "Hello" });
|
|
268
|
+
doc.composition.tracks.push({ id: "t", kind: "overlay", name: "T", contents: [{
|
|
269
|
+
id: "o",
|
|
270
|
+
kind: "overlay",
|
|
271
|
+
startTime: 0,
|
|
272
|
+
duration: 2,
|
|
273
|
+
source: { kind: "overlay", primitiveId: "heroText", params: { text: "{{title}}" } }
|
|
274
|
+
}] });
|
|
275
|
+
doc.brandKit = kit("Document kit");
|
|
276
|
+
doc.presets = { granite: { label: "Granite", values: { title: "Granite" }, brandKit: kit("Granite kit") } };
|
|
277
|
+
return parseTemplateDocument(doc);
|
|
278
|
+
}
|
|
279
|
+
var source = { mediaId: "m1", kind: "video", durationSec: 30 };
|
|
280
|
+
var SAMPLE_SHA = "b".repeat(64);
|
|
281
|
+
var CONTRACT_MATTE_KEY = "4aa54bdd6d0d";
|
|
282
|
+
function matteCase(bakeVersion, sha256) {
|
|
283
|
+
const doc = minimalTemplate();
|
|
284
|
+
doc.parameters[0] = {
|
|
285
|
+
name: "source",
|
|
286
|
+
type: "media",
|
|
287
|
+
kind: "video",
|
|
288
|
+
required: true,
|
|
289
|
+
sample: { url: "https://cdn.cueframe.ai/samples/contract.mp4", sha256: SAMPLE_SHA, mimeType: "video/mp4" },
|
|
290
|
+
prepared: { mattes: { [CONTRACT_MATTE_KEY]: { url: "https://cdn.cueframe.ai/mattes/contract.mp4", sha256: "c".repeat(64), mimeType: "video/mp4", bakeVersion } } }
|
|
291
|
+
};
|
|
292
|
+
return { doc: parseTemplateDocument(doc), values: {}, media: { source: { ...source, sha256 } } };
|
|
293
|
+
}
|
|
294
|
+
function logicalMedia(doc, composition) {
|
|
295
|
+
const out = structuredClone(composition);
|
|
296
|
+
const media = new Set(doc.parameters.filter((p) => p.type === "media").map((p) => p.name));
|
|
297
|
+
for (const ref of findReferences(doc)) {
|
|
298
|
+
if (!ref.wholeLeaf || !media.has(ref.name)) continue;
|
|
299
|
+
const parent = ref.path.slice(0, -1).reduce((v, k) => v?.[k], out);
|
|
300
|
+
const leaf = ref.path[ref.path.length - 1];
|
|
301
|
+
if (typeof parent?.[leaf] === "string" && parent[leaf].length > 0) parent[leaf] = `media:${ref.name}`;
|
|
302
|
+
}
|
|
303
|
+
return out;
|
|
304
|
+
}
|
|
305
|
+
function runTemplateApplyContract(harness) {
|
|
306
|
+
const { describe, it, expect, makeLane, kind } = harness;
|
|
307
|
+
const red = new Set(harness.knownRed ?? []);
|
|
308
|
+
const fact = (name, fn) => (red.has(name) ? it.fails : it)(name, fn);
|
|
309
|
+
describe(`template apply contract (${kind})`, () => {
|
|
310
|
+
fact("contract_apply_reads_back_bound_composition", async () => {
|
|
311
|
+
const lane = await makeLane();
|
|
312
|
+
const doc = contractDoc();
|
|
313
|
+
await lane.apply({ doc, values: { title: "Sam" }, media: { source } });
|
|
314
|
+
const stored = await lane.readBack();
|
|
315
|
+
expect(stored && logicalMedia(doc, stored.composition)).toEqual(logicalMedia(doc, bindTemplate(doc, { title: "Sam" }, { source })));
|
|
316
|
+
});
|
|
317
|
+
fact("contract_apply_preset_kit_over_document_kit", async () => {
|
|
318
|
+
const lane = await makeLane();
|
|
319
|
+
const doc = contractDoc();
|
|
320
|
+
const plain = await lane.apply({ doc, values: {}, media: { source } });
|
|
321
|
+
const granite = await lane.apply({ doc, values: {}, media: { source }, preset: "granite" });
|
|
322
|
+
expect(plain.brandKit?.name).toBe("Document kit");
|
|
323
|
+
expect(granite.brandKit?.name).toBe("Granite kit");
|
|
324
|
+
if (kind === "server" || plain.brandKit?.kitId !== void 0) expect(plain.brandKit?.kitId).toBe(`template:${doc.slug}`);
|
|
325
|
+
if (kind === "server" || granite.brandKit?.kitId !== void 0) expect(granite.brandKit?.kitId).toBe(`template:${doc.slug}:granite`);
|
|
326
|
+
});
|
|
327
|
+
fact("contract_apply_refuses_missing_media", async () => {
|
|
328
|
+
const lane = await makeLane();
|
|
329
|
+
await expect(lane.apply({ doc: contractDoc(), values: {}, media: {} })).rejects.toMatchObject({ code: "template_values_invalid" });
|
|
330
|
+
});
|
|
331
|
+
if (kind === "server") {
|
|
332
|
+
const server = async () => {
|
|
333
|
+
const lane = await makeLane();
|
|
334
|
+
if (!lane.server) throw new Error(`${lane.name}: a server lane supplies lane.server`);
|
|
335
|
+
return { lane, server: lane.server };
|
|
336
|
+
};
|
|
337
|
+
fact("contract_apply_installs_component_once", async () => {
|
|
338
|
+
const { lane, server: s } = await server();
|
|
339
|
+
const doc = parseTemplateDocument(withComponent(contractDoc()));
|
|
340
|
+
await lane.apply({ doc, values: {}, media: { source } });
|
|
341
|
+
await lane.apply({ doc, values: {}, media: { source } });
|
|
342
|
+
expect(await s.readComponentVersionCount("c1")).toBe(1);
|
|
343
|
+
});
|
|
344
|
+
fact("contract_apply_refuses_differing_component", async () => {
|
|
345
|
+
const { lane, server: s } = await server();
|
|
346
|
+
await s.seedComponent("c1", "export default () => 1;");
|
|
347
|
+
const doc = parseTemplateDocument(withComponent(contractDoc()));
|
|
348
|
+
await expect(lane.apply({ doc, values: {}, media: { source } })).rejects.toMatchObject({ code: "template_component_conflict" });
|
|
349
|
+
expect(await s.readComponentVersionCount("c1")).toBe(1);
|
|
350
|
+
expect(await lane.readBack()).toBe(null);
|
|
351
|
+
});
|
|
352
|
+
fact("contract_apply_brandKitId_over_both_kits", async () => {
|
|
353
|
+
const { lane, server: s } = await server();
|
|
354
|
+
const brandKitId = await s.seedBrandKit("Org kit");
|
|
355
|
+
const applied = await lane.apply({ doc: contractDoc(), values: {}, media: { source }, preset: "granite", brandKitId });
|
|
356
|
+
expect(applied.brandKit?.name).toBe("Org kit");
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
if (kind === "desktop") {
|
|
360
|
+
fact("contract_apply_refuses_stale_matte", async () => {
|
|
361
|
+
const lane = await makeLane();
|
|
362
|
+
await expect(lane.apply(matteCase(`stale-${CURRENT_MATTE_BAKE_VERSION}`, SAMPLE_SHA))).rejects.toThrow(/bakeVersion/);
|
|
363
|
+
});
|
|
364
|
+
fact("contract_apply_matte_only_on_its_sample", async () => {
|
|
365
|
+
const lane = await makeLane();
|
|
366
|
+
expect((await lane.apply(matteCase(CURRENT_MATTE_BAKE_VERSION, SAMPLE_SHA))).mattes).toEqual([CONTRACT_MATTE_KEY]);
|
|
367
|
+
expect((await lane.apply(matteCase(CURRENT_MATTE_BAKE_VERSION, "d".repeat(64)))).mattes ?? []).toEqual([]);
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
export {
|
|
373
|
+
CONTRACT_MATTE_KEY,
|
|
374
|
+
TEMPLATE_BINDING_FIXTURES,
|
|
375
|
+
minimalTemplate,
|
|
376
|
+
readFixturePath,
|
|
377
|
+
runTemplateApplyContract,
|
|
378
|
+
sceneWithImageSlot,
|
|
379
|
+
withComponent
|
|
380
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../_members/component-runtime/template/index.js";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MATTE_KEY,
|
|
3
|
+
PRESET_NAME,
|
|
4
|
+
TEMPLATE_MAX_BYTES,
|
|
5
|
+
TemplateDocumentSchema,
|
|
6
|
+
TemplateError,
|
|
7
|
+
TemplateParameterSchema,
|
|
8
|
+
bindTemplate,
|
|
9
|
+
checkReferences,
|
|
10
|
+
coerceParameterValue,
|
|
11
|
+
findReferences,
|
|
12
|
+
parseTemplateDocument
|
|
13
|
+
} from "../chunk-REST55RC.js";
|
|
14
|
+
import "../chunk-TR53N6HB.js";
|
|
15
|
+
import "../chunk-EC6VFQE6.js";
|
|
16
|
+
import "../chunk-IG3YAOUZ.js";
|
|
17
|
+
import "../chunk-PWWZTY3G.js";
|
|
18
|
+
import "../chunk-UFD4EZHM.js";
|
|
19
|
+
import "../chunk-WPZKOVYF.js";
|
|
20
|
+
import "../chunk-B7J5UUUV.js";
|
|
21
|
+
import {
|
|
22
|
+
CURRENT_MATTE_BAKE_VERSION
|
|
23
|
+
} from "../chunk-7NIOFHMH.js";
|
|
24
|
+
import "../chunk-DKBFAQCW.js";
|
|
25
|
+
import "../chunk-WREYUH2E.js";
|
|
26
|
+
import "../chunk-ILO4NEZ3.js";
|
|
27
|
+
import "../chunk-AK5QBHOB.js";
|
|
28
|
+
import "../chunk-VG2ND6PX.js";
|
|
29
|
+
import "../chunk-CL5Y6V6K.js";
|
|
30
|
+
import "../chunk-2L7PYYJK.js";
|
|
31
|
+
import "../chunk-OOL7ZUG7.js";
|
|
32
|
+
import "../chunk-2ESYSVXG.js";
|
|
33
|
+
|
|
34
|
+
// ../execution/component-runtime/src/template/extract.ts
|
|
35
|
+
function extractTemplate(args) {
|
|
36
|
+
const escape = (v) => typeof v === "string" ? v.replaceAll("{{", "\\{{") : Array.isArray(v) ? v.map(escape) : v && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, escape(x)])) : v;
|
|
37
|
+
const composition = escape(args.composition);
|
|
38
|
+
const clips = /* @__PURE__ */ new Map();
|
|
39
|
+
for (const track of composition.tracks) for (const clip2 of track.contents) clips.set(clip2.id, clip2);
|
|
40
|
+
const clip = (id) => {
|
|
41
|
+
const found = clips.get(id);
|
|
42
|
+
if (!found) throw new Error(`clip ${id} is not in the composition`);
|
|
43
|
+
return found;
|
|
44
|
+
};
|
|
45
|
+
const parameters = [];
|
|
46
|
+
for (const m of args.mediaParams) {
|
|
47
|
+
const source = clip(m.clipId).source;
|
|
48
|
+
const holder = m.slot === void 0 ? source : source?.assets;
|
|
49
|
+
const key = m.slot ?? "mediaId";
|
|
50
|
+
if (typeof holder?.[key] !== "string" || holder[key].length === 0) {
|
|
51
|
+
throw new Error(`clip ${m.clipId} has no media at source.${m.slot === void 0 ? "mediaId" : `assets.${m.slot}`}`);
|
|
52
|
+
}
|
|
53
|
+
parameters.push({ name: m.name, type: "media", kind: m.kind, required: true, default: holder[key], ...m.label ? { label: m.label } : {} });
|
|
54
|
+
holder[key] = `{{${m.name}}}`;
|
|
55
|
+
}
|
|
56
|
+
for (const t of args.textParams) {
|
|
57
|
+
const parent = t.leafPath.slice(0, -1).reduce((v, k) => v?.[k], clip(t.clipId));
|
|
58
|
+
const leaf = t.leafPath[t.leafPath.length - 1];
|
|
59
|
+
if (parent == null || !(leaf in parent)) throw new Error(`clip ${t.clipId} has no leaf ${t.leafPath.join(".")}`);
|
|
60
|
+
parameters.push({
|
|
61
|
+
name: t.name,
|
|
62
|
+
type: t.type,
|
|
63
|
+
required: t.required,
|
|
64
|
+
default: t.default ?? parent[leaf],
|
|
65
|
+
...t.options ? { options: t.options } : {},
|
|
66
|
+
...t.label ? { label: t.label } : {}
|
|
67
|
+
});
|
|
68
|
+
parent[leaf] = `{{${t.name}}}`;
|
|
69
|
+
}
|
|
70
|
+
const doc = parseTemplateDocument({
|
|
71
|
+
v: 1,
|
|
72
|
+
slug: args.slug,
|
|
73
|
+
name: args.name,
|
|
74
|
+
...args.description ? { description: args.description } : {},
|
|
75
|
+
composition,
|
|
76
|
+
parameters,
|
|
77
|
+
components: args.components
|
|
78
|
+
});
|
|
79
|
+
const { misplaced, mediaSiteErrors } = checkReferences(doc);
|
|
80
|
+
if (misplaced.length || mediaSiteErrors.length) {
|
|
81
|
+
throw new TemplateError("template_values_invalid", [...misplaced.map((m) => `reference outside a string leaf: ${m}`), ...mediaSiteErrors].join("; "));
|
|
82
|
+
}
|
|
83
|
+
return doc;
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
CURRENT_MATTE_BAKE_VERSION,
|
|
87
|
+
MATTE_KEY,
|
|
88
|
+
PRESET_NAME,
|
|
89
|
+
TEMPLATE_MAX_BYTES,
|
|
90
|
+
TemplateDocumentSchema,
|
|
91
|
+
TemplateError,
|
|
92
|
+
TemplateParameterSchema,
|
|
93
|
+
bindTemplate,
|
|
94
|
+
checkReferences,
|
|
95
|
+
coerceParameterValue,
|
|
96
|
+
extractTemplate,
|
|
97
|
+
findReferences,
|
|
98
|
+
parseTemplateDocument
|
|
99
|
+
};
|
package/dist/compose.js
CHANGED
|
@@ -5,39 +5,39 @@ import {
|
|
|
5
5
|
isContrastCritical
|
|
6
6
|
} from "./chunk-QDBVYZSF.js";
|
|
7
7
|
import "./chunk-GULDS3VE.js";
|
|
8
|
-
import {
|
|
9
|
-
catalog as catalog4
|
|
10
|
-
} from "./chunk-PTVTWQ4T.js";
|
|
11
|
-
import {
|
|
12
|
-
catalog as catalog7
|
|
13
|
-
} from "./chunk-UKDBU7HM.js";
|
|
14
|
-
import {
|
|
15
|
-
catalog
|
|
16
|
-
} from "./chunk-RBWS5XHE.js";
|
|
17
|
-
import "./chunk-DLF4WVSE.js";
|
|
18
|
-
import "./chunk-U4V4FZGE.js";
|
|
19
8
|
import {
|
|
20
9
|
catalog as catalog3
|
|
21
10
|
} from "./chunk-FVDFPJHT.js";
|
|
22
|
-
import "./chunk-QGAWDLYX.js";
|
|
23
11
|
import {
|
|
24
12
|
catalog as catalog6
|
|
25
13
|
} from "./chunk-VLJOIUHL.js";
|
|
26
|
-
import "./chunk-S5H6GH6M.js";
|
|
27
|
-
import "./chunk-QAGGJHAF.js";
|
|
28
|
-
import {
|
|
29
|
-
catalog as catalog5
|
|
30
|
-
} from "./chunk-RAXHCRVV.js";
|
|
31
14
|
import {
|
|
32
15
|
catalog as catalog2
|
|
33
16
|
} from "./chunk-TKFLSGAS.js";
|
|
34
|
-
import "./chunk-MFHXCHRI.js";
|
|
35
17
|
import {
|
|
36
18
|
catalog as catalog8
|
|
37
19
|
} from "./chunk-RL5SO653.js";
|
|
20
|
+
import {
|
|
21
|
+
catalog as catalog4
|
|
22
|
+
} from "./chunk-PTVTWQ4T.js";
|
|
23
|
+
import {
|
|
24
|
+
catalog as catalog7
|
|
25
|
+
} from "./chunk-UKDBU7HM.js";
|
|
26
|
+
import "./chunk-QGAWDLYX.js";
|
|
27
|
+
import "./chunk-S5H6GH6M.js";
|
|
28
|
+
import "./chunk-QAGGJHAF.js";
|
|
29
|
+
import "./chunk-MFHXCHRI.js";
|
|
30
|
+
import {
|
|
31
|
+
catalog
|
|
32
|
+
} from "./chunk-RBWS5XHE.js";
|
|
33
|
+
import "./chunk-DLF4WVSE.js";
|
|
34
|
+
import "./chunk-U4V4FZGE.js";
|
|
38
35
|
import "./chunk-LT4PWSR2.js";
|
|
39
36
|
import "./chunk-FWSJLHSV.js";
|
|
40
37
|
import "./chunk-ZFEXATWN.js";
|
|
38
|
+
import {
|
|
39
|
+
catalog as catalog5
|
|
40
|
+
} from "./chunk-RAXHCRVV.js";
|
|
41
41
|
import "./chunk-XHGZ2E77.js";
|
|
42
42
|
import "./chunk-W2245F6G.js";
|
|
43
43
|
import "./chunk-FHMTAZD4.js";
|
|
@@ -47,11 +47,11 @@ import {
|
|
|
47
47
|
getPrimitiveText,
|
|
48
48
|
getPrimitiveTextParam,
|
|
49
49
|
listPrimitivesByCategory
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-4NIJWK45.js";
|
|
51
51
|
import {
|
|
52
52
|
CueframeError,
|
|
53
53
|
encodeError
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-AK5QBHOB.js";
|
|
55
55
|
import "./chunk-7PA7FGLD.js";
|
|
56
56
|
import {
|
|
57
57
|
NEUTRAL_RAMP
|
package/dist/composition/ops.js
CHANGED
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
selectSceneMarkers,
|
|
22
22
|
selectTracksByKind
|
|
23
23
|
} from "../chunk-LBJ5LI5V.js";
|
|
24
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-IG3YAOUZ.js";
|
|
25
|
+
import "../chunk-PWWZTY3G.js";
|
|
25
26
|
import "../chunk-UFD4EZHM.js";
|
|
26
27
|
import "../chunk-WPZKOVYF.js";
|
|
27
28
|
import "../chunk-B7J5UUUV.js";
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
CatalogFilterError,
|
|
8
8
|
DISABLED_PRIMITIVE_IDS,
|
|
9
9
|
PRIMITIVE_META,
|
|
10
|
+
PRIMITIVE_USE_CASES,
|
|
10
11
|
decodeCatalogCursor,
|
|
11
12
|
derivePlacement,
|
|
12
13
|
encodeCatalogCursor,
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
validateCatalogFilters,
|
|
27
28
|
validateParamsAgainstSchema,
|
|
28
29
|
validatePrimitiveParams
|
|
29
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-4NIJWK45.js";
|
|
30
31
|
import "../chunk-7PA7FGLD.js";
|
|
31
32
|
import "../chunk-2ESYSVXG.js";
|
|
32
33
|
export {
|
|
@@ -38,6 +39,7 @@ export {
|
|
|
38
39
|
CatalogFilterError,
|
|
39
40
|
DISABLED_PRIMITIVE_IDS,
|
|
40
41
|
PRIMITIVE_META,
|
|
42
|
+
PRIMITIVE_USE_CASES,
|
|
41
43
|
decodeCatalogCursor,
|
|
42
44
|
derivePlacement,
|
|
43
45
|
encodeCatalogCursor,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
silhouetteKeepOutForWindow,
|
|
33
33
|
sourceRectToOutput,
|
|
34
34
|
sourceWindowKey
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-7NIOFHMH.js";
|
|
36
36
|
import {
|
|
37
37
|
BRAND_TOKEN_REFS,
|
|
38
38
|
BRAND_TOKEN_ROOT_KEYS,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
import {
|
|
74
74
|
contrastRatio
|
|
75
75
|
} from "../chunk-ILO4NEZ3.js";
|
|
76
|
-
import "../chunk-
|
|
76
|
+
import "../chunk-AK5QBHOB.js";
|
|
77
77
|
import "../chunk-VG2ND6PX.js";
|
|
78
78
|
import "../chunk-OOL7ZUG7.js";
|
|
79
79
|
import "../chunk-2ESYSVXG.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../_members/composition/validators/brandKitBody.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BrandAudioSchema,
|
|
3
|
+
BrandKitBodySchema,
|
|
4
|
+
BrandKitBodyShape
|
|
5
|
+
} from "../../chunk-TR53N6HB.js";
|
|
6
|
+
import "../../chunk-PWWZTY3G.js";
|
|
7
|
+
import "../../chunk-UFD4EZHM.js";
|
|
8
|
+
import "../../chunk-WPZKOVYF.js";
|
|
9
|
+
import "../../chunk-B7J5UUUV.js";
|
|
10
|
+
import "../../chunk-WREYUH2E.js";
|
|
11
|
+
import "../../chunk-OOL7ZUG7.js";
|
|
12
|
+
import "../../chunk-2ESYSVXG.js";
|
|
13
|
+
export {
|
|
14
|
+
BrandAudioSchema,
|
|
15
|
+
BrandKitBodySchema,
|
|
16
|
+
BrandKitBodyShape
|
|
17
|
+
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AudioPaletteRef,
|
|
3
|
-
BrandKit,
|
|
4
2
|
ComposePlan,
|
|
5
3
|
Destination,
|
|
6
4
|
DestinationDeliveryStatus,
|
|
7
5
|
DestinationResult,
|
|
8
|
-
EasingValue,
|
|
9
6
|
Font,
|
|
10
|
-
FontRef,
|
|
11
7
|
FontStatus,
|
|
12
8
|
FontVariant,
|
|
13
9
|
MediaSourceSnapshot,
|
|
14
|
-
Motif,
|
|
15
10
|
MuxDestination,
|
|
16
11
|
PlanAssetRequest,
|
|
17
12
|
PlanCut,
|
|
@@ -48,7 +43,15 @@ import {
|
|
|
48
43
|
WebhookDeliveryStatus,
|
|
49
44
|
WebhookDestination,
|
|
50
45
|
YoutubeDestination
|
|
51
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-IG3YAOUZ.js";
|
|
47
|
+
import {
|
|
48
|
+
AudioPaletteRef,
|
|
49
|
+
BrandKit,
|
|
50
|
+
EasingValue,
|
|
51
|
+
FontRef,
|
|
52
|
+
Motif,
|
|
53
|
+
MotifMotionPreset
|
|
54
|
+
} from "../chunk-PWWZTY3G.js";
|
|
52
55
|
import {
|
|
53
56
|
ANIMATABLE_PARAMS,
|
|
54
57
|
ANIMATABLE_VALUE,
|
|
@@ -150,6 +153,7 @@ export {
|
|
|
150
153
|
MediaClipSource,
|
|
151
154
|
MediaSourceSnapshot,
|
|
152
155
|
Motif,
|
|
156
|
+
MotifMotionPreset,
|
|
153
157
|
MuxDestination,
|
|
154
158
|
OpaqueId,
|
|
155
159
|
OverlayClipSource,
|