@pixerate/flair 0.28.0 → 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 (59) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +48 -6
  3. package/dist/catalog/index.d.ts +11 -6
  4. package/dist/catalog/index.js +1 -1
  5. package/dist/{chunk-4LKAPRFM.js → chunk-6GFOLHCT.js} +920 -34
  6. package/dist/chunk-6GFOLHCT.js.map +1 -0
  7. package/dist/{chunk-JL6TI6II.js → chunk-7KYQ4R76.js} +2 -2
  8. package/dist/chunk-7KYQ4R76.js.map +1 -0
  9. package/dist/{chunk-STKEKXCK.js → chunk-AUH3PEFW.js} +2 -2
  10. package/dist/{chunk-PFGGPIMT.js → chunk-DA4UUSDO.js} +58 -3
  11. package/dist/chunk-DA4UUSDO.js.map +1 -0
  12. package/dist/{chunk-RDU63CDO.js → chunk-HDYBY3PQ.js} +380 -1
  13. package/dist/chunk-HDYBY3PQ.js.map +1 -0
  14. package/dist/{chunk-VLQLRKGW.js → chunk-KZYZX3V5.js} +260 -33
  15. package/dist/chunk-KZYZX3V5.js.map +1 -0
  16. package/dist/{chunk-GXP4YLAP.js → chunk-MBKNTXQX.js} +9 -9
  17. package/dist/chunk-MBKNTXQX.js.map +1 -0
  18. package/dist/{chunk-H6VDFBIO.js → chunk-SMR2MJXB.js} +156 -5
  19. package/dist/chunk-SMR2MJXB.js.map +1 -0
  20. package/dist/{chunk-YBGRXVAE.js → chunk-X3C2VFTM.js} +3 -3
  21. package/dist/{chunk-CK6EV37I.js → chunk-ZULFHADW.js} +69 -6
  22. package/dist/chunk-ZULFHADW.js.map +1 -0
  23. package/dist/cli.js +6 -6
  24. package/dist/editor/index.d.ts +3 -3
  25. package/dist/editor/index.js +3 -3
  26. package/dist/{effect-GGP66JI6.js → effect-YBWDNIYG.js} +10 -10
  27. package/dist/embed/index.d.ts +36 -8
  28. package/dist/embed/index.js +5 -5
  29. package/dist/{frames-VEcqa40g.d.ts → frames-CGJudAbu.d.ts} +11 -1
  30. package/dist/index.d.ts +69 -6
  31. package/dist/index.js +35 -7
  32. package/dist/index.js.map +1 -1
  33. package/dist/node.d.ts +4 -4
  34. package/dist/node.js +9 -9
  35. package/dist/react/index.d.ts +4 -4
  36. package/dist/react/index.js +7 -7
  37. package/dist/react/index.js.map +1 -1
  38. package/dist/{recorder-CDPPTJMG.js → recorder-TYMEZHOT.js} +3 -3
  39. package/dist/{renderer-teaa98RE.d.ts → renderer-tk1nbVkW.d.ts} +252 -2
  40. package/dist/svelte/index.d.ts +4 -4
  41. package/dist/svelte/index.js +7 -7
  42. package/dist/svelte/index.js.map +1 -1
  43. package/dist/{svg-BhRboN9q.d.ts → svg-DaKRPA9v.d.ts} +39 -7
  44. package/dist/{types-DUOMxZaq.d.ts → types-wh28fXW4.d.ts} +2 -2
  45. package/dist/vector/index.d.ts +2 -2
  46. package/dist/vector/index.js +5 -3
  47. package/package.json +1 -1
  48. package/dist/chunk-4LKAPRFM.js.map +0 -1
  49. package/dist/chunk-CK6EV37I.js.map +0 -1
  50. package/dist/chunk-GXP4YLAP.js.map +0 -1
  51. package/dist/chunk-H6VDFBIO.js.map +0 -1
  52. package/dist/chunk-JL6TI6II.js.map +0 -1
  53. package/dist/chunk-PFGGPIMT.js.map +0 -1
  54. package/dist/chunk-RDU63CDO.js.map +0 -1
  55. package/dist/chunk-VLQLRKGW.js.map +0 -1
  56. /package/dist/{chunk-STKEKXCK.js.map → chunk-AUH3PEFW.js.map} +0 -0
  57. /package/dist/{chunk-YBGRXVAE.js.map → chunk-X3C2VFTM.js.map} +0 -0
  58. /package/dist/{effect-GGP66JI6.js.map → effect-YBWDNIYG.js.map} +0 -0
  59. /package/dist/{recorder-CDPPTJMG.js.map → recorder-TYMEZHOT.js.map} +0 -0
@@ -289,17 +289,30 @@ interface SvgPlayerOptions extends SvgViewOptions {
289
289
  /** Hide the view (`visibility: hidden`) whenever playback is paused or reset (default false). */
290
290
  hideWhenPaused?: boolean;
291
291
  /**
292
- * Plays in answer to the pointer instead of on its own (see {@link SvgTrigger}):
293
- * `"hover"` and `"press"` play to the end while hovered or held and back to
294
- * the start after; `"click"` plays the next step on each click, starting
295
- * over after the last. `autoplay`, `loop` and `steps` are ignored.
292
+ * Plays in answer to the pointer or the page instead of on its own (see
293
+ * {@link SvgTrigger}): `"hover"` and `"press"` play to the end while
294
+ * hovered or held and back to the start after; `"click"` plays the next
295
+ * step on each click, starting over after the last; `"scroll"` follows
296
+ * the trigger target's progress through the viewport (see `scrollRange`),
297
+ * scrubbing back and forth as the page scrolls. `autoplay`, `loop` and
298
+ * `steps` are ignored.
296
299
  */
297
300
  trigger?: SvgTrigger;
298
- /** The element whose pointer events trigger it (default the container). */
301
+ /** The element whose pointer events trigger it, or whose scrolling a scroll trigger follows (default the container). */
299
302
  triggerTarget?: HTMLElement;
303
+ /**
304
+ * For a scroll trigger: the stretch of the target's progress through the
305
+ * viewport (0 as its top comes in at the bottom, 1 as its bottom leaves at
306
+ * the top) over which the picture plays from start to end (default
307
+ * `[0.1, 0.6]`: from just after it comes into view to a little past the
308
+ * middle).
309
+ */
310
+ scrollRange?: readonly [number, number];
300
311
  }
301
312
  /** What makes a triggered {@link SvgPlayer} play. */
302
- type SvgTrigger = "hover" | "press" | "click";
313
+ type SvgTrigger = "hover" | "press" | "click" | "scroll";
314
+ /** The stretch of the viewport a scroll-triggered picture plays over (see `SvgPlayerOptions.scrollRange`). */
315
+ declare const SCROLL_RANGE: readonly [number, number];
303
316
  /**
304
317
  * Plays an {@link SvgMotion} inside `container`: loops by default, and can be
305
318
  * paused, sought and sped up. Dispose it to stop and remove the picture.
@@ -327,6 +340,10 @@ declare class SvgPlayer {
327
340
  private wasPlayingBeforeHidden;
328
341
  private hasEnteredViewport;
329
342
  private intersectionObserver?;
343
+ private readonly scrollRange;
344
+ /** A scroll trigger's pending update (one per frame). */
345
+ private scrollFrame;
346
+ private followingScroll;
330
347
  constructor(container: HTMLElement, motion: SvgMotion, options?: SvgPlayerOptions);
331
348
  /** The loop length in ms. */
332
349
  get duration(): number;
@@ -339,6 +356,17 @@ declare class SvgPlayer {
339
356
  reset(): void;
340
357
  /** Shows the picture at `ms` (wrapped into the loop when looping). */
341
358
  seek(ms: number): void;
359
+ /**
360
+ * Shows the picture at `progress` of the way through it, 0–1: how hosts
361
+ * scrub it themselves (a slider, a scroll position of their own). A scroll
362
+ * trigger stops following the page once a host calls this.
363
+ */
364
+ setProgress(progress: number): void;
365
+ /**
366
+ * A scroll trigger's playback position, 0–1, for the trigger target's
367
+ * `progress` through the viewport (see {@link SvgPlayerOptions.scrollRange}).
368
+ */
369
+ scrollPosition(progress: number): number;
342
370
  setSpeed(speed: number): void;
343
371
  /**
344
372
  * Plays to the end (`true`) or back to the start (`false`) from wherever it
@@ -356,6 +384,10 @@ declare class SvgPlayer {
356
384
  private onEnter;
357
385
  private onLeave;
358
386
  private onClick;
387
+ /** Seeks to where the trigger target is in the viewport. */
388
+ private followScroll;
389
+ /** A scroll or resize: follow it on the next frame (or now, without frames). */
390
+ private onScroll;
359
391
  private listen;
360
392
  private run;
361
393
  }
@@ -386,4 +418,4 @@ interface AnimateCountOptions {
386
418
  */
387
419
  declare function animateCount(options: AnimateCountOptions): () => void;
388
420
 
389
- export { type AnimateCountOptions as A, svgMotionIssues as B, type Clock as C, type DataKey as D, EASES as E, svgOpeningTag as F, svgView as G, writtenText as H, ManualClock as M, type SvgMotion as S, type SvgTrigger as a, SvgPlayer as b, type EaseName as c, SCRAMBLE_MS as d, STEP_MS as e, SVG_PICTURE as f, type SvgAnimation as g, type SvgBox as h, type SvgElementFrame as i, type SvgPlayerOptions as j, type SvgView as k, type SvgViewOptions as l, animateCount as m, defaultDataKey as n, formatCount as o, jitter as p, lerpAttr as q, lerpData as r, pageHidden as s, parseSvg as t, realClock as u, stepData as v, stepProgress as w, stepStart as x, svgDuration as y, svgFrame as z };
421
+ export { type AnimateCountOptions as A, svgFrame as B, type Clock as C, type DataKey as D, EASES as E, svgMotionIssues as F, svgOpeningTag as G, svgView as H, writtenText as I, ManualClock as M, type SvgMotion as S, type SvgTrigger as a, SvgPlayer as b, type EaseName as c, SCRAMBLE_MS as d, SCROLL_RANGE as e, STEP_MS as f, SVG_PICTURE as g, type SvgAnimation as h, type SvgBox as i, type SvgElementFrame as j, type SvgPlayerOptions as k, type SvgView as l, type SvgViewOptions as m, animateCount as n, defaultDataKey as o, formatCount as p, jitter as q, lerpAttr as r, lerpData as s, pageHidden as t, parseSvg as u, realClock as v, stepData as w, stepProgress as x, stepStart as y, svgDuration as z };
@@ -1,8 +1,8 @@
1
1
  import { C as ControlValue, a as ControlDef } from './controls-Ec6P0Vpy.js';
2
- import { S as SvgMotion, a as SvgTrigger } from './svg-BhRboN9q.js';
2
+ import { S as SvgMotion, a as SvgTrigger } from './svg-DaKRPA9v.js';
3
3
 
4
4
  /** What an effect is for, used to group the catalog. */
5
- type EffectCategory = "gradient" | "organic" | "pattern" | "light" | "lighting" | "space" | "retro" | "image" | "overlay" | "text" | "morph" | "interaction" | "pyrotechnics" | "timewarp" | "melt" | "electric" | "splatter" | "bubble" | "sticker" | "trail" | "particles" | "debris" | "impact" | "comic" | "atmosphere" | "glow" | "shadow" | "distortion" | "transition" | "loader" | "data" | "icon";
5
+ type EffectCategory = "gradient" | "organic" | "pattern" | "light" | "lighting" | "space" | "retro" | "image" | "overlay" | "text" | "morph" | "interaction" | "pyrotechnics" | "timewarp" | "melt" | "electric" | "splatter" | "bubble" | "sticker" | "trail" | "particles" | "debris" | "impact" | "comic" | "atmosphere" | "glow" | "shadow" | "distortion" | "audio" | "scroll" | "transition" | "loader" | "data" | "icon";
6
6
  /** Every category, in the order the catalog lists them. */
7
7
  declare const EFFECT_CATEGORIES: readonly EffectCategory[];
8
8
  /**
@@ -1,5 +1,5 @@
1
- import { h as SvgBox, S as SvgMotion } from '../svg-BhRboN9q.js';
2
- export { A as AnimateCountOptions, D as DataKey, E as EASES, c as EaseName, d as SCRAMBLE_MS, e as STEP_MS, f as SVG_PICTURE, g as SvgAnimation, i as SvgElementFrame, b as SvgPlayer, j as SvgPlayerOptions, a as SvgTrigger, k as SvgView, l as SvgViewOptions, m as animateCount, n as defaultDataKey, o as formatCount, q as lerpAttr, r as lerpData, t as parseSvg, v as stepData, w as stepProgress, x as stepStart, y as svgDuration, z as svgFrame, B as svgMotionIssues, F as svgOpeningTag, G as svgView, H as writtenText } from '../svg-BhRboN9q.js';
1
+ import { i as SvgBox, S as SvgMotion } from '../svg-DaKRPA9v.js';
2
+ export { A as AnimateCountOptions, D as DataKey, E as EASES, c as EaseName, d as SCRAMBLE_MS, e as SCROLL_RANGE, f as STEP_MS, g as SVG_PICTURE, h as SvgAnimation, j as SvgElementFrame, b as SvgPlayer, k as SvgPlayerOptions, a as SvgTrigger, l as SvgView, m as SvgViewOptions, n as animateCount, o as defaultDataKey, p as formatCount, r as lerpAttr, s as lerpData, u as parseSvg, w as stepData, x as stepProgress, y as stepStart, z as svgDuration, B as svgFrame, F as svgMotionIssues, G as svgOpeningTag, H as svgView, I as writtenText } from '../svg-DaKRPA9v.js';
3
3
 
4
4
  /**
5
5
  * Shape morphing: any SVG paths turned into paths with the same structure, so
@@ -7,16 +7,17 @@ import {
7
7
  } from "../chunk-H6L67KHI.js";
8
8
  import {
9
9
  svgAnimatedMarkup
10
- } from "../chunk-YBGRXVAE.js";
10
+ } from "../chunk-X3C2VFTM.js";
11
11
  import {
12
12
  parseViewBox,
13
13
  svgFrameMarkup,
14
14
  svgInlineLayout,
15
15
  svgViewBox
16
- } from "../chunk-STKEKXCK.js";
16
+ } from "../chunk-AUH3PEFW.js";
17
17
  import {
18
18
  EASES,
19
19
  SCRAMBLE_MS,
20
+ SCROLL_RANGE,
20
21
  STEP_MS,
21
22
  SVG_PICTURE,
22
23
  SvgPlayer,
@@ -35,7 +36,7 @@ import {
35
36
  svgOpeningTag,
36
37
  svgView,
37
38
  writtenText
38
- } from "../chunk-PFGGPIMT.js";
39
+ } from "../chunk-DA4UUSDO.js";
39
40
  import "../chunk-WMZQCUFJ.js";
40
41
  import {
41
42
  morphPaths,
@@ -44,6 +45,7 @@ import {
44
45
  export {
45
46
  EASES,
46
47
  SCRAMBLE_MS,
48
+ SCROLL_RANGE,
47
49
  STEP_MS,
48
50
  SVG_PICTURE,
49
51
  SvgPlayer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/flair",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Web visual effects and motion graphics: WebGL2 shader effects, animated vector effects, a catalog of ready-made effects, and a UI-agnostic, agent-ready effect editor.",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",