visualfries 0.1.10115 → 0.3.2
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 +122 -0
- package/bin/visualfries.js +1570 -0
- package/dist/DIContainer.d.ts +2 -1
- package/dist/DIContainer.js +16 -5
- package/dist/SceneBuilder.svelte.d.ts +70 -1
- package/dist/SceneBuilder.svelte.js +96 -29
- package/dist/agent/audioMixer.d.ts +34 -0
- package/dist/agent/audioMixer.js +308 -0
- package/dist/agent/broll.d.ts +35 -0
- package/dist/agent/broll.js +226 -0
- package/dist/agent/capabilities.d.ts +34 -0
- package/dist/agent/capabilities.js +246 -0
- package/dist/agent/captionScene.d.ts +23 -0
- package/dist/agent/captionScene.js +204 -0
- package/dist/agent/catalog.d.ts +24 -0
- package/dist/agent/catalog.js +67 -0
- package/dist/agent/cueFiles.d.ts +54 -0
- package/dist/agent/cueFiles.js +219 -0
- package/dist/agent/cuePresets.d.ts +7 -0
- package/dist/agent/cuePresets.js +50 -0
- package/dist/agent/deterministicMedia.d.ts +61 -0
- package/dist/agent/deterministicMedia.js +303 -0
- package/dist/agent/index.d.ts +18 -0
- package/dist/agent/index.js +18 -0
- package/dist/agent/inspectScene.d.ts +36 -0
- package/dist/agent/inspectScene.js +139 -0
- package/dist/agent/localRender.d.ts +82 -0
- package/dist/agent/localRender.js +702 -0
- package/dist/agent/overlays.d.ts +40 -0
- package/dist/agent/overlays.js +325 -0
- package/dist/agent/productionPlan.d.ts +131 -0
- package/dist/agent/productionPlan.js +322 -0
- package/dist/agent/renderPlan.d.ts +27 -0
- package/dist/agent/renderPlan.js +68 -0
- package/dist/agent/renderRanges.d.ts +24 -0
- package/dist/agent/renderRanges.js +73 -0
- package/dist/agent/runtimeSupport.d.ts +19 -0
- package/dist/agent/runtimeSupport.js +192 -0
- package/dist/agent/streamingEncoder.d.ts +31 -0
- package/dist/agent/streamingEncoder.js +208 -0
- package/dist/agent/transcripts.d.ts +29 -0
- package/dist/agent/transcripts.js +146 -0
- package/dist/agent/transitions.d.ts +20 -0
- package/dist/agent/transitions.js +169 -0
- package/dist/animations/PixiAnimationTarget.d.ts +29 -0
- package/dist/animations/PixiAnimationTarget.js +63 -0
- package/dist/animations/builders/LineHighlighterAnimationBuilder.js +20 -3
- package/dist/animations/builders/WordHighlighterAnimationBuilder.js +15 -2
- package/dist/browser/browserExport.d.ts +73 -0
- package/dist/browser/browserExport.js +180 -0
- package/dist/browser/glTransitions.d.ts +37 -0
- package/dist/browser/glTransitions.js +261 -0
- package/dist/browser/index.d.ts +3 -0
- package/dist/browser/index.js +3 -0
- package/dist/browser/mediaDecode.d.ts +31 -0
- package/dist/browser/mediaDecode.js +152 -0
- package/dist/builders/PixiComponentBuilder.d.ts +6 -0
- package/dist/builders/PixiComponentBuilder.js +12 -0
- package/dist/builders/_ComponentState.svelte.d.ts +7 -5
- package/dist/builders/_ComponentState.svelte.js +29 -15
- package/dist/builders/html/StyleBuilder.js +9 -8
- package/dist/builders/html/TextComponentHtmlBuilder.js +4 -2
- package/dist/builders/html/processors/AppearanceStyleProcessor.js +1 -1
- package/dist/builders/html/processors/TextAppearanceStyleProcessor.js +7 -0
- package/dist/builders/html/processors/TextEffectsStyleProcessor.js +32 -13
- package/dist/commands/ReplaceSourceOnTimeCommand.js +9 -1
- package/dist/commands/SeekCommand.js +19 -6
- package/dist/components/AnimatedGIF.d.ts +3 -0
- package/dist/components/AnimatedGIF.js +28 -1
- package/dist/components/Component.svelte.d.ts +5 -5
- package/dist/components/Component.svelte.js +29 -13
- package/dist/components/ComponentContext.svelte.js +68 -23
- package/dist/components/hooks/AnimationHook.js +1 -1
- package/dist/components/hooks/CanvasFillHook.d.ts +12 -0
- package/dist/components/hooks/CanvasFillHook.js +75 -0
- package/dist/components/hooks/DeterministicMediaFrameHook.js +3 -0
- package/dist/components/hooks/HtmlTextHook.js +11 -3
- package/dist/components/hooks/HtmlToCanvasHook.js +8 -25
- package/dist/components/hooks/MediaHook.js +172 -47
- package/dist/components/hooks/MediaSeekingHook.js +138 -88
- package/dist/components/hooks/PixiGifHook.js +4 -4
- package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.d.ts +3 -0
- package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.js +85 -8
- package/dist/components/hooks/PixiVideoTextureHook.js +10 -4
- package/dist/components/hooks/PixiVisualTransformHook.d.ts +16 -0
- package/dist/components/hooks/PixiVisualTransformHook.js +102 -0
- package/dist/components/hooks/SubtitlesHook.js +48 -24
- package/dist/components/hooks/VerifyMediaHook.js +2 -2
- package/dist/directors/ComponentDirector.d.ts +1 -0
- package/dist/directors/ComponentDirector.js +41 -8
- package/dist/factories/SceneBuilderFactory.d.ts +3 -0
- package/dist/factories/SceneBuilderFactory.js +6 -0
- package/dist/fonts/fontDiscovery.js +12 -1
- package/dist/layers/Layer.svelte.d.ts +54 -0
- package/dist/layers/Layer.svelte.js +2 -25
- package/dist/managers/AppManager.svelte.d.ts +12 -0
- package/dist/managers/AppManager.svelte.js +180 -8
- package/dist/managers/ComponentsManager.svelte.d.ts +7 -7
- package/dist/managers/ComponentsManager.svelte.js +29 -15
- package/dist/managers/DeterministicMediaManager.d.ts +6 -0
- package/dist/managers/DeterministicMediaManager.js +57 -3
- package/dist/managers/EventManager.js +3 -1
- package/dist/managers/LayersManager.svelte.d.ts +54 -0
- package/dist/managers/RenderManager.d.ts +5 -0
- package/dist/managers/RenderManager.js +67 -21
- package/dist/managers/StateManager.svelte.d.ts +56 -0
- package/dist/managers/StateManager.svelte.js +60 -58
- package/dist/managers/SubtitlesManager.svelte.js +1 -3
- package/dist/managers/TimeManager.svelte.d.ts +4 -0
- package/dist/managers/TimeManager.svelte.js +23 -7
- package/dist/schemas/runtime/deterministic.d.ts +3 -0
- package/dist/schemas/runtime/deterministic.js +5 -1
- package/dist/schemas/runtime/types.d.ts +36 -15
- package/dist/schemas/scene/components.d.ts +126 -0
- package/dist/schemas/scene/components.js +11 -0
- package/dist/schemas/scene/core.d.ts +109 -10
- package/dist/schemas/scene/core.js +1 -1
- package/dist/utils/mediaWindow.d.ts +13 -0
- package/dist/utils/mediaWindow.js +25 -0
- package/dist/utils/svgGenerator.js +1 -1
- package/dist/utils/timelineWindow.d.ts +2 -0
- package/dist/utils/timelineWindow.js +7 -0
- package/dist/utils/utils.js +2 -4
- package/docs/AGENT_PATTERNS.md +243 -0
- package/docs/AGENT_WORKFLOW.md +364 -0
- package/docs/AUTHORING_BEST_PRACTICES.md +188 -0
- package/docs/AUTHORING_SYSTEM_AUDIT.md +98 -0
- package/docs/BROWSER_EXPORT_SPIKE.md +55 -0
- package/docs/DETERMINISTIC_RENDERER.md +83 -0
- package/docs/NEXT_RELEASE.md +28 -0
- package/docs/PROPOSED_VISUALFRIES_SKILL.md +68 -0
- package/docs/examples/agent-cues.json +49 -0
- package/docs/examples/agent-transcript.json +23 -0
- package/docs/examples/agent-transcript.srt +7 -0
- package/docs/examples/agent-transcript.vtt +7 -0
- package/docs/examples/image-animation.json +87 -0
- package/docs/examples/native-text-metric-badge.json +109 -0
- package/package.json +133 -100
- package/skills/visualfries/SKILL.md +328 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ComponentCapability } from './capabilities.js';
|
|
2
|
+
export type SceneInspectionIssue = {
|
|
3
|
+
level: 'error' | 'warning';
|
|
4
|
+
type: string;
|
|
5
|
+
code?: string;
|
|
6
|
+
capabilityId?: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
message: string;
|
|
9
|
+
componentId?: string;
|
|
10
|
+
layerId?: string;
|
|
11
|
+
};
|
|
12
|
+
export type SceneInspectionReport = {
|
|
13
|
+
valid: boolean;
|
|
14
|
+
schemaValid: boolean;
|
|
15
|
+
runtimeSupported: boolean;
|
|
16
|
+
issues: SceneInspectionIssue[];
|
|
17
|
+
components: Array<{
|
|
18
|
+
id: string;
|
|
19
|
+
layerId: string;
|
|
20
|
+
type: string;
|
|
21
|
+
capability?: ComponentCapability;
|
|
22
|
+
}>;
|
|
23
|
+
summary: {
|
|
24
|
+
duration: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
layers: number;
|
|
28
|
+
components: number;
|
|
29
|
+
runtimeWarnings: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export type InspectSceneOptions = {
|
|
33
|
+
strictRuntimeSupport?: boolean;
|
|
34
|
+
includeCapabilities?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function inspectScene(input: unknown, options?: InspectSceneOptions): SceneInspectionReport;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { SceneShape } from '../schemas/scene/index.js';
|
|
2
|
+
import { getComponentCapability } from './capabilities.js';
|
|
3
|
+
import { analyzeRuntimeSupport } from './runtimeSupport.js';
|
|
4
|
+
export function inspectScene(input, options = {}) {
|
|
5
|
+
const parsed = SceneShape.safeParse(input);
|
|
6
|
+
if (!parsed.success) {
|
|
7
|
+
return {
|
|
8
|
+
valid: false,
|
|
9
|
+
schemaValid: false,
|
|
10
|
+
runtimeSupported: false,
|
|
11
|
+
issues: [
|
|
12
|
+
{
|
|
13
|
+
level: 'error',
|
|
14
|
+
type: 'schema',
|
|
15
|
+
message: parsed.error.message
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
components: [],
|
|
19
|
+
summary: { duration: 0, width: 0, height: 0, layers: 0, components: 0, runtimeWarnings: 0 }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const scene = parsed.data;
|
|
23
|
+
const issues = [];
|
|
24
|
+
const assetIds = new Set((scene.assets ?? []).map((asset) => asset.id));
|
|
25
|
+
let components = 0;
|
|
26
|
+
const componentReports = [];
|
|
27
|
+
for (const layer of scene.layers ?? []) {
|
|
28
|
+
for (const component of layer.components ?? []) {
|
|
29
|
+
components += 1;
|
|
30
|
+
componentReports.push({
|
|
31
|
+
id: component.id,
|
|
32
|
+
layerId: layer.id,
|
|
33
|
+
type: component.type,
|
|
34
|
+
...(options.includeCapabilities === false
|
|
35
|
+
? {}
|
|
36
|
+
: { capability: getComponentCapability(component.type) })
|
|
37
|
+
});
|
|
38
|
+
if (component.timeline.endAt > scene.settings.duration) {
|
|
39
|
+
issues.push({
|
|
40
|
+
level: 'warning',
|
|
41
|
+
type: 'timeline-outside-scene',
|
|
42
|
+
message: `Component ends after scene duration (${component.timeline.endAt}s > ${scene.settings.duration}s).`,
|
|
43
|
+
componentId: component.id,
|
|
44
|
+
layerId: layer.id
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if ('source' in component &&
|
|
48
|
+
component.source?.assetId &&
|
|
49
|
+
!assetIds.has(component.source.assetId)) {
|
|
50
|
+
issues.push({
|
|
51
|
+
level: 'warning',
|
|
52
|
+
type: 'missing-asset',
|
|
53
|
+
message: `Component references asset "${component.source.assetId}" that is not in scene.assets.`,
|
|
54
|
+
componentId: component.id,
|
|
55
|
+
layerId: layer.id
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (component.type === 'SUBTITLES') {
|
|
59
|
+
const assetId = component.timingAnchor.assetId ?? component.source?.assetId;
|
|
60
|
+
const languageCode = component.source?.languageCode;
|
|
61
|
+
if (!assetId) {
|
|
62
|
+
issues.push({
|
|
63
|
+
level: 'error',
|
|
64
|
+
type: 'subtitle-anchor-missing',
|
|
65
|
+
message: 'Subtitles component needs timingAnchor.assetId or source.assetId.',
|
|
66
|
+
componentId: component.id,
|
|
67
|
+
layerId: layer.id
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else if (!scene.settings.subtitles?.data?.[assetId]) {
|
|
71
|
+
issues.push({
|
|
72
|
+
level: 'warning',
|
|
73
|
+
type: 'subtitle-data-missing',
|
|
74
|
+
message: `No scene.settings.subtitles.data entry found for "${assetId}".`,
|
|
75
|
+
componentId: component.id,
|
|
76
|
+
layerId: layer.id
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else if (languageCode &&
|
|
80
|
+
(!scene.settings.subtitles.data[assetId]?.[languageCode] ||
|
|
81
|
+
scene.settings.subtitles.data[assetId][languageCode].length === 0)) {
|
|
82
|
+
issues.push({
|
|
83
|
+
level: 'warning',
|
|
84
|
+
type: 'subtitle-language-data-missing',
|
|
85
|
+
message: `No subtitle data found for asset "${assetId}" and language "${languageCode}". Runtime may fall back to another language.`,
|
|
86
|
+
componentId: component.id,
|
|
87
|
+
layerId: layer.id
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const runtime = analyzeRuntimeSupport(scene, {
|
|
94
|
+
mode: (options.strictRuntimeSupport ? 'strict' : 'warn')
|
|
95
|
+
});
|
|
96
|
+
issues.push(...runtime.issues);
|
|
97
|
+
const rawRuntimeIssues = [];
|
|
98
|
+
const rawLayers = input?.layers;
|
|
99
|
+
if (Array.isArray(rawLayers)) {
|
|
100
|
+
for (const [layerIndex, rawLayer] of rawLayers.entries()) {
|
|
101
|
+
const layer = rawLayer;
|
|
102
|
+
if (!Array.isArray(layer.components))
|
|
103
|
+
continue;
|
|
104
|
+
for (const [componentIndex, rawComponent] of layer.components.entries()) {
|
|
105
|
+
const component = rawComponent;
|
|
106
|
+
if (component.appearance?.clipColor === undefined &&
|
|
107
|
+
component.appearance?.text?.clipColor === undefined) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
rawRuntimeIssues.push({
|
|
111
|
+
level: options.strictRuntimeSupport ? 'error' : 'warning',
|
|
112
|
+
type: 'runtime-support',
|
|
113
|
+
code: 'runtime-text-clip-color-unsupported',
|
|
114
|
+
capabilityId: `component.${component.type ?? 'TEXT'}.text.clipColor`,
|
|
115
|
+
path: `layers.${layerIndex}.components.${componentIndex}.appearance.text.clipColor`,
|
|
116
|
+
message: 'clipColor has no defined VisualFries runtime semantics and would otherwise be stripped during parsing.',
|
|
117
|
+
componentId: component.id,
|
|
118
|
+
layerId: layer.id
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
issues.push(...rawRuntimeIssues);
|
|
124
|
+
return {
|
|
125
|
+
valid: !issues.some((issue) => issue.level === 'error'),
|
|
126
|
+
schemaValid: true,
|
|
127
|
+
runtimeSupported: runtime.supported && rawRuntimeIssues.length === 0,
|
|
128
|
+
issues,
|
|
129
|
+
components: componentReports,
|
|
130
|
+
summary: {
|
|
131
|
+
duration: scene.settings.duration,
|
|
132
|
+
width: scene.settings.width,
|
|
133
|
+
height: scene.settings.height,
|
|
134
|
+
layers: scene.layers.length,
|
|
135
|
+
components,
|
|
136
|
+
runtimeWarnings: runtime.issues.length + rawRuntimeIssues.length
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type AgentRenderPlan } from './renderPlan.js';
|
|
2
|
+
export type LocalRenderModulePaths = {
|
|
3
|
+
vite?: string;
|
|
4
|
+
svelteVitePlugin?: string;
|
|
5
|
+
playwright?: string;
|
|
6
|
+
nodeModules?: string;
|
|
7
|
+
};
|
|
8
|
+
export type LocalRenderOptions = {
|
|
9
|
+
scene: unknown;
|
|
10
|
+
output: string;
|
|
11
|
+
framesOnly?: boolean;
|
|
12
|
+
frameIndices: number[];
|
|
13
|
+
fps: number;
|
|
14
|
+
imageFormat?: 'png' | 'jpg' | 'jpeg';
|
|
15
|
+
imageQuality?: number;
|
|
16
|
+
audioOverride?: string;
|
|
17
|
+
keepFrames?: boolean;
|
|
18
|
+
skipDuplicates?: boolean;
|
|
19
|
+
streamEncode?: boolean;
|
|
20
|
+
crf?: number;
|
|
21
|
+
preset?: string;
|
|
22
|
+
renderPlan?: AgentRenderPlan;
|
|
23
|
+
tmpDir?: string;
|
|
24
|
+
packageRoot?: string;
|
|
25
|
+
modulePaths?: LocalRenderModulePaths;
|
|
26
|
+
chromiumPath?: string;
|
|
27
|
+
serverRendererMode?: 'canvas' | 'webgl';
|
|
28
|
+
preferWebGL2?: boolean;
|
|
29
|
+
powerPreference?: 'default' | 'high-performance' | 'low-power';
|
|
30
|
+
mediaDiagnostics?: boolean;
|
|
31
|
+
explain?: Array<{
|
|
32
|
+
componentId: string;
|
|
33
|
+
frame: number;
|
|
34
|
+
}>;
|
|
35
|
+
environment?: 'client' | 'server';
|
|
36
|
+
};
|
|
37
|
+
export type LocalRenderResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
scene: {
|
|
40
|
+
id: string;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
duration: number;
|
|
44
|
+
fps: number;
|
|
45
|
+
};
|
|
46
|
+
frames: {
|
|
47
|
+
count: number;
|
|
48
|
+
dir: string;
|
|
49
|
+
items: Array<{
|
|
50
|
+
frame: number;
|
|
51
|
+
time: number;
|
|
52
|
+
path: string | null;
|
|
53
|
+
isDuplicate: boolean;
|
|
54
|
+
}>;
|
|
55
|
+
transport: 'range-binding' | 'sparse-evaluate' | 'range-binding-stream-encode';
|
|
56
|
+
skippedDuplicates: number;
|
|
57
|
+
};
|
|
58
|
+
output: string;
|
|
59
|
+
encoded: boolean;
|
|
60
|
+
encoding: {
|
|
61
|
+
mode: 'none' | 'frame-sequence';
|
|
62
|
+
} | {
|
|
63
|
+
mode: 'image2pipe';
|
|
64
|
+
elapsedMs: number;
|
|
65
|
+
audioMuxed: boolean;
|
|
66
|
+
};
|
|
67
|
+
audio: {
|
|
68
|
+
mode: 'none' | 'override' | 'mixed' | 'primary-fallback';
|
|
69
|
+
selectedSources: number;
|
|
70
|
+
skippedSources: number;
|
|
71
|
+
plannedSources: number;
|
|
72
|
+
path?: string;
|
|
73
|
+
};
|
|
74
|
+
mediaDiagnosticsPath: string | null;
|
|
75
|
+
mediaDiagnostics: Array<Record<string, unknown>>;
|
|
76
|
+
explanations?: Array<Record<string, unknown> | null>;
|
|
77
|
+
runtimeErrors?: string[];
|
|
78
|
+
};
|
|
79
|
+
export declare const localPathFromUrl: (value: string | undefined) => string | undefined;
|
|
80
|
+
export declare const eventEmitter3ShimSource = "export default class EventEmitter{constructor(){this._events=new Map();}_add(name,fn,context,once){if(typeof fn!=='function')throw new TypeError('The listener must be a function');const list=this._events.get(name)||[];list.push({fn,context:context===undefined?this:context,once});this._events.set(name,list);return this;}on(name,fn,context){return this._add(name,fn,context,false);}addListener(name,fn,context){return this.on(name,fn,context);}once(name,fn,context){return this._add(name,fn,context,true);}off(name,fn,context,once){return this.removeListener(name,fn,context,once);}removeListener(name,fn,context,once){const list=this._events.get(name);if(!list)return this;if(fn===undefined){this._events.delete(name);return this;}const next=list.filter((listener)=>listener.fn!==fn||(context!==undefined&&listener.context!==context)||(once!==undefined&&listener.once!==once));if(next.length)this._events.set(name,next);else this._events.delete(name);return this;}removeAllListeners(name){if(name===undefined)this._events.clear();else this._events.delete(name);return this;}emit(name,...args){const list=this._events.get(name);if(!list?.length)return false;for(const listener of [...list]){if(listener.once)this.removeListener(name,listener.fn,listener.context,true);listener.fn.apply(listener.context,args);}return true;}listeners(name){return (this._events.get(name)||[]).map((listener)=>listener.fn);}listenerCount(name){return this._events.get(name)?.length||0;}eventNames(){return [...this._events.keys()];}}\nexport { EventEmitter };\n";
|
|
81
|
+
export declare const normalizeImageQuality: (value: number | undefined, fallback?: number) => number;
|
|
82
|
+
export declare function renderSceneLocally(options: LocalRenderOptions): Promise<LocalRenderResult>;
|