@pixerate/flair 0.16.0 → 0.17.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 (43) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +12 -6
  3. package/dist/catalog/index.d.ts +3 -3
  4. package/dist/catalog/index.js +6 -2
  5. package/dist/{chunk-UNLCGDCB.js → chunk-LKQM3GSQ.js} +3 -3
  6. package/dist/{chunk-KWNFZ5NC.js → chunk-LURJMWYM.js} +237 -185
  7. package/dist/{chunk-KWNFZ5NC.js.map → chunk-LURJMWYM.js.map} +1 -1
  8. package/dist/{chunk-DVVQRZJ5.js → chunk-MILF5MRS.js} +11 -2
  9. package/dist/chunk-MILF5MRS.js.map +1 -0
  10. package/dist/{chunk-YLJWC4N2.js → chunk-PMVJP5I4.js} +2 -2
  11. package/dist/{chunk-4RGHZWQC.js → chunk-RM3I6WZH.js} +2 -2
  12. package/dist/{chunk-4RGHZWQC.js.map → chunk-RM3I6WZH.js.map} +1 -1
  13. package/dist/{chunk-FIJOMGPG.js → chunk-UP6QQVRS.js} +2 -2
  14. package/dist/{chunk-WC3VADZC.js → chunk-VYOMXE6I.js} +46 -4
  15. package/dist/chunk-VYOMXE6I.js.map +1 -0
  16. package/dist/cli.js +4 -4
  17. package/dist/{controls-Syr6drzO.d.ts → controls-Ec6P0Vpy.d.ts} +9 -2
  18. package/dist/editor/index.d.ts +3 -3
  19. package/dist/editor/index.js +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +9 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/node.d.ts +1 -1
  24. package/dist/node.js +2 -2
  25. package/dist/react/index.d.ts +14 -3
  26. package/dist/react/index.js +18 -9
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/recorder-HKFFHQES.js +10 -0
  29. package/dist/{renderer-SNYZu__R.d.ts → renderer-Bm0oQ7Bw.d.ts} +1 -1
  30. package/dist/svelte/index.d.ts +16 -5
  31. package/dist/svelte/index.js +16 -11
  32. package/dist/svelte/index.js.map +1 -1
  33. package/dist/{types-9J6NWaN3.d.ts → types-C7g8-lTX.d.ts} +9 -3
  34. package/dist/vector/index.d.ts +27 -1
  35. package/dist/vector/index.js +4 -2
  36. package/package.json +1 -1
  37. package/dist/chunk-DVVQRZJ5.js.map +0 -1
  38. package/dist/chunk-WC3VADZC.js.map +0 -1
  39. package/dist/recorder-KEX3U35D.js +0 -10
  40. /package/dist/{chunk-UNLCGDCB.js.map → chunk-LKQM3GSQ.js.map} +0 -0
  41. /package/dist/{chunk-YLJWC4N2.js.map → chunk-PMVJP5I4.js.map} +0 -0
  42. /package/dist/{chunk-FIJOMGPG.js.map → chunk-UP6QQVRS.js.map} +0 -0
  43. /package/dist/{recorder-KEX3U35D.js.map → recorder-HKFFHQES.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pixerate/flair
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6bd52a7: Text effects suit headlines of any length and any theme:
8
+
9
+ - **Colours**: colour controls take CSS colours, through `effectDefaults` and the React and Svelte wrappers too. Before, `effectDefaults` silently replaced colour strings with defaults. Hex can be `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`, and `rgb()`/`rgba()` and `hsl()`/`hsla()` work too (see the new `parseColor`). Vector effects also take `currentColor` to follow the surrounding text colour, and colours mixed from it use CSS `color-mix`.
10
+ - **Long text**: inline text effects keep their full size and the picture gets wider, so long phrases are no longer shrunk. Drip text no longer squashes long words at any size: it scales the whole word down on its own stage and widens inline. Its drips now repeat along the word instead of crowding the middle.
11
+ - **Overhang**: text effects write `data-overhang="top right bottom left"` (ems) on their `<svg>`, saying how far they reach past their inline box. The new `svgInlineLayout(svg)` in `/vector` reads it with the aspect ratio. In React and Svelte, `contain` turns it into a margin.
12
+ - **Plays when seen**: in React and Svelte, an effect that plays once (`loop: false`, no trigger) now waits until it is scrolled into view by default. `playOnEnter: false` starts it at mount. `SvgPlayer`'s `playOnEnter` now plays at once where there is no `IntersectionObserver`.
13
+
14
+ - 6bd52a7: Every text effect now takes `font`, `weight` and `inline` controls, like drip text: typewriter, scramble text, kinetic stagger, neon sign, stroke draw text, split reveal, highlighter, word cycle, liquid fill, glitch text and extruded text.
15
+
16
+ - `font` takes any CSS font-family, and `inherit` uses the surrounding text's. `weight` runs from 100 to 900. The defaults keep each effect's current look.
17
+ - `inline: true` frames just the text, from cap height to baseline, hides the backdrop and sets `overflow="visible"`, so the effect sits in a heading without adding leading. Give its container `display: inline-block; height: 0.72em` and the viewBox's aspect ratio.
18
+
3
19
  ## 0.16.0
4
20
 
5
21
  ### Minor Changes
package/README.md CHANGED
@@ -134,12 +134,17 @@ animateCount({
134
134
 
135
135
  With `loop: false` a player plays once and stays on its last frame (like CSS `animation-fill-mode: forwards`); add `hideWhenPaused` to hide it at the end instead.
136
136
 
137
- Drip text can sit inside a heading. Set `inline: true` and the picture frames just the word, from cap height to baseline, while its outline and drips spill over the text around it. Give its container `display: inline-block`, `height: 0.72em` and the viewBox's aspect ratio. `font` and `weight` set its typeface, and `font: "inherit"` takes the heading's:
137
+ Text effects (`category: "text"`) can sit inside a heading:
138
+
139
+ - **`inline: true`** frames just the text, from cap height to baseline. The backdrop is hidden, and outlines, glows, underlines and drips spill over the text around it. Inline text keeps its full size at any length: the picture gets wider instead of the text shrinking. Give the container `display: inline-block`, `height: 0.72em` and the viewBox's aspect ratio.
140
+ - **Overhang**: each text effect writes `data-overhang="top right bottom left"` (in ems) on its `<svg>`, saying how far it reaches past its box when it comes to rest. `svgInlineLayout(motion.svg)` (from `@pixerate/flair/vector`) reads the aspect ratio and the overhang. Use the overhang as a margin to keep room for drips and glows.
141
+ - **Typeface**: every text effect takes `font` and `weight`, and `font: "inherit"` uses the heading's font.
142
+ - **Colour**: colour controls take any CSS hex, `rgb()` or `hsl()` colour, or `currentColor` to follow the text colour around it, so one effect suits light and dark themes. Effects whose default text is light on a dark backdrop need an ink colour that shows on your page.
138
143
 
139
144
  ```ts
140
- const motion = renderVectorEffect(getEffect("drip-text") as VectorEffect, { word: "Slop", inline: true, font: "inherit" });
141
- const [, , w, h] = motion.svg.match(/viewBox="([^"]+)"/)![1]!.split(" ").map(Number);
142
- Object.assign(host.style, { display: "inline-block", height: "0.72em", aspectRatio: `${w} / ${h}` });
145
+ const motion = renderVectorEffect(getEffect("drip-text") as VectorEffect, { word: "Slop", inline: true, font: "inherit", outline: "currentColor" });
146
+ const { aspectRatio, overhang: o } = svgInlineLayout(motion.svg)!;
147
+ Object.assign(host.style, { display: "inline-block", height: "0.72em", aspectRatio: `${aspectRatio}`, margin: `${o.top}em ${o.right}em ${o.bottom}em ${o.left}em` });
143
148
  new SvgPlayer(host, motion, { loop: false });
144
149
  ```
145
150
 
@@ -165,7 +170,8 @@ import { VectorEffect } from "@pixerate/flair/react";
165
170
 
166
171
  - **Server rendering**: both render a still of the last frame as markup (`"first"` for hover and press triggers; set `poster` for another), sized from the viewBox, so the page hydrates with the picture in place. The `SvgPlayer` takes over after mount and is disposed on unmount.
167
172
  - **Reduced motion**: under `prefers-reduced-motion: reduce` the still stays. `reducedMotion="always"` or `"never"` overrides it.
168
- - **Size**: a block as wide as its container, with the viewBox's aspect ratio. With `inline` (or an effect whose `inline` control is on, like drip text's) it is an `inline-block` 0.72em high, sitting on the baseline like a capital letter; pass a CSS length to `inline` for another height.
173
+ - **Size**: a block as wide as its container, with the viewBox's aspect ratio. With `inline` (or an effect whose `inline` control is on) it is an `inline-block` 0.72em high, sitting on the baseline like a capital letter; pass a CSS length to `inline` for another height. Add `contain` to keep room for what spills past the text (a margin of its overhang).
174
+ - **Plays when seen**: an effect that plays once (`loop={false}`, no trigger) waits until it is scrolled into view, so one further down the page doesn't finish before anyone sees it. Pass `playOnEnter={false}` to start at mount.
169
175
  - **Props**: player options (`loop`, `autoplay`, `speed`, `hold`, `trigger`, `steps`, `pauseWhenHidden`, `playOnEnter`, `clock` …), `values` and `preset` for an effect, `onPlayer` for the player itself, and any `<span>` attribute (`elementId` sets the host's `id` on `<VectorEffect>`). Values are compared by content, so an inline object does not restart it; pass `<SvgPlayerView>` a memoised `motion`.
170
176
 
171
177
  Without React or Svelte, `svgFrameMarkup(motion, { at: "last" })` (from `@pixerate/flair/vector`) gives the same still as safe `<svg>` markup with no DOM, for any server or framework.
@@ -186,7 +192,7 @@ Without React or Svelte, `svgFrameMarkup(motion, { at: "last" })` (from `@pixera
186
192
  <h1>Stop the <span use:vectorEffect={params} style={still.style}>{@html still.markup}</span></h1>
187
193
  ```
188
194
 
189
- - **Params**: the React props, as one object: `id` with `values` and `preset`, or `motion`; player options; `poster`, `reducedMotion`, `inline`, `onPlayer`. A change remakes the player (values by content; `speed` without remaking), and it is disposed when the element goes.
195
+ - **Params**: the React props, as one object: `id` with `values` and `preset`, or `motion`; player options; `poster`, `reducedMotion`, `inline`, `contain`, `onPlayer`. An effect that plays once waits until it is scrolled into view, as in React. A change remakes the player (values by content; `speed` without remaking), and it is disposed when the element goes.
190
196
  - **Still**: `markup` is the still's layer and `style` the host's size from the viewBox, with the same rules as React. The action hides the still while the player runs and keeps it under `prefers-reduced-motion`. Without `vectorEffectStill` it makes its own still and sizes the element on the client.
191
197
  - **Attachments**: `{@attach fromAction(vectorEffect, () => params)}`, with `fromAction` from `svelte/attachments`.
192
198
 
@@ -1,6 +1,6 @@
1
- import { a as ControlDef, C as ControlValue } from '../controls-Syr6drzO.js';
2
- import { E as EffectDefinition, a as EffectCategory, S as ShaderEffect } from '../types-9J6NWaN3.js';
3
- export { b as EFFECT_CATEGORIES, c as EffectPreset, d as VECTOR_CONTROL_TYPES, e as VectorControl, V as VectorEffect, f as colorControl, n as numberControl, r as renderVectorEffect, v as vectorControlDef, g as vectorControlIssues, h as vectorControls, i as vectorEffectControls } from '../types-9J6NWaN3.js';
1
+ import { a as ControlDef, C as ControlValue } from '../controls-Ec6P0Vpy.js';
2
+ import { E as EffectDefinition, a as EffectCategory, S as ShaderEffect } from '../types-C7g8-lTX.js';
3
+ export { C as CURRENT_COLOR, b as EFFECT_CATEGORIES, c as EffectPreset, d as VECTOR_CONTROL_TYPES, e as VectorControl, V as VectorEffect, f as colorControl, i as isCurrentColor, n as numberControl, r as renderVectorEffect, v as vectorControlDef, g as vectorControlIssues, h as vectorControls, j as vectorEffectControls } from '../types-C7g8-lTX.js';
4
4
  import '../svg-XugR-6Ec.js';
5
5
 
6
6
  /**
@@ -1,4 +1,5 @@
1
1
  import {
2
+ CURRENT_COLOR,
2
3
  EFFECTS,
3
4
  EFFECT_CATEGORIES,
4
5
  FBM,
@@ -16,6 +17,7 @@ import {
16
17
  findEffects,
17
18
  getEffect,
18
19
  glsl,
20
+ isCurrentColor,
19
21
  numberControl,
20
22
  renderVectorEffect,
21
23
  svgDataUrl,
@@ -24,11 +26,12 @@ import {
24
26
  vectorControlIssues,
25
27
  vectorControls,
26
28
  vectorEffectControls
27
- } from "../chunk-KWNFZ5NC.js";
29
+ } from "../chunk-LURJMWYM.js";
28
30
  import "../chunk-OHW7UG6D.js";
29
31
  import "../chunk-EHDJ3CPJ.js";
30
- import "../chunk-WC3VADZC.js";
32
+ import "../chunk-VYOMXE6I.js";
31
33
  export {
34
+ CURRENT_COLOR,
32
35
  EFFECTS,
33
36
  EFFECT_CATEGORIES,
34
37
  FBM,
@@ -46,6 +49,7 @@ export {
46
49
  findEffects,
47
50
  getEffect,
48
51
  glsl,
52
+ isCurrentColor,
49
53
  numberControl,
50
54
  renderVectorEffect,
51
55
  svgDataUrl,
@@ -21,12 +21,12 @@ import {
21
21
  drawFrame,
22
22
  resetGlCaches,
23
23
  wrapSource
24
- } from "./chunk-YLJWC4N2.js";
24
+ } from "./chunk-PMVJP5I4.js";
25
25
  import {
26
26
  controlValue,
27
27
  imageUrls,
28
28
  parseControls
29
- } from "./chunk-WC3VADZC.js";
29
+ } from "./chunk-VYOMXE6I.js";
30
30
 
31
31
  // src/shader/renderer.ts
32
32
  var ShaderRenderer = class {
@@ -1617,4 +1617,4 @@ export {
1617
1617
  validateScene,
1618
1618
  standaloneSceneHtml
1619
1619
  };
1620
- //# sourceMappingURL=chunk-UNLCGDCB.js.map
1620
+ //# sourceMappingURL=chunk-LKQM3GSQ.js.map