@liveblocks/react-ui 2.25.0-aiprivatebeta1 → 2.25.0-aiprivatebeta10

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 (273) hide show
  1. package/dist/_private/index.cjs +18 -10
  2. package/dist/_private/index.cjs.map +1 -1
  3. package/dist/_private/index.d.cts +204 -172
  4. package/dist/_private/index.d.ts +204 -172
  5. package/dist/_private/index.js +12 -5
  6. package/dist/_private/index.js.map +1 -1
  7. package/dist/components/AiChat.cjs +185 -0
  8. package/dist/components/AiChat.cjs.map +1 -0
  9. package/dist/components/AiChat.js +183 -0
  10. package/dist/components/AiChat.js.map +1 -0
  11. package/dist/components/AiTool.cjs +164 -0
  12. package/dist/components/AiTool.cjs.map +1 -0
  13. package/dist/components/AiTool.js +162 -0
  14. package/dist/components/AiTool.js.map +1 -0
  15. package/dist/components/Comment.cjs +7 -5
  16. package/dist/components/Comment.cjs.map +1 -1
  17. package/dist/components/Comment.js +7 -5
  18. package/dist/components/Comment.js.map +1 -1
  19. package/dist/components/Composer.cjs +1 -2
  20. package/dist/components/Composer.cjs.map +1 -1
  21. package/dist/components/Composer.js +1 -2
  22. package/dist/components/Composer.js.map +1 -1
  23. package/dist/components/InboxNotificationList.cjs +11 -3
  24. package/dist/components/InboxNotificationList.cjs.map +1 -1
  25. package/dist/components/InboxNotificationList.js +12 -4
  26. package/dist/components/InboxNotificationList.js.map +1 -1
  27. package/dist/components/Thread.cjs +3 -3
  28. package/dist/components/Thread.cjs.map +1 -1
  29. package/dist/components/Thread.js +3 -3
  30. package/dist/components/Thread.js.map +1 -1
  31. package/dist/components/internal/AiChatAssistantMessage.cjs +74 -291
  32. package/dist/components/internal/AiChatAssistantMessage.cjs.map +1 -1
  33. package/dist/components/internal/AiChatAssistantMessage.js +76 -293
  34. package/dist/components/internal/AiChatAssistantMessage.js.map +1 -1
  35. package/dist/components/internal/AiChatComposer.cjs +58 -282
  36. package/dist/components/internal/AiChatComposer.cjs.map +1 -1
  37. package/dist/components/internal/AiChatComposer.js +63 -283
  38. package/dist/components/internal/AiChatComposer.js.map +1 -1
  39. package/dist/components/internal/AiChatUserMessage.cjs +26 -169
  40. package/dist/components/internal/AiChatUserMessage.cjs.map +1 -1
  41. package/dist/components/internal/AiChatUserMessage.js +28 -171
  42. package/dist/components/internal/AiChatUserMessage.js.map +1 -1
  43. package/dist/components/internal/Button.cjs.map +1 -1
  44. package/dist/components/internal/Button.js.map +1 -1
  45. package/dist/components/internal/CodeBlock.cjs +72 -0
  46. package/dist/components/internal/CodeBlock.cjs.map +1 -0
  47. package/dist/components/internal/CodeBlock.js +70 -0
  48. package/dist/components/internal/CodeBlock.js.map +1 -0
  49. package/dist/components/internal/Emoji.cjs +12 -4
  50. package/dist/components/internal/Emoji.cjs.map +1 -1
  51. package/dist/components/internal/Emoji.js +12 -4
  52. package/dist/components/internal/Emoji.js.map +1 -1
  53. package/dist/components/internal/Prose.cjs +37 -0
  54. package/dist/components/internal/Prose.cjs.map +1 -0
  55. package/dist/components/internal/Prose.js +35 -0
  56. package/dist/components/internal/Prose.js.map +1 -0
  57. package/dist/constants.cjs +2 -0
  58. package/dist/constants.cjs.map +1 -1
  59. package/dist/constants.js +2 -1
  60. package/dist/constants.js.map +1 -1
  61. package/dist/icon.cjs +6 -0
  62. package/dist/icon.cjs.map +1 -1
  63. package/dist/icon.js +3 -0
  64. package/dist/icon.js.map +1 -1
  65. package/dist/icons/{Resolve.cjs → CheckCircle.cjs} +3 -3
  66. package/dist/icons/CheckCircle.cjs.map +1 -0
  67. package/dist/icons/{Resolve.js → CheckCircle.js} +3 -3
  68. package/dist/icons/CheckCircle.js.map +1 -0
  69. package/dist/icons/{Resolved.cjs → CheckCircleFill.cjs} +3 -3
  70. package/dist/icons/CheckCircleFill.cjs.map +1 -0
  71. package/dist/icons/{Resolved.js → CheckCircleFill.js} +3 -3
  72. package/dist/icons/CheckCircleFill.js.map +1 -0
  73. package/dist/icons/Copy.cjs +8 -9
  74. package/dist/icons/Copy.cjs.map +1 -1
  75. package/dist/icons/Copy.js +8 -9
  76. package/dist/icons/Copy.js.map +1 -1
  77. package/dist/icons/Retry.cjs +21 -0
  78. package/dist/icons/Retry.cjs.map +1 -0
  79. package/dist/icons/Retry.js +19 -0
  80. package/dist/icons/Retry.js.map +1 -0
  81. package/dist/icons/index.cjs +8 -4
  82. package/dist/icons/index.cjs.map +1 -1
  83. package/dist/icons/index.js +4 -2
  84. package/dist/icons/index.js.map +1 -1
  85. package/dist/index.cjs +3 -1
  86. package/dist/index.cjs.map +1 -1
  87. package/dist/index.d.cts +102 -43
  88. package/dist/index.d.ts +102 -43
  89. package/dist/index.js +2 -1
  90. package/dist/index.js.map +1 -1
  91. package/dist/overrides.cjs +6 -12
  92. package/dist/overrides.cjs.map +1 -1
  93. package/dist/overrides.js +6 -12
  94. package/dist/overrides.js.map +1 -1
  95. package/dist/primitives/AiChatComposer/index.cjs +202 -0
  96. package/dist/primitives/AiChatComposer/index.cjs.map +1 -0
  97. package/dist/primitives/AiChatComposer/index.js +195 -0
  98. package/dist/primitives/AiChatComposer/index.js.map +1 -0
  99. package/dist/primitives/AiMessage/contexts.cjs +18 -0
  100. package/dist/primitives/AiMessage/contexts.cjs.map +1 -0
  101. package/dist/primitives/AiMessage/contexts.js +15 -0
  102. package/dist/primitives/AiMessage/contexts.js.map +1 -0
  103. package/dist/primitives/AiMessage/index.cjs +134 -0
  104. package/dist/primitives/AiMessage/index.cjs.map +1 -0
  105. package/dist/primitives/AiMessage/index.js +132 -0
  106. package/dist/primitives/AiMessage/index.js.map +1 -0
  107. package/dist/primitives/Collapsible/index.cjs +127 -0
  108. package/dist/primitives/Collapsible/index.cjs.map +1 -0
  109. package/dist/primitives/Collapsible/index.js +123 -0
  110. package/dist/primitives/Collapsible/index.js.map +1 -0
  111. package/dist/primitives/Comment/index.cjs +2 -2
  112. package/dist/primitives/Comment/index.cjs.map +1 -1
  113. package/dist/primitives/Comment/index.js +1 -1
  114. package/dist/primitives/Comment/index.js.map +1 -1
  115. package/dist/primitives/Composer/index.cjs +19 -14
  116. package/dist/primitives/Composer/index.cjs.map +1 -1
  117. package/dist/primitives/Composer/index.js +18 -13
  118. package/dist/primitives/Composer/index.js.map +1 -1
  119. package/dist/{slate → primitives/Composer/slate}/plugins/auto-formatting.cjs +3 -3
  120. package/dist/primitives/Composer/slate/plugins/auto-formatting.cjs.map +1 -0
  121. package/dist/{slate → primitives/Composer/slate}/plugins/auto-formatting.js +3 -3
  122. package/dist/primitives/Composer/slate/plugins/auto-formatting.js.map +1 -0
  123. package/dist/{slate → primitives/Composer/slate}/plugins/auto-links.cjs +7 -2
  124. package/dist/primitives/Composer/slate/plugins/auto-links.cjs.map +1 -0
  125. package/dist/{slate → primitives/Composer/slate}/plugins/auto-links.js +8 -3
  126. package/dist/primitives/Composer/slate/plugins/auto-links.js.map +1 -0
  127. package/dist/{slate → primitives/Composer/slate}/plugins/custom-links.cjs +8 -3
  128. package/dist/primitives/Composer/slate/plugins/custom-links.cjs.map +1 -0
  129. package/dist/{slate → primitives/Composer/slate}/plugins/custom-links.js +9 -4
  130. package/dist/primitives/Composer/slate/plugins/custom-links.js.map +1 -0
  131. package/dist/{slate → primitives/Composer/slate}/plugins/mentions.cjs +9 -10
  132. package/dist/primitives/Composer/slate/plugins/mentions.cjs.map +1 -0
  133. package/dist/{slate → primitives/Composer/slate}/plugins/mentions.js +6 -6
  134. package/dist/primitives/Composer/slate/plugins/mentions.js.map +1 -0
  135. package/dist/{slate → primitives/Composer/slate}/plugins/paste.cjs +1 -1
  136. package/dist/primitives/Composer/slate/plugins/paste.cjs.map +1 -0
  137. package/dist/{slate → primitives/Composer/slate}/plugins/paste.js +1 -1
  138. package/dist/primitives/Composer/slate/plugins/paste.js.map +1 -0
  139. package/dist/primitives/Composer/utils.cjs +4 -4
  140. package/dist/primitives/Composer/utils.cjs.map +1 -1
  141. package/dist/primitives/Composer/utils.js +4 -4
  142. package/dist/primitives/Composer/utils.js.map +1 -1
  143. package/dist/primitives/{internal/Markdown.cjs → Markdown.cjs} +150 -83
  144. package/dist/primitives/Markdown.cjs.map +1 -0
  145. package/dist/primitives/{internal/Markdown.js → Markdown.js} +151 -83
  146. package/dist/primitives/Markdown.js.map +1 -0
  147. package/dist/primitives/index.cjs +4 -9
  148. package/dist/primitives/index.cjs.map +1 -1
  149. package/dist/primitives/index.d.cts +4 -110
  150. package/dist/primitives/index.d.ts +4 -110
  151. package/dist/primitives/index.js +0 -1
  152. package/dist/primitives/index.js.map +1 -1
  153. package/dist/primitives/slate/plugins/empty-clear-formatting.cjs.map +1 -0
  154. package/dist/primitives/slate/plugins/empty-clear-formatting.js.map +1 -0
  155. package/dist/{slate → primitives/slate}/plugins/normalize.cjs +0 -5
  156. package/dist/primitives/slate/plugins/normalize.cjs.map +1 -0
  157. package/dist/{slate → primitives/slate}/plugins/normalize.js +0 -5
  158. package/dist/primitives/slate/plugins/normalize.js.map +1 -0
  159. package/dist/primitives/slate/utils/get-character.cjs.map +1 -0
  160. package/dist/primitives/slate/utils/get-character.js.map +1 -0
  161. package/dist/primitives/slate/utils/get-dom-range.cjs.map +1 -0
  162. package/dist/primitives/slate/utils/get-dom-range.js.map +1 -0
  163. package/dist/primitives/slate/utils/get-match-range.cjs.map +1 -0
  164. package/dist/primitives/slate/utils/get-match-range.js.map +1 -0
  165. package/dist/primitives/slate/utils/is-empty-string.cjs.map +1 -0
  166. package/dist/primitives/slate/utils/is-empty-string.js.map +1 -0
  167. package/dist/primitives/slate/utils/is-empty.cjs.map +1 -0
  168. package/dist/primitives/slate/utils/is-empty.js.map +1 -0
  169. package/dist/primitives/slate/utils/is-text.cjs.map +1 -0
  170. package/dist/primitives/slate/utils/is-text.js.map +1 -0
  171. package/dist/primitives/slate/utils/is-whitespace-character.cjs.map +1 -0
  172. package/dist/primitives/slate/utils/is-whitespace-character.js.map +1 -0
  173. package/dist/{slate → primitives/slate}/utils/marks.cjs +9 -9
  174. package/dist/primitives/slate/utils/marks.cjs.map +1 -0
  175. package/dist/{slate → primitives/slate}/utils/marks.js +9 -9
  176. package/dist/primitives/slate/utils/marks.js.map +1 -0
  177. package/dist/primitives/slate/utils/selection-contains-inlines.cjs.map +1 -0
  178. package/dist/primitives/slate/utils/selection-contains-inlines.js.map +1 -0
  179. package/dist/utils/ErrorBoundary.cjs +48 -0
  180. package/dist/utils/ErrorBoundary.cjs.map +1 -0
  181. package/dist/utils/ErrorBoundary.js +45 -0
  182. package/dist/utils/ErrorBoundary.js.map +1 -0
  183. package/dist/utils/use-visible.cjs +63 -45
  184. package/dist/utils/use-visible.cjs.map +1 -1
  185. package/dist/utils/use-visible.js +64 -46
  186. package/dist/utils/use-visible.js.map +1 -1
  187. package/dist/version.cjs +1 -1
  188. package/dist/version.cjs.map +1 -1
  189. package/dist/version.js +1 -1
  190. package/dist/version.js.map +1 -1
  191. package/package.json +18 -6
  192. package/src/styles/constants.css +1 -1
  193. package/src/styles/dark/index.css +7 -3
  194. package/src/styles/index.css +640 -307
  195. package/src/styles/utils.css +8 -3
  196. package/styles/dark/attributes.css +1 -1
  197. package/styles/dark/attributes.css.map +1 -1
  198. package/styles/dark/media-query.css +1 -1
  199. package/styles/dark/media-query.css.map +1 -1
  200. package/styles.css +1 -1
  201. package/styles.css.map +1 -1
  202. package/dist/components/AiChat/AiChat.cjs +0 -211
  203. package/dist/components/AiChat/AiChat.cjs.map +0 -1
  204. package/dist/components/AiChat/AiChat.js +0 -209
  205. package/dist/components/AiChat/AiChat.js.map +0 -1
  206. package/dist/icons/Resolve.cjs.map +0 -1
  207. package/dist/icons/Resolve.js.map +0 -1
  208. package/dist/icons/Resolved.cjs.map +0 -1
  209. package/dist/icons/Resolved.js.map +0 -1
  210. package/dist/primitives/Chat/Composer/index.cjs +0 -323
  211. package/dist/primitives/Chat/Composer/index.cjs.map +0 -1
  212. package/dist/primitives/Chat/Composer/index.js +0 -315
  213. package/dist/primitives/Chat/Composer/index.js.map +0 -1
  214. package/dist/primitives/internal/Collapsible.cjs +0 -99
  215. package/dist/primitives/internal/Collapsible.cjs.map +0 -1
  216. package/dist/primitives/internal/Collapsible.js +0 -95
  217. package/dist/primitives/internal/Collapsible.js.map +0 -1
  218. package/dist/primitives/internal/Emoji.cjs +0 -32
  219. package/dist/primitives/internal/Emoji.cjs.map +0 -1
  220. package/dist/primitives/internal/Emoji.js +0 -30
  221. package/dist/primitives/internal/Emoji.js.map +0 -1
  222. package/dist/primitives/internal/Markdown.cjs.map +0 -1
  223. package/dist/primitives/internal/Markdown.js.map +0 -1
  224. package/dist/slate/plugins/auto-formatting.cjs.map +0 -1
  225. package/dist/slate/plugins/auto-formatting.js.map +0 -1
  226. package/dist/slate/plugins/auto-links.cjs.map +0 -1
  227. package/dist/slate/plugins/auto-links.js.map +0 -1
  228. package/dist/slate/plugins/custom-links.cjs.map +0 -1
  229. package/dist/slate/plugins/custom-links.js.map +0 -1
  230. package/dist/slate/plugins/empty-clear-formatting.cjs.map +0 -1
  231. package/dist/slate/plugins/empty-clear-formatting.js.map +0 -1
  232. package/dist/slate/plugins/mentions.cjs.map +0 -1
  233. package/dist/slate/plugins/mentions.js.map +0 -1
  234. package/dist/slate/plugins/normalize.cjs.map +0 -1
  235. package/dist/slate/plugins/normalize.js.map +0 -1
  236. package/dist/slate/plugins/paste.cjs.map +0 -1
  237. package/dist/slate/plugins/paste.js.map +0 -1
  238. package/dist/slate/utils/get-character.cjs.map +0 -1
  239. package/dist/slate/utils/get-character.js.map +0 -1
  240. package/dist/slate/utils/get-dom-range.cjs.map +0 -1
  241. package/dist/slate/utils/get-dom-range.js.map +0 -1
  242. package/dist/slate/utils/get-match-range.cjs.map +0 -1
  243. package/dist/slate/utils/get-match-range.js.map +0 -1
  244. package/dist/slate/utils/is-empty-string.cjs.map +0 -1
  245. package/dist/slate/utils/is-empty-string.js.map +0 -1
  246. package/dist/slate/utils/is-empty.cjs.map +0 -1
  247. package/dist/slate/utils/is-empty.js.map +0 -1
  248. package/dist/slate/utils/is-text.cjs.map +0 -1
  249. package/dist/slate/utils/is-text.js.map +0 -1
  250. package/dist/slate/utils/is-whitespace-character.cjs.map +0 -1
  251. package/dist/slate/utils/is-whitespace-character.js.map +0 -1
  252. package/dist/slate/utils/marks.cjs.map +0 -1
  253. package/dist/slate/utils/marks.js.map +0 -1
  254. package/dist/slate/utils/selection-contains-inlines.cjs.map +0 -1
  255. package/dist/slate/utils/selection-contains-inlines.js.map +0 -1
  256. /package/dist/{slate → primitives/slate}/plugins/empty-clear-formatting.cjs +0 -0
  257. /package/dist/{slate → primitives/slate}/plugins/empty-clear-formatting.js +0 -0
  258. /package/dist/{slate → primitives/slate}/utils/get-character.cjs +0 -0
  259. /package/dist/{slate → primitives/slate}/utils/get-character.js +0 -0
  260. /package/dist/{slate → primitives/slate}/utils/get-dom-range.cjs +0 -0
  261. /package/dist/{slate → primitives/slate}/utils/get-dom-range.js +0 -0
  262. /package/dist/{slate → primitives/slate}/utils/get-match-range.cjs +0 -0
  263. /package/dist/{slate → primitives/slate}/utils/get-match-range.js +0 -0
  264. /package/dist/{slate → primitives/slate}/utils/is-empty-string.cjs +0 -0
  265. /package/dist/{slate → primitives/slate}/utils/is-empty-string.js +0 -0
  266. /package/dist/{slate → primitives/slate}/utils/is-empty.cjs +0 -0
  267. /package/dist/{slate → primitives/slate}/utils/is-empty.js +0 -0
  268. /package/dist/{slate → primitives/slate}/utils/is-text.cjs +0 -0
  269. /package/dist/{slate → primitives/slate}/utils/is-text.js +0 -0
  270. /package/dist/{slate → primitives/slate}/utils/is-whitespace-character.cjs +0 -0
  271. /package/dist/{slate → primitives/slate}/utils/is-whitespace-character.js +0 -0
  272. /package/dist/{slate → primitives/slate}/utils/selection-contains-inlines.cjs +0 -0
  273. /package/dist/{slate → primitives/slate}/utils/selection-contains-inlines.js +0 -0
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ElementType, ComponentPropsWithoutRef, FormHTMLAttributes, FormEvent, HTMLAttributes, ButtonHTMLAttributes, ReactNode, ComponentType } from 'react';
2
+ import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEvent } from 'react';
3
3
  import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
4
4
 
5
5
  type Direction = "ltr" | "rtl";
@@ -22,112 +22,6 @@ type ComposerBodyMarks = {
22
22
  [K in ComposerBodyMark]: boolean;
23
23
  };
24
24
 
25
- type FormProps = FormHTMLAttributes<HTMLFormElement> & {
26
- /**
27
- * The event handler called when a chat message is submitted.
28
- */
29
- onComposerSubmit?: (message: {
30
- /**
31
- * The submitted message text.
32
- */
33
- text: string;
34
- }, event: FormEvent<HTMLFormElement>) => void;
35
- /**
36
- * Whether the composer is disabled.
37
- */
38
- disabled?: boolean;
39
- /**
40
- * The id of the chat the composer belongs to.
41
- */
42
- chatId: string;
43
- };
44
- /**
45
- * Surrounds the chat composer's content and handles submissions.
46
- *
47
- * @example
48
- * <Form onComposerSubmit={({ text }) => {}}>
49
- * <Editor />
50
- * <Submit />
51
- * </Form>
52
- */
53
- declare const Form: react.ForwardRefExoticComponent<FormHTMLAttributes<HTMLFormElement> & {
54
- /**
55
- * The event handler called when a chat message is submitted.
56
- */
57
- onComposerSubmit?: (message: {
58
- /**
59
- * The submitted message text.
60
- */
61
- text: string;
62
- }, event: FormEvent<HTMLFormElement>) => void;
63
- /**
64
- * Whether the composer is disabled.
65
- */
66
- disabled?: boolean;
67
- /**
68
- * The id of the chat the composer belongs to.
69
- */
70
- chatId: string;
71
- } & react.RefAttributes<HTMLFormElement>>;
72
- type EditorProps = Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> & {
73
- /**
74
- * The editor's initial value.
75
- */
76
- defaultValue?: string;
77
- /**
78
- * The text to display when the editor is empty.
79
- */
80
- placeholder?: string;
81
- /**
82
- * Whether the editor is disabled.
83
- */
84
- disabled?: boolean;
85
- /**
86
- * Whether to focus the editor on mount.
87
- */
88
- autoFocus?: boolean;
89
- };
90
- /**
91
- * Displays the chat composer's editor.
92
- *
93
- * @example
94
- * <Editor placeholder="Write a message…" />
95
- */
96
- declare const Editor: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> & {
97
- /**
98
- * The editor's initial value.
99
- */
100
- defaultValue?: string;
101
- /**
102
- * The text to display when the editor is empty.
103
- */
104
- placeholder?: string;
105
- /**
106
- * Whether the editor is disabled.
107
- */
108
- disabled?: boolean;
109
- /**
110
- * Whether to focus the editor on mount.
111
- */
112
- autoFocus?: boolean;
113
- } & react.RefAttributes<HTMLDivElement>>;
114
- type SubmitProps = ButtonHTMLAttributes<HTMLButtonElement>;
115
- /**
116
- * A button to submit a chat message.
117
- *
118
- * @example
119
- * <ChatComposer.Submit>Send</ChatComposer.Submit>
120
- */
121
- declare const Submit: react.ForwardRefExoticComponent<SubmitProps & react.RefAttributes<HTMLButtonElement>>;
122
- type AttachFilesProps = ButtonHTMLAttributes<HTMLButtonElement>;
123
- /**
124
- * A button which opens a file picker to create attachments.
125
- *
126
- * @example
127
- * <Composer.AttachFiles>Attach files</Composer.AttachFiles>
128
- */
129
- declare const AttachFiles: react.ForwardRefExoticComponent<AttachFilesProps & react.RefAttributes<HTMLButtonElement>>;
130
-
131
25
  type CommentMentionProps = ComponentPropsWithSlot<"span">;
132
26
  type CommentBodyMentionProps = {
133
27
  /**
@@ -160,7 +54,7 @@ interface CommentBodyComponents {
160
54
  */
161
55
  Link: ComponentType<CommentBodyLinkProps>;
162
56
  }
163
- interface CommentBodyProps extends Omit<ComponentPropsWithSlot<"div">, "children"> {
57
+ interface CommentBodyProps extends ComponentPropsWithSlot<"div"> {
164
58
  /**
165
59
  * The comment body to display.
166
60
  * If not defined, the component will render `null`.
@@ -265,7 +159,7 @@ interface ComposerEditorComponents {
265
159
  */
266
160
  FloatingToolbar?: ComponentType<ComposerEditorFloatingToolbarProps>;
267
161
  }
268
- interface ComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue"> {
162
+ interface ComposerEditorProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue" | "children"> {
269
163
  /**
270
164
  * The reading direction of the editor and related elements.
271
165
  */
@@ -600,4 +494,4 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
600
494
  */
601
495
  declare const Timestamp: react.ForwardRefExoticComponent<TimestampProps & react.RefAttributes<HTMLTimeElement>>;
602
496
 
603
- export { AttachmentTooLargeError, AttachFiles as ChatComposerAttachFiles, AttachFilesProps as ChatComposerAttachFilesProps, Editor as ChatComposerEditor, EditorProps as ChatComposerEditorProps, Form as ChatComposerForm, FormProps as ChatComposerFormProps, Submit as ChatComposerSubmit, SubmitProps as ChatComposerSubmitProps, index$1 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
497
+ export { AttachmentTooLargeError, index$1 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
@@ -1,4 +1,3 @@
1
- export { AttachFiles as ChatComposerAttachFiles, Editor as ChatComposerEditor, Form as ChatComposerForm, Submit as ChatComposerSubmit } from './Chat/Composer/index.js';
2
1
  import * as index from './Comment/index.js';
3
2
  export { index as Comment };
4
3
  import * as index$1 from './Composer/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-clear-formatting.cjs","sources":["../../../../src/primitives/slate/plugins/empty-clear-formatting.ts"],"sourcesContent":["import type { Editor as SlateEditor } from \"slate\";\n\nimport { isEmpty } from \"../utils/is-empty\";\nimport { removeMarks } from \"../utils/marks\";\n\n// This plugins clears formatting on empty blocks\n// https://github.com/ianstormtaylor/slate/issues/2908\nexport function withEmptyClearFormatting<T extends SlateEditor>(editor: T): T {\n const { onChange } = editor;\n\n editor.onChange = (options) => {\n if (isEmpty(editor, editor.children)) {\n removeMarks(editor);\n }\n\n onChange(options);\n };\n\n return editor;\n}\n"],"names":["isEmpty","removeMarks"],"mappings":";;;;;AAOO,SAAS,yBAAgD,MAAc,EAAA;AAC5E,EAAM,MAAA,EAAE,UAAa,GAAA,MAAA,CAAA;AAErB,EAAO,MAAA,CAAA,QAAA,GAAW,CAAC,OAAY,KAAA;AAC7B,IAAA,IAAIA,eAAQ,CAAA,MAAA,EAAQ,MAAO,CAAA,QAAQ,CAAG,EAAA;AACpC,MAAAC,iBAAA,CAAY,MAAM,CAAA,CAAA;AAAA,KACpB;AAEA,IAAA,QAAA,CAAS,OAAO,CAAA,CAAA;AAAA,GAClB,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty-clear-formatting.js","sources":["../../../../src/primitives/slate/plugins/empty-clear-formatting.ts"],"sourcesContent":["import type { Editor as SlateEditor } from \"slate\";\n\nimport { isEmpty } from \"../utils/is-empty\";\nimport { removeMarks } from \"../utils/marks\";\n\n// This plugins clears formatting on empty blocks\n// https://github.com/ianstormtaylor/slate/issues/2908\nexport function withEmptyClearFormatting<T extends SlateEditor>(editor: T): T {\n const { onChange } = editor;\n\n editor.onChange = (options) => {\n if (isEmpty(editor, editor.children)) {\n removeMarks(editor);\n }\n\n onChange(options);\n };\n\n return editor;\n}\n"],"names":[],"mappings":";;;AAOO,SAAS,yBAAgD,MAAc,EAAA;AAC5E,EAAM,MAAA,EAAE,UAAa,GAAA,MAAA,CAAA;AAErB,EAAO,MAAA,CAAA,QAAA,GAAW,CAAC,OAAY,KAAA;AAC7B,IAAA,IAAI,OAAQ,CAAA,MAAA,EAAQ,MAAO,CAAA,QAAQ,CAAG,EAAA;AACpC,MAAA,WAAA,CAAY,MAAM,CAAA,CAAA;AAAA,KACpB;AAEA,IAAA,QAAA,CAAS,OAAO,CAAA,CAAA;AAAA,GAClB,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -14,11 +14,6 @@ function withNormalize(editor) {
14
14
  }
15
15
  }
16
16
  }
17
- if (slate.Element.isElement(node) && (node.type === "auto-link" || node.type === "custom-link")) {
18
- if (node.children.length === 0 || node.children.length === 1 && node.children[0]?.text === "") {
19
- slate.Transforms.removeNodes(editor, { at: path });
20
- }
21
- }
22
17
  normalizeNode(entry);
23
18
  };
24
19
  return editor;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.cjs","sources":["../../../../src/primitives/slate/plugins/normalize.ts"],"sourcesContent":["import type { Editor as SlateEditor } from \"slate\";\nimport {\n Element as SlateElement,\n Node as SlateNode,\n Transforms as SlateTransforms,\n} from \"slate\";\n\nexport function withNormalize(editor: SlateEditor) {\n const { normalizeNode } = editor;\n\n editor.normalizeNode = (entry) => {\n const [node, path] = entry;\n\n // Paragraphs should only contain inline elements\n if (SlateElement.isElement(node) && node.type === \"paragraph\") {\n for (const [child, childPath] of SlateNode.children(editor, path)) {\n if (SlateElement.isElement(child) && !editor.isInline(child)) {\n SlateTransforms.unwrapNodes(editor, { at: childPath });\n return;\n }\n }\n }\n\n normalizeNode(entry);\n };\n\n return editor;\n}\n"],"names":["SlateElement","SlateNode","SlateTransforms"],"mappings":";;;;AAOO,SAAS,cAAc,MAAqB,EAAA;AACjD,EAAM,MAAA,EAAE,eAAkB,GAAA,MAAA,CAAA;AAE1B,EAAO,MAAA,CAAA,aAAA,GAAgB,CAAC,KAAU,KAAA;AAChC,IAAM,MAAA,CAAC,IAAM,EAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AAGrB,IAAA,IAAIA,cAAa,SAAU,CAAA,IAAI,CAAK,IAAA,IAAA,CAAK,SAAS,WAAa,EAAA;AAC7D,MAAW,KAAA,MAAA,CAAC,OAAO,SAAS,CAAA,IAAKC,WAAU,QAAS,CAAA,MAAA,EAAQ,IAAI,CAAG,EAAA;AACjE,QAAI,IAAAD,aAAA,CAAa,UAAU,KAAK,CAAA,IAAK,CAAC,MAAO,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAC5D,UAAAE,gBAAA,CAAgB,WAAY,CAAA,MAAA,EAAQ,EAAE,EAAA,EAAI,WAAW,CAAA,CAAA;AACrD,UAAA,OAAA;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEA,IAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,GACrB,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -12,11 +12,6 @@ function withNormalize(editor) {
12
12
  }
13
13
  }
14
14
  }
15
- if (Element.isElement(node) && (node.type === "auto-link" || node.type === "custom-link")) {
16
- if (node.children.length === 0 || node.children.length === 1 && node.children[0]?.text === "") {
17
- Transforms.removeNodes(editor, { at: path });
18
- }
19
- }
20
15
  normalizeNode(entry);
21
16
  };
22
17
  return editor;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sources":["../../../../src/primitives/slate/plugins/normalize.ts"],"sourcesContent":["import type { Editor as SlateEditor } from \"slate\";\nimport {\n Element as SlateElement,\n Node as SlateNode,\n Transforms as SlateTransforms,\n} from \"slate\";\n\nexport function withNormalize(editor: SlateEditor) {\n const { normalizeNode } = editor;\n\n editor.normalizeNode = (entry) => {\n const [node, path] = entry;\n\n // Paragraphs should only contain inline elements\n if (SlateElement.isElement(node) && node.type === \"paragraph\") {\n for (const [child, childPath] of SlateNode.children(editor, path)) {\n if (SlateElement.isElement(child) && !editor.isInline(child)) {\n SlateTransforms.unwrapNodes(editor, { at: childPath });\n return;\n }\n }\n }\n\n normalizeNode(entry);\n };\n\n return editor;\n}\n"],"names":["SlateElement","SlateNode","SlateTransforms"],"mappings":";;AAOO,SAAS,cAAc,MAAqB,EAAA;AACjD,EAAM,MAAA,EAAE,eAAkB,GAAA,MAAA,CAAA;AAE1B,EAAO,MAAA,CAAA,aAAA,GAAgB,CAAC,KAAU,KAAA;AAChC,IAAM,MAAA,CAAC,IAAM,EAAA,IAAI,CAAI,GAAA,KAAA,CAAA;AAGrB,IAAA,IAAIA,QAAa,SAAU,CAAA,IAAI,CAAK,IAAA,IAAA,CAAK,SAAS,WAAa,EAAA;AAC7D,MAAW,KAAA,MAAA,CAAC,OAAO,SAAS,CAAA,IAAKC,KAAU,QAAS,CAAA,MAAA,EAAQ,IAAI,CAAG,EAAA;AACjE,QAAI,IAAAD,OAAA,CAAa,UAAU,KAAK,CAAA,IAAK,CAAC,MAAO,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAC5D,UAAAE,UAAA,CAAgB,WAAY,CAAA,MAAA,EAAQ,EAAE,EAAA,EAAI,WAAW,CAAA,CAAA;AACrD,UAAA,OAAA;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEA,IAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,GACrB,CAAA;AAEA,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-character.cjs","sources":["../../../../src/primitives/slate/utils/get-character.ts"],"sourcesContent":["import type { Location as SlateLocation } from \"slate\";\nimport { Editor as SlateEditor, Range as SlateRange } from \"slate\";\n\ninterface Options {\n filterVoids?: boolean;\n}\n\nexport function getCharacterBefore<T extends SlateEditor>(\n editor: T,\n at: SlateLocation,\n options: Options = {}\n) {\n const { filterVoids } = options;\n const before = SlateEditor.before(editor, at, {\n unit: \"character\",\n voids: filterVoids,\n });\n\n if (before) {\n const range = SlateEditor.range(\n editor,\n before,\n SlateRange.isRange(at) ? SlateRange.start(at) : at\n );\n const text = SlateEditor.string(editor, range);\n\n return {\n range,\n text,\n void: text.length === 0,\n };\n }\n\n return;\n}\n\nexport function getCharacterAfter<T extends SlateEditor>(\n editor: T,\n at: SlateLocation,\n options: Options = {}\n) {\n const { filterVoids } = options;\n const after = SlateEditor.after(editor, at, {\n unit: \"character\",\n voids: filterVoids,\n });\n\n if (after) {\n const range = SlateEditor.range(\n editor,\n after,\n SlateRange.isRange(at) ? SlateRange.end(at) : at\n );\n const text = SlateEditor.string(editor, range);\n\n return {\n range,\n text,\n void: text.length === 0,\n };\n }\n\n return;\n}\n"],"names":["SlateEditor","SlateRange"],"mappings":";;;;AAOO,SAAS,kBACd,CAAA,MAAA,EACA,EACA,EAAA,OAAA,GAAmB,EACnB,EAAA;AACA,EAAM,MAAA,EAAE,aAAgB,GAAA,OAAA,CAAA;AACxB,EAAA,MAAM,MAAS,GAAAA,YAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,EAAI,EAAA;AAAA,IAC5C,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA,WAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,MAAM,QAAQA,YAAY,CAAA,KAAA;AAAA,MACxB,MAAA;AAAA,MACA,MAAA;AAAA,MACAC,YAAW,OAAQ,CAAA,EAAE,IAAIA,WAAW,CAAA,KAAA,CAAM,EAAE,CAAI,GAAA,EAAA;AAAA,KAClD,CAAA;AACA,IAAA,MAAM,IAAO,GAAAD,YAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAE7C,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA,EAAM,KAAK,MAAW,KAAA,CAAA;AAAA,KACxB,CAAA;AAAA,GACF;AAEA,EAAA,OAAA;AACF,CAAA;AAEO,SAAS,iBACd,CAAA,MAAA,EACA,EACA,EAAA,OAAA,GAAmB,EACnB,EAAA;AACA,EAAM,MAAA,EAAE,aAAgB,GAAA,OAAA,CAAA;AACxB,EAAA,MAAM,KAAQ,GAAAA,YAAA,CAAY,KAAM,CAAA,MAAA,EAAQ,EAAI,EAAA;AAAA,IAC1C,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA,WAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,MAAM,QAAQA,YAAY,CAAA,KAAA;AAAA,MACxB,MAAA;AAAA,MACA,KAAA;AAAA,MACAC,YAAW,OAAQ,CAAA,EAAE,IAAIA,WAAW,CAAA,GAAA,CAAI,EAAE,CAAI,GAAA,EAAA;AAAA,KAChD,CAAA;AACA,IAAA,MAAM,IAAO,GAAAD,YAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAE7C,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA,EAAM,KAAK,MAAW,KAAA,CAAA;AAAA,KACxB,CAAA;AAAA,GACF;AAEA,EAAA,OAAA;AACF;;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-character.js","sources":["../../../../src/primitives/slate/utils/get-character.ts"],"sourcesContent":["import type { Location as SlateLocation } from \"slate\";\nimport { Editor as SlateEditor, Range as SlateRange } from \"slate\";\n\ninterface Options {\n filterVoids?: boolean;\n}\n\nexport function getCharacterBefore<T extends SlateEditor>(\n editor: T,\n at: SlateLocation,\n options: Options = {}\n) {\n const { filterVoids } = options;\n const before = SlateEditor.before(editor, at, {\n unit: \"character\",\n voids: filterVoids,\n });\n\n if (before) {\n const range = SlateEditor.range(\n editor,\n before,\n SlateRange.isRange(at) ? SlateRange.start(at) : at\n );\n const text = SlateEditor.string(editor, range);\n\n return {\n range,\n text,\n void: text.length === 0,\n };\n }\n\n return;\n}\n\nexport function getCharacterAfter<T extends SlateEditor>(\n editor: T,\n at: SlateLocation,\n options: Options = {}\n) {\n const { filterVoids } = options;\n const after = SlateEditor.after(editor, at, {\n unit: \"character\",\n voids: filterVoids,\n });\n\n if (after) {\n const range = SlateEditor.range(\n editor,\n after,\n SlateRange.isRange(at) ? SlateRange.end(at) : at\n );\n const text = SlateEditor.string(editor, range);\n\n return {\n range,\n text,\n void: text.length === 0,\n };\n }\n\n return;\n}\n"],"names":["SlateEditor","SlateRange"],"mappings":";;AAOO,SAAS,kBACd,CAAA,MAAA,EACA,EACA,EAAA,OAAA,GAAmB,EACnB,EAAA;AACA,EAAM,MAAA,EAAE,aAAgB,GAAA,OAAA,CAAA;AACxB,EAAA,MAAM,MAAS,GAAAA,MAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,EAAI,EAAA;AAAA,IAC5C,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA,WAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,MAAM,QAAQA,MAAY,CAAA,KAAA;AAAA,MACxB,MAAA;AAAA,MACA,MAAA;AAAA,MACAC,MAAW,OAAQ,CAAA,EAAE,IAAIA,KAAW,CAAA,KAAA,CAAM,EAAE,CAAI,GAAA,EAAA;AAAA,KAClD,CAAA;AACA,IAAA,MAAM,IAAO,GAAAD,MAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAE7C,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA,EAAM,KAAK,MAAW,KAAA,CAAA;AAAA,KACxB,CAAA;AAAA,GACF;AAEA,EAAA,OAAA;AACF,CAAA;AAEO,SAAS,iBACd,CAAA,MAAA,EACA,EACA,EAAA,OAAA,GAAmB,EACnB,EAAA;AACA,EAAM,MAAA,EAAE,aAAgB,GAAA,OAAA,CAAA;AACxB,EAAA,MAAM,KAAQ,GAAAA,MAAA,CAAY,KAAM,CAAA,MAAA,EAAQ,EAAI,EAAA;AAAA,IAC1C,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA,WAAA;AAAA,GACR,CAAA,CAAA;AAED,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,MAAM,QAAQA,MAAY,CAAA,KAAA;AAAA,MACxB,MAAA;AAAA,MACA,KAAA;AAAA,MACAC,MAAW,OAAQ,CAAA,EAAE,IAAIA,KAAW,CAAA,GAAA,CAAI,EAAE,CAAI,GAAA,EAAA;AAAA,KAChD,CAAA;AACA,IAAA,MAAM,IAAO,GAAAD,MAAA,CAAY,MAAO,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAE7C,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA,EAAM,KAAK,MAAW,KAAA,CAAA;AAAA,KACxB,CAAA;AAAA,GACF;AAEA,EAAA,OAAA;AACF;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-dom-range.cjs","sources":["../../../../src/primitives/slate/utils/get-dom-range.ts"],"sourcesContent":["import type { Editor as SlateEditor, Range as SlateRange } from \"slate\";\nimport { ReactEditor } from \"slate-react\";\n\nexport function getDOMRange(\n editor: SlateEditor,\n range: SlateRange\n): Range | undefined {\n try {\n return ReactEditor.toDOMRange(editor, range);\n } catch (error) {\n return getDOMRange(editor, {\n anchor: range.anchor,\n focus: range.anchor,\n });\n }\n}\n"],"names":["ReactEditor"],"mappings":";;;;AAGgB,SAAA,WAAA,CACd,QACA,KACmB,EAAA;AACnB,EAAI,IAAA;AACF,IAAO,OAAAA,sBAAA,CAAY,UAAW,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAAA,WACpC,KAAP,EAAA;AACA,IAAA,OAAO,YAAY,MAAQ,EAAA;AAAA,MACzB,QAAQ,KAAM,CAAA,MAAA;AAAA,MACd,OAAO,KAAM,CAAA,MAAA;AAAA,KACd,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-dom-range.js","sources":["../../../../src/primitives/slate/utils/get-dom-range.ts"],"sourcesContent":["import type { Editor as SlateEditor, Range as SlateRange } from \"slate\";\nimport { ReactEditor } from \"slate-react\";\n\nexport function getDOMRange(\n editor: SlateEditor,\n range: SlateRange\n): Range | undefined {\n try {\n return ReactEditor.toDOMRange(editor, range);\n } catch (error) {\n return getDOMRange(editor, {\n anchor: range.anchor,\n focus: range.anchor,\n });\n }\n}\n"],"names":[],"mappings":";;AAGgB,SAAA,WAAA,CACd,QACA,KACmB,EAAA;AACnB,EAAI,IAAA;AACF,IAAO,OAAA,WAAA,CAAY,UAAW,CAAA,MAAA,EAAQ,KAAK,CAAA,CAAA;AAAA,WACpC,KAAP,EAAA;AACA,IAAA,OAAO,YAAY,MAAQ,EAAA;AAAA,MACzB,QAAQ,KAAM,CAAA,MAAA;AAAA,MACd,OAAO,KAAM,CAAA,MAAA;AAAA,KACd,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-match-range.cjs","sources":["../../../../src/primitives/slate/utils/get-match-range.ts"],"sourcesContent":["import type { Point as SlatePoint } from \"slate\";\nimport {\n Editor as SlateEditor,\n Path as SlatePath,\n Range as SlateRange,\n} from \"slate\";\n\nimport { isWhitespaceCharacter } from \"./is-whitespace-character\";\n\ninterface Options {\n include?: boolean;\n direction?: \"before\" | \"after\" | \"both\";\n allowConsecutiveWhitespace?: boolean;\n ignoreTerminator?: (\n character: string,\n point: SlatePoint,\n direction: \"before\" | \"after\"\n ) => boolean;\n}\n\nconst defaultOptions: Options = {\n direction: \"before\",\n allowConsecutiveWhitespace: true,\n};\n\nexport function getMatchRange(\n editor: SlateEditor,\n at: SlateRange,\n terminators: string[] = [\" \"],\n options: Options = defaultOptions\n): SlateRange | undefined {\n const { include, direction, ignoreTerminator, allowConsecutiveWhitespace } = {\n ...defaultOptions,\n ...options,\n };\n\n let [start, end] = SlateRange.edges(at);\n let point: SlatePoint = start;\n let previousCharacterWasWhitespace = false;\n\n function move(direction: \"before\" | \"after\"): boolean {\n const nextPoint =\n direction === \"after\"\n ? SlateEditor.after(editor, point, { unit: \"character\" })\n : SlateEditor.before(editor, point, { unit: \"character\" });\n\n // Stop if we reached the end of a block\n if (!nextPoint || SlatePath.compare(nextPoint.path, point.path) !== 0) {\n return false;\n }\n\n const nextCharacter =\n nextPoint &&\n SlateEditor.string(\n editor,\n direction === \"after\"\n ? { anchor: point, focus: nextPoint }\n : { anchor: nextPoint, focus: point }\n );\n const lastCharacter =\n nextCharacter &&\n nextCharacter[direction === \"after\" ? 0 : nextCharacter.length - 1];\n\n if (\n !allowConsecutiveWhitespace &&\n previousCharacterWasWhitespace &&\n isWhitespaceCharacter(lastCharacter)\n ) {\n return false;\n }\n\n if (\n nextPoint &&\n lastCharacter &&\n (!terminators.includes(lastCharacter) ||\n ignoreTerminator?.(lastCharacter, nextPoint, direction))\n ) {\n previousCharacterWasWhitespace = isWhitespaceCharacter(lastCharacter);\n point = nextPoint;\n\n if (point.offset === 0) {\n return false;\n }\n } else {\n return false;\n }\n\n return true;\n }\n\n if (direction !== \"before\") {\n point = end;\n while (move(\"after\"));\n end = point;\n }\n\n if (direction !== \"after\") {\n point = start;\n while (move(\"before\"));\n start = point;\n }\n\n if (include) {\n return {\n anchor:\n direction === \"before\" || direction === \"both\"\n ? (SlateEditor.before(editor, start, { unit: \"offset\" }) ?? start)\n : start,\n focus:\n direction === \"after\" || direction === \"both\"\n ? (SlateEditor.after(editor, end, { unit: \"offset\" }) ?? end)\n : end,\n };\n }\n\n return { anchor: start, focus: end };\n}\n"],"names":["SlateRange","direction","SlateEditor","SlatePath","isWhitespaceCharacter"],"mappings":";;;;;AAoBA,MAAM,cAA0B,GAAA;AAAA,EAC9B,SAAW,EAAA,QAAA;AAAA,EACX,0BAA4B,EAAA,IAAA;AAC9B,CAAA,CAAA;AAEgB,SAAA,aAAA,CACd,QACA,EACA,EAAA,WAAA,GAAwB,CAAC,GAAG,CAAA,EAC5B,UAAmB,cACK,EAAA;AACxB,EAAA,MAAM,EAAE,OAAA,EAAS,SAAW,EAAA,gBAAA,EAAkB,4BAA+B,GAAA;AAAA,IAC3E,GAAG,cAAA;AAAA,IACH,GAAG,OAAA;AAAA,GACL,CAAA;AAEA,EAAA,IAAI,CAAC,KAAO,EAAA,GAAG,CAAI,GAAAA,WAAA,CAAW,MAAM,EAAE,CAAA,CAAA;AACtC,EAAA,IAAI,KAAoB,GAAA,KAAA,CAAA;AACxB,EAAA,IAAI,8BAAiC,GAAA,KAAA,CAAA;AAErC,EAAA,SAAS,KAAKC,UAAwC,EAAA;AACpD,IAAA,MAAM,YACJA,UAAc,KAAA,OAAA,GACVC,aAAY,KAAM,CAAA,MAAA,EAAQ,OAAO,EAAE,IAAA,EAAM,aAAa,CAAA,GACtDA,aAAY,MAAO,CAAA,MAAA,EAAQ,OAAO,EAAE,IAAA,EAAM,aAAa,CAAA,CAAA;AAG7D,IAAI,IAAA,CAAC,aAAaC,UAAU,CAAA,OAAA,CAAQ,UAAU,IAAM,EAAA,KAAA,CAAM,IAAI,CAAA,KAAM,CAAG,EAAA;AACrE,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,aAAA,GACJ,aACAD,YAAY,CAAA,MAAA;AAAA,MACV,MAAA;AAAA,MACAD,UAAc,KAAA,OAAA,GACV,EAAE,MAAA,EAAQ,KAAO,EAAA,KAAA,EAAO,S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,CAAO,MAAQ,EAAA,KAAA,EAAO,EAAE,IAAA,EAAM,QAAS,EAAC,KAAK,KAC1D,GAAA,KAAA;AAAA,MACN,KACE,EAAA,SAAA,KAAc,OAAW,IAAA,SAAA,KAAc,SAClCA,YAAY,CAAA,KAAA,CAAM,MAAQ,EAAA,GAAA,EAAK,EAAE,IAAA,EAAM,QAAS,EAAC,KAAK,GACvD,GAAA,GAAA;AAAA,KACR,CAAA;AAAA,GACF;AAEA,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAO,EAAA,KAAA,EAAO,GAAI,EAAA,CAAA;AACrC;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-match-range.js","sources":["../../../../src/primitives/slate/utils/get-match-range.ts"],"sourcesContent":["import type { Point as SlatePoint } from \"slate\";\nimport {\n Editor as SlateEditor,\n Path as SlatePath,\n Range as SlateRange,\n} from \"slate\";\n\nimport { isWhitespaceCharacter } from \"./is-whitespace-character\";\n\ninterface Options {\n include?: boolean;\n direction?: \"before\" | \"after\" | \"both\";\n allowConsecutiveWhitespace?: boolean;\n ignoreTerminator?: (\n character: string,\n point: SlatePoint,\n direction: \"before\" | \"after\"\n ) => boolean;\n}\n\nconst defaultOptions: Options = {\n direction: \"before\",\n allowConsecutiveWhitespace: true,\n};\n\nexport function getMatchRange(\n editor: SlateEditor,\n at: SlateRange,\n terminators: string[] = [\" \"],\n options: Options = defaultOptions\n): SlateRange | undefined {\n const { include, direction, ignoreTerminator, allowConsecutiveWhitespace } = {\n ...defaultOptions,\n ...options,\n };\n\n let [start, end] = SlateRange.edges(at);\n let point: SlatePoint = start;\n let previousCharacterWasWhitespace = false;\n\n function move(direction: \"before\" | \"after\"): boolean {\n const nextPoint =\n direction === \"after\"\n ? SlateEditor.after(editor, point, { unit: \"character\" })\n : SlateEditor.before(editor, point, { unit: \"character\" });\n\n // Stop if we reached the end of a block\n if (!nextPoint || SlatePath.compare(nextPoint.path, point.path) !== 0) {\n return false;\n }\n\n const nextCharacter =\n nextPoint &&\n SlateEditor.string(\n editor,\n direction === \"after\"\n ? { anchor: point, focus: nextPoint }\n : { anchor: nextPoint, focus: point }\n );\n const lastCharacter =\n nextCharacter &&\n nextCharacter[direction === \"after\" ? 0 : nextCharacter.length - 1];\n\n if (\n !allowConsecutiveWhitespace &&\n previousCharacterWasWhitespace &&\n isWhitespaceCharacter(lastCharacter)\n ) {\n return false;\n }\n\n if (\n nextPoint &&\n lastCharacter &&\n (!terminators.includes(lastCharacter) ||\n ignoreTerminator?.(lastCharacter, nextPoint, direction))\n ) {\n previousCharacterWasWhitespace = isWhitespaceCharacter(lastCharacter);\n point = nextPoint;\n\n if (point.offset === 0) {\n return false;\n }\n } else {\n return false;\n }\n\n return true;\n }\n\n if (direction !== \"before\") {\n point = end;\n while (move(\"after\"));\n end = point;\n }\n\n if (direction !== \"after\") {\n point = start;\n while (move(\"before\"));\n start = point;\n }\n\n if (include) {\n return {\n anchor:\n direction === \"before\" || direction === \"both\"\n ? (SlateEditor.before(editor, start, { unit: \"offset\" }) ?? start)\n : start,\n focus:\n direction === \"after\" || direction === \"both\"\n ? (SlateEditor.after(editor, end, { unit: \"offset\" }) ?? end)\n : end,\n };\n }\n\n return { anchor: start, focus: end };\n}\n"],"names":["SlateRange","direction","SlateEditor","SlatePath"],"mappings":";;;AAoBA,MAAM,cAA0B,GAAA;AAAA,EAC9B,SAAW,EAAA,QAAA;AAAA,EACX,0BAA4B,EAAA,IAAA;AAC9B,CAAA,CAAA;AAEgB,SAAA,aAAA,CACd,QACA,EACA,EAAA,WAAA,GAAwB,CAAC,GAAG,CAAA,EAC5B,UAAmB,cACK,EAAA;AACxB,EAAA,MAAM,EAAE,OAAA,EAAS,SAAW,EAAA,gBAAA,EAAkB,4BAA+B,GAAA;AAAA,IAC3E,GAAG,cAAA;AAAA,IACH,GAAG,OAAA;AAAA,GACL,CAAA;AAEA,EAAA,IAAI,CAAC,KAAO,EAAA,GAAG,CAAI,GAAAA,KAAA,CAAW,MAAM,EAAE,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CAAM,WAAW,CAAG,EAAA;AACtB,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACK,MAAA;AACL,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EAAA,IAAI,cAAc,QAAU,EAAA;AAC1B,IAAQ,KAAA,GAAA,GAAA,CAAA;AACR,IAAA,OAAO,KAAK,OAAO,CAAA;AAAE,MAAA,CAAA;AACrB,IAAM,GAAA,GAAA,KAAA,CAAA;AAAA,GACR;AAEA,EAAA,IAAI,cAAc,OAAS,EAAA;AACzB,IAAQ,KAAA,GAAA,KAAA,CAAA;AACR,IAAA,OAAO,KAAK,QAAQ,CAAA;AAAE,MAAA,CAAA;AACtB,IAAQ,KAAA,GAAA,KAAA,CAAA;AAAA,GACV;AAEA,EAAA,IAAI,OAAS,EAAA;AACX,IAAO,OAAA;AAAA,MACL,MACE,EAAA,SAAA,KAAc,QAAY,IAAA,SAAA,KAAc,SACnCC,MAAY,CAAA,MAAA,CAAO,MAAQ,EAAA,KAAA,EAAO,EAAE,IAAA,EAAM,QAAS,EAAC,KAAK,KAC1D,GAAA,KAAA;AAAA,MACN,KACE,EAAA,SAAA,KAAc,OAAW,IAAA,SAAA,KAAc,SAClCA,MAAY,CAAA,KAAA,CAAM,MAAQ,EAAA,GAAA,EAAK,EAAE,IAAA,EAAM,QAAS,EAAC,KAAK,GACvD,GAAA,GAAA;AAAA,KACR,CAAA;AAAA,GACF;AAEA,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAO,EAAA,KAAA,EAAO,GAAI,EAAA,CAAA;AACrC;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-string.cjs","sources":["../../../../src/primitives/slate/utils/is-empty-string.ts"],"sourcesContent":["export function isEmptyString(string: string) {\n return !string.trim();\n}\n"],"names":[],"mappings":";;AAAO,SAAS,cAAc,MAAgB,EAAA;AAC5C,EAAO,OAAA,CAAC,OAAO,IAAK,EAAA,CAAA;AACtB;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty-string.js","sources":["../../../../src/primitives/slate/utils/is-empty-string.ts"],"sourcesContent":["export function isEmptyString(string: string) {\n return !string.trim();\n}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc,MAAgB,EAAA;AAC5C,EAAO,OAAA,CAAC,OAAO,IAAK,EAAA,CAAA;AACtB;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty.cjs","sources":["../../../../src/primitives/slate/utils/is-empty.ts"],"sourcesContent":["import type { Descendant as SlateDescendant } from \"slate\";\nimport { Editor as SlateEditor } from \"slate\";\n\nimport { isEmptyString } from \"./is-empty-string\";\nimport { isText } from \"./is-text\";\n\nexport function isEmpty(editor: SlateEditor, children: SlateDescendant[]) {\n // Check if all blocks are empty, stopping at the first non-empty block\n for (const child of children) {\n if (isText(child)) {\n // Non-empty text\n if (!isEmptyString(child.text)) {\n return false;\n }\n } else if (child.type === \"paragraph\") {\n // Non-empty paragraph\n if (\n child.children.length > 1 ||\n (child.children[0] &&\n !(isText(child.children[0]) && isEmptyString(child.children[0].text)))\n ) {\n return false;\n }\n } else {\n // Non-empty other block\n if (!SlateEditor.isEmpty(editor, child)) {\n return false;\n }\n }\n }\n\n return true;\n}\n"],"names":["isText","isEmptyString","SlateEditor"],"mappings":";;;;;;AAMgB,SAAA,OAAA,CAAQ,QAAqB,QAA6B,EAAA;AAExE,EAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC5B,IAAI,IAAAA,aAAA,CAAO,KAAK,CAAG,EAAA;AAEjB,MAAA,IAAI,CAACC,2BAAA,CAAc,KAAM,CAAA,IAAI,CAAG,EAAA;AAC9B,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACF,MAAA,IAAW,KAAM,CAAA,IAAA,KAAS,WAAa,EAAA;AAErC,MAAA,IACE,MAAM,QAAS,CAAA,MAAA,GAAS,KACvB,KAAM,CAAA,QAAA,CAAS,MACd,EAAED,aAAA,CAAO,KAAM,CAAA,QAAA,CAAS,EAAE,CAAK,IAAAC,2BAAA,CAAc,MAAM,QAAS,CAAA,CAAA,CAAA,CAAG,IAAI,CACrE,CAAA,EAAA;AACA,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACK,MAAA;AAEL,MAAA,IAAI,CAACC,YAAA,CAAY,OAAQ,CAAA,MAAA,EAAQ,KAAK,CAAG,EAAA;AACvC,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACF;AAAA,GACF;AAEA,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-empty.js","sources":["../../../../src/primitives/slate/utils/is-empty.ts"],"sourcesContent":["import type { Descendant as SlateDescendant } from \"slate\";\nimport { Editor as SlateEditor } from \"slate\";\n\nimport { isEmptyString } from \"./is-empty-string\";\nimport { isText } from \"./is-text\";\n\nexport function isEmpty(editor: SlateEditor, children: SlateDescendant[]) {\n // Check if all blocks are empty, stopping at the first non-empty block\n for (const child of children) {\n if (isText(child)) {\n // Non-empty text\n if (!isEmptyString(child.text)) {\n return false;\n }\n } else if (child.type === \"paragraph\") {\n // Non-empty paragraph\n if (\n child.children.length > 1 ||\n (child.children[0] &&\n !(isText(child.children[0]) && isEmptyString(child.children[0].text)))\n ) {\n return false;\n }\n } else {\n // Non-empty other block\n if (!SlateEditor.isEmpty(editor, child)) {\n return false;\n }\n }\n }\n\n return true;\n}\n"],"names":["SlateEditor"],"mappings":";;;;AAMgB,SAAA,OAAA,CAAQ,QAAqB,QAA6B,EAAA;AAExE,EAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC5B,IAAI,IAAA,MAAA,CAAO,KAAK,CAAG,EAAA;AAEjB,MAAA,IAAI,CAAC,aAAA,CAAc,KAAM,CAAA,IAAI,CAAG,EAAA;AAC9B,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACF,MAAA,IAAW,KAAM,CAAA,IAAA,KAAS,WAAa,EAAA;AAErC,MAAA,IACE,MAAM,QAAS,CAAA,MAAA,GAAS,KACvB,KAAM,CAAA,QAAA,CAAS,MACd,EAAE,MAAA,CAAO,KAAM,CAAA,QAAA,CAAS,EAAE,CAAK,IAAA,aAAA,CAAc,MAAM,QAAS,CAAA,CAAA,CAAA,CAAG,IAAI,CACrE,CAAA,EAAA;AACA,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACK,MAAA;AAEL,MAAA,IAAI,CAACA,MAAA,CAAY,OAAQ,CAAA,MAAA,EAAQ,KAAK,CAAG,EAAA;AACvC,QAAO,OAAA,KAAA,CAAA;AAAA,OACT;AAAA,KACF;AAAA,GACF;AAEA,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-text.cjs","sources":["../../../../src/primitives/slate/utils/is-text.ts"],"sourcesContent":["import type { Node as SlateNode, Text as SlateText } from \"slate\";\n\nexport function isText(element: SlateNode): element is SlateText {\n return (\n !(\"type\" in element) &&\n \"text\" in element &&\n typeof element.text === \"string\"\n );\n}\n\nexport function isPlainText(node: SlateNode): boolean {\n return isText(node) && Object.keys(node).length === 1;\n}\n"],"names":[],"mappings":";;AAEO,SAAS,OAAO,OAA0C,EAAA;AAC/D,EAAA,OACE,EAAE,MAAU,IAAA,OAAA,CAAA,IACZ,UAAU,OACV,IAAA,OAAO,QAAQ,IAAS,KAAA,QAAA,CAAA;AAE5B,CAAA;AAEO,SAAS,YAAY,IAA0B,EAAA;AACpD,EAAA,OAAO,OAAO,IAAI,CAAA,IAAK,OAAO,IAAK,CAAA,IAAI,EAAE,MAAW,KAAA,CAAA,CAAA;AACtD;;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-text.js","sources":["../../../../src/primitives/slate/utils/is-text.ts"],"sourcesContent":["import type { Node as SlateNode, Text as SlateText } from \"slate\";\n\nexport function isText(element: SlateNode): element is SlateText {\n return (\n !(\"type\" in element) &&\n \"text\" in element &&\n typeof element.text === \"string\"\n );\n}\n\nexport function isPlainText(node: SlateNode): boolean {\n return isText(node) && Object.keys(node).length === 1;\n}\n"],"names":[],"mappings":"AAEO,SAAS,OAAO,OAA0C,EAAA;AAC/D,EAAA,OACE,EAAE,MAAU,IAAA,OAAA,CAAA,IACZ,UAAU,OACV,IAAA,OAAO,QAAQ,IAAS,KAAA,QAAA,CAAA;AAE5B,CAAA;AAEO,SAAS,YAAY,IAA0B,EAAA;AACpD,EAAA,OAAO,OAAO,IAAI,CAAA,IAAK,OAAO,IAAK,CAAA,IAAI,EAAE,MAAW,KAAA,CAAA,CAAA;AACtD;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-whitespace-character.cjs","sources":["../../../../src/primitives/slate/utils/is-whitespace-character.ts"],"sourcesContent":["const WHITESPACE_REGEX = /\\s/;\n\nexport function isWhitespaceCharacter(character?: string): boolean {\n return character ? WHITESPACE_REGEX.test(character) : false;\n}\n"],"names":[],"mappings":";;AAAA,MAAM,gBAAmB,GAAA,IAAA,CAAA;AAElB,SAAS,sBAAsB,SAA6B,EAAA;AACjE,EAAA,OAAO,SAAY,GAAA,gBAAA,CAAiB,IAAK,CAAA,SAAS,CAAI,GAAA,KAAA,CAAA;AACxD;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-whitespace-character.js","sources":["../../../../src/primitives/slate/utils/is-whitespace-character.ts"],"sourcesContent":["const WHITESPACE_REGEX = /\\s/;\n\nexport function isWhitespaceCharacter(character?: string): boolean {\n return character ? WHITESPACE_REGEX.test(character) : false;\n}\n"],"names":[],"mappings":"AAAA,MAAM,gBAAmB,GAAA,IAAA,CAAA;AAElB,SAAS,sBAAsB,SAA6B,EAAA;AACjE,EAAA,OAAO,SAAY,GAAA,gBAAA,CAAiB,IAAK,CAAA,SAAS,CAAI,GAAA,KAAA,CAAA;AACxD;;;;"}
@@ -3,22 +3,22 @@
3
3
  var slate = require('slate');
4
4
  var getCharacter = require('./get-character.cjs');
5
5
 
6
- const defaultMarks = {
6
+ const defaultComposerBodyMarks = {
7
7
  bold: false,
8
8
  italic: false,
9
9
  strikethrough: false,
10
10
  code: false
11
11
  };
12
- function isMarkActive(editor, mark) {
13
- const marks = slate.Editor.marks(editor);
14
- return marks ? marks[mark] === true : false;
15
- }
16
- function getMarks(editor) {
12
+ function getComposerBodyMarks(editor) {
17
13
  if (!editor) {
18
- return { ...defaultMarks };
14
+ return { ...defaultComposerBodyMarks };
19
15
  }
20
16
  const marks = slate.Editor.marks(editor);
21
- return { ...defaultMarks, ...marks };
17
+ return { ...defaultComposerBodyMarks, ...marks };
18
+ }
19
+ function isMarkActive(editor, mark) {
20
+ const marks = slate.Editor.marks(editor);
21
+ return marks ? marks[mark] === true : false;
22
22
  }
23
23
  function filterActiveMarks(value) {
24
24
  return Object.keys(value ?? {}).filter(
@@ -54,7 +54,7 @@ function leaveMarkEdge(editor, edge) {
54
54
  }
55
55
 
56
56
  exports.filterActiveMarks = filterActiveMarks;
57
- exports.getMarks = getMarks;
57
+ exports.getComposerBodyMarks = getComposerBodyMarks;
58
58
  exports.isMarkActive = isMarkActive;
59
59
  exports.leaveMarkEdge = leaveMarkEdge;
60
60
  exports.removeMarks = removeMarks;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marks.cjs","sources":["../../../../src/primitives/slate/utils/marks.ts"],"sourcesContent":["import type { Text } from \"slate\";\nimport { Editor as SlateEditor, Range as SlateRange } from \"slate\";\n\nimport type { ComposerBodyMarks } from \"../../../types\";\nimport { getCharacterAfter, getCharacterBefore } from \"./get-character\";\n\nconst defaultComposerBodyMarks: Required<ComposerBodyMarks> = {\n bold: false,\n italic: false,\n strikethrough: false,\n code: false,\n};\n\nexport function getComposerBodyMarks(editor?: SlateEditor) {\n if (!editor) {\n return { ...defaultComposerBodyMarks };\n }\n\n const marks = SlateEditor.marks(editor);\n\n return { ...defaultComposerBodyMarks, ...marks };\n}\n\nexport function isMarkActive<M = ComposerBodyMarks>(\n editor: SlateEditor,\n mark: keyof M\n) {\n const marks = SlateEditor.marks(editor) as M | null;\n\n return marks ? marks[mark] === true : false;\n}\n\nexport function filterActiveMarks(\n value: Text | ComposerBodyMarks | null | undefined\n) {\n return Object.keys(value ?? {}).filter(\n (key) => key !== \"text\"\n ) as (keyof ComposerBodyMarks)[];\n}\n\nexport function toggleMark(editor: SlateEditor, mark: keyof ComposerBodyMarks) {\n const isActive = isMarkActive(editor, mark);\n\n if (isActive) {\n SlateEditor.removeMark(editor, mark);\n } else {\n SlateEditor.addMark(editor, mark, true);\n }\n}\n\nexport function removeMarks(editor: SlateEditor) {\n const marks = SlateEditor.marks(editor);\n\n if (marks) {\n for (const mark in marks) {\n SlateEditor.removeMark(editor, mark);\n }\n }\n}\n\nexport function leaveMarkEdge(editor: SlateEditor, edge: \"start\" | \"end\") {\n if (editor.selection && SlateRange.isCollapsed(editor.selection)) {\n const marks = Object.keys(SlateEditor.marks(editor) ?? {});\n\n if (marks.length > 0) {\n const sibling =\n edge === \"start\"\n ? getCharacterBefore(editor, editor.selection)\n : getCharacterAfter(editor, editor.selection);\n\n if (!sibling) {\n removeMarks(editor);\n }\n }\n }\n}\n"],"names":["SlateEditor","SlateRange","getCharacterBefore","getCharacterAfter"],"mappings":";;;;;AAMA,MAAM,wBAAwD,GAAA;AAAA,EAC5D,IAAM,EAAA,KAAA;AAAA,EACN,MAAQ,EAAA,KAAA;AAAA,EACR,aAAe,EAAA,KAAA;AAAA,EACf,IAAM,EAAA,KAAA;AACR,CAAA,CAAA;AAEO,SAAS,qBAAqB,MAAsB,EAAA;AACzD,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAO,OAAA,EAAE,GAAG,wBAAyB,EAAA,CAAA;AAAA,GACvC;AAEA,EAAM,MAAA,KAAA,GAAQA,YAAY,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AAEtC,EAAA,OAAO,EAAE,GAAG,wBAA0B,EAAA,GAAG,KAAM,EAAA,CAAA;AACjD,CAAA;A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CAAA,CAAA;AAEzD,IAAI,IAAA,KAAA,CAAM,SAAS,CAAG,EAAA;AACpB,MAAM,MAAA,OAAA,GACJ,IAAS,KAAA,OAAA,GACLE,+BAAmB,CAAA,MAAA,EAAQ,MAAO,CAAA,SAAS,CAC3C,GAAAC,8BAAA,CAAkB,MAAQ,EAAA,MAAA,CAAO,SAAS,CAAA,CAAA;AAEhD,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA,WAAA,CAAY,MAAM,CAAA,CAAA;AAAA,OACpB;AAAA,KACF;AAAA,GACF;AACF;;;;;;;;;"}
@@ -1,22 +1,22 @@
1
1
  import { Editor, Range } from 'slate';
2
2
  import { getCharacterBefore, getCharacterAfter } from './get-character.js';
3
3
 
4
- const defaultMarks = {
4
+ const defaultComposerBodyMarks = {
5
5
  bold: false,
6
6
  italic: false,
7
7
  strikethrough: false,
8
8
  code: false
9
9
  };
10
- function isMarkActive(editor, mark) {
11
- const marks = Editor.marks(editor);
12
- return marks ? marks[mark] === true : false;
13
- }
14
- function getMarks(editor) {
10
+ function getComposerBodyMarks(editor) {
15
11
  if (!editor) {
16
- return { ...defaultMarks };
12
+ return { ...defaultComposerBodyMarks };
17
13
  }
18
14
  const marks = Editor.marks(editor);
19
- return { ...defaultMarks, ...marks };
15
+ return { ...defaultComposerBodyMarks, ...marks };
16
+ }
17
+ function isMarkActive(editor, mark) {
18
+ const marks = Editor.marks(editor);
19
+ return marks ? marks[mark] === true : false;
20
20
  }
21
21
  function filterActiveMarks(value) {
22
22
  return Object.keys(value ?? {}).filter(
@@ -51,5 +51,5 @@ function leaveMarkEdge(editor, edge) {
51
51
  }
52
52
  }
53
53
 
54
- export { filterActiveMarks, getMarks, isMarkActive, leaveMarkEdge, removeMarks, toggleMark };
54
+ export { filterActiveMarks, getComposerBodyMarks, isMarkActive, leaveMarkEdge, removeMarks, toggleMark };
55
55
  //# sourceMappingURL=marks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marks.js","sources":["../../../../src/primitives/slate/utils/marks.ts"],"sourcesContent":["import type { Text } from \"slate\";\nimport { Editor as SlateEditor, Range as SlateRange } from \"slate\";\n\nimport type { ComposerBodyMarks } from \"../../../types\";\nimport { getCharacterAfter, getCharacterBefore } from \"./get-character\";\n\nconst defaultComposerBodyMarks: Required<ComposerBodyMarks> = {\n bold: false,\n italic: false,\n strikethrough: false,\n code: false,\n};\n\nexport function getComposerBodyMarks(editor?: SlateEditor) {\n if (!editor) {\n return { ...defaultComposerBodyMarks };\n }\n\n const marks = SlateEditor.marks(editor);\n\n return { ...defaultComposerBodyMarks, ...marks };\n}\n\nexport function isMarkActive<M = ComposerBodyMarks>(\n editor: SlateEditor,\n mark: keyof M\n) {\n const marks = SlateEditor.marks(editor) as M | null;\n\n return marks ? marks[mark] === true : false;\n}\n\nexport function filterActiveMarks(\n value: Text | ComposerBodyMarks | null | undefined\n) {\n return Object.keys(value ?? {}).filter(\n (key) => key !== \"text\"\n ) as (keyof ComposerBodyMarks)[];\n}\n\nexport function toggleMark(editor: SlateEditor, mark: keyof ComposerBodyMarks) {\n const isActive = isMarkActive(editor, mark);\n\n if (isActive) {\n SlateEditor.removeMark(editor, mark);\n } else {\n SlateEditor.addMark(editor, mark, true);\n }\n}\n\nexport function removeMarks(editor: SlateEditor) {\n const marks = SlateEditor.marks(editor);\n\n if (marks) {\n for (const mark in marks) {\n SlateEditor.removeMark(editor, mark);\n }\n }\n}\n\nexport function leaveMarkEdge(editor: SlateEditor, edge: \"start\" | \"end\") {\n if (editor.selection && SlateRange.isCollapsed(editor.selection)) {\n const marks = Object.keys(SlateEditor.marks(editor) ?? {});\n\n if (marks.length > 0) {\n const sibling =\n edge === \"start\"\n ? getCharacterBefore(editor, editor.selection)\n : getCharacterAfter(editor, editor.selection);\n\n if (!sibling) {\n removeMarks(editor);\n }\n }\n }\n}\n"],"names":["SlateEditor","SlateRange"],"mappings":";;;AAMA,MAAM,wBAAwD,GAAA;AAAA,EAC5D,IAAM,EAAA,KAAA;A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EAAA,IAAI,KAAO,EAAA;AACT,IAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,MAAYA,MAAA,CAAA,UAAA,CAAW,QAAQ,IAAI,CAAA,CAAA;AAAA,KACrC;AAAA,GACF;AACF,CAAA;AAEgB,SAAA,aAAA,CAAc,QAAqB,IAAuB,EAAA;AACxE,EAAA,IAAI,OAAO,SAAa,IAAAC,KAAA,CAAW,WAAY,CAAA,MAAA,CAAO,SAAS,CAAG,EAAA;AAChE,IAAM,MAAA,KAAA,GAAQ,OAAO,IAAK,CAAAD,MAAA,CAAY,MAAM,MAAM,CAAA,IAAK,EAAE,CAAA,CAAA;AAEzD,IAAI,IAAA,KAAA,CAAM,SAAS,CAAG,EAAA;AACpB,MAAM,MAAA,OAAA,GACJ,IAAS,KAAA,OAAA,GACL,kBAAmB,CAAA,MAAA,EAAQ,MAAO,CAAA,SAAS,CAC3C,GAAA,iBAAA,CAAkB,MAAQ,EAAA,MAAA,CAAO,SAAS,CAAA,CAAA;AAEhD,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA,WAAA,CAAY,MAAM,CAAA,CAAA;AAAA,OACpB;AAAA,KACF;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-contains-inlines.cjs","sources":["../../../../src/primitives/slate/utils/selection-contains-inlines.ts"],"sourcesContent":["import type { Node as SlateNode } from \"slate\";\nimport {\n Editor as SlateEditor,\n Element as SlateElement,\n Range as SlateRange,\n} from \"slate\";\n\nexport function selectionContainsInlines(\n editor: SlateEditor,\n match: (node: SlateNode) => boolean\n) {\n const { selection } = editor;\n if (!selection) {\n return false;\n }\n\n const roots = Array.from(\n SlateEditor.nodes(editor, {\n at: selection,\n match: (node) =>\n SlateElement.isElement(node) && SlateEditor.isBlock(editor, node),\n mode: \"lowest\",\n })\n );\n\n for (const [, rootPath] of roots) {\n const intersectingSelection = SlateRange.isRange(selection)\n ? SlateRange.intersection(selection, SlateEditor.range(editor, rootPath))\n : selection;\n\n if (!intersectingSelection) {\n continue;\n }\n\n const matches = Array.from(\n SlateEditor.nodes(editor, {\n at: intersectingSelection,\n match: (node) =>\n SlateEditor.isInline(editor, node as SlateElement) && match(node),\n })\n );\n\n if (matches.length > 0) {\n return true;\n }\n }\n\n return false;\n}\n"],"names":["SlateEditor","SlateElement","SlateRange"],"mappings":";;;;AAOgB,SAAA,wBAAA,CACd,QACA,KACA,EAAA;AACA,EAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AACtB,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,QAAQ,KAAM,CAAA,IAAA;AAAA,IAClBA,YAAA,CAAY,MAAM,MAAQ,EAAA;AAAA,MACxB,EAAI,EAAA,SAAA;AAAA,MACJ,KAAA,EAAO,CAAC,IAAA,KACNC,aAAa,CAAA,SAAA,CAAU,IAAI,CAAK,IAAAD,YAAA,CAAY,OAAQ,CAAA,MAAA,EAAQ,IAAI,CAAA;AAAA,MAClE,IAAM,EAAA,QAAA;AAAA,KACP,CAAA;AAAA,GACH,CAAA;AAEA,EAAA,KAAA,MAAW,GAAG,QAAQ,CAAA,IAAK,KAAO,EAAA;AAChC,IAAA,MAAM,qBAAwB,GAAAE,WAAA,CAAW,OAAQ,CAAA,SAAS,CACtD,GAAAA,WAAA,CAAW,YAAa,CAAA,SAAA,EAAWF,YAAY,CAAA,KAAA,CAAM,MAAQ,EAAA,QAAQ,CAAC,CACtE,GAAA,SAAA,CAAA;AAEJ,IAAA,IAAI,CAAC,qBAAuB,EAAA;AAC1B,MAAA,SAAA;AAAA,KACF;AAEA,IAAA,MAAM,UAAU,KAAM,CAAA,IAAA;AAAA,MACpBA,YAAA,CAAY,MAAM,MAAQ,EAAA;AAAA,QACxB,EAAI,EAAA,qBAAA;AAAA,QACJ,KAAA,EAAO,CAAC,IACN,KAAAA,YAAA,CAAY,SAAS,MAAQ,EAAA,IAAoB,CAAK,IAAA,KAAA,CAAM,IAAI,CAAA;AAAA,OACnE,CAAA;AAAA,KACH,CAAA;AAEA,IAAI,IAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AACtB,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACF;AAEA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-contains-inlines.js","sources":["../../../../src/primitives/slate/utils/selection-contains-inlines.ts"],"sourcesContent":["import type { Node as SlateNode } from \"slate\";\nimport {\n Editor as SlateEditor,\n Element as SlateElement,\n Range as SlateRange,\n} from \"slate\";\n\nexport function selectionContainsInlines(\n editor: SlateEditor,\n match: (node: SlateNode) => boolean\n) {\n const { selection } = editor;\n if (!selection) {\n return false;\n }\n\n const roots = Array.from(\n SlateEditor.nodes(editor, {\n at: selection,\n match: (node) =>\n SlateElement.isElement(node) && SlateEditor.isBlock(editor, node),\n mode: \"lowest\",\n })\n );\n\n for (const [, rootPath] of roots) {\n const intersectingSelection = SlateRange.isRange(selection)\n ? SlateRange.intersection(selection, SlateEditor.range(editor, rootPath))\n : selection;\n\n if (!intersectingSelection) {\n continue;\n }\n\n const matches = Array.from(\n SlateEditor.nodes(editor, {\n at: intersectingSelection,\n match: (node) =>\n SlateEditor.isInline(editor, node as SlateElement) && match(node),\n })\n );\n\n if (matches.length > 0) {\n return true;\n }\n }\n\n return false;\n}\n"],"names":["SlateEditor","SlateElement","SlateRange"],"mappings":";;AAOgB,SAAA,wBAAA,CACd,QACA,KACA,EAAA;AACA,EAAM,MAAA,EAAE,WAAc,GAAA,MAAA,CAAA;AACtB,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,QAAQ,KAAM,CAAA,IAAA;AAAA,IAClBA,MAAA,CAAY,MAAM,MAAQ,EAAA;AAAA,MACxB,EAAI,EAAA,SAAA;AAAA,MACJ,KAAA,EAAO,CAAC,IAAA,KACNC,OAAa,CAAA,SAAA,CAAU,IAAI,CAAK,IAAAD,MAAA,CAAY,OAAQ,CAAA,MAAA,EAAQ,IAAI,CAAA;AAAA,MAClE,IAAM,EAAA,QAAA;AAAA,KACP,CAAA;AAAA,GACH,CAAA;AAEA,EAAA,KAAA,MAAW,GAAG,QAAQ,CAAA,IAAK,KAAO,EAAA;AAChC,IAAA,MAAM,qBAAwB,GAAAE,KAAA,CAAW,OAAQ,CAAA,SAAS,CACtD,GAAAA,KAAA,CAAW,YAAa,CAAA,SAAA,EAAWF,MAAY,CAAA,KAAA,CAAM,MAAQ,EAAA,QAAQ,CAAC,CACtE,GAAA,SAAA,CAAA;AAEJ,IAAA,IAAI,CAAC,qBAAuB,EAAA;AAC1B,MAAA,SAAA;AAAA,KACF;AAEA,IAAA,MAAM,UAAU,KAAM,CAAA,IAAA;AAAA,MACpBA,MAAA,CAAY,MAAM,MAAQ,EAAA;AAAA,QACxB,EAAI,EAAA,qBAAA;AAAA,QACJ,KAAA,EAAO,CAAC,IACN,KAAAA,MAAA,CAAY,SAAS,MAAQ,EAAA,IAAoB,CAAK,IAAA,KAAA,CAAM,IAAI,CAAA;AAAA,OACnE,CAAA;AAAA,KACH,CAAA;AAEA,IAAI,IAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AACtB,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACF;AAEA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+
6
+ const ErrorBoundaryContext = react.createContext(null);
7
+ class ErrorBoundary extends react.Component {
8
+ constructor(props) {
9
+ super(props);
10
+ this.state = { error: null };
11
+ }
12
+ static getDerivedStateFromError(error) {
13
+ return { error };
14
+ }
15
+ componentDidCatch(error, errorInfo) {
16
+ console.error(error, errorInfo);
17
+ }
18
+ reset() {
19
+ this.setState({ error: null });
20
+ }
21
+ render() {
22
+ if (this.state.error === null)
23
+ return this.props.children;
24
+ const error = this.state.error;
25
+ const reset = this.reset.bind(this);
26
+ const fallback = this.props.fallback;
27
+ const Fallback = typeof fallback === "function" ? fallback : () => fallback ?? null;
28
+ return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundaryContext.Provider, {
29
+ value: { error, reset },
30
+ children: /* @__PURE__ */ jsxRuntime.jsx(Fallback, {
31
+ error: this.state.error
32
+ })
33
+ });
34
+ }
35
+ }
36
+ function useErrorBoundary() {
37
+ const context = react.useContext(ErrorBoundaryContext);
38
+ if (context === null) {
39
+ throw new Error(
40
+ "useErrorBoundary must be used within an ErrorBoundary component"
41
+ );
42
+ }
43
+ return context;
44
+ }
45
+
46
+ exports.ErrorBoundary = ErrorBoundary;
47
+ exports.useErrorBoundary = useErrorBoundary;
48
+ //# sourceMappingURL=ErrorBoundary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.cjs","sources":["../../src/utils/ErrorBoundary.tsx"],"sourcesContent":["import type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport { Component, createContext, useContext } from \"react\";\n\nconst ErrorBoundaryContext = createContext<{\n error: Error;\n reset: () => void;\n} | null>(null);\n\nexport interface ErrorBoundaryProps {\n children?: ReactNode;\n fallback?: ReactNode | ComponentType<{ error: Error }>;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\n}\n\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n console.error(error, errorInfo);\n }\n\n reset() {\n this.setState({ error: null });\n }\n\n render(): React.ReactNode {\n if (this.state.error === null) return this.props.children;\n\n const error = this.state.error;\n const reset = this.reset.bind(this);\n const fallback = this.props.fallback;\n const Fallback =\n typeof fallback === \"function\" ? fallback : () => fallback ?? null;\n return (\n <ErrorBoundaryContext.Provider value={{ error, reset }}>\n <Fallback error={this.state.error} />\n </ErrorBoundaryContext.Provider>\n );\n }\n}\n\nexport function useErrorBoundary(): {\n error: Error;\n reset: () => void;\n} {\n const context = useContext(ErrorBoundaryContext);\n\n if (context === null) {\n throw new Error(\n \"useErrorBoundary must be used within an ErrorBoundary component\"\n );\n }\n\n return context;\n}\n"],"names":["createContext","Component","jsx","useContext"],"mappings":";;;;;AAGA,MAAM,oBAAA,GAAuBA,oBAGnB,IAAI,CAAA,CAAA;AAWP,MAAM,sBAAsBC,eAGjC,CAAA;AAAA,EACA,YAAY,KAA2B,EAAA;AACrC,IAAA,KAAA,CAAM,KAAK,CAAA,CAAA;AACX,IAAK,IAAA,CAAA,KAAA,GAAQ,EAAE,KAAA,EAAO,IAAK,EAAA,CAAA;AAAA,GAC7B;AAAA,EAEA,OAAO,yBAAyB,KAAc,EAAA;AAC5C,IAAA,OAAO,EAAE,KAAM,EAAA,CAAA;AAAA,GACjB;AAAA,EAEA,iBAAA,CAAkB,OAAc,SAA4B,EAAA;AAC1D,IAAQ,OAAA,CAAA,KAAA,CAAM,OAAO,SAAS,CAAA,CAAA;AAAA,GAChC;AAAA,EAEA,KAAQ,GAAA;AACN,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,KAAO,EAAA,IAAA,EAAM,CAAA,CAAA;AAAA,GAC/B;AAAA,EAEA,MAA0B,GAAA;AACxB,IAAI,IAAA,IAAA,CAAK,MAAM,KAAU,KAAA,IAAA;AAAM,MAAA,OAAO,KAAK,KAAM,CAAA,QAAA,CAAA;AAEjD,IAAM,MAAA,KAAA,GAAQ,KAAK,KAAM,CAAA,KAAA,CAAA;AACzB,IAAA,MAAM,KAAQ,GAAA,IAAA,CAAK,KAAM,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAClC,IAAM,MAAA,QAAA,GAAW,KAAK,KAAM,CAAA,QAAA,CAAA;AAC5B,IAAA,MAAM,WACJ,OAAO,QAAA,KAAa,UAAa,GAAA,QAAA,GAAW,MAAM,QAAY,IAAA,IAAA,CAAA;AAChE,IACE,uBAAAC,cAAA,CAAC,qBAAqB,QAArB,EAAA;AAAA,MAA8B,KAAA,EAAO,EAAE,KAAA,EAAO,KAAM,EAAA;AAAA,MACnD,QAAC,kBAAAA,cAAA,CAAA,QAAA,EAAA;AAAA,QAAS,KAAA,EAAO,KAAK,KAAM,CAAA,KAAA;AAAA,OAAO,CAAA;AAAA,KACrC,CAAA,CAAA;AAAA,GAEJ;AACF,CAAA;AAEO,SAAS,gBAGd,GAAA;AACA,EAAM,MAAA,OAAA,GAAUC,iBAAW,oBAAoB,CAAA,CAAA;AAE/C,EAAA,IAAI,YAAY,IAAM,EAAA;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,iEAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAO,OAAA,OAAA,CAAA;AACT;;;;;"}
@@ -0,0 +1,45 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, Component, useContext } from 'react';
3
+
4
+ const ErrorBoundaryContext = createContext(null);
5
+ class ErrorBoundary extends Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.state = { error: null };
9
+ }
10
+ static getDerivedStateFromError(error) {
11
+ return { error };
12
+ }
13
+ componentDidCatch(error, errorInfo) {
14
+ console.error(error, errorInfo);
15
+ }
16
+ reset() {
17
+ this.setState({ error: null });
18
+ }
19
+ render() {
20
+ if (this.state.error === null)
21
+ return this.props.children;
22
+ const error = this.state.error;
23
+ const reset = this.reset.bind(this);
24
+ const fallback = this.props.fallback;
25
+ const Fallback = typeof fallback === "function" ? fallback : () => fallback ?? null;
26
+ return /* @__PURE__ */ jsx(ErrorBoundaryContext.Provider, {
27
+ value: { error, reset },
28
+ children: /* @__PURE__ */ jsx(Fallback, {
29
+ error: this.state.error
30
+ })
31
+ });
32
+ }
33
+ }
34
+ function useErrorBoundary() {
35
+ const context = useContext(ErrorBoundaryContext);
36
+ if (context === null) {
37
+ throw new Error(
38
+ "useErrorBoundary must be used within an ErrorBoundary component"
39
+ );
40
+ }
41
+ return context;
42
+ }
43
+
44
+ export { ErrorBoundary, useErrorBoundary };
45
+ //# sourceMappingURL=ErrorBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.js","sources":["../../src/utils/ErrorBoundary.tsx"],"sourcesContent":["import type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport { Component, createContext, useContext } from \"react\";\n\nconst ErrorBoundaryContext = createContext<{\n error: Error;\n reset: () => void;\n} | null>(null);\n\nexport interface ErrorBoundaryProps {\n children?: ReactNode;\n fallback?: ReactNode | ComponentType<{ error: Error }>;\n}\n\ninterface ErrorBoundaryState {\n error: Error | null;\n}\n\nexport class ErrorBoundary extends Component<\n ErrorBoundaryProps,\n ErrorBoundaryState\n> {\n constructor(props: ErrorBoundaryProps) {\n super(props);\n this.state = { error: null };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n console.error(error, errorInfo);\n }\n\n reset() {\n this.setState({ error: null });\n }\n\n render(): React.ReactNode {\n if (this.state.error === null) return this.props.children;\n\n const error = this.state.error;\n const reset = this.reset.bind(this);\n const fallback = this.props.fallback;\n const Fallback =\n typeof fallback === \"function\" ? fallback : () => fallback ?? null;\n return (\n <ErrorBoundaryContext.Provider value={{ error, reset }}>\n <Fallback error={this.state.error} />\n </ErrorBoundaryContext.Provider>\n );\n }\n}\n\nexport function useErrorBoundary(): {\n error: Error;\n reset: () => void;\n} {\n const context = useContext(ErrorBoundaryContext);\n\n if (context === null) {\n throw new Error(\n \"useErrorBoundary must be used within an ErrorBoundary component\"\n );\n }\n\n return context;\n}\n"],"names":[],"mappings":";;;AAGA,MAAM,oBAAA,GAAuB,cAGnB,IAAI,CAAA,CAAA;AAWP,MAAM,sBAAsB,SAGjC,CAAA;AAAA,EACA,YAAY,KAA2B,EAAA;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