@vanillaskyai/video 0.10.22 → 0.11.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/CHANGELOG.md +74 -1
- package/PUBLIC-API.md +45 -438
- package/README.md +57 -96
- package/dist/builtin-metadata-OT6V7TB4.js +8 -0
- package/dist/{chapter-title-2JVDU62E.js → chapter-title-2RCXX7SN.js} +1 -2
- package/dist/{chunk-PDQFQIQW.js → chunk-3EQ6PVWL.js} +1 -1
- package/dist/chunk-4G4JBMCM.js +37 -0
- package/dist/{chunk-7AA2JWHZ.js → chunk-5DOQTIMD.js} +6 -6
- package/dist/chunk-666HGTVZ.js +41 -0
- package/dist/{chunk-7M56IUUX.js → chunk-6Z3ID54H.js} +0 -18
- package/dist/{chunk-5BSJLT6H.js → chunk-E7FHBLAC.js} +16 -29
- package/dist/chunk-HIQM4J3U.js +30 -0
- package/dist/chunk-ISWQ6T5X.js +36 -0
- package/dist/{chunk-224QNWRA.js → chunk-K5J7ESRO.js} +1 -10
- package/dist/chunk-KMVRBUL5.js +50 -0
- package/dist/chunk-NM4CXXZY.js +25 -0
- package/dist/{chunk-44WND2VP.js → chunk-V2CP7PVY.js} +19 -63
- package/dist/{chunk-3O7OMMMF.js → chunk-WZESNEPT.js} +0 -1
- package/dist/{chunk-RXTN2CW6.js → chunk-Z3DLSLAJ.js} +1 -1
- package/dist/cinema-media-YZ2UANJG.js +365 -0
- package/dist/cli.js +154 -1753
- package/dist/{compose-video-BH5K6XWT.js → compose-video-H2YUQDUY.js} +4 -4
- package/dist/{events-B4YCc4vc.d.ts → events-BZAfl0Dm.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -6
- package/dist/preload-media-23JXUFCF.js +77 -0
- package/dist/react.d.ts +39 -15
- package/dist/react.js +1350 -739
- package/dist/scene-validation-SGLLLFY5.js +9 -0
- package/dist/server.d.ts +67 -117
- package/dist/server.js +262 -614
- package/dist/test.d.ts +2 -2
- package/dist/test.js +21 -21
- package/dist/{text-stream-LD364KBI.js → text-stream-SOVLYR2L.js} +2 -2
- package/dist/{types-BqB8zC9u.d.ts → types-CG-kPI81.d.ts} +3 -1
- package/dist/{types-DdZw4GRQ.d.ts → types-ht-Zw3Wv.d.ts} +1 -1
- package/docs/agent-integration.md +19 -64
- package/docs/architecture.md +82 -87
- package/docs/customization.md +49 -66
- package/docs/development.md +18 -17
- package/docs/errors.md +4 -4
- package/docs/getting-started.md +74 -93
- package/docs/media-and-audio.md +9 -7
- package/docs/performance.md +11 -6
- package/docs/persistence.md +3 -7
- package/docs/production.md +4 -15
- package/docs/prompt-and-input.md +1 -2
- package/docs/provider-integration.md +134 -181
- package/docs/reference/protocol.md +5 -14
- package/docs/reference/provider-adapters.md +21 -13
- package/docs/security.md +1 -14
- package/docs/testing.md +56 -123
- package/package.json +5 -27
- package/starters/video-chat/.env.example +12 -4
- package/starters/video-chat/.env.native.example +13 -0
- package/starters/video-chat/README.md +72 -11
- package/starters/video-chat/package.json +1 -1
- package/starters/video-chat/providers/text-native.ts +94 -0
- package/starters/video-chat/providers/text.ts +19 -0
- package/starters/video-chat/providers/transcription.ts +32 -0
- package/starters/video-chat/providers/video-custom.ts +45 -0
- package/starters/video-chat/providers/video-delivery.ts +57 -0
- package/starters/video-chat/providers/video-google.ts +48 -0
- package/starters/video-chat/providers/video-job.ts +103 -0
- package/starters/video-chat/providers/video-runway.ts +45 -0
- package/starters/video-chat/providers/video.ts +39 -63
- package/starters/video-chat/server.ts +3 -29
- package/starters/video-chat/vite.config.ts +2 -8
- package/styles/video-chat.css +8 -105
- package/dist/builtin-server-W4PLJUZ5.js +0 -8
- package/dist/catalog-types-WTbLP6Jh.d.ts +0 -78
- package/dist/check-runtime.d.ts +0 -15
- package/dist/check-runtime.js +0 -96
- package/dist/chunk-2E6T633S.js +0 -27
- package/dist/chunk-4YM2M62S.js +0 -13
- package/dist/chunk-4ZJLPHBV.js +0 -684
- package/dist/chunk-5JBMYQP6.js +0 -156
- package/dist/chunk-73NTSFFI.js +0 -81
- package/dist/chunk-EGVQODKU.js +0 -83
- package/dist/chunk-HFVNAPHZ.js +0 -35
- package/dist/chunk-IIN5M5HW.js +0 -697
- package/dist/chunk-IQMYK5DX.js +0 -133
- package/dist/chunk-IR44XKBI.js +0 -46
- package/dist/chunk-JKVOBTRO.js +0 -145
- package/dist/chunk-LVM5Q2DL.js +0 -68
- package/dist/chunk-M4QTEJTK.js +0 -709
- package/dist/chunk-QSBDB4J2.js +0 -16
- package/dist/chunk-R3XAOMKP.js +0 -29
- package/dist/chunk-SPVTJH3F.js +0 -24
- package/dist/chunk-YAHT3LST.js +0 -663
- package/dist/chunk-ZD2VTUYR.js +0 -28
- package/dist/cinema-media-HYCDG65Z.js +0 -11
- package/dist/comparison-XXAP4S4J.js +0 -36
- package/dist/editorial-timeline-VUQC6KPA.js +0 -42
- package/dist/key-figure-4TJK7HLT.js +0 -29
- package/dist/kit-DrRpdn0p.d.ts +0 -79
- package/dist/mobile-message-FIHAO6XC.js +0 -49
- package/dist/preload-media-LJXWKTWG.js +0 -57
- package/dist/quote-GRPIYKQJ.js +0 -32
- package/dist/system-prompt-AG26KJAA.js +0 -12
- package/dist/template-catalog.d.ts +0 -400
- package/dist/template-catalog.js +0 -6
- package/dist/templates.d.ts +0 -25
- package/dist/templates.js +0 -102
- package/dist/validate-4OUD2CLX.js +0 -10
- package/docs/concepts.md +0 -107
- package/docs/custom-templates.md +0 -346
- package/docs/immersive-interface.md +0 -86
- package/docs/maintainers/cinematic-migration.md +0 -38
- package/docs/motion-and-effects.md +0 -109
- package/docs/reference/design-system.html +0 -125
- package/docs/responsive-orientation.md +0 -37
- package/docs/streaming-protocol.md +0 -15
- package/examples/custom-template/README.md +0 -19
- package/examples/custom-template/minimal-text.tsx +0 -82
- package/examples/custom-template/structured-data.tsx +0 -104
- package/registry/items/backgrounds.json +0 -70
- package/registry/items/chapterTitle.json +0 -80
- package/registry/items/cinemaMedia.json +0 -136
- package/registry/items/comparison.json +0 -168
- package/registry/items/editorialTimeline.json +0 -172
- package/registry/items/keyFigure.json +0 -162
- package/registry/items/mobileMessage.json +0 -153
- package/registry/items/motion.json +0 -45
- package/registry/items/quote.json +0 -161
- package/registry/items/template-context.json +0 -31
- package/registry/items/theme.json +0 -47
- package/registry/items/typography.json +0 -47
package/dist/chunk-5JBMYQP6.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// src/visual-system/scene-templates/tokens.ts
|
|
2
|
-
var STYLE_PRESETS = {
|
|
3
|
-
bold: {
|
|
4
|
-
id: "bold",
|
|
5
|
-
useWhen: "The default. Drifting two-color brand mesh, heavy tight headlines at the top. Launches, hype, product moments \u2014 the loudest of the three.",
|
|
6
|
-
background: "mesh",
|
|
7
|
-
titlePlacement: "title-top",
|
|
8
|
-
type: { weightDelta: 0, trackingDeltaEm: 0, sizeScale: 1 }
|
|
9
|
-
},
|
|
10
|
-
editorial: {
|
|
11
|
-
id: "editorial",
|
|
12
|
-
useWhen: "Calm vertical wash, lighter and wider-tracked headlines, centered. Reviews, thoughtful updates, premium or B2B brands \u2014 when the copy should feel considered rather than shouted.",
|
|
13
|
-
background: "wash",
|
|
14
|
-
titlePlacement: "title-center",
|
|
15
|
-
type: { weightDelta: -200, trackingDeltaEm: 0.01, sizeScale: 1.08 }
|
|
16
|
-
},
|
|
17
|
-
stark: {
|
|
18
|
-
id: "stark",
|
|
19
|
-
useWhen: "Single hard spotlight on near-black, uppercase and tightly tracked. Dev tools, technical claims, high-contrast statements \u2014 maximum weight on very few words.",
|
|
20
|
-
background: "spotlight",
|
|
21
|
-
titlePlacement: "title-top",
|
|
22
|
-
type: { weightDelta: 100, trackingDeltaEm: -0.01, sizeScale: 1, transform: "uppercase" }
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
var DEFAULT_PRESET_ID = "bold";
|
|
26
|
-
var PRESET_IDS = Object.keys(STYLE_PRESETS);
|
|
27
|
-
function resolvePreset(id) {
|
|
28
|
-
return id && STYLE_PRESETS[id] || STYLE_PRESETS[DEFAULT_PRESET_ID];
|
|
29
|
-
}
|
|
30
|
-
var DENSITY_SCALES = {
|
|
31
|
-
airy: {
|
|
32
|
-
id: "airy",
|
|
33
|
-
useWhen: "Smaller headlines held further off the frame edges. Premium, considered, editorial \u2014 when the copy should have room to breathe.",
|
|
34
|
-
typeScale: 0.92,
|
|
35
|
-
safeZoneScale: 1.3
|
|
36
|
-
},
|
|
37
|
-
normal: {
|
|
38
|
-
id: "normal",
|
|
39
|
-
useWhen: "The default. No change to type size or frame padding.",
|
|
40
|
-
typeScale: 1,
|
|
41
|
-
safeZoneScale: 1
|
|
42
|
-
},
|
|
43
|
-
packed: {
|
|
44
|
-
id: "packed",
|
|
45
|
-
useWhen: "Bigger headlines pushed closer to the edges. Dense, urgent, information-heavy \u2014 when the frame should feel full.",
|
|
46
|
-
typeScale: 1.08,
|
|
47
|
-
safeZoneScale: 0.8
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
var MOTION_SCALES = {
|
|
51
|
-
calm: {
|
|
52
|
-
id: "calm",
|
|
53
|
-
useWhen: "Slower entrances and exits \u2014 text eases in rather than arriving. Founder stories, sober data, anything reflective.",
|
|
54
|
-
phaseScale: 1.4
|
|
55
|
-
},
|
|
56
|
-
normal: {
|
|
57
|
-
id: "normal",
|
|
58
|
-
useWhen: "The default. Archetype timings as authored.",
|
|
59
|
-
phaseScale: 1
|
|
60
|
-
},
|
|
61
|
-
punchy: {
|
|
62
|
-
id: "punchy",
|
|
63
|
-
useWhen: "Snappier entrances and exits \u2014 text lands fast and clears fast. Hype, launches, hot takes.",
|
|
64
|
-
phaseScale: 0.7
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var DEFAULT_DENSITY_ID = "normal";
|
|
68
|
-
var DEFAULT_MOTION_ID = "normal";
|
|
69
|
-
var DENSITY_IDS = Object.keys(DENSITY_SCALES);
|
|
70
|
-
var MOTION_IDS = Object.keys(MOTION_SCALES);
|
|
71
|
-
function resolveDensity(id) {
|
|
72
|
-
return id && DENSITY_SCALES[id] || DENSITY_SCALES[DEFAULT_DENSITY_ID];
|
|
73
|
-
}
|
|
74
|
-
function resolveMotion(id) {
|
|
75
|
-
return id && MOTION_SCALES[id] || MOTION_SCALES[DEFAULT_MOTION_ID];
|
|
76
|
-
}
|
|
77
|
-
function resolveTokens(style) {
|
|
78
|
-
const preset = resolvePreset(style.preset);
|
|
79
|
-
const density = resolveDensity(style.density);
|
|
80
|
-
const motion = resolveMotion(style.motion);
|
|
81
|
-
const composedPreset = {
|
|
82
|
-
...preset,
|
|
83
|
-
type: {
|
|
84
|
-
...preset.type,
|
|
85
|
-
sizeScale: preset.type.sizeScale * density.typeScale,
|
|
86
|
-
phaseScale: motion.phaseScale
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
return {
|
|
90
|
-
primary: "#FFFFFF",
|
|
91
|
-
secondary: "#FFFFFF",
|
|
92
|
-
background: { type: "solid", color: "#000000" },
|
|
93
|
-
surface: "#000000",
|
|
94
|
-
surfaceElevated: "#171717",
|
|
95
|
-
foreground: "#FFFFFF",
|
|
96
|
-
muted: "#B7B7BC",
|
|
97
|
-
font: '-apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif',
|
|
98
|
-
scriptFont: "Georgia",
|
|
99
|
-
preset: composedPreset,
|
|
100
|
-
density,
|
|
101
|
-
motion
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function darken(hex, factor) {
|
|
105
|
-
if (!hex.startsWith("#") || hex.length !== 4 && hex.length !== 7) {
|
|
106
|
-
return hex;
|
|
107
|
-
}
|
|
108
|
-
const full = hex.length === 4 ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}` : hex;
|
|
109
|
-
const ch = (i) => Math.max(0, Math.round(parseInt(full.slice(i, i + 2), 16) * (1 - factor))).toString(16).padStart(2, "0");
|
|
110
|
-
return `#${ch(1)}${ch(3)}${ch(5)}`;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// src/visual-system/scene-templates/external-video-backdrop.tsx
|
|
114
|
-
import React from "react";
|
|
115
|
-
import { jsx } from "react/jsx-runtime";
|
|
116
|
-
var DEFAULT = { mode: false, audioMuted: true, audioVolume: 1 };
|
|
117
|
-
var sharedContext = globalThis;
|
|
118
|
-
var BackdropContext = sharedContext.__vanillaskyVideoBackdropContext ??= React.createContext(DEFAULT);
|
|
119
|
-
function ExternalVideoBackdropProvider({
|
|
120
|
-
mode,
|
|
121
|
-
audioMuted = true,
|
|
122
|
-
audioVolume = 1,
|
|
123
|
-
preparingNarration = false,
|
|
124
|
-
onMediaError,
|
|
125
|
-
children
|
|
126
|
-
}) {
|
|
127
|
-
const value = React.useMemo(
|
|
128
|
-
() => ({ mode, audioMuted, audioVolume, preparingNarration, onMediaError }),
|
|
129
|
-
[mode, audioMuted, audioVolume, preparingNarration, onMediaError]
|
|
130
|
-
);
|
|
131
|
-
return /* @__PURE__ */ jsx(BackdropContext.Provider, { value, children });
|
|
132
|
-
}
|
|
133
|
-
function useExternalVideoBackdrop() {
|
|
134
|
-
return React.useContext(BackdropContext).mode;
|
|
135
|
-
}
|
|
136
|
-
function useMediaAudio() {
|
|
137
|
-
const { audioMuted, audioVolume } = React.useContext(BackdropContext);
|
|
138
|
-
return { muted: audioMuted, volume: audioVolume };
|
|
139
|
-
}
|
|
140
|
-
function useNarrationPreroll() {
|
|
141
|
-
return React.useContext(BackdropContext).preparingNarration === true;
|
|
142
|
-
}
|
|
143
|
-
function useMediaFailure() {
|
|
144
|
-
return React.useContext(BackdropContext).onMediaError;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export {
|
|
148
|
-
resolveDensity,
|
|
149
|
-
resolveTokens,
|
|
150
|
-
darken,
|
|
151
|
-
ExternalVideoBackdropProvider,
|
|
152
|
-
useExternalVideoBackdrop,
|
|
153
|
-
useMediaAudio,
|
|
154
|
-
useNarrationPreroll,
|
|
155
|
-
useMediaFailure
|
|
156
|
-
};
|
package/dist/chunk-73NTSFFI.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// src/visual-system/catalog/schema.ts
|
|
2
|
-
function cloneJson(value) {
|
|
3
|
-
return JSON.parse(JSON.stringify(value));
|
|
4
|
-
}
|
|
5
|
-
function getTemplateDefaults(schema) {
|
|
6
|
-
return Object.fromEntries(Object.entries(schema.properties).filter(([, property]) => property.default !== void 0).map(([name, property]) => [name, cloneJson(property.default)]));
|
|
7
|
-
}
|
|
8
|
-
function isMeaningfullyPresentTemplateValue(value) {
|
|
9
|
-
if (value == null) return false;
|
|
10
|
-
if (typeof value === "string") return value.trim().length > 0;
|
|
11
|
-
if (Array.isArray(value)) return value.length > 0;
|
|
12
|
-
if (typeof value === "object") return Object.keys(value).length > 0;
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
function schemaProperties(schema) {
|
|
16
|
-
return [
|
|
17
|
-
schema,
|
|
18
|
-
...Object.values(schema.properties ?? {}).flatMap(schemaProperties),
|
|
19
|
-
...schema.items ? schemaProperties(schema.items) : []
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
function getTemplateSchemaGates(schema) {
|
|
23
|
-
const requiredAnyOf = schema["x-vanillasky"]?.requiredAnyOf ?? [];
|
|
24
|
-
for (const [groupIndex, group] of requiredAnyOf.entries()) {
|
|
25
|
-
if (!Array.isArray(group) || group.length === 0) {
|
|
26
|
-
throw new Error(`Template schema x-vanillasky.requiredAnyOf[${groupIndex}] must name at least one field`);
|
|
27
|
-
}
|
|
28
|
-
for (const field of group) {
|
|
29
|
-
if (typeof field !== "string" || !Object.hasOwn(schema.properties, field)) {
|
|
30
|
-
throw new Error(`Template schema x-vanillasky.requiredAnyOf[${groupIndex}] field ${String(field)} is not declared`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const properties = Object.values(schema.properties).flatMap(schemaProperties);
|
|
35
|
-
return {
|
|
36
|
-
requiresStat: schema["x-vanillasky"]?.requiresStat === true || properties.some(({ format }) => format === "grounded-stat"),
|
|
37
|
-
requiresQuote: properties.some(({ format }) => format === "grounded-quote"),
|
|
38
|
-
requiresScreenshot: properties.some(({ format }) => format === "supplied-image"),
|
|
39
|
-
allowsStockMedia: schema["x-vanillasky"]?.allowsStockMedia === true || properties.some(({ format }) => format === "stock-media-keyword"),
|
|
40
|
-
requiredAnyOf
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function summaryType(property) {
|
|
44
|
-
if (property.format === "uri" || property.format === "supplied-image") return "media";
|
|
45
|
-
if (property.enum) return "enum";
|
|
46
|
-
if (property.type === "number" || property.type === "integer") return "number";
|
|
47
|
-
if (property.type === "boolean") return "boolean";
|
|
48
|
-
if (property.type === "array" && property.items?.type === "object") return "data-points";
|
|
49
|
-
if (property.type === "array") return "string-array";
|
|
50
|
-
return "string";
|
|
51
|
-
}
|
|
52
|
-
function summarizeTemplateVariables(schema) {
|
|
53
|
-
const required = new Set(schema.required ?? []);
|
|
54
|
-
return Object.fromEntries(Object.entries(schema.properties).map(([name, property]) => [name, {
|
|
55
|
-
type: summaryType(property),
|
|
56
|
-
...property.title == null ? {} : { title: property.title },
|
|
57
|
-
...property.description == null ? {} : { description: property.description },
|
|
58
|
-
...property.default === void 0 ? {} : { default: cloneJson(property.default) },
|
|
59
|
-
...property.examples == null ? {} : { examples: cloneJson(property.examples) },
|
|
60
|
-
...property.enum == null ? {} : { options: [...property.enum] },
|
|
61
|
-
required: required.has(name),
|
|
62
|
-
...property.minItems == null ? {} : { minItems: property.minItems },
|
|
63
|
-
...property.maxItems == null ? {} : { maxItems: property.maxItems }
|
|
64
|
-
}]));
|
|
65
|
-
}
|
|
66
|
-
function templateVariableNotation(property, required) {
|
|
67
|
-
const type = summaryType(property);
|
|
68
|
-
const options = property.enum?.length ? `(${property.enum.join("|")})` : "";
|
|
69
|
-
const itemCount = property.minItems === property.maxItems && property.minItems != null ? `[${property.minItems}]` : property.minItems != null || property.maxItems != null ? `[${property.minItems ?? 0}..${property.maxItems ?? "\u221E"}]` : "";
|
|
70
|
-
const textProperty = property.type === "array" ? property.items : property;
|
|
71
|
-
const characterCount = textProperty?.type === "string" && (textProperty.minLength != null || textProperty.maxLength != null) ? `{${textProperty.minLength ?? 0}..${textProperty.maxLength ?? "\u221E"}}` : "";
|
|
72
|
-
return `${type}${itemCount}${characterCount}${options}${required ? "!" : ""}`;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export {
|
|
76
|
-
getTemplateDefaults,
|
|
77
|
-
isMeaningfullyPresentTemplateValue,
|
|
78
|
-
getTemplateSchemaGates,
|
|
79
|
-
summarizeTemplateVariables,
|
|
80
|
-
templateVariableNotation
|
|
81
|
-
};
|
package/dist/chunk-EGVQODKU.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// src/visual-system/catalog/value-validation.ts
|
|
2
|
-
var STRING_FORMATS = /* @__PURE__ */ new Set(["uri", "supplied-image", "grounded-quote", "stock-media-keyword", "emoji"]);
|
|
3
|
-
function isTemplatePropertyFormatSupported(format, type) {
|
|
4
|
-
return format === "grounded-stat" ? type === "string" || type === "number" || type === "integer" : STRING_FORMATS.has(format) && type === "string";
|
|
5
|
-
}
|
|
6
|
-
function validUrl(value) {
|
|
7
|
-
try {
|
|
8
|
-
return ["https:", "http:", "data:"].includes(new URL(value).protocol);
|
|
9
|
-
} catch {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function validSingleEmoji(value) {
|
|
14
|
-
const text = value.trim();
|
|
15
|
-
const graphemes = Array.from(new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(text));
|
|
16
|
-
return graphemes.length === 1 && /\p{Extended_Pictographic}|\p{Regional_Indicator}|\u20e3/u.test(text);
|
|
17
|
-
}
|
|
18
|
-
function validateTemplateSchemaValue(schema, value, path, options = {}) {
|
|
19
|
-
const fail = (message) => {
|
|
20
|
-
throw new Error(`${options.errorPrefix ?? ""}${path} ${message}`);
|
|
21
|
-
};
|
|
22
|
-
if (schema.enum && (typeof value !== "string" || !schema.enum.includes(value))) fail("must match an allowed value");
|
|
23
|
-
if (schema.type === "string") {
|
|
24
|
-
if (typeof value !== "string") fail("must be string");
|
|
25
|
-
const text = value;
|
|
26
|
-
if (schema.minLength != null && text.length < schema.minLength) fail(`must contain at least ${schema.minLength} characters`);
|
|
27
|
-
if (schema.maxLength != null && text.length > schema.maxLength) fail(`must contain at most ${schema.maxLength} characters`);
|
|
28
|
-
if (!options.deferMediaUrls && (schema.format === "uri" || schema.format === "supplied-image")) {
|
|
29
|
-
const emptySentinel = options.allowEmptyOptionalMedia && options.optional && text === "";
|
|
30
|
-
if (!emptySentinel && !validUrl(text)) fail("must be a valid URL");
|
|
31
|
-
}
|
|
32
|
-
if (schema.format === "emoji" && !validSingleEmoji(text)) fail("must be a single emoji");
|
|
33
|
-
} else if (schema.type === "number" || schema.type === "integer") {
|
|
34
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
35
|
-
fail(`must be ${options.includeTypeArticle ? "a " : ""}${schema.type}`);
|
|
36
|
-
}
|
|
37
|
-
const number = value;
|
|
38
|
-
if (schema.type === "integer" && !Number.isInteger(number)) fail("must be integer");
|
|
39
|
-
if (schema.minimum != null && number < schema.minimum) fail(`must be at least ${schema.minimum}`);
|
|
40
|
-
if (schema.maximum != null && number > schema.maximum) fail(`must be at most ${schema.maximum}`);
|
|
41
|
-
} else if (schema.type === "boolean") {
|
|
42
|
-
if (typeof value !== "boolean") fail("must be boolean");
|
|
43
|
-
} else if (schema.type === "array") {
|
|
44
|
-
if (!Array.isArray(value)) fail("must be array");
|
|
45
|
-
const items = value;
|
|
46
|
-
if (schema.minItems === schema.maxItems && schema.minItems != null && items.length !== schema.minItems) {
|
|
47
|
-
fail(`must contain exactly ${schema.minItems} items`);
|
|
48
|
-
}
|
|
49
|
-
if (schema.minItems != null && items.length < schema.minItems) fail(`must contain at least ${schema.minItems} items`);
|
|
50
|
-
if (schema.maxItems != null && items.length > schema.maxItems) fail(`must contain at most ${schema.maxItems} items`);
|
|
51
|
-
if (schema.items) items.forEach((item, index) => validateTemplateSchemaValue(schema.items, item, `${path}.${index}`, {
|
|
52
|
-
...options,
|
|
53
|
-
optional: false
|
|
54
|
-
}));
|
|
55
|
-
} else if (schema.type === "object") {
|
|
56
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) fail("must be object");
|
|
57
|
-
const object = value;
|
|
58
|
-
for (const required2 of schema.required ?? []) {
|
|
59
|
-
if (!Object.hasOwn(object, required2)) fail(`requires ${required2}`);
|
|
60
|
-
}
|
|
61
|
-
const properties = schema.properties ?? {};
|
|
62
|
-
if (schema.additionalProperties === false) {
|
|
63
|
-
for (const name of Object.keys(object)) {
|
|
64
|
-
if (!Object.hasOwn(properties, name)) {
|
|
65
|
-
throw new Error(`${options.errorPrefix ?? ""}${path}.${name} is not declared`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const required = new Set(schema.required ?? []);
|
|
70
|
-
for (const [name, property] of Object.entries(properties)) {
|
|
71
|
-
if (Object.hasOwn(object, name)) validateTemplateSchemaValue(property, object[name], `${path}.${name}`, {
|
|
72
|
-
...options,
|
|
73
|
-
allowEmptyOptionalMedia: property.default === "",
|
|
74
|
-
optional: !required.has(name)
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export {
|
|
81
|
-
isTemplatePropertyFormatSupported,
|
|
82
|
-
validateTemplateSchemaValue
|
|
83
|
-
};
|
package/dist/chunk-HFVNAPHZ.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SceneBackground,
|
|
3
|
-
getMediaBackgroundProps
|
|
4
|
-
} from "./chunk-YAHT3LST.js";
|
|
5
|
-
import {
|
|
6
|
-
editorialFont
|
|
7
|
-
} from "./chunk-4YM2M62S.js";
|
|
8
|
-
import {
|
|
9
|
-
hasSceneMedia
|
|
10
|
-
} from "./chunk-224QNWRA.js";
|
|
11
|
-
|
|
12
|
-
// src/visual-system/scene-templates/editorial-background.tsx
|
|
13
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
-
function EditorialSurface({ children, template, ...props }) {
|
|
15
|
-
const { variables, style, width, height, progress, sceneDuration, isPlaying } = props;
|
|
16
|
-
const overMedia = hasSceneMedia(variables), u = Math.min(width, height);
|
|
17
|
-
const surface = {
|
|
18
|
-
position: "absolute",
|
|
19
|
-
inset: 0,
|
|
20
|
-
overflow: "hidden",
|
|
21
|
-
background: overMedia ? "var(--vanillasky-template-surface, #000)" : "#000",
|
|
22
|
-
fontFamily: editorialFont,
|
|
23
|
-
color: "#fff",
|
|
24
|
-
// Two soft, scale-aware shadows preserve local contrast without outlining type.
|
|
25
|
-
textShadow: overMedia ? `0 ${u * 2e-3}px ${u * 8e-3}px rgba(0,0,0,.65), 0 ${u * 6e-3}px ${u * 0.016}px rgba(0,0,0,.4)` : void 0
|
|
26
|
-
};
|
|
27
|
-
return /* @__PURE__ */ jsxs("div", { "data-template": template, style: surface, children: [
|
|
28
|
-
overMedia && /* @__PURE__ */ jsx(SceneBackground, { style, width, height, progress, sceneDuration, ...getMediaBackgroundProps(variables), mediaTreatment: "cinematic", textAnchor: "center", backgroundEffect: "none", isPlaying }),
|
|
29
|
-
children
|
|
30
|
-
] });
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
EditorialSurface
|
|
35
|
-
};
|