@pixerate/editor 0.123.0 → 0.124.1
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/agent/index.cjs +2 -2
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.js +3 -3
- package/dist/animation/index.d.cts +2 -1
- package/dist/animation/index.d.ts +2 -1
- package/dist/animation-editor/index.cjs.map +1 -1
- package/dist/animation-editor/index.d.cts +11 -733
- package/dist/animation-editor/index.d.ts +11 -733
- package/dist/animation-editor/index.js.map +1 -1
- package/dist/{bezier-C-W9LFyD.d.cts → bezier-CBzKKDjl.d.cts} +2 -66
- package/dist/{bezier-DQZE5dxA.d.ts → bezier-CWv6LQal.d.ts} +2 -66
- package/dist/{brushstrokeRender-M4S65DHT.cjs → brushstrokeRender-EELTV7U4.cjs} +8 -8
- package/dist/{brushstrokeRender-M4S65DHT.cjs.map → brushstrokeRender-EELTV7U4.cjs.map} +1 -1
- package/dist/{brushstrokeRender-CDDRSV2W.js → brushstrokeRender-LRV7GXGD.js} +3 -3
- package/dist/canvas/index.cjs +6 -6
- package/dist/canvas/index.d.cts +10 -6
- package/dist/canvas/index.d.ts +10 -6
- package/dist/canvas/index.js +1 -1
- package/dist/{chunk-SMJGE7HM.cjs → chunk-4QQZV5Y5.cjs} +512 -39
- package/dist/chunk-4QQZV5Y5.cjs.map +1 -0
- package/dist/{chunk-TVXFHE4T.js → chunk-64PYNEHJ.js} +45 -12
- package/dist/chunk-64PYNEHJ.js.map +1 -0
- package/dist/{chunk-2IW3BWRT.cjs → chunk-7LQO6OHH.cjs} +2 -2
- package/dist/{chunk-2IW3BWRT.cjs.map → chunk-7LQO6OHH.cjs.map} +1 -1
- package/dist/chunk-CN4PJHUG.cjs +234 -0
- package/dist/chunk-CN4PJHUG.cjs.map +1 -0
- package/dist/chunk-FHYDQOPC.cjs +215 -0
- package/dist/chunk-FHYDQOPC.cjs.map +1 -0
- package/dist/{chunk-KMBC4HNV.js → chunk-J67OLQUQ.js} +2 -2
- package/dist/chunk-JRXJTPES.js +215 -0
- package/dist/chunk-JRXJTPES.js.map +1 -0
- package/dist/{chunk-IPFRWILU.js → chunk-ORHMVUR6.js} +488 -15
- package/dist/chunk-ORHMVUR6.js.map +1 -0
- package/dist/{chunk-6CJRDJCU.cjs → chunk-PEHYWUVV.cjs} +176 -111
- package/dist/chunk-PEHYWUVV.cjs.map +1 -0
- package/dist/chunk-QEG3GRN2.js +234 -0
- package/dist/chunk-QEG3GRN2.js.map +1 -0
- package/dist/{chunk-6ZBR4J62.js → chunk-WATAQ2Z2.js} +79 -14
- package/dist/chunk-WATAQ2Z2.js.map +1 -0
- package/dist/{chunk-RLRUAPBJ.cjs → chunk-Z6OUCS2K.cjs} +47 -14
- package/dist/chunk-Z6OUCS2K.cjs.map +1 -0
- package/dist/effects/index.cjs +605 -0
- package/dist/effects/index.cjs.map +1 -0
- package/dist/effects/index.d.cts +163 -0
- package/dist/effects/index.d.ts +163 -0
- package/dist/effects/index.js +605 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/evaluate-2S3vSPLy.d.cts +55 -0
- package/dist/evaluate-CfmT6xA3.d.ts +55 -0
- package/dist/{export-DfjzHAJI.d.ts → export-BGtXgMJ3.d.ts} +536 -128
- package/dist/{export-Dv0-ZVrV.d.cts → export-BdfY_lH0.d.ts} +392 -5
- package/dist/{export-Dv0-ZVrV.d.ts → export-CbpjwxaI.d.cts} +392 -5
- package/dist/{export-lU5qSpHE.d.cts → export-WmYoWmLM.d.cts} +536 -128
- package/dist/flair-CxB3fOcU.d.ts +739 -0
- package/dist/flair-D7BxyBwL.d.cts +739 -0
- package/dist/gradient-KDfCvhuj.d.cts +66 -0
- package/dist/gradient-KDfCvhuj.d.ts +66 -0
- package/dist/helpers-777mC6dc.d.cts +253 -0
- package/dist/helpers-DX2_7L5t.d.ts +253 -0
- package/dist/image-editor/index.cjs +1296 -805
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +39 -182
- package/dist/image-editor/index.d.ts +39 -182
- package/dist/image-editor/index.js +497 -6
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{opentype-p8Xxf-Wh.d.ts → opentype-14PDI5D2.d.ts} +1 -1
- package/dist/{opentype-BV7wWatY.d.cts → opentype-D80AVmMu.d.cts} +1 -1
- package/dist/paint/index.cjs +2 -2
- package/dist/paint/index.d.cts +32 -10
- package/dist/paint/index.d.ts +32 -10
- package/dist/paint/index.js +1 -1
- package/dist/paint-editor/index.cjs +10 -8
- package/dist/paint-editor/index.cjs.map +1 -1
- package/dist/paint-editor/index.d.cts +11 -5
- package/dist/paint-editor/index.d.ts +11 -5
- package/dist/paint-editor/index.js +4 -2
- package/dist/paint-editor/index.js.map +1 -1
- package/dist/parameters/index.d.cts +4 -184
- package/dist/parameters/index.d.ts +4 -184
- package/dist/{pathfinder-IxcyhO00.d.cts → pathfinder-C0UoFypx.d.cts} +1 -1
- package/dist/{pathfinder-StVChJOT.d.ts → pathfinder-DjISxkUv.d.ts} +1 -1
- package/dist/{player-DrcP2xqj.d.cts → player-CBtEoU2x.d.cts} +2 -54
- package/dist/{player-DV4Jujdq.d.ts → player-cGLrngL_.d.ts} +2 -54
- package/dist/{svg-BtND4TJu.d.cts → svg-BDrjRnL1.d.cts} +3 -2
- package/dist/{svg-BfVXG7hL.d.ts → svg-C-vZ3q50.d.ts} +3 -2
- package/dist/tools/index.cjs +2 -2
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +3 -3
- package/dist/tools-C7JtLYzo.d.ts +126 -0
- package/dist/tools-DHKGHiSK.d.cts +126 -0
- package/dist/{types-fuXEme9j.d.ts → types-BcX7sCsn.d.ts} +2 -2
- package/dist/{types-DJF3Ghn5.d.cts → types-CznabG7m.d.cts} +2 -2
- package/dist/types-D3-J3TFf.d.ts +185 -0
- package/dist/types-DMcf_z4J.d.cts +185 -0
- package/dist/vector/index.d.cts +10 -10
- package/dist/vector/index.d.ts +10 -10
- package/dist/video-editor/index.cjs +749 -277
- package/dist/video-editor/index.cjs.map +1 -1
- package/dist/video-editor/index.d.cts +265 -138
- package/dist/video-editor/index.d.ts +265 -138
- package/dist/video-editor/index.js +490 -18
- package/dist/video-editor/index.js.map +1 -1
- package/dist/{warp-BjmAgQwq.d.cts → warp-CH9MM435.d.cts} +1 -1
- package/dist/{warp-Ca5fedzS.d.ts → warp-k_PdtXOG.d.ts} +1 -1
- package/package.json +6 -1
- package/skills/pixerate-image-editor/SKILL.md +7 -0
- package/skills/pixerate-image-editor/references/provider-effects.md +35 -0
- package/skills/pixerate-video-editor/SKILL.md +39 -1
- package/dist/chunk-6CJRDJCU.cjs.map +0 -1
- package/dist/chunk-6ZBR4J62.js.map +0 -1
- package/dist/chunk-IPFRWILU.js.map +0 -1
- package/dist/chunk-RLRUAPBJ.cjs.map +0 -1
- package/dist/chunk-SMJGE7HM.cjs.map +0 -1
- package/dist/chunk-TVXFHE4T.js.map +0 -1
- /package/dist/{brushstrokeRender-CDDRSV2W.js.map → brushstrokeRender-LRV7GXGD.js.map} +0 -0
- /package/dist/{chunk-KMBC4HNV.js.map → chunk-J67OLQUQ.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/effects/index.cjs","../../src/effects/conformance.ts","../../src/effects/fake.ts","../../src/effects/ui.ts"],"names":["input"],"mappings":"AAAA;AACE;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACA;ACJA,IAAM,OAAA,EAAS,CAAC,CAAA,EAAA,GAAgB,6CAAA,CAAe,EAAA,EAAI,CAAA,CAAE,KAAA,EAAO,EAAA,WAAa,MAAA,EAAQ,CAAA,QAAA,EAAW,CAAA,CAAE,IAAI,CAAA,EAAA,EAAK,CAAA,CAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/editor/editor/packages/core/dist/effects/index.cjs","sourcesContent":[null,"/**\n * `checkEffectProvider`: a conformance check any provider can run in its own tests, so editors\n * can rely on the contract (strict control schemas, valid defaults, typed errors, renderers that\n * return the size they were asked for).\n */\n\nimport { isEffectError } from './errors.js';\nimport { createEffectPixels, effectValueErrors, isEffectPixels } from './helpers.js';\nimport { EFFECT_KINDS, EFFECT_USES, type EffectDescription, type EffectPixels, type EffectProvider, type EffectSummary } from './types.js';\n\nexport interface EffectConformanceIssue {\n\teffectId?: string;\n\tmessage: string;\n}\n\nexport interface EffectConformanceOptions {\n\t/** Effects to check in depth (default: every listed effect). */\n\tids?: readonly string[];\n\t/** Also create renderers and render one small frame of each pixel effect (default true). */\n\trender?: boolean;\n\t/** Renderer size for the render check (default 8). */\n\tsize?: number;\n}\n\nconst codeOf = (e: unknown) => (isEffectError(e) ? e.code : e instanceof Error ? `untyped ${e.name}: ${e.message}` : String(e));\n\nasync function rejectsWith(code: string, run: () => unknown): Promise<string | null> {\n\ttry {\n\t\tawait run();\n\t\treturn `did not fail (expected ${code})`;\n\t} catch (e) {\n\t\tconst got = codeOf(e);\n\t\treturn got === code ? null : `failed with ${got} (expected ${code})`;\n\t}\n}\n\nfunction checkSummary(e: EffectSummary, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: e.id, message });\n\tif (!e.id || typeof e.id !== 'string') at('summary has no id');\n\tif (!e.name) at('summary has no name');\n\tif (!EFFECT_KINDS.includes(e.kind)) at(`kind \"${e.kind}\" is not one of ${EFFECT_KINDS.join(', ')}`);\n\tif (!e.category) at('summary has no category');\n\tif (!Array.isArray(e.uses) || !e.uses.length) at('summary has no uses');\n\tfor (const u of e.uses ?? []) if (!EFFECT_USES.includes(u)) at(`use \"${u}\" is not one of ${EFFECT_USES.join(', ')}`);\n\tif (typeof e.transparent !== 'boolean') at('transparent is not a boolean');\n\tif (typeof e.loop !== 'boolean') at('loop is not a boolean');\n\tif (e.duration !== undefined && !(e.duration > 0)) at('duration must be a positive number of ms when present');\n}\n\nfunction checkDescription(id: string, d: EffectDescription, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: id, message });\n\tif (d.id !== id) at(`describe(\"${id}\") returned id \"${d.id}\"`);\n\tconst c = d.controls;\n\tif (!c || c.type !== 'object') at('controls is not an object schema');\n\tif (c?.additionalProperties !== false) at('controls must set additionalProperties: false');\n\tfor (const [name, schema] of Object.entries(c?.properties ?? {})) {\n\t\tif (!schema.description || !String(schema.description).trim()) at(`control \"${name}\" has no description`);\n\t\tif (!(name in (d.defaults ?? {}))) at(`control \"${name}\" has no default`);\n\t}\n\tfor (const name of Object.keys(d.defaults ?? {})) if (!(name in (c?.properties ?? {}))) at(`default \"${name}\" is not a control`);\n\tfor (const e of effectValueErrors(d, d.defaults)) at(`default ${e.path}: ${e.message}`);\n\tfor (const p of d.presets ?? []) for (const e of effectValueErrors(d, p.values)) at(`preset \"${p.name}\" ${e.path}: ${e.message}`);\n\tfor (const input of d.inputs ?? []) {\n\t\tif (!input.name || !input.description) at('every input needs a name and a description');\n\t\tif (input.kind !== 'image' && input.kind !== 'audio') at(`input \"${input.name}\" has kind \"${input.kind}\"`);\n\t}\n\tif (d.uses.includes('filter') && !d.inputs.some((i) => i.name === 'source')) at('a filter must read an input named \"source\"');\n\tif (d.uses.includes('transition') && !(d.inputs.some((i) => i.name === 'from') && d.inputs.some((i) => i.name === 'to'))) {\n\t\tat('a transition must read inputs named \"from\" and \"to\"');\n\t}\n}\n\nfunction grey(size: number): EffectPixels {\n\tconst p = createEffectPixels(size, size);\n\tp.data.fill(128);\n\treturn p;\n}\n\nasync function checkRender(provider: EffectProvider, d: EffectDescription, size: number, issues: EffectConformanceIssue[]) {\n\tconst at = (message: string) => issues.push({ effectId: d.id, message });\n\tconst inputs = Object.fromEntries(d.inputs.filter((i) => i.kind === 'image').map((i) => [i.name, grey(size)]));\n\tlet renderer;\n\ttry {\n\t\trenderer = await provider.createRenderer(d.id, { width: size, height: size });\n\t} catch (e) {\n\t\t// A vector effect may need the host's help to become pixels (a Worker has no DOM to lay out SVG).\n\t\tif (!(d.kind === 'vector' && codeOf(e) === 'unsupported')) at(`createRenderer failed: ${codeOf(e)}`);\n\t\treturn;\n\t}\n\ttry {\n\t\tconst out = await renderer.render({ time: 0, inputs });\n\t\tif (!isEffectPixels(out)) at('render did not return EffectPixels');\n\t\telse if (out.width !== size || out.height !== size || out.data.length !== size * size * 4) at(`render returned ${out.width}×${out.height}, not ${size}×${size}`);\n\t} catch (e) {\n\t\tat(`render failed: ${codeOf(e)}`);\n\t}\n\tconst bad = await rejectsWith('invalid_values', () => renderer.render({ time: 0, inputs, values: { __not_a_control__: 1 } }));\n\tif (bad) at(`render with an unknown control ${bad}`);\n\trenderer.dispose();\n\tconst after = await rejectsWith('disposed', () => renderer.render({ time: 0, inputs }));\n\tif (after) at(`render after dispose ${after}`);\n}\n\n/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */\nexport async function checkEffectProvider(provider: EffectProvider, options: EffectConformanceOptions = {}): Promise<EffectConformanceIssue[]> {\n\tconst issues: EffectConformanceIssue[] = [];\n\tconst top = (message: string) => issues.push({ message });\n\tif (!provider.id) top('provider has no id');\n\tconst caps = provider.capabilities;\n\tfor (const k of ['supportsWorker', 'supportsFloat', 'supportsMask', 'supportsHostImages', 'supportsVector'] as const) {\n\t\tif (typeof caps?.[k] !== 'boolean') top(`capabilities.${k} is not a boolean`);\n\t}\n\tif (caps?.supportsVector && typeof provider.applyVectorEffect !== 'function') top('supportsVector is set but applyVectorEffect is missing');\n\n\tconst list = await provider.list();\n\tconst ids = new Set<string>();\n\tfor (const e of list) {\n\t\tif (ids.has(e.id)) top(`duplicate id \"${e.id}\"`);\n\t\tids.add(e.id);\n\t\tcheckSummary(e, issues);\n\t}\n\tconst all = await provider.search('');\n\tif (all.length !== list.length) top(`search(\"\") returned ${all.length} effects, list() ${list.length}`);\n\tconst firstUse = list[0]?.uses[0];\n\tif (firstUse) {\n\t\tconst filtered = await provider.search('', { use: firstUse });\n\t\tif (filtered.some((e) => !e.uses.includes(firstUse))) top(`search(\"\", { use: \"${firstUse}\" }) returned effects without that use`);\n\t}\n\tconst unknown = await rejectsWith('unknown_effect', () => provider.describe('__no_such_effect__'));\n\tif (unknown) top(`describe of an unknown id ${unknown}`);\n\tconst unknownRenderer = await rejectsWith('unknown_effect', () => provider.createRenderer('__no_such_effect__', { width: 4, height: 4 }));\n\tif (unknownRenderer) top(`createRenderer of an unknown id ${unknownRenderer}`);\n\n\tconst size = options.size ?? 8;\n\tfor (const id of options.ids ?? [...ids]) {\n\t\tlet d: EffectDescription;\n\t\ttry {\n\t\t\td = await provider.describe(id);\n\t\t} catch (e) {\n\t\t\tissues.push({ effectId: id, message: `describe failed: ${codeOf(e)}` });\n\t\t\tcontinue;\n\t\t}\n\t\tcheckDescription(id, d, issues);\n\t\tif (options.render !== false && d.kind !== 'motion') await checkRender(provider, d, size, issues);\n\t\tif ((d.kind === 'vector' || d.kind === 'motion') && caps.supportsVector && provider.applyVectorEffect) {\n\t\t\ttry {\n\t\t\t\tconst m = await provider.applyVectorEffect(id, '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10 10\"><rect id=\"r\" width=\"10\" height=\"10\"/></svg>');\n\t\t\t\tif (typeof m.svg !== 'string' || !m.svg.includes('<svg')) issues.push({ effectId: id, message: 'applyVectorEffect returned no SVG' });\n\t\t\t\tif (!(m.duration >= 0)) issues.push({ effectId: id, message: 'applyVectorEffect returned no duration' });\n\t\t\t} catch (e) {\n\t\t\t\t// The probe target is a bare <rect>; an effect that needs more (a path to follow, a fill colour) may refuse it.\n\t\t\t\tif (codeOf(e) !== 'unsupported') issues.push({ effectId: id, message: `applyVectorEffect failed: ${codeOf(e)}` });\n\t\t\t}\n\t\t\tconst bad = await rejectsWith('invalid_values', () => provider.applyVectorEffect!(id, '<svg xmlns=\"http://www.w3.org/2000/svg\"/>', { __not_a_control__: 1 }));\n\t\t\tif (bad) issues.push({ effectId: id, message: `applyVectorEffect with an unknown control ${bad}` });\n\t\t}\n\t}\n\treturn issues;\n}\n","/**\n * `createFakeEffectProvider`: a small, deterministic, CPU-only provider implementing the whole\n * contract. Tests and the demo use it; it is also a reference for real providers.\n *\n * Effects (ids prefixed `fake.`):\n * - `invert` (filter), `tint` (filter)\n * - `gradient` (generator, loops)\n * - `bar` (title / overlay: a lower-third bar that slides in, transparent)\n * - `crossfade` (transition)\n * - `fade-in` (motion, vector only)\n */\n\nimport { EffectDisposedError, EffectUnsupportedError, UnknownEffectError } from './errors.js';\nimport { createEffectPixels, encodeEffectFloat, isEffectPixels, resolveEffectValues, searchEffectSummaries, srgbToLinear } from './helpers.js';\nimport type {\n\tEffectDescription,\n\tEffectImageSource,\n\tEffectPixels,\n\tEffectProvider,\n\tEffectProviderCapabilities,\n\tEffectRenderer,\n\tEffectRendererOptions,\n\tEffectRenderRequest,\n\tEffectSummary,\n\tEffectValues,\n\tEffectVectorMotion,\n\tEffectVectorTarget\n} from './types.js';\n\nconst HEX = '^#[0-9a-fA-F]{6}$';\nconst colour = (description: string) => ({ type: 'string' as const, pattern: HEX, description });\nconst amount = (description: string) => ({ type: 'number' as const, minimum: 0, maximum: 1, description });\n\nconst DESCRIPTIONS: readonly EffectDescription[] = [\n\t{\n\t\tid: 'fake.invert',\n\t\tname: 'Invert',\n\t\tkind: 'shader',\n\t\tcategory: 'image',\n\t\tuses: ['filter'],\n\t\tdescription: 'Inverts the colours of the source.',\n\t\ttags: ['negative', 'colour'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: { amount: amount('How far to invert, 0 (unchanged) to 1 (fully inverted). Default 1.') }\n\t\t},\n\t\tdefaults: { amount: 1 },\n\t\tpresets: [{ name: 'Half', values: { amount: 0.5 } }],\n\t\tinputs: [{ name: 'source', kind: 'image', description: 'The picture to invert.', required: true }]\n\t},\n\t{\n\t\tid: 'fake.tint',\n\t\tname: 'Tint',\n\t\tkind: 'shader',\n\t\tcategory: 'image',\n\t\tuses: ['filter'],\n\t\tdescription: 'Mixes the source towards a colour.',\n\t\ttags: ['colour', 'wash'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Tint colour as #rrggbb. Default #ff8800.'),\n\t\t\t\tamount: amount('How far to mix towards the colour, 0–1. Default 0.5.')\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#ff8800', amount: 0.5 },\n\t\tpresets: [\n\t\t\t{ name: 'Sepia', values: { color: '#704214', amount: 0.4 } },\n\t\t\t{ name: 'Cool', values: { color: '#2060ff', amount: 0.25 } }\n\t\t],\n\t\tinputs: [{ name: 'source', kind: 'image', description: 'The picture to tint.', required: true }]\n\t},\n\t{\n\t\tid: 'fake.gradient',\n\t\tname: 'Gradient',\n\t\tkind: 'shader',\n\t\tcategory: 'gradient',\n\t\tuses: ['generator'],\n\t\tdescription: 'A linear gradient between two colours that can turn over time.',\n\t\ttags: ['background'],\n\t\ttransparent: false,\n\t\tloop: true,\n\t\tduration: 4000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tfrom: colour('Start colour as #rrggbb. Default #1e3a8a.'),\n\t\t\t\tto: colour('End colour as #rrggbb. Default #f472b6.'),\n\t\t\t\tangle: { type: 'number', minimum: 0, maximum: 360, description: 'Direction in degrees, 0 = left to right, 90 = top to bottom. Default 90.' },\n\t\t\t\tspin: { type: 'number', minimum: -360, maximum: 360, description: 'Turn per loop (4 s) in degrees. Default 0.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { from: '#1e3a8a', to: '#f472b6', angle: 90, spin: 0 },\n\t\tpresets: [{ name: 'Sunset', values: { from: '#f97316', to: '#7c3aed' } }],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.bar',\n\t\tname: 'Lower-third bar',\n\t\tkind: 'shader',\n\t\tcategory: 'broadcast',\n\t\tuses: ['title', 'overlay'],\n\t\tdescription: 'A coloured bar that slides in from the left in the lower third. Transparent elsewhere.',\n\t\ttags: ['lower third', 'title'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 2000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tcolor: colour('Bar colour as #rrggbb. Default #0ea5e9.'),\n\t\t\t\theight: { type: 'number', minimum: 0.02, maximum: 0.5, description: 'Bar height as a fraction of the picture height. Default 0.12.' },\n\t\t\t\tslide: { type: 'number', minimum: 0, maximum: 5000, description: 'Slide-in time (ms). Default 500.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { color: '#0ea5e9', height: 0.12, slide: 500 },\n\t\tpresets: [],\n\t\tinputs: []\n\t},\n\t{\n\t\tid: 'fake.crossfade',\n\t\tname: 'Crossfade',\n\t\tkind: 'shader',\n\t\tcategory: 'transition',\n\t\tuses: ['transition'],\n\t\tdescription: 'Dissolves from one picture to the next.',\n\t\ttags: ['dissolve', 'mix'],\n\t\ttransparent: false,\n\t\tloop: false,\n\t\tduration: 1000,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: { curve: { type: 'string', enum: ['linear', 'smooth'], description: 'Mix curve: linear, or smooth (ease in and out). Default smooth.' } }\n\t\t},\n\t\tdefaults: { curve: 'smooth' },\n\t\tpresets: [],\n\t\tinputs: [\n\t\t\t{ name: 'from', kind: 'image', description: 'The outgoing picture.', required: true },\n\t\t\t{ name: 'to', kind: 'image', description: 'The incoming picture.', required: true }\n\t\t]\n\t},\n\t{\n\t\tid: 'fake.fade-in',\n\t\tname: 'Fade in',\n\t\tkind: 'motion',\n\t\tcategory: 'morph',\n\t\tuses: ['motion'],\n\t\tdescription: 'Fades vector elements in from transparent, one after another.',\n\t\ttags: ['appear', 'entrance'],\n\t\ttransparent: true,\n\t\tloop: false,\n\t\tduration: 600,\n\t\tcontrols: {\n\t\t\ttype: 'object',\n\t\t\tadditionalProperties: false,\n\t\t\tproperties: {\n\t\t\t\tms: { type: 'number', minimum: 0, maximum: 10000, description: 'Fade time per element (ms). Default 600.' },\n\t\t\t\tstagger: { type: 'number', minimum: 0, maximum: 5000, description: 'Delay between elements (ms). Default 0.' }\n\t\t\t}\n\t\t},\n\t\tdefaults: { ms: 600, stagger: 0 },\n\t\tpresets: [{ name: 'Cascade', values: { ms: 400, stagger: 120 } }],\n\t\tinputs: []\n\t}\n];\n\nconst summaryOf = ({ controls: _c, defaults: _d, presets: _p, inputs: _i, ...summary }: EffectDescription): EffectSummary => summary;\n\nconst hexToRgb = (hex: string): [number, number, number] => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16)) as [number, number, number];\nconst smooth = (t: number) => t * t * (3 - 2 * t);\nconst clamp01 = (v: number) => (v < 0 ? 0 : v > 1 ? 1 : v);\n\nfunction input(request: EffectRenderRequest, name: string, id: string, width: number, height: number): EffectPixels {\n\tconst src: EffectImageSource | undefined = request.inputs?.[name];\n\tif (!src) throw new EffectUnsupportedError(`Effect \"${id}\" needs an input named \"${name}\".`, id);\n\tif (!isEffectPixels(src)) throw new EffectUnsupportedError(`The fake provider only takes EffectPixels inputs (\"${name}\").`, id);\n\tif (src.width !== width || src.height !== height) {\n\t\tthrow new EffectUnsupportedError(`Input \"${name}\" is ${src.width}×${src.height}; the renderer is ${width}×${height}.`, id);\n\t}\n\treturn src;\n}\n\n/** Per-pixel colour work in 8-bit sRGB; float output (when asked) is derived from it. */\nfunction renderPixels(d: EffectDescription, v: Record<string, EffectValues[string]>, request: EffectRenderRequest, width: number, height: number): EffectPixels {\n\tconst out = createEffectPixels(width, height);\n\tconst o = out.data;\n\tswitch (d.id) {\n\t\tcase 'fake.invert': {\n\t\t\tconst s = input(request, 'source', d.id, width, height).data;\n\t\t\tconst k = v.amount as number;\n\t\t\tfor (let i = 0; i < o.length; i += 4) {\n\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = s[i + c] + (255 - 2 * s[i + c]) * k;\n\t\t\t\to[i + 3] = s[i + 3];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.tint': {\n\t\t\tconst s = input(request, 'source', d.id, width, height).data;\n\t\t\tconst rgb = hexToRgb(v.color as string);\n\t\t\tconst k = v.amount as number;\n\t\t\tfor (let i = 0; i < o.length; i += 4) {\n\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = s[i + c] + (rgb[c] - s[i + c]) * k;\n\t\t\t\to[i + 3] = s[i + 3];\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.gradient': {\n\t\t\tconst a = hexToRgb(v.from as string);\n\t\t\tconst b = hexToRgb(v.to as string);\n\t\t\tconst turn = ((request.time % (d.duration ?? 4000)) / (d.duration ?? 4000)) * (v.spin as number);\n\t\t\tconst rad = (((v.angle as number) + turn) * Math.PI) / 180;\n\t\t\tconst dx = Math.cos(rad);\n\t\t\tconst dy = Math.sin(rad);\n\t\t\tconst half = (Math.abs(dx) * width + Math.abs(dy) * height) / 2 || 1;\n\t\t\tfor (let y = 0, i = 0; y < height; y++) {\n\t\t\t\tfor (let x = 0; x < width; x++, i += 4) {\n\t\t\t\t\tconst t = clamp01(((x + 0.5 - width / 2) * dx + (y + 0.5 - height / 2) * dy) / (2 * half) + 0.5);\n\t\t\t\t\tfor (let c = 0; c < 3; c++) o[i + c] = a[c] + (b[c] - a[c]) * t;\n\t\t\t\t\to[i + 3] = 255;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.bar': {\n\t\t\tconst rgb = hexToRgb(v.color as string);\n\t\t\tconst slide = v.slide as number;\n\t\t\tconst shown = slide > 0 ? smooth(clamp01(request.time / slide)) : 1;\n\t\t\tconst top = Math.round(height * (0.75 - (v.height as number) / 2));\n\t\t\tconst bottom = Math.round(height * (0.75 + (v.height as number) / 2));\n\t\t\tconst right = Math.round(width * 0.7 * shown);\n\t\t\tfor (let y = Math.max(0, top); y < Math.min(height, bottom); y++) {\n\t\t\t\tfor (let x = 0; x < right; x++) {\n\t\t\t\t\tconst i = (y * width + x) * 4;\n\t\t\t\t\to[i] = rgb[0];\n\t\t\t\t\to[i + 1] = rgb[1];\n\t\t\t\t\to[i + 2] = rgb[2];\n\t\t\t\t\to[i + 3] = 255;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'fake.crossfade': {\n\t\t\tconst from = input(request, 'from', d.id, width, height).data;\n\t\t\tconst to = input(request, 'to', d.id, width, height).data;\n\t\t\tconst p = clamp01(request.progress ?? request.time / (d.duration ?? 1000));\n\t\t\tconst k = v.curve === 'smooth' ? smooth(p) : p;\n\t\t\tfor (let i = 0; i < o.length; i++) o[i] = from[i] + (to[i] - from[i]) * k;\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tthrow new EffectUnsupportedError(`\"${d.id}\" is a ${d.kind} effect; use applyVectorEffect.`, d.id);\n\t}\n\treturn out;\n}\n\nfunction toFloat(p: EffectPixels): EffectPixels {\n\tconst f = new Float32Array(p.data.length);\n\tfor (let i = 0; i < f.length; i += 4) {\n\t\tf[i] = srgbToLinear(p.data[i] / 255);\n\t\tf[i + 1] = srgbToLinear(p.data[i + 1] / 255);\n\t\tf[i + 2] = srgbToLinear(p.data[i + 2] / 255);\n\t\tf[i + 3] = p.data[i + 3] / 255;\n\t}\n\treturn encodeEffectFloat({ ...p, float: f });\n}\n\nfunction maskResult(out: EffectPixels, mask: EffectImageSource, source: EffectPixels | undefined, id: string): void {\n\tif (!isEffectPixels(mask) || mask.width !== out.width || mask.height !== out.height) {\n\t\tthrow new EffectUnsupportedError('The mask must be EffectPixels the size of the renderer.', id);\n\t}\n\tconst o = out.data;\n\tfor (let i = 0; i < o.length; i += 4) {\n\t\tconst k = mask.data[i + 3] / 255;\n\t\tif (source) for (let c = 0; c < 4; c++) o[i + c] = source.data[i + c] + (o[i + c] - source.data[i + c]) * k;\n\t\telse o[i + 3] *= k;\n\t}\n}\n\nexport interface FakeEffectProviderOptions {\n\t/** Overrides of the capability flags, to test how editors degrade. */\n\tcapabilities?: Partial<EffectProviderCapabilities>;\n\t/** Called on every render (tests count frames with it). */\n\tonRender?: (effectId: string, request: EffectRenderRequest) => void;\n}\n\n/** A deterministic CPU effects provider with six effects (see the module comment). */\nexport function createFakeEffectProvider(options: FakeEffectProviderOptions = {}): EffectProvider {\n\tconst capabilities: EffectProviderCapabilities = {\n\t\tsupportsWorker: false,\n\t\tsupportsFloat: true,\n\t\tsupportsMask: true,\n\t\tsupportsHostImages: false,\n\t\tsupportsVector: true,\n\t\tmaxSize: 8192,\n\t\t...options.capabilities\n\t};\n\tconst byId = new Map(DESCRIPTIONS.map((d) => [d.id, d]));\n\tconst get = (id: string) => {\n\t\tconst d = byId.get(id);\n\t\tif (!d) throw new UnknownEffectError(id, 'the fake provider');\n\t\treturn d;\n\t};\n\tconst summaries = DESCRIPTIONS.map(summaryOf);\n\n\tconst provider: EffectProvider = {\n\t\tid: 'fake',\n\t\tname: 'Fake effects',\n\t\tversion: '1',\n\t\tcapabilities,\n\t\tlist: (o) => searchEffectSummaries(summaries, '', o),\n\t\tsearch: (q, o) => searchEffectSummaries(summaries, q, o),\n\t\tdescribe: (id) => structuredClone(get(id)),\n\t\tcreateRenderer(id: string, ro: EffectRendererOptions): EffectRenderer {\n\t\t\tconst d = get(id);\n\t\t\tif (d.kind === 'motion') throw new EffectUnsupportedError(`\"${id}\" is a motion effect; use applyVectorEffect.`, id);\n\t\t\tconst { width, height } = ro;\n\t\t\tconst depth = ro.depth ?? 8;\n\t\t\tif (!(width > 0 && height > 0) || width > capabilities.maxSize! || height > capabilities.maxSize!) {\n\t\t\t\tthrow new EffectUnsupportedError(`Renderer size ${width}×${height} is outside 1–${capabilities.maxSize}.`, id);\n\t\t\t}\n\t\t\tlet disposed = false;\n\t\t\treturn {\n\t\t\t\teffectId: id,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\tdepth,\n\t\t\t\tasync render(request) {\n\t\t\t\t\tif (disposed) throw new EffectDisposedError(id);\n\t\t\t\t\tif (!Number.isFinite(request.time) || request.time < 0) {\n\t\t\t\t\t\tthrow new EffectUnsupportedError(`time must be a finite number of ms ≥ 0, got ${request.time}.`, id);\n\t\t\t\t\t}\n\t\t\t\t\tconst values = resolveEffectValues(d, request.values);\n\t\t\t\t\toptions.onRender?.(id, request);\n\t\t\t\t\tconst out = renderPixels(d, values, request, width, height);\n\t\t\t\t\tif (request.mask) {\n\t\t\t\t\t\tif (!capabilities.supportsMask) throw new EffectUnsupportedError('This provider does not take masks.', id);\n\t\t\t\t\t\tconst source = d.uses.includes('filter') ? (request.inputs?.source as EffectPixels) : undefined;\n\t\t\t\t\t\tmaskResult(out, request.mask, source, id);\n\t\t\t\t\t}\n\t\t\t\t\treturn depth > 8 && capabilities.supportsFloat ? toFloat(out) : out;\n\t\t\t\t},\n\t\t\t\tdispose() {\n\t\t\t\t\tdisposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\t\tapplyVectorEffect(id: string, target: EffectVectorTarget, values?: EffectValues): EffectVectorMotion {\n\t\t\tconst d = get(id);\n\t\t\tif (d.kind !== 'motion' && d.kind !== 'vector') throw new EffectUnsupportedError(`\"${id}\" is a ${d.kind} effect, not a vector one.`, id);\n\t\t\tconst v = resolveEffectValues(d, values);\n\t\t\tconst svg = typeof target === 'string' ? target : target.svg;\n\t\t\tconst ids = typeof target === 'string' || !target.nodeIds ? [...svg.matchAll(/\\sid=\"([^\"]+)\"/g)].map((m) => m[1]) : [...target.nodeIds];\n\t\t\tconst ms = v.ms as number;\n\t\t\tconst stagger = v.stagger as number;\n\t\t\treturn {\n\t\t\t\tsvg,\n\t\t\t\tanimate: ids.map((elementId, i) => ({ id: elementId, delay: i * stagger, ms, attrs: { opacity: [0, 1] as const } })),\n\t\t\t\tduration: ms + Math.max(0, ids.length - 1) * stagger,\n\t\t\t\tloop: false\n\t\t\t};\n\t\t}\n\t};\n\treturn provider;\n}\n","/**\n * Framework-free helpers for effects UIs (the React and Svelte effects browser and parameter\n * panel): control schemas as parameter fields, preview thumbnails from a provider's renderer,\n * and labels.\n */\n\nimport type { JsonSchema } from '../tools/schema.js';\nimport type { ParameterField, ParameterValue } from '../parameters/types.js';\nimport { createEffectPixels } from './helpers.js';\nimport type { EffectDescription, EffectPixels, EffectProvider, EffectSummary, EffectUse, EffectValue } from './types.js';\n\n/** Names for the uses, for filters and badges. */\nexport const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>> = {\n\tfilter: 'Filter',\n\ttransition: 'Transition',\n\tgenerator: 'Generator',\n\toverlay: 'Overlay',\n\ttitle: 'Title',\n\tmotion: 'Motion',\n\tinteractive: 'Interactive'\n};\n\nconst HEX = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;\nconst typeOf = (s: JsonSchema) => (Array.isArray(s.type) ? s.type.find((t) => t !== 'null') : s.type);\n\n/**\n * One control as a parameter field: numbers and integers (sliders when bounded), switches,\n * choices (`enum`), colours (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.\n * `null` for a control no field can edit (objects, long lists).\n */\nexport function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null {\n\tconst base = { id: name, ...(schema.title ? { label: schema.title } : {}), ...(schema.description ? { description: schema.description } : {}) };\n\tconst def = (schema.default ?? fallback) as EffectValue | undefined;\n\tconst type = typeOf(schema);\n\tif (Array.isArray(schema.enum) && schema.enum.length) {\n\t\tconst options = schema.enum.filter((v): v is string | number => typeof v === 'string' || typeof v === 'number');\n\t\treturn { ...base, type: 'choice', options, default: (typeof def === 'string' || typeof def === 'number' ? def : options[0]) as string | number, control: options.length <= 4 ? 'segmented' : 'select' };\n\t}\n\tif (type === 'number' || type === 'integer') {\n\t\tconst min = schema.minimum ?? schema.exclusiveMinimum;\n\t\tconst max = schema.maximum ?? schema.exclusiveMaximum;\n\t\treturn { ...base, type: type === 'integer' ? 'int' : 'number', default: typeof def === 'number' ? def : (min ?? 0), ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), ...(schema.multipleOf ? { step: schema.multipleOf } : {}) };\n\t}\n\tif (type === 'boolean') return { ...base, type: 'boolean', default: def === true };\n\tif (type === 'string') {\n\t\tif (typeof def === 'string' && HEX.test(def)) return { ...base, type: 'color', alpha: def.length === 9, default: def };\n\t\treturn { ...base, type: 'text', default: typeof def === 'string' ? def : '', ...(schema.maxLength ? { maxLength: schema.maxLength } : {}) };\n\t}\n\tif (type === 'array' && Array.isArray(def) && def.length >= 2 && def.length <= 4 && def.every((n) => typeof n === 'number')) {\n\t\tconst items = schema.items ?? {};\n\t\treturn { ...base, type: 'vector', size: def.length as 2 | 3 | 4, default: [...def], ...(items.minimum !== undefined ? { min: items.minimum } : {}), ...(items.maximum !== undefined ? { max: items.maximum } : {}) };\n\t}\n\treturn null;\n}\n\n/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */\nexport function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>): ParameterField[] {\n\treturn Object.entries(description.controls.properties)\n\t\t.map(([name, schema]) => effectControlField(name, schema, description.defaults[name]))\n\t\t.filter((f): f is ParameterField => !!f);\n}\n\n/** A saved value as a field shows it (`ParameterValue`), or the field's default. */\nexport const effectFieldValue = (field: ParameterField, value: unknown): ParameterValue =>\n\tvalue === undefined || value === null || (typeof value === 'object' && !Array.isArray(value)) ? field.default : (value as ParameterValue);\n\n/**\n * A colourful, deterministic picture for previews of filters and transitions (`variant` 0 and 1\n * differ, for a transition's two sides).\n */\nexport function effectSamplePicture(width: number, height: number, variant = 0): EffectPixels {\n\tconst p = createEffectPixels(width, height);\n\tfor (let y = 0, i = 0; y < height; y++) {\n\t\tfor (let x = 0; x < width; x++, i += 4) {\n\t\t\tconst u = x / Math.max(1, width - 1);\n\t\t\tconst v = y / Math.max(1, height - 1);\n\t\t\tconst check = (Math.floor(u * 4) + Math.floor(v * 4)) % 2;\n\t\t\tif (variant === 0) p.data.set([Math.round(40 + 200 * u), Math.round(80 + 120 * v), Math.round(200 - 120 * u) + check * 30, 255], i);\n\t\t\telse p.data.set([Math.round(230 - 60 * v), Math.round(190 - 100 * u), 60 + check * 40, 255], i);\n\t\t}\n\t}\n\treturn p;\n}\n\n/**\n * A small preview of an effect from the provider's own renderer: filters run on a sample picture,\n * transitions go half way between two, generators and overlays draw at `time` (default half\n * their length, or 1 s). Thumbnails render one at a time (each renderer is disposed before the\n * next is made) and are kept per provider. Rejects like the provider does (motion effects have\n * no pixels).\n */\nexport function renderEffectThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size: { width: number; height: number } = { width: 96, height: 54 }): Promise<EffectPixels> {\n\tlet cache = thumbnails.get(provider);\n\tif (!cache) thumbnails.set(provider, (cache = new Map()));\n\tconst key = `${effect.id}@${size.width}x${size.height}`;\n\tlet out = cache.get(key);\n\tif (!out) {\n\t\t// One at a time: a browser full of previews would otherwise open a graphics context each.\n\t\tout = thumbnailQueue.then(() => renderThumbnail(provider, effect, size));\n\t\tthumbnailQueue = out.catch(() => undefined);\n\t\tout.catch(() => cache!.delete(key));\n\t\tcache.set(key, out);\n\t}\n\treturn out;\n}\n\nconst thumbnails = new WeakMap<EffectProvider, Map<string, Promise<EffectPixels>>>();\nlet thumbnailQueue: Promise<unknown> = Promise.resolve();\n\nasync function renderThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size: { width: number; height: number }): Promise<EffectPixels> {\n\tconst d = 'inputs' in effect ? effect : await provider.describe(effect.id);\n\tconst renderer = await provider.createRenderer(d.id, size);\n\ttry {\n\t\tconst time = d.duration ? d.duration / 2 : 1000;\n\t\tconst inputs: Record<string, EffectPixels> = {};\n\t\tfor (const input of d.inputs) if (input.kind === 'image') inputs[input.name] = effectSamplePicture(size.width, size.height, input.name === 'to' ? 1 : 0);\n\t\treturn await renderer.render({ time, inputs, ...(d.uses.includes('transition') ? { progress: 0.5 } : {}) });\n\t} finally {\n\t\trenderer.dispose();\n\t}\n}\n\n/** Effects grouped by category, categories in first-seen order. */\nexport function groupEffectsByCategory<T extends EffectSummary>(effects: readonly T[]): { category: string; effects: T[] }[] {\n\tconst groups = new Map<string, T[]>();\n\tfor (const e of effects) {\n\t\tconst g = groups.get(e.category);\n\t\tif (g) g.push(e);\n\t\telse groups.set(e.category, [e]);\n\t}\n\treturn [...groups].map(([category, list]) => ({ category, effects: list }));\n}\n"]}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { E as EffectProvider, b as EffectProviderCapabilities, c as EffectRenderRequest, a as EffectUse, d as EffectValue, e as EffectDescription, f as EffectPixels, g as EffectSummary } from '../helpers-777mC6dc.cjs';
|
|
2
|
+
export { h as EFFECT_KINDS, i as EFFECT_USES, j as EffectControlSchema, k as EffectImageSource, l as EffectInputSpec, m as EffectKind, n as EffectPreset, o as EffectRenderer, p as EffectRendererOptions, q as EffectSearchOptions, r as EffectSvgAnimation, s as EffectValues, t as EffectVectorMotion, u as EffectVectorTarget, v as EffectsSlot, w as applyEffectMask, x as createEffectPixels, y as effectValueErrors, z as encodeEffectFloat, A as isEffectPixels, B as linearToSrgb, C as resolveEffectValues, D as searchEffectSummaries, F as srgbToLinear } from '../helpers-777mC6dc.cjs';
|
|
3
|
+
import { S as SchemaValidationError, J as JsonSchema } from '../schema-Di0CS6Pe.cjs';
|
|
4
|
+
export { A as AppliedEffectInfo, E as EffectChangeResult, a as EffectTargetEffects, b as EffectToolContext, c as EffectToolHost, d as createEffectToolProvider } from '../tools-DHKGHiSK.cjs';
|
|
5
|
+
import { P as ParameterField, a as ParameterValue } from '../types-DMcf_z4J.cjs';
|
|
6
|
+
import '../flair-D7BxyBwL.cjs';
|
|
7
|
+
import '../behavior-Ymbld6jL.cjs';
|
|
8
|
+
import '../easing-lM0Xo9Ni.cjs';
|
|
9
|
+
import '../evaluate-2S3vSPLy.cjs';
|
|
10
|
+
import '../types-CznabG7m.cjs';
|
|
11
|
+
import '../gradient-KDfCvhuj.cjs';
|
|
12
|
+
import '../types-CwMPoRMU.cjs';
|
|
13
|
+
import '../registry-BqA1AZt0.cjs';
|
|
14
|
+
|
|
15
|
+
type EffectErrorCode = 'unknown_effect' | 'invalid_values' | 'unsupported' | 'disposed' | 'no_provider';
|
|
16
|
+
declare const EFFECT_ERROR_CODES: readonly EffectErrorCode[];
|
|
17
|
+
/**
|
|
18
|
+
* Base of every effects error. Check `code` (or use `isEffectError`) rather than `instanceof`
|
|
19
|
+
* across packages, since a provider may be bundled with its own copy of this class.
|
|
20
|
+
*/
|
|
21
|
+
declare class EffectError extends Error {
|
|
22
|
+
readonly code: EffectErrorCode;
|
|
23
|
+
readonly effectId?: string;
|
|
24
|
+
constructor(code: EffectErrorCode, message: string, effectId?: string);
|
|
25
|
+
}
|
|
26
|
+
/** No effect has this id. */
|
|
27
|
+
declare class UnknownEffectError extends EffectError {
|
|
28
|
+
constructor(effectId: string, providerName?: string);
|
|
29
|
+
}
|
|
30
|
+
/** Control values do not match the effect's control schema (unknown control, wrong type, out of range). */
|
|
31
|
+
declare class EffectControlError extends EffectError {
|
|
32
|
+
readonly details: readonly SchemaValidationError[];
|
|
33
|
+
constructor(effectId: string, details: readonly SchemaValidationError[]);
|
|
34
|
+
}
|
|
35
|
+
/** The provider cannot do this (a vector effect asked for pixels, a size above `maxSize`, a missing input...). */
|
|
36
|
+
declare class EffectUnsupportedError extends EffectError {
|
|
37
|
+
constructor(message: string, effectId?: string);
|
|
38
|
+
}
|
|
39
|
+
/** The renderer was disposed. Create a new one. */
|
|
40
|
+
declare class EffectDisposedError extends EffectError {
|
|
41
|
+
constructor(effectId: string);
|
|
42
|
+
}
|
|
43
|
+
/** No effects provider is registered with this editor. */
|
|
44
|
+
declare class NoEffectsProviderError extends EffectError {
|
|
45
|
+
constructor();
|
|
46
|
+
}
|
|
47
|
+
/** True for any effects error, including one thrown by another copy of this module. */
|
|
48
|
+
declare function isEffectError(error: unknown): error is EffectError;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* `checkEffectProvider`: a conformance check any provider can run in its own tests, so editors
|
|
52
|
+
* can rely on the contract (strict control schemas, valid defaults, typed errors, renderers that
|
|
53
|
+
* return the size they were asked for).
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
interface EffectConformanceIssue {
|
|
57
|
+
effectId?: string;
|
|
58
|
+
message: string;
|
|
59
|
+
}
|
|
60
|
+
interface EffectConformanceOptions {
|
|
61
|
+
/** Effects to check in depth (default: every listed effect). */
|
|
62
|
+
ids?: readonly string[];
|
|
63
|
+
/** Also create renderers and render one small frame of each pixel effect (default true). */
|
|
64
|
+
render?: boolean;
|
|
65
|
+
/** Renderer size for the render check (default 8). */
|
|
66
|
+
size?: number;
|
|
67
|
+
}
|
|
68
|
+
/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */
|
|
69
|
+
declare function checkEffectProvider(provider: EffectProvider, options?: EffectConformanceOptions): Promise<EffectConformanceIssue[]>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `createFakeEffectProvider`: a small, deterministic, CPU-only provider implementing the whole
|
|
73
|
+
* contract. Tests and the demo use it; it is also a reference for real providers.
|
|
74
|
+
*
|
|
75
|
+
* Effects (ids prefixed `fake.`):
|
|
76
|
+
* - `invert` (filter), `tint` (filter)
|
|
77
|
+
* - `gradient` (generator, loops)
|
|
78
|
+
* - `bar` (title / overlay: a lower-third bar that slides in, transparent)
|
|
79
|
+
* - `crossfade` (transition)
|
|
80
|
+
* - `fade-in` (motion, vector only)
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
interface FakeEffectProviderOptions {
|
|
84
|
+
/** Overrides of the capability flags, to test how editors degrade. */
|
|
85
|
+
capabilities?: Partial<EffectProviderCapabilities>;
|
|
86
|
+
/** Called on every render (tests count frames with it). */
|
|
87
|
+
onRender?: (effectId: string, request: EffectRenderRequest) => void;
|
|
88
|
+
}
|
|
89
|
+
/** A deterministic CPU effects provider with six effects (see the module comment). */
|
|
90
|
+
declare function createFakeEffectProvider(options?: FakeEffectProviderOptions): EffectProvider;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Framework-free helpers for effects UIs (the React and Svelte effects browser and parameter
|
|
94
|
+
* panel): control schemas as parameter fields, preview thumbnails from a provider's renderer,
|
|
95
|
+
* and labels.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/** Names for the uses, for filters and badges. */
|
|
99
|
+
declare const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>>;
|
|
100
|
+
/**
|
|
101
|
+
* One control as a parameter field: numbers and integers (sliders when bounded), switches,
|
|
102
|
+
* choices (`enum`), colours (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.
|
|
103
|
+
* `null` for a control no field can edit (objects, long lists).
|
|
104
|
+
*/
|
|
105
|
+
declare function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null;
|
|
106
|
+
/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */
|
|
107
|
+
declare function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>): ParameterField[];
|
|
108
|
+
/** A saved value as a field shows it (`ParameterValue`), or the field's default. */
|
|
109
|
+
declare const effectFieldValue: (field: ParameterField, value: unknown) => ParameterValue;
|
|
110
|
+
/**
|
|
111
|
+
* A colourful, deterministic picture for previews of filters and transitions (`variant` 0 and 1
|
|
112
|
+
* differ, for a transition's two sides).
|
|
113
|
+
*/
|
|
114
|
+
declare function effectSamplePicture(width: number, height: number, variant?: number): EffectPixels;
|
|
115
|
+
/**
|
|
116
|
+
* A small preview of an effect from the provider's own renderer: filters run on a sample picture,
|
|
117
|
+
* transitions go half way between two, generators and overlays draw at `time` (default half
|
|
118
|
+
* their length, or 1 s). Thumbnails render one at a time (each renderer is disposed before the
|
|
119
|
+
* next is made) and are kept per provider. Rejects like the provider does (motion effects have
|
|
120
|
+
* no pixels).
|
|
121
|
+
*/
|
|
122
|
+
declare function renderEffectThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size?: {
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
}): Promise<EffectPixels>;
|
|
126
|
+
/** Effects grouped by category, categories in first-seen order. */
|
|
127
|
+
declare function groupEffectsByCategory<T extends EffectSummary>(effects: readonly T[]): {
|
|
128
|
+
category: string;
|
|
129
|
+
effects: T[];
|
|
130
|
+
}[];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* `EffectRendererPool`: keeps a few live renderers, reused per effect, size and depth.
|
|
134
|
+
*
|
|
135
|
+
* GPU providers hold one graphics context per renderer, and browsers allow only about sixteen
|
|
136
|
+
* WebGL contexts at a time (the oldest is lost after that). So the pool keeps at most
|
|
137
|
+
* `maxRenderers` renderers. It disposes the least recently used one once its renders finish, and it
|
|
138
|
+
* runs one render at a time per renderer, as the contract requires.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
interface EffectRendererPoolOptions {
|
|
142
|
+
/** Most live renderers (default 4). */
|
|
143
|
+
maxRenderers?: number;
|
|
144
|
+
}
|
|
145
|
+
declare class EffectRendererPool {
|
|
146
|
+
private readonly entries;
|
|
147
|
+
private readonly maxRenderers;
|
|
148
|
+
constructor(options?: EffectRendererPoolOptions);
|
|
149
|
+
/** Live renderers now. */
|
|
150
|
+
get size(): number;
|
|
151
|
+
/** Renders `request` with the provider's renderer for this effect, size and depth (made on first use). */
|
|
152
|
+
render(provider: EffectProvider, id: string, size: {
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
depth?: 8 | 16 | 32;
|
|
156
|
+
}, request: EffectRenderRequest): Promise<EffectPixels>;
|
|
157
|
+
/** Disposes the least recently used renderers over the limit, after their queued renders. */
|
|
158
|
+
private evict;
|
|
159
|
+
/** Disposes every renderer (after its queued renders). */
|
|
160
|
+
clear(): void;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export { EFFECT_ERROR_CODES, EFFECT_USE_LABELS, type EffectConformanceIssue, type EffectConformanceOptions, EffectControlError, EffectDescription, EffectDisposedError, EffectError, type EffectErrorCode, EffectPixels, EffectProvider, EffectProviderCapabilities, EffectRenderRequest, EffectRendererPool, type EffectRendererPoolOptions, EffectSummary, EffectUnsupportedError, EffectUse, EffectValue, type FakeEffectProviderOptions, NoEffectsProviderError, UnknownEffectError, checkEffectProvider, createFakeEffectProvider, effectControlField, effectFieldValue, effectParameterFields, effectSamplePicture, groupEffectsByCategory, isEffectError, renderEffectThumbnail };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { E as EffectProvider, b as EffectProviderCapabilities, c as EffectRenderRequest, a as EffectUse, d as EffectValue, e as EffectDescription, f as EffectPixels, g as EffectSummary } from '../helpers-DX2_7L5t.js';
|
|
2
|
+
export { h as EFFECT_KINDS, i as EFFECT_USES, j as EffectControlSchema, k as EffectImageSource, l as EffectInputSpec, m as EffectKind, n as EffectPreset, o as EffectRenderer, p as EffectRendererOptions, q as EffectSearchOptions, r as EffectSvgAnimation, s as EffectValues, t as EffectVectorMotion, u as EffectVectorTarget, v as EffectsSlot, w as applyEffectMask, x as createEffectPixels, y as effectValueErrors, z as encodeEffectFloat, A as isEffectPixels, B as linearToSrgb, C as resolveEffectValues, D as searchEffectSummaries, F as srgbToLinear } from '../helpers-DX2_7L5t.js';
|
|
3
|
+
import { S as SchemaValidationError, J as JsonSchema } from '../schema-Di0CS6Pe.js';
|
|
4
|
+
export { A as AppliedEffectInfo, E as EffectChangeResult, a as EffectTargetEffects, b as EffectToolContext, c as EffectToolHost, d as createEffectToolProvider } from '../tools-C7JtLYzo.js';
|
|
5
|
+
import { P as ParameterField, a as ParameterValue } from '../types-D3-J3TFf.js';
|
|
6
|
+
import '../flair-CxB3fOcU.js';
|
|
7
|
+
import '../behavior-Ymbld6jL.js';
|
|
8
|
+
import '../easing-lM0Xo9Ni.js';
|
|
9
|
+
import '../evaluate-CfmT6xA3.js';
|
|
10
|
+
import '../types-BcX7sCsn.js';
|
|
11
|
+
import '../gradient-KDfCvhuj.js';
|
|
12
|
+
import '../types-CwMPoRMU.js';
|
|
13
|
+
import '../registry-D-4fit9C.js';
|
|
14
|
+
|
|
15
|
+
type EffectErrorCode = 'unknown_effect' | 'invalid_values' | 'unsupported' | 'disposed' | 'no_provider';
|
|
16
|
+
declare const EFFECT_ERROR_CODES: readonly EffectErrorCode[];
|
|
17
|
+
/**
|
|
18
|
+
* Base of every effects error. Check `code` (or use `isEffectError`) rather than `instanceof`
|
|
19
|
+
* across packages, since a provider may be bundled with its own copy of this class.
|
|
20
|
+
*/
|
|
21
|
+
declare class EffectError extends Error {
|
|
22
|
+
readonly code: EffectErrorCode;
|
|
23
|
+
readonly effectId?: string;
|
|
24
|
+
constructor(code: EffectErrorCode, message: string, effectId?: string);
|
|
25
|
+
}
|
|
26
|
+
/** No effect has this id. */
|
|
27
|
+
declare class UnknownEffectError extends EffectError {
|
|
28
|
+
constructor(effectId: string, providerName?: string);
|
|
29
|
+
}
|
|
30
|
+
/** Control values do not match the effect's control schema (unknown control, wrong type, out of range). */
|
|
31
|
+
declare class EffectControlError extends EffectError {
|
|
32
|
+
readonly details: readonly SchemaValidationError[];
|
|
33
|
+
constructor(effectId: string, details: readonly SchemaValidationError[]);
|
|
34
|
+
}
|
|
35
|
+
/** The provider cannot do this (a vector effect asked for pixels, a size above `maxSize`, a missing input...). */
|
|
36
|
+
declare class EffectUnsupportedError extends EffectError {
|
|
37
|
+
constructor(message: string, effectId?: string);
|
|
38
|
+
}
|
|
39
|
+
/** The renderer was disposed. Create a new one. */
|
|
40
|
+
declare class EffectDisposedError extends EffectError {
|
|
41
|
+
constructor(effectId: string);
|
|
42
|
+
}
|
|
43
|
+
/** No effects provider is registered with this editor. */
|
|
44
|
+
declare class NoEffectsProviderError extends EffectError {
|
|
45
|
+
constructor();
|
|
46
|
+
}
|
|
47
|
+
/** True for any effects error, including one thrown by another copy of this module. */
|
|
48
|
+
declare function isEffectError(error: unknown): error is EffectError;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* `checkEffectProvider`: a conformance check any provider can run in its own tests, so editors
|
|
52
|
+
* can rely on the contract (strict control schemas, valid defaults, typed errors, renderers that
|
|
53
|
+
* return the size they were asked for).
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
interface EffectConformanceIssue {
|
|
57
|
+
effectId?: string;
|
|
58
|
+
message: string;
|
|
59
|
+
}
|
|
60
|
+
interface EffectConformanceOptions {
|
|
61
|
+
/** Effects to check in depth (default: every listed effect). */
|
|
62
|
+
ids?: readonly string[];
|
|
63
|
+
/** Also create renderers and render one small frame of each pixel effect (default true). */
|
|
64
|
+
render?: boolean;
|
|
65
|
+
/** Renderer size for the render check (default 8). */
|
|
66
|
+
size?: number;
|
|
67
|
+
}
|
|
68
|
+
/** Runs the contract checks against `provider` and returns every issue found (empty when it conforms). */
|
|
69
|
+
declare function checkEffectProvider(provider: EffectProvider, options?: EffectConformanceOptions): Promise<EffectConformanceIssue[]>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `createFakeEffectProvider`: a small, deterministic, CPU-only provider implementing the whole
|
|
73
|
+
* contract. Tests and the demo use it; it is also a reference for real providers.
|
|
74
|
+
*
|
|
75
|
+
* Effects (ids prefixed `fake.`):
|
|
76
|
+
* - `invert` (filter), `tint` (filter)
|
|
77
|
+
* - `gradient` (generator, loops)
|
|
78
|
+
* - `bar` (title / overlay: a lower-third bar that slides in, transparent)
|
|
79
|
+
* - `crossfade` (transition)
|
|
80
|
+
* - `fade-in` (motion, vector only)
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
interface FakeEffectProviderOptions {
|
|
84
|
+
/** Overrides of the capability flags, to test how editors degrade. */
|
|
85
|
+
capabilities?: Partial<EffectProviderCapabilities>;
|
|
86
|
+
/** Called on every render (tests count frames with it). */
|
|
87
|
+
onRender?: (effectId: string, request: EffectRenderRequest) => void;
|
|
88
|
+
}
|
|
89
|
+
/** A deterministic CPU effects provider with six effects (see the module comment). */
|
|
90
|
+
declare function createFakeEffectProvider(options?: FakeEffectProviderOptions): EffectProvider;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Framework-free helpers for effects UIs (the React and Svelte effects browser and parameter
|
|
94
|
+
* panel): control schemas as parameter fields, preview thumbnails from a provider's renderer,
|
|
95
|
+
* and labels.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/** Names for the uses, for filters and badges. */
|
|
99
|
+
declare const EFFECT_USE_LABELS: Readonly<Record<EffectUse, string>>;
|
|
100
|
+
/**
|
|
101
|
+
* One control as a parameter field: numbers and integers (sliders when bounded), switches,
|
|
102
|
+
* choices (`enum`), colours (strings whose default is `#rrggbb`), vectors (2–4 numbers) and text.
|
|
103
|
+
* `null` for a control no field can edit (objects, long lists).
|
|
104
|
+
*/
|
|
105
|
+
declare function effectControlField(name: string, schema: JsonSchema, fallback: EffectValue | undefined): ParameterField | null;
|
|
106
|
+
/** An effect's controls as parameter fields, in schema order (controls no field can edit are left out). */
|
|
107
|
+
declare function effectParameterFields(description: Pick<EffectDescription, 'controls' | 'defaults'>): ParameterField[];
|
|
108
|
+
/** A saved value as a field shows it (`ParameterValue`), or the field's default. */
|
|
109
|
+
declare const effectFieldValue: (field: ParameterField, value: unknown) => ParameterValue;
|
|
110
|
+
/**
|
|
111
|
+
* A colourful, deterministic picture for previews of filters and transitions (`variant` 0 and 1
|
|
112
|
+
* differ, for a transition's two sides).
|
|
113
|
+
*/
|
|
114
|
+
declare function effectSamplePicture(width: number, height: number, variant?: number): EffectPixels;
|
|
115
|
+
/**
|
|
116
|
+
* A small preview of an effect from the provider's own renderer: filters run on a sample picture,
|
|
117
|
+
* transitions go half way between two, generators and overlays draw at `time` (default half
|
|
118
|
+
* their length, or 1 s). Thumbnails render one at a time (each renderer is disposed before the
|
|
119
|
+
* next is made) and are kept per provider. Rejects like the provider does (motion effects have
|
|
120
|
+
* no pixels).
|
|
121
|
+
*/
|
|
122
|
+
declare function renderEffectThumbnail(provider: EffectProvider, effect: EffectSummary | EffectDescription, size?: {
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
}): Promise<EffectPixels>;
|
|
126
|
+
/** Effects grouped by category, categories in first-seen order. */
|
|
127
|
+
declare function groupEffectsByCategory<T extends EffectSummary>(effects: readonly T[]): {
|
|
128
|
+
category: string;
|
|
129
|
+
effects: T[];
|
|
130
|
+
}[];
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* `EffectRendererPool`: keeps a few live renderers, reused per effect, size and depth.
|
|
134
|
+
*
|
|
135
|
+
* GPU providers hold one graphics context per renderer, and browsers allow only about sixteen
|
|
136
|
+
* WebGL contexts at a time (the oldest is lost after that). So the pool keeps at most
|
|
137
|
+
* `maxRenderers` renderers. It disposes the least recently used one once its renders finish, and it
|
|
138
|
+
* runs one render at a time per renderer, as the contract requires.
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
interface EffectRendererPoolOptions {
|
|
142
|
+
/** Most live renderers (default 4). */
|
|
143
|
+
maxRenderers?: number;
|
|
144
|
+
}
|
|
145
|
+
declare class EffectRendererPool {
|
|
146
|
+
private readonly entries;
|
|
147
|
+
private readonly maxRenderers;
|
|
148
|
+
constructor(options?: EffectRendererPoolOptions);
|
|
149
|
+
/** Live renderers now. */
|
|
150
|
+
get size(): number;
|
|
151
|
+
/** Renders `request` with the provider's renderer for this effect, size and depth (made on first use). */
|
|
152
|
+
render(provider: EffectProvider, id: string, size: {
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
depth?: 8 | 16 | 32;
|
|
156
|
+
}, request: EffectRenderRequest): Promise<EffectPixels>;
|
|
157
|
+
/** Disposes the least recently used renderers over the limit, after their queued renders. */
|
|
158
|
+
private evict;
|
|
159
|
+
/** Disposes every renderer (after its queued renders). */
|
|
160
|
+
clear(): void;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export { EFFECT_ERROR_CODES, EFFECT_USE_LABELS, type EffectConformanceIssue, type EffectConformanceOptions, EffectControlError, EffectDescription, EffectDisposedError, EffectError, type EffectErrorCode, EffectPixels, EffectProvider, EffectProviderCapabilities, EffectRenderRequest, EffectRendererPool, type EffectRendererPoolOptions, EffectSummary, EffectUnsupportedError, EffectUse, EffectValue, type FakeEffectProviderOptions, NoEffectsProviderError, UnknownEffectError, checkEffectProvider, createFakeEffectProvider, effectControlField, effectFieldValue, effectParameterFields, effectSamplePicture, groupEffectsByCategory, isEffectError, renderEffectThumbnail };
|