pixi-effects 0.12.0 → 0.13.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 +22 -0
- package/README.md +5 -5
- package/ai/reference/cheatsheet.md +3 -3
- package/ai/reference/pitfalls.md +2 -2
- package/ai/template.html +5 -5
- package/ai/tools/check.mjs +1 -1
- package/dist/{Base-W3sQzGPO.d.cts → Base-C6ZnJ9pD.d.cts} +1 -1
- package/dist/{Base-CYH9vPCH.d.ts → Base-CQOlB2VH.d.ts} +1 -1
- package/dist/Controller.cjs +75 -17
- package/dist/Controller.cjs.map +1 -1
- package/dist/Controller.d.cts +15 -3
- package/dist/Controller.d.ts +15 -3
- package/dist/Controller.js +75 -17
- package/dist/Controller.js.map +1 -1
- package/dist/{Movie-CY2QPVVM.d.cts → Movie-DnR4H1OO.d.ts} +5 -2
- package/dist/{Movie-EBF6_RfX.d.ts → Movie-Tl5dRLJl.d.cts} +5 -2
- package/dist/Presenter.d.cts +2 -2
- package/dist/Presenter.d.ts +2 -2
- package/dist/index.cjs +32 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +32 -13
- package/dist/index.js.map +1 -1
- package/dist/loader.css +1 -1
- package/dist/three.d.cts +2 -2
- package/dist/three.d.ts +2 -2
- package/dist/{types-mpqQO8MJ.d.cts → types-CBSiUKau.d.cts} +18 -1
- package/dist/{types-mpqQO8MJ.d.ts → types-CBSiUKau.d.ts} +18 -1
- package/docs/api.md +4 -3
- package/docs/dsl.md +2 -2
- package/llms-full.txt +11 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1569,7 +1569,7 @@ ${offset}
|
|
|
1569
1569
|
}
|
|
1570
1570
|
|
|
1571
1571
|
// src/core/stops.ts
|
|
1572
|
-
var KEYS = ["at", "page", "notes", "advance"];
|
|
1572
|
+
var KEYS = ["at", "page", "notes", "advance", "pdf"];
|
|
1573
1573
|
function normalizeStops(raw, duration, frameRate) {
|
|
1574
1574
|
if (!raw || raw.length === 0) return [];
|
|
1575
1575
|
const total = Math.round(duration * frameRate);
|
|
@@ -1577,7 +1577,7 @@ function normalizeStops(raw, duration, frameRate) {
|
|
|
1577
1577
|
raw.forEach((r, i) => {
|
|
1578
1578
|
const spec = typeof r === "number" ? { at: r } : r && typeof r === "object" ? r : null;
|
|
1579
1579
|
if (!spec || typeof spec.at !== "number" || !Number.isFinite(spec.at)) {
|
|
1580
|
-
console.warn(`pixi-effects: stops[${i}] ${JSON.stringify(r)} is not a time in seconds (or { at, page?, notes?, advance? }); ignored`);
|
|
1580
|
+
console.warn(`pixi-effects: stops[${i}] ${JSON.stringify(r)} is not a time in seconds (or { at, page?, notes?, advance?, pdf? }); ignored`);
|
|
1581
1581
|
return;
|
|
1582
1582
|
}
|
|
1583
1583
|
if (typeof r === "object") chunkUQBGW5DO_cjs.warnUnknownOptions(`stops[${i}]`, r, KEYS);
|
|
@@ -1613,6 +1613,10 @@ function normalizeStops(raw, duration, frameRate) {
|
|
|
1613
1613
|
if (typeof s.advance === "number" && Number.isFinite(s.advance) && s.advance >= 0) stop.advance = s.advance;
|
|
1614
1614
|
else console.warn(`pixi-effects: stops[${index}] advance must be a number of seconds >= 0, got ${JSON.stringify(s.advance)}; ignored`);
|
|
1615
1615
|
}
|
|
1616
|
+
if (s.pdf !== void 0) {
|
|
1617
|
+
if (typeof s.pdf === "boolean") stop.pdf = s.pdf;
|
|
1618
|
+
else console.warn(`pixi-effects: stops[${index}] pdf must be true or false, got ${JSON.stringify(s.pdf)}; ignored`);
|
|
1619
|
+
}
|
|
1616
1620
|
return stop;
|
|
1617
1621
|
});
|
|
1618
1622
|
}
|
|
@@ -1630,6 +1634,20 @@ function stopAtOrBefore(stops, frame) {
|
|
|
1630
1634
|
function pageStarts(stops) {
|
|
1631
1635
|
return stops.filter((s) => s.pageStart);
|
|
1632
1636
|
}
|
|
1637
|
+
function pictureStops(stops, opts = {}) {
|
|
1638
|
+
if (opts.which === "stops") return opts.pdf ? stops.filter((s) => s.pdf !== false) : [...stops];
|
|
1639
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
1640
|
+
for (const s of stops) byPage.set(s.pageIndex, [...byPage.get(s.pageIndex) ?? [], s]);
|
|
1641
|
+
const take = (list) => opts.pick === "first" ? list[0] : list[list.length - 1];
|
|
1642
|
+
const picks = [];
|
|
1643
|
+
for (const list of byPage.values()) {
|
|
1644
|
+
const flagged = list.filter((s) => s.pdf === true);
|
|
1645
|
+
const usable = list.filter((s) => s.pdf !== false);
|
|
1646
|
+
const one = take(flagged.length ? flagged : usable.length ? usable : opts.pdf ? [] : list);
|
|
1647
|
+
if (one) picks.push(one);
|
|
1648
|
+
}
|
|
1649
|
+
return picks;
|
|
1650
|
+
}
|
|
1633
1651
|
|
|
1634
1652
|
// src/core/loader.ts
|
|
1635
1653
|
var FADE_FALLBACK_MS = 900;
|
|
@@ -1932,16 +1950,10 @@ var Movie = class {
|
|
|
1932
1950
|
return encodeCanvas(out, o.type, o.as, o.quality);
|
|
1933
1951
|
}
|
|
1934
1952
|
async stopImages(opts = {}) {
|
|
1935
|
-
chunkUQBGW5DO_cjs.warnUnknownOptions("movie.stopImages()", opts, ["which", "pick", "scale", "type", "quality", "as", "motionBlur", "onImage"]);
|
|
1953
|
+
chunkUQBGW5DO_cjs.warnUnknownOptions("movie.stopImages()", opts, ["which", "pick", "scale", "type", "quality", "as", "motionBlur", "pdf", "onImage"]);
|
|
1936
1954
|
this._requireReady("stopImages");
|
|
1937
1955
|
if (this.stops.length === 0) return [];
|
|
1938
|
-
|
|
1939
|
-
if (opts.which === "stops") picks = this.stops;
|
|
1940
|
-
else {
|
|
1941
|
-
const byPage = /* @__PURE__ */ new Map();
|
|
1942
|
-
for (const s of this.stops) byPage.set(s.pageIndex, [...byPage.get(s.pageIndex) ?? [], s]);
|
|
1943
|
-
picks = [...byPage.values()].map((list) => opts.pick === "first" ? list[0] : list[list.length - 1]);
|
|
1944
|
-
}
|
|
1956
|
+
const picks = pictureStops(this.stops, { which: opts.which, pick: opts.pick, pdf: opts.pdf });
|
|
1945
1957
|
this.pause();
|
|
1946
1958
|
const back = this.currentFrame, wasAtPoster = this._atPoster;
|
|
1947
1959
|
const out = [];
|
|
@@ -1965,7 +1977,8 @@ var Movie = class {
|
|
|
1965
1977
|
return out;
|
|
1966
1978
|
}
|
|
1967
1979
|
/**
|
|
1968
|
-
* The deck as a PDF: one page per page of the talk (the page's last stop, fully built
|
|
1980
|
+
* The deck as a PDF: one page per page of the talk (the page's last stop, fully built, unless a stop says `pdf: true` or `pdf: false`;
|
|
1981
|
+
* `which: 'stops'` makes a page of every stop that is not `pdf: false`), each a
|
|
1969
1982
|
* JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
|
|
1970
1983
|
*/
|
|
1971
1984
|
async exportPDF(opts = {}) {
|
|
@@ -1981,6 +1994,7 @@ var Movie = class {
|
|
|
1981
1994
|
quality: opts.quality ?? 0.92,
|
|
1982
1995
|
as: "blob",
|
|
1983
1996
|
motionBlur: opts.motionBlur,
|
|
1997
|
+
pdf: true,
|
|
1984
1998
|
onImage: opts.onImage
|
|
1985
1999
|
});
|
|
1986
2000
|
const pages = await Promise.all(images.map(async (i) => ({
|
|
@@ -3215,7 +3229,11 @@ function deck(options) {
|
|
|
3215
3229
|
const id = `page-${i + 1}`;
|
|
3216
3230
|
const label = page.name ? `"${page.name}"` : `pages[${i}]`;
|
|
3217
3231
|
const isLast = i === pages.length - 1;
|
|
3218
|
-
const
|
|
3232
|
+
const entries = (page.stops ?? [isLast ? page.duration : page.duration - overlap]).map((e, k) => {
|
|
3233
|
+
if (e && typeof e === "object") chunkUQBGW5DO_cjs.warnUnknownOptions(`deck() page ${label} stops[${k}]`, e, ["at", "pdf"]);
|
|
3234
|
+
return typeof e === "object" && e !== null ? e : { at: e };
|
|
3235
|
+
});
|
|
3236
|
+
const local = entries.map((e) => e.at);
|
|
3219
3237
|
local.forEach((s, k) => {
|
|
3220
3238
|
if (!(typeof s === "number" && Number.isFinite(s) && s > 0 && s <= page.duration + 1e-9)) throw new Error(`deck(): page ${label} has stop ${String(s)}, outside the page (0 to ${page.duration} s)`);
|
|
3221
3239
|
if (k > 0 && s <= local[k - 1]) throw new Error(`deck(): page ${label} stops must be in order, earliest first (got ${local.join(", ")})`);
|
|
@@ -3229,6 +3247,7 @@ function deck(options) {
|
|
|
3229
3247
|
if (page.notes !== void 0) stop.notes = page.notes;
|
|
3230
3248
|
}
|
|
3231
3249
|
if (k === local.length - 1 && page.advance !== void 0) stop.advance = page.advance;
|
|
3250
|
+
if (entries[k].pdf !== void 0) stop.pdf = entries[k].pdf;
|
|
3232
3251
|
stops.push(stop);
|
|
3233
3252
|
});
|
|
3234
3253
|
if (transition && !isLast) {
|
|
@@ -3293,6 +3312,7 @@ exports.measureText = measureText;
|
|
|
3293
3312
|
exports.normalizeStops = normalizeStops;
|
|
3294
3313
|
exports.orbit = orbit;
|
|
3295
3314
|
exports.particles = particles;
|
|
3315
|
+
exports.pictureStops = pictureStops;
|
|
3296
3316
|
exports.react = react;
|
|
3297
3317
|
exports.resolveLoader = resolveLoader;
|
|
3298
3318
|
exports.splitText = splitText;
|