@namroodinc/liquid-editorial 0.11.0 → 0.13.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 (260) hide show
  1. package/README.md +44 -20
  2. package/UPGRADING.md +322 -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-Cnyqrc-R.js → Board-BCS7sDXg.js} +13 -5
  8. package/dist/chunks/{Board-Cnyqrc-R.js.map → Board-BCS7sDXg.js.map} +1 -1
  9. package/dist/chunks/{Board-DFuJt2Oh.cjs → Board-CNVy8gHI.cjs} +2 -2
  10. package/dist/chunks/Board-CNVy8gHI.cjs.map +1 -0
  11. package/dist/chunks/CollectionView-CIJdNwcq.cjs +2 -0
  12. package/dist/chunks/CollectionView-CIJdNwcq.cjs.map +1 -0
  13. package/dist/chunks/{CollectionView-Vj84E26b.js → CollectionView-JRNdXHti.js} +5 -5
  14. package/dist/chunks/CollectionView-JRNdXHti.js.map +1 -0
  15. package/dist/chunks/{ColourField-DkO8tjeB.js → ColourField-BTj9NHgI.js} +147 -153
  16. package/dist/chunks/ColourField-BTj9NHgI.js.map +1 -0
  17. package/dist/chunks/ColourField-DuoVeXjG.cjs +2 -0
  18. package/dist/chunks/ColourField-DuoVeXjG.cjs.map +1 -0
  19. package/dist/chunks/DatePicker-BYpGsfL4.cjs +2 -0
  20. package/dist/chunks/DatePicker-BYpGsfL4.cjs.map +1 -0
  21. package/dist/chunks/{DatePicker-B8tllGYy.js → DatePicker-Cb5WspIC.js} +22 -22
  22. package/dist/chunks/DatePicker-Cb5WspIC.js.map +1 -0
  23. package/dist/chunks/{Drawer-DTtgAZO2.js → Drawer-Ck5XKT_V.js} +4 -4
  24. package/dist/chunks/Drawer-Ck5XKT_V.js.map +1 -0
  25. package/dist/chunks/Drawer-DdIH9jpe.cjs +2 -0
  26. package/dist/chunks/Drawer-DdIH9jpe.cjs.map +1 -0
  27. package/dist/chunks/EntryPicker-CCCoJxbd.cjs +2 -0
  28. package/dist/chunks/EntryPicker-CCCoJxbd.cjs.map +1 -0
  29. package/dist/chunks/{EntryPicker-KxHZzZsh.js → EntryPicker-DLCP4S-q.js} +4 -4
  30. package/dist/chunks/EntryPicker-DLCP4S-q.js.map +1 -0
  31. package/dist/chunks/{FormEditor-BJcAIVcL.cjs → FormEditor-ArvjKtJJ.cjs} +2 -2
  32. package/dist/chunks/{FormEditor-BJcAIVcL.cjs.map → FormEditor-ArvjKtJJ.cjs.map} +1 -1
  33. package/dist/chunks/{FormEditor-CdLqPaKK.js → FormEditor-DnNBv9Xf.js} +16 -16
  34. package/dist/chunks/{FormEditor-CdLqPaKK.js.map → FormEditor-DnNBv9Xf.js.map} +1 -1
  35. package/dist/chunks/{Message-CyLq9ef-.js → Message-C73sJfdo.js} +4 -8
  36. package/dist/chunks/{Message-CyLq9ef-.js.map → Message-C73sJfdo.js.map} +1 -1
  37. package/dist/chunks/{Message-D3b8HDhm.cjs → Message-CIKSTXp8.cjs} +2 -2
  38. package/dist/chunks/{Message-D3b8HDhm.cjs.map → Message-CIKSTXp8.cjs.map} +1 -1
  39. package/dist/chunks/RichTextEditor--kMao88d.cjs +2 -0
  40. package/dist/chunks/RichTextEditor--kMao88d.cjs.map +1 -0
  41. package/dist/chunks/{RichTextEditor-DmNM63Wg.js → RichTextEditor-CvbboqJY.js} +397 -380
  42. package/dist/chunks/RichTextEditor-CvbboqJY.js.map +1 -0
  43. package/dist/chunks/{dialogLabel-D18maX-p.js → dialogLabel-DT7rCr3_.js} +19 -19
  44. package/dist/chunks/{dialogLabel-D18maX-p.js.map → dialogLabel-DT7rCr3_.js.map} +1 -1
  45. package/dist/chunks/{dialogLabel-2HRYMHbF.cjs → dialogLabel-_-MTckE_.cjs} +2 -2
  46. package/dist/chunks/{dialogLabel-2HRYMHbF.cjs.map → dialogLabel-_-MTckE_.cjs.map} +1 -1
  47. package/dist/chunks/overlayLayer-iGhuAByk.cjs +2 -0
  48. package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +1 -0
  49. package/dist/chunks/{overlayLayer-IuoPVwTO.js → overlayLayer-lU4iWSjO.js} +32 -28
  50. package/dist/chunks/overlayLayer-lU4iWSjO.js.map +1 -0
  51. package/dist/chunks/{group-7Z_xRlQx.js → style-7Z_xRlQx.js} +1 -1
  52. package/dist/chunks/{group-7Z_xRlQx.js.map → style-7Z_xRlQx.js.map} +1 -1
  53. package/dist/chunks/{group-nulIa2_8.cjs → style-nulIa2_8.cjs} +1 -1
  54. package/dist/chunks/{group-nulIa2_8.cjs.map → style-nulIa2_8.cjs.map} +1 -1
  55. package/dist/chunks/use-picker-session-Bue5MJHQ.cjs +2 -0
  56. package/dist/chunks/use-picker-session-Bue5MJHQ.cjs.map +1 -0
  57. package/dist/chunks/{use-picker-session-BDEWL2jK.js → use-picker-session-DUO4G8Cs.js} +4 -4
  58. package/dist/chunks/use-picker-session-DUO4G8Cs.js.map +1 -0
  59. package/dist/chunks/{useTooltip-BXAvQwt4.cjs → useTooltip-C7ON4nkV.cjs} +2 -2
  60. package/dist/chunks/{useTooltip-BXAvQwt4.cjs.map → useTooltip-C7ON4nkV.cjs.map} +1 -1
  61. package/dist/chunks/{useTooltip-BrC7FdeH.js → useTooltip-DnJEFBLg.js} +2 -2
  62. package/dist/chunks/{useTooltip-BrC7FdeH.js.map → useTooltip-DnJEFBLg.js.map} +1 -1
  63. package/dist/components/AppShell/index.cjs +1 -1
  64. package/dist/components/AppShell/index.js +1 -1
  65. package/dist/components/AssetCard/index.cjs +1 -1
  66. package/dist/components/AssetCard/index.cjs.map +1 -1
  67. package/dist/components/AssetCard/index.d.cts.map +1 -1
  68. package/dist/components/AssetCard/index.d.ts.map +1 -1
  69. package/dist/components/AssetCard/index.js +16 -16
  70. package/dist/components/AssetCard/index.js.map +1 -1
  71. package/dist/components/AssetCard/style.css +47 -46
  72. package/dist/components/AssetGrid/index.cjs +1 -1
  73. package/dist/components/AssetGrid/index.cjs.map +1 -1
  74. package/dist/components/AssetGrid/index.d.cts +0 -2
  75. package/dist/components/AssetGrid/index.d.cts.map +1 -1
  76. package/dist/components/AssetGrid/index.d.ts +0 -2
  77. package/dist/components/AssetGrid/index.d.ts.map +1 -1
  78. package/dist/components/AssetGrid/index.js +15 -15
  79. package/dist/components/AssetGrid/index.js.map +1 -1
  80. package/dist/components/Avatar/index.cjs +1 -1
  81. package/dist/components/Avatar/index.js +1 -1
  82. package/dist/components/Avatar/style.css +26 -5
  83. package/dist/components/Badge/index.cjs +1 -1
  84. package/dist/components/Badge/index.cjs.map +1 -1
  85. package/dist/components/Badge/index.d.cts +2 -3
  86. package/dist/components/Badge/index.d.cts.map +1 -1
  87. package/dist/components/Badge/index.d.ts +2 -3
  88. package/dist/components/Badge/index.d.ts.map +1 -1
  89. package/dist/components/Badge/index.js +1 -1
  90. package/dist/components/Badge/index.js.map +1 -1
  91. package/dist/components/Badge/style.css +29 -35
  92. package/dist/components/Banner/index.cjs +1 -1
  93. package/dist/components/Banner/index.js +1 -1
  94. package/dist/components/Board/index.cjs +1 -1
  95. package/dist/components/Board/index.js +1 -1
  96. package/dist/components/Board/style.css +37 -16
  97. package/dist/components/Button/style.css +17 -12
  98. package/dist/components/ButtonGroup/index.cjs.map +1 -1
  99. package/dist/components/ButtonGroup/index.d.cts +1 -1
  100. package/dist/components/ButtonGroup/index.d.ts +1 -1
  101. package/dist/components/ButtonGroup/index.js.map +1 -1
  102. package/dist/components/ButtonGroup/style.css +4 -20
  103. package/dist/components/Choice/index.cjs +1 -1
  104. package/dist/components/Choice/index.cjs.map +1 -1
  105. package/dist/components/Choice/index.js +3 -3
  106. package/dist/components/Choice/index.js.map +1 -1
  107. package/dist/components/Choice/style.css +34 -22
  108. package/dist/components/CollectionView/index.cjs +1 -1
  109. package/dist/components/CollectionView/index.js +1 -1
  110. package/dist/components/CollectionView/style.css +8 -11
  111. package/dist/components/ColourField/index.cjs +1 -1
  112. package/dist/components/ColourField/index.d.cts.map +1 -1
  113. package/dist/components/ColourField/index.d.ts.map +1 -1
  114. package/dist/components/ColourField/index.js +1 -1
  115. package/dist/components/ColourField/style.css +31 -20
  116. package/dist/components/DatePicker/index.cjs +1 -1
  117. package/dist/components/DatePicker/index.js +1 -1
  118. package/dist/components/DatePicker/style.css +10 -3
  119. package/dist/components/Drawer/index.cjs +1 -1
  120. package/dist/components/Drawer/index.js +1 -1
  121. package/dist/components/Drawer/style.css +10 -23
  122. package/dist/components/EditLayout/index.cjs +1 -1
  123. package/dist/components/EditLayout/index.cjs.map +1 -1
  124. package/dist/components/EditLayout/index.js +4 -4
  125. package/dist/components/EditLayout/index.js.map +1 -1
  126. package/dist/components/EditLayout/style.css +5 -6
  127. package/dist/components/EntryPicker/index.cjs +1 -1
  128. package/dist/components/EntryPicker/index.js +1 -1
  129. package/dist/components/EntryPicker/style.css +46 -20
  130. package/dist/components/Field/style.css +6 -5
  131. package/dist/components/FormEditor/README.md +28 -19
  132. package/dist/components/FormEditor/index.cjs +1 -1
  133. package/dist/components/FormEditor/index.js +1 -1
  134. package/dist/components/FormEditor/style.css +1 -0
  135. package/dist/components/ImageCropper/style.css +20 -20
  136. package/dist/components/LimitReading/style.css +1 -1
  137. package/dist/components/Menu/index.cjs +1 -1
  138. package/dist/components/Menu/index.js +1 -1
  139. package/dist/components/Menu/style.css +3 -3
  140. package/dist/components/Modal/index.cjs +1 -1
  141. package/dist/components/Modal/index.cjs.map +1 -1
  142. package/dist/components/Modal/index.js +3 -3
  143. package/dist/components/Modal/index.js.map +1 -1
  144. package/dist/components/Modal/style.css +6 -6
  145. package/dist/components/Popover/index.cjs +1 -1
  146. package/dist/components/Popover/index.cjs.map +1 -1
  147. package/dist/components/Popover/index.d.cts.map +1 -1
  148. package/dist/components/Popover/index.d.ts.map +1 -1
  149. package/dist/components/Popover/index.js +58 -55
  150. package/dist/components/Popover/index.js.map +1 -1
  151. package/dist/components/Popover/style.css +2 -2
  152. package/dist/components/RichTextEditor/index.cjs +1 -1
  153. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  154. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  155. package/dist/components/RichTextEditor/index.js +1 -1
  156. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
  157. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
  158. package/dist/components/RichTextEditor/style.css +123 -75
  159. package/dist/components/Select/index.cjs +1 -1
  160. package/dist/components/Select/index.js +1 -1
  161. package/dist/components/SelectionCard/index.cjs +1 -1
  162. package/dist/components/SelectionCard/index.cjs.map +1 -1
  163. package/dist/components/SelectionCard/index.d.cts.map +1 -1
  164. package/dist/components/SelectionCard/index.d.ts.map +1 -1
  165. package/dist/components/SelectionCard/index.js +7 -3
  166. package/dist/components/SelectionCard/index.js.map +1 -1
  167. package/dist/components/SelectionCard/style.css +30 -48
  168. package/dist/components/SideNav/index.cjs +1 -1
  169. package/dist/components/SideNav/index.cjs.map +1 -1
  170. package/dist/components/SideNav/index.d.cts +3 -3
  171. package/dist/components/SideNav/index.d.ts +3 -3
  172. package/dist/components/SideNav/index.js +15 -3
  173. package/dist/components/SideNav/index.js.map +1 -1
  174. package/dist/components/SideNav/style.css +19 -13
  175. package/dist/components/Skeleton/style.css +1 -1
  176. package/dist/components/Slider/style.css +19 -32
  177. package/dist/components/SortableList/index.cjs +1 -1
  178. package/dist/components/SortableList/index.cjs.map +1 -1
  179. package/dist/components/SortableList/index.js +6 -2
  180. package/dist/components/SortableList/index.js.map +1 -1
  181. package/dist/components/SortableList/style.css +20 -5
  182. package/dist/components/Stepper/style.css +8 -9
  183. package/dist/components/SubNav/index.cjs.map +1 -1
  184. package/dist/components/SubNav/index.d.cts +2 -2
  185. package/dist/components/SubNav/index.d.ts +2 -2
  186. package/dist/components/SubNav/index.js.map +1 -1
  187. package/dist/components/SubNav/style.css +3 -8
  188. package/dist/components/Switch/index.cjs +1 -1
  189. package/dist/components/Switch/index.cjs.map +1 -1
  190. package/dist/components/Switch/index.d.cts.map +1 -1
  191. package/dist/components/Switch/index.d.ts.map +1 -1
  192. package/dist/components/Switch/index.js +3 -2
  193. package/dist/components/Switch/index.js.map +1 -1
  194. package/dist/components/Switch/style.css +26 -6
  195. package/dist/components/Table/index.cjs +1 -1
  196. package/dist/components/Table/index.cjs.map +1 -1
  197. package/dist/components/Table/index.js +2 -2
  198. package/dist/components/Table/index.js.map +1 -1
  199. package/dist/components/Table/style.css +34 -22
  200. package/dist/components/TagsInput/index.cjs +1 -1
  201. package/dist/components/TagsInput/index.cjs.map +1 -1
  202. package/dist/components/TagsInput/index.js +1 -1
  203. package/dist/components/TagsInput/index.js.map +1 -1
  204. package/dist/components/TagsInput/style.css +12 -5
  205. package/dist/components/Time/index.cjs +1 -1
  206. package/dist/components/Time/index.js +1 -1
  207. package/dist/components/Time/style.css +1 -1
  208. package/dist/components/Toast/index.cjs +1 -1
  209. package/dist/components/Toast/index.js +1 -1
  210. package/dist/components/Toast/style.css +1 -1
  211. package/dist/components/TopNav/index.cjs +1 -1
  212. package/dist/components/TopNav/index.cjs.map +1 -1
  213. package/dist/components/TopNav/index.d.cts +4 -4
  214. package/dist/components/TopNav/index.d.ts +4 -4
  215. package/dist/components/TopNav/index.js +5 -1
  216. package/dist/components/TopNav/index.js.map +1 -1
  217. package/dist/components/TopNav/style.css +6 -9
  218. package/dist/elements.css +2 -2
  219. package/dist/index.cjs +1 -1
  220. package/dist/index.d.cts +2 -2
  221. package/dist/index.d.cts.map +1 -1
  222. package/dist/index.d.ts +2 -2
  223. package/dist/index.d.ts.map +1 -1
  224. package/dist/index.js +44 -44
  225. package/dist/internal/dialogFocus.d.cts +2 -0
  226. package/dist/internal/dialogFocus.d.cts.map +1 -1
  227. package/dist/internal/dialogFocus.d.ts +2 -0
  228. package/dist/internal/dialogFocus.d.ts.map +1 -1
  229. package/dist/message.css +13 -17
  230. package/dist/tokens.css +112 -280
  231. package/package.json +1 -1
  232. package/dist/chunks/Board-DFuJt2Oh.cjs.map +0 -1
  233. package/dist/chunks/CollectionView-BNYx29b1.cjs +0 -2
  234. package/dist/chunks/CollectionView-BNYx29b1.cjs.map +0 -1
  235. package/dist/chunks/CollectionView-Vj84E26b.js.map +0 -1
  236. package/dist/chunks/ColourField--rS9KDpq.cjs +0 -2
  237. package/dist/chunks/ColourField--rS9KDpq.cjs.map +0 -1
  238. package/dist/chunks/ColourField-DkO8tjeB.js.map +0 -1
  239. package/dist/chunks/DatePicker-B8tllGYy.js.map +0 -1
  240. package/dist/chunks/DatePicker-OiqjoO-f.cjs +0 -2
  241. package/dist/chunks/DatePicker-OiqjoO-f.cjs.map +0 -1
  242. package/dist/chunks/Drawer-BDX9_qHA.cjs +0 -2
  243. package/dist/chunks/Drawer-BDX9_qHA.cjs.map +0 -1
  244. package/dist/chunks/Drawer-DTtgAZO2.js.map +0 -1
  245. package/dist/chunks/EntryPicker-BI_7g2Wg.cjs +0 -2
  246. package/dist/chunks/EntryPicker-BI_7g2Wg.cjs.map +0 -1
  247. package/dist/chunks/EntryPicker-KxHZzZsh.js.map +0 -1
  248. package/dist/chunks/RichTextEditor-BXyhSeJd.cjs +0 -2
  249. package/dist/chunks/RichTextEditor-BXyhSeJd.cjs.map +0 -1
  250. package/dist/chunks/RichTextEditor-DmNM63Wg.js.map +0 -1
  251. package/dist/chunks/overlayLayer-IuoPVwTO.js.map +0 -1
  252. package/dist/chunks/overlayLayer-seJG-EFn.cjs +0 -2
  253. package/dist/chunks/overlayLayer-seJG-EFn.cjs.map +0 -1
  254. package/dist/chunks/use-picker-session-BDEWL2jK.js.map +0 -1
  255. package/dist/chunks/use-picker-session-C4FGinLN.cjs +0 -2
  256. package/dist/chunks/use-picker-session-C4FGinLN.cjs.map +0 -1
  257. package/dist/components/ColourField/focus.d.cts +0 -3
  258. package/dist/components/ColourField/focus.d.cts.map +0 -1
  259. package/dist/components/ColourField/focus.d.ts +0 -3
  260. package/dist/components/ColourField/focus.d.ts.map +0 -1
@@ -1,90 +1,92 @@
1
1
  import { t as e } from "./Icon-CYXOo0Kt.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-BDEWL2jK.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-DUO4G8Cs.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,168 @@ 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", {
327
- className: "ds-storyblock__bar",
328
- role: "toolbar",
329
- "aria-label": `Block actions for ${n}`,
330
- ...h,
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", {
296
+ className: "ds-storyblock__bar ds-field-surface",
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 ? "active" : "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__ */ I("div", {
347
+ className: "ds-storyblock__popover-label",
348
+ children: "Alignment"
349
+ }),
350
+ /* @__PURE__ */ I(p, {
351
+ className: "ds-storyblock__alignment",
352
+ "aria-label": "Alignment",
353
+ children: me.map((e) => /* @__PURE__ */ I(t, {
354
+ size: "sm",
355
+ iconStart: e.icon,
356
+ "aria-pressed": r === e.align,
357
+ variant: r === e.align ? "primary" : "neutral",
358
+ onClick: () => m(e.align),
359
+ children: e.label
360
+ }, e.align))
361
+ }),
362
+ d && /* @__PURE__ */ L(t, {
363
+ className: "ds-storyblock__action",
364
+ variant: "simple",
365
+ size: "sm",
366
+ iconStart: "pencil",
367
+ onClick: () => {
368
+ O(), d();
369
+ },
370
+ children: ["Edit ", e]
371
+ }),
372
+ u.isShown && /* @__PURE__ */ I(t, {
373
+ className: "ds-storyblock__action",
374
+ variant: "simple",
375
+ size: "sm",
376
+ iconStart: "rotate-cw",
377
+ isDisabled: !u.isEnabled,
378
+ onClick: () => {
379
+ O(), h();
380
+ },
381
+ children: l ? `Choose another ${e}…` : "Replace…"
382
+ }),
383
+ /* @__PURE__ */ I(y, {}),
384
+ /* @__PURE__ */ I(t, {
385
+ className: "ds-storyblock__action",
386
+ variant: "danger",
387
+ size: "sm",
388
+ iconStart: "trash",
389
+ onClick: () => {
390
+ b(!1), g();
391
+ },
392
+ children: "Remove from field"
393
+ })
394
+ ]
395
+ })
384
396
  })
385
397
  ]
386
398
  });
387
399
  }
388
- function _e({ kind: e, id: t, item: n, missing: r }) {
389
- return /* @__PURE__ */ M("div", {
400
+ function ve({ kind: e, id: t, item: n, missing: r }) {
401
+ return /* @__PURE__ */ I("div", {
390
402
  className: "ds-entry ds-storyblock__body",
391
- children: r ? /* @__PURE__ */ N("span", {
403
+ children: r ? /* @__PURE__ */ L("span", {
392
404
  className: "ds-entry__body",
393
- children: [/* @__PURE__ */ M("em", {
405
+ children: [/* @__PURE__ */ I("em", {
394
406
  className: "ds-entry__title",
395
407
  children: `Unavailable ${e}`
396
- }), /* @__PURE__ */ N("span", {
408
+ }), /* @__PURE__ */ L("span", {
397
409
  className: "ds-entry__meta",
398
- children: [/* @__PURE__ */ M("span", { children: `This ${e} was deleted. Replace or remove it.` }), /* @__PURE__ */ M("code", { children: t })]
410
+ children: [/* @__PURE__ */ I("span", { children: `This ${e} was deleted. Replace or remove it.` }), /* @__PURE__ */ I("code", { children: t })]
399
411
  })]
400
- }) : /* @__PURE__ */ M(_, { item: n })
412
+ }) : /* @__PURE__ */ I(S, { item: n })
401
413
  });
402
414
  }
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, _ = () => {
415
+ function ye({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i }) {
416
+ 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
417
  let e = r();
406
418
  e !== void 0 && n.chain().focus().setNodeSelection(e).run();
407
419
  };
408
- return /* @__PURE__ */ N(P, {
409
- className: "ds-storyblock",
420
+ return /* @__PURE__ */ L(z, {
421
+ className: "ds-storyblock ds-field-surface",
410
422
  "data-align": m,
411
423
  "data-selected": g || void 0,
412
424
  "data-missing": f || void 0,
413
425
  "data-tone": f ? "removed" : d.tone,
414
426
  contentEditable: !1,
415
427
  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(), _());
428
+ let t = e.target;
429
+ t instanceof Element && e.currentTarget.contains(t) && (t.closest("button") ? e.preventDefault() : !a && !t.closest("[data-drag-handle]") && (e.preventDefault(), _()));
418
430
  },
419
431
  children: [
420
- a ? /* @__PURE__ */ M("div", {
421
- className: "ds-storyblock__bar",
422
- children: /* @__PURE__ */ M(he, {
432
+ a ? /* @__PURE__ */ I("div", {
433
+ className: "ds-storyblock__bar ds-field-surface",
434
+ children: /* @__PURE__ */ I(ge, {
423
435
  kind: c,
424
436
  isMovable: !1
425
437
  })
426
- }) : /* @__PURE__ */ M(ge, {
438
+ }) : /* @__PURE__ */ I(_e, {
427
439
  kind: c,
428
440
  name: f ? `Unavailable ${c}` : d.title,
429
441
  align: m,
442
+ missing: f,
430
443
  isSelected: g,
431
444
  isLocked: !!u?.isDialogHidden,
432
445
  canReplace: {
@@ -448,13 +461,13 @@ function ve({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i })
448
461
  }).run();
449
462
  }
450
463
  }),
451
- /* @__PURE__ */ M(_e, {
464
+ /* @__PURE__ */ I(ve, {
452
465
  kind: c,
453
466
  id: l,
454
467
  item: d,
455
468
  missing: f
456
469
  }),
457
- p && /* @__PURE__ */ M("div", {
470
+ p && /* @__PURE__ */ I("div", {
458
471
  className: "ds-storyblock__failure",
459
472
  children: p
460
473
  })
@@ -463,7 +476,7 @@ function ve({ node: e, selected: t, editor: n, getPos: r, updateAttributes: i })
463
476
  }
464
477
  //#endregion
465
478
  //#region src/components/RichTextEditor/use-embeds.tsx
466
- var ye = "ds-rte-embed-commit", be = ["entry", "asset"], xe = {
479
+ var be = "ds-rte-embed-commit", xe = ["entry", "asset"], Se = {
467
480
  entry: {
468
481
  itemLabel: "entry",
469
482
  itemsLabel: "entries"
@@ -472,8 +485,8 @@ var ye = "ds-rte-embed-commit", be = ["entry", "asset"], xe = {
472
485
  itemLabel: "asset",
473
486
  itemsLabel: "assets"
474
487
  }
475
- }, Se = {}, Ce = [];
476
- function we(e, t, n) {
488
+ }, Ce = {}, we = [];
489
+ function Q(e, t, n) {
477
490
  return {
478
491
  type: e,
479
492
  align: t,
@@ -483,29 +496,29 @@ function we(e, t, n) {
483
496
  } : { assetId: n.id }
484
497
  };
485
498
  }
486
- function Q(e, t) {
499
+ function Te(e, t) {
487
500
  if (t.tone === "removed") return {
488
501
  label: t.removedLabel ?? "Removed",
489
502
  description: `This ${e} was removed.`
490
503
  };
491
- if (!B(we(e, "full", t))) return {
504
+ if (!W(Q(e, "full", t))) return {
492
505
  label: "Can't embed",
493
506
  description: `This ${e} has no ${e === "entry" && !t.modelId?.trim() ? "model API ID" : "ID"}.`
494
507
  };
495
508
  }
496
- var Te = {
497
- entry: (e) => Q("entry", e),
498
- asset: (e) => Q("asset", e)
509
+ var Ee = {
510
+ entry: (e) => Te("entry", e),
511
+ asset: (e) => Te("asset", e)
499
512
  };
500
- function Ee(e, t) {
513
+ function De(e, t) {
501
514
  return e?.type.name === "storyblock" && e.attrs.type === t.kind && String(t.kind === "entry" ? e.attrs.entryId : e.attrs.assetId) === t.replaceId;
502
515
  }
503
- function De(e) {
516
+ function Oe(e) {
504
517
  return e.flatMap((e) => e.mapping.maps);
505
518
  }
506
- function Oe(e, t) {
519
+ function ke(e, t) {
507
520
  let n = t;
508
- for (let t of De(e)) {
521
+ for (let t of Oe(e)) {
509
522
  let e = n, r;
510
523
  if (t.forEach((t, n, i, a) => {
511
524
  r === void 0 && t <= e && e < n && n - t === a - i && (r = i + (e - t));
@@ -519,9 +532,9 @@ function Oe(e, t) {
519
532
  }
520
533
  return n;
521
534
  }
522
- function ke(e, t, n) {
535
+ function Ae(e, t, n) {
523
536
  let r = t, i = n;
524
- for (let t of De(e)) {
537
+ for (let t of Oe(e)) {
525
538
  if (r === i) {
526
539
  r = i = t.map(i, -1);
527
540
  continue;
@@ -537,13 +550,13 @@ function ke(e, t, n) {
537
550
  to: i
538
551
  };
539
552
  }
540
- function Ae(e, t) {
553
+ function je(e, t) {
541
554
  let n = e.resolve(Math.min(t, e.content.size));
542
555
  return n.depth ? n.after(1) : n.pos;
543
556
  }
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 ? {
557
+ function Me(e, t, n) {
558
+ let r = e !== void 0, i = !!e?.resolveItem, a = !!e?.onEditItem, o = e?.refreshKey, s = e?.items, c = !!e?.isDialogHidden, l = X(e);
559
+ return M(() => r ? {
547
560
  resolveItem: i ? t : void 0,
548
561
  refreshKey: o,
549
562
  items: s,
@@ -562,8 +575,8 @@ function je(e, t, n) {
562
575
  n
563
576
  ]);
564
577
  }
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, {
578
+ function Ne({ session: e, source: t, disabled: n, label: r, close: i, target: a, pick: o }) {
579
+ let { itemLabel: s, itemsLabel: c } = Se[e.kind], l = M(() => e.replaceId ? [e.replaceId] : [], [e]), u = T(l, t.items ?? we, {
567
580
  ...t,
568
581
  resolveItem: void 0,
569
582
  mode: "single"
@@ -573,9 +586,9 @@ function Me({ session: e, source: t, disabled: n, label: r, close: i, target: a,
573
586
  itemLabel: s,
574
587
  itemsLabel: c,
575
588
  close: i,
576
- restrict: Te[e.kind]
589
+ restrict: Ee[e.kind]
577
590
  }), d = e.replaceId ? "Replace" : "Embed";
578
- return /* @__PURE__ */ M(g, {
591
+ return /* @__PURE__ */ I(x, {
579
592
  ...u.dialog,
580
593
  isOpen: !0,
581
594
  onClose: i,
@@ -591,42 +604,42 @@ function Me({ session: e, source: t, disabled: n, label: r, close: i, target: a,
591
604
  isDialogHidden: t.isDialogHidden
592
605
  });
593
606
  }
594
- function Ne(e, n = Se, r, i) {
595
- let [a, s] = k(null), c = O(0), l = O({
607
+ function Pe(e, n = Ce, r, i) {
608
+ let [a, o] = P(null), s = N(0), c = N({
596
609
  session: null,
597
610
  from: 0,
598
611
  to: 0,
599
612
  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({
613
+ }), u = N(/* @__PURE__ */ new Map()), [d, f] = P(0), m = O(() => {
614
+ c.current.alive = !1, o(null);
615
+ }, []), h = a ? n[a.kind] : void 0, g = a && X(h) && (!r || h?.isCreating) ? a : null;
616
+ a && !g && o(null);
617
+ let _ = !!(g && (h?.isDialogHidden || h?.isCreating)), v = l({
605
618
  editor: e,
606
619
  sources: n,
607
620
  disabled: r,
608
621
  busy: _
609
622
  });
610
- T(() => {
623
+ A(() => {
611
624
  if (!e || !a) return;
612
- l.current.alive = !0;
625
+ c.current.alive = !0;
613
626
  let t = ({ editor: e, transaction: t, appendedTransactions: n }) => {
614
627
  let r = [t, ...n];
615
- if (!l.current.alive || !r.some((e) => e.docChanged)) return;
616
- let { from: i, to: o } = l.current;
628
+ if (!c.current.alive || !r.some((e) => e.docChanged)) return;
629
+ let { from: i, to: o } = c.current;
617
630
  if (a.replaceId === void 0) {
618
- let e = ke(r, i, o);
619
- e ? Object.assign(l.current, e) : m();
631
+ let e = Ae(r, i, o);
632
+ e ? Object.assign(c.current, e) : m();
620
633
  return;
621
634
  }
622
- let s = Oe(r, i);
623
- s === null || !Ee(e.state.doc.nodeAt(s), a) ? m() : Object.assign(l.current, {
635
+ let s = ke(r, i);
636
+ s === null || !De(e.state.doc.nodeAt(s), a) ? m() : Object.assign(c.current, {
624
637
  from: s,
625
638
  to: s + 1
626
639
  });
627
640
  };
628
641
  return e.on("transaction", t), () => {
629
- e.off("transaction", t), l.current.session === a && (l.current.alive = !1);
642
+ e.off("transaction", t), c.current.session === a && (c.current.alive = !1);
630
643
  };
631
644
  }, [
632
645
  e,
@@ -635,41 +648,41 @@ function Ne(e, n = Se, r, i) {
635
648
  ]);
636
649
  let y = (e) => {
637
650
  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);
651
+ return !(!t || t.isDestroyed || c.current.session !== e || !c.current.alive || !X(i) || r && !i?.isCreating);
639
652
  }, b = (e, t, n) => {
640
653
  let r = v.current.editor;
641
654
  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, {
655
+ let { doc: i } = r.state, a = e.replaceId !== void 0, o = a ? i.nodeAt(c.current.from) : null;
656
+ if (a && !De(o, e)) return !1;
657
+ let s = Q(e.kind, o?.attrs.align ?? "full", t);
658
+ if (!W(s)) return !1;
659
+ let l = a ? c.current.from : je(i, c.current.to), d = `${e.kind}:${t.id}`;
660
+ c.current.alive = !1, u.current = /* @__PURE__ */ new Map([[d, {
648
661
  item: t,
649
662
  revision: n
650
663
  }]]);
651
- let f = !1;
664
+ let p = !1;
652
665
  try {
653
- let e = r.chain().focus().setMeta(ye, !0);
654
- f = a ? e.setNodeSelection(c).updateAttributes("storyblock", s).run() : e.insertContentAt(c, {
666
+ let e = r.chain().focus().setMeta(be, !0);
667
+ p = a ? e.setNodeSelection(l).updateAttributes("storyblock", s).run() : e.insertContentAt(l, {
655
668
  type: "storyblock",
656
669
  attrs: s
657
- }).setNodeSelection(c).run();
670
+ }).setNodeSelection(l).run();
658
671
  } catch {
659
- f = !1;
672
+ p = !1;
660
673
  } finally {
661
674
  m();
662
675
  }
663
- return f ? p((e) => e + 1) : d.current.delete(u), f;
676
+ return p ? f((e) => e + 1) : u.current.delete(d), p;
664
677
  }, x = (e, t) => {
665
678
  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;
679
+ if (!n || i || a || !X(r[e])) return;
680
+ let l = t === void 0 ? null : n.state.doc.nodeAt(t);
681
+ if (t !== void 0 && (l?.type.name !== "storyblock" || l.attrs.type !== e)) return;
669
682
  let { $from: u, from: d, to: f } = n.state.selection, p = {
670
- id: c.current += 1,
683
+ id: s.current += 1,
671
684
  kind: e,
672
- replaceId: o ? String(e === "entry" ? o.attrs.entryId : o.attrs.assetId) : void 0
685
+ replaceId: l ? String(e === "entry" ? l.attrs.entryId : l.attrs.assetId) : void 0
673
686
  }, m = t === void 0 ? u.depth ? {
674
687
  from: u.before(1),
675
688
  to: u.after(1)
@@ -680,16 +693,16 @@ function Ne(e, n = Se, r, i) {
680
693
  from: t,
681
694
  to: t + 1
682
695
  };
683
- l.current = {
696
+ c.current = {
684
697
  session: p,
685
698
  ...m,
686
699
  alive: !0
687
- }, s(p);
688
- }, S = o({ open: x }), [w] = k(() => ({
700
+ }, o(p);
701
+ }, S = l({ open: x }), [C] = P(() => ({
689
702
  replace: (e, t) => S.current.open(e, t),
690
- seed: (e, t) => d.current.get(`${e}:${t}`),
703
+ seed: (e, t) => u.current.get(`${e}:${t}`),
691
704
  forgetSeed: (e, t, n) => {
692
- d.current.get(`${e}:${t}`) === n && d.current.delete(`${e}:${t}`);
705
+ u.current.get(`${e}:${t}`) === n && u.current.delete(`${e}:${t}`);
693
706
  },
694
707
  resolve: {
695
708
  entry: (e) => v.current.sources.entry?.resolveItem?.(e) ?? null,
@@ -703,43 +716,43 @@ function Ne(e, n = Se, r, i) {
703
716
  v.current.sources.asset?.onEditItem?.(e);
704
717
  }
705
718
  }
706
- })), E = je(n.entry, w.resolve.entry, w.edit.entry), A = je(n.asset, w.resolve.asset, w.edit.asset), j = D(() => ({
719
+ })), w = Me(n.entry, C.resolve.entry, C.edit.entry), T = Me(n.asset, C.resolve.asset, C.edit.asset), E = M(() => ({
707
720
  views: {
708
- entry: E,
709
- asset: A
721
+ entry: w,
722
+ asset: T
710
723
  },
711
724
  disabled: r,
712
725
  busy: _,
713
- pickCount: f,
714
- replace: w.replace,
715
- seed: w.seed,
716
- forgetSeed: w.forgetSeed
726
+ pickCount: d,
727
+ replace: C.replace,
728
+ seed: C.seed,
729
+ forgetSeed: C.forgetSeed
717
730
  }), [
718
- E,
719
- A,
731
+ w,
732
+ T,
720
733
  r,
721
734
  _,
722
- f,
723
- w
724
- ]), N = be.filter((e) => J(n[e]));
735
+ d,
736
+ C
737
+ ]), D = xe.filter((e) => X(n[e]));
725
738
  return {
726
- context: j,
727
- isCreating: be.some((e) => n[e]?.isCreating),
728
- toolbar: N.length > 0 && /* @__PURE__ */ M(u, {
739
+ context: E,
740
+ isCreating: xe.some((e) => n[e]?.isCreating),
741
+ toolbar: D.length > 0 && /* @__PURE__ */ I(p, {
729
742
  "aria-label": "Embed",
730
- children: N.map((n) => /* @__PURE__ */ M(t, {
743
+ children: D.map((n) => /* @__PURE__ */ I(t, {
731
744
  size: "sm",
732
745
  isIconOnly: !0,
733
746
  iconStart: n === "entry" ? "file-text" : "image",
734
747
  "aria-label": `Embed ${n}`,
735
748
  title: `Embed ${n}`,
736
749
  "aria-pressed": g?.kind === n,
737
- variant: g?.kind === n ? "active" : "neutral",
750
+ variant: g?.kind === n ? "primary" : "neutral",
738
751
  isDisabled: r || _ || !e,
739
752
  onClick: () => x(n)
740
753
  }, n))
741
754
  }),
742
- dialog: e && g && h && /* @__PURE__ */ M(Me, {
755
+ dialog: e && g && h && /* @__PURE__ */ I(Ne, {
743
756
  session: g,
744
757
  source: h,
745
758
  disabled: r,
@@ -755,9 +768,9 @@ function Ne(e, n = Se, r, i) {
755
768
  }
756
769
  //#endregion
757
770
  //#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(() => {
771
+ function Fe({ editor: e, selection: n, onClose: r }) {
772
+ let [i, a] = P(n.href), [o, s] = P(), c = j();
773
+ A(() => {
761
774
  let t = () => {
762
775
  e.state.doc.eq(n.document) || r();
763
776
  };
@@ -792,13 +805,13 @@ function Pe({ editor: e, selection: n, onClose: r }) {
792
805
  }]
793
806
  }).run() : a.setLink({ href: t }).run(), r();
794
807
  };
795
- return /* @__PURE__ */ M(p, {
808
+ return /* @__PURE__ */ I(g, {
796
809
  isOpen: !0,
797
810
  title: n.isEditing ? "Edit link" : "Add link",
798
811
  size: "dialog",
799
812
  onClose: r,
800
- footer: /* @__PURE__ */ N(j, { children: [
801
- n.isEditing && /* @__PURE__ */ M(t, {
813
+ footer: /* @__PURE__ */ L(ee, { children: [
814
+ n.isEditing && /* @__PURE__ */ I(t, {
802
815
  variant: "danger",
803
816
  onClick: () => {
804
817
  l() && e.chain().focus().setTextSelection({
@@ -808,28 +821,28 @@ function Pe({ editor: e, selection: n, onClose: r }) {
808
821
  },
809
822
  children: "Remove link"
810
823
  }),
811
- /* @__PURE__ */ M(t, {
824
+ /* @__PURE__ */ I(t, {
812
825
  onClick: r,
813
826
  children: "Cancel"
814
827
  }),
815
- /* @__PURE__ */ M(t, {
828
+ /* @__PURE__ */ I(t, {
816
829
  variant: "primary",
817
830
  type: "submit",
818
831
  form: c,
819
832
  children: "Save"
820
833
  })
821
834
  ] }),
822
- children: /* @__PURE__ */ M("form", {
835
+ children: /* @__PURE__ */ I("form", {
823
836
  id: c,
824
837
  noValidate: !0,
825
838
  onSubmit: (e) => {
826
839
  e.preventDefault(), e.stopPropagation(), u();
827
840
  },
828
- children: /* @__PURE__ */ M(f, {
841
+ children: /* @__PURE__ */ I(h, {
829
842
  label: "URL",
830
843
  isRequired: !0,
831
844
  error: o,
832
- children: (e) => /* @__PURE__ */ M(m, {
845
+ children: (e) => /* @__PURE__ */ I(_, {
833
846
  ...e,
834
847
  value: i,
835
848
  inputMode: "url",
@@ -922,35 +935,35 @@ var $ = [
922
935
  run: (e) => e.chain().focus().redo().run()
923
936
  }]
924
937
  ];
925
- function Fe({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openLink: o, expandControl: s, embedControl: c }) {
926
- return /* @__PURE__ */ N("div", {
927
- className: "ds-rte__toolbar",
938
+ function Ie({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openLink: o, expandControl: s, embedControl: c }) {
939
+ return /* @__PURE__ */ L("div", {
940
+ className: "ds-rte__toolbar ds-field-surface",
928
941
  role: "toolbar",
929
942
  "aria-label": `${i} formatting`,
930
943
  children: [
931
- $.map((i, a) => /* @__PURE__ */ M(u, {
944
+ $.map((i, a) => /* @__PURE__ */ I(p, {
932
945
  "aria-label": `Formatting ${a + 1}`,
933
- children: i.map((i) => /* @__PURE__ */ M(t, {
946
+ children: i.map((i) => /* @__PURE__ */ I(t, {
934
947
  size: "sm",
935
948
  isIconOnly: !0,
936
949
  iconStart: i.icon,
937
950
  "aria-label": i.label,
938
951
  title: i.label,
939
952
  "aria-pressed": i.active ? n?.active[i.id] : void 0,
940
- variant: n?.active[i.id] ? "active" : "neutral",
953
+ variant: n?.active[i.id] ? "primary" : "neutral",
941
954
  isDisabled: r || !e,
942
955
  onClick: () => e && i.run(e)
943
956
  }, i.id))
944
957
  }, a)),
945
- /* @__PURE__ */ M(u, {
958
+ /* @__PURE__ */ I(p, {
946
959
  "aria-label": "Link",
947
- children: /* @__PURE__ */ M(t, {
960
+ children: /* @__PURE__ */ I(t, {
948
961
  size: "sm",
949
962
  isIconOnly: !0,
950
963
  iconStart: "link",
951
964
  "aria-label": n?.linkActive ? "Edit link" : "Add link",
952
965
  title: n?.linkActive ? "Edit link" : "Add link",
953
- variant: n?.linkActive ? "active" : "neutral",
966
+ variant: n?.linkActive ? "primary" : "neutral",
954
967
  isDisabled: r || !e,
955
968
  onClick: () => e && o(e.state, e.isActive("link") ? e.state.selection.from : void 0)
956
969
  })
@@ -961,32 +974,36 @@ function Fe({ editor: e, state: n, disabled: r, label: i, toolbarExtra: a, openL
961
974
  ]
962
975
  });
963
976
  }
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, {
977
+ 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) {
978
+ return /* @__PURE__ */ I(c.Provider, {
966
979
  value: e,
967
- children: /* @__PURE__ */ N("div", {
980
+ children: /* @__PURE__ */ L("div", {
968
981
  ref: d,
969
982
  className: ["ds-rte", t].filter(Boolean).join(" "),
970
983
  style: n.frameStyle,
971
984
  "data-expanded": n.expanded || void 0,
972
985
  "data-focused": r && !n.expanded || void 0,
973
986
  "data-disabled": i || void 0,
974
- "aria-invalid": o || void 0,
987
+ "data-invalid": a || void 0,
988
+ "aria-invalid": a || void 0,
975
989
  children: [
976
- s && /* @__PURE__ */ M("p", {
977
- id: c,
990
+ o && /* @__PURE__ */ I("p", {
991
+ id: s,
978
992
  role: "alert",
979
993
  className: "ds-field__error",
980
- children: s
994
+ children: o
981
995
  }),
982
- n.expanded && /* @__PURE__ */ M("p", {
996
+ n.expanded && /* @__PURE__ */ I("p", {
983
997
  className: "ds-rte__placeholder",
984
998
  children: "Editing in expanded view. Press Esc to return."
985
999
  }),
986
- n.surfaceSlot(/* @__PURE__ */ M("div", {
1000
+ n.surfaceSlot(/* @__PURE__ */ I("div", {
987
1001
  className: "ds-rte__surface",
988
- hidden: !!s,
989
- "data-invalid": o || void 0,
1002
+ hidden: !!o,
1003
+ "data-expanded": n.expanded || void 0,
1004
+ "data-focused": r || void 0,
1005
+ "data-disabled": i || void 0,
1006
+ "data-invalid": a || void 0,
990
1007
  children: l
991
1008
  })),
992
1009
  n.dialog,
@@ -994,33 +1011,33 @@ var Ie = S(function({ scopeRef: e, className: t, expansion: n, isFocused: r, dis
994
1011
  ]
995
1012
  })
996
1013
  });
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) });
1014
+ }), Re = K.extend({ addNodeView() {
1015
+ return B(ye, { update: ({ oldNode: e, newNode: t, updateProps: n }) => e.attrs.type === t.attrs.type && (e !== t && n(), !0) });
999
1016
  } });
1000
- function Re(e, t) {
1017
+ function ze(e, t) {
1001
1018
  return t.key !== "Escape" || t.isComposing ? !1 : (e.someProp("handleKeyDown", (n) => n(e, t)) && t.preventDefault(), !0);
1002
1019
  }
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;
1020
+ var Be = D(function(e, t) {
1021
+ 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;
1022
+ R && S && C(null);
1023
+ let z = O((e, t) => {
1024
+ if (R) return;
1008
1025
  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({
1026
+ C({
1010
1027
  from: n?.from ?? e.selection.from,
1011
1028
  to: n?.to ?? e.selection.to,
1012
1029
  href: r?.attrs.href ?? "",
1013
1030
  isEditing: !!r,
1014
1031
  document: e.doc
1015
1032
  });
1016
- }, [L]), z = D(() => ({
1033
+ }, [R]), B = M(() => ({
1017
1034
  role: "textbox",
1018
1035
  ...h ? {} : { "aria-label": m ?? c },
1019
1036
  "aria-multiline": "true",
1020
1037
  ...d ? { id: d } : {},
1021
1038
  ...h ? { "aria-labelledby": h } : {},
1022
1039
  ...g ? { "aria-describedby": g } : {},
1023
- ...I ? { "aria-invalid": String(I) } : {},
1040
+ ...F ? { "aria-invalid": String(F) } : {},
1024
1041
  ...f || p ? { "aria-required": "true" } : {}
1025
1042
  }), [
1026
1043
  c,
@@ -1028,96 +1045,96 @@ var ze = S(function(e, t) {
1028
1045
  d,
1029
1046
  h,
1030
1047
  g,
1031
- I,
1048
+ F,
1032
1049
  f,
1033
1050
  p
1034
- ]), B = D(() => ({
1035
- attributes: z,
1051
+ ]), V = M(() => ({
1052
+ attributes: B,
1036
1053
  handleDOMEvents: {
1037
- keydown: Re,
1054
+ keydown: ze,
1038
1055
  click: (e, t) => {
1039
1056
  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);
1057
+ return !n || !e.dom.contains(n) ? !1 : (t.preventDefault(), e.editable && z(e.state, e.posAtDOM(n, 0)), !0);
1041
1058
  }
1042
1059
  }
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({
1060
+ }), [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
1061
  immediatelyRender: !1,
1045
- editable: !L,
1046
- content: W,
1062
+ editable: !R,
1063
+ content: se,
1047
1064
  extensions: H,
1048
- editorProps: B,
1065
+ editorProps: V,
1049
1066
  onFocus: () => x(!0),
1050
1067
  onBlur: () => x(!1),
1051
1068
  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()));
1069
+ (!R || n.getMeta("ds-rte-embed-commit")) && (e.format === "json" ? e.onChange?.(G(t.getJSON())) : e.onChange?.(t.getHTML()));
1053
1070
  }
1054
1071
  });
1055
- T(() => {
1056
- K && (K.setEditable(!L, !1), K.setOptions({ editorProps: B }));
1072
+ A(() => {
1073
+ U && (U.setEditable(!R, !1), U.setOptions({ editorProps: V }));
1057
1074
  }, [
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 });
1075
+ U,
1076
+ R,
1077
+ V
1078
+ ]), A(() => {
1079
+ if (!U || e.value === void 0 || D) return;
1080
+ let t = typeof e.value == "string" ? ne(e.value, U.schema) : U.schema.nodeFromJSON(Y(e.value));
1081
+ t.eq(U.state.doc) || U.commands.setContent(t, { emitUpdate: !1 });
1065
1082
  }, [
1066
- K,
1083
+ U,
1067
1084
  e.value,
1068
- F
1085
+ D
1069
1086
  ]);
1070
- let J = oe({
1071
- editor: K,
1087
+ let ce = ae({
1088
+ editor: U,
1072
1089
  selector: ({ editor: e }) => e ? {
1073
1090
  active: Object.fromEntries($.flat().map((t) => [t.id, t.active?.(e) ?? !1])),
1074
1091
  linkActive: e.isActive("link")
1075
1092
  } : 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,
1093
+ }), W = Pe(U, D ? void 0 : e.embeds, R, c), K = le({
1094
+ editor: U,
1095
+ disabled: R,
1096
+ isHeld: W.isCreating,
1097
+ invalid: !!F,
1081
1098
  label: m ?? c,
1082
1099
  labelledBy: h,
1083
1100
  expandedWidth: a,
1084
1101
  frameRef: v
1085
1102
  });
1086
- return /* @__PURE__ */ M(Y.Provider, {
1087
- value: X.context,
1088
- children: /* @__PURE__ */ N(Ie, {
1103
+ return /* @__PURE__ */ I(Z.Provider, {
1104
+ value: W.context,
1105
+ children: /* @__PURE__ */ L(Le, {
1089
1106
  ref: y,
1090
1107
  scopeRef: v,
1091
1108
  className: l,
1092
- expansion: Z,
1109
+ expansion: K,
1093
1110
  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,
1111
+ disabled: R,
1112
+ invalid: !!F,
1113
+ contentError: D,
1114
+ errorId: k,
1115
+ surface: /* @__PURE__ */ L(ee, { children: [/* @__PURE__ */ I(Ie, {
1116
+ editor: U,
1117
+ state: ce,
1118
+ disabled: R,
1102
1119
  label: c,
1103
1120
  toolbarExtra: u,
1104
- openLink: R,
1105
- expandControl: Z.toggle,
1106
- embedControl: X.toolbar
1107
- }), /* @__PURE__ */ M("div", {
1108
- className: "ds-rte__content",
1121
+ openLink: z,
1122
+ expandControl: K.toggle,
1123
+ embedControl: W.toolbar
1124
+ }), /* @__PURE__ */ I("div", {
1125
+ className: "ds-rte__content ds-field-surface",
1109
1126
  "data-size": i,
1110
- children: /* @__PURE__ */ M(ee, { editor: K })
1127
+ children: /* @__PURE__ */ I(te, { editor: U })
1111
1128
  })] }),
1112
- children: [X.dialog, K && S && !L && /* @__PURE__ */ M(Pe, {
1113
- editor: K,
1129
+ children: [W.dialog, U && S && !R && /* @__PURE__ */ I(Fe, {
1130
+ editor: U,
1114
1131
  selection: S,
1115
- onClose: A
1132
+ onClose: w
1116
1133
  })]
1117
1134
  })
1118
1135
  });
1119
1136
  });
1120
1137
  //#endregion
1121
- export { le as n, U as r, ze as t };
1138
+ export { fe as n, q as r, Be as t };
1122
1139
 
1123
- //# sourceMappingURL=RichTextEditor-DmNM63Wg.js.map
1140
+ //# sourceMappingURL=RichTextEditor-CvbboqJY.js.map