@pixerate/flair 0.15.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.
- package/CHANGELOG.md +26 -0
- package/README.md +33 -6
- package/dist/catalog/index.d.ts +3 -3
- package/dist/catalog/index.js +6 -2
- package/dist/{chunk-SHHAIWUR.js → chunk-LKQM3GSQ.js} +12 -12
- package/dist/{chunk-KWNFZ5NC.js → chunk-LURJMWYM.js} +237 -185
- package/dist/{chunk-KWNFZ5NC.js.map → chunk-LURJMWYM.js.map} +1 -1
- package/dist/{chunk-DVVQRZJ5.js → chunk-MILF5MRS.js} +11 -2
- package/dist/chunk-MILF5MRS.js.map +1 -0
- package/dist/{chunk-YLJWC4N2.js → chunk-PMVJP5I4.js} +2 -2
- package/dist/{chunk-4RGHZWQC.js → chunk-RM3I6WZH.js} +2 -2
- package/dist/{chunk-4RGHZWQC.js.map → chunk-RM3I6WZH.js.map} +1 -1
- package/dist/{chunk-FIJOMGPG.js → chunk-UP6QQVRS.js} +2 -2
- package/dist/{chunk-WC3VADZC.js → chunk-VYOMXE6I.js} +46 -4
- package/dist/chunk-VYOMXE6I.js.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/{controls-Syr6drzO.d.ts → controls-Ec6P0Vpy.d.ts} +9 -2
- package/dist/editor/index.d.ts +3 -3
- package/dist/editor/index.js +7 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +80 -76
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/react/index.d.ts +14 -3
- package/dist/react/index.js +18 -9
- package/dist/react/index.js.map +1 -1
- package/dist/recorder-HKFFHQES.js +10 -0
- package/dist/{renderer-SNYZu__R.d.ts → renderer-Bm0oQ7Bw.d.ts} +1 -1
- package/dist/svelte/index.d.ts +146 -0
- package/dist/svelte/index.js +195 -0
- package/dist/svelte/index.js.map +1 -0
- package/dist/{types-9J6NWaN3.d.ts → types-C7g8-lTX.d.ts} +9 -3
- package/dist/vector/index.d.ts +27 -1
- package/dist/vector/index.js +4 -2
- package/package.json +13 -3
- package/dist/chunk-DVVQRZJ5.js.map +0 -1
- package/dist/chunk-WC3VADZC.js.map +0 -1
- package/dist/recorder-KEX3U35D.js +0 -10
- /package/dist/{chunk-SHHAIWUR.js.map → chunk-LKQM3GSQ.js.map} +0 -0
- /package/dist/{chunk-YLJWC4N2.js.map → chunk-PMVJP5I4.js.map} +0 -0
- /package/dist/{chunk-FIJOMGPG.js.map → chunk-UP6QQVRS.js.map} +0 -0
- /package/dist/{recorder-KEX3U35D.js.map → recorder-HKFFHQES.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
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
|
+
|
|
19
|
+
## 0.16.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 55fbb80: New `@pixerate/flair/svelte` entry point, with `svelte` (>= 5) as an optional peer dependency (its types only; nothing to compile):
|
|
24
|
+
|
|
25
|
+
- `use:vectorEffect={{ id: "drip-text", values: { word: "Slop" }, loop: false }}` plays a catalog vector effect (or `{ motion }`, any `SvgMotion`) in an element: it makes an `SvgPlayer` on mount, remakes it when the params change (values by content, `speed` without remaking) and disposes it on destroy. Works as an attachment through `fromAction`.
|
|
26
|
+
- `vectorEffectStill(params)` returns `{ markup, style }` for server rendering: `<span use:vectorEffect={params} style={still.style}>{@html still.markup}</span>` shows the last frame, sized from the viewBox, until the player takes over. The still stays under `prefers-reduced-motion` (`reducedMotion` overrides).
|
|
27
|
+
- Sized like the React components: a block with the viewBox's aspect ratio, or with `inline` (or an effect's `inline` control) an `inline-block` 0.72em high.
|
|
28
|
+
|
|
3
29
|
## 0.15.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ Flair gives products a library of good-looking, configurable visual effects (her
|
|
|
45
45
|
| `@pixerate/flair/catalog` | `EFFECTS`, `getEffect`, `findEffects`, `effectDefaults`, `renderVectorEffect`, `vectorControls`, GLSL helpers, sample images, `textImage` | None |
|
|
46
46
|
| `@pixerate/flair/vector` | `SvgMotion`, `svgFrame`, `svgView`, `SvgPlayer`, `svgFrameMarkup`, `svgViewBox`, `animateCount`, `formatCount`, `morphPaths`, `morphSequence`, `svgMotionIssues` | None |
|
|
47
47
|
| `@pixerate/flair/react` | `<VectorEffect>`, `<SvgPlayerView>`: vector effects as React components, server-rendered as a still | `react` ≥ 18 (optional peer) |
|
|
48
|
+
| `@pixerate/flair/svelte` | `vectorEffect` action, `vectorEffectStill`: vector effects in Svelte, server-rendered as a still | `svelte` ≥ 5 (optional peer; types only) |
|
|
48
49
|
| `@pixerate/flair/editor` | `EffectEditor`, effect documents, keyframe tracks, renderer bindings, parameter-panel binding, agent tools and instructions | `@pixerate/editor` ≥ 0.29 (optional peer; only its dependency-free `/history`, `/commands`, `/tools`, `/animation` and `/parameters` subpaths) |
|
|
49
50
|
| `@pixerate/flair/node` | `exportMotionGraphic`: renders a shader to GIF/MP4 through headless Chrome and ffmpeg | Node.js |
|
|
50
51
|
|
|
@@ -133,12 +134,17 @@ animateCount({
|
|
|
133
134
|
|
|
134
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.
|
|
135
136
|
|
|
136
|
-
|
|
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.
|
|
137
143
|
|
|
138
144
|
```ts
|
|
139
|
-
const motion = renderVectorEffect(getEffect("drip-text") as VectorEffect, { word: "Slop", inline: true, font: "inherit" });
|
|
140
|
-
const
|
|
141
|
-
Object.assign(host.style, { display: "inline-block", height: "0.72em", aspectRatio: `${
|
|
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` });
|
|
142
148
|
new SvgPlayer(host, motion, { loop: false });
|
|
143
149
|
```
|
|
144
150
|
|
|
@@ -164,10 +170,31 @@ import { VectorEffect } from "@pixerate/flair/react";
|
|
|
164
170
|
|
|
165
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.
|
|
166
172
|
- **Reduced motion**: under `prefers-reduced-motion: reduce` the still stays. `reducedMotion="always"` or `"never"` overrides it.
|
|
167
|
-
- **Size**: a block as wide as its container, with the viewBox's aspect ratio. With `inline` (or an effect whose `inline` control is on
|
|
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.
|
|
168
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`.
|
|
169
176
|
|
|
170
|
-
Without React, `svgFrameMarkup(motion, { at: "last" })` (from `@pixerate/flair/vector`) gives the same still as safe `<svg>` markup with no DOM, for any server or framework.
|
|
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.
|
|
178
|
+
|
|
179
|
+
### Svelte
|
|
180
|
+
|
|
181
|
+
`@pixerate/flair/svelte` does the same for Svelte 5, as plain TypeScript (no `.svelte` files, so nothing to compile). The `vectorEffect` action plays an effect by `id` (or any `motion`) in its element, and `vectorEffectStill` gives the server-rendered still:
|
|
182
|
+
|
|
183
|
+
```svelte
|
|
184
|
+
<script>
|
|
185
|
+
import { vectorEffect, vectorEffectStill } from "@pixerate/flair/svelte";
|
|
186
|
+
|
|
187
|
+
let { word = "Slop" } = $props();
|
|
188
|
+
const params = $derived({ id: "drip-text", values: { word, inline: true, font: "inherit" }, loop: false });
|
|
189
|
+
const still = $derived(vectorEffectStill(params));
|
|
190
|
+
</script>
|
|
191
|
+
|
|
192
|
+
<h1>Stop the <span use:vectorEffect={params} style={still.style}>{@html still.markup}</span></h1>
|
|
193
|
+
```
|
|
194
|
+
|
|
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.
|
|
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.
|
|
197
|
+
- **Attachments**: `{@attach fromAction(vectorEffect, () => params)}`, with `fromAction` from `svelte/attachments`.
|
|
171
198
|
|
|
172
199
|
`shader-text` fills letters from a text image: set its `uText` control to `textImage("Your title", { weight: 900 })`, a transparent SVG `data:` URL of any Unicode text.
|
|
173
200
|
|
package/dist/catalog/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as ControlDef, C as ControlValue } from '../controls-
|
|
2
|
-
import { E as EffectDefinition, a as EffectCategory, S as ShaderEffect } from '../types-
|
|
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,
|
|
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
|
/**
|
package/dist/catalog/index.js
CHANGED
|
@@ -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-
|
|
29
|
+
} from "../chunk-LURJMWYM.js";
|
|
28
30
|
import "../chunk-OHW7UG6D.js";
|
|
29
31
|
import "../chunk-EHDJ3CPJ.js";
|
|
30
|
-
import "../chunk-
|
|
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,
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CAMERA_MS,
|
|
3
|
+
CAMERA_STEP_MS,
|
|
4
|
+
EFFECT_TYPES,
|
|
5
|
+
MAX_TILT,
|
|
6
|
+
cameraAt,
|
|
7
|
+
cameraTrack,
|
|
8
|
+
sceneStage
|
|
9
|
+
} from "./chunk-WAMA45G3.js";
|
|
1
10
|
import {
|
|
2
11
|
HOVER_SECONDS,
|
|
3
12
|
MAX_CLICKS,
|
|
@@ -12,21 +21,12 @@ import {
|
|
|
12
21
|
drawFrame,
|
|
13
22
|
resetGlCaches,
|
|
14
23
|
wrapSource
|
|
15
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PMVJP5I4.js";
|
|
16
25
|
import {
|
|
17
26
|
controlValue,
|
|
18
27
|
imageUrls,
|
|
19
28
|
parseControls
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import {
|
|
22
|
-
CAMERA_MS,
|
|
23
|
-
CAMERA_STEP_MS,
|
|
24
|
-
EFFECT_TYPES,
|
|
25
|
-
MAX_TILT,
|
|
26
|
-
cameraAt,
|
|
27
|
-
cameraTrack,
|
|
28
|
-
sceneStage
|
|
29
|
-
} from "./chunk-WAMA45G3.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-
|
|
1620
|
+
//# sourceMappingURL=chunk-LKQM3GSQ.js.map
|