@pixerate/editor 0.161.0 → 0.162.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/dist/agent/index.cjs +36 -35
- package/dist/agent/index.js +7 -6
- package/dist/animation/index.cjs +5 -4
- package/dist/animation/index.js +4 -3
- package/dist/animation-editor/index.cjs +62 -61
- package/dist/animation-editor/index.js +6 -5
- package/dist/canvas/index.cjs +33 -32
- package/dist/canvas/index.js +6 -5
- package/dist/chart/index.cjs +88 -87
- package/dist/chart/index.js +7 -6
- package/dist/{chunk-QMI5HZWA.cjs → chunk-236TKNUR.cjs} +3 -3
- package/dist/{chunk-6UPGM3JB.js → chunk-2TKHLX6H.js} +1 -1
- package/dist/{chunk-3YDQLQH2.cjs → chunk-32MMQYCQ.cjs} +81 -81
- package/dist/{chunk-MHEXLG3M.cjs → chunk-3GJH2MGH.cjs} +37 -37
- package/dist/{chunk-AKDWAWSY.cjs → chunk-3IHNXRUV.cjs} +45 -45
- package/dist/{chunk-TVO6W2Q6.cjs → chunk-4NGVHHJB.cjs} +17 -17
- package/dist/chunk-4VU4CP7R.js +769 -0
- package/dist/{chunk-DBIVICAO.js → chunk-7CKPUUN4.js} +1 -1
- package/dist/{chunk-57JLBGJ5.cjs → chunk-7YBDRJXT.cjs} +8 -8
- package/dist/{chunk-KY3FYKP3.js → chunk-BQWGN5WH.js} +1 -1
- package/dist/{chunk-LEUZ4FRC.cjs → chunk-CIPIESX4.cjs} +3 -3
- package/dist/chunk-CJE5MOIS.js +347 -0
- package/dist/{chunk-5QBRAIVK.js → chunk-CX6JLDFC.js} +3 -3
- package/dist/{chunk-R3QY7PPL.js → chunk-DTSTNRPH.js} +1 -1
- package/dist/{chunk-6LUYFHHN.cjs → chunk-EQ46F75O.cjs} +51 -51
- package/dist/{chunk-UKCJ43YL.cjs → chunk-ES3UEVUT.cjs} +130 -898
- package/dist/{chunk-UM3RPYC5.js → chunk-EVPZ5IKN.js} +1 -1
- package/dist/{chunk-XNQ5EFB4.cjs → chunk-EY22AY6R.cjs} +16 -16
- package/dist/chunk-FKUKJ3XA.cjs +347 -0
- package/dist/{chunk-YABNLNY7.js → chunk-GLMP22FT.js} +3 -3
- package/dist/{chunk-SUF6WRXR.cjs → chunk-GTELFJRE.cjs} +2 -2
- package/dist/{chunk-72BGL3I2.js → chunk-GWV4T5NZ.js} +1 -1
- package/dist/{chunk-AY65VQSU.js → chunk-H3OEM3Q2.js} +1 -1
- package/dist/{chunk-4YWAEV4W.cjs → chunk-HDGBM7EA.cjs} +26 -26
- package/dist/{chunk-H5XX4KHB.js → chunk-HLOKB7WW.js} +5 -3
- package/dist/{chunk-WNAAWLZ5.js → chunk-KGTF55R3.js} +2 -2
- package/dist/{chunk-WPPJH6X4.cjs → chunk-LL3H5XUH.cjs} +6 -4
- package/dist/{chunk-4T44CJ5K.cjs → chunk-NA4UVVJ4.cjs} +15 -15
- package/dist/{chunk-Q6PA362P.js → chunk-NO5QQDHZ.js} +2 -2
- package/dist/{chunk-AA34BA7G.js → chunk-QYZGBVNC.js} +30 -798
- package/dist/chunk-S6X2QRVU.cjs +769 -0
- package/dist/{chunk-SSCL7QQ4.js → chunk-XDCFJEU7.js} +2 -2
- package/dist/color/index.cjs +6 -2
- package/dist/color/index.d.cts +1 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.js +28 -24
- package/dist/color/suggest.d.cts +12 -0
- package/dist/color/suggest.d.ts +12 -0
- package/dist/effects/index.cjs +37 -13
- package/dist/effects/index.js +29 -5
- package/dist/effects/ui.d.cts +20 -3
- package/dist/effects/ui.d.ts +20 -3
- package/dist/export/index.cjs +6 -5
- package/dist/export/index.js +5 -4
- package/dist/extensions/index.cjs +9 -8
- package/dist/extensions/index.js +8 -7
- package/dist/gradient/index.cjs +28 -26
- package/dist/gradient/index.js +7 -5
- package/dist/image-editor/index.cjs +638 -637
- package/dist/image-editor/index.js +5 -4
- package/dist/index.cjs +15 -14
- package/dist/index.js +9 -8
- package/dist/paint-editor/index.cjs +15 -14
- package/dist/paint-editor/index.js +5 -4
- package/dist/typography/accessibility.d.cts +44 -0
- package/dist/typography/accessibility.d.ts +44 -0
- package/dist/typography/catalog.d.cts +98 -0
- package/dist/typography/catalog.d.ts +98 -0
- package/dist/typography/index.cjs +1099 -0
- package/dist/typography/index.d.cts +16 -0
- package/dist/typography/index.d.ts +16 -0
- package/dist/typography/index.js +1099 -0
- package/dist/typography/metrics.d.cts +31 -0
- package/dist/typography/metrics.d.ts +31 -0
- package/dist/typography/picker.d.cts +132 -0
- package/dist/typography/picker.d.ts +132 -0
- package/dist/typography/registry.d.cts +66 -0
- package/dist/typography/registry.d.ts +66 -0
- package/dist/typography/scale.d.cts +62 -0
- package/dist/typography/scale.d.ts +62 -0
- package/dist/typography/segment.d.cts +26 -0
- package/dist/typography/segment.d.ts +26 -0
- package/dist/typography/stack.d.cts +26 -0
- package/dist/typography/stack.d.ts +26 -0
- package/dist/typography/tools.d.cts +34 -0
- package/dist/typography/tools.d.ts +34 -0
- package/dist/typography/types.d.cts +96 -0
- package/dist/typography/types.d.ts +96 -0
- package/dist/typography/weight.d.cts +13 -0
- package/dist/typography/weight.d.ts +13 -0
- package/dist/vector/index.cjs +950 -949
- package/dist/vector/index.js +5 -4
- package/dist/video-editor/index.cjs +5 -4
- package/dist/video-editor/index.js +4 -3
- package/package.json +11 -1
- package/skills/README.md +1 -0
- package/skills/pixerate-typography/SKILL.md +91 -0
package/dist/vector/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
reverseMorphContour,
|
|
39
39
|
subpathToMorphContour,
|
|
40
40
|
turnMorphContour
|
|
41
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-KGTF55R3.js";
|
|
42
42
|
import {
|
|
43
43
|
DEFAULT_VECTOR_FONT,
|
|
44
44
|
IDENTITY_MATRIX,
|
|
@@ -507,7 +507,7 @@ import {
|
|
|
507
507
|
withVectorStrokes,
|
|
508
508
|
withVectorTargetPaint,
|
|
509
509
|
zigzagPaths
|
|
510
|
-
} from "../chunk-
|
|
510
|
+
} from "../chunk-2TKHLX6H.js";
|
|
511
511
|
import "../chunk-A5UCR2TO.js";
|
|
512
512
|
import {
|
|
513
513
|
createProvenance
|
|
@@ -566,11 +566,12 @@ import {
|
|
|
566
566
|
HistoryManager
|
|
567
567
|
} from "../chunk-RNSANXPT.js";
|
|
568
568
|
import "../chunk-5UJHB3BW.js";
|
|
569
|
-
import "../chunk-
|
|
569
|
+
import "../chunk-BQWGN5WH.js";
|
|
570
570
|
import {
|
|
571
571
|
hexToRgba
|
|
572
572
|
} from "../chunk-2WPNAGHI.js";
|
|
573
|
-
import "../chunk-
|
|
573
|
+
import "../chunk-QYZGBVNC.js";
|
|
574
|
+
import "../chunk-4VU4CP7R.js";
|
|
574
575
|
import "../chunk-6ONMQ6WF.js";
|
|
575
576
|
|
|
576
577
|
// src/vector/trace.ts
|
|
@@ -168,14 +168,15 @@ require('../chunk-2BSBFBOA.cjs');
|
|
|
168
168
|
var _chunkFJ2MSI43cjs = require('../chunk-FJ2MSI43.cjs');
|
|
169
169
|
|
|
170
170
|
|
|
171
|
-
var
|
|
171
|
+
var _chunkGTELFJREcjs = require('../chunk-GTELFJRE.cjs');
|
|
172
172
|
|
|
173
173
|
|
|
174
174
|
|
|
175
175
|
var _chunkDWJJI6RTcjs = require('../chunk-DWJJI6RT.cjs');
|
|
176
|
-
require('../chunk-
|
|
176
|
+
require('../chunk-CIPIESX4.cjs');
|
|
177
177
|
require('../chunk-A6QWKBJP.cjs');
|
|
178
|
-
require('../chunk-
|
|
178
|
+
require('../chunk-ES3UEVUT.cjs');
|
|
179
|
+
require('../chunk-S6X2QRVU.cjs');
|
|
179
180
|
require('../chunk-IPJ3TEYR.cjs');
|
|
180
181
|
|
|
181
182
|
// src/video-editor/parse.ts
|
|
@@ -3356,7 +3357,7 @@ var VideoEditorController = (_class7 = class _VideoEditorController {
|
|
|
3356
3357
|
this.readOnly = _nullishCoalesce(options.readOnly, () => ( false));
|
|
3357
3358
|
this.previewScale = checkPreviewScale(_nullishCoalesce(options.previewScale, () => ( "auto")));
|
|
3358
3359
|
this.onChange = options.onChange;
|
|
3359
|
-
this.player = new (0,
|
|
3360
|
+
this.player = new (0, _chunkGTELFJREcjs.AnimationPlayer)({ clock: options.clock, duration: () => _chunk3OSXHLITcjs.videoProjectDuration.call(void 0, this.project), loop: "none" });
|
|
3360
3361
|
this.state = this.computeState();
|
|
3361
3362
|
this.connect();
|
|
3362
3363
|
}
|
|
@@ -168,14 +168,15 @@ import {
|
|
|
168
168
|
} from "../chunk-RNSANXPT.js";
|
|
169
169
|
import {
|
|
170
170
|
AnimationPlayer
|
|
171
|
-
} from "../chunk-
|
|
171
|
+
} from "../chunk-H3OEM3Q2.js";
|
|
172
172
|
import {
|
|
173
173
|
CUBIC_BEZIER_PRESETS,
|
|
174
174
|
evaluateEasing
|
|
175
175
|
} from "../chunk-5UJHB3BW.js";
|
|
176
|
-
import "../chunk-
|
|
176
|
+
import "../chunk-BQWGN5WH.js";
|
|
177
177
|
import "../chunk-2WPNAGHI.js";
|
|
178
|
-
import "../chunk-
|
|
178
|
+
import "../chunk-QYZGBVNC.js";
|
|
179
|
+
import "../chunk-4VU4CP7R.js";
|
|
179
180
|
import "../chunk-6ONMQ6WF.js";
|
|
180
181
|
|
|
181
182
|
// src/video-editor/parse.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.162.0",
|
|
4
4
|
"description": "UI-agnostic rich text and media editing core library",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -244,6 +244,16 @@
|
|
|
244
244
|
"default": "./dist/color/index.cjs"
|
|
245
245
|
}
|
|
246
246
|
},
|
|
247
|
+
"./typography": {
|
|
248
|
+
"import": {
|
|
249
|
+
"types": "./dist/typography/index.d.ts",
|
|
250
|
+
"default": "./dist/typography/index.js"
|
|
251
|
+
},
|
|
252
|
+
"require": {
|
|
253
|
+
"types": "./dist/typography/index.d.cts",
|
|
254
|
+
"default": "./dist/typography/index.cjs"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
247
257
|
"./gradient": {
|
|
248
258
|
"import": {
|
|
249
259
|
"types": "./dist/gradient/index.d.ts",
|
package/skills/README.md
CHANGED
|
@@ -25,6 +25,7 @@ that uses the tools can load the matching skill.
|
|
|
25
25
|
| [`pixerate-tokens`](pixerate-tokens/SKILL.md) | Design tokens: collections, modes, variables and aliases, through the whole-set document tools. |
|
|
26
26
|
| [`pixerate-effect-authoring`](pixerate-effect-authoring/SKILL.md) | Authoring shaders and procedural effects: inspecting parameters and source code, setting values and presets, keyframing animation tracks, playback timing, and previewing. |
|
|
27
27
|
| [`pixerate-color`](pixerate-color/SKILL.md) | Colour inspection, WCAG accessibility and contrast optimization, CVD simulation, palette audits, harmonies, and OKLab/OKLCH blends. |
|
|
28
|
+
| [`pixerate-typography`](pixerate-typography/SKILL.md) | Fonts and fallback stacks, font loading, modular type scales and hierarchies, fluid sizes, readability and type-aware contrast audits, text segmentation, the font picker. |
|
|
28
29
|
|
|
29
30
|
## Using them
|
|
30
31
|
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pixerate-typography
|
|
3
|
+
description: How to choose and load fonts, build resilient font-family fallback stacks, generate modular type scales and heading hierarchies, compute fluid clamp() sizes, audit body text for line length and line spacing, check text contrast with the real font size and weight, split text into letters, words or lines for animation, and drive a font picker. Use when asked to pick or pair fonts, set up type tokens, check readability or legibility, or animate live text.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Typography tools
|
|
7
|
+
|
|
8
|
+
The typography module is DOM-free: it works on numbers (px sizes, unitless line-heights, em
|
|
9
|
+
tracking) and family names, never on rendered pixels. Fonts come from a **font provider** the
|
|
10
|
+
host supplies (installed system fonts, a web font service, a design system's families); by
|
|
11
|
+
default it is a catalog of common system fonts, which says what is *usually* installed, not
|
|
12
|
+
what this machine has.
|
|
13
|
+
|
|
14
|
+
## Mental model
|
|
15
|
+
|
|
16
|
+
- A **font spec** is `{ family, weight, style, size (px), lineHeight (unitless), letterSpacing (em) }`.
|
|
17
|
+
- A **type scale** multiplies a base size by a ratio per step (`16 × 1.25² = 25`). A **hierarchy**
|
|
18
|
+
names the steps: `caption` (−2), `body-sm`, `body` (0), `h4`, `h3`, `h2`, `h1`, `display` (5).
|
|
19
|
+
- A **fallback stack** is the `font-family` value: your family, then a tested cross-platform stack
|
|
20
|
+
for its category, ending in a generic family, so text still renders when the font is missing.
|
|
21
|
+
- **Large text** under WCAG 2 is 24px, or 18.67px (14pt) at weight 700+. It needs 3:1 contrast
|
|
22
|
+
for AA instead of 4.5:1. The accessibility tool decides this from the spec for you.
|
|
23
|
+
|
|
24
|
+
## Working method
|
|
25
|
+
|
|
26
|
+
1. **Find fonts.** `list_fonts` with `category`, `weight`, `style` or `query`. Only use families it
|
|
27
|
+
returns (or that the user names), and always ship them inside a stack from `resolve_font_stack`.
|
|
28
|
+
2. **Load before rendering.** `load_font` before drawing or capturing text in a web font, so the
|
|
29
|
+
first frame does not use the fallback. `loaded: false` means the fallback will show.
|
|
30
|
+
3. **Set up the scale.** `generate_type_hierarchy` for named tokens and ready CSS custom
|
|
31
|
+
properties; `suggest_type_scale` for arbitrary steps. Smaller ratios (minor/major third) suit
|
|
32
|
+
dense UI; larger ones (perfect fourth/fifth, golden) suit editorial and marketing pages.
|
|
33
|
+
4. **Make it fluid (optional).** `compute_fluid_type_size` for headings that grow between two
|
|
34
|
+
viewport widths. Bounds are in rem so browser zoom and font-size settings still work.
|
|
35
|
+
5. **Audit the body text.** `audit_text_readability` with the real text, `fontSize`, `lineHeight`
|
|
36
|
+
and the column `width`: fix `lineLength.status` (45–75 characters) and `lineSpacing`
|
|
37
|
+
(at least 1.5) before polishing anything else.
|
|
38
|
+
6. **Check contrast with the type.** `check_typography_accessibility` with foreground, background,
|
|
39
|
+
`fontSize` and `fontWeight`. Use `suggestion` when `passesAA` is false. For pure colour work
|
|
40
|
+
(palettes, dual colours) use the `pixerate-color` tools.
|
|
41
|
+
7. **Animate live text.** `segment_text` splits into `grapheme`, `word` (with `wordsOnly`),
|
|
42
|
+
`sentence` or `line` (with `maxCharacters` to wrap) and returns UTF-16 `start` / `end`
|
|
43
|
+
offsets, so letters and words can be staggered without converting text to outlines.
|
|
44
|
+
8. **Drive the on-screen picker.** When a font picker is mounted, `get_font_selection` shows what
|
|
45
|
+
is chosen, `list_picker_fonts` what it offers, and `set_font_selection` changes any fields in
|
|
46
|
+
one step and returns the new selection.
|
|
47
|
+
|
|
48
|
+
## Best practices
|
|
49
|
+
|
|
50
|
+
- **Two families are usually enough**: one for text, optionally one for headings. Pair by contrast
|
|
51
|
+
of category (serif headings with sans text, or the reverse), not by two similar sans-serifs.
|
|
52
|
+
- **Body text at 16px or more**, line-height 1.5–1.7, about 66 characters per line
|
|
53
|
+
(`max-width: 66ch`). Headings get tighter leading (1.1–1.3) and slightly negative tracking; small
|
|
54
|
+
captions slightly positive tracking. The scale tools already recommend these.
|
|
55
|
+
- **Use weight 400+ below 24px.** Thin weights lower effective contrast even when the ratio passes.
|
|
56
|
+
- **Avoid long runs of capitals** for body text; keep all-caps to short labels.
|
|
57
|
+
- **Prefer rem and clamp()** over fixed px for type on the web, so user settings apply.
|
|
58
|
+
- **Never assume a font is installed.** A system font in the catalog may be missing on Linux or
|
|
59
|
+
Android; the fallback stack is what makes that safe.
|
|
60
|
+
|
|
61
|
+
## Tool reference
|
|
62
|
+
|
|
63
|
+
| Tool | When to use | Returns |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `list_fonts` | Discover families the host offers; filter by `category`, `source`, `weight`, `style`, `query`; `limit` default 50 | `{ fonts: [{ family, category, weights, styles, isVariable?, source }], total, truncated }` |
|
|
66
|
+
| `resolve_font_stack` | Turn a family (or stack) into a resilient `font-family` value for its category; also says if the provider lists it | `{ stack, families, category, available }` |
|
|
67
|
+
| `suggest_type_scale` | Sizes for arbitrary integer `steps` (-12…12) from `baseSize` (px, default 16) and `ratio` (name or number, default major-third) | `{ ratio, baseSize, steps: [{ name, step, size, lineHeight, letterSpacing }] }` |
|
|
68
|
+
| `generate_type_hierarchy` | Named tokens caption…display on one scale, with CSS custom properties (`prefix`, `selector`) | `{ ratio, ratioName?, baseSize, steps: { body, h1, … }, css }` |
|
|
69
|
+
| `compute_fluid_type_size` | A size that grows from `minSize` at `minViewport` to `maxSize` at `maxViewport` (all px) | `{ clampCss, slope, intercept, samples }` |
|
|
70
|
+
| `audit_text_readability` | Check body text: line length (own lines, or `width` + `fontSize`), line spacing, capitals, tiny or tight type, reading time | `{ lineLength, lineSpacing, allCaps, wordCount, estimatedReadingTimeSeconds, issues }` |
|
|
71
|
+
| `check_typography_accessibility` | Contrast for text of a given `fontSize` (px) and `fontWeight`, deciding large text itself; suggests a passing foreground | `{ ratio, large, level, passesAA, passesAAA, required, suggestion?, largeTextMinSize, issues }` |
|
|
72
|
+
| `segment_text` | Split text into graphemes, words, sentences or lines with offsets, for staggered animation | `{ segments: [{ text, start, end, index, isWordLike? }], count }` |
|
|
73
|
+
| `load_font` | Load a family's face (`weight`, `style`) before rendering or capturing; only listed when the provider can load | `{ family, weight, style, loaded }` |
|
|
74
|
+
| `get_font_selection` | Read the mounted font picker's value, CSS and the chosen family's weights and styles | `{ value, css, availableWeights, availableStyles }` |
|
|
75
|
+
| `list_picker_fonts` | Families the mounted picker offers (by `category`, `query`), plus recent families | `{ fonts, recent, total, truncated }` |
|
|
76
|
+
| `set_font_selection` | Change the picker's family, weight, style, size, lineHeight or letterSpacing in one validated step; weights snap to what the family has | `{ value, css, availableWeights, availableStyles }` |
|
|
77
|
+
|
|
78
|
+
## Pitfalls
|
|
79
|
+
|
|
80
|
+
- **Sizes are CSS px.** 12pt is 16px; 18pt is 24px. Convert before calling the tools.
|
|
81
|
+
- **lineHeight is a multiplier**, not px: 24px leading on 16px text is `1.5`. When it is omitted
|
|
82
|
+
the audit assumes the browser's `normal` (about 1.2) and says so with `assumed: true`.
|
|
83
|
+
- **`line` segmentation does not know the renderer's wrapping.** Without `maxCharacters` it only
|
|
84
|
+
splits on line breaks; with it, it wraps by character count, which approximates proportional
|
|
85
|
+
fonts.
|
|
86
|
+
- **A one-line string is not a measure.** `too-short` on a single heading is expected; pass the
|
|
87
|
+
column `width` and `fontSize` to estimate how paragraphs will wrap.
|
|
88
|
+
- **The system catalog is not detection.** Without the host opting into Local Font Access,
|
|
89
|
+
`list_fonts` lists commonly installed fonts. Always use `resolve_font_stack` output.
|
|
90
|
+
- **Picker fonts may differ from `list_fonts`.** `set_font_selection` only accepts families the
|
|
91
|
+
picker lists; check with `list_picker_fonts`.
|