@pixerate/editor-react 0.106.0 → 0.107.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.
@@ -2699,10 +2699,11 @@ function EffectParameters({
2699
2699
  onPreset,
2700
2700
  onPresetName,
2701
2701
  renderControlAddon,
2702
+ fonts,
2702
2703
  disabled = false,
2703
2704
  className = ""
2704
2705
  }) {
2705
- const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
2706
+ const fields = (0, import_react19.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
2706
2707
  const idBase = (0, import_react19.useId)();
2707
2708
  const gesture = import_react19.default.useRef(null);
2708
2709
  const count = import_react19.default.useRef(0);
@@ -3,7 +3,7 @@ import {
3
3
  EffectsBrowser,
4
4
  useEffectDescription,
5
5
  useEffects
6
- } from "../chunk-Q7LAFHGP.js";
6
+ } from "../chunk-ZQ6H2C7N.js";
7
7
  import "../chunk-5LFQ2UQZ.js";
8
8
  import "../chunk-KIRIU53A.js";
9
9
  import "../chunk-3I7FOSLF.js";
@@ -3454,10 +3454,11 @@ function EffectParameters({
3454
3454
  onPreset,
3455
3455
  onPresetName,
3456
3456
  renderControlAddon,
3457
+ fonts,
3457
3458
  disabled = false,
3458
3459
  className = ""
3459
3460
  }) {
3460
- const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
3461
+ const fields = (0, import_react27.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3461
3462
  const idBase = (0, import_react27.useId)();
3462
3463
  const gesture = import_react27.default.useRef(null);
3463
3464
  const count = import_react27.default.useRef(0);
@@ -2,7 +2,7 @@ import {
2
2
  EffectParameters,
3
3
  EffectsBrowser,
4
4
  useEffectDescription
5
- } from "../chunk-Q7LAFHGP.js";
5
+ } from "../chunk-ZQ6H2C7N.js";
6
6
  import "../chunk-5LFQ2UQZ.js";
7
7
  import "../chunk-KIRIU53A.js";
8
8
  import "../chunk-3I7FOSLF.js";
@@ -6,7 +6,7 @@ import {
6
6
  EffectsBrowser,
7
7
  useEffectDescription,
8
8
  useEffects
9
- } from "./chunk-Q7LAFHGP.js";
9
+ } from "./chunk-ZQ6H2C7N.js";
10
10
  import {
11
11
  PresenceLayer,
12
12
  useAgentPlayback,
@@ -152,10 +152,11 @@ function EffectParameters({
152
152
  onPreset,
153
153
  onPresetName,
154
154
  renderControlAddon,
155
+ fonts,
155
156
  disabled = false,
156
157
  className = ""
157
158
  }) {
158
- const fields = useMemo2(() => effectParameterFields(description), [description]);
159
+ const fields = useMemo2(() => effectParameterFields(description, { fonts }), [description, fonts]);
159
160
  const idBase = useId();
160
161
  const gesture = React3.useRef(null);
161
162
  const count = React3.useRef(0);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type EffectDescription } from '@pixerate/editor/effects';
2
+ import { type EffectDescription, type EffectFieldOptions } from '@pixerate/editor/effects';
3
3
  import { type ParameterValue } from '@pixerate/editor/parameters';
4
4
  export interface EffectParametersProps {
5
5
  /** The effect's description (`describe`). */
@@ -21,6 +21,8 @@ export interface EffectParametersProps {
21
21
  onPresetName?: (name: string) => void;
22
22
  /** Optional addon rendered next to the control label (e.g. keyframe toggle button). */
23
23
  renderControlAddon?: (control: string) => React.ReactNode;
24
+ /** Families offered by font controls (`format: "font"`); default the system font catalog. */
25
+ fonts?: EffectFieldOptions['fonts'];
24
26
  disabled?: boolean;
25
27
  className?: string;
26
28
  }
@@ -29,4 +31,4 @@ export interface EffectParametersProps {
29
31
  * numbers, switches, choices, colour pickers, vectors and text, with each control's description,
30
32
  * per-control reset and the effect's presets.
31
33
  */
32
- export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, disabled, className }: EffectParametersProps): React.JSX.Element;
34
+ export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, fonts, disabled, className }: EffectParametersProps): React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type EffectDescription } from '@pixerate/editor/effects';
2
+ import { type EffectDescription, type EffectFieldOptions } from '@pixerate/editor/effects';
3
3
  import { type ParameterValue } from '@pixerate/editor/parameters';
4
4
  export interface EffectParametersProps {
5
5
  /** The effect's description (`describe`). */
@@ -21,6 +21,8 @@ export interface EffectParametersProps {
21
21
  onPresetName?: (name: string) => void;
22
22
  /** Optional addon rendered next to the control label (e.g. keyframe toggle button). */
23
23
  renderControlAddon?: (control: string) => React.ReactNode;
24
+ /** Families offered by font controls (`format: "font"`); default the system font catalog. */
25
+ fonts?: EffectFieldOptions['fonts'];
24
26
  disabled?: boolean;
25
27
  className?: string;
26
28
  }
@@ -29,4 +31,4 @@ export interface EffectParametersProps {
29
31
  * numbers, switches, choices, colour pickers, vectors and text, with each control's description,
30
32
  * per-control reset and the effect's presets.
31
33
  */
32
- export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, disabled, className }: EffectParametersProps): React.JSX.Element;
34
+ export declare function EffectParameters({ description, values, onChange, onReset, keyframed, onPreset, onPresetName, renderControlAddon, fonts, disabled, className }: EffectParametersProps): React.JSX.Element;
@@ -1599,10 +1599,11 @@ function EffectParameters({
1599
1599
  onPreset,
1600
1600
  onPresetName,
1601
1601
  renderControlAddon,
1602
+ fonts,
1602
1603
  disabled = false,
1603
1604
  className = ""
1604
1605
  }) {
1605
- const fields = (0, import_react8.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
1606
+ const fields = (0, import_react8.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
1606
1607
  const idBase = (0, import_react8.useId)();
1607
1608
  const gesture = import_react8.default.useRef(null);
1608
1609
  const count = import_react8.default.useRef(0);
@@ -6,7 +6,7 @@ import {
6
6
  useEffectAuthoring,
7
7
  useEffectDescription,
8
8
  useEffects
9
- } from "../chunk-Q7LAFHGP.js";
9
+ } from "../chunk-ZQ6H2C7N.js";
10
10
  import "../chunk-5LFQ2UQZ.js";
11
11
  import "../chunk-KIRIU53A.js";
12
12
  import "../chunk-3I7FOSLF.js";
@@ -3677,10 +3677,11 @@ function EffectParameters({
3677
3677
  onPreset,
3678
3678
  onPresetName,
3679
3679
  renderControlAddon,
3680
+ fonts,
3680
3681
  disabled = false,
3681
3682
  className = ""
3682
3683
  }) {
3683
- const fields = (0, import_react18.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
3684
+ const fields = (0, import_react18.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3684
3685
  const idBase = (0, import_react18.useId)();
3685
3686
  const gesture = import_react18.default.useRef(null);
3686
3687
  const count = import_react18.default.useRef(0);
@@ -20,9 +20,9 @@ import {
20
20
  useImageEditor,
21
21
  useImageEffectsTools,
22
22
  useImageHistogram
23
- } from "../chunk-CEV4OEOY.js";
23
+ } from "../chunk-6XI62THS.js";
24
24
  import "../chunk-AJCWF6SN.js";
25
- import "../chunk-Q7LAFHGP.js";
25
+ import "../chunk-ZQ6H2C7N.js";
26
26
  import "../chunk-5LFQ2UQZ.js";
27
27
  import "../chunk-KIRIU53A.js";
28
28
  import "../chunk-3I7FOSLF.js";
package/dist/index.cjs CHANGED
@@ -7384,10 +7384,11 @@ function EffectParameters({
7384
7384
  onPreset,
7385
7385
  onPresetName,
7386
7386
  renderControlAddon,
7387
+ fonts,
7387
7388
  disabled = false,
7388
7389
  className = ""
7389
7390
  }) {
7390
- const fields = (0, import_react54.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
7391
+ const fields = (0, import_react54.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
7391
7392
  const idBase = (0, import_react54.useId)();
7392
7393
  const gesture = import_react54.default.useRef(null);
7393
7394
  const count = import_react54.default.useRef(0);
package/dist/index.js CHANGED
@@ -44,9 +44,9 @@ import {
44
44
  useImageEditor,
45
45
  useImageEffectsTools,
46
46
  useImageHistogram
47
- } from "./chunk-CEV4OEOY.js";
47
+ } from "./chunk-6XI62THS.js";
48
48
  import "./chunk-AJCWF6SN.js";
49
- import "./chunk-Q7LAFHGP.js";
49
+ import "./chunk-ZQ6H2C7N.js";
50
50
  import "./chunk-5LFQ2UQZ.js";
51
51
  import "./chunk-KIRIU53A.js";
52
52
  import "./chunk-3I7FOSLF.js";
@@ -2987,10 +2987,11 @@ function EffectParameters({
2987
2987
  onPreset,
2988
2988
  onPresetName,
2989
2989
  renderControlAddon,
2990
+ fonts,
2990
2991
  disabled = false,
2991
2992
  className = ""
2992
2993
  }) {
2993
- const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
2994
+ const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
2994
2995
  const idBase = (0, import_react21.useId)();
2995
2996
  const gesture = import_react21.default.useRef(null);
2996
2997
  const count = import_react21.default.useRef(0);
@@ -5,7 +5,7 @@ import {
5
5
  EffectParameters,
6
6
  EffectsBrowser,
7
7
  useEffectDescription
8
- } from "../chunk-Q7LAFHGP.js";
8
+ } from "../chunk-ZQ6H2C7N.js";
9
9
  import "../chunk-5LFQ2UQZ.js";
10
10
  import "../chunk-KIRIU53A.js";
11
11
  import "../chunk-3I7FOSLF.js";
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import { type FontPickerModel, type FontProvider, type FontSpec, type FontSummary } from "@pixerate/editor/typography";
3
+ export interface FontPickerProps {
4
+ /** The selected font (controlled). */
5
+ value?: Partial<FontSpec>;
6
+ /** Called when the user (or an agent through the model's tools) picks a different font, weight or style. */
7
+ onChange?: (value: FontSpec) => void;
8
+ /** An existing model; when given, `provider`, `fonts` and `previewText` are ignored. */
9
+ model?: FontPickerModel;
10
+ /** Where fonts come from (fetched on mount). */
11
+ provider?: FontProvider;
12
+ /** A fixed list of fonts. */
13
+ fonts?: readonly FontSummary[];
14
+ /** Text for the live preview. */
15
+ previewText?: string;
16
+ /** Show the live preview (default true). */
17
+ showPreview?: boolean;
18
+ /** Show the category filter (default true). */
19
+ showCategories?: boolean;
20
+ /** Show the weight and style selects (default true). */
21
+ showWeight?: boolean;
22
+ /** Most options rendered at once (default 200); search to reach the rest. */
23
+ maxResults?: number;
24
+ disabled?: boolean;
25
+ className?: string;
26
+ id?: string;
27
+ /** Accessible label for the group (default "Font picker"). */
28
+ "aria-label"?: string;
29
+ }
30
+ /** Body of the picker, driven by a model (shared with {@link TypographyControl}). */
31
+ export declare function FontPickerView({ model, showPreview, showCategories, showWeight, maxResults, disabled, className, id, "aria-label": ariaLabel, children, }: {
32
+ model: FontPickerModel;
33
+ showPreview?: boolean;
34
+ showCategories?: boolean;
35
+ showWeight?: boolean;
36
+ maxResults?: number;
37
+ disabled?: boolean;
38
+ className?: string;
39
+ id?: string;
40
+ "aria-label"?: string;
41
+ children?: React.ReactNode;
42
+ }): React.JSX.Element;
43
+ /**
44
+ * Searchable font picker: a combobox over a listbox of families rendered in their own face, a
45
+ * category filter, weight and style selects, and a live preview. Arrow keys, Home, End, Enter and
46
+ * Escape work in the search field.
47
+ */
48
+ export declare function FontPicker({ value, onChange, model, provider, fonts, previewText, ...view }: FontPickerProps): React.JSX.Element;
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import { type FontPickerModel, type FontProvider, type FontSpec, type FontSummary } from "@pixerate/editor/typography";
3
+ export interface FontPickerProps {
4
+ /** The selected font (controlled). */
5
+ value?: Partial<FontSpec>;
6
+ /** Called when the user (or an agent through the model's tools) picks a different font, weight or style. */
7
+ onChange?: (value: FontSpec) => void;
8
+ /** An existing model; when given, `provider`, `fonts` and `previewText` are ignored. */
9
+ model?: FontPickerModel;
10
+ /** Where fonts come from (fetched on mount). */
11
+ provider?: FontProvider;
12
+ /** A fixed list of fonts. */
13
+ fonts?: readonly FontSummary[];
14
+ /** Text for the live preview. */
15
+ previewText?: string;
16
+ /** Show the live preview (default true). */
17
+ showPreview?: boolean;
18
+ /** Show the category filter (default true). */
19
+ showCategories?: boolean;
20
+ /** Show the weight and style selects (default true). */
21
+ showWeight?: boolean;
22
+ /** Most options rendered at once (default 200); search to reach the rest. */
23
+ maxResults?: number;
24
+ disabled?: boolean;
25
+ className?: string;
26
+ id?: string;
27
+ /** Accessible label for the group (default "Font picker"). */
28
+ "aria-label"?: string;
29
+ }
30
+ /** Body of the picker, driven by a model (shared with {@link TypographyControl}). */
31
+ export declare function FontPickerView({ model, showPreview, showCategories, showWeight, maxResults, disabled, className, id, "aria-label": ariaLabel, children, }: {
32
+ model: FontPickerModel;
33
+ showPreview?: boolean;
34
+ showCategories?: boolean;
35
+ showWeight?: boolean;
36
+ maxResults?: number;
37
+ disabled?: boolean;
38
+ className?: string;
39
+ id?: string;
40
+ "aria-label"?: string;
41
+ children?: React.ReactNode;
42
+ }): React.JSX.Element;
43
+ /**
44
+ * Searchable font picker: a combobox over a listbox of families rendered in their own face, a
45
+ * category filter, weight and style selects, and a live preview. Arrow keys, Home, End, Enter and
46
+ * Escape work in the search field.
47
+ */
48
+ export declare function FontPicker({ value, onChange, model, provider, fonts, previewText, ...view }: FontPickerProps): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { type FontPickerProps } from "./FontPicker.cjs";
3
+ export interface TypographyControlProps extends FontPickerProps {
4
+ /** Accessible label for the group (default "Typography"). */
5
+ "aria-label"?: string;
6
+ }
7
+ /**
8
+ * Composite inspector control: the {@link FontPicker} plus size (px), line height and letter
9
+ * spacing (em). Emits the whole {@link FontSpec} through `onChange`.
10
+ */
11
+ export declare function TypographyControl({ value, onChange, model, provider, fonts, previewText, disabled, "aria-label": ariaLabel, ...view }: TypographyControlProps): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { type FontPickerProps } from "./FontPicker.js";
3
+ export interface TypographyControlProps extends FontPickerProps {
4
+ /** Accessible label for the group (default "Typography"). */
5
+ "aria-label"?: string;
6
+ }
7
+ /**
8
+ * Composite inspector control: the {@link FontPicker} plus size (px), line height and letter
9
+ * spacing (em). Emits the whole {@link FontSpec} through `onChange`.
10
+ */
11
+ export declare function TypographyControl({ value, onChange, model, provider, fonts, previewText, disabled, "aria-label": ariaLabel, ...view }: TypographyControlProps): React.JSX.Element;
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/typography/index.ts
22
+ var typography_exports = {};
23
+ __export(typography_exports, {
24
+ FontPicker: () => FontPicker,
25
+ FontPickerView: () => FontPickerView,
26
+ TypographyControl: () => TypographyControl,
27
+ useFontPicker: () => useFontPicker
28
+ });
29
+ module.exports = __toCommonJS(typography_exports);
30
+
31
+ // src/typography/FontPicker.tsx
32
+ var import_react2 = require("react");
33
+ var import_typography2 = require("@pixerate/editor/typography");
34
+
35
+ // src/typography/useFontPicker.ts
36
+ var import_react = require("react");
37
+ var import_typography = require("@pixerate/editor/typography");
38
+ function useFontPicker(options = {}) {
39
+ const onChangeRef = (0, import_react.useRef)(options.onChange);
40
+ onChangeRef.current = options.onChange;
41
+ const [model] = (0, import_react.useState)(() => options.model ?? new import_typography.FontPickerModel({ ...options, onChange: void 0 }));
42
+ const state = (0, import_react.useSyncExternalStore)(model.subscribe, model.getState, model.getState);
43
+ (0, import_react.useEffect)(() => model.onValueChange((value) => onChangeRef.current?.(value)), [model]);
44
+ const valueKey = options.value ? JSON.stringify(options.value) : "";
45
+ (0, import_react.useEffect)(() => {
46
+ if (options.value) model.setValue(options.value);
47
+ }, [model, valueKey]);
48
+ (0, import_react.useEffect)(() => {
49
+ if (!options.model && options.provider) void model.refresh();
50
+ }, [model]);
51
+ return { model, state };
52
+ }
53
+
54
+ // src/typography/FontPicker.tsx
55
+ var import_jsx_runtime = require("react/jsx-runtime");
56
+ var FIELD = {
57
+ boxSizing: "border-box",
58
+ width: "100%",
59
+ padding: "5px 8px",
60
+ borderRadius: "6px",
61
+ border: "1px solid var(--pixerate-font-picker-border, #3a4152)",
62
+ background: "var(--pixerate-font-picker-field-bg, #151922)",
63
+ color: "inherit",
64
+ font: "inherit"
65
+ };
66
+ function FontPickerView({
67
+ model,
68
+ showPreview = true,
69
+ showCategories = true,
70
+ showWeight = true,
71
+ maxResults = 200,
72
+ disabled = false,
73
+ className,
74
+ id,
75
+ "aria-label": ariaLabel = "Font picker",
76
+ children
77
+ }) {
78
+ const { state } = useFontPicker({ model });
79
+ const baseId = (0, import_react2.useId)();
80
+ const listId = `${baseId}-list`;
81
+ const optionId = (i) => `${baseId}-opt-${i}`;
82
+ const listRef = (0, import_react2.useRef)(null);
83
+ const shown = state.results.slice(0, maxResults);
84
+ const css = model.css;
85
+ (0, import_react2.useEffect)(() => {
86
+ if (state.highlighted < 0) return;
87
+ const el = listRef.current?.ownerDocument.getElementById(optionId(state.highlighted));
88
+ el?.scrollIntoView?.({ block: "nearest" });
89
+ }, [state.highlighted]);
90
+ const status = state.loading ? "Loading fonts\u2026" : state.error ? `Could not load fonts: ${state.error}` : state.loadStatus[state.value.family.toLowerCase()] === "failed" ? `${state.value.family} could not be loaded; a fallback is shown.` : "";
91
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
92
+ "div",
93
+ {
94
+ id,
95
+ role: "group",
96
+ "aria-label": ariaLabel,
97
+ "aria-disabled": disabled || void 0,
98
+ className,
99
+ style: {
100
+ boxSizing: "border-box",
101
+ width: "var(--pixerate-font-picker-width, 280px)",
102
+ borderRadius: "var(--pixerate-font-picker-radius, 8px)",
103
+ background: "var(--pixerate-font-picker-bg, #1f2430)",
104
+ color: "var(--pixerate-font-picker-fg, #f0f2f5)",
105
+ padding: "12px",
106
+ display: "flex",
107
+ flexDirection: "column",
108
+ gap: "8px",
109
+ fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
110
+ fontSize: "12px",
111
+ opacity: disabled ? 0.6 : 1,
112
+ pointerEvents: disabled ? "none" : "auto"
113
+ },
114
+ children: [
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
117
+ "input",
118
+ {
119
+ type: "text",
120
+ role: "combobox",
121
+ "aria-label": "Search fonts",
122
+ "aria-expanded": "true",
123
+ "aria-controls": listId,
124
+ "aria-autocomplete": "list",
125
+ "aria-activedescendant": state.highlighted >= 0 && state.highlighted < shown.length ? optionId(state.highlighted) : void 0,
126
+ placeholder: "Search fonts",
127
+ value: state.query,
128
+ disabled,
129
+ onChange: (e) => model.setQuery(e.target.value),
130
+ onKeyDown: (e) => {
131
+ if (model.handleKey(e.key)) e.preventDefault();
132
+ },
133
+ style: FIELD
134
+ }
135
+ ),
136
+ showCategories && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
+ "select",
138
+ {
139
+ "aria-label": "Font category",
140
+ value: state.category,
141
+ disabled,
142
+ onChange: (e) => model.setCategory(e.target.value),
143
+ style: { ...FIELD, width: "auto" },
144
+ children: ["all", ...import_typography2.FONT_CATEGORIES].map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: c, children: import_typography2.FONT_CATEGORY_LABELS[c] }, c))
145
+ }
146
+ )
147
+ ] }),
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
149
+ "ul",
150
+ {
151
+ ref: listRef,
152
+ id: listId,
153
+ role: "listbox",
154
+ "aria-label": "Fonts",
155
+ style: {
156
+ listStyle: "none",
157
+ margin: 0,
158
+ padding: "2px",
159
+ maxHeight: "var(--pixerate-font-picker-list-height, 180px)",
160
+ overflowY: "auto",
161
+ borderRadius: "6px",
162
+ border: "1px solid var(--pixerate-font-picker-border, #3a4152)"
163
+ },
164
+ children: [
165
+ shown.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { role: "presentation", style: { padding: "6px 8px", opacity: 0.7 }, children: state.loading ? "Loading\u2026" : "No fonts match" }),
166
+ shown.map((font, i) => {
167
+ const selected = font.family.toLowerCase() === state.value.family.toLowerCase();
168
+ const highlighted = i === state.highlighted;
169
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
170
+ "li",
171
+ {
172
+ id: optionId(i),
173
+ role: "option",
174
+ "aria-selected": selected,
175
+ "data-highlighted": highlighted || void 0,
176
+ onMouseDown: (e) => e.preventDefault(),
177
+ onMouseEnter: () => model.setHighlight(i),
178
+ onClick: () => model.selectFamily(font.family),
179
+ style: {
180
+ display: "flex",
181
+ justifyContent: "space-between",
182
+ alignItems: "baseline",
183
+ gap: "8px",
184
+ padding: "5px 8px",
185
+ borderRadius: "4px",
186
+ cursor: "pointer",
187
+ background: selected ? "var(--pixerate-font-picker-selected, #2f3b57)" : highlighted ? "var(--pixerate-font-picker-hover, #2a3040)" : "transparent"
188
+ },
189
+ children: [
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { fontFamily: model.familyCss(font), fontSize: "14px" }, children: font.family }),
191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: { opacity: 0.6, fontSize: "10px" }, children: import_typography2.FONT_CATEGORY_LABELS[font.category] })
192
+ ]
193
+ },
194
+ font.family
195
+ );
196
+ })
197
+ ]
198
+ }
199
+ ),
200
+ showWeight && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
201
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
202
+ "select",
203
+ {
204
+ "aria-label": "Font weight",
205
+ value: state.value.weight,
206
+ disabled,
207
+ onChange: (e) => model.setWeight(Number(e.target.value)),
208
+ style: FIELD,
209
+ children: model.availableWeights.map((w) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: w, children: w }, w))
210
+ }
211
+ ),
212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
213
+ "select",
214
+ {
215
+ "aria-label": "Font style",
216
+ value: state.value.style,
217
+ disabled,
218
+ onChange: (e) => model.setStyle(e.target.value),
219
+ style: FIELD,
220
+ children: model.availableStyles.map((s) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: s, children: s }, s))
221
+ }
222
+ )
223
+ ] }),
224
+ children,
225
+ showPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
226
+ "div",
227
+ {
228
+ "aria-label": "Font preview",
229
+ style: {
230
+ fontFamily: css.fontFamily,
231
+ fontWeight: css.fontWeight,
232
+ fontStyle: css.fontStyle,
233
+ fontSize: `${Math.min(state.value.size, 48)}px`,
234
+ lineHeight: css.lineHeight,
235
+ letterSpacing: css.letterSpacing,
236
+ padding: "6px 4px",
237
+ overflowWrap: "anywhere"
238
+ },
239
+ children: state.previewText
240
+ }
241
+ ),
242
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { role: "status", "aria-live": "polite", style: { minHeight: status ? void 0 : 0, opacity: 0.75 }, children: status })
243
+ ]
244
+ }
245
+ );
246
+ }
247
+ function FontPicker({ value, onChange, model, provider, fonts, previewText, ...view }) {
248
+ const picker = useFontPicker({ model, provider, fonts, previewText, value, onChange });
249
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FontPickerView, { model: picker.model, ...view });
250
+ }
251
+
252
+ // src/typography/TypographyControl.tsx
253
+ var import_jsx_runtime2 = require("react/jsx-runtime");
254
+ var NUMBER = {
255
+ boxSizing: "border-box",
256
+ width: "100%",
257
+ padding: "5px 6px",
258
+ borderRadius: "6px",
259
+ border: "1px solid var(--pixerate-font-picker-border, #3a4152)",
260
+ background: "var(--pixerate-font-picker-field-bg, #151922)",
261
+ color: "inherit",
262
+ font: "inherit"
263
+ };
264
+ function NumberField({
265
+ label,
266
+ unit,
267
+ value,
268
+ step,
269
+ min,
270
+ max,
271
+ disabled,
272
+ onCommit
273
+ }) {
274
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", flexDirection: "column", gap: "2px", flex: 1, minWidth: 0 }, children: [
275
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { opacity: 0.75 }, children: [
276
+ label,
277
+ " ",
278
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { opacity: 0.6 }, children: unit })
279
+ ] }),
280
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
281
+ "input",
282
+ {
283
+ type: "number",
284
+ "aria-label": label,
285
+ value,
286
+ step,
287
+ min,
288
+ max,
289
+ disabled,
290
+ onChange: (e) => {
291
+ const n = e.target.valueAsNumber;
292
+ if (Number.isFinite(n)) onCommit(n);
293
+ },
294
+ style: NUMBER
295
+ }
296
+ )
297
+ ] });
298
+ }
299
+ function TypographyControl({
300
+ value,
301
+ onChange,
302
+ model,
303
+ provider,
304
+ fonts,
305
+ previewText,
306
+ disabled = false,
307
+ "aria-label": ariaLabel = "Typography",
308
+ ...view
309
+ }) {
310
+ const { model: m, state } = useFontPicker({ model, provider, fonts, previewText, value, onChange });
311
+ const v = state.value;
312
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FontPickerView, { model: m, disabled, "aria-label": ariaLabel, ...view, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: "6px" }, children: [
313
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NumberField, { label: "Font size", unit: "px", value: v.size, step: 1, min: 1, max: 1e3, disabled, onCommit: (n) => m.setSize(n) }),
314
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NumberField, { label: "Line height", unit: "\xD7", value: v.lineHeight ?? 1.5, step: 0.05, min: 0.5, max: 4, disabled, onCommit: (n) => m.setLineHeight(n) }),
315
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NumberField, { label: "Letter spacing", unit: "em", value: v.letterSpacing ?? 0, step: 0.01, min: -0.5, max: 1, disabled, onCommit: (n) => m.setLetterSpacing(n) })
316
+ ] }) });
317
+ }
318
+
319
+ // src/typography/index.ts
320
+ __reExport(typography_exports, require("@pixerate/editor/typography"), module.exports);
321
+ // Annotate the CommonJS export names for ESM import in node:
322
+ 0 && (module.exports = {
323
+ FontPicker,
324
+ FontPickerView,
325
+ TypographyControl,
326
+ useFontPicker,
327
+ ...require("@pixerate/editor/typography")
328
+ });
@@ -0,0 +1,7 @@
1
+ export { FontPicker, FontPickerView } from "./FontPicker.cjs";
2
+ export type { FontPickerProps } from "./FontPicker.cjs";
3
+ export { TypographyControl } from "./TypographyControl.cjs";
4
+ export type { TypographyControlProps } from "./TypographyControl.cjs";
5
+ export { useFontPicker } from "./useFontPicker.cjs";
6
+ export type { UseFontPickerOptions, UseFontPickerResult } from "./useFontPicker.cjs";
7
+ export * from "@pixerate/editor/typography";
@@ -0,0 +1,7 @@
1
+ export { FontPicker, FontPickerView } from "./FontPicker.js";
2
+ export type { FontPickerProps } from "./FontPicker.js";
3
+ export { TypographyControl } from "./TypographyControl.js";
4
+ export type { TypographyControlProps } from "./TypographyControl.js";
5
+ export { useFontPicker } from "./useFontPicker.js";
6
+ export type { UseFontPickerOptions, UseFontPickerResult } from "./useFontPicker.js";
7
+ export * from "@pixerate/editor/typography";
@@ -0,0 +1,299 @@
1
+ // src/typography/FontPicker.tsx
2
+ import { useEffect as useEffect2, useId, useRef as useRef2 } from "react";
3
+ import {
4
+ FONT_CATEGORIES,
5
+ FONT_CATEGORY_LABELS
6
+ } from "@pixerate/editor/typography";
7
+
8
+ // src/typography/useFontPicker.ts
9
+ import { useEffect, useRef, useState, useSyncExternalStore } from "react";
10
+ import { FontPickerModel } from "@pixerate/editor/typography";
11
+ function useFontPicker(options = {}) {
12
+ const onChangeRef = useRef(options.onChange);
13
+ onChangeRef.current = options.onChange;
14
+ const [model] = useState(() => options.model ?? new FontPickerModel({ ...options, onChange: void 0 }));
15
+ const state = useSyncExternalStore(model.subscribe, model.getState, model.getState);
16
+ useEffect(() => model.onValueChange((value) => onChangeRef.current?.(value)), [model]);
17
+ const valueKey = options.value ? JSON.stringify(options.value) : "";
18
+ useEffect(() => {
19
+ if (options.value) model.setValue(options.value);
20
+ }, [model, valueKey]);
21
+ useEffect(() => {
22
+ if (!options.model && options.provider) void model.refresh();
23
+ }, [model]);
24
+ return { model, state };
25
+ }
26
+
27
+ // src/typography/FontPicker.tsx
28
+ import { jsx, jsxs } from "react/jsx-runtime";
29
+ var FIELD = {
30
+ boxSizing: "border-box",
31
+ width: "100%",
32
+ padding: "5px 8px",
33
+ borderRadius: "6px",
34
+ border: "1px solid var(--pixerate-font-picker-border, #3a4152)",
35
+ background: "var(--pixerate-font-picker-field-bg, #151922)",
36
+ color: "inherit",
37
+ font: "inherit"
38
+ };
39
+ function FontPickerView({
40
+ model,
41
+ showPreview = true,
42
+ showCategories = true,
43
+ showWeight = true,
44
+ maxResults = 200,
45
+ disabled = false,
46
+ className,
47
+ id,
48
+ "aria-label": ariaLabel = "Font picker",
49
+ children
50
+ }) {
51
+ const { state } = useFontPicker({ model });
52
+ const baseId = useId();
53
+ const listId = `${baseId}-list`;
54
+ const optionId = (i) => `${baseId}-opt-${i}`;
55
+ const listRef = useRef2(null);
56
+ const shown = state.results.slice(0, maxResults);
57
+ const css = model.css;
58
+ useEffect2(() => {
59
+ if (state.highlighted < 0) return;
60
+ const el = listRef.current?.ownerDocument.getElementById(optionId(state.highlighted));
61
+ el?.scrollIntoView?.({ block: "nearest" });
62
+ }, [state.highlighted]);
63
+ const status = state.loading ? "Loading fonts\u2026" : state.error ? `Could not load fonts: ${state.error}` : state.loadStatus[state.value.family.toLowerCase()] === "failed" ? `${state.value.family} could not be loaded; a fallback is shown.` : "";
64
+ return /* @__PURE__ */ jsxs(
65
+ "div",
66
+ {
67
+ id,
68
+ role: "group",
69
+ "aria-label": ariaLabel,
70
+ "aria-disabled": disabled || void 0,
71
+ className,
72
+ style: {
73
+ boxSizing: "border-box",
74
+ width: "var(--pixerate-font-picker-width, 280px)",
75
+ borderRadius: "var(--pixerate-font-picker-radius, 8px)",
76
+ background: "var(--pixerate-font-picker-bg, #1f2430)",
77
+ color: "var(--pixerate-font-picker-fg, #f0f2f5)",
78
+ padding: "12px",
79
+ display: "flex",
80
+ flexDirection: "column",
81
+ gap: "8px",
82
+ fontFamily: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
83
+ fontSize: "12px",
84
+ opacity: disabled ? 0.6 : 1,
85
+ pointerEvents: disabled ? "none" : "auto"
86
+ },
87
+ children: [
88
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "6px" }, children: [
89
+ /* @__PURE__ */ jsx(
90
+ "input",
91
+ {
92
+ type: "text",
93
+ role: "combobox",
94
+ "aria-label": "Search fonts",
95
+ "aria-expanded": "true",
96
+ "aria-controls": listId,
97
+ "aria-autocomplete": "list",
98
+ "aria-activedescendant": state.highlighted >= 0 && state.highlighted < shown.length ? optionId(state.highlighted) : void 0,
99
+ placeholder: "Search fonts",
100
+ value: state.query,
101
+ disabled,
102
+ onChange: (e) => model.setQuery(e.target.value),
103
+ onKeyDown: (e) => {
104
+ if (model.handleKey(e.key)) e.preventDefault();
105
+ },
106
+ style: FIELD
107
+ }
108
+ ),
109
+ showCategories && /* @__PURE__ */ jsx(
110
+ "select",
111
+ {
112
+ "aria-label": "Font category",
113
+ value: state.category,
114
+ disabled,
115
+ onChange: (e) => model.setCategory(e.target.value),
116
+ style: { ...FIELD, width: "auto" },
117
+ children: ["all", ...FONT_CATEGORIES].map((c) => /* @__PURE__ */ jsx("option", { value: c, children: FONT_CATEGORY_LABELS[c] }, c))
118
+ }
119
+ )
120
+ ] }),
121
+ /* @__PURE__ */ jsxs(
122
+ "ul",
123
+ {
124
+ ref: listRef,
125
+ id: listId,
126
+ role: "listbox",
127
+ "aria-label": "Fonts",
128
+ style: {
129
+ listStyle: "none",
130
+ margin: 0,
131
+ padding: "2px",
132
+ maxHeight: "var(--pixerate-font-picker-list-height, 180px)",
133
+ overflowY: "auto",
134
+ borderRadius: "6px",
135
+ border: "1px solid var(--pixerate-font-picker-border, #3a4152)"
136
+ },
137
+ children: [
138
+ shown.length === 0 && /* @__PURE__ */ jsx("li", { role: "presentation", style: { padding: "6px 8px", opacity: 0.7 }, children: state.loading ? "Loading\u2026" : "No fonts match" }),
139
+ shown.map((font, i) => {
140
+ const selected = font.family.toLowerCase() === state.value.family.toLowerCase();
141
+ const highlighted = i === state.highlighted;
142
+ return /* @__PURE__ */ jsxs(
143
+ "li",
144
+ {
145
+ id: optionId(i),
146
+ role: "option",
147
+ "aria-selected": selected,
148
+ "data-highlighted": highlighted || void 0,
149
+ onMouseDown: (e) => e.preventDefault(),
150
+ onMouseEnter: () => model.setHighlight(i),
151
+ onClick: () => model.selectFamily(font.family),
152
+ style: {
153
+ display: "flex",
154
+ justifyContent: "space-between",
155
+ alignItems: "baseline",
156
+ gap: "8px",
157
+ padding: "5px 8px",
158
+ borderRadius: "4px",
159
+ cursor: "pointer",
160
+ background: selected ? "var(--pixerate-font-picker-selected, #2f3b57)" : highlighted ? "var(--pixerate-font-picker-hover, #2a3040)" : "transparent"
161
+ },
162
+ children: [
163
+ /* @__PURE__ */ jsx("span", { style: { fontFamily: model.familyCss(font), fontSize: "14px" }, children: font.family }),
164
+ /* @__PURE__ */ jsx("span", { style: { opacity: 0.6, fontSize: "10px" }, children: FONT_CATEGORY_LABELS[font.category] })
165
+ ]
166
+ },
167
+ font.family
168
+ );
169
+ })
170
+ ]
171
+ }
172
+ ),
173
+ showWeight && /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "6px" }, children: [
174
+ /* @__PURE__ */ jsx(
175
+ "select",
176
+ {
177
+ "aria-label": "Font weight",
178
+ value: state.value.weight,
179
+ disabled,
180
+ onChange: (e) => model.setWeight(Number(e.target.value)),
181
+ style: FIELD,
182
+ children: model.availableWeights.map((w) => /* @__PURE__ */ jsx("option", { value: w, children: w }, w))
183
+ }
184
+ ),
185
+ /* @__PURE__ */ jsx(
186
+ "select",
187
+ {
188
+ "aria-label": "Font style",
189
+ value: state.value.style,
190
+ disabled,
191
+ onChange: (e) => model.setStyle(e.target.value),
192
+ style: FIELD,
193
+ children: model.availableStyles.map((s) => /* @__PURE__ */ jsx("option", { value: s, children: s }, s))
194
+ }
195
+ )
196
+ ] }),
197
+ children,
198
+ showPreview && /* @__PURE__ */ jsx(
199
+ "div",
200
+ {
201
+ "aria-label": "Font preview",
202
+ style: {
203
+ fontFamily: css.fontFamily,
204
+ fontWeight: css.fontWeight,
205
+ fontStyle: css.fontStyle,
206
+ fontSize: `${Math.min(state.value.size, 48)}px`,
207
+ lineHeight: css.lineHeight,
208
+ letterSpacing: css.letterSpacing,
209
+ padding: "6px 4px",
210
+ overflowWrap: "anywhere"
211
+ },
212
+ children: state.previewText
213
+ }
214
+ ),
215
+ /* @__PURE__ */ jsx("div", { role: "status", "aria-live": "polite", style: { minHeight: status ? void 0 : 0, opacity: 0.75 }, children: status })
216
+ ]
217
+ }
218
+ );
219
+ }
220
+ function FontPicker({ value, onChange, model, provider, fonts, previewText, ...view }) {
221
+ const picker = useFontPicker({ model, provider, fonts, previewText, value, onChange });
222
+ return /* @__PURE__ */ jsx(FontPickerView, { model: picker.model, ...view });
223
+ }
224
+
225
+ // src/typography/TypographyControl.tsx
226
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
227
+ var NUMBER = {
228
+ boxSizing: "border-box",
229
+ width: "100%",
230
+ padding: "5px 6px",
231
+ borderRadius: "6px",
232
+ border: "1px solid var(--pixerate-font-picker-border, #3a4152)",
233
+ background: "var(--pixerate-font-picker-field-bg, #151922)",
234
+ color: "inherit",
235
+ font: "inherit"
236
+ };
237
+ function NumberField({
238
+ label,
239
+ unit,
240
+ value,
241
+ step,
242
+ min,
243
+ max,
244
+ disabled,
245
+ onCommit
246
+ }) {
247
+ return /* @__PURE__ */ jsxs2("label", { style: { display: "flex", flexDirection: "column", gap: "2px", flex: 1, minWidth: 0 }, children: [
248
+ /* @__PURE__ */ jsxs2("span", { style: { opacity: 0.75 }, children: [
249
+ label,
250
+ " ",
251
+ /* @__PURE__ */ jsx2("span", { style: { opacity: 0.6 }, children: unit })
252
+ ] }),
253
+ /* @__PURE__ */ jsx2(
254
+ "input",
255
+ {
256
+ type: "number",
257
+ "aria-label": label,
258
+ value,
259
+ step,
260
+ min,
261
+ max,
262
+ disabled,
263
+ onChange: (e) => {
264
+ const n = e.target.valueAsNumber;
265
+ if (Number.isFinite(n)) onCommit(n);
266
+ },
267
+ style: NUMBER
268
+ }
269
+ )
270
+ ] });
271
+ }
272
+ function TypographyControl({
273
+ value,
274
+ onChange,
275
+ model,
276
+ provider,
277
+ fonts,
278
+ previewText,
279
+ disabled = false,
280
+ "aria-label": ariaLabel = "Typography",
281
+ ...view
282
+ }) {
283
+ const { model: m, state } = useFontPicker({ model, provider, fonts, previewText, value, onChange });
284
+ const v = state.value;
285
+ return /* @__PURE__ */ jsx2(FontPickerView, { model: m, disabled, "aria-label": ariaLabel, ...view, children: /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: "6px" }, children: [
286
+ /* @__PURE__ */ jsx2(NumberField, { label: "Font size", unit: "px", value: v.size, step: 1, min: 1, max: 1e3, disabled, onCommit: (n) => m.setSize(n) }),
287
+ /* @__PURE__ */ jsx2(NumberField, { label: "Line height", unit: "\xD7", value: v.lineHeight ?? 1.5, step: 0.05, min: 0.5, max: 4, disabled, onCommit: (n) => m.setLineHeight(n) }),
288
+ /* @__PURE__ */ jsx2(NumberField, { label: "Letter spacing", unit: "em", value: v.letterSpacing ?? 0, step: 0.01, min: -0.5, max: 1, disabled, onCommit: (n) => m.setLetterSpacing(n) })
289
+ ] }) });
290
+ }
291
+
292
+ // src/typography/index.ts
293
+ export * from "@pixerate/editor/typography";
294
+ export {
295
+ FontPicker,
296
+ FontPickerView,
297
+ TypographyControl,
298
+ useFontPicker
299
+ };
@@ -0,0 +1,17 @@
1
+ import { FontPickerModel, type FontPickerOptions, type FontPickerState } from "@pixerate/editor/typography";
2
+ export interface UseFontPickerOptions extends FontPickerOptions {
3
+ /** Use an existing model (e.g. one an agent tool provider also drives) instead of creating one. */
4
+ model?: FontPickerModel;
5
+ }
6
+ export interface UseFontPickerResult {
7
+ model: FontPickerModel;
8
+ state: FontPickerState;
9
+ }
10
+ /**
11
+ * Creates (or adopts) a {@link FontPickerModel} and re-renders on its changes. `value` is kept in
12
+ * sync when it changes; `onChange` always calls the latest callback, for changes made in the
13
+ * picker or by its agent tools. With a `provider`, fonts are
14
+ * fetched on mount. The model is not destroyed on unmount (StrictMode re-runs effects), so a model
15
+ * passed in can outlive the component.
16
+ */
17
+ export declare function useFontPicker(options?: UseFontPickerOptions): UseFontPickerResult;
@@ -0,0 +1,17 @@
1
+ import { FontPickerModel, type FontPickerOptions, type FontPickerState } from "@pixerate/editor/typography";
2
+ export interface UseFontPickerOptions extends FontPickerOptions {
3
+ /** Use an existing model (e.g. one an agent tool provider also drives) instead of creating one. */
4
+ model?: FontPickerModel;
5
+ }
6
+ export interface UseFontPickerResult {
7
+ model: FontPickerModel;
8
+ state: FontPickerState;
9
+ }
10
+ /**
11
+ * Creates (or adopts) a {@link FontPickerModel} and re-renders on its changes. `value` is kept in
12
+ * sync when it changes; `onChange` always calls the latest callback, for changes made in the
13
+ * picker or by its agent tools. With a `provider`, fonts are
14
+ * fetched on mount. The model is not destroyed on unmount (StrictMode re-runs effects), so a model
15
+ * passed in can outlive the component.
16
+ */
17
+ export declare function useFontPicker(options?: UseFontPickerOptions): UseFontPickerResult;
@@ -4669,10 +4669,11 @@ function EffectParameters({
4669
4669
  onPreset,
4670
4670
  onPresetName,
4671
4671
  renderControlAddon,
4672
+ fonts,
4672
4673
  disabled = false,
4673
4674
  className = ""
4674
4675
  }) {
4675
- const fields = (0, import_react22.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
4676
+ const fields = (0, import_react22.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
4676
4677
  const idBase = (0, import_react22.useId)();
4677
4678
  const gesture = import_react22.default.useRef(null);
4678
4679
  const count = import_react22.default.useRef(0);
@@ -3,7 +3,7 @@ import {
3
3
  EffectsBrowser,
4
4
  useEffectDescription,
5
5
  useEffects
6
- } from "../chunk-Q7LAFHGP.js";
6
+ } from "../chunk-ZQ6H2C7N.js";
7
7
  import "../chunk-5LFQ2UQZ.js";
8
8
  import "../chunk-KIRIU53A.js";
9
9
  import "../chunk-3I7FOSLF.js";
@@ -3175,10 +3175,11 @@ function EffectParameters({
3175
3175
  onPreset,
3176
3176
  onPresetName,
3177
3177
  renderControlAddon,
3178
+ fonts,
3178
3179
  disabled = false,
3179
3180
  className = ""
3180
3181
  }) {
3181
- const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description), [description]);
3182
+ const fields = (0, import_react21.useMemo)(() => (0, import_effects3.effectParameterFields)(description, { fonts }), [description, fonts]);
3182
3183
  const idBase = (0, import_react21.useId)();
3183
3184
  const gesture = import_react21.default.useRef(null);
3184
3185
  const count = import_react21.default.useRef(0);
@@ -4,7 +4,7 @@ import {
4
4
  EffectsBrowser,
5
5
  useEffectDescription,
6
6
  useEffects
7
- } from "../chunk-Q7LAFHGP.js";
7
+ } from "../chunk-ZQ6H2C7N.js";
8
8
  import "../chunk-5LFQ2UQZ.js";
9
9
  import "../chunk-KIRIU53A.js";
10
10
  import "../chunk-3I7FOSLF.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.106.0",
3
+ "version": "0.107.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -174,6 +174,16 @@
174
174
  "default": "./dist/color/index.cjs"
175
175
  }
176
176
  },
177
+ "./typography": {
178
+ "import": {
179
+ "types": "./dist/typography/index.d.ts",
180
+ "default": "./dist/typography/index.js"
181
+ },
182
+ "require": {
183
+ "types": "./dist/typography/index.d.cts",
184
+ "default": "./dist/typography/index.cjs"
185
+ }
186
+ },
177
187
  "./gradient": {
178
188
  "import": {
179
189
  "types": "./dist/gradient/index.d.ts",
@@ -229,6 +239,9 @@
229
239
  "color": [
230
240
  "./dist/color/index.d.ts"
231
241
  ],
242
+ "typography": [
243
+ "./dist/typography/index.d.ts"
244
+ ],
232
245
  "gradient": [
233
246
  "./dist/gradient/index.d.ts"
234
247
  ]
@@ -245,7 +258,7 @@
245
258
  },
246
259
  "peerDependencies": {
247
260
  "@dagrejs/dagre": "^1.1.8",
248
- "@pixerate/editor": ">=0.161.0 <1.0.0-0",
261
+ "@pixerate/editor": ">=0.162.0 <1.0.0-0",
249
262
  "@tiptap/core": "^2.27.3",
250
263
  "@tiptap/pm": "^2.27.3",
251
264
  "@tiptap/react": "^2.27.3",
@@ -272,7 +285,7 @@
272
285
  "tsup": "^9.0.0",
273
286
  "typescript": "^5.7.3",
274
287
  "vitest": "^5.0.5",
275
- "@pixerate/editor": "0.161.0"
288
+ "@pixerate/editor": "0.162.0"
276
289
  },
277
290
  "scripts": {
278
291
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",