@namroodinc/liquid-editorial 0.12.0 → 0.13.1

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 (199) hide show
  1. package/README.md +17 -7
  2. package/UPGRADING.md +90 -0
  3. package/dist/chunks/{Avatar-DPnrvkwd.cjs → Avatar-BY0dAItT.cjs} +2 -2
  4. package/dist/chunks/{Avatar-DPnrvkwd.cjs.map → Avatar-BY0dAItT.cjs.map} +1 -1
  5. package/dist/chunks/{Avatar-BK8IdL5W.js → Avatar-UjhjcHh5.js} +2 -2
  6. package/dist/chunks/{Avatar-BK8IdL5W.js.map → Avatar-UjhjcHh5.js.map} +1 -1
  7. package/dist/chunks/{Board-BCS7sDXg.js → Board-6fXt1YFp.js} +2 -2
  8. package/dist/chunks/{Board-BCS7sDXg.js.map → Board-6fXt1YFp.js.map} +1 -1
  9. package/dist/chunks/{Board-CNVy8gHI.cjs → Board-DfVQSb_L.cjs} +2 -2
  10. package/dist/chunks/{Board-CNVy8gHI.cjs.map → Board-DfVQSb_L.cjs.map} +1 -1
  11. package/dist/chunks/{CollectionView-DrszOUOt.cjs → CollectionView-CIJdNwcq.cjs} +2 -2
  12. package/dist/chunks/{CollectionView-DrszOUOt.cjs.map → CollectionView-CIJdNwcq.cjs.map} +1 -1
  13. package/dist/chunks/{CollectionView-B0ZJxkNK.js → CollectionView-JRNdXHti.js} +2 -2
  14. package/dist/chunks/{CollectionView-B0ZJxkNK.js.map → CollectionView-JRNdXHti.js.map} +1 -1
  15. package/dist/chunks/{ColourField-C39pcjkG.js → ColourField-YaCEWiPA.js} +147 -153
  16. package/dist/chunks/ColourField-YaCEWiPA.js.map +1 -0
  17. package/dist/chunks/ColourField-bgi6TLOM.cjs +2 -0
  18. package/dist/chunks/ColourField-bgi6TLOM.cjs.map +1 -0
  19. package/dist/chunks/{DatePicker-Dpvfomrm.cjs → DatePicker-CCygKPuy.cjs} +2 -2
  20. package/dist/chunks/{DatePicker-Dpvfomrm.cjs.map → DatePicker-CCygKPuy.cjs.map} +1 -1
  21. package/dist/chunks/{DatePicker-DDc1nDTb.js → DatePicker-CHJYSaLU.js} +22 -22
  22. package/dist/chunks/{DatePicker-DDc1nDTb.js.map → DatePicker-CHJYSaLU.js.map} +1 -1
  23. package/dist/chunks/{Drawer-C3mWT9Kh.js → Drawer-Ck5XKT_V.js} +3 -3
  24. package/dist/chunks/{Drawer-C3mWT9Kh.js.map → Drawer-Ck5XKT_V.js.map} +1 -1
  25. package/dist/chunks/{Drawer-DTKZptua.cjs → Drawer-DdIH9jpe.cjs} +2 -2
  26. package/dist/chunks/{Drawer-DTKZptua.cjs.map → Drawer-DdIH9jpe.cjs.map} +1 -1
  27. package/dist/chunks/{EntryPicker-CgWbgWnc.cjs → EntryPicker-DmiAnu9l.cjs} +2 -2
  28. package/dist/chunks/{EntryPicker-CgWbgWnc.cjs.map → EntryPicker-DmiAnu9l.cjs.map} +1 -1
  29. package/dist/chunks/{EntryPicker-DlEsVCvA.js → EntryPicker-WERMwe0h.js} +3 -3
  30. package/dist/chunks/{EntryPicker-DlEsVCvA.js.map → EntryPicker-WERMwe0h.js.map} +1 -1
  31. package/dist/chunks/{FormEditor-iACd0El-.cjs → FormEditor-B8USzAky.cjs} +2 -2
  32. package/dist/chunks/{FormEditor-iACd0El-.cjs.map → FormEditor-B8USzAky.cjs.map} +1 -1
  33. package/dist/chunks/{FormEditor-CLLOHKiO.js → FormEditor-BG2RhC71.js} +16 -16
  34. package/dist/chunks/{FormEditor-CLLOHKiO.js.map → FormEditor-BG2RhC71.js.map} +1 -1
  35. package/dist/chunks/{Icon-CD3oeiNA.cjs → Icon-C12r4frL.cjs} +2 -2
  36. package/dist/chunks/Icon-C12r4frL.cjs.map +1 -0
  37. package/dist/chunks/{Icon-CYXOo0Kt.js → Icon-Peb0houB.js} +38 -36
  38. package/dist/chunks/Icon-Peb0houB.js.map +1 -0
  39. package/dist/chunks/{Message-CyLq9ef-.js → Message-CMoH7jcg.js} +5 -9
  40. package/dist/chunks/{Message-CyLq9ef-.js.map → Message-CMoH7jcg.js.map} +1 -1
  41. package/dist/chunks/{Message-D3b8HDhm.cjs → Message-qguX0uZk.cjs} +2 -2
  42. package/dist/chunks/{Message-D3b8HDhm.cjs.map → Message-qguX0uZk.cjs.map} +1 -1
  43. package/dist/chunks/RichTextEditor-BSA4uzKm.cjs +2 -0
  44. package/dist/chunks/RichTextEditor-BSA4uzKm.cjs.map +1 -0
  45. package/dist/chunks/{RichTextEditor-B0P53GFt.js → RichTextEditor-D8VQAM5h.js} +396 -375
  46. package/dist/chunks/RichTextEditor-D8VQAM5h.js.map +1 -0
  47. package/dist/chunks/{dialogLabel-D18maX-p.js → dialogLabel-DT7rCr3_.js} +19 -19
  48. package/dist/chunks/{dialogLabel-D18maX-p.js.map → dialogLabel-DT7rCr3_.js.map} +1 -1
  49. package/dist/chunks/{dialogLabel-2HRYMHbF.cjs → dialogLabel-_-MTckE_.cjs} +2 -2
  50. package/dist/chunks/{dialogLabel-2HRYMHbF.cjs.map → dialogLabel-_-MTckE_.cjs.map} +1 -1
  51. package/dist/chunks/overlayLayer-iGhuAByk.cjs +2 -0
  52. package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +1 -0
  53. package/dist/chunks/{overlayLayer-IuoPVwTO.js → overlayLayer-lU4iWSjO.js} +32 -28
  54. package/dist/chunks/overlayLayer-lU4iWSjO.js.map +1 -0
  55. package/dist/chunks/{group-7Z_xRlQx.js → style-7Z_xRlQx.js} +1 -1
  56. package/dist/chunks/{group-7Z_xRlQx.js.map → style-7Z_xRlQx.js.map} +1 -1
  57. package/dist/chunks/{group-nulIa2_8.cjs → style-nulIa2_8.cjs} +1 -1
  58. package/dist/chunks/{group-nulIa2_8.cjs.map → style-nulIa2_8.cjs.map} +1 -1
  59. package/dist/chunks/{use-picker-session-DbfOJstX.cjs → use-picker-session-CM0zcEbf.cjs} +2 -2
  60. package/dist/chunks/{use-picker-session-DbfOJstX.cjs.map → use-picker-session-CM0zcEbf.cjs.map} +1 -1
  61. package/dist/chunks/{use-picker-session-BnMxbGAZ.js → use-picker-session-GCDShVBy.js} +3 -3
  62. package/dist/chunks/{use-picker-session-BnMxbGAZ.js.map → use-picker-session-GCDShVBy.js.map} +1 -1
  63. package/dist/chunks/{useTooltip-BXAvQwt4.cjs → useTooltip-C7ON4nkV.cjs} +2 -2
  64. package/dist/chunks/{useTooltip-BXAvQwt4.cjs.map → useTooltip-C7ON4nkV.cjs.map} +1 -1
  65. package/dist/chunks/{useTooltip-BrC7FdeH.js → useTooltip-DnJEFBLg.js} +2 -2
  66. package/dist/chunks/{useTooltip-BrC7FdeH.js.map → useTooltip-DnJEFBLg.js.map} +1 -1
  67. package/dist/components/AppShell/index.cjs +1 -1
  68. package/dist/components/AppShell/index.js +1 -1
  69. package/dist/components/AssetCard/index.cjs +1 -1
  70. package/dist/components/AssetCard/index.js +1 -1
  71. package/dist/components/AssetGrid/index.cjs +1 -1
  72. package/dist/components/AssetGrid/index.js +1 -1
  73. package/dist/components/Avatar/index.cjs +1 -1
  74. package/dist/components/Avatar/index.js +1 -1
  75. package/dist/components/Badge/style.css +9 -9
  76. package/dist/components/Banner/index.cjs +1 -1
  77. package/dist/components/Banner/index.js +1 -1
  78. package/dist/components/Board/index.cjs +1 -1
  79. package/dist/components/Board/index.js +1 -1
  80. package/dist/components/Board/style.css +3 -3
  81. package/dist/components/Button/index.cjs +1 -1
  82. package/dist/components/Button/index.js +1 -1
  83. package/dist/components/Button/style.css +4 -8
  84. package/dist/components/Choice/index.cjs +1 -1
  85. package/dist/components/Choice/index.cjs.map +1 -1
  86. package/dist/components/Choice/index.js +3 -3
  87. package/dist/components/Choice/index.js.map +1 -1
  88. package/dist/components/Choice/style.css +29 -18
  89. package/dist/components/CollectionView/index.cjs +1 -1
  90. package/dist/components/CollectionView/index.js +1 -1
  91. package/dist/components/ColourField/index.cjs +1 -1
  92. package/dist/components/ColourField/index.d.cts.map +1 -1
  93. package/dist/components/ColourField/index.d.ts.map +1 -1
  94. package/dist/components/ColourField/index.js +1 -1
  95. package/dist/components/ColourField/style.css +4 -4
  96. package/dist/components/DatePicker/index.cjs +1 -1
  97. package/dist/components/DatePicker/index.js +1 -1
  98. package/dist/components/Drawer/index.cjs +1 -1
  99. package/dist/components/Drawer/index.js +1 -1
  100. package/dist/components/Drawer/style.css +2 -4
  101. package/dist/components/EditLayout/index.cjs +1 -1
  102. package/dist/components/EditLayout/index.js +4 -4
  103. package/dist/components/EditLayout/style.css +1 -7
  104. package/dist/components/EntryPicker/index.cjs +1 -1
  105. package/dist/components/EntryPicker/index.js +1 -1
  106. package/dist/components/EntryPicker/style.css +3 -1
  107. package/dist/components/Field/style.css +1 -1
  108. package/dist/components/FormEditor/README.md +28 -33
  109. package/dist/components/FormEditor/index.cjs +1 -1
  110. package/dist/components/FormEditor/index.js +1 -1
  111. package/dist/components/FormEditor/style.css +1 -0
  112. package/dist/components/Icon/icons.d.cts +2 -0
  113. package/dist/components/Icon/icons.d.cts.map +1 -1
  114. package/dist/components/Icon/icons.d.ts +2 -0
  115. package/dist/components/Icon/icons.d.ts.map +1 -1
  116. package/dist/components/Icon/index.cjs +1 -1
  117. package/dist/components/Icon/index.js +1 -1
  118. package/dist/components/LimitReading/style.css +1 -1
  119. package/dist/components/Menu/index.cjs +1 -1
  120. package/dist/components/Menu/index.js +1 -1
  121. package/dist/components/Menu/style.css +3 -2
  122. package/dist/components/Modal/index.cjs +1 -1
  123. package/dist/components/Modal/index.js +2 -2
  124. package/dist/components/Modal/style.css +1 -3
  125. package/dist/components/Popover/index.cjs +1 -1
  126. package/dist/components/Popover/index.cjs.map +1 -1
  127. package/dist/components/Popover/index.d.cts.map +1 -1
  128. package/dist/components/Popover/index.d.ts.map +1 -1
  129. package/dist/components/Popover/index.js +58 -55
  130. package/dist/components/Popover/index.js.map +1 -1
  131. package/dist/components/RichTextEditor/index.cjs +1 -1
  132. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  133. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  134. package/dist/components/RichTextEditor/index.js +1 -1
  135. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
  136. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
  137. package/dist/components/RichTextEditor/style.css +141 -61
  138. package/dist/components/SearchField/index.cjs +1 -1
  139. package/dist/components/SearchField/index.js +1 -1
  140. package/dist/components/Select/index.cjs +1 -1
  141. package/dist/components/Select/index.js +2 -2
  142. package/dist/components/SelectionCard/index.cjs +1 -1
  143. package/dist/components/SelectionCard/index.cjs.map +1 -1
  144. package/dist/components/SelectionCard/index.d.cts.map +1 -1
  145. package/dist/components/SelectionCard/index.d.ts.map +1 -1
  146. package/dist/components/SelectionCard/index.js +2 -2
  147. package/dist/components/SelectionCard/index.js.map +1 -1
  148. package/dist/components/SelectionCard/style.css +20 -65
  149. package/dist/components/SideNav/index.cjs +1 -1
  150. package/dist/components/SideNav/index.js +1 -1
  151. package/dist/components/Skeleton/style.css +1 -1
  152. package/dist/components/Slider/style.css +12 -23
  153. package/dist/components/SortableList/index.cjs +1 -1
  154. package/dist/components/SortableList/index.js +1 -1
  155. package/dist/components/Stepper/index.cjs +1 -1
  156. package/dist/components/Stepper/index.js +1 -1
  157. package/dist/components/SubNav/index.cjs +1 -1
  158. package/dist/components/SubNav/index.js +1 -1
  159. package/dist/components/Switch/index.cjs +1 -1
  160. package/dist/components/Switch/index.cjs.map +1 -1
  161. package/dist/components/Switch/index.d.cts.map +1 -1
  162. package/dist/components/Switch/index.d.ts.map +1 -1
  163. package/dist/components/Switch/index.js +2 -1
  164. package/dist/components/Switch/index.js.map +1 -1
  165. package/dist/components/Switch/style.css +14 -2
  166. package/dist/components/Table/index.cjs +1 -1
  167. package/dist/components/Table/index.js +1 -1
  168. package/dist/components/TagsInput/style.css +3 -21
  169. package/dist/components/Time/index.cjs +1 -1
  170. package/dist/components/Time/index.js +1 -1
  171. package/dist/components/Toast/index.cjs +1 -1
  172. package/dist/components/Toast/index.js +1 -1
  173. package/dist/components/TopNav/index.cjs +1 -1
  174. package/dist/components/TopNav/index.js +1 -1
  175. package/dist/elements.css +2 -1
  176. package/dist/index.cjs +1 -1
  177. package/dist/index.js +30 -30
  178. package/dist/internal/dialogFocus.d.cts +2 -0
  179. package/dist/internal/dialogFocus.d.cts.map +1 -1
  180. package/dist/internal/dialogFocus.d.ts +2 -0
  181. package/dist/internal/dialogFocus.d.ts.map +1 -1
  182. package/dist/message.css +5 -3
  183. package/dist/tokens.css +83 -309
  184. package/package.json +1 -1
  185. package/dist/chunks/ColourField-BdobU76j.cjs +0 -2
  186. package/dist/chunks/ColourField-BdobU76j.cjs.map +0 -1
  187. package/dist/chunks/ColourField-C39pcjkG.js.map +0 -1
  188. package/dist/chunks/Icon-CD3oeiNA.cjs.map +0 -1
  189. package/dist/chunks/Icon-CYXOo0Kt.js.map +0 -1
  190. package/dist/chunks/RichTextEditor-B0P53GFt.js.map +0 -1
  191. package/dist/chunks/RichTextEditor-Wu_yjvD7.cjs +0 -2
  192. package/dist/chunks/RichTextEditor-Wu_yjvD7.cjs.map +0 -1
  193. package/dist/chunks/overlayLayer-IuoPVwTO.js.map +0 -1
  194. package/dist/chunks/overlayLayer-seJG-EFn.cjs +0 -2
  195. package/dist/chunks/overlayLayer-seJG-EFn.cjs.map +0 -1
  196. package/dist/components/ColourField/focus.d.cts +0 -3
  197. package/dist/components/ColourField/focus.d.cts.map +0 -1
  198. package/dist/components/ColourField/focus.d.ts +0 -3
  199. package/dist/components/ColourField/focus.d.ts.map +0 -1
@@ -1,90 +1,92 @@
1
- import { t as e } from "./Icon-CYXOo0Kt.js";
1
+ import { t as e } from "./Icon-Peb0houB.js";
2
2
  import { Button as t } from "../components/Button/index.js";
3
3
  import { t as n } from "./mergeRefs-C6_5pADN.js";
4
- import { d as r, f as i, s as a, u as o } from "./overlayLayer-IuoPVwTO.js";
5
- import { a as s, o as c } from "./dialogLabel-D18maX-p.js";
6
- import { t as l } from "./useIsomorphicLayoutEffect-Bc9hxFMc.js";
7
- import { ButtonGroup as u } from "../components/ButtonGroup/index.js";
8
- import { Badge as d } from "../components/Badge/index.js";
4
+ import { d as r, f as i, g as a, o, p as s, s as c, u as l } from "./overlayLayer-lU4iWSjO.js";
5
+ import { a as u, o as d } from "./dialogLabel-DT7rCr3_.js";
6
+ import { t as f } from "./useIsomorphicLayoutEffect-Bc9hxFMc.js";
7
+ import { ButtonGroup as p } from "../components/ButtonGroup/index.js";
8
+ import { Badge as m } from "../components/Badge/index.js";
9
9
  /* empty css */
10
- import { Field as f } from "../components/Field/index.js";
11
- import { Modal as p } from "../components/Modal/index.js";
12
- import { TextField as m } from "../components/TextField/index.js";
13
- import { a as h, i as g, l as _, o as v, s as y, t as b } from "./use-picker-session-BnMxbGAZ.js";
14
- import { createContext as x, forwardRef as S, useCallback as C, useContext as w, useEffect as T, useId as E, useMemo as D, useRef as O, useState as k } from "react";
15
- import { createPortal as A } from "react-dom";
16
- import { Fragment as j, jsx as M, jsxs as N } from "react/jsx-runtime";
17
- import { EditorContent as ee, Node as te, NodeViewWrapper as P, ReactNodeViewRenderer as F, createDocument as ne, getMarkRange as re, getSchema as ie, mergeAttributes as I, useEditor as ae, useEditorState as oe } from "@tiptap/react";
18
- import { Placeholder as se } from "@tiptap/extension-placeholder";
19
- import { StarterKit as L } from "@tiptap/starter-kit";
20
- import { Link as R } from "@tiptap/extension-link";
10
+ import { Field as h } from "../components/Field/index.js";
11
+ import { Modal as g } from "../components/Modal/index.js";
12
+ import { TextField as _ } from "../components/TextField/index.js";
13
+ import { Popover as v } from "../components/Popover/index.js";
14
+ import { MenuSeparator as y } from "../components/Menu/index.js";
15
+ import { a as b, i as x, l as S, o as C, s as w, t as T } from "./use-picker-session-GCDShVBy.js";
16
+ import { createContext as E, forwardRef as D, useCallback as O, useContext as k, useEffect as A, useId as j, useMemo as M, useRef as N, useState as P } from "react";
17
+ import { createPortal as F } from "react-dom";
18
+ import { Fragment as ee, jsx as I, jsxs as L } from "react/jsx-runtime";
19
+ import { EditorContent as te, Node as R, NodeViewWrapper as z, ReactNodeViewRenderer as B, createDocument as ne, getMarkRange as re, getSchema as V, mergeAttributes as H, useEditor as ie, useEditorState as ae } from "@tiptap/react";
20
+ import { Placeholder as oe } from "@tiptap/extension-placeholder";
21
+ import { StarterKit as se } from "@tiptap/starter-kit";
22
+ import { Link as U } from "@tiptap/extension-link";
21
23
  //#region src/components/RichTextEditor/expansion.tsx
22
- function z(e, t) {
24
+ function ce(e, t) {
23
25
  let n = t.querySelector(".ds-rte__content");
24
26
  if (!n) return;
25
27
  let r = e.view.coordsAtPos(e.state.selection.head), i = n.getBoundingClientRect();
26
28
  (r.top < i.top || r.bottom > i.bottom) && (n.scrollTop += r.top - i.top - i.height / 2);
27
29
  }
28
- function ce({ editor: e, disabled: n, isHeld: a = !1, invalid: o, label: u, labelledBy: d, expandedWidth: f, frameRef: m }) {
29
- let h = c("ds-rte__host"), [g, _] = k(!1), [v, y] = k(0), b = O(null), x = O(null), S = O(null), w = O(!1), T = O(!1), D = E();
30
- g && n && !a && _(!1);
31
- let j = C(() => {
32
- w.current = document.activeElement === S.current, _(!1);
30
+ function le({ editor: e, disabled: n, isHeld: i = !1, invalid: a, label: o, labelledBy: c, expandedWidth: l, frameRef: p }) {
31
+ let m = d("ds-rte__host"), [h, _] = P(!1), [v, y] = P(0), b = N(null), x = N(null), S = N(null), C = N(!1), w = N(!1), T = j();
32
+ h && n && !i && _(!1);
33
+ let E = O(() => {
34
+ C.current = document.activeElement === S.current, _(!1);
33
35
  }, []);
34
- l(() => {
35
- h && (s(h, g ? x.current : b.current), T.current !== g && (T.current = g, n || !e ? r(document.activeElement) && i(m.current, { preventScroll: !0 }) : (z(e, h), !g && w.current ? S.current?.focus() : (e.view.focus(), e.commands.scrollIntoView()), w.current = !1)));
36
+ f(() => {
37
+ m && (u(m, h ? x.current : b.current), w.current !== h && (w.current = h, n || !e ? r(document.activeElement) && s(p.current, { preventScroll: !0 }) : (ce(e, m), !h && C.current ? S.current?.focus() : (e.view.focus(), e.commands.scrollIntoView()), C.current = !1)));
36
38
  }, [
39
+ m,
37
40
  h,
38
- g,
39
41
  e,
40
42
  n,
41
- m
43
+ p
42
44
  ]);
43
- let N = g ? "Collapse editor" : "Expand editor";
45
+ let D = h ? "Collapse editor" : "Expand editor";
44
46
  return {
45
- expanded: g,
46
- toggle: /* @__PURE__ */ M(t, {
47
+ expanded: h,
48
+ toggle: /* @__PURE__ */ I(t, {
47
49
  ref: S,
48
50
  size: "sm",
49
51
  isIconOnly: !0,
50
- iconStart: g ? "minimize-2" : "maximize-2",
52
+ iconStart: h ? "minimize-2" : "maximize-2",
51
53
  className: "ds-rte__expand",
52
- "aria-label": N,
53
- title: N,
54
- "aria-expanded": g,
55
- "aria-controls": g ? D : void 0,
56
- isDisabled: n || !e || !h,
54
+ "aria-label": D,
55
+ title: D,
56
+ "aria-expanded": h,
57
+ "aria-controls": h ? T : void 0,
58
+ isDisabled: n || !e || !m,
57
59
  onMouseDown: (e) => e.preventDefault(),
58
60
  onClick: () => {
59
- g ? j() : (y(m.current.getBoundingClientRect().height), _(!0));
61
+ h ? E() : (y(p.current.getBoundingClientRect().height), _(!0));
60
62
  }
61
63
  }),
62
- surfaceSlot: (e) => /* @__PURE__ */ M("div", {
64
+ surfaceSlot: (e) => /* @__PURE__ */ I("div", {
63
65
  ref: b,
64
66
  className: "ds-rte__slot",
65
- children: h ? A(e, h) : e
67
+ children: m ? F(e, m) : e
66
68
  }),
67
- dialog: /* @__PURE__ */ M(p, {
68
- id: D,
69
- isOpen: g,
70
- onClose: j,
71
- title: u,
69
+ dialog: /* @__PURE__ */ I(g, {
70
+ id: T,
71
+ isOpen: h,
72
+ onClose: E,
73
+ title: o,
72
74
  hasHeader: !1,
73
- size: f === "full" ? "full" : "wide",
75
+ size: l === "full" ? "full" : "wide",
74
76
  className: "ds-rte__modal",
75
- "data-invalid": o || void 0,
76
- "aria-labelledby": d,
77
- children: /* @__PURE__ */ M("div", {
77
+ "data-invalid": a || void 0,
78
+ "aria-labelledby": c,
79
+ children: /* @__PURE__ */ I("div", {
78
80
  ref: x,
79
81
  className: "ds-rte__expanded-slot"
80
82
  })
81
83
  }),
82
- frameStyle: g ? { minBlockSize: v } : void 0
84
+ frameStyle: h ? { minBlockSize: v } : void 0
83
85
  };
84
86
  }
85
87
  //#endregion
86
88
  //#region src/components/RichTextEditor/storyblock.ts
87
- function B(e) {
89
+ function W(e) {
88
90
  let t = (e) => typeof e == "string" && e.trim().length > 0;
89
91
  return [
90
92
  "left",
@@ -92,7 +94,7 @@ function B(e) {
92
94
  "right"
93
95
  ].includes(e.align == null ? "full" : e.align) && (e.type === "entry" ? t(e.id) && t(e.entryId) && e.assetId == null : e.type === "asset" && t(e.assetId) && e.id == null && e.entryId == null);
94
96
  }
95
- function V(e) {
97
+ function G(e) {
96
98
  return {
97
99
  ...e,
98
100
  ...e.type === "storyblock" && e.attrs ? { attrs: {
@@ -103,10 +105,10 @@ function V(e) {
103
105
  } : { assetId: e.attrs.assetId },
104
106
  align: e.attrs.align ?? "full"
105
107
  } } : {},
106
- ...e.content ? { content: e.content.map(V) } : {}
108
+ ...e.content ? { content: e.content.map(G) } : {}
107
109
  };
108
110
  }
109
- var H = te.create({
111
+ var K = R.create({
110
112
  name: "storyblock",
111
113
  group: "block",
112
114
  atom: !0,
@@ -129,7 +131,7 @@ var H = te.create({
129
131
  parseHTML() {
130
132
  return [{
131
133
  tag: "div[data-storyblock]",
132
- getAttrs: (e) => B(Object.fromEntries([
134
+ getAttrs: (e) => W(Object.fromEntries([
133
135
  "type",
134
136
  "id",
135
137
  "entryId",
@@ -139,64 +141,64 @@ var H = te.create({
139
141
  }];
140
142
  },
141
143
  renderHTML({ node: e, HTMLAttributes: t }) {
142
- let n = V({
144
+ let n = G({
143
145
  type: "storyblock",
144
146
  attrs: e.attrs
145
147
  }).attrs;
146
- return ["div", I(t, {
148
+ return ["div", H(t, {
147
149
  "data-storyblock": "",
148
150
  ...Object.fromEntries(Object.entries(n).map(([e, t]) => [`data-storyblock-${e.toLowerCase()}`, t]))
149
151
  })];
150
152
  }
151
- }), U = {
153
+ }), q = {
152
154
  type: "doc",
153
155
  content: [{ type: "paragraph" }]
154
- }, W = [L.configure({
156
+ }, ue = [se.configure({
155
157
  link: !1,
156
158
  trailingNode: { notAfter: ["paragraph", "storyblock"] }
157
- }), R.configure({
159
+ }), U.configure({
158
160
  openOnClick: !1,
159
161
  autolink: !0
160
162
  })];
161
- function G(e = H) {
162
- return [e, ...W];
163
+ function de(e = K) {
164
+ return [e, ...ue];
163
165
  }
164
- var K = ie(G());
165
- function q(e) {
166
+ var J = V(de());
167
+ function Y(e) {
166
168
  return e.content?.length ? e : {
167
169
  ...e,
168
- content: U.content
170
+ content: q.content
169
171
  };
170
172
  }
171
- function le(e) {
173
+ function fe(e) {
172
174
  try {
173
175
  if (!e || typeof e != "object" || !("type" in e) || e.type !== "doc") throw Error();
174
176
  let t = (e) => {
175
- let n = K.nodes[e.type ?? ""];
177
+ let n = J.nodes[e.type ?? ""];
176
178
  if (!n || Object.keys(e).some((e) => ![
177
179
  "type",
178
180
  "attrs",
179
181
  "content",
180
182
  "marks",
181
183
  "text"
182
- ].includes(e)) || e.text !== void 0 && e.type !== "text" || e.attrs && Object.keys(e.attrs).some((e) => !Object.hasOwn(n.spec.attrs ?? {}, e)) || e.type === "storyblock" && (!B(e.attrs ?? {}) || e.marks?.length)) throw Error();
184
+ ].includes(e)) || e.text !== void 0 && e.type !== "text" || e.attrs && Object.keys(e.attrs).some((e) => !Object.hasOwn(n.spec.attrs ?? {}, e)) || e.type === "storyblock" && (!W(e.attrs ?? {}) || e.marks?.length)) throw Error();
183
185
  for (let t of e.marks ?? []) {
184
- let e = K.marks[t.type];
186
+ let e = J.marks[t.type];
185
187
  if (!e || Object.keys(t).some((e) => !["type", "attrs"].includes(e)) || Object.keys(t.attrs ?? {}).some((t) => !Object.hasOwn(e.spec.attrs ?? {}, t))) throw Error();
186
188
  }
187
189
  e.content?.forEach(t);
188
190
  }, n = e;
189
- t(n), K.nodeFromJSON(q(n)).check();
191
+ t(n), J.nodeFromJSON(Y(n)).check();
190
192
  } catch {
191
193
  return "Unsupported or invalid rich-text document.";
192
194
  }
193
195
  }
194
196
  //#endregion
195
197
  //#region src/components/RichTextEditor/embed-context.ts
196
- function J(e) {
198
+ function X(e) {
197
199
  return !!(e && (e.loadPage || e.items?.length || e.onCreate));
198
200
  }
199
- var Y = x({
201
+ var Z = E({
200
202
  views: {},
201
203
  disabled: !1,
202
204
  busy: !1,
@@ -204,64 +206,26 @@ var Y = x({
204
206
  replace: () => {},
205
207
  seed: () => void 0,
206
208
  forgetSeed: () => {}
207
- }), X = [], Z = [
209
+ }), pe = [], me = [
208
210
  {
209
211
  align: "left",
210
212
  icon: "align-left",
211
- label: "Align left"
213
+ label: "Left"
212
214
  },
213
215
  {
214
216
  align: "full",
215
217
  icon: "align-justify",
216
- label: "Full width"
218
+ label: "Full"
217
219
  },
218
220
  {
219
221
  align: "right",
220
222
  icon: "align-right",
221
- label: "Align right"
223
+ label: "Right"
222
224
  }
223
- ], ue = [
224
- "left",
225
- "full",
226
- "right",
227
- "replace",
228
- "edit",
229
- "remove"
230
- ], de = /* @__PURE__ */ new Map([
231
- ["ArrowLeft", -1],
232
- ["ArrowRight", 1],
233
- ["Home", -Infinity],
234
- ["End", Infinity]
235
- ]);
236
- function fe(e) {
237
- let t = de.get(e.key);
238
- if (t === void 0 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
239
- let n = Array.from(e.currentTarget.querySelectorAll("button:not(:disabled)")), r = n.indexOf(e.target);
240
- if (r === -1) return;
241
- e.preventDefault();
242
- let i = r + t;
243
- n[Number.isFinite(i) ? (i + n.length) % n.length : Math.max(0, Math.min(i, n.length - 1))].focus();
244
- }
245
- function pe(e, t) {
246
- let [n, r] = k(), [i, a] = k(!1), o = e || i, s = n && t.includes(n) ? n : t[0];
247
- return {
248
- control: (e) => ({
249
- isDisabled: !t.includes(e),
250
- tabIndex: o && e === s ? 0 : -1,
251
- onFocus: () => r(e)
252
- }),
253
- barProps: {
254
- onKeyDown: fe,
255
- onFocus: () => a(!0),
256
- onBlur: (e) => {
257
- e.currentTarget.contains(e.relatedTarget) || a(!1);
258
- }
259
- }
260
- };
261
- }
262
- function me(e, t) {
263
- let { views: n, seed: r, forgetSeed: i } = w(Y), a = n[e], o = a?.items ?? X, s = D(() => [t], [t]), c = C((t) => r(e, t), [r, e]), l = v(s, o, a?.resolveItem, a?.refreshKey, c), u = r(e, t);
264
- T(() => {
225
+ ];
226
+ function he(e, t) {
227
+ let { views: n, seed: r, forgetSeed: i } = k(Z), a = n[e], o = a?.items ?? pe, s = M(() => [t], [t]), c = O((t) => r(e, t), [r, e]), l = C(s, o, a?.resolveItem, a?.refreshKey, c), u = r(e, t);
228
+ A(() => {
265
229
  u && i(e, t, u);
266
230
  }, [
267
231
  i,
@@ -269,10 +233,10 @@ function me(e, t) {
269
233
  t,
270
234
  u
271
235
  ]);
272
- let { known: d, failures: f } = l, p = !!a?.resolveItem, m = D(() => y({
236
+ let { known: d, failures: f } = l, p = !!a?.resolveItem, m = M(() => w({
273
237
  selected: s,
274
238
  items: o,
275
- pageItems: X,
239
+ pageItems: pe,
276
240
  known: d,
277
241
  failures: f,
278
242
  hasResolver: p,
@@ -284,29 +248,29 @@ function me(e, t) {
284
248
  f,
285
249
  p,
286
250
  e
287
- ]), g = h(`Couldn't load ${e}`, l.status, l.error, l.retry), _ = o.some((e) => e.id === t);
251
+ ]), h = b(`Couldn't load ${e}`, l.status, l.error, l.retry), g = o.some((e) => e.id === t);
288
252
  return {
289
253
  view: a,
290
254
  item: m,
291
- missing: m.tone === "removed" || !_ && d.has(t) && !d.get(t),
292
- failure: g
255
+ missing: m.tone === "removed" || !g && d.has(t) && !d.get(t),
256
+ failure: h
293
257
  };
294
258
  }
295
- function he({ kind: t, isMovable: n, onSelect: r }) {
296
- return /* @__PURE__ */ N("span", {
259
+ function ge({ kind: t, isMovable: n, onSelect: r }) {
260
+ return /* @__PURE__ */ L("span", {
297
261
  className: "ds-storyblock__kind",
298
262
  "data-drag-handle": n ? "" : void 0,
299
263
  draggable: n || void 0,
300
264
  title: n ? "Drag to move" : void 0,
301
265
  onClick: n ? r : void 0,
302
- children: [n && /* @__PURE__ */ M("span", {
266
+ children: [n && /* @__PURE__ */ I("span", {
303
267
  className: "ds-storyblock__grip",
304
268
  "aria-hidden": "true",
305
- children: /* @__PURE__ */ M(e, {
269
+ children: /* @__PURE__ */ I(e, {
306
270
  name: "grip-vertical",
307
271
  size: 16
308
272
  })
309
- }), /* @__PURE__ */ M(d, {
273
+ }), /* @__PURE__ */ I(m, {
310
274
  className: "ds-storyblock__kind-label",
311
275
  shape: "tag",
312
276
  size: "sm",
@@ -314,119 +278,172 @@ function he({ kind: t, isMovable: n, onSelect: r }) {
314
278
  })]
315
279
  });
316
280
  }
317
- function ge({ kind: e, name: n, align: r, isSelected: i, isLocked: a, canReplace: o, onEdit: s, onSelect: c, onAlign: l, onReplace: d, onRemove: f }) {
318
- let p = {
319
- left: !0,
320
- full: !0,
321
- right: !0,
322
- replace: o.isEnabled,
323
- edit: !!s,
324
- remove: !0
325
- }, { control: m, barProps: h } = pe(i, a ? [] : ue.filter((e) => p[e]));
326
- return /* @__PURE__ */ N("div", {
281
+ function _e({ kind: e, name: n, align: r, isSelected: s, isLocked: c, missing: l, canReplace: u, onEdit: d, onSelect: f, onAlign: m, onReplace: h, onRemove: g }) {
282
+ let [_, b] = P(!1), [x, S] = P(!1), C = N(null), w = N(null), T = j(), E = o(_) && !c, D = `Block actions for ${n}`;
283
+ _ && c && b(!1), A(() => {
284
+ if (!E) return;
285
+ w.current?.querySelector("[aria-pressed=\"true\"]")?.focus({ preventScroll: !0 });
286
+ let e = (e) => {
287
+ let t = e.target;
288
+ t instanceof Node && !C.current?.contains(t) && !w.current?.contains(t) && b(!1);
289
+ };
290
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
291
+ }, [E]);
292
+ let O = () => {
293
+ b(!1), C.current?.focus({ preventScroll: !0 });
294
+ };
295
+ return /* @__PURE__ */ L("div", {
327
296
  className: "ds-storyblock__bar ds-field-surface",
328
- role: "toolbar",
329
- "aria-label": `Block actions for ${n}`,
330
- ...h,
297
+ onKeyDown: (e) => {
298
+ let t = w.current;
299
+ if (!E || !t) return;
300
+ if (e.key === "Escape" && !e.nativeEvent.isComposing) {
301
+ e.preventDefault(), e.stopPropagation(), O();
302
+ return;
303
+ }
304
+ if (e.key !== "Tab" || !(e.target instanceof Node) || !t.contains(e.target)) return;
305
+ let n = a(t), r = e.shiftKey ? n[0] : n.at(-1);
306
+ e.target === t && !e.shiftKey ? (e.preventDefault(), n[0]?.focus({ preventScroll: !0 })) : (e.target === r || e.target === t) && (e.preventDefault(), e.shiftKey ? O() : (b(!1), i(e.currentTarget)));
307
+ },
308
+ onBlur: ({ relatedTarget: e }) => {
309
+ E && e && e !== C.current && !w.current?.contains(e) && b(!1);
310
+ },
331
311
  children: [
332
- /* @__PURE__ */ M(he, {
312
+ /* @__PURE__ */ I(ge, {
333
313
  kind: e,
334
- isMovable: !a,
335
- onSelect: c
314
+ isMovable: !c,
315
+ onSelect: f
336
316
  }),
337
- /* @__PURE__ */ M(u, {
338
- className: "ds-storyblock__alignment",
339
- "aria-label": "Alignment",
340
- children: Z.map((e) => /* @__PURE__ */ M(t, {
341
- ...m(e.align),
342
- size: "sm",
343
- isIconOnly: !0,
344
- iconStart: e.icon,
345
- "aria-label": `${e.label}: ${n}`,
346
- title: e.label,
347
- "aria-pressed": r === e.align,
348
- variant: r === e.align ? "primary" : "neutral",
349
- onClick: () => l(e.align)
350
- }, e.align))
317
+ /* @__PURE__ */ I(t, {
318
+ ref: C,
319
+ variant: E ? "active" : "simple",
320
+ size: "sm",
321
+ isIconOnly: !0,
322
+ iconStart: "more-horizontal",
323
+ isDisabled: c,
324
+ tabIndex: !c && (s || x || E) ? 0 : -1,
325
+ "aria-label": D,
326
+ "aria-haspopup": "dialog",
327
+ "aria-expanded": E,
328
+ "aria-controls": E ? T : void 0,
329
+ onFocus: () => S(!0),
330
+ onBlur: () => S(!1),
331
+ onClick: () => E ? O() : b(!0)
351
332
  }),
352
- /* @__PURE__ */ N("div", {
353
- className: "ds-storyblock__actions",
354
- children: [
355
- o.isShown && /* @__PURE__ */ M(t, {
356
- ...m("replace"),
357
- variant: "simple",
358
- size: "sm",
359
- "aria-label": `Replace ${n}`,
360
- onClick: d,
361
- children: "Replace"
362
- }),
363
- s && /* @__PURE__ */ M(t, {
364
- ...m("edit"),
365
- variant: "simple",
366
- size: "sm",
367
- isIconOnly: !0,
368
- iconStart: "pencil",
369
- "aria-label": `Edit ${n}`,
370
- title: `Edit ${e}`,
371
- onClick: s
372
- }),
373
- /* @__PURE__ */ M(t, {
374
- ...m("remove"),
375
- variant: "simple",
376
- size: "sm",
377
- isIconOnly: !0,
378
- iconStart: "trash",
379
- "aria-label": `Remove ${n}`,
380
- title: "Remove block from this field",
381
- onClick: f
382
- })
383
- ]
333
+ /* @__PURE__ */ I(v, {
334
+ anchorRef: C,
335
+ panelRef: w,
336
+ isOpen: E,
337
+ align: "end",
338
+ role: "dialog",
339
+ tabIndex: -1,
340
+ "aria-label": D,
341
+ id: T,
342
+ className: "ds-storyblock__popover ds-surface-raised ds-field-surface",
343
+ children: /* @__PURE__ */ L("div", {
344
+ className: "ds-storyblock__popover-content",
345
+ children: [
346
+ /* @__PURE__ */ L("div", {
347
+ className: "ds-storyblock__popover-section",
348
+ children: [/* @__PURE__ */ I("div", {
349
+ className: "ds-storyblock__popover-label",
350
+ children: "Alignment"
351
+ }), /* @__PURE__ */ I(p, {
352
+ className: "ds-storyblock__alignment",
353
+ "aria-label": "Alignment",
354
+ children: me.map((e) => /* @__PURE__ */ I(t, {
355
+ size: "sm",
356
+ iconStart: e.icon,
357
+ "aria-pressed": r === e.align,
358
+ variant: r === e.align ? "primary" : "neutral",
359
+ onClick: () => m(e.align),
360
+ children: e.label
361
+ }, e.align))
362
+ })]
363
+ }),
364
+ (d || u.isShown) && /* @__PURE__ */ L("div", {
365
+ className: "ds-storyblock__popover-section",
366
+ children: [d && /* @__PURE__ */ L(t, {
367
+ className: "ds-storyblock__action",
368
+ variant: "simple",
369
+ size: "md",
370
+ iconStart: "pencil",
371
+ onClick: () => {
372
+ O(), d();
373
+ },
374
+ children: ["Edit ", e]
375
+ }), u.isShown && /* @__PURE__ */ I(t, {
376
+ className: "ds-storyblock__action",
377
+ variant: "simple",
378
+ size: "md",
379
+ iconStart: "rotate-cw",
380
+ isDisabled: !u.isEnabled,
381
+ onClick: () => {
382
+ O(), h();
383
+ },
384
+ children: l ? `Choose another ${e}…` : "Replace…"
385
+ })]
386
+ }),
387
+ /* @__PURE__ */ I(y, {}),
388
+ /* @__PURE__ */ I(t, {
389
+ className: "ds-storyblock__action",
390
+ variant: "danger",
391
+ size: "md",
392
+ iconStart: "trash",
393
+ onClick: () => {
394
+ b(!1), g();
395
+ },
396
+ children: "Remove from field"
397
+ })
398
+ ]
399
+ })
384
400
  })
385
401
  ]
386
402
  });
387
403
  }
388
- function _e({ kind: e, id: t, item: n, missing: r }) {
389
- return /* @__PURE__ */ M("div", {
404
+ function ve({ kind: e, id: t, item: n, missing: r }) {
405
+ return /* @__PURE__ */ I("div", {
390
406
  className: "ds-entry ds-storyblock__body",
391
- children: r ? /* @__PURE__ */ N("span", {
407
+ children: r ? /* @__PURE__ */ L("span", {
392
408
  className: "ds-entry__body",
393
- children: [/* @__PURE__ */ M("em", {
409
+ children: [/* @__PURE__ */ I("em", {
394
410
  className: "ds-entry__title",
395
411
  children: `Unavailable ${e}`
396
- }), /* @__PURE__ */ N("span", {
412
+ }), /* @__PURE__ */ L("span", {
397
413
  className: "ds-entry__meta",
398
- children: [/* @__PURE__ */ M("span", { children: `This ${e} was deleted. Replace or remove it.` }), /* @__PURE__ */ M("code", { children: t })]
414
+ children: [/* @__PURE__ */ I("span", { children: `This ${e} was deleted. Replace or remove it.` }), /* @__PURE__ */ I("code", { children: t })]
399
415
  })]
400
- }) : /* @__PURE__ */ M(_, { item: n })
416
+ }) : /* @__PURE__ */ I(S, { item: n })
401
417
  });
402
418
  }
403
- function ve({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i }) {
404
- let { disabled: a, busy: o, replace: s } = w(Y), c = e.attrs.type, l = String(c === "entry" ? e.attrs.entryId : e.attrs.assetId), { view: u, item: d, missing: f, failure: p } = me(c, l), m = e.attrs.align ?? "full", h = !f && !d.isUnavailable && !d.isDisabled && u?.onEditItem, g = t && !a, _ = () => {
419
+ function ye({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i }) {
420
+ let { disabled: a, busy: o, replace: s } = k(Z), c = e.attrs.type, l = String(c === "entry" ? e.attrs.entryId : e.attrs.assetId), { view: u, item: d, missing: f, failure: p } = he(c, l), m = e.attrs.align ?? "full", h = !f && !d.isUnavailable && !d.isDisabled && u?.onEditItem, g = t && !a, _ = () => {
405
421
  let e = r();
406
422
  e !== void 0 && n.chain().focus().setNodeSelection(e).run();
407
423
  };
408
- return /* @__PURE__ */ N(P, {
409
- className: "ds-storyblock",
424
+ return /* @__PURE__ */ L(z, {
425
+ className: "ds-storyblock ds-field-surface",
410
426
  "data-align": m,
411
427
  "data-selected": g || void 0,
412
428
  "data-missing": f || void 0,
413
429
  "data-tone": f ? "removed" : d.tone,
414
430
  contentEditable: !1,
415
431
  onMouseDown: (e) => {
416
- let t = e.target instanceof Element ? e.target : null;
417
- t?.closest("button") ? e.preventDefault() : !a && !t?.closest("[data-drag-handle]") && (e.preventDefault(), _());
432
+ let t = e.target;
433
+ t instanceof Element && e.currentTarget.contains(t) && (t.closest("button") ? e.preventDefault() : !a && !t.closest("[data-drag-handle]") && (e.preventDefault(), _()));
418
434
  },
419
435
  children: [
420
- a ? /* @__PURE__ */ M("div", {
436
+ a ? /* @__PURE__ */ I("div", {
421
437
  className: "ds-storyblock__bar ds-field-surface",
422
- children: /* @__PURE__ */ M(he, {
438
+ children: /* @__PURE__ */ I(ge, {
423
439
  kind: c,
424
440
  isMovable: !1
425
441
  })
426
- }) : /* @__PURE__ */ M(ge, {
442
+ }) : /* @__PURE__ */ I(_e, {
427
443
  kind: c,
428
444
  name: f ? `Unavailable ${c}` : d.title,
429
445
  align: m,
446
+ missing: f,
430
447
  isSelected: g,
431
448
  isLocked: !!u?.isDialogHidden,
432
449
  canReplace: {
@@ -448,13 +465,13 @@ function ve({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i })
448
465
  }).run();
449
466
  }
450
467
  }),
451
- /* @__PURE__ */ M(_e, {
468
+ /* @__PURE__ */ I(ve, {
452
469
  kind: c,
453
470
  id: l,
454
471
  item: d,
455
472
  missing: f
456
473
  }),
457
- p && /* @__PURE__ */ M("div", {
474
+ p && /* @__PURE__ */ I("div", {
458
475
  className: "ds-storyblock__failure",
459
476
  children: p
460
477
  })
@@ -463,7 +480,7 @@ function ve({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i })
463
480
  }
464
481
  //#endregion
465
482
  //#region src/components/RichTextEditor/use-embeds.tsx
466
- var ye = "ds-rte-embed-commit", be = ["entry", "asset"], xe = {
483
+ var be = "ds-rte-embed-commit", xe = ["entry", "asset"], Se = {
467
484
  entry: {
468
485
  itemLabel: "entry",
469
486
  itemsLabel: "entries"
@@ -472,8 +489,8 @@ var ye = "ds-rte-embed-commit", be = ["entry", "asset"], xe = {
472
489
  itemLabel: "asset",
473
490
  itemsLabel: "assets"
474
491
  }
475
- }, Se = {}, Ce = [];
476
- function we(e, t, n) {
492
+ }, Ce = {}, we = [];
493
+ function Q(e, t, n) {
477
494
  return {
478
495
  type: e,
479
496
  align: t,
@@ -483,29 +500,29 @@ function we(e, t, n) {
483
500
  } : { assetId: n.id }
484
501
  };
485
502
  }
486
- function Q(e, t) {
503
+ function Te(e, t) {
487
504
  if (t.tone === "removed") return {
488
505
  label: t.removedLabel ?? "Removed",
489
506
  description: `This ${e} was removed.`
490
507
  };
491
- if (!B(we(e, "full", t))) return {
508
+ if (!W(Q(e, "full", t))) return {
492
509
  label: "Can't embed",
493
510
  description: `This ${e} has no ${e === "entry" && !t.modelId?.trim() ? "model API ID" : "ID"}.`
494
511
  };
495
512
  }
496
- var Te = {
497
- entry: (e) => Q("entry", e),
498
- asset: (e) => Q("asset", e)
513
+ var Ee = {
514
+ entry: (e) => Te("entry", e),
515
+ asset: (e) => Te("asset", e)
499
516
  };
500
- function Ee(e, t) {
517
+ function De(e, t) {
501
518
  return e?.type.name === "storyblock" && e.attrs.type === t.kind && String(t.kind === "entry" ? e.attrs.entryId : e.attrs.assetId) === t.replaceId;
502
519
  }
503
- function De(e) {
520
+ function Oe(e) {
504
521
  return e.flatMap((e) => e.mapping.maps);
505
522
  }
506
- function Oe(e, t) {
523
+ function ke(e, t) {
507
524
  let n = t;
508
- for (let t of De(e)) {
525
+ for (let t of Oe(e)) {
509
526
  let e = n, r;
510
527
  if (t.forEach((t, n, i, a) => {
511
528
  r === void 0 && t <= e && e < n && n - t === a - i && (r = i + (e - t));
@@ -519,9 +536,9 @@ function Oe(e, t) {
519
536
  }
520
537
  return n;
521
538
  }
522
- function ke(e, t, n) {
539
+ function Ae(e, t, n) {
523
540
  let r = t, i = n;
524
- for (let t of De(e)) {
541
+ for (let t of Oe(e)) {
525
542
  if (r === i) {
526
543
  r = i = t.map(i, -1);
527
544
  continue;
@@ -537,13 +554,13 @@ function ke(e, t, n) {
537
554
  to: i
538
555
  };
539
556
  }
540
- function Ae(e, t) {
557
+ function je(e, t) {
541
558
  let n = e.resolve(Math.min(t, e.content.size));
542
559
  return n.depth ? n.after(1) : n.pos;
543
560
  }
544
- function je(e, t, n) {
545
- let r = e !== void 0, i = !!e?.resolveItem, a = !!e?.onEditItem, o = e?.refreshKey, s = e?.items, c = !!e?.isDialogHidden, l = J(e);
546
- return D(() => r ? {
561
+ function Me(e, t, n) {
562
+ let r = e !== void 0, i = !!e?.resolveItem, a = !!e?.onEditItem, o = e?.refreshKey, s = e?.items, c = !!e?.isDialogHidden, l = X(e);
563
+ return M(() => r ? {
547
564
  resolveItem: i ? t : void 0,
548
565
  refreshKey: o,
549
566
  items: s,
@@ -562,8 +579,8 @@ function je(e, t, n) {
562
579
  n
563
580
  ]);
564
581
  }
565
- function Me({ session: e, source: t, disabled: n, label: r, close: i, target: a, pick: o }) {
566
- let { itemLabel: s, itemsLabel: c } = xe[e.kind], l = D(() => e.replaceId ? [e.replaceId] : [], [e]), u = b(l, t.items ?? Ce, {
582
+ function Ne({ session: e, source: t, disabled: n, label: r, close: i, target: a, pick: o }) {
583
+ let { itemLabel: s, itemsLabel: c } = Se[e.kind], l = M(() => e.replaceId ? [e.replaceId] : [], [e]), u = T(l, t.items ?? we, {
567
584
  ...t,
568
585
  resolveItem: void 0,
569
586
  mode: "single"
@@ -573,9 +590,9 @@ function Me({ session: e, source: t, disabled: n, label: r, close: i, target: a,
573
590
  itemLabel: s,
574
591
  itemsLabel: c,
575
592
  close: i,
576
- restrict: Te[e.kind]
593
+ restrict: Ee[e.kind]
577
594
  }), d = e.replaceId ? "Replace" : "Embed";
578
- return /* @__PURE__ */ M(g, {
595
+ return /* @__PURE__ */ I(x, {
579
596
  ...u.dialog,
580
597
  isOpen: !0,
581
598
  onClose: i,
@@ -591,42 +608,42 @@ function Me({ session: e, source: t, disabled: n, label: r, close: i, target: a,
591
608
  isDialogHidden: t.isDialogHidden
592
609
  });
593
610
  }
594
- function Ne(e, n = Se, r, i) {
595
- let [a, s] = k(null), c = O(0), l = O({
611
+ function Pe(e, n = Ce, r, i) {
612
+ let [a, o] = P(null), s = N(0), c = N({
596
613
  session: null,
597
614
  from: 0,
598
615
  to: 0,
599
616
  alive: !1
600
- }), d = O(/* @__PURE__ */ new Map()), [f, p] = k(0), m = C(() => {
601
- l.current.alive = !1, s(null);
602
- }, []), h = a ? n[a.kind] : void 0, g = a && J(h) && (!r || h?.isCreating) ? a : null;
603
- a && !g && s(null);
604
- let _ = !!(g && (h?.isDialogHidden || h?.isCreating)), v = o({
617
+ }), u = N(/* @__PURE__ */ new Map()), [d, f] = P(0), m = O(() => {
618
+ c.current.alive = !1, o(null);
619
+ }, []), h = a ? n[a.kind] : void 0, g = a && X(h) && (!r || h?.isCreating) ? a : null;
620
+ a && !g && o(null);
621
+ let _ = !!(g && (h?.isDialogHidden || h?.isCreating)), v = l({
605
622
  editor: e,
606
623
  sources: n,
607
624
  disabled: r,
608
625
  busy: _
609
626
  });
610
- T(() => {
627
+ A(() => {
611
628
  if (!e || !a) return;
612
- l.current.alive = !0;
629
+ c.current.alive = !0;
613
630
  let t = ({ editor: e, transaction: t, appendedTransactions: n }) => {
614
631
  let r = [t, ...n];
615
- if (!l.current.alive || !r.some((e) => e.docChanged)) return;
616
- let { from: i, to: o } = l.current;
632
+ if (!c.current.alive || !r.some((e) => e.docChanged)) return;
633
+ let { from: i, to: o } = c.current;
617
634
  if (a.replaceId === void 0) {
618
- let e = ke(r, i, o);
619
- e ? Object.assign(l.current, e) : m();
635
+ let e = Ae(r, i, o);
636
+ e ? Object.assign(c.current, e) : m();
620
637
  return;
621
638
  }
622
- let s = Oe(r, i);
623
- s === null || !Ee(e.state.doc.nodeAt(s), a) ? m() : Object.assign(l.current, {
639
+ let s = ke(r, i);
640
+ s === null || !De(e.state.doc.nodeAt(s), a) ? m() : Object.assign(c.current, {
624
641
  from: s,
625
642
  to: s + 1
626
643
  });
627
644
  };
628
645
  return e.on("transaction", t), () => {
629
- e.off("transaction", t), l.current.session === a && (l.current.alive = !1);
646
+ e.off("transaction", t), c.current.session === a && (c.current.alive = !1);
630
647
  };
631
648
  }, [
632
649
  e,
@@ -635,41 +652,41 @@ function Ne(e, n = Se, r, i) {
635
652
  ]);
636
653
  let y = (e) => {
637
654
  let { editor: t, sources: n, disabled: r } = v.current, i = n[e.kind];
638
- return !(!t || t.isDestroyed || l.current.session !== e || !l.current.alive || !J(i) || r && !i?.isCreating);
655
+ return !(!t || t.isDestroyed || c.current.session !== e || !c.current.alive || !X(i) || r && !i?.isCreating);
639
656
  }, b = (e, t, n) => {
640
657
  let r = v.current.editor;
641
658
  if (!r || !y(e) || t.isDisabled || t.tone === "removed") return !1;
642
- let { doc: i } = r.state, a = e.replaceId !== void 0, o = a ? i.nodeAt(l.current.from) : null;
643
- if (a && !Ee(o, e)) return !1;
644
- let s = we(e.kind, o?.attrs.align ?? "full", t);
645
- if (!B(s)) return !1;
646
- let c = a ? l.current.from : Ae(i, l.current.to), u = `${e.kind}:${t.id}`;
647
- l.current.alive = !1, d.current = /* @__PURE__ */ new Map([[u, {
659
+ let { doc: i } = r.state, a = e.replaceId !== void 0, o = a ? i.nodeAt(c.current.from) : null;
660
+ if (a && !De(o, e)) return !1;
661
+ let s = Q(e.kind, o?.attrs.align ?? "full", t);
662
+ if (!W(s)) return !1;
663
+ let l = a ? c.current.from : je(i, c.current.to), d = `${e.kind}:${t.id}`;
664
+ c.current.alive = !1, u.current = /* @__PURE__ */ new Map([[d, {
648
665
  item: t,
649
666
  revision: n
650
667
  }]]);
651
- let f = !1;
668
+ let p = !1;
652
669
  try {
653
- let e = r.chain().focus().setMeta(ye, !0);
654
- f = a ? e.setNodeSelection(c).updateAttributes("storyblock", s).run() : e.insertContentAt(c, {
670
+ let e = r.chain().focus().setMeta(be, !0);
671
+ p = a ? e.setNodeSelection(l).updateAttributes("storyblock", s).run() : e.insertContentAt(l, {
655
672
  type: "storyblock",
656
673
  attrs: s
657
- }).setNodeSelection(c).run();
674
+ }).setNodeSelection(l).run();
658
675
  } catch {
659
- f = !1;
676
+ p = !1;
660
677
  } finally {
661
678
  m();
662
679
  }
663
- return f ? p((e) => e + 1) : d.current.delete(u), f;
680
+ return p ? f((e) => e + 1) : u.current.delete(d), p;
664
681
  }, x = (e, t) => {
665
682
  let { editor: n, sources: r, disabled: i, busy: a } = v.current;
666
- if (!n || i || a || !J(r[e])) return;
667
- let o = t === void 0 ? null : n.state.doc.nodeAt(t);
668
- if (t !== void 0 && (o?.type.name !== "storyblock" || o.attrs.type !== e)) return;
683
+ if (!n || i || a || !X(r[e])) return;
684
+ let l = t === void 0 ? null : n.state.doc.nodeAt(t);
685
+ if (t !== void 0 && (l?.type.name !== "storyblock" || l.attrs.type !== e)) return;
669
686
  let { $from: u, from: d, to: f } = n.state.selection, p = {
670
- id: c.current += 1,
687
+ id: s.current += 1,
671
688
  kind: e,
672
- replaceId: o ? String(e === "entry" ? o.attrs.entryId : o.attrs.assetId) : void 0
689
+ replaceId: l ? String(e === "entry" ? l.attrs.entryId : l.attrs.assetId) : void 0
673
690
  }, m = t === void 0 ? u.depth ? {
674
691
  from: u.before(1),
675
692
  to: u.after(1)
@@ -680,16 +697,16 @@ function Ne(e, n = Se, r, i) {
680
697
  from: t,
681
698
  to: t + 1
682
699
  };
683
- l.current = {
700
+ c.current = {
684
701
  session: p,
685
702
  ...m,
686
703
  alive: !0
687
- }, s(p);
688
- }, S = o({ open: x }), [w] = k(() => ({
704
+ }, o(p);
705
+ }, S = l({ open: x }), [C] = P(() => ({
689
706
  replace: (e, t) => S.current.open(e, t),
690
- seed: (e, t) => d.current.get(`${e}:${t}`),
707
+ seed: (e, t) => u.current.get(`${e}:${t}`),
691
708
  forgetSeed: (e, t, n) => {
692
- d.current.get(`${e}:${t}`) === n && d.current.delete(`${e}:${t}`);
709
+ u.current.get(`${e}:${t}`) === n && u.current.delete(`${e}:${t}`);
693
710
  },
694
711
  resolve: {
695
712
  entry: (e) => v.current.sources.entry?.resolveItem?.(e) ?? null,
@@ -703,31 +720,31 @@ function Ne(e, n = Se, r, i) {
703
720
  v.current.sources.asset?.onEditItem?.(e);
704
721
  }
705
722
  }
706
- })), E = je(n.entry, w.resolve.entry, w.edit.entry), A = je(n.asset, w.resolve.asset, w.edit.asset), j = D(() => ({
723
+ })), w = Me(n.entry, C.resolve.entry, C.edit.entry), T = Me(n.asset, C.resolve.asset, C.edit.asset), E = M(() => ({
707
724
  views: {
708
- entry: E,
709
- asset: A
725
+ entry: w,
726
+ asset: T
710
727
  },
711
728
  disabled: r,
712
729
  busy: _,
713
- pickCount: f,
714
- replace: w.replace,
715
- seed: w.seed,
716
- forgetSeed: w.forgetSeed
730
+ pickCount: d,
731
+ replace: C.replace,
732
+ seed: C.seed,
733
+ forgetSeed: C.forgetSeed
717
734
  }), [
718
- E,
719
- A,
735
+ w,
736
+ T,
720
737
  r,
721
738
  _,
722
- f,
723
- w
724
- ]), N = be.filter((e) => J(n[e]));
739
+ d,
740
+ C
741
+ ]), D = xe.filter((e) => X(n[e]));
725
742
  return {
726
- context: j,
727
- isCreating: be.some((e) => n[e]?.isCreating),
728
- toolbar: N.length > 0 && /* @__PURE__ */ M(u, {
743
+ context: E,
744
+ isCreating: xe.some((e) => n[e]?.isCreating),
745
+ toolbar: D.length > 0 && /* @__PURE__ */ I(p, {
729
746
  "aria-label": "Embed",
730
- children: N.map((n) => /* @__PURE__ */ M(t, {
747
+ children: D.map((n) => /* @__PURE__ */ I(t, {
731
748
  size: "sm",
732
749
  isIconOnly: !0,
733
750
  iconStart: n === "entry" ? "file-text" : "image",
@@ -739,7 +756,7 @@ function Ne(e, n = Se, r, i) {
739
756
  onClick: () => x(n)
740
757
  }, n))
741
758
  }),
742
- dialog: e && g && h && /* @__PURE__ */ M(Me, {
759
+ dialog: e && g && h && /* @__PURE__ */ I(Ne, {
743
760
  session: g,
744
761
  source: h,
745
762
  disabled: r,
@@ -755,9 +772,9 @@ function Ne(e, n = Se, r, i) {
755
772
  }
756
773
  //#endregion
757
774
  //#region src/components/RichTextEditor/index.tsx
758
- function Pe({ editor: e, selection: n, onClose: r }) {
759
- let [i, a] = k(n.href), [o, s] = k(), c = E();
760
- T(() => {
775
+ function Fe({ editor: e, selection: n, onClose: r }) {
776
+ let [i, a] = P(n.href), [o, s] = P(), c = j();
777
+ A(() => {
761
778
  let t = () => {
762
779
  e.state.doc.eq(n.document) || r();
763
780
  };
@@ -792,13 +809,13 @@ function Pe({ editor: e, selection: n, onClose: r }) {
792
809
  }]
793
810
  }).run() : a.setLink({ href: t }).run(), r();
794
811
  };
795
- return /* @__PURE__ */ M(p, {
812
+ return /* @__PURE__ */ I(g, {
796
813
  isOpen: !0,
797
814
  title: n.isEditing ? "Edit link" : "Add link",
798
815
  size: "dialog",
799
816
  onClose: r,
800
- footer: /* @__PURE__ */ N(j, { children: [
801
- n.isEditing && /* @__PURE__ */ M(t, {
817
+ footer: /* @__PURE__ */ L(ee, { children: [
818
+ n.isEditing && /* @__PURE__ */ I(t, {
802
819
  variant: "danger",
803
820
  onClick: () => {
804
821
  l() && e.chain().focus().setTextSelection({
@@ -808,28 +825,28 @@ function Pe({ editor: e, selection: n, onClose: r }) {
808
825
  },
809
826
  children: "Remove link"
810
827
  }),
811
- /* @__PURE__ */ M(t, {
828
+ /* @__PURE__ */ I(t, {
812
829
  onClick: r,
813
830
  children: "Cancel"
814
831
  }),
815
- /* @__PURE__ */ M(t, {
832
+ /* @__PURE__ */ I(t, {
816
833
  variant: "primary",
817
834
  type: "submit",
818
835
  form: c,
819
836
  children: "Save"
820
837
  })
821
838
  ] }),
822
- children: /* @__PURE__ */ M("form", {
839
+ children: /* @__PURE__ */ I("form", {
823
840
  id: c,
824
841
  noValidate: !0,
825
842
  onSubmit: (e) => {
826
843
  e.preventDefault(), e.stopPropagation(), u();
827
844
  },
828
- children: /* @__PURE__ */ M(f, {
845
+ children: /* @__PURE__ */ I(h, {
829
846
  label: "URL",
830
847
  isRequired: !0,
831
848
  error: o,
832
- children: (e) => /* @__PURE__ */ M(m, {
849
+ children: (e) => /* @__PURE__ */ I(_, {
833
850
  ...e,
834
851
  value: i,
835
852
  inputMode: "url",
@@ -922,15 +939,15 @@ var $ = [
922
939
  run: (e) => e.chain().focus().redo().run()
923
940
  }]
924
941
  ];
925
- function Fe({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openLink: o, expandControl: s, embedControl: c }) {
926
- return /* @__PURE__ */ N("div", {
942
+ function Ie({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openLink: o, expandControl: s, embedControl: c }) {
943
+ return /* @__PURE__ */ L("div", {
927
944
  className: "ds-rte__toolbar ds-field-surface",
928
945
  role: "toolbar",
929
946
  "aria-label": `${i} formatting`,
930
947
  children: [
931
- $.map((i, a) => /* @__PURE__ */ M(u, {
948
+ $.map((i, a) => /* @__PURE__ */ I(p, {
932
949
  "aria-label": `Formatting ${a + 1}`,
933
- children: i.map((i) => /* @__PURE__ */ M(t, {
950
+ children: i.map((i) => /* @__PURE__ */ I(t, {
934
951
  size: "sm",
935
952
  isIconOnly: !0,
936
953
  iconStart: i.icon,
@@ -942,9 +959,9 @@ function Fe({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openL
942
959
  onClick: () => e && i.run(e)
943
960
  }, i.id))
944
961
  }, a)),
945
- /* @__PURE__ */ M(u, {
962
+ /* @__PURE__ */ I(p, {
946
963
  "aria-label": "Link",
947
- children: /* @__PURE__ */ M(t, {
964
+ children: /* @__PURE__ */ I(t, {
948
965
  size: "sm",
949
966
  isIconOnly: !0,
950
967
  iconStart: "link",
@@ -961,32 +978,36 @@ function Fe({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openL
961
978
  ]
962
979
  });
963
980
  }
964
- var Ie = S(function({ scopeRef: e, className: t, expansion: n, isFocused: r, disabled: i, invalid: o, contentError: s, errorId: c, surface: l, children: u }, d) {
965
- return /* @__PURE__ */ M(a.Provider, {
981
+ var Le = D(function({ scopeRef: e, className: t, expansion: n, isFocused: r, disabled: i, invalid: a, contentError: o, errorId: s, surface: l, children: u }, d) {
982
+ return /* @__PURE__ */ I(c.Provider, {
966
983
  value: e,
967
- children: /* @__PURE__ */ N("div", {
984
+ children: /* @__PURE__ */ L("div", {
968
985
  ref: d,
969
986
  className: ["ds-rte", t].filter(Boolean).join(" "),
970
987
  style: n.frameStyle,
971
988
  "data-expanded": n.expanded || void 0,
972
989
  "data-focused": r && !n.expanded || void 0,
973
990
  "data-disabled": i || void 0,
974
- "aria-invalid": o || void 0,
991
+ "data-invalid": a || void 0,
992
+ "aria-invalid": a || void 0,
975
993
  children: [
976
- s && /* @__PURE__ */ M("p", {
977
- id: c,
994
+ o && /* @__PURE__ */ I("p", {
995
+ id: s,
978
996
  role: "alert",
979
997
  className: "ds-field__error",
980
- children: s
998
+ children: o
981
999
  }),
982
- n.expanded && /* @__PURE__ */ M("p", {
1000
+ n.expanded && /* @__PURE__ */ I("p", {
983
1001
  className: "ds-rte__placeholder",
984
1002
  children: "Editing in expanded view. Press Esc to return."
985
1003
  }),
986
- n.surfaceSlot(/* @__PURE__ */ M("div", {
1004
+ n.surfaceSlot(/* @__PURE__ */ I("div", {
987
1005
  className: "ds-rte__surface",
988
- hidden: !!s,
989
- "data-invalid": o || void 0,
1006
+ hidden: !!o,
1007
+ "data-expanded": n.expanded || void 0,
1008
+ "data-focused": r || void 0,
1009
+ "data-disabled": i || void 0,
1010
+ "data-invalid": a || void 0,
990
1011
  children: l
991
1012
  })),
992
1013
  n.dialog,
@@ -994,33 +1015,33 @@ var Ie = S(function({ scopeRef: e, className: t, expansion: n, isFocused: r, dis
994
1015
  ]
995
1016
  })
996
1017
  });
997
- }), Le = H.extend({ addNodeView() {
998
- return F(ve, { update: ({ oldNode: e, newNode: t, updateProps: n }) => e.attrs.type === t.attrs.type && (e !== t && n(), !0) });
1018
+ }), Re = K.extend({ addNodeView() {
1019
+ return B(ye, { update: ({ oldNode: e, newNode: t, updateProps: n }) => e.attrs.type === t.attrs.type && (e !== t && n(), !0) });
999
1020
  } });
1000
- function Re(e, t) {
1021
+ function ze(e, t) {
1001
1022
  return t.key !== "Escape" || t.isComposing ? !1 : (e.someProp("handleKeyDown", (n) => n(e, t)) && t.preventDefault(), !0);
1002
1023
  }
1003
- var ze = S(function(e, t) {
1004
- let { placeholder: r = "Write something…", size: i = "md", expandedWidth: a = "wide", isDisabled: o = !1, isInvalid: s = !1, label: c = "Rich text editor", className: l, toolbarExtra: u, id: d, isRequired: f, required: p, "aria-label": m, "aria-labelledby": h, "aria-describedby": g, "aria-invalid": _ } = e, v = O(null), y = D(() => n(v, t), [t]), [b, x] = k(!1), [S, w] = k(null), A = C(() => w(null), []), [te] = k(() => e.defaultValue ?? (e.format === "json" ? U : "")), P = e.value === void 0 ? te : e.value, F = D(() => e.format === "json" ? le(P) : void 0, [e.format, P]), ie = E(), I = s || !!F || _, L = o || !!F;
1005
- L && S && w(null);
1006
- let R = C((e, t) => {
1007
- if (L) return;
1024
+ var Be = D(function(e, t) {
1025
+ let { placeholder: r = "Write something…", size: i = "md", expandedWidth: a = "wide", isDisabled: o = !1, isInvalid: s = !1, label: c = "Rich text editor", className: l, toolbarExtra: u, id: d, isRequired: f, required: p, "aria-label": m, "aria-labelledby": h, "aria-describedby": g, "aria-invalid": _ } = e, v = N(null), y = M(() => n(v, t), [t]), [b, x] = P(!1), [S, C] = P(null), w = O(() => C(null), []), [T] = P(() => e.defaultValue ?? (e.format === "json" ? q : "")), E = e.value === void 0 ? T : e.value, D = M(() => e.format === "json" ? fe(E) : void 0, [e.format, E]), k = j(), F = s || !!D || _, R = o || !!D;
1026
+ R && S && C(null);
1027
+ let z = O((e, t) => {
1028
+ if (R) return;
1008
1029
  let n = t === void 0 ? void 0 : re(e.doc.resolve(t), e.schema.marks.link), r = n && e.doc.nodeAt(n.from)?.marks.find((t) => t.type === e.schema.marks.link);
1009
- w({
1030
+ C({
1010
1031
  from: n?.from ?? e.selection.from,
1011
1032
  to: n?.to ?? e.selection.to,
1012
1033
  href: r?.attrs.href ?? "",
1013
1034
  isEditing: !!r,
1014
1035
  document: e.doc
1015
1036
  });
1016
- }, [L]), z = D(() => ({
1037
+ }, [R]), B = M(() => ({
1017
1038
  role: "textbox",
1018
1039
  ...h ? {} : { "aria-label": m ?? c },
1019
1040
  "aria-multiline": "true",
1020
1041
  ...d ? { id: d } : {},
1021
1042
  ...h ? { "aria-labelledby": h } : {},
1022
1043
  ...g ? { "aria-describedby": g } : {},
1023
- ...I ? { "aria-invalid": String(I) } : {},
1044
+ ...F ? { "aria-invalid": String(F) } : {},
1024
1045
  ...f || p ? { "aria-required": "true" } : {}
1025
1046
  }), [
1026
1047
  c,
@@ -1028,96 +1049,96 @@ var ze = S(function(e, t) {
1028
1049
  d,
1029
1050
  h,
1030
1051
  g,
1031
- I,
1052
+ F,
1032
1053
  f,
1033
1054
  p
1034
- ]), B = D(() => ({
1035
- attributes: z,
1055
+ ]), V = M(() => ({
1056
+ attributes: B,
1036
1057
  handleDOMEvents: {
1037
- keydown: Re,
1058
+ keydown: ze,
1038
1059
  click: (e, t) => {
1039
1060
  let n = t.target instanceof Element ? t.target.closest("a") : null;
1040
- return !n || !e.dom.contains(n) ? !1 : (t.preventDefault(), e.editable && R(e.state, e.posAtDOM(n, 0)), !0);
1061
+ return !n || !e.dom.contains(n) ? !1 : (t.preventDefault(), e.editable && z(e.state, e.posAtDOM(n, 0)), !0);
1041
1062
  }
1042
1063
  }
1043
- }), [z, R]), H = D(() => [...G(Le), se.configure({ placeholder: r })], [r]), W = D(() => F ? U : typeof P == "string" ? P : q(P), [P, F]), K = ae({
1064
+ }), [B, z]), H = M(() => [...de(Re), oe.configure({ placeholder: r })], [r]), se = M(() => D ? q : typeof E == "string" ? E : Y(E), [E, D]), U = ie({
1044
1065
  immediatelyRender: !1,
1045
- editable: !L,
1046
- content: W,
1066
+ editable: !R,
1067
+ content: se,
1047
1068
  extensions: H,
1048
- editorProps: B,
1069
+ editorProps: V,
1049
1070
  onFocus: () => x(!0),
1050
1071
  onBlur: () => x(!1),
1051
1072
  onUpdate: ({ editor: t, transaction: n }) => {
1052
- (!L || n.getMeta("ds-rte-embed-commit")) && (e.format === "json" ? e.onChange?.(V(t.getJSON())) : e.onChange?.(t.getHTML()));
1073
+ (!R || n.getMeta("ds-rte-embed-commit")) && (e.format === "json" ? e.onChange?.(G(t.getJSON())) : e.onChange?.(t.getHTML()));
1053
1074
  }
1054
1075
  });
1055
- T(() => {
1056
- K && (K.setEditable(!L, !1), K.setOptions({ editorProps: B }));
1076
+ A(() => {
1077
+ U && (U.setEditable(!R, !1), U.setOptions({ editorProps: V }));
1057
1078
  }, [
1058
- K,
1059
- L,
1060
- B
1061
- ]), T(() => {
1062
- if (!K || e.value === void 0 || F) return;
1063
- let t = typeof e.value == "string" ? ne(e.value, K.schema) : K.schema.nodeFromJSON(q(e.value));
1064
- t.eq(K.state.doc) || K.commands.setContent(t, { emitUpdate: !1 });
1079
+ U,
1080
+ R,
1081
+ V
1082
+ ]), A(() => {
1083
+ if (!U || e.value === void 0 || D) return;
1084
+ let t = typeof e.value == "string" ? ne(e.value, U.schema) : U.schema.nodeFromJSON(Y(e.value));
1085
+ t.eq(U.state.doc) || U.commands.setContent(t, { emitUpdate: !1 });
1065
1086
  }, [
1066
- K,
1087
+ U,
1067
1088
  e.value,
1068
- F
1089
+ D
1069
1090
  ]);
1070
- let J = oe({
1071
- editor: K,
1091
+ let ce = ae({
1092
+ editor: U,
1072
1093
  selector: ({ editor: e }) => e ? {
1073
1094
  active: Object.fromEntries($.flat().map((t) => [t.id, t.active?.(e) ?? !1])),
1074
1095
  linkActive: e.isActive("link")
1075
1096
  } : null
1076
- }), X = Ne(K, F ? void 0 : e.embeds, L, c), Z = ce({
1077
- editor: K,
1078
- disabled: L,
1079
- isHeld: X.isCreating,
1080
- invalid: !!I,
1097
+ }), W = Pe(U, D ? void 0 : e.embeds, R, c), K = le({
1098
+ editor: U,
1099
+ disabled: R,
1100
+ isHeld: W.isCreating,
1101
+ invalid: !!F,
1081
1102
  label: m ?? c,
1082
1103
  labelledBy: h,
1083
1104
  expandedWidth: a,
1084
1105
  frameRef: v
1085
1106
  });
1086
- return /* @__PURE__ */ M(Y.Provider, {
1087
- value: X.context,
1088
- children: /* @__PURE__ */ N(Ie, {
1107
+ return /* @__PURE__ */ I(Z.Provider, {
1108
+ value: W.context,
1109
+ children: /* @__PURE__ */ L(Le, {
1089
1110
  ref: y,
1090
1111
  scopeRef: v,
1091
1112
  className: l,
1092
- expansion: Z,
1113
+ expansion: K,
1093
1114
  isFocused: b,
1094
- disabled: L,
1095
- invalid: !!I,
1096
- contentError: F,
1097
- errorId: ie,
1098
- surface: /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(Fe, {
1099
- editor: K,
1100
- state: J,
1101
- disabled: L,
1115
+ disabled: R,
1116
+ invalid: !!F,
1117
+ contentError: D,
1118
+ errorId: k,
1119
+ surface: /* @__PURE__ */ L(ee, { children: [/* @__PURE__ */ I(Ie, {
1120
+ editor: U,
1121
+ state: ce,
1122
+ disabled: R,
1102
1123
  label: c,
1103
1124
  toolbarExtra: u,
1104
- openLink: R,
1105
- expandControl: Z.toggle,
1106
- embedControl: X.toolbar
1107
- }), /* @__PURE__ */ M("div", {
1108
- className: "ds-rte__content",
1125
+ openLink: z,
1126
+ expandControl: K.toggle,
1127
+ embedControl: W.toolbar
1128
+ }), /* @__PURE__ */ I("div", {
1129
+ className: "ds-rte__content ds-field-surface",
1109
1130
  "data-size": i,
1110
- children: /* @__PURE__ */ M(ee, { editor: K })
1131
+ children: /* @__PURE__ */ I(te, { editor: U })
1111
1132
  })] }),
1112
- children: [X.dialog, K && S && !L && /* @__PURE__ */ M(Pe, {
1113
- editor: K,
1133
+ children: [W.dialog, U && S && !R && /* @__PURE__ */ I(Fe, {
1134
+ editor: U,
1114
1135
  selection: S,
1115
- onClose: A
1136
+ onClose: w
1116
1137
  })]
1117
1138
  })
1118
1139
  });
1119
1140
  });
1120
1141
  //#endregion
1121
- export { le as n, U as r, ze as t };
1142
+ export { fe as n, q as r, Be as t };
1122
1143
 
1123
- //# sourceMappingURL=RichTextEditor-B0P53GFt.js.map
1144
+ //# sourceMappingURL=RichTextEditor-D8VQAM5h.js.map