@namroodinc/liquid-editorial 0.15.0 → 0.16.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.
Files changed (122) hide show
  1. package/README.md +283 -12
  2. package/UPGRADING.md +59 -0
  3. package/dist/chunks/EntryPicker-C7EBfpaw.cjs +2 -0
  4. package/dist/chunks/EntryPicker-C7EBfpaw.cjs.map +1 -0
  5. package/dist/chunks/{EntryPicker-BGWxiLJ_.js → EntryPicker-DBnDsgzi.js} +395 -395
  6. package/dist/chunks/EntryPicker-DBnDsgzi.js.map +1 -0
  7. package/dist/chunks/FormEditor-BG8bOXI8.js +35 -0
  8. package/dist/chunks/FormEditor-BG8bOXI8.js.map +1 -0
  9. package/dist/chunks/FormEditor-BJN0QuLI.cjs +2 -0
  10. package/dist/chunks/FormEditor-BJN0QuLI.cjs.map +1 -0
  11. package/dist/chunks/{NumberField-C90eJGny.js → NumberField-CVsK4l9P.js} +13 -13
  12. package/dist/chunks/{NumberField-C90eJGny.js.map → NumberField-CVsK4l9P.js.map} +1 -1
  13. package/dist/chunks/{NumberField-BrWFmPkW.cjs → NumberField-Ccjpa_1d.cjs} +2 -2
  14. package/dist/chunks/{NumberField-BrWFmPkW.cjs.map → NumberField-Ccjpa_1d.cjs.map} +1 -1
  15. package/dist/chunks/RichTextEditor-D4rNww9d.cjs +2 -0
  16. package/dist/chunks/RichTextEditor-D4rNww9d.cjs.map +1 -0
  17. package/dist/chunks/{RichTextEditor-CS2ED0HP.js → RichTextEditor-DSxiMLVd.js} +1147 -1017
  18. package/dist/chunks/RichTextEditor-DSxiMLVd.js.map +1 -0
  19. package/dist/components/Choice/index.cjs +1 -1
  20. package/dist/components/Choice/index.cjs.map +1 -1
  21. package/dist/components/Choice/index.js +5 -5
  22. package/dist/components/EntryPicker/index.cjs +1 -1
  23. package/dist/components/EntryPicker/index.js +1 -1
  24. package/dist/components/FormEditor/README.md +150 -161
  25. package/dist/components/FormEditor/control.d.cts +4 -4
  26. package/dist/components/FormEditor/control.d.cts.map +1 -1
  27. package/dist/components/FormEditor/control.d.ts +4 -4
  28. package/dist/components/FormEditor/control.d.ts.map +1 -1
  29. package/dist/components/FormEditor/form.d.cts +3 -3
  30. package/dist/components/FormEditor/form.d.cts.map +1 -1
  31. package/dist/components/FormEditor/form.d.ts +3 -3
  32. package/dist/components/FormEditor/form.d.ts.map +1 -1
  33. package/dist/components/FormEditor/index.cjs +1 -1
  34. package/dist/components/FormEditor/index.js +2 -2
  35. package/dist/components/FormEditor/model.d.cts +2 -0
  36. package/dist/components/FormEditor/model.d.cts.map +1 -1
  37. package/dist/components/FormEditor/model.d.ts +2 -0
  38. package/dist/components/FormEditor/model.d.ts.map +1 -1
  39. package/dist/components/FormEditor/rich-text-control.d.cts +1 -2
  40. package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -1
  41. package/dist/components/FormEditor/rich-text-control.d.ts +1 -2
  42. package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -1
  43. package/dist/components/ImageCropper/index.cjs +1 -1
  44. package/dist/components/ImageCropper/index.cjs.map +1 -1
  45. package/dist/components/ImageCropper/index.js +6 -6
  46. package/dist/components/NumberField/index.cjs +1 -1
  47. package/dist/components/NumberField/index.js +1 -1
  48. package/dist/components/RichTextEditor/block-plugins.d.cts +62 -0
  49. package/dist/components/RichTextEditor/block-plugins.d.cts.map +1 -0
  50. package/dist/components/RichTextEditor/block-plugins.d.ts +62 -0
  51. package/dist/components/RichTextEditor/block-plugins.d.ts.map +1 -0
  52. package/dist/components/RichTextEditor/content-block-view.d.cts +1 -1
  53. package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -1
  54. package/dist/components/RichTextEditor/content-block-view.d.ts +1 -1
  55. package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -1
  56. package/dist/components/RichTextEditor/content-block.d.cts +7 -21
  57. package/dist/components/RichTextEditor/content-block.d.cts.map +1 -1
  58. package/dist/components/RichTextEditor/content-block.d.ts +7 -21
  59. package/dist/components/RichTextEditor/content-block.d.ts.map +1 -1
  60. package/dist/components/RichTextEditor/document.d.cts +16 -3
  61. package/dist/components/RichTextEditor/document.d.cts.map +1 -1
  62. package/dist/components/RichTextEditor/document.d.ts +16 -3
  63. package/dist/components/RichTextEditor/document.d.ts.map +1 -1
  64. package/dist/components/RichTextEditor/index.cjs +1 -1
  65. package/dist/components/RichTextEditor/index.d.cts +6 -4
  66. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  67. package/dist/components/RichTextEditor/index.d.ts +6 -4
  68. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  69. package/dist/components/RichTextEditor/index.js +1 -1
  70. package/dist/components/RichTextEditor/picker-block.d.cts +25 -0
  71. package/dist/components/RichTextEditor/picker-block.d.cts.map +1 -0
  72. package/dist/components/RichTextEditor/picker-block.d.ts +25 -0
  73. package/dist/components/RichTextEditor/picker-block.d.ts.map +1 -0
  74. package/dist/components/RichTextEditor/use-blocks.d.cts +19 -0
  75. package/dist/components/RichTextEditor/use-blocks.d.cts.map +1 -0
  76. package/dist/components/RichTextEditor/use-blocks.d.ts +19 -0
  77. package/dist/components/RichTextEditor/use-blocks.d.ts.map +1 -0
  78. package/dist/components/SelectionCard/index.cjs +1 -1
  79. package/dist/components/SelectionCard/index.cjs.map +1 -1
  80. package/dist/components/SelectionCard/index.js +4 -4
  81. package/dist/components/SelectionCard/index.js.map +1 -1
  82. package/dist/index.cjs +1 -1
  83. package/dist/index.d.cts +2 -2
  84. package/dist/index.d.cts.map +1 -1
  85. package/dist/index.d.ts +2 -2
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +46 -46
  88. package/dist/internal/useStableValue.d.cts +8 -0
  89. package/dist/internal/useStableValue.d.cts.map +1 -0
  90. package/dist/internal/useStableValue.d.ts +8 -0
  91. package/dist/internal/useStableValue.d.ts.map +1 -0
  92. package/dist/rich-text-blocks.cjs +2 -0
  93. package/dist/rich-text-blocks.cjs.map +1 -0
  94. package/dist/rich-text-blocks.d.cts +20 -0
  95. package/dist/rich-text-blocks.d.cts.map +1 -0
  96. package/dist/rich-text-blocks.d.ts +20 -0
  97. package/dist/rich-text-blocks.d.ts.map +1 -0
  98. package/dist/rich-text-blocks.js +36 -0
  99. package/dist/rich-text-blocks.js.map +1 -0
  100. package/package.json +14 -1
  101. package/dist/chunks/EntryPicker-BGWxiLJ_.js.map +0 -1
  102. package/dist/chunks/EntryPicker-wVjzdlAO.cjs +0 -2
  103. package/dist/chunks/EntryPicker-wVjzdlAO.cjs.map +0 -1
  104. package/dist/chunks/FormEditor-BHVJG23r.js +0 -30
  105. package/dist/chunks/FormEditor-BHVJG23r.js.map +0 -1
  106. package/dist/chunks/FormEditor-DjUz7qQo.cjs +0 -2
  107. package/dist/chunks/FormEditor-DjUz7qQo.cjs.map +0 -1
  108. package/dist/chunks/RichTextEditor-BgfeOrEe.cjs +0 -2
  109. package/dist/chunks/RichTextEditor-BgfeOrEe.cjs.map +0 -1
  110. package/dist/chunks/RichTextEditor-CS2ED0HP.js.map +0 -1
  111. package/dist/components/RichTextEditor/embed-context.d.cts +0 -41
  112. package/dist/components/RichTextEditor/embed-context.d.cts.map +0 -1
  113. package/dist/components/RichTextEditor/embed-context.d.ts +0 -41
  114. package/dist/components/RichTextEditor/embed-context.d.ts.map +0 -1
  115. package/dist/components/RichTextEditor/embed-types.d.cts +0 -29
  116. package/dist/components/RichTextEditor/embed-types.d.cts.map +0 -1
  117. package/dist/components/RichTextEditor/embed-types.d.ts +0 -29
  118. package/dist/components/RichTextEditor/embed-types.d.ts.map +0 -1
  119. package/dist/components/RichTextEditor/use-embeds.d.cts +0 -31
  120. package/dist/components/RichTextEditor/use-embeds.d.cts.map +0 -1
  121. package/dist/components/RichTextEditor/use-embeds.d.ts +0 -31
  122. package/dist/components/RichTextEditor/use-embeds.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../Grid/index.cjs"),r=require("../../chunks/style-nulIa2_8.cjs");let i=require("react"),a=require("react/jsx-runtime");var o=e=>{e.preventDefault(),e.stopPropagation()};function s(e,{disabled:n,isFocusableWhenDisabled:r,name:i,required:a,...s}){let c=!!(n&&r);return t.t(()=>{let t=e.current;if(t&&c)return t.addEventListener(`click`,o),()=>t.removeEventListener(`click`,o)},[e,c]),c?{...s,"aria-disabled":!0,"data-disabled":``}:{...s,disabled:n,name:i,required:a}}var c=(0,i.forwardRef)(function({isIndeterminate:t=!1,className:n,children:r,...o},c){let l=(0,i.useRef)(null),u=s(l,o);return(0,i.useEffect)(()=>{l.current&&(l.current.indeterminate=t)},[t]),(0,a.jsxs)(`label`,{className:[`ds-choice`,n].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{type:`checkbox`,className:`ds-choice__control ds-indicator`,"data-kind":`checkbox`,ref:e.t(l,c),...u}),r&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:r})]})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},o){let c=(0,i.useRef)(null),l=s(c,r);return(0,a.jsxs)(`label`,{className:[`ds-choice`,t].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{ref:e.t(c,o),type:`radio`,className:`ds-choice__control ds-indicator`,"data-kind":`radio`,...l}),n&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:n})]})});function u({label:e,columns:t=1,children:i,className:o,...s}){return(0,a.jsx)(r.t,{...s,label:e,className:[`ds-choice-group`,o].filter(Boolean).join(` `),children:t===1?(0,a.jsx)(n.Stack,{gap:`sm`,children:i}):(0,a.jsx)(n.Grid,{columns:t,gap:`sm`,className:`ds-choice-group__grid ds-field-group-grid`,style:{"--field-group-columns":t},children:i})})}exports.Checkbox=c,exports.ChoiceGroup=u,exports.Radio=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),t=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs"),n=require("../../chunks/style-nulIa2_8.cjs"),r=require("../Grid/index.cjs");let i=require("react"),a=require("react/jsx-runtime");var o=e=>{e.preventDefault(),e.stopPropagation()};function s(e,{disabled:n,isFocusableWhenDisabled:r,name:i,required:a,...s}){let c=!!(n&&r);return t.t(()=>{let t=e.current;if(t&&c)return t.addEventListener(`click`,o),()=>t.removeEventListener(`click`,o)},[e,c]),c?{...s,"aria-disabled":!0,"data-disabled":``}:{...s,disabled:n,name:i,required:a}}var c=(0,i.forwardRef)(function({isIndeterminate:t=!1,className:n,children:r,...o},c){let l=(0,i.useRef)(null),u=s(l,o);return(0,i.useEffect)(()=>{l.current&&(l.current.indeterminate=t)},[t]),(0,a.jsxs)(`label`,{className:[`ds-choice`,n].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{type:`checkbox`,className:`ds-choice__control ds-indicator`,"data-kind":`checkbox`,ref:e.t(l,c),...u}),r&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:r})]})}),l=(0,i.forwardRef)(function({className:t,children:n,...r},o){let c=(0,i.useRef)(null),l=s(c,r);return(0,a.jsxs)(`label`,{className:[`ds-choice`,t].filter(Boolean).join(` `),children:[(0,a.jsx)(`input`,{ref:e.t(c,o),type:`radio`,className:`ds-choice__control ds-indicator`,"data-kind":`radio`,...l}),n&&(0,a.jsx)(`span`,{className:`ds-choice__label`,children:n})]})});function u({label:e,columns:t=1,children:i,className:o,...s}){return(0,a.jsx)(n.t,{...s,label:e,className:[`ds-choice-group`,o].filter(Boolean).join(` `),children:t===1?(0,a.jsx)(r.Stack,{gap:`sm`,children:i}):(0,a.jsx)(r.Grid,{columns:t,gap:`sm`,className:`ds-choice-group__grid ds-field-group-grid`,style:{"--field-group-columns":t},children:i})})}exports.Checkbox=c,exports.ChoiceGroup=u,exports.Radio=l;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","require_components_Grid_index","require_style","react","react_jsx_runtime","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","node","input","Checkbox","inner","inputProps","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":"A,6TA0BA,IAAMY,EAAU,GAAiB,CAC/BC,EAAM,eAAe,EACrBA,EAAM,gBAAgB,CACxB,EAWA,SAASC,EACP,EACA,CAAE,WAAU,0BAAyB,OAAM,WAAU,GAAGC,GACxD,CACA,IAAMC,EAAa,GAAQC,GAAYC,GASvC,OARAX,EAAA,MAAgC,CAC9B,IAAMY,EAAOC,EAAM,QACnB,GAAKD,GAASH,EAId,OADAG,EAAK,iBAAiB,QAASP,CAAM,MACxBO,EAAK,oBAAoB,QAASP,CAAM,CACvD,EAAG,CAACQ,EAAOJ,CAAU,CAAC,EACfA,EACH,CAAE,GAAGD,EAAM,gBAAiB,GAAM,gBAAiB,EAAG,EACtD,CAAE,GAAGA,EAAM,WAAU,OAAM,UAAS,CAC1C,CASA,IAAaM,GAAA,EAAWrB,EAAAA,WAAAA,CAA4C,SAClE,CAAE,kBAAkB,GAAO,YAAW,WAAU,GAAGe,GACnD,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAQ7C,OANA,EAAAL,EAAA,UAAA,KAAgB,CACVY,EAAM,UACR,EAAM,QAAQ,cAAgBE,EAElC,EAAG,CAACA,CAAe,CAAC,GAGlB,EAAAb,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAA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G,CAAA,CAEE,CAAA,CAEhB,C"}
1
+ {"version":3,"file":"index.cjs","names":["forwardRef","useRef","mergeRefs","FieldGroup","Stack","Grid","require_mergeRefs","require_useIsomorphicLayoutEffect","require_style","require_components_Grid_index","react","react_jsx_runtime","refuse","event","useChoiceInput","rest","keepsFocus","disabled","isFocusableWhenDisabled","node","input","Checkbox","inner","inputProps","isIndeterminate","className","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useIsomorphicLayoutEffect } from \"../../internal/useIsomorphicLayoutEffect\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\ntype ChoiceInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> & {\n /**\n * With `disabled`, keep the control focusable so it can be reached and\n * described: it is marked `aria-disabled` instead of native `disabled` and\n * keeps the disabled look. As with native `disabled`, presses change nothing\n * and run no click or change handlers, and the control is left out of form\n * submission and validation.\n */\n isFocusableWhenDisabled?: boolean;\n};\n\nconst refuse = (event: Event) => {\n event.preventDefault();\n event.stopPropagation();\n};\n\n/**\n * The native input's props. A focusable disabled choice stops each press on\n * the input itself, before React or an ancestor sees it, and cancels it, so\n * the browser restores the checked and indeterminate states and nothing\n * reports a change. It renders without `name` and `required`, which keeps it\n * out of submission and validation as native `disabled` would; a radio then\n * also leaves its group's arrow-key order. `aria-disabled` set directly is\n * passed through without blocking.\n */\nfunction useChoiceInput(\n input: RefObject<HTMLInputElement | null>,\n { disabled, isFocusableWhenDisabled, name, required, ...rest }: ChoiceInputProps,\n) {\n const keepsFocus = Boolean(disabled && isFocusableWhenDisabled);\n useIsomorphicLayoutEffect(() => {\n const node = input.current;\n if (!node || !keepsFocus) {\n return;\n }\n node.addEventListener(\"click\", refuse);\n return () => node.removeEventListener(\"click\", refuse);\n }, [input, keepsFocus]);\n return keepsFocus\n ? { ...rest, \"aria-disabled\": true, \"data-disabled\": \"\" }\n : { ...rest, disabled, name, required };\n}\n\nexport interface CheckboxProps extends ChoiceInputProps {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"checkbox\"\n ref={mergeRefs(inner, ref)}\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends ChoiceInputProps {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const inputProps = useChoiceInput(inner, rest);\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={mergeRefs(inner, ref)}\n type=\"radio\"\n className=\"ds-choice__control ds-indicator\"\n data-kind=\"radio\"\n {...inputProps}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n className=\"ds-choice-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":"A,6TA0BA,IAAMY,EAAU,GAAiB,CAC/BC,EAAM,eAAe,EACrBA,EAAM,gBAAgB,CACxB,EAWA,SAASC,EACP,EACA,CAAE,WAAU,0BAAyB,OAAM,WAAU,GAAGC,GACxD,CACA,IAAMC,EAAa,GAAQC,GAAYC,GASvC,OARAX,EAAA,MAAgC,CAC9B,IAAMY,EAAOC,EAAM,QACnB,GAAKD,GAASH,EAId,OADAG,EAAK,iBAAiB,QAASP,CAAM,MACxBO,EAAK,oBAAoB,QAASP,CAAM,CACvD,EAAG,CAACQ,EAAOJ,CAAU,CAAC,EACfA,EACH,CAAE,GAAGD,EAAM,gBAAiB,GAAM,gBAAiB,EAAG,EACtD,CAAE,GAAGA,EAAM,WAAU,OAAM,UAAS,CAC1C,CASA,IAAaM,GAAA,EAAWrB,EAAAA,WAAAA,CAA4C,SAClE,CAAE,kBAAkB,GAAO,YAAW,WAAU,GAAGe,GACnD,EACA,CACA,IAAMO,GAAA,EAAQrB,EAAAA,OAAAA,CAAgC,IAAI,EAC5CsB,EAAaT,EAAeQ,EAAOP,CAAI,EAQ7C,OANA,EAAAL,EAAA,UAAA,KAAgB,CACVY,EAAM,UACR,EAAM,QAAQ,cAAgBE,EAElC,EAAG,CAACA,CAAe,CAAC,GAGlB,EAAAb,EAAA,KAAA,CAAC,QAAD,CAAO,UAAW,CAAC,YAAac,CAAS,CAAC,CA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AO,CAAE,wBAAyB0B,CAAQ,EAEzC,UACG,CAAA,CAEE,CAAA,CAEhB,C"}
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "../../chunks/mergeRefs-C6_5pADN.js";
2
2
  import { t } from "../../chunks/useIsomorphicLayoutEffect-Bc9hxFMc.js";
3
- import { Grid as n, Stack as r } from "../Grid/index.js";
4
- import { t as i } from "../../chunks/style-7Z_xRlQx.js";
3
+ import { t as n } from "../../chunks/style-7Z_xRlQx.js";
4
+ import { Grid as r, Stack as i } from "../Grid/index.js";
5
5
  import { forwardRef as a, useEffect as o, useRef as s } from "react";
6
6
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  //#region src/components/Choice/index.tsx
@@ -58,14 +58,14 @@ var f = a(function({ isIndeterminate: t = !1, className: n, children: r, ...i },
58
58
  });
59
59
  });
60
60
  function m({ label: e, columns: t = 1, children: a, className: o, ...s }) {
61
- return /* @__PURE__ */ c(i, {
61
+ return /* @__PURE__ */ c(n, {
62
62
  ...s,
63
63
  label: e,
64
64
  className: ["ds-choice-group", o].filter(Boolean).join(" "),
65
- children: t === 1 ? /* @__PURE__ */ c(r, {
65
+ children: t === 1 ? /* @__PURE__ */ c(i, {
66
66
  gap: "sm",
67
67
  children: a
68
- }) : /* @__PURE__ */ c(n, {
68
+ }) : /* @__PURE__ */ c(r, {
69
69
  columns: t,
70
70
  gap: "sm",
71
71
  className: "ds-choice-group__grid ds-field-group-grid",
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/EntryPicker-wVjzdlAO.cjs");exports.EntryPicker=e.t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/EntryPicker-C7EBfpaw.cjs");exports.EntryPicker=e.t;
@@ -1 +1 @@
1
- export { t as EntryPicker } from "../../chunks/EntryPicker-BGWxiLJ_.js";
1
+ export { t as EntryPicker } from "../../chunks/EntryPicker-DBnDsgzi.js";
@@ -86,7 +86,7 @@ exports. Import the aggregate stylesheet with either entry point. The optional
86
86
  | `value` | `FormValues` | Omit for uncontrolled state; controlled callers must echo changes. |
87
87
  | `defaultValue` | `FormValues` | `{}`; initial uncontrolled values only. |
88
88
  | `onValueChange` | `(values, { fieldId }) => void` | Reports the complete next values and the edited field ID. |
89
- | `embedSources` | `Record<string, RichTextEmbedSources>` | Rich-text embed sources keyed by field ID; absent means no embed buttons. |
89
+ | `blockPlugins` | `Record<string, readonly ContentBlockPlugin[]>` | Rich-text plug-ins keyed by field ID. Register the same definitions on the field schema. |
90
90
  | `pickerItems` | `Record<string, EntryItem[]>` | `{}`; available assets/entries keyed by field ID. |
91
91
  | `errors` | `FormErrors` | `{}`; app messages override built-in errors. Clear stale app errors explicitly. |
92
92
  | `showAllErrors` | Boolean | `false`; reveal built-in required/format errors, usually after submission. |
@@ -161,7 +161,7 @@ are not automatically schema options.
161
161
  | --- | --- | --- |
162
162
  | `shortText` | `inputType: "text" \| "email"` (`text`), `maxLength`, `readOnly: false`, `autoFocus: false` | String; empty text remains `""`. |
163
163
  | `longText` | `rows: 3`, `maxLength`, `readOnly: false`, `autoFocus: false` | String. |
164
- | `richText` | `placeholder: "Write something…"`, `expandedWidth: "wide" \| "full"` (`wide`; any other runtime value throws), `tables: true` (false removes table insertion and rejects table nodes; a non-boolean runtime value throws); no autofocus | TipTap JSON document rooted at `doc`. |
164
+ | `richText` | `placeholder: "Write something…"`, `expandedWidth: "wide" \| "full"` (`wide`; any other runtime value throws), `tables: true` (false removes table insertion and rejects table nodes; a non-boolean runtime value throws), `blockDefinitions: ContentBlockDefinition[]` (none; the block types the field accepts, see [content block plug-ins](#rich-text-content-block-plug-ins); a non-array, duplicate or malformed runtime value throws with the field ID); no autofocus | TipTap JSON document rooted at `doc`. |
165
165
  | `number` | `min`, `max`, `step: number \| "any"` (`"any"`), `hasSteppers: true`, `decreaseLabel` / `increaseLabel` (`"Decrease {label}"` / `"Increase {label}"`), `prefix`, `suffix` (strings), `autoFocus: false` | Finite number. |
166
166
  | `boolean` | `autoFocus: false`; always a Switch | Boolean; `false` satisfies required. |
167
167
  | `dateTime` | Native browser date-and-time input; `autoFocus: false`; label gets `(UTC)` | UTC ISO string ending in `Z`, including milliseconds. |
@@ -375,9 +375,9 @@ or `right`. An omitted or null value displays as left. HTML reads inline
375
375
  `text-align` on `<td>` and `<th>`, so keep that property in HTML sanitizers.
376
376
  Set the same left default in the delivery renderer.
377
377
 
378
- Pasting or dropping a selection that contains an entry or asset Content Block
379
- into a cell rejects the entire operation, including mixed selections with text.
380
- Previously saved embeds inside a cell still load.
378
+ Pasting or dropping a selection that contains a Content Block of any
379
+ registered type into a cell rejects the entire operation, including mixed
380
+ selections with text. Previously saved blocks inside a cell still load.
381
381
 
382
382
  Tables without stored widths save as a `<table>` with a `<tbody>` and no inline
383
383
  sizing. A table with any stored column width saves with its sizing:
@@ -738,7 +738,7 @@ See the packaged UPGRADING.md for removed styling APIs.
738
738
  each selected ID's copy from before a refresh until a fresh one arrives.
739
739
  Translate clear events and Field bindings here. Rich text is the one adapter
740
740
  `control.tsx` does not import: `rich-text-control.tsx` renders RichTextEditor,
741
- forwarding `expandedWidth` and `tables`, and `index.tsx` supplies it through
741
+ forwarding `expandedWidth`, `tables` and registered content block plug-ins, and `index.tsx` supplies it through
742
742
  `RichTextControlContext`. RichTextEditor's `tables.tsx` handles the quick
743
743
  grid and renders the custom size form with `FormEditorCore` from `form.tsx`,
744
744
  so the two components
@@ -815,163 +815,152 @@ Refused results keep a focusable `aria-disabled` checkbox, described by the
815
815
  reason or, at the cap, by a full-selection note. Applications confirm
816
816
  missing records and remove links when saving; FormEditor never drops selections.
817
817
 
818
- ## Rich-text embedded entries and assets
819
-
820
- `RichTextEditor.embeds` accepts optional `entry` and `asset` sources.
821
- `FormEditor.embedSources[fieldId]` passes the same configuration to a rich-text
822
- field, independently of ordinary `pickerSources`. Sources reuse EntryPicker paging
823
- (`loadPage`), static `items` (searched by title and keywords when there is no
824
- `loadPage`), `resolveItem`, refresh keys, `dialogTitle`/`dialogDescription`,
825
- editing and dialog suspension. They do not fetch or save content themselves.
826
-
827
- A source adds its toolbar button and its blocks' Replace action only when it can
828
- offer something to embed: `loadPage`, non-empty `items` or `onCreate`. A source with only
829
- `resolveItem` displays existing blocks without offering insertion. Embedding from
830
- a source that lists choices (`loadPage` or non-empty `items`) always stages
831
- existing items across queries and pages; its toolbar button reads "Embed
832
- entries" or "Embed assets". A source that can only create (`onCreate` alone)
833
- reads "Embed entry" or "Embed asset" and inserts the one item it creates, with
834
- Done to close. Use the results checkboxes to select or deselect items. The
835
- footer shows the count as text, since an insertion has no limit to draw a
836
- usage ring against. Insert selected commits the selected items as
837
- consecutive content blocks in selection order, with one undo step. Closing the
838
- dialog discards the pending selection. Replace still chooses one item, and New
839
- creates and inserts one item when the selection is empty. While a creation is
840
- pending (`isCreating`), rows can't be selected, so staging and creation never
841
- compete for the same insertion. Embed sources ignore EntryPicker's `mode` and
842
- `max`, including on a source spread from a field's picker source.
843
-
844
- Give a source with `loadPage` a `resolveItem`. After a `refreshKey` change,
845
- Insert selected waits for `resolveItem` to check each staged item, even when
846
- refreshed search results already list it. The inserted content block uses the
847
- confirmed copy from the current refresh immediately. The picker deselects items
848
- that `resolveItem` returns as null, removed, unavailable or disabled, and any
849
- that a results page at the current refresh shows as removed, unavailable,
850
- disabled or otherwise restricted, since a page can refuse an item but only
851
- `resolveItem` confirms one. It reports
852
- the change in the footer and re-enables Insert selected for the rest.
853
- If `resolveItem` rejects, the dialog shows
854
- "Couldn't load selected entries" (or assets) with Try again, and Insert selected
855
- stays disabled until a retry succeeds. Without `resolveItem`, a
856
- staged item is checked again only if a refreshed page shows it; one that no
857
- longer appears keeps its earlier copy and is inserted. Static `items` sources
858
- deselect an item as soon as it leaves `items`.
859
-
860
- Entry rows use the existing `EntryItem` contract with an additional `modelId`
861
- containing a readable model API ID; `item.id` identifies the selected entry.
862
- Asset rows need only the existing item contract. A row that can't become a block
863
- is restricted in the dialog, as an application's own `isDisabled` row would be,
864
- rather than ignoring the pick or producing an invalid block. The reasons are:
865
-
866
- - a removed item (`tone: "removed"`): its `removedLabel`, or "Removed";
867
- - an item with `isUnavailable`: "Unavailable", in insertion, replacement and
868
- for an item committed after creation;
869
- - an entry without `modelId`, or a blank ID: "Can't embed".
818
+ ## Rich-text content block plug-ins
819
+
820
+ A rich-text field accepts `blockDefinitions`, an optional list of pure
821
+ `ContentBlockDefinition` values. Supply those same definition objects in
822
+ `blockPlugins[fieldId]` to give each type an editor preview and actions.
823
+ `validateFormValues` uses the field's definitions. A valid block satisfies a
824
+ required field. An unsupported or malformed block protects the field value and
825
+ displays an error. Register every block type that can appear in the field, even
826
+ when an author has no insert permission. Standalone `RichTextEditor.blockPlugins`
827
+ supplies both the definitions and runtime behavior. The package README's
828
+ [Rich-text content blocks](../../../README.md#rich-text-content-blocks) guide
829
+ builds a complete plug-in, with its dialog, preview and server validation.
830
+
831
+ Define plug-ins and their definitions once, outside render, or memoize them.
832
+ Blocks render again when their plug-in object changes, and checks run again
833
+ when a definition changes. `createPickerBlockPlugin` is the exception: call it
834
+ on every render with the current source, and blocks render again only when the
835
+ source's items, refresh key, resolver or item editor change.
870
836
 
871
837
  ```tsx
872
- import type { RichTextEmbedItem, RichTextEmbedSource, RichTextEmbedSources } from "@namroodinc/liquid-editorial";
873
-
874
- export function embeddedResources(
875
- entries: Omit<RichTextEmbedSource, "onCreate">,
876
- assets: RichTextEmbedSource,
877
- createEntry: (onCreated: (item: RichTextEmbedItem) => void) => void,
878
- ): RichTextEmbedSources {
879
- return {
880
- entry: {
881
- ...entries, // returned entry items carry modelId; give entries a resolveItem
882
- onCreate: (target) => createEntry((item) => {
883
- if (target.available()) { target.commit(item); }
884
- }),
885
- },
886
- asset: assets,
887
- };
838
+ import { useMemo } from "react";
839
+ import {
840
+ FormEditor as BlockFormEditor,
841
+ type ContentBlockPlugin,
842
+ } from "@namroodinc/liquid-editorial";
843
+ import type { ContentBlockDefinition } from "@namroodinc/liquid-editorial/rich-text-blocks";
844
+
845
+ const mapDefinition: ContentBlockDefinition = {
846
+ type: "map",
847
+ validate: ({ latitude, longitude }) =>
848
+ typeof latitude === "number" &&
849
+ Math.abs(latitude) <= 90 &&
850
+ typeof longitude === "number" &&
851
+ Math.abs(longitude) <= 180,
852
+ };
853
+
854
+ export function StoryForm({
855
+ renderMapForm,
856
+ }: {
857
+ renderMapForm: ContentBlockPlugin["renderEditor"];
858
+ }) {
859
+ const map = useMemo(
860
+ () =>
861
+ ({
862
+ definition: mapDefinition,
863
+ label: "Map",
864
+ icon: "globe",
865
+ insertLabel: "Insert map",
866
+ editLabel: "Edit map",
867
+ renderPreview: ({ latitude, longitude }, frame) =>
868
+ frame({ body: <p>{String(latitude)}, {String(longitude)}</p> }),
869
+ renderEditor: renderMapForm,
870
+ }) satisfies ContentBlockPlugin,
871
+ [renderMapForm],
872
+ );
873
+
874
+ return (
875
+ <BlockFormEditor
876
+ schema={{
877
+ fields: [
878
+ { id: "body", type: "richText", label: "Body", blockDefinitions: [mapDefinition] },
879
+ ],
880
+ }}
881
+ blockPlugins={{ body: [map] }}
882
+ />
883
+ );
888
884
  }
889
- // <FormEditor schema={schema} embedSources={{ body: embeddedResources(...) }} ... />
890
885
  ```
891
886
 
892
- `onCreate` receives a `RichTextEmbedTarget`: `available()` checks the living editor,
893
- source and bookmarked position; `commit(item)` returns whether insertion or
894
- replacement succeeded. The application rechecks permissions, field eligibility
895
- and resource availability before committing a delayed creation. A pending creation
896
- may complete while its source's `isCreating` disables the parent form; ordinary
897
- read-only controls still reject commits, and a disabled editor reports only that
898
- commit, never selection or plugin changes. An expanded editor stays expanded while
899
- a source `isCreating`, so the block lands where the writer is working; clear
900
- `isCreating` and re-enable together after committing. `isDialogHidden` suspends the
901
- picker without resetting its query or pages. While a picker is suspended or its
902
- source `isCreating`, Embed and Replace are disabled so another session cannot
903
- replace the pending target. Blocks of a kind whose picker is suspended also
904
- disable their Block actions trigger, closing an open menu, and can't be dragged,
905
- so the pending replacement keeps its target.
906
-
907
- The bookmark follows document edits, including transactions plugins append.
908
- Insertion is anchored to the top-level block the cursor was in and lands at the
909
- top-level boundary after it, even when that block is wrapped, lifted, joined or
910
- edited meanwhile; a change that replaces the whole block ends the session.
911
- Replacement follows its block and survives in-place changes such as alignment,
912
- keeping the block's alignment as it is at commit. Deleting the bookmarked block
913
- ends the session. Removing the source or disabling the editor for any other
914
- reason also ends it for good: the picker never reopens on its own and its target
915
- refuses later commits. `commit` always returns a boolean. Each Embed or Replace
916
- starts a fresh picker.
917
-
918
- Entry nodes store `{ type: "contentBlock", attrs: { type: "entry", id: "article",
919
- entryId: "<resource ID>", align: "full" } }`; asset nodes store
920
- `{ type: "contentBlock", attrs: { type: "asset", assetId: "<resource ID>", align:
921
- "full" } }`. Model IDs and resource IDs have separate meanings. Identifiers are
922
- opaque strings in the library; applications validate UUIDs/model formats and own
923
- model restrictions. Entry model IDs can be refreshed by the application's delivery
924
- serializer without changing the saved parent document.
925
-
926
- Documents saved by 0.14.0 and earlier store the same attributes under
927
- `type: "storyblock"` and in `data-storyblock*` HTML attributes. RichTextEditor
928
- and FormEditor validation read them as content blocks without reporting a
929
- change; the writer's next edit saves the current names. Applications that
930
- validate, render or sanitize stored rich text must accept both forms until they
931
- migrate stored documents by renaming the node type or attribute prefix.
932
-
933
- Blocks are atomic, draggable and selectable. Insert follows the cursor's top-level
934
- block, including when the caret is in a table cell. Replacement stays within
935
- the same kind and retains alignment. Left and
936
- right blocks occupy 62% of the writing width and let text wrap around them. Below
937
- 32rem they use the full writing width. Drag the grip and kind label to move a
938
- block. Select a block with the arrow keys in the editor and press Tab to reach its
939
- `Block actions for {item title}` button. It opens the shared Menu, named the
940
- same, with a visible Alignment label above the icon-only radio items (Align left, Full width, Align
941
- right), then Edit, Replace and Remove from field. Opening it focuses the current
942
- alignment and the arrow keys walk the items. Tab closes it and continues after the
943
- editor; Shift+Tab and Escape return focus to the trigger. Alignment changes keep
944
- the menu open. Edit, Replace and Remove close it. Remove deletes the block from
945
- the document and returns the caret to that position.
946
-
947
- Standard blocks have a primary-tinted title bar. Pass `tone: "draft"` and
948
- publication guidance in the picker item’s `metadata` to show a warning bar and
949
- note. Missing blocks have a danger bar and a solid danger kind label. Selection
950
- deepens each bar in its own tone and adds a focus outline. A missing block offers
951
- “Choose another entry” or “Choose another asset” when replacement is available.
952
- A read-only block shows its kind and body, and its bar does not change on
953
- hover. Enter and gap-cursor editing let
954
- writers continue after a final block. Selecting a block leaves the document intact.
955
-
956
- A block alone satisfies required rich text. Syntax errors are rejected by both
957
- RichTextEditor and FormEditor validation. Resolved row data is never serialized;
958
- HTML uses reference-only data-content-block attributes and round-trips through the
959
- same schema. Node views share the selected-item cache's loading, stale-refresh and
960
- retry behavior; null or removed-tone items, static ones included, show a missing
961
- state. A static item takes precedence over a cached lookup, so supplying one
962
- repairs a block whose lookup found nothing. A block just inserted or replaced shows the row the writer picked at once,
963
- without a Loading placeholder or another `resolveItem` call, including a Replace
964
- that picks the block's own item again (repairing a missing block or refreshing
965
- renamed metadata); any later block for
966
- that item, after an undo, paste or reset, is described afresh, as is a block whose
967
- kind changes between entry and asset under an equal resource ID. Node views read
968
- sources through stable wrappers, so sources built on every render don't re-render
969
- every block; keep static `items` arrays stable. Resolution,
970
- selection, expansion and linked-item edits emit no document change on their own.
971
-
972
- The architecture remains `FormEditor → RichTextEditor → content block node views`,
973
- with both ordinary pickers and editor dialogs using `usePickerSession` (search,
974
- paging, selection rules, edit dismissal and the shared PickerDialog props),
975
- PickerDialog, EntryRow and the selected-item reader. Remote embed batches that
976
- have a resolver use search pages for the results and the selected-item reader
977
- for rechecks. Applications supply data and resource editors.
887
+ `renderEditor` receives a `ContentBlockSession`. Render a dialog component
888
+ with its `data` as the initial value in edit or replace mode. After validating
889
+ the inputs, call `target.commit({ latitude, longitude })`, and call
890
+ `target.close()` on cancellation. `commit` returns a boolean and insertion can
891
+ also commit an array in one undo step. For previews that need hooks, return a
892
+ component from `renderPreview` and let that component call `frame` with the
893
+ title, body and optional status or resource edit action. The frame provides
894
+ selection, dragging, alignment and removal. Wrap the body in
895
+ `.ds-content-block__body` for the frame's padding and type size.
896
+
897
+ Plug-in blocks are atomic: writers edit their data only through the plug-in's
898
+ dialog. Tables aren't plug-ins, because writers edit their cells in place.
899
+ They are TableKit schema nodes that reuse the frame, title bar and actions
900
+ menu, and their type name, `table`, is reserved.
901
+
902
+ Block type names are unique lowercase identifiers beginning with a letter.
903
+ Use letters, digits and hyphens. The editor reserves `table`.
904
+ JSON stores `{ type: "contentBlock", attrs: { type: "map", align: "full",
905
+ data: { latitude: 51.5, longitude: -0.12 } } }`. Alignment is `left`, `full` or
906
+ `right`; an omitted `align` reads as `full`, and the editor always writes it.
907
+ The HTML node is a `div` with `data-content-block`,
908
+ `data-content-block-type`, `data-content-block-align` and the JSON string in
909
+ `data-content-block-data`. Only those attributes are read, so a block element's
910
+ own `type`, `align` or `data` attributes never change the stored block. Import `contentBlockRegistry` and `validContentBlock`
911
+ from the browser-independent `rich-text-blocks` entry point to validate the
912
+ same payload on the server. Applications define what to publish and how to
913
+ render it in delivery.
914
+
915
+ ### Blocks that use a picker
916
+
917
+ Use `createPickerBlockPlugin` for blocks chosen from an EntryPicker. Supply
918
+ the definition, singular and plural labels, icon, picker source, `toData(item)`
919
+ and `itemId(data)`. The source can provide static `items`, remote `loadPage`,
920
+ `resolveItem`, `onEditItem` and `onCreate`. Resolve-only sources show existing
921
+ blocks. Applications define which items are eligible and which attributes to
922
+ store. Resolved previews stay in editor state.
923
+
924
+ Insertion from listed choices stages selections across queries and pages, then
925
+ commits them in order. Replacement chooses one item and keeps alignment.
926
+ Restricted, removed or unavailable items cannot be committed. Give remote
927
+ sources a resolver so a refresh can recheck staged items. A failed recheck
928
+ blocks insertion until retry succeeds. `onCreate` gets a picker target that
929
+ commits the created item after the application rechecks permissions and
930
+ availability. While creating, the picker suspends other selections. Use
931
+ `isCreating` and `isDialogHidden` to coordinate asynchronous drawers and
932
+ temporarily disable the parent form.
933
+
934
+ A target checks the live editor, registration and document position.
935
+ Insertion is anchored after the current top-level block and replacement follows
936
+ its original block through alignment changes. Deletion, a change to the
937
+ target's data or editor disposal invalidates the session. An ordinary
938
+ read-only transition closes the session. A plug-in can finish its own pending
939
+ creation while the application temporarily disables the form.
940
+
941
+ The editor refuses any change that would leave an unregistered or invalid
942
+ block in the document, whether it comes from a paste, a drop, a toolbar command
943
+ or an attribute update. The editor's own documents therefore always pass
944
+ validation. A document from elsewhere is checked when it arrives, and the whole
945
+ document is checked again when the definitions change. A document that no longer
946
+ passes protects the field until its plug-ins return.
947
+
948
+ The editor and FormEditor validate one generic node with the pure definition
949
+ registry. `index.tsx` owns validation and the change guard, `use-blocks.tsx`
950
+ owns the transaction and dialog target, `block-plugins.ts` owns the node views'
951
+ registration snapshot, `content-block-view.tsx` renders a plug-in block in the
952
+ shared frame, and `picker-block.tsx` adapts the optional picker workflow.
953
+ Applications register type-specific previews, data and editors.
954
+
955
+ Tables join the frame without the plug-in registry. `document.ts` adds
956
+ TableKit's `table`, `tableRow`, `tableHeader` and `tableCell` nodes to the
957
+ schema when `tables` is on, so validation reads them as schema content, not
958
+ payloads. `table-view.tsx` gives the table node a ProseMirror node view that
959
+ wraps it in `contentBlockFrameClass` and mounts `ContentBlockBar` from
960
+ `content-block-frame.tsx`, with the table's actions from `table-actions.ts`.
961
+ It reads the read-only state from the same `BlockContext`. The toolbar's
962
+ `TableControl` in `tables.tsx` inserts tables, separately from the plug-in
963
+ insert buttons. A new block with editable content follows that route: a schema
964
+ node and node view in the library, not a plug-in. `src/test/mapBlock.tsx` is
965
+ the plug-in route's reference: the README guide shows it, and a test keeps the
966
+ two in step.
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import type { RichTextEmbedSources } from "../RichTextEditor/index.cjs";
2
+ import type { ContentBlockPlugin } from "../RichTextEditor/index.cjs";
3
3
  import { type EntryItem, type EntryPickerSource } from "../EntryPicker/index.cjs";
4
4
  import type { FieldRenderProps } from "../Field/index.cjs";
5
5
  import { type FieldOf, type FormField, type FormFieldValue } from "./model.cjs";
@@ -13,7 +13,7 @@ export interface ControlProps<F extends FormField> {
13
13
  onChange: (value: FormFieldValue | undefined) => void;
14
14
  }
15
15
  export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
16
- embeds?: RichTextEmbedSources;
16
+ blockPlugins?: readonly ContentBlockPlugin[];
17
17
  };
18
18
  /**
19
19
  * Renders the rich-text adapter, supplied by FormEditor's entry point. Controls
@@ -21,7 +21,7 @@ export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
21
21
  */
22
22
  export declare const RichTextControlContext: import("react").Context<((props: RichTextControlProps) => ReactNode) | null>;
23
23
  interface FormControlProps {
24
- embeds?: RichTextEmbedSources;
24
+ blockPlugins?: readonly ContentBlockPlugin[];
25
25
  field: FormField;
26
26
  stored: FormFieldValue | undefined;
27
27
  /** Picker fields' stored IDs, derived once by the owning field. */
@@ -32,6 +32,6 @@ interface FormControlProps {
32
32
  accessibility: Accessibility;
33
33
  onChange: (value: FormFieldValue | undefined) => void;
34
34
  }
35
- export declare function FormControl({ embeds, field, stored, selected, items, source, isDisabled, accessibility: { required, ...accessibility }, onChange, }: FormControlProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
35
+ export declare function FormControl({ blockPlugins, field, stored, selected, items, source, isDisabled, accessibility: { required, ...accessibility }, onChange, }: FormControlProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
36
36
  export {};
37
37
  //# sourceMappingURL=control.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.cts","sourceRoot":"","sources":["../../../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,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC9C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,mCACxB,oBAAoB,KAAK,SAAS,SACtC,CAAC;AA2FR,UAAU,gBAAgB;IACxB,YAAY,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAC7C,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IACnC,mEAAmE;IACnE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,EAC1B,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,KAAK,EACL,MAAM,EACN,UAAU,EACV,aAAa,EAAE,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,EAC7C,QAAQ,GACT,EAAE,gBAAgB,+TA+FlB"}
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import type { RichTextEmbedSources } from "../RichTextEditor/index.js";
2
+ import type { ContentBlockPlugin } from "../RichTextEditor/index.js";
3
3
  import { type EntryItem, type EntryPickerSource } from "../EntryPicker/index.js";
4
4
  import type { FieldRenderProps } from "../Field/index.js";
5
5
  import { type FieldOf, type FormField, type FormFieldValue } from "./model.js";
@@ -13,7 +13,7 @@ export interface ControlProps<F extends FormField> {
13
13
  onChange: (value: FormFieldValue | undefined) => void;
14
14
  }
15
15
  export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
16
- embeds?: RichTextEmbedSources;
16
+ blockPlugins?: readonly ContentBlockPlugin[];
17
17
  };
18
18
  /**
19
19
  * Renders the rich-text adapter, supplied by FormEditor's entry point. Controls
@@ -21,7 +21,7 @@ export type RichTextControlProps = ControlProps<FieldOf<"richText">> & {
21
21
  */
22
22
  export declare const RichTextControlContext: import("react").Context<((props: RichTextControlProps) => ReactNode) | null>;
23
23
  interface FormControlProps {
24
- embeds?: RichTextEmbedSources;
24
+ blockPlugins?: readonly ContentBlockPlugin[];
25
25
  field: FormField;
26
26
  stored: FormFieldValue | undefined;
27
27
  /** Picker fields' stored IDs, derived once by the owning field. */
@@ -32,6 +32,6 @@ interface FormControlProps {
32
32
  accessibility: Accessibility;
33
33
  onChange: (value: FormFieldValue | undefined) => void;
34
34
  }
35
- export declare function FormControl({ embeds, field, stored, selected, items, source, isDisabled, accessibility: { required, ...accessibility }, onChange, }: FormControlProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
35
+ export declare function FormControl({ blockPlugins, field, stored, selected, items, source, isDisabled, accessibility: { required, ...accessibility }, onChange, }: FormControlProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
36
36
  export {};
37
37
  //# sourceMappingURL=control.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAe,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAM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AAmE;IACnE,QAAQ,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED,wBAAgB,WAAW,CAAC,EAC1B,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,KAAK,EACL,MAAM,EACN,UAAU,EACV,aAAa,EAAE,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,EAC7C,QAAQ,GACT,EAAE,gBAAgB,+TA+FlB"}
@@ -1,5 +1,5 @@
1
1
  import { type HTMLAttributes } from "react";
2
- import type { RichTextEmbedSources } from "../RichTextEditor/index.cjs";
2
+ import type { ContentBlockPlugin } from "../RichTextEditor/index.cjs";
3
3
  import type { EntryItem, EntryPickerSource } from "../EntryPicker/index.cjs";
4
4
  import type { GridColumns } from "../Grid/index.cjs";
5
5
  import { type FormSchema, type FormErrors, type FormValues } from "./model.cjs";
@@ -14,7 +14,7 @@ export interface FormEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "d
14
14
  /** Available assets or entries, keyed by field ID. Loading belongs to the app. */
15
15
  pickerItems?: Record<string, EntryItem[]>;
16
16
  pickerSources?: Record<string, EntryPickerSource>;
17
- embedSources?: Record<string, RichTextEmbedSources>;
17
+ blockPlugins?: Record<string, readonly ContentBlockPlugin[]>;
18
18
  /** App-provided messages take precedence over built-in validation. */
19
19
  errors?: FormErrors;
20
20
  isDisabled?: boolean;
@@ -29,5 +29,5 @@ export interface FormEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "d
29
29
  * RichTextEditor through context. RichTextEditor's own dialogs render this, so
30
30
  * the editor never imports the FormEditor that renders it.
31
31
  */
32
- export declare function FormEditorCore({ schema, value, defaultValue, onValueChange, pickerItems, pickerSources, embedSources, errors, isDisabled, showAllErrors, columns, minColumnWidth, className, style, ...rest }: FormEditorProps): import("react").JSX.Element;
32
+ export declare function FormEditorCore({ schema, value, defaultValue, onValueChange, pickerItems, pickerSources, blockPlugins, errors, isDisabled, showAllErrors, columns, minColumnWidth, className, style, ...rest }: FormEditorProps): import("react").JSX.Element;
33
33
  //# sourceMappingURL=form.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,cAAc,CAAC,cAAc,CAAC,EAC9B,cAAc,GAAG,UAAU,CAC5B;IACC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACjE,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACpD,sEAAsE;IACtE,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0GAA0G;IAC1G,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAwED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,YAAiB,EACjB,aAAa,EACb,WAAgB,EAChB,aAAkB,EAClB,YAAiB,EACjB,MAAW,EACX,UAAkB,EAClB,aAAqB,EACrB,OAAW,EACX,cAAwB,EACxB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,eAAe,+BAiFjB"}
1
+ {"version":3,"file":"form.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AACnF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,cAAc,CAAC,cAAc,CAAC,EAC9B,cAAc,GAAG,UAAU,CAC5B;IACC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,UAAU,C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