soinproduction-gutenberg 0.3.43 → 0.3.45
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/admin-ui/editor.css +5 -0
- package/core/editor/appearance.tsx +38 -9
- package/core/editor/environment.ts +2 -0
- package/dist/admin-ui/editor.css +5 -0
- package/dist/core/editor/appearance.js +50 -24
- package/dist/core/editor/appearance.js.map +3 -3
- package/dist/core/editor/environment.d.ts +2 -0
- package/dist/core/editor/environment.js.map +2 -2
- package/dist/host/docs/AUTHORING.md +2 -0
- package/host/docs/AUTHORING.md +2 -0
- package/package.json +1 -1
package/admin-ui/editor.css
CHANGED
|
@@ -807,3 +807,8 @@
|
|
|
807
807
|
|
|
808
808
|
/* Color setting labels match heading and other inspector field labels. */
|
|
809
809
|
.site-field-color > legend .site-setting-label > span:first-child { font-size: 11px; font-weight: 500; text-transform: uppercase; }
|
|
810
|
+
|
|
811
|
+
/* Text uses the same preset tiles as Heading; its color stays in the same panel. */
|
|
812
|
+
.site-text-size-options{grid-template-columns:repeat(3,minmax(0,1fr))}
|
|
813
|
+
.site-text-size-options>.components-button{text-transform:uppercase;font-size:11px;padding:0 4px}
|
|
814
|
+
.site-text-color-setting>span{font-size:11px;font-weight:500;text-transform:uppercase}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { editorEnvironment } from './environment.js';
|
|
2
2
|
import { textFontSize } from '../fields/appearance.js';
|
|
3
|
-
import { useId, useRef, useState } from 'react';
|
|
3
|
+
import { useId, useRef, useState, type KeyboardEvent } from 'react';
|
|
4
4
|
import { OrderedInspectorControls } from './inspector.js';
|
|
5
5
|
import { EditorAction } from '../ui/editor-action.js';
|
|
6
6
|
import { SettingLabel } from './reset.js';
|
|
@@ -46,17 +46,46 @@ function TextSizeControl({ field, value = {}, setValue }: any) {
|
|
|
46
46
|
const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];
|
|
47
47
|
if (!presets.length) return null;
|
|
48
48
|
const selected = textFontSize(value.fontSize) ? value.fontSize : '';
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
value
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const allowed = editorEnvironment().textSizes;
|
|
50
|
+
const choices: {value: string; label: string; disabled?: boolean}[] = allowed ? Object.entries(allowed).filter(([slug]) => slug === '' || presets.some(preset => preset.slug === slug)).map(([value, label]) => ({ value, label }))
|
|
51
|
+
: [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];
|
|
52
|
+
if (allowed && selected && !choices.some(choice => choice.value === selected)) choices.push({value: selected, label: 'Current: ' + (presets.find(preset => preset.slug === selected)?.name ?? selected), disabled: true});
|
|
53
|
+
const select = (fontSize: string) => setValue({ ...value, fontSize: fontSize || undefined });
|
|
54
|
+
const navigate = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
55
|
+
const current = (event.target as HTMLElement).closest<HTMLElement>('[data-text-size]');
|
|
56
|
+
if (!current) return;
|
|
57
|
+
const enabled = choices.filter(choice => !choice.disabled);
|
|
58
|
+
if (!enabled.length) return;
|
|
59
|
+
const index = enabled.findIndex(choice => choice.value === current.dataset.textSize);
|
|
60
|
+
const target = event.key === 'Home' ? 0 : event.key === 'End' ? enabled.length - 1 :
|
|
61
|
+
['ArrowRight', 'ArrowDown'].includes(event.key) ? (index + 1) % enabled.length :
|
|
62
|
+
['ArrowLeft', 'ArrowUp'].includes(event.key) ? (index + enabled.length - 1) % enabled.length : null;
|
|
63
|
+
if (target === null) return;
|
|
64
|
+
event.preventDefault();
|
|
65
|
+
select(enabled[target].value);
|
|
66
|
+
event.currentTarget.querySelectorAll<HTMLButtonElement>('[data-text-size]:not(:disabled)')[target]?.focus();
|
|
67
|
+
};
|
|
68
|
+
return <fieldset className="site-heading-setting site-text-size-setting">
|
|
69
|
+
<legend><SettingLabel onReset={() => select('')} resetDisabled={!selected}
|
|
70
|
+
resetLabel="Reset text size to section default">Text size</SettingLabel></legend>
|
|
71
|
+
<div className="site-heading-options site-text-size-options" role="radiogroup" aria-label="Text size" onKeyDown={navigate}>
|
|
72
|
+
{choices.map((choice, index) => <wp.components.Button key={choice.value} type="button" role="radio"
|
|
73
|
+
aria-checked={selected === choice.value} disabled={choice.disabled}
|
|
74
|
+
tabIndex={!choice.disabled && (selected === choice.value || (!choices.some(option => !option.disabled && option.value === selected) && index === 0)) ? 0 : -1}
|
|
75
|
+
data-text-size={choice.value} onClick={() => select(choice.value)}>{choice.label}</wp.components.Button>)}
|
|
76
|
+
</div>
|
|
77
|
+
</fieldset>;
|
|
54
78
|
}
|
|
55
79
|
export function TextAppearanceControl(props: any) {
|
|
56
80
|
if (props.options?.itemPanel && !props.controls) return null;
|
|
57
81
|
const { value = {}, setValue } = props;
|
|
58
|
-
const
|
|
59
|
-
return props.options?.fontSize && !props.controls ?
|
|
82
|
+
const color = <AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} />;
|
|
83
|
+
return props.options?.fontSize && !props.controls ? <OrderedInspectorControls order={props.field.order}>
|
|
84
|
+
<wp.components.PanelBody title="Text" initialOpen>
|
|
85
|
+
<TextSizeControl {...props} />
|
|
86
|
+
<div className="site-field-appearance site-text-color-setting"><span>Text color</span>{color}</div>
|
|
87
|
+
</wp.components.PanelBody>
|
|
88
|
+
</OrderedInspectorControls> : <AppearancePanel {...props}>{color}</AppearancePanel>;
|
|
60
89
|
}
|
|
61
90
|
export function IconAppearanceControl(props: any) {
|
|
62
91
|
if (props.options?.itemPanel && !props.controls) return null;
|
|
@@ -8,6 +8,8 @@ export type LinkRecord = {
|
|
|
8
8
|
key?: string;
|
|
9
9
|
};
|
|
10
10
|
export type EditorEnvironment = {
|
|
11
|
+
/** Text size choices by theme preset slug; an empty key retains the section default. */
|
|
12
|
+
textSizes?: Record<string, string>;
|
|
11
13
|
adminUrl?: string;
|
|
12
14
|
renderCustomField?: (props: any, scope: any) => ReactNode;
|
|
13
15
|
media?: () => MediaLibrary;
|
package/dist/admin-ui/editor.css
CHANGED
|
@@ -807,3 +807,8 @@
|
|
|
807
807
|
|
|
808
808
|
/* Color setting labels match heading and other inspector field labels. */
|
|
809
809
|
.site-field-color > legend .site-setting-label > span:first-child { font-size: 11px; font-weight: 500; text-transform: uppercase; }
|
|
810
|
+
|
|
811
|
+
/* Text uses the same preset tiles as Heading; its color stays in the same panel. */
|
|
812
|
+
.site-text-size-options{grid-template-columns:repeat(3,minmax(0,1fr))}
|
|
813
|
+
.site-text-size-options>.components-button{text-transform:uppercase;font-size:11px;padding:0 4px}
|
|
814
|
+
.site-text-color-setting>span{font-size:11px;font-weight:500;text-transform:uppercase}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { editorEnvironment } from "./environment.js";
|
|
3
3
|
import { textFontSize } from "../fields/appearance.js";
|
|
4
4
|
import { useId, useRef, useState } from "react";
|
|
5
5
|
import { OrderedInspectorControls } from "./inspector.js";
|
|
@@ -57,33 +57,59 @@ function TextSizeControl({ field, value = {}, setValue }) {
|
|
|
57
57
|
const presets = [...new Map(entries.map((preset) => [preset.slug, preset])).values()];
|
|
58
58
|
if (!presets.length) return null;
|
|
59
59
|
const selected = textFontSize(value.fontSize) ? value.fontSize : "";
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
const allowed = editorEnvironment().textSizes;
|
|
61
|
+
const choices = allowed ? Object.entries(allowed).filter(([slug]) => slug === "" || presets.some((preset) => preset.slug === slug)).map(([value2, label]) => ({ value: value2, label })) : [{ value: "", label: "Section default" }, ...presets.map((preset) => ({ value: preset.slug, label: preset.name ?? preset.slug }))];
|
|
62
|
+
if (allowed && selected && !choices.some((choice) => choice.value === selected)) choices.push({ value: selected, label: "Current: " + (presets.find((preset) => preset.slug === selected)?.name ?? selected), disabled: true });
|
|
63
|
+
const select = (fontSize) => setValue({ ...value, fontSize: fontSize || void 0 });
|
|
64
|
+
const navigate = (event) => {
|
|
65
|
+
const current = event.target.closest("[data-text-size]");
|
|
66
|
+
if (!current) return;
|
|
67
|
+
const enabled = choices.filter((choice) => !choice.disabled);
|
|
68
|
+
if (!enabled.length) return;
|
|
69
|
+
const index = enabled.findIndex((choice) => choice.value === current.dataset.textSize);
|
|
70
|
+
const target = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : ["ArrowRight", "ArrowDown"].includes(event.key) ? (index + 1) % enabled.length : ["ArrowLeft", "ArrowUp"].includes(event.key) ? (index + enabled.length - 1) % enabled.length : null;
|
|
71
|
+
if (target === null) return;
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
select(enabled[target].value);
|
|
74
|
+
event.currentTarget.querySelectorAll("[data-text-size]:not(:disabled)")[target]?.focus();
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ jsxs("fieldset", { className: "site-heading-setting site-text-size-setting", children: [
|
|
77
|
+
/* @__PURE__ */ jsx("legend", { children: /* @__PURE__ */ jsx(
|
|
78
|
+
SettingLabel,
|
|
79
|
+
{
|
|
80
|
+
onReset: () => select(""),
|
|
81
|
+
resetDisabled: !selected,
|
|
82
|
+
resetLabel: "Reset text size to section default",
|
|
83
|
+
children: "Text size"
|
|
84
|
+
}
|
|
85
|
+
) }),
|
|
86
|
+
/* @__PURE__ */ jsx("div", { className: "site-heading-options site-text-size-options", role: "radiogroup", "aria-label": "Text size", onKeyDown: navigate, children: choices.map((choice, index) => /* @__PURE__ */ jsx(
|
|
87
|
+
wp.components.Button,
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
role: "radio",
|
|
91
|
+
"aria-checked": selected === choice.value,
|
|
92
|
+
disabled: choice.disabled,
|
|
93
|
+
tabIndex: !choice.disabled && (selected === choice.value || !choices.some((option) => !option.disabled && option.value === selected) && index === 0) ? 0 : -1,
|
|
94
|
+
"data-text-size": choice.value,
|
|
95
|
+
onClick: () => select(choice.value),
|
|
96
|
+
children: choice.label
|
|
97
|
+
},
|
|
98
|
+
choice.value
|
|
99
|
+
)) })
|
|
100
|
+
] });
|
|
78
101
|
}
|
|
79
102
|
function TextAppearanceControl(props) {
|
|
80
103
|
if (props.options?.itemPanel && !props.controls) return null;
|
|
81
104
|
const { value = {}, setValue } = props;
|
|
82
|
-
const
|
|
83
|
-
return props.options?.fontSize && !props.controls ? /* @__PURE__ */ jsxs(
|
|
84
|
-
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
105
|
+
const color = /* @__PURE__ */ jsx(AppearanceColorButton, { label: `${props.field.label ?? "Text"} color settings`, value: value.color, onChange: (color2) => setValue({ ...value, color: color2 }) });
|
|
106
|
+
return props.options?.fontSize && !props.controls ? /* @__PURE__ */ jsx(OrderedInspectorControls, { order: props.field.order, children: /* @__PURE__ */ jsxs(wp.components.PanelBody, { title: "Text", initialOpen: true, children: [
|
|
107
|
+
/* @__PURE__ */ jsx(TextSizeControl, { ...props }),
|
|
108
|
+
/* @__PURE__ */ jsxs("div", { className: "site-field-appearance site-text-color-setting", children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { children: "Text color" }),
|
|
110
|
+
color
|
|
111
|
+
] })
|
|
112
|
+
] }) }) : /* @__PURE__ */ jsx(AppearancePanel, { ...props, children: color });
|
|
87
113
|
}
|
|
88
114
|
function IconAppearanceControl(props) {
|
|
89
115
|
if (props.options?.itemPanel && !props.controls) return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../core/editor/appearance.tsx"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAgBS,SAUA,UATG,KADH;AAhBT,SAAS,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { editorEnvironment } from './environment.js';\nimport { textFontSize } from '../fields/appearance.js';\nimport { useId, useRef, useState, type KeyboardEvent } from 'react';\nimport { OrderedInspectorControls } from './inspector.js';\nimport { EditorAction } from '../ui/editor-action.js';\nimport { SettingLabel } from './reset.js';\ndeclare const wp: any;\nexport function Palette({ label, value, onChange }: any) {\n const root = useRef<HTMLFieldSetElement>(null);\n const reset = () => {\n // Keep focus inside a popover before its Reset action becomes disabled.\n root.current?.querySelector<HTMLElement>('[role=\"option\"], [role=\"radio\"], input')?.focus({ preventScroll: true });\n onChange('');\n };\n const [colors = []] = wp.blockEditor.useSettings('color.palette');\n const selected = colors.find((color: any) => color.slug === value)?.color ?? (typeof value === 'string' && value.startsWith('#') ? value : undefined);\n return <fieldset ref={root} className=\"site-field-color\">\n <legend><SettingLabel onReset={reset} resetDisabled={!value} resetLabel={`Reset ${label.toLowerCase()} to default`}>{label}</SettingLabel></legend>\n <wp.components.ColorPalette colors={colors} value={selected} disableCustomColors clearable={false} onChange={(color: string | undefined) => onChange(colors.find((item: any) => item.color === color)?.slug ?? '')} />\n </fieldset>;\n}\n/** A field-label disclosure; the palette participates in the inspector layout. */\nexport function AppearanceColorButton({ label, paletteLabel = 'Text color', value, onChange }: any) {\n const [open, setOpen] = useState(false);\n const id = useId();\n const trigger = useRef<HTMLDivElement>(null);\n return <>\n <div ref={trigger} className=\"site-appearance-toggle\"><EditorAction action=\"style\" label={label}\n aria-expanded={open} aria-controls={id} aria-pressed={Boolean(value)} onClick={() => setOpen(current => !current)} /></div>\n <div id={id} className=\"site-appearance-disclosure\" hidden={!open} onKeyDown={event => {\n if (event.key !== 'Escape') return;\n event.preventDefault(); event.stopPropagation(); setOpen(false);\n trigger.current?.querySelector('button')?.focus({ preventScroll: true });\n }}>{open && <Palette label={paletteLabel} value={value} onChange={onChange} />}</div>\n </>;\n}\n\nfunction AppearancePanel({ field, children, controls, options }: any) {\n if (options?.labelOnly) return children;\n const row = <div className=\"site-field-appearance\"><span>{(field.label ?? 'Text') + ' color'}</span>{children}</div>;\n return controls ? row : <OrderedInspectorControls order={field.order}><div className=\"site-field-appearance-panel\">{row}</div></OrderedInspectorControls>;\n}\nfunction TextSizeControl({ field, value = {}, setValue }: any) {\n const [configured = []] = wp.blockEditor.useSettings('typography.fontSizes');\n const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset: any) => textFontSize(preset?.slug));\n const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];\n if (!presets.length) return null;\n const selected = textFontSize(value.fontSize) ? value.fontSize : '';\n const allowed = editorEnvironment().textSizes;\n const choices: {value: string; label: string; disabled?: boolean}[] = allowed ? Object.entries(allowed).filter(([slug]) => slug === '' || presets.some(preset => preset.slug === slug)).map(([value, label]) => ({ value, label }))\n : [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];\n if (allowed && selected && !choices.some(choice => choice.value === selected)) choices.push({value: selected, label: 'Current: ' + (presets.find(preset => preset.slug === selected)?.name ?? selected), disabled: true});\n const select = (fontSize: string) => setValue({ ...value, fontSize: fontSize || undefined });\n const navigate = (event: KeyboardEvent<HTMLDivElement>) => {\n const current = (event.target as HTMLElement).closest<HTMLElement>('[data-text-size]');\n if (!current) return;\n const enabled = choices.filter(choice => !choice.disabled);\n if (!enabled.length) return;\n const index = enabled.findIndex(choice => choice.value === current.dataset.textSize);\n const target = event.key === 'Home' ? 0 : event.key === 'End' ? enabled.length - 1 :\n ['ArrowRight', 'ArrowDown'].includes(event.key) ? (index + 1) % enabled.length :\n ['ArrowLeft', 'ArrowUp'].includes(event.key) ? (index + enabled.length - 1) % enabled.length : null;\n if (target === null) return;\n event.preventDefault();\n select(enabled[target].value);\n event.currentTarget.querySelectorAll<HTMLButtonElement>('[data-text-size]:not(:disabled)')[target]?.focus();\n };\n return <fieldset className=\"site-heading-setting site-text-size-setting\">\n <legend><SettingLabel onReset={() => select('')} resetDisabled={!selected}\n resetLabel=\"Reset text size to section default\">Text size</SettingLabel></legend>\n <div className=\"site-heading-options site-text-size-options\" role=\"radiogroup\" aria-label=\"Text size\" onKeyDown={navigate}>\n {choices.map((choice, index) => <wp.components.Button key={choice.value} type=\"button\" role=\"radio\"\n aria-checked={selected === choice.value} disabled={choice.disabled}\n tabIndex={!choice.disabled && (selected === choice.value || (!choices.some(option => !option.disabled && option.value === selected) && index === 0)) ? 0 : -1}\n data-text-size={choice.value} onClick={() => select(choice.value)}>{choice.label}</wp.components.Button>)}\n </div>\n </fieldset>;\n}\nexport function TextAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n const { value = {}, setValue } = props;\n const color = <AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} />;\n return props.options?.fontSize && !props.controls ? <OrderedInspectorControls order={props.field.order}>\n <wp.components.PanelBody title=\"Text\" initialOpen>\n <TextSizeControl {...props} />\n <div className=\"site-field-appearance site-text-color-setting\"><span>Text color</span>{color}</div>\n </wp.components.PanelBody>\n </OrderedInspectorControls> : <AppearancePanel {...props}>{color}</AppearancePanel>;\n}\nexport function IconAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n return <AppearancePanel {...props}><AppearanceColorButton label={`${props.field.label ?? 'Icon'} color settings`} paletteLabel=\"Icon color\" value={props.value} onChange={props.setValue} /></AppearancePanel>;\n}\n"],
|
|
5
|
+
"mappings": "AAgBS,SAUA,UATG,KADH;AAhBT,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAC7B,SAAS,OAAO,QAAQ,gBAAoC;AAC5D,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAEtB,SAAS,QAAQ,EAAE,OAAO,OAAO,SAAS,GAAQ;AACvD,QAAM,OAAO,OAA4B,IAAI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,sBAAsB,OAAY;AAChD,MAAI,MAAM,SAAS,aAAa,CAAC,MAAM,SAAU,QAAO;AACxD,SAAO,oBAAC,mBAAiB,GAAG,OAAO,8BAAC,yBAAsB,OAAO,GAAG,MAAM,MAAM,SAAS,MAAM,mBAAmB,cAAa,cAAa,OAAO,MAAM,OAAO,UAAU,MAAM,UAAU,GAAE;AAC9L;",
|
|
6
|
+
"names": ["value", "color"]
|
|
7
7
|
}
|
|
@@ -8,6 +8,8 @@ export type LinkRecord = {
|
|
|
8
8
|
key?: string;
|
|
9
9
|
};
|
|
10
10
|
export type EditorEnvironment = {
|
|
11
|
+
/** Text size choices by theme preset slug; an empty key retains the section default. */
|
|
12
|
+
textSizes?: Record<string, string>;
|
|
11
13
|
adminUrl?: string;
|
|
12
14
|
renderCustomField?: (props: any, scope: any) => ReactNode;
|
|
13
15
|
media?: () => MediaLibrary;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../core/editor/environment.ts"],
|
|
4
|
-
"sourcesContent": ["import type { MediaLibrary } from '../media/values.js';\nimport type { ReactNode } from 'react';\nexport type LinkRecord = {\n id: number | string;\n title: string;\n url: string;\n kind: string;\n key?: string;\n};\nexport type EditorEnvironment = {\n adminUrl?: string;\n renderCustomField?: (props: any, scope: any) => ReactNode;\n media?: () => MediaLibrary;\n linkRecords?: (site: any) => LinkRecord[];\n actionExtras?: (props: { value: any; setValue: (value: any) => void; site: any }) => ReactNode;\n};\nlet environment: EditorEnvironment = {};\n/** Configure host integrations before mounting the editor. No project globals are read by the core. */\nexport function configureEditor(next: EditorEnvironment) {\n environment = { ...environment, ...next };\n}\nexport function editorEnvironment() {\n return environment;\n}\nconst emptyMedia: MediaLibrary = {};\nexport function editorMedia() {\n return environment.media?.() ?? emptyMedia;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { MediaLibrary } from '../media/values.js';\nimport type { ReactNode } from 'react';\nexport type LinkRecord = {\n id: number | string;\n title: string;\n url: string;\n kind: string;\n key?: string;\n};\nexport type EditorEnvironment = {\n /** Text size choices by theme preset slug; an empty key retains the section default. */\n textSizes?: Record<string, string>;\n adminUrl?: string;\n renderCustomField?: (props: any, scope: any) => ReactNode;\n media?: () => MediaLibrary;\n linkRecords?: (site: any) => LinkRecord[];\n actionExtras?: (props: { value: any; setValue: (value: any) => void; site: any }) => ReactNode;\n};\nlet environment: EditorEnvironment = {};\n/** Configure host integrations before mounting the editor. No project globals are read by the core. */\nexport function configureEditor(next: EditorEnvironment) {\n environment = { ...environment, ...next };\n}\nexport function editorEnvironment() {\n return environment;\n}\nconst emptyMedia: MediaLibrary = {};\nexport function editorMedia() {\n return environment.media?.() ?? emptyMedia;\n}\n"],
|
|
5
|
+
"mappings": "AAkBA,IAAI,cAAiC,CAAC;AAE/B,SAAS,gBAAgB,MAAyB;AACvD,gBAAc,EAAE,GAAG,aAAa,GAAG,KAAK;AAC1C;AACO,SAAS,oBAAoB;AAClC,SAAO;AACT;AACA,MAAM,aAA2B,CAAC;AAC3B,SAAS,cAAc;AAC5B,SAAO,YAAY,QAAQ,KAAK;AAClC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -133,3 +133,5 @@ Archive visitor filters and sorting use the shared ui Select, MultiSelect, Check
|
|
|
133
133
|
ArchiveResults enables shared layout motion on its matching Records by default. Remaining cards move to their new grid positions on filtering/sorting; added cards appear in 220ms and removed cards fade in 140ms, with a 260ms move. Load-more uses the same entry behavior. Initial rendering and offscreen section reveals keep their existing behavior. No extra card wrappers or changes to stored content/relationships are added. Motion is disabled in Gutenberg, for prefers-reduced-motion and when browser animation APIs are absent. Rapid updates interrupt active effects. Exiting cards are inert/aria-hidden. Use `<ArchiveResults motion={false}>` to opt out, or `<Records motion>` to opt an ordinary collection in. Each Records template should use ordinary keyed React content; the controller animates its existing direct DOM children. Core collection motion uses AutoAnimate for DOM reconciliation, a shared transform/opacity-only plugin and explicit observer cleanup.
|
|
134
134
|
|
|
135
135
|
Standalone Text exposes one theme-preset Text size control. A stored `__textStyles[field].fontSize` overrides the authored font size; Reset removes only that override. The optional `fontSize` prop supplies an authored theme preset default. Existing Text classes, values, colors and legacy element names remain valid. Use one Text insertion label for narrative body, introduction, description and captions; retain distinct labels only for a distinct semantic component such as Eyebrow.
|
|
136
|
+
|
|
137
|
+
Projects may restrict the standalone Text size menu through `configureEditor({textSizes: {small: 'Small', '': 'Default', large: 'Large'}})`. Keys are existing theme font-preset slugs; the empty key resets to the authored section size. This filters editor choices only: theme tokens and saved overrides remain intact. Keep the project map in its theme configuration and configure it in the project editor entry before mounting.
|
package/host/docs/AUTHORING.md
CHANGED
|
@@ -133,3 +133,5 @@ Archive visitor filters and sorting use the shared ui Select, MultiSelect, Check
|
|
|
133
133
|
ArchiveResults enables shared layout motion on its matching Records by default. Remaining cards move to their new grid positions on filtering/sorting; added cards appear in 220ms and removed cards fade in 140ms, with a 260ms move. Load-more uses the same entry behavior. Initial rendering and offscreen section reveals keep their existing behavior. No extra card wrappers or changes to stored content/relationships are added. Motion is disabled in Gutenberg, for prefers-reduced-motion and when browser animation APIs are absent. Rapid updates interrupt active effects. Exiting cards are inert/aria-hidden. Use `<ArchiveResults motion={false}>` to opt out, or `<Records motion>` to opt an ordinary collection in. Each Records template should use ordinary keyed React content; the controller animates its existing direct DOM children. Core collection motion uses AutoAnimate for DOM reconciliation, a shared transform/opacity-only plugin and explicit observer cleanup.
|
|
134
134
|
|
|
135
135
|
Standalone Text exposes one theme-preset Text size control. A stored `__textStyles[field].fontSize` overrides the authored font size; Reset removes only that override. The optional `fontSize` prop supplies an authored theme preset default. Existing Text classes, values, colors and legacy element names remain valid. Use one Text insertion label for narrative body, introduction, description and captions; retain distinct labels only for a distinct semantic component such as Eyebrow.
|
|
136
|
+
|
|
137
|
+
Projects may restrict the standalone Text size menu through `configureEditor({textSizes: {small: 'Small', '': 'Default', large: 'Large'}})`. Keys are existing theme font-preset slugs; the empty key resets to the authored section size. This filters editor choices only: theme tokens and saved overrides remain intact. Keep the project map in its theme configuration and configure it in the project editor entry before mounting.
|