pixi-effects 0.28.2 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +10 -10
  3. package/ai/chat-template.html +5 -5
  4. package/ai/tools/check.mjs +18 -3
  5. package/ai/tools/pixi-effects.mjs +1 -1
  6. package/ai/tools/render.mjs +14 -9
  7. package/ai/tools/view.mjs +6 -2
  8. package/dist/Base-CB1_FPZD.d.cts +60 -0
  9. package/dist/Base-Ne74ztNl.d.ts +60 -0
  10. package/dist/Composition-MUKR3FYD.cjs +16 -0
  11. package/dist/{Composition-K6B3APM5.cjs.map → Composition-MUKR3FYD.cjs.map} +1 -1
  12. package/dist/Composition-RJGA7KDU.js +7 -0
  13. package/dist/{Composition-H7UNR5F5.js.map → Composition-RJGA7KDU.js.map} +1 -1
  14. package/dist/Controller.cjs +73 -45
  15. package/dist/Controller.cjs.map +1 -1
  16. package/dist/Controller.d.cts +16 -22
  17. package/dist/Controller.d.ts +16 -22
  18. package/dist/Controller.js +74 -40
  19. package/dist/Controller.js.map +1 -1
  20. package/dist/{Movie-CHcM8HNB.d.ts → Movie-C2rZFkrO.d.ts} +227 -119
  21. package/dist/{Movie-Cx5ozUGb.d.cts → Movie-DdnpLpw1.d.cts} +227 -119
  22. package/dist/{blendModes-HDOP6R7T.cjs → blendModes-ETMYWATF.cjs} +5 -5
  23. package/dist/{blendModes-HDOP6R7T.cjs.map → blendModes-ETMYWATF.cjs.map} +1 -1
  24. package/dist/{blendModes-PAVTW3BO.js → blendModes-RIVZXL5A.js} +4 -4
  25. package/dist/{blendModes-PAVTW3BO.js.map → blendModes-RIVZXL5A.js.map} +1 -1
  26. package/dist/{chunk-P4GY3Z4G.cjs → chunk-2DXPTKQZ.cjs} +6 -6
  27. package/dist/chunk-2DXPTKQZ.cjs.map +1 -0
  28. package/dist/{chunk-TYWFKCPY.js → chunk-4KB3GUEK.js} +5 -5
  29. package/dist/chunk-4KB3GUEK.js.map +1 -0
  30. package/dist/{chunk-5MZWXVTT.js → chunk-A3Q3SDSH.js} +35 -28
  31. package/dist/chunk-A3Q3SDSH.js.map +1 -0
  32. package/dist/chunk-CRQFDY7E.js +4182 -0
  33. package/dist/chunk-CRQFDY7E.js.map +1 -0
  34. package/dist/chunk-HREBQAY4.cjs +4206 -0
  35. package/dist/chunk-HREBQAY4.cjs.map +1 -0
  36. package/dist/{chunk-ZMAD3KJU.cjs → chunk-LYOKH7KE.cjs} +22 -3
  37. package/dist/chunk-LYOKH7KE.cjs.map +1 -0
  38. package/dist/{chunk-45QKLD6M.js → chunk-RCVZX2JP.js} +22 -3
  39. package/dist/chunk-RCVZX2JP.js.map +1 -0
  40. package/dist/{chunk-KBH33IQX.cjs → chunk-WHNADXXG.cjs} +121 -114
  41. package/dist/chunk-WHNADXXG.cjs.map +1 -0
  42. package/dist/{chunk-7VN2KI3U.js → chunk-ZAXYPXKW.js} +14 -6
  43. package/dist/chunk-ZAXYPXKW.js.map +1 -0
  44. package/dist/{chunk-MJW7KILM.cjs → chunk-ZVUO325O.cjs} +32 -24
  45. package/dist/chunk-ZVUO325O.cjs.map +1 -0
  46. package/dist/index.cjs +106 -4482
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.cts +15 -60
  49. package/dist/index.d.ts +15 -60
  50. package/dist/index.js +6 -4457
  51. package/dist/index.js.map +1 -1
  52. package/dist/loader.css +1 -1
  53. package/dist/{Presenter.cjs → present.cjs} +370 -31
  54. package/dist/present.cjs.map +1 -0
  55. package/dist/present.d.cts +278 -0
  56. package/dist/present.d.ts +278 -0
  57. package/dist/{Presenter.js → present.js} +358 -32
  58. package/dist/present.js.map +1 -0
  59. package/dist/three.cjs +6 -6
  60. package/dist/three.d.cts +2 -2
  61. package/dist/three.d.ts +2 -2
  62. package/dist/three.js +2 -2
  63. package/dist/{types-DpK1vwcl.d.ts → types-BzIB65Vk.d.cts} +11 -265
  64. package/dist/{types-DpK1vwcl.d.cts → types-BzIB65Vk.d.ts} +11 -265
  65. package/docs/api.md +44 -77
  66. package/docs/dsl.md +16 -14
  67. package/llms-full.txt +86 -115
  68. package/llms.txt +1 -1
  69. package/package.json +5 -5
  70. package/skills/pixi-effects/SKILL.md +5 -5
  71. package/skills/pixi-effects/reference/cheatsheet.md +9 -9
  72. package/skills/pixi-effects/reference/direction.md +2 -0
  73. package/skills/pixi-effects/reference/pitfalls.md +6 -6
  74. package/skills/pixi-effects/reference/recipes.md +4 -4
  75. package/skills/pixi-effects/template.html +7 -7
  76. package/dist/Base-C6f0fE8j.d.ts +0 -109
  77. package/dist/Base-DI1FCGcH.d.cts +0 -109
  78. package/dist/Composition-H7UNR5F5.js +0 -7
  79. package/dist/Composition-K6B3APM5.cjs +0 -16
  80. package/dist/Presenter.cjs.map +0 -1
  81. package/dist/Presenter.d.cts +0 -122
  82. package/dist/Presenter.d.ts +0 -122
  83. package/dist/Presenter.js.map +0 -1
  84. package/dist/chunk-45QKLD6M.js.map +0 -1
  85. package/dist/chunk-5MZWXVTT.js.map +0 -1
  86. package/dist/chunk-7VN2KI3U.js.map +0 -1
  87. package/dist/chunk-KBH33IQX.cjs.map +0 -1
  88. package/dist/chunk-MJW7KILM.cjs.map +0 -1
  89. package/dist/chunk-P4GY3Z4G.cjs.map +0 -1
  90. package/dist/chunk-TYWFKCPY.js.map +0 -1
  91. package/dist/chunk-ZMAD3KJU.cjs.map +0 -1
@@ -0,0 +1,278 @@
1
+ import { k as Movie, j as MotionBlurSpec } from './Movie-C2rZFkrO.js';
2
+ import { S as SequenceSpec, J as Props, K as Keyframe, a0 as TransitionSpec, k as CompositionSpec, Z as Stop } from './types-BzIB65Vk.js';
3
+ import 'pixi.js';
4
+
5
+ interface PresenterOptions {
6
+ canvas: HTMLCanvasElement;
7
+ /** Keys on the page: arrows, Space, Enter, PageUp / PageDown, Home / End, page number + Enter, B / W, F, ?, Esc. Default true. */
8
+ keyboard?: boolean;
9
+ /** A click (or tap) on the picture is "next". Default true. */
10
+ clickToAdvance?: boolean;
11
+ /** A swipe to the left is "next", to the right "back" (touch screens). Default true. */
12
+ swipe?: boolean;
13
+ /** The page counter, the page name and a progress line (they fade out when nothing happens). Default true. */
14
+ indicator?: boolean;
15
+ /** Stops with `advance: seconds` move on by themselves. Default true. */
16
+ autoAdvance?: boolean;
17
+ /** Run off the end: go back to the start and play again (a kiosk, a looping demo). Default false. */
18
+ loop?: boolean;
19
+ /** The accent of the progress line (any CSS colour). */
20
+ accent?: string;
21
+ /** Called when the audience-facing session is over: Escape with nothing left to close, or fullscreen left. (`Controller`'s Present button uses it to bring its bar back.) */
22
+ onExit?: () => void;
23
+ }
24
+ /**
25
+ * A presentation player for a movie with `stops` (`composition.stops`): it stops where the stops are, and moves on with the keys,
26
+ * a click, a tap or a swipe, like slides with animation. It draws only a small page counter, the page name and a progress line (they
27
+ * fade out when idle), and a black / white screen, a list of keys (`?`) and fullscreen (`F`). Use it instead of `Controller` on the page.
28
+ */
29
+ declare class Presenter {
30
+ readonly movie: Movie;
31
+ readonly options: Required<Omit<PresenterOptions, 'accent' | 'onExit'>> & {
32
+ accent?: string;
33
+ onExit?: () => void;
34
+ };
35
+ private box;
36
+ private wrappedHere;
37
+ private root;
38
+ private counterEl;
39
+ private titleEl;
40
+ private progressEl;
41
+ private coverEl;
42
+ private helpEl;
43
+ private jumpEl;
44
+ private idleTimer;
45
+ private digitsTimer;
46
+ private advanceTimer;
47
+ private loopTimer;
48
+ private overviewEl;
49
+ private gridEl;
50
+ private overviewSel;
51
+ /** A picture of every stop (by stop index), made once before the talk: for the overview and the presenter view's "next". */
52
+ private thumbs;
53
+ private thumbsPromise;
54
+ private waitEl;
55
+ private view;
56
+ private digits;
57
+ private downAt;
58
+ private swiped;
59
+ private canvasCursor;
60
+ private destroyed;
61
+ private wasWrapAttr;
62
+ private onKey;
63
+ private onStop;
64
+ private offStop;
65
+ private onSeeked;
66
+ private onFrame;
67
+ private onEnded;
68
+ private onPointerDown;
69
+ private onPointerUp;
70
+ private onPointerMove;
71
+ private onClick;
72
+ private wasFullscreen;
73
+ private onFullscreenChange;
74
+ constructor(movie: Movie, options: PresenterOptions);
75
+ /** Enter presentation: ask for fullscreen (a browser needs a click or key press for that) and play to the first stop. */
76
+ start(): Promise<void>;
77
+ /** Leave fullscreen. */
78
+ exit(): Promise<void>;
79
+ next(): Promise<void>;
80
+ prev(): Promise<void>;
81
+ /** Black out (`'black'`), white out (`'white'`) or bring the picture back (`'off'`). */
82
+ setCover(mode: 'black' | 'white' | 'off'): void;
83
+ destroy(): void;
84
+ private positioningBox;
85
+ private run;
86
+ private enterFullscreen;
87
+ private toggleFullscreen;
88
+ private cancelAdvance;
89
+ private handleStop;
90
+ private handleEnded;
91
+ private refresh;
92
+ private wake;
93
+ private showDigits;
94
+ /** Something that moves the presentation: if the screen is blacked out (or the key list is open) the first press only brings it back. */
95
+ private navigate;
96
+ private handleKey;
97
+ private togglePresenterView;
98
+ /** Open the speaker's window: what is on screen (live), the next picture, the notes of the page, a timer, and next / back. Returns it (null if the browser blocked the popup). */
99
+ openPresenterView(): Window | null;
100
+ closePresenterView(): void;
101
+ /** Copy what the movie has just drawn into the view (called from the `frame` event, right after the render, when the canvas can be read). */
102
+ private mirror;
103
+ private refreshView;
104
+ private pageStops;
105
+ private overviewOpen;
106
+ private toggleOverview;
107
+ /**
108
+ * Make a picture of every stop, once. Taking them moves the playhead through the stops and back, which the audience would see:
109
+ * `start()` does it before anything is shown (behind a "Preparing" cover), and an overview opened before that does it on the spot.
110
+ */
111
+ /** Make the page pictures now (the overview and the presenter view use them): `start()` does it before the audience sees anything. */
112
+ ensureThumbs(): Promise<void>;
113
+ /** A page's picture is its last stop's (the page fully built). */
114
+ private pageThumb;
115
+ private onThumb;
116
+ private buildOverview;
117
+ private fillThumb;
118
+ private select;
119
+ private handleOverviewKey;
120
+ private handleClick;
121
+ private handlePointerUp;
122
+ }
123
+
124
+ interface DeckPage {
125
+ /** The page's name: shown by the Presenter, and in the stops list. */
126
+ name?: string;
127
+ /** How long the page lasts, seconds (including any transition into the next page, see `DeckOptions.transition`). Required. */
128
+ duration: number;
129
+ /** The page's layers, written in the page's own time (`at: 0` is the start of the page). */
130
+ sequences: SequenceSpec[];
131
+ /** Where the page stops, in the page's own time: the first is the page settled, the rest are steps (a bullet appears, a chart grows). Default: where the transition into the next page begins (the end for the last page). */
132
+ stops?: Array<number | {
133
+ at: number;
134
+ pdf?: boolean;
135
+ }>;
136
+ /** Speaker notes (kept on the page's first stop). */
137
+ notes?: string;
138
+ /** Move on by itself this many seconds after the page's last stop (kiosk mode). */
139
+ advance?: number;
140
+ /** The page is itself a layer: it may carry `initial`, `keyframes`, `filters`, … (fade or slide the whole page, for instance). */
141
+ initial?: Props;
142
+ keyframes?: Keyframe[];
143
+ }
144
+ /** A transition spec without the parts `deck()` fills in (which two pages, and when). */
145
+ type DeckTransition = TransitionSpec extends infer T ? (T extends TransitionSpec ? Omit<T, 'from' | 'to' | 'at'> : never) : never;
146
+ interface DeckOptions {
147
+ pages: DeckPage[];
148
+ /**
149
+ * A transition between every two pages: `{ kind: 'crossfade' | 'slide' | 'wipe' | 'iris' | 'dip' | 'zoom' | 'dissolve' | 'luma', duration, …its own options }` (see Transitions). The next page starts
150
+ * `duration` seconds before the current one ends, and the transition plays across the overlap.
151
+ */
152
+ transition?: DeckTransition;
153
+ }
154
+ /** What `deck()` returns: spread it into `movie.init` (`{ duration, composition: { sequences, transitions?, stops } }` plus any movie option you passed). */
155
+ interface DeckResult {
156
+ duration: number;
157
+ composition: CompositionSpec;
158
+ [movieOption: string]: unknown;
159
+ }
160
+ /**
161
+ * A deck of pages as one movie. Each page is a nested composition laid out after the one before (so its layers use the page's own
162
+ * time), the stops (where a `Presenter` pauses) come from the pages, and an optional `transition` joins the pages with the existing
163
+ * crossfade / slide / wipe / … transitions.
164
+ *
165
+ * ```js
166
+ * await movie.init({ canvas, width: 1280, height: 720, frameRate: 30, ...deck({
167
+ * transition: { kind: 'slide', duration: 0.6, direction: 'left' },
168
+ * pages: [
169
+ * { name: 'Hello', duration: 5, stops: [1.2], sequences: [ …title, subtitle… ] },
170
+ * { name: 'Why', duration: 8, stops: [1.2, 3, 5], sequences: [ …three bullets, at 1.2, 3, 5… ] },
171
+ * ],
172
+ * }) });
173
+ * movie.on('ready', …); new Presenter(movie, { canvas });
174
+ * ```
175
+ */
176
+ declare function deck(options: DeckOptions): DeckResult;
177
+
178
+ /** A presentation is now on a stop (`next()` played to it, or `prev()` / `goToStop()` / `goToPage()` jumped to it). */
179
+ interface StopEvent {
180
+ index: number;
181
+ stop: Stop;
182
+ pageIndex: number;
183
+ }
184
+ /** Call `fn` every time a presentation lands on a stop. Returns the function that stops listening. */
185
+ declare function onStop(movie: Movie, fn: (e: StopEvent) => void): () => void;
186
+ /** Which stop the playhead is on or has passed (-1 before the first). */
187
+ declare const stopIndex: (movie: Movie) => number;
188
+ /** The stop the playhead is on or has passed, or null. */
189
+ declare const currentStop: (movie: Movie) => Stop | null;
190
+ /** Which page the playhead is in (0-based), -1 before the first stop. */
191
+ declare const pageIndex: (movie: Movie) => number;
192
+ /** How many pages the stops make. */
193
+ declare const pageCount: (movie: Movie) => number;
194
+ /**
195
+ * Play to the next stop and pause exactly there (a presentation's "next"). Pressed again while it is playing toward a stop, it skips the
196
+ * rest of the animation and lands on that stop at once. After the last stop it plays to the end. Resolves when it has landed (or
197
+ * stopped for another reason). An ordinary `movie.play()` ignores the stops.
198
+ */
199
+ declare function next(movie: Movie): Promise<void>;
200
+ /** Jump back to the previous stop at once (no reverse playback); from the first stop, to the start. */
201
+ declare function prev(movie: Movie): Promise<void>;
202
+ /** Jump to stop `index` (0-based). */
203
+ declare function goToStop(movie: Movie, index: number): Promise<void>;
204
+ /** Jump to the first stop of page `page` (0-based). */
205
+ declare function goToPage(movie: Movie, page: number): Promise<void>;
206
+
207
+ /** One picture of a stop (see `stopImages()`). */
208
+ interface StopImage {
209
+ stop: Stop; /** The page it belongs to (0-based). */
210
+ page: number;
211
+ image: Blob | string;
212
+ }
213
+ interface StopImagesOptions {
214
+ /** One picture per page (default) or one per stop. */
215
+ which?: 'pages' | 'stops';
216
+ /** With `which: 'pages'`: the page's last stop (default: the page fully built) or its first. */
217
+ pick?: 'last' | 'first';
218
+ /** Output size relative to the canvas. Default 1. */
219
+ scale?: number;
220
+ /** `'image/png'` (default) or `'image/jpeg'`. */
221
+ type?: 'image/png' | 'image/jpeg';
222
+ /** JPEG quality, 0–1. */
223
+ quality?: number;
224
+ /** Return `data:` URLs instead of Blobs. */
225
+ as?: 'blob' | 'dataURL';
226
+ /** Motion blur for the pictures (off unless you ask: they are usually for looking at). */
227
+ motionBlur?: MotionBlurSpec;
228
+ /** Pictures for a PDF: stops flagged `pdf: false` are left out (a page whose stops are all flagged has no picture). `exportPDF` sets it. */
229
+ pdf?: boolean;
230
+ /** Called as each picture is ready, in order. */
231
+ onImage?: (image: StopImage) => void;
232
+ }
233
+ interface InspectStopsReport {
234
+ stops: Array<{
235
+ index: number;
236
+ page: string | null;
237
+ at: number;
238
+ frame: number;
239
+ moving: number;
240
+ settled: boolean;
241
+ }>;
242
+ issues: string[];
243
+ }
244
+ /**
245
+ * A picture of the settled state of each page (default: the page's last stop, fully built) or of every stop, for a page list, an
246
+ * overview, an export. Pauses the movie, and leaves the playhead where it was. `onImage` is called as each picture is ready.
247
+ */
248
+ declare function stopImages(movie: Movie, opts: StopImagesOptions & {
249
+ as: 'dataURL';
250
+ }): Promise<Array<StopImage & {
251
+ image: string;
252
+ }>>;
253
+ declare function stopImages(movie: Movie, opts?: StopImagesOptions): Promise<StopImage[]>;
254
+ /**
255
+ * Look at every stop: is the picture there still changing? A stop is compared with the picture `lookback` frames before it (default 3):
256
+ * when more than `tolerance` (default 0.4 %) of the picture differs, the audience, a page overview and a PDF all see a half-finished
257
+ * animation. `issues` says which stop, which page and what to do; leaves the playhead where it was.
258
+ */
259
+ declare function inspectStops(movie: Movie, opts?: {
260
+ lookback?: number;
261
+ tolerance?: number;
262
+ }): Promise<InspectStopsReport>;
263
+ /**
264
+ * 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`;
265
+ * `which: 'stops'` makes a page of every stop that is not `pdf: false`), each a
266
+ * JPEG at the canvas size. Needs `composition.stops`. A transparent background comes out black: give the movie a `background`.
267
+ */
268
+ declare function exportPDF(movie: Movie, opts?: {
269
+ which?: 'pages' | 'stops';
270
+ pick?: 'last' | 'first';
271
+ scale?: number;
272
+ quality?: number;
273
+ title?: string;
274
+ motionBlur?: MotionBlurSpec;
275
+ onImage?: (image: StopImage) => void;
276
+ }): Promise<Blob>;
277
+
278
+ export { type DeckOptions, type DeckPage, type DeckResult, type DeckTransition, type InspectStopsReport, Presenter, type PresenterOptions, type StopEvent, type StopImage, type StopImagesOptions, currentStop, deck, exportPDF, goToPage, goToStop, inspectStops, next, onStop, pageCount, pageIndex, prev, stopImages, stopIndex };