soinproduction-gutenberg 0.3.43 → 0.3.44
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/core/editor/appearance.tsx +6 -1
- package/core/editor/environment.ts +2 -0
- package/dist/core/editor/appearance.js +5 -1
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { editorEnvironment } from './environment.js';
|
|
1
2
|
import { SelectControl } from '../../ui/select.js';
|
|
2
3
|
import { textFontSize } from '../fields/appearance.js';
|
|
3
4
|
import { useId, useRef, useState } from 'react';
|
|
@@ -46,10 +47,14 @@ function TextSizeControl({ field, value = {}, setValue }: any) {
|
|
|
46
47
|
const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];
|
|
47
48
|
if (!presets.length) return null;
|
|
48
49
|
const selected = textFontSize(value.fontSize) ? value.fontSize : '';
|
|
50
|
+
const allowed = editorEnvironment().textSizes;
|
|
51
|
+
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 }))
|
|
52
|
+
: [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];
|
|
53
|
+
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});
|
|
49
54
|
const fields = <SelectControl label={<SettingLabel onReset={() => setValue({ ...value, fontSize: undefined })}
|
|
50
55
|
resetDisabled={!selected} resetLabel="Reset text size to section default">Text size</SettingLabel>}
|
|
51
56
|
value={selected} onChange={fontSize => setValue({ ...value, fontSize: fontSize || undefined })}
|
|
52
|
-
options={
|
|
57
|
+
options={choices} />;
|
|
53
58
|
return <OrderedInspectorControls order={field.order}><wp.components.PanelBody title="Text" initialOpen>{fields}</wp.components.PanelBody></OrderedInspectorControls>;
|
|
54
59
|
}
|
|
55
60
|
export function TextAppearanceControl(props: any) {
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { editorEnvironment } from "./environment.js";
|
|
2
3
|
import { SelectControl } from "../../ui/select.js";
|
|
3
4
|
import { textFontSize } from "../fields/appearance.js";
|
|
4
5
|
import { useId, useRef, useState } from "react";
|
|
@@ -57,6 +58,9 @@ function TextSizeControl({ field, value = {}, setValue }) {
|
|
|
57
58
|
const presets = [...new Map(entries.map((preset) => [preset.slug, preset])).values()];
|
|
58
59
|
if (!presets.length) return null;
|
|
59
60
|
const selected = textFontSize(value.fontSize) ? value.fontSize : "";
|
|
61
|
+
const allowed = editorEnvironment().textSizes;
|
|
62
|
+
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 }))];
|
|
63
|
+
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 });
|
|
60
64
|
const fields = /* @__PURE__ */ jsx(
|
|
61
65
|
SelectControl,
|
|
62
66
|
{
|
|
@@ -71,7 +75,7 @@ function TextSizeControl({ field, value = {}, setValue }) {
|
|
|
71
75
|
),
|
|
72
76
|
value: selected,
|
|
73
77
|
onChange: (fontSize) => setValue({ ...value, fontSize: fontSize || void 0 }),
|
|
74
|
-
options:
|
|
78
|
+
options: choices
|
|
75
79
|
}
|
|
76
80
|
);
|
|
77
81
|
return /* @__PURE__ */ jsx(OrderedInspectorControls, { order: field.order, children: /* @__PURE__ */ jsx(wp.components.PanelBody, { title: "Text", initialOpen: true, children: fields }) });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../core/editor/appearance.tsx"],
|
|
4
|
-
"sourcesContent": ["import { SelectControl } from '../../ui/select.js';\nimport { textFontSize } from '../fields/appearance.js';\nimport { useId, useRef, useState } 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 fields = <SelectControl label={<SettingLabel onReset={() => setValue({ ...value, fontSize: undefined })}\n resetDisabled={!selected} resetLabel=\"Reset text size to section default\">Text size</SettingLabel>}\n value={selected} onChange={fontSize => setValue({ ...value, fontSize: fontSize || undefined })}\n options={
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import { editorEnvironment } from './environment.js';\nimport { SelectControl } from '../../ui/select.js';\nimport { textFontSize } from '../fields/appearance.js';\nimport { useId, useRef, useState } 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 fields = <SelectControl label={<SettingLabel onReset={() => setValue({ ...value, fontSize: undefined })}\n resetDisabled={!selected} resetLabel=\"Reset text size to section default\">Text size</SettingLabel>}\n value={selected} onChange={fontSize => setValue({ ...value, fontSize: fontSize || undefined })}\n options={choices} />;\n return <OrderedInspectorControls order={field.order}><wp.components.PanelBody title=\"Text\" initialOpen>{fields}</wp.components.PanelBody></OrderedInspectorControls>;\n}\nexport function TextAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n const { value = {}, setValue } = props;\n const appearance = <AppearancePanel {...props}><AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} /></AppearancePanel>;\n return props.options?.fontSize && !props.controls ? <>{appearance}<TextSizeControl {...props} /></> : appearance;\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": "AAiBS,SAUA,UATG,KADH;AAjBT,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC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AO,UAAU,CAAC,UAAkB,SAAS,EAAE,GAAG,OAAO,MAAM,CAAC,GAAG,GAAE;AAChN,SAAO,MAAM,SAAS,YAAY,CAAC,MAAM,WAAW,iCAAG;AAAA;AAAA,IAAW,oBAAC,mBAAiB,GAAG,OAAO;AAAA,KAAE,IAAM;AACxG;AACO,SAAS,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"]
|
|
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.
|