soinproduction-gutenberg 0.3.46 → 0.3.47

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.
@@ -812,3 +812,5 @@
812
812
  .site-text-size-options{grid-template-columns:repeat(3,minmax(0,1fr))}
813
813
  .site-text-size-options>.components-button{text-transform:uppercase;font-size:11px;padding:0 4px}
814
814
  .site-text-color-setting>span{font-size:11px;font-weight:500;text-transform:uppercase}
815
+
816
+ .site-text-size-options>.components-button:disabled{grid-column:1/-1}
@@ -40,13 +40,15 @@ function AppearancePanel({ field, children, controls, options }: any) {
40
40
  const row = <div className="site-field-appearance"><span>{(field.label ?? 'Text') + ' color'}</span>{children}</div>;
41
41
  return controls ? row : <OrderedInspectorControls order={field.order}><div className="site-field-appearance-panel">{row}</div></OrderedInspectorControls>;
42
42
  }
43
- function TextSizeControl({ value = {}, setValue }: any) {
43
+ function TextSizeControl({ value = {}, setValue, options = {} }: any) {
44
44
  const [configured = []] = wp.blockEditor.useSettings('typography.fontSizes');
45
45
  const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset: any) => textFontSize(preset?.slug));
46
46
  const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];
47
47
  if (!presets.length) return null;
48
- const selected = textFontSize(value.fontSize) ? value.fontSize : '';
48
+ const override = textFontSize(value.fontSize) ? value.fontSize : '';
49
49
  const allowed = editorEnvironment().textSizes;
50
+ const fallback = textFontSize(options.defaults?.fontSize) ? options.defaults.fontSize : '';
51
+ const selected = override || (allowed && !Object.hasOwn(allowed, '') ? fallback : '');
50
52
  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
53
  : [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];
52
54
  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});
@@ -66,9 +68,10 @@ function TextSizeControl({ value = {}, setValue }: any) {
66
68
  event.currentTarget.querySelectorAll<HTMLButtonElement>('[data-text-size]:not(:disabled)')[target]?.focus();
67
69
  };
68
70
  return <fieldset className="site-heading-setting site-text-size-setting">
69
- <legend><SettingLabel onReset={() => select('')} resetDisabled={!selected}
71
+ <legend><SettingLabel onReset={() => select('')} resetDisabled={!override}
70
72
  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}>
73
+ <div className="site-heading-options site-text-size-options" role="radiogroup" aria-label="Text size" onKeyDown={navigate}
74
+ style={{ gridTemplateColumns: `repeat(${Math.min(choices.length, 5)}, minmax(0, 1fr))` }}>
72
75
  {choices.map((choice, index) => <wp.components.Button key={choice.value} type="button" role="radio"
73
76
  aria-checked={selected === choice.value} disabled={choice.disabled}
74
77
  tabIndex={!choice.disabled && (selected === choice.value || (!choices.some(option => !option.disabled && option.value === selected) && index === 0)) ? 0 : -1}
@@ -812,3 +812,5 @@
812
812
  .site-text-size-options{grid-template-columns:repeat(3,minmax(0,1fr))}
813
813
  .site-text-size-options>.components-button{text-transform:uppercase;font-size:11px;padding:0 4px}
814
814
  .site-text-color-setting>span{font-size:11px;font-weight:500;text-transform:uppercase}
815
+
816
+ .site-text-size-options>.components-button:disabled{grid-column:1/-1}
@@ -51,13 +51,15 @@ function AppearancePanel({ field, children, controls, options }) {
51
51
  ] });
52
52
  return controls ? row : /* @__PURE__ */ jsx(OrderedInspectorControls, { order: field.order, children: /* @__PURE__ */ jsx("div", { className: "site-field-appearance-panel", children: row }) });
53
53
  }
54
- function TextSizeControl({ value = {}, setValue }) {
54
+ function TextSizeControl({ value = {}, setValue, options = {} }) {
55
55
  const [configured = []] = wp.blockEditor.useSettings("typography.fontSizes");
56
56
  const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset) => textFontSize(preset?.slug));
57
57
  const presets = [...new Map(entries.map((preset) => [preset.slug, preset])).values()];
58
58
  if (!presets.length) return null;
59
- const selected = textFontSize(value.fontSize) ? value.fontSize : "";
59
+ const override = textFontSize(value.fontSize) ? value.fontSize : "";
60
60
  const allowed = editorEnvironment().textSizes;
61
+ const fallback = textFontSize(options.defaults?.fontSize) ? options.defaults.fontSize : "";
62
+ const selected = override || (allowed && !Object.hasOwn(allowed, "") ? fallback : "");
61
63
  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
64
  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
65
  const select = (fontSize) => setValue({ ...value, fontSize: fontSize || void 0 });
@@ -78,25 +80,35 @@ function TextSizeControl({ value = {}, setValue }) {
78
80
  SettingLabel,
79
81
  {
80
82
  onReset: () => select(""),
81
- resetDisabled: !selected,
83
+ resetDisabled: !override,
82
84
  resetLabel: "Reset text size to section default",
83
85
  children: "Text size"
84
86
  }
85
87
  ) }),
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
+ /* @__PURE__ */ jsx(
89
+ "div",
88
90
  {
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
- )) })
91
+ className: "site-heading-options site-text-size-options",
92
+ role: "radiogroup",
93
+ "aria-label": "Text size",
94
+ onKeyDown: navigate,
95
+ style: { gridTemplateColumns: `repeat(${Math.min(choices.length, 5)}, minmax(0, 1fr))` },
96
+ children: choices.map((choice, index) => /* @__PURE__ */ jsx(
97
+ wp.components.Button,
98
+ {
99
+ type: "button",
100
+ role: "radio",
101
+ "aria-checked": selected === choice.value,
102
+ disabled: choice.disabled,
103
+ tabIndex: !choice.disabled && (selected === choice.value || !choices.some((option) => !option.disabled && option.value === selected) && index === 0) ? 0 : -1,
104
+ "data-text-size": choice.value,
105
+ onClick: () => select(choice.value),
106
+ children: choice.label
107
+ },
108
+ choice.value
109
+ ))
110
+ }
111
+ )
100
112
  ] });
101
113
  }
102
114
  function TextAppearanceControl(props) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../core/editor/appearance.tsx"],
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({ 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;AAC7C,QAAM,QAAQ,MAAM;AAElB,SAAK,SAAS,cAA2B,wCAAwC,GAAG,MAAM,EAAE,eAAe,KAAK,CAAC;AACjH,aAAS,EAAE;AAAA,EACb;AACA,QAAM,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,YAAY,YAAY,eAAe;AAChE,QAAM,WAAW,OAAO,KAAK,CAAC,UAAe,MAAM,SAAS,KAAK,GAAG,UAAU,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG,IAAI,QAAQ;AAC3I,SAAO,qBAAC,cAAS,KAAK,MAAM,WAAU,oBACpC;AAAA,wBAAC,YAAO,8BAAC,gBAAa,SAAS,OAAO,eAAe,CAAC,OAAO,YAAY,SAAS,MAAM,YAAY,CAAC,eAAgB,iBAAM,GAAe;AAAA,IAC1I,oBAAC,GAAG,WAAW,cAAd,EAA2B,QAAgB,OAAO,UAAU,qBAAmB,MAAC,WAAW,OAAO,UAAU,CAAC,UAA8B,SAAS,OAAO,KAAK,CAAC,SAAc,KAAK,UAAU,KAAK,GAAG,QAAQ,EAAE,GAAG;AAAA,KACtN;AACF;AAEO,SAAS,sBAAsB,EAAE,OAAO,eAAe,cAAc,OAAO,SAAS,GAAQ;AAClG,QAAM,CAAC,MAAM,OAAO,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AAM,mBAAmB,OAAO,MAAM,OAAO,UAAU,CAACC,WAAkB,SAAS,EAAE,GAAG,OAAO,OAAAA,OAAM,CAAC,GAAG;AAC7K,SAAO,MAAM,SAAS,YAAY,CAAC,MAAM,WAAW,oBAAC,4BAAyB,OAAO,MAAM,MAAM,OAC/F,+BAAC,GAAG,WAAW,WAAd,EAAwB,OAAM,QAAO,aAAW,MAC/C;AAAA,wBAAC,mBAAiB,GAAG,OAAO;AAAA,IAC5B,qBAAC,SAAI,WAAU,iDAAgD;AAAA,0BAAC,UAAK,wBAAU;AAAA,MAAQ;AAAA,OAAM;AAAA,KAC/F,GACF,IAA8B,oBAAC,mBAAiB,GAAG,OAAQ,iBAAM;AACnE;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;",
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({ value = {}, setValue, options = {} }: 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 override = textFontSize(value.fontSize) ? value.fontSize : '';\n const allowed = editorEnvironment().textSizes;\n const fallback = textFontSize(options.defaults?.fontSize) ? options.defaults.fontSize : '';\n const selected = override || (allowed && !Object.hasOwn(allowed, '') ? fallback : '');\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={!override}\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 style={{ gridTemplateColumns: `repeat(${Math.min(choices.length, 5)}, minmax(0, 1fr))` }}>\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;AAC7C,QAAM,QAAQ,MAAM;AAElB,SAAK,SAAS,cAA2B,wCAAwC,GAAG,MAAM,EAAE,eAAe,KAAK,CAAC;AACjH,aAAS,EAAE;AAAA,EACb;AACA,QAAM,CAAC,SAAS,CAAC,CAAC,IAAI,GAAG,YAAY,YAAY,eAAe;AAChE,QAAM,WAAW,OAAO,KAAK,CAAC,UAAe,MAAM,SAAS,KAAK,GAAG,UAAU,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG,IAAI,QAAQ;AAC3I,SAAO,qBAAC,cAAS,KAAK,MAAM,WAAU,oBACpC;AAAA,wBAAC,YAAO,8BAAC,gBAAa,SAAS,OAAO,eAAe,CAAC,OAAO,YAAY,SAAS,MAAM,YAAY,CAAC,eAAgB,iBAAM,GAA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,MAAM,OAAO,UAAU,MAAM,UAAU,GAAE;AAC9L;",
6
6
  "names": ["value", "color"]
7
7
  }
@@ -135,3 +135,5 @@ ArchiveResults enables shared layout motion on its matching Records by default.
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
136
 
137
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.
138
+
139
+ For a fixed global scale, configure only named presets, for example `textSizes: {small: 'Small', medium: 'Medium', large: 'Large'}`, and author `<Text fontSize="medium" />` (using actual theme slugs). The inspector highlights the authored size when no override is saved; Reset removes the override and selects that default. An empty-key Default option is optional, not required. Each named choice always resolves to the same global theme token in every section.
@@ -135,3 +135,5 @@ ArchiveResults enables shared layout motion on its matching Records by default.
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
136
 
137
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.
138
+
139
+ For a fixed global scale, configure only named presets, for example `textSizes: {small: 'Small', medium: 'Medium', large: 'Large'}`, and author `<Text fontSize="medium" />` (using actual theme slugs). The inspector highlights the authored size when no override is saved; Reset removes the override and selects that default. An empty-key Default option is optional, not required. Each named choice always resolves to the same global theme token in every section.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soinproduction-gutenberg",
3
- "version": "0.3.46",
3
+ "version": "0.3.47",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {