pixi-effects 0.47.5 → 0.48.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/CHANGELOG.md +15 -0
- package/README.md +8 -6
- package/ai/chat-template.html +3 -3
- package/dist/Composition-BOLWGT2R.js +7 -0
- package/dist/{Composition-ZCRJHBB5.js.map → Composition-BOLWGT2R.js.map} +1 -1
- package/dist/Composition-ZZEOEETS.cjs +16 -0
- package/dist/{Composition-PMWLJQPI.cjs.map → Composition-ZZEOEETS.cjs.map} +1 -1
- package/dist/Controller.cjs +3 -0
- package/dist/Controller.cjs.map +1 -1
- package/dist/Controller.js +3 -0
- package/dist/Controller.js.map +1 -1
- package/dist/{Spans-KTUPDFSR.cjs → Spans-MWYFG7RI.cjs} +9 -9
- package/dist/{Spans-KTUPDFSR.cjs.map → Spans-MWYFG7RI.cjs.map} +1 -1
- package/dist/{Spans-FMAVPATS.js → Spans-PGXRMD6J.js} +4 -4
- package/dist/{Spans-FMAVPATS.js.map → Spans-PGXRMD6J.js.map} +1 -1
- package/dist/{chunk-UI7CEUTP.js → chunk-AJWUCFGM.js} +3 -3
- package/dist/{chunk-UI7CEUTP.js.map → chunk-AJWUCFGM.js.map} +1 -1
- package/dist/{chunk-LHUIEFMH.js → chunk-IY5YTIK3.js} +56 -41
- package/dist/chunk-IY5YTIK3.js.map +1 -0
- package/dist/chunk-K3XOEC3C.js +53 -0
- package/dist/chunk-K3XOEC3C.js.map +1 -0
- package/dist/{chunk-4PYVHLIK.js → chunk-L3MEZZAV.js} +17 -14
- package/dist/chunk-L3MEZZAV.js.map +1 -0
- package/dist/{chunk-2AT5WSSV.cjs → chunk-L3XC464G.cjs} +101 -86
- package/dist/chunk-L3XC464G.cjs.map +1 -0
- package/dist/{chunk-OGLRSR6C.cjs → chunk-M2LFQY2E.cjs} +63 -63
- package/dist/{chunk-OGLRSR6C.cjs.map → chunk-M2LFQY2E.cjs.map} +1 -1
- package/dist/{chunk-ECLBZV4N.cjs → chunk-V3VBHSK6.cjs} +17 -14
- package/dist/chunk-V3VBHSK6.cjs.map +1 -0
- package/dist/chunk-VQXZ2NOI.cjs +56 -0
- package/dist/chunk-VQXZ2NOI.cjs.map +1 -0
- package/dist/index.cjs +38 -33
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +4 -3
- package/dist/loader.css +1 -1
- package/dist/present.cjs +4 -3
- package/dist/present.cjs.map +1 -1
- package/dist/present.js +4 -3
- package/dist/present.js.map +1 -1
- package/dist/three.cjs +5 -5
- package/dist/three.js +1 -1
- package/docs/api.md +15 -0
- package/llms-full.txt +17 -2
- package/package.json +1 -1
- package/skills/pixi-effects/SKILL.md +1 -1
- package/skills/pixi-effects/reference/pitfalls.md +1 -1
- package/skills/pixi-effects/template.html +6 -6
- package/dist/Composition-PMWLJQPI.cjs +0 -16
- package/dist/Composition-ZCRJHBB5.js +0 -7
- package/dist/chunk-2AT5WSSV.cjs.map +0 -1
- package/dist/chunk-4PYVHLIK.js.map +0 -1
- package/dist/chunk-ECLBZV4N.cjs.map +0 -1
- package/dist/chunk-LHUIEFMH.js.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// src/core/mediabunny.ts
|
|
2
|
+
var source = null;
|
|
3
|
+
var pending = null;
|
|
4
|
+
function useMediabunny(from) {
|
|
5
|
+
if (from == null || typeof from !== "string" && typeof from !== "function" && typeof from !== "object") {
|
|
6
|
+
throw new TypeError(`pixi-effects: useMediabunny() takes the mediabunny module, a URL or a function that returns the module; it got ${String(from)}`);
|
|
7
|
+
}
|
|
8
|
+
source = from;
|
|
9
|
+
pending = null;
|
|
10
|
+
}
|
|
11
|
+
function loadMediabunny() {
|
|
12
|
+
if (!pending) {
|
|
13
|
+
const from = source;
|
|
14
|
+
const p = fetchModule(from).then(
|
|
15
|
+
(mod) => {
|
|
16
|
+
if (!mod || typeof mod.Output !== "function") {
|
|
17
|
+
throw new Error(`pixi-effects: ${describe(from)} did not give the mediabunny module (no Output in it). ${HOW}`);
|
|
18
|
+
}
|
|
19
|
+
return mod;
|
|
20
|
+
},
|
|
21
|
+
(err) => {
|
|
22
|
+
const why = err instanceof Error ? err.message : String(err);
|
|
23
|
+
throw new Error(`pixi-effects: could not load mediabunny from ${describe(from)} (${why}). ${HOW}`, { cause: err });
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
pending = p;
|
|
27
|
+
p.catch(() => {
|
|
28
|
+
if (pending === p) pending = null;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return pending;
|
|
32
|
+
}
|
|
33
|
+
var HOW = 'mediabunny is needed to export (movie.render(), the download button) and for a video layer; playing needs nothing. Add it to the import map ("mediabunny": "https://cdn.jsdelivr.net/npm/mediabunny@1/+esm"), install it next to pixi-effects, or call useMediabunny(module | url | () => import(...)) before you export.';
|
|
34
|
+
function fetchModule(from) {
|
|
35
|
+
if (from === null) return import('mediabunny');
|
|
36
|
+
if (typeof from === "string") return import(
|
|
37
|
+
/* @vite-ignore */
|
|
38
|
+
/* webpackIgnore: true */
|
|
39
|
+
from
|
|
40
|
+
);
|
|
41
|
+
if (typeof from === "function") return Promise.resolve().then(from);
|
|
42
|
+
return Promise.resolve(from);
|
|
43
|
+
}
|
|
44
|
+
function describe(from) {
|
|
45
|
+
if (from === null) return "'mediabunny' (the bare name: an import map or a bundler resolves it)";
|
|
46
|
+
if (typeof from === "string") return from;
|
|
47
|
+
if (typeof from === "function") return "the function given to useMediabunny()";
|
|
48
|
+
return "the object given to useMediabunny()";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { loadMediabunny, useMediabunny };
|
|
52
|
+
//# sourceMappingURL=chunk-K3XOEC3C.js.map
|
|
53
|
+
//# sourceMappingURL=chunk-K3XOEC3C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/mediabunny.ts"],"names":[],"mappings":";AAeA,IAAI,MAAA,GAAkC,IAAA;AACtC,IA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,GAAU,IAAA;AAAA,IAAM,CAAC,CAAA;AAAA,EACtD;AACA,EAAA,OAAO,OAAA;AACT;AAEA,IAAM,GAAA,GAAM,2TAAA;AAIZ,SAAS,YAAY,IAAA,EAA0D;AAC7E,EAAA,IAAI,IAAA,KAAS,IAAA,EAAM,OAAO,OAAO,YAAY,CAAA;AAC7C,EAAA,IAAI,OAAO,IAAA,KAAS,QAAA,EAAU,OAAO;AAAA;AAAA;AAAA,IAAoD;AAAA,GAAA;AACzF,EAAA,IAAI,OAAO,SAAS,UAAA,EAAY,OAAO,QAAQ,OAAA,EAAQ,CAAE,KAAK,IAAI,CAAA;AAClE,EAAA,OAAO,OAAA,CAAQ,QAAQ,IAAI,CAAA;AAC7B;AAEA,SAAS,SAAS,IAAA,EAAuC;AACvD,EAAA,IAAI,IAAA,KAAS,MAAM,OAAO,sEAAA;AAC1B,EAAA,IAAI,OAAO,IAAA,KAAS,QAAA,EAAU,OAAO,IAAA;AACrC,EAAA,IAAI,OAAO,IAAA,KAAS,UAAA,EAAY,OAAO,uCAAA;AACvC,EAAA,OAAO,qCAAA;AACT","file":"chunk-K3XOEC3C.js","sourcesContent":["// mediabunny (about 180 KB gzipped) is what writes a video file and decodes a `video` layer. A page that only plays never needs it, so it is\n// fetched the first time something asks for it: `movie.render()`, a video asset. Nothing imports it at the top of a module.\nimport type * as Mediabunny from 'mediabunny';\n\n/** The mediabunny module, as `import * as mb from 'mediabunny'` gives it. */\nexport type MediabunnyModule = typeof Mediabunny;\n\n/**\n * Where mediabunny comes from, for {@link useMediabunny}:\n * - the module itself (`import * as mb from 'mediabunny'`: it is ready, nothing is fetched),\n * - a URL to `import()` (a page with no import map entry for it),\n * - a function that returns the module (`() => import('mediabunny')`, your own copy, a bundler chunk).\n */\nexport type MediabunnySource = MediabunnyModule | string | (() => Promise<MediabunnyModule>);\n\nlet source: MediabunnySource | null = null;\nlet pending: Promise<MediabunnyModule> | null = null;\n\n/**\n * Says where mediabunny comes from. Without it, the bare name `'mediabunny'` is imported the first time it is needed, which your bundler or the\n * page's import map resolves. A page that only plays (no export, no `video` layer) needs neither this nor an import map entry for it.\n * Calling it again replaces the source for the next load; a module that was already loaded stays in use by what holds it.\n */\nexport function useMediabunny(from: MediabunnySource): void {\n if (from == null || (typeof from !== 'string' && typeof from !== 'function' && typeof from !== 'object')) {\n throw new TypeError(`pixi-effects: useMediabunny() takes the mediabunny module, a URL or a function that returns the module; it got ${String(from)}`);\n }\n source = from;\n pending = null;\n}\n\n/** The mediabunny module, fetched once (the first call starts it; later calls share it). A failed load is tried again on the next call. */\nexport function loadMediabunny(): Promise<MediabunnyModule> {\n if (!pending) {\n const from = source;\n const p = fetchModule(from).then(\n (mod) => {\n if (!mod || typeof (mod as { Output?: unknown }).Output !== 'function') {\n throw new Error(`pixi-effects: ${describe(from)} did not give the mediabunny module (no Output in it). ${HOW}`);\n }\n return mod;\n },\n (err: unknown) => {\n const why = err instanceof Error ? err.message : String(err);\n throw new Error(`pixi-effects: could not load mediabunny from ${describe(from)} (${why}). ${HOW}`, { cause: err });\n },\n );\n pending = p;\n p.catch(() => { if (pending === p) pending = null; }); // the next call tries again (a network blip, an import map added later)\n }\n return pending;\n}\n\nconst HOW = 'mediabunny is needed to export (movie.render(), the download button) and for a video layer; playing needs nothing. '\n + 'Add it to the import map (\"mediabunny\": \"https://cdn.jsdelivr.net/npm/mediabunny@1/+esm\"), install it next to pixi-effects, '\n + 'or call useMediabunny(module | url | () => import(...)) before you export.';\n\nfunction fetchModule(from: MediabunnySource | null): Promise<MediabunnyModule> {\n if (from === null) return import('mediabunny');\n if (typeof from === 'string') return import(/* @vite-ignore */ /* webpackIgnore: true */ from) as Promise<MediabunnyModule>;\n if (typeof from === 'function') return Promise.resolve().then(from);\n return Promise.resolve(from);\n}\n\nfunction describe(from: MediabunnySource | null): string {\n if (from === null) return \"'mediabunny' (the bare name: an import map or a bundler resolves it)\";\n if (typeof from === 'string') return from;\n if (typeof from === 'function') return 'the function given to useMediabunny()';\n return 'the object given to useMediabunny()';\n}\n"]}
|
|
@@ -2246,11 +2246,11 @@ function registerFilterLibrary(mod) {
|
|
|
2246
2246
|
if (key.endsWith("Filter") && typeof value === "function") library.set(lower(key.slice(0, -"Filter".length)), value);
|
|
2247
2247
|
}
|
|
2248
2248
|
}
|
|
2249
|
-
var MISSING = (
|
|
2250
|
-
`pixi-effects: the filter
|
|
2249
|
+
var MISSING = (what, why, many = false) => new Error(
|
|
2250
|
+
`pixi-effects: the ${many ? "filters" : "filter"} ${what} ${many ? "come" : "comes"} from the pixi-filters package${why ? ` (${why})` : ""}. Add it to your import map ("pixi-filters": "https://esm.sh/pixi-filters@6.1.5?external=pixi.js") or run \`npm i pixi-filters\`.`
|
|
2251
2251
|
);
|
|
2252
|
-
function
|
|
2253
|
-
|
|
2252
|
+
function libraryFilters(spec) {
|
|
2253
|
+
const found = /* @__PURE__ */ new Map();
|
|
2254
2254
|
const visit = (node) => {
|
|
2255
2255
|
if (!node || typeof node !== "object") return;
|
|
2256
2256
|
if (Array.isArray(node)) {
|
|
@@ -2261,21 +2261,24 @@ function needsFilterLibrary(spec) {
|
|
|
2261
2261
|
if (Array.isArray(o.filters)) {
|
|
2262
2262
|
for (const f of o.filters) {
|
|
2263
2263
|
if (typeof f?.type !== "string" || !isNamedFilterType(f.type)) continue;
|
|
2264
|
-
if (isLibraryType(f.type))
|
|
2265
|
-
|
|
2264
|
+
if (isLibraryType(f.type)) {
|
|
2265
|
+
if (!found.get(f.type)) found.set(f.type, typeof o.name === "string" && o.name ? o.name : void 0);
|
|
2266
|
+
} else if (!isCoreType(f.type)) throw unknownType(f.type);
|
|
2266
2267
|
}
|
|
2267
2268
|
}
|
|
2268
2269
|
for (const key of ["sequences", "mask", "layer"]) visit(o[key]);
|
|
2269
2270
|
};
|
|
2270
2271
|
visit(spec);
|
|
2271
|
-
return
|
|
2272
|
+
return found;
|
|
2272
2273
|
}
|
|
2273
2274
|
async function ensureFilterLibrary(spec, load = () => import('pixi-filters')) {
|
|
2274
|
-
|
|
2275
|
+
const used = libraryFilters(spec);
|
|
2276
|
+
if (!used.size || library) return;
|
|
2275
2277
|
try {
|
|
2276
2278
|
registerFilterLibrary(await load());
|
|
2277
2279
|
} catch (e) {
|
|
2278
|
-
|
|
2280
|
+
const what = [...used].map(([type, layer]) => `"${type}"${layer ? ` (layer "${layer}")` : ""}`).join(", ");
|
|
2281
|
+
throw MISSING(what, e.message, used.size > 1);
|
|
2279
2282
|
}
|
|
2280
2283
|
}
|
|
2281
2284
|
var SINGLE_VALUE = { pixelate: "size", emboss: "strength" };
|
|
@@ -2325,7 +2328,7 @@ function createNamedFilter(type, params) {
|
|
|
2325
2328
|
if (core) return new PIXI[core[1]](params);
|
|
2326
2329
|
if (!isLibraryType(type)) throw unknownType(type);
|
|
2327
2330
|
const Ctor = library?.get(lower(type));
|
|
2328
|
-
if (!Ctor) throw MISSING(type
|
|
2331
|
+
if (!Ctor) throw MISSING(`"${type}"`, library ? "not found in the loaded package" : "not loaded yet");
|
|
2329
2332
|
const single = SINGLE_VALUE[Object.keys(SINGLE_VALUE).find((k) => lower(k) === lower(type)) ?? ""];
|
|
2330
2333
|
if (single) return new Ctor(params[single]);
|
|
2331
2334
|
const made = new Ctor(lower(type) === "colorgradient" ? colorGradientParams(params) : params);
|
|
@@ -6069,13 +6072,13 @@ var CanvasSequence = class extends Sequence {
|
|
|
6069
6072
|
var _CompositionSequence = null;
|
|
6070
6073
|
async function getCompositionSequence() {
|
|
6071
6074
|
if (!_CompositionSequence) {
|
|
6072
|
-
_CompositionSequence = (await import('./Composition-
|
|
6075
|
+
_CompositionSequence = (await import('./Composition-BOLWGT2R.js')).CompositionSequence;
|
|
6073
6076
|
}
|
|
6074
6077
|
return _CompositionSequence;
|
|
6075
6078
|
}
|
|
6076
6079
|
var _SpansSequence = null;
|
|
6077
6080
|
async function getSpansSequence() {
|
|
6078
|
-
if (!_SpansSequence) _SpansSequence = (await import('./Spans-
|
|
6081
|
+
if (!_SpansSequence) _SpansSequence = (await import('./Spans-PGXRMD6J.js')).SpansSequence;
|
|
6079
6082
|
return _SpansSequence;
|
|
6080
6083
|
}
|
|
6081
6084
|
var staticTypes = {
|
|
@@ -6121,5 +6124,5 @@ async function buildSequenceTree(specs, parent, root, out = []) {
|
|
|
6121
6124
|
}
|
|
6122
6125
|
|
|
6123
6126
|
export { CameraSequence, DEFAULT_FOV, DEG3 as DEG, EXPRESSION_NAMES, FALLOFFS, LIGHT_KINDS, LIGHT_PROPS, LightSequence, MANY_BLURRED, MAX_BLUR, MAX_CASTERS, MAX_LIGHTS, MIN_BLUR, NEAR, NullSequence, SHADOW_TAPS, Sequence, TextSequence, bindClock, bindCounterKeyframes, blurRadius, buildScope, buildSequenceTree, cameraBasis, checkEase, clockTable, contentLength, createTimeline, ensureFilterLibrary, evaluateExpr, flattenSvgPath, focusProblems, homeCamera, homeDistance, layerInitialZ, layerToWorld, lengthen, lightLevel, noise, noise2, packLights, parseEase, parseSpring, projectLayer, projectPoint, rand, random, registerSequenceType, remapOf, resolveAt, resolveNumber, spansMeta, springDuration, timeRemapOf, trimPolylines };
|
|
6124
|
-
//# sourceMappingURL=chunk-
|
|
6125
|
-
//# sourceMappingURL=chunk-
|
|
6127
|
+
//# sourceMappingURL=chunk-L3MEZZAV.js.map
|
|
6128
|
+
//# sourceMappingURL=chunk-L3MEZZAV.js.map
|