@remarkablejames/editor 0.0.5 → 0.0.7

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 (194) hide show
  1. package/README.md +1 -1
  2. package/lib/ActionMenuButton-D9o3Kwmv.cjs +1 -0
  3. package/lib/{ActionMenuButton-DBZjUu-F.js → ActionMenuButton-nxV91Fqo.js} +10 -9
  4. package/lib/Attachment.cjs +19 -1
  5. package/lib/Attachment.js +270 -7
  6. package/lib/Blockquote.cjs +2 -2
  7. package/lib/Blockquote.js +12 -13
  8. package/lib/Bold.cjs +1 -1
  9. package/lib/Bold.js +10 -11
  10. package/lib/BulletList.cjs +1 -1
  11. package/lib/BulletList.js +8 -9
  12. package/lib/Callout.cjs +1 -1
  13. package/lib/Callout.js +45 -41
  14. package/lib/Clear.cjs +1 -1
  15. package/lib/Clear.js +14 -13
  16. package/lib/Code.cjs +1 -1
  17. package/lib/Code.js +5 -6
  18. package/lib/CodeBlock.cjs +1 -1
  19. package/lib/CodeBlock.js +31 -30
  20. package/lib/CodeView.cjs +1 -1
  21. package/lib/CodeView.js +8 -9
  22. package/lib/Color.cjs +1 -1
  23. package/lib/Color.js +19 -18
  24. package/lib/Column.cjs +1 -1
  25. package/lib/Column.js +8 -9
  26. package/lib/Drawer-Bh-y5bs8.cjs +2 -0
  27. package/lib/{Drawer-DTCwtJEs.js → Drawer-CF6Z_IA2.js} +24 -18
  28. package/lib/Drawer.cjs +1 -1
  29. package/lib/Drawer.js +3 -3
  30. package/lib/Emoji.cjs +1 -1
  31. package/lib/Emoji.js +15 -14
  32. package/lib/Excalidraw.cjs +1 -1
  33. package/lib/Excalidraw.js +33 -28
  34. package/lib/ExportPdf.cjs +3 -3
  35. package/lib/ExportPdf.js +13 -14
  36. package/lib/ExportWord.cjs +1 -1
  37. package/lib/ExportWord.js +6 -6
  38. package/lib/FontFamily.cjs +1 -1
  39. package/lib/FontFamily.js +6 -7
  40. package/lib/FontSize.cjs +1 -1
  41. package/lib/FontSize.js +14 -15
  42. package/lib/Heading.cjs +1 -1
  43. package/lib/Heading.js +26 -26
  44. package/lib/Highlight.cjs +1 -1
  45. package/lib/Highlight.js +23 -22
  46. package/lib/History.cjs +1 -1
  47. package/lib/History.js +11 -11
  48. package/lib/HorizontalRule.cjs +1 -1
  49. package/lib/HorizontalRule.js +9 -10
  50. package/lib/Icon-BvGyfX2j.js +15 -0
  51. package/lib/Icon-wjwoRc9F.cjs +1 -0
  52. package/lib/Iframe-BbfZKbPY.cjs +1 -0
  53. package/lib/{Iframe-D-UYBxiv.js → Iframe-Dfd3LI7b.js} +18 -15
  54. package/lib/Iframe.cjs +1 -1
  55. package/lib/Iframe.js +3 -3
  56. package/lib/Image.cjs +1 -1
  57. package/lib/Image.js +5 -4
  58. package/lib/ImageCropper-CY1ETEjC.cjs +10 -0
  59. package/lib/ImageCropper-DrSdjo9x.js +979 -0
  60. package/lib/ImageGif.cjs +1 -1
  61. package/lib/ImageGif.js +80 -77
  62. package/lib/ImportWord.cjs +1 -1
  63. package/lib/ImportWord.js +28 -26
  64. package/lib/{Indent-Bvt-Qwar.js → Indent-CDVF9DWN.js} +30 -31
  65. package/lib/Indent-Q1VuhSM2.cjs +1 -0
  66. package/lib/Indent.cjs +1 -1
  67. package/lib/Indent.js +2 -2
  68. package/lib/Italic.cjs +1 -1
  69. package/lib/Italic.js +11 -12
  70. package/lib/{Katex-CJDtvu-v.js → Katex-DqhWWAA-.js} +22 -19
  71. package/lib/Katex-K1QU2SB2.cjs +4 -0
  72. package/lib/Katex.cjs +1 -1
  73. package/lib/Katex.js +2 -2
  74. package/lib/LineHeight.cjs +1 -1
  75. package/lib/LineHeight.js +20 -19
  76. package/lib/Link.cjs +1 -1
  77. package/lib/Link.js +2 -2
  78. package/lib/LinkEditBlock-CBYGLs3J.cjs +5 -0
  79. package/lib/{LinkEditBlock-Cdqwj_NU.js → LinkEditBlock-xP0pGVhB.js} +24 -19
  80. package/lib/Mention.js +3 -3
  81. package/lib/{Mermaid-CnMYVX1P.js → Mermaid-BJ6ryVdY.js} +48 -45
  82. package/lib/Mermaid-D3_nLeOW.cjs +2 -0
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +2 -2
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +28 -26
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +10 -11
  89. package/lib/PaywallSeparator.cjs +1 -0
  90. package/lib/PaywallSeparator.js +140 -0
  91. package/lib/SearchAndReplace.cjs +1 -1
  92. package/lib/SearchAndReplace.js +42 -37
  93. package/lib/SlashCommand.cjs +1 -1
  94. package/lib/SlashCommand.js +5 -5
  95. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
  96. package/lib/{SlashCommandNodeView-DcoLvt_6.js → SlashCommandNodeView-DS9FqMiY.js} +80 -62
  97. package/lib/Strike.cjs +1 -1
  98. package/lib/Strike.js +11 -12
  99. package/lib/Table-CV6pUoVf.cjs +5 -0
  100. package/lib/{Table-Cu12PvQ_.js → Table-CcG-JNtV.js} +46 -46
  101. package/lib/Table.cjs +1 -1
  102. package/lib/Table.js +1 -1
  103. package/lib/TaskList.cjs +1 -1
  104. package/lib/TaskList.js +11 -12
  105. package/lib/TextAlign.cjs +1 -1
  106. package/lib/TextAlign.js +27 -26
  107. package/lib/TextDirection.cjs +1 -1
  108. package/lib/TextDirection.js +19 -18
  109. package/lib/TextUnderline.cjs +1 -1
  110. package/lib/TextUnderline.js +8 -9
  111. package/lib/{Twitter-CrX4XY1j.js → Twitter-BIL3o833.js} +22 -18
  112. package/lib/Twitter-BfSTqPDh.cjs +1 -0
  113. package/lib/Twitter.cjs +1 -1
  114. package/lib/Twitter.js +2 -2
  115. package/lib/Video-DAKr90QL.js +231 -0
  116. package/lib/Video-HAinT0w6.cjs +1 -0
  117. package/lib/Video.cjs +1 -1
  118. package/lib/Video.js +5 -4
  119. package/lib/bubble.cjs +3 -3
  120. package/lib/bubble.js +86 -77
  121. package/lib/button-090-I3tp.js +35 -0
  122. package/lib/button-B4Sz2ZhW.cjs +1 -0
  123. package/lib/checkbox-BCPsu7yR.cjs +1 -0
  124. package/lib/checkbox-DiXWHAI0.js +29 -0
  125. package/lib/{clsx-BUPZHhq3.js → clsx-m_C5j3RU.js} +24 -24
  126. package/lib/components/RichTextProvider.d.ts +1 -1
  127. package/lib/dialog-C8J59d2J.cjs +1 -0
  128. package/lib/dialog-bDkDW-C_.js +95 -0
  129. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  130. package/lib/dom-dataset-CIEeltF6.js +47 -0
  131. package/lib/{dropdown-menu-CVwXaR3Z.js → dropdown-menu-DWt_xj4h.js} +1 -1
  132. package/lib/{dropdown-menu-XIrQk3jr.cjs → dropdown-menu-tUP872Zv.cjs} +1 -1
  133. package/lib/events.constant-Bke62qxm.cjs +1 -0
  134. package/lib/events.constant-CSWD3-ho.js +72 -0
  135. package/lib/extensions/PaywallSeparator/PaywallSeparator.d.ts +35 -0
  136. package/lib/extensions/PaywallSeparator/components/PaywallIcon.d.ts +2 -0
  137. package/lib/extensions/PaywallSeparator/components/PaywallSeparatorView.d.ts +17 -0
  138. package/lib/extensions/PaywallSeparator/components/RichTextPaywallSeparator.d.ts +1 -0
  139. package/lib/extensions/PaywallSeparator/components/index.d.ts +2 -0
  140. package/lib/extensions/PaywallSeparator/index.d.ts +1 -0
  141. package/lib/file-i7e4nQY2.cjs +1 -0
  142. package/lib/file-jDdkhyj7.js +43 -0
  143. package/lib/{index-RkKGy5oa.js → index-B3Ijnbxs.js} +1 -1
  144. package/lib/index-BXh8X1ch.cjs +1 -0
  145. package/lib/{index-Dl3OjzmR.js → index-C1KQsOcg.js} +1 -1
  146. package/lib/{index-D4M4hrH4.js → index-C8FjP66D.js} +1 -1
  147. package/lib/index-jMN4V2hr.js +2763 -0
  148. package/lib/{index-DZj2z9_1.js → index-s3l5RdyW.js} +1 -1
  149. package/lib/index.cjs +4 -4
  150. package/lib/index.js +464 -149
  151. package/lib/input-C_J-pfTx.js +21 -0
  152. package/lib/input-DwLo4r7V.cjs +1 -0
  153. package/lib/isNumber-BTYSVlKo.cjs +1 -0
  154. package/lib/isNumber-WaBzl_0s.js +15 -0
  155. package/lib/label-BgIVynq3.cjs +1 -0
  156. package/lib/label-ClsOg9Hr.js +11 -0
  157. package/lib/{popover-DDT8YRht.js → popover-BC7FRr8B.js} +1 -1
  158. package/lib/{popover-0syCfWYi.cjs → popover-C3A6zzNV.cjs} +1 -1
  159. package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
  160. package/lib/{select-DTNz0ZeE.cjs → select-B8HIWDXf.cjs} +1 -1
  161. package/lib/{select-D9wQw2qB.js → select-DSKqhVGR.js} +1 -1
  162. package/lib/{separator-DRGTEiX4.js → separator-BJWSNjvr.js} +13 -12
  163. package/lib/separator-D6ruF682.cjs +1 -0
  164. package/lib/style.css +1 -1
  165. package/lib/tabs-D1J1iB7B.js +46 -0
  166. package/lib/tabs-IEbMQmNX.cjs +1 -0
  167. package/lib/{textarea-DfVzbMr5.js → textarea-Ch5w3PiI.js} +1 -1
  168. package/lib/{textarea-DpkwluT0.cjs → textarea-CtVdqwSM.cjs} +1 -1
  169. package/lib/theme.cjs +1 -1
  170. package/lib/theme.js +18 -18
  171. package/lib/throttle-CRNq0z-O.js +249 -0
  172. package/lib/throttle-gTTvqDTW.cjs +1 -0
  173. package/lib/toggle-C9tcMm1r.cjs +1 -0
  174. package/lib/toggle-CaSwYCk4.js +89 -0
  175. package/lib/types.d.ts +5 -5
  176. package/lib/{updatePosition-C294Pixi.js → updatePosition-DvfTZHcH.js} +2 -2
  177. package/lib/use-toast-C6zPo25l.cjs +1 -0
  178. package/lib/use-toast-CEOqhXfx.js +97 -0
  179. package/lib/useButtonProps-D-ruygH7.js +165 -0
  180. package/lib/useButtonProps-D9ndBdmA.cjs +1 -0
  181. package/package.json +34 -32
  182. package/lib/ActionMenuButton-C6jGtl3k.cjs +0 -1
  183. package/lib/Drawer-B031ezmA.cjs +0 -2
  184. package/lib/Iframe-BUK2pkOL.cjs +0 -1
  185. package/lib/Indent-_y6N8MIQ.cjs +0 -1
  186. package/lib/Katex-bJXkt-VP.cjs +0 -4
  187. package/lib/LinkEditBlock-ewTApx0K.cjs +0 -5
  188. package/lib/Mermaid-Dwz9o-yM.cjs +0 -2
  189. package/lib/SlashCommandNodeView-BMgQJ4xT.cjs +0 -1
  190. package/lib/Table-B8CHl8jK.cjs +0 -5
  191. package/lib/Twitter-6HYP_upt.cjs +0 -1
  192. package/lib/index-B0d-u29p.js +0 -5425
  193. package/lib/index-De9MZVWQ.cjs +0 -28
  194. package/lib/separator-D8lOAf8f.cjs +0 -1
package/lib/Callout.js CHANGED
@@ -1,50 +1,54 @@
1
- import { h as D, j as x, N as H, k as M, m as B } from "./clsx-BUPZHhq3.js";
2
- import { h as V, u as j, d as P, D as E, m as R, A as T, n as W, o as F, L as u, j as v, p as U, B as C } from "./index-B0d-u29p.js";
3
- import { jsx as o, jsxs as l, Fragment as Y } from "react/jsx-runtime";
1
+ import { h as D, j as x, N as H, k as M, m as B } from "./clsx-m_C5j3RU.js";
2
+ import { A as T } from "./toggle-CaSwYCk4.js";
3
+ import { jsx as o, jsxs as l, Fragment as V } from "react/jsx-runtime";
4
+ import { Info as P, Lightbulb as j, AlertCircle as E, TriangleAlert as R, OctagonAlert as W } from "lucide-react";
4
5
  import { useState as s } from "react";
5
- import "./theme.js";
6
- import { Info as _, Lightbulb as $, AlertCircle as z, TriangleAlert as K, OctagonAlert as q } from "lucide-react";
7
- import { S as G, a as J, b as Q, c as X, d as Z } from "./select-D9wQw2qB.js";
6
+ import { D as F, a as U, b as Y, c as _, d as $ } from "./dialog-bDkDW-C_.js";
7
+ import { S as z, a as K, b as q, c as G, d as J } from "./select-DSKqhVGR.js";
8
+ import { f as Q, u as X, c as Z } from "./useButtonProps-D-ruygH7.js";
8
9
  import { u as tt } from "./index-BGd2HiwP.js";
10
+ import { L as u } from "./label-ClsOg9Hr.js";
11
+ import { I as v } from "./input-C_J-pfTx.js";
12
+ import { B as C } from "./button-090-I3tp.js";
9
13
  const y = [
10
14
  {
11
15
  value: "note",
12
16
  label: "Note",
13
- icon: _,
17
+ icon: P,
14
18
  color: "#1f6feb",
15
19
  background: "#1f6feb1f"
16
20
  },
17
21
  {
18
22
  value: "tip",
19
23
  label: "Tip",
20
- icon: $,
24
+ icon: j,
21
25
  color: "#238636",
22
26
  background: "#2386361f"
23
27
  },
24
28
  {
25
29
  value: "important",
26
30
  label: "Important",
27
- icon: z,
31
+ icon: E,
28
32
  color: "#ab7df8",
29
33
  background: "#ab7df81f"
30
34
  },
31
35
  {
32
36
  value: "warning",
33
37
  label: "Warning",
34
- icon: K,
38
+ icon: R,
35
39
  color: "#d29922",
36
40
  background: "#d299221f"
37
41
  },
38
42
  {
39
43
  value: "caution",
40
44
  label: "Caution",
41
- icon: q,
45
+ icon: W,
42
46
  color: "#f85149",
43
47
  background: "#f851491f"
44
48
  }
45
49
  ];
46
50
  function et({ node: t }) {
47
- const { type: e = "note", title: a = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
51
+ const { type: e = "note", title: r = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
48
52
  return /* @__PURE__ */ o(D, { children: /* @__PURE__ */ l(
49
53
  "div",
50
54
  {
@@ -71,7 +75,7 @@ function et({ node: t }) {
71
75
  }),
72
76
  children: [
73
77
  /* @__PURE__ */ o(c, { className: "richtext-size-5" }),
74
- /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: a })
78
+ /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: r })
75
79
  ]
76
80
  }
77
81
  ),
@@ -87,39 +91,39 @@ const ot = [
87
91
  { value: "warning", label: "Warning", icon: "TriangleAlert" },
88
92
  { value: "caution", label: "Caution", icon: "OctagonAlert" }
89
93
  ];
90
- function ht() {
91
- const { t } = tt(), e = V(), a = j(lt.name), [n, i] = s(!1), [c, d] = s("note"), [p, b] = s(""), [g, f] = s(""), {
94
+ function gt() {
95
+ const { t } = tt(), e = Q(), r = X(lt.name), [n, i] = s(!1), [c, d] = s("note"), [h, b] = s(""), [f, g] = s(""), {
92
96
  icon: A = void 0,
93
97
  tooltip: N = void 0,
94
98
  shortcutKeys: L = void 0,
95
- tooltipOptions: S = {},
96
- isActive: k = void 0
97
- } = (a == null ? void 0 : a.componentProps) ?? {}, { dataState: I, disabled: m } = P(k), w = () => {
98
- e && (e.chain().focus().setCallout({ type: c, title: p, body: g }).run(), i(!1), d("note"), b(""), f(""));
99
+ tooltipOptions: I = {},
100
+ isActive: S = void 0
101
+ } = (r == null ? void 0 : r.componentProps) ?? {}, { dataState: k, disabled: m } = Z(S), w = () => {
102
+ e && (e.chain().focus().setCallout({ type: c, title: h, body: f }).run(), i(!1), d("note"), b(""), g(""));
99
103
  }, O = () => {
100
104
  m || i(!0);
101
105
  };
102
- return a ? /* @__PURE__ */ l(E, { onOpenChange: i, open: n, children: [
103
- /* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(
106
+ return r ? /* @__PURE__ */ l(F, { onOpenChange: i, open: n, children: [
107
+ /* @__PURE__ */ o(U, { asChild: !0, children: /* @__PURE__ */ o(
104
108
  T,
105
109
  {
106
110
  action: O,
107
- dataState: I,
111
+ dataState: k,
108
112
  disabled: m,
109
113
  icon: A,
110
114
  shortcutKeys: L,
111
115
  tooltip: N,
112
- tooltipOptions: S
116
+ tooltipOptions: I
113
117
  }
114
118
  ) }),
115
- /* @__PURE__ */ l(W, { children: [
116
- /* @__PURE__ */ o(F, { children: t("editor.callout.dialog.title") }),
119
+ /* @__PURE__ */ l(Y, { children: [
120
+ /* @__PURE__ */ o(_, { children: t("editor.callout.dialog.title") }),
117
121
  /* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
118
122
  /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
119
123
  /* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
120
- /* @__PURE__ */ l(G, { onValueChange: d, value: c, children: [
121
- /* @__PURE__ */ o(J, { children: /* @__PURE__ */ o(Q, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
122
- /* @__PURE__ */ o(X, { children: ot.map((r) => /* @__PURE__ */ o(Z, { value: r.value, children: t(`editor.callout.type.${r.value}`) }, r.value)) })
124
+ /* @__PURE__ */ l(z, { onValueChange: d, value: c, children: [
125
+ /* @__PURE__ */ o(K, { children: /* @__PURE__ */ o(q, { placeholder: t("editor.callout.dialog.type.placeholder") }) }),
126
+ /* @__PURE__ */ o(G, { children: ot.map((a) => /* @__PURE__ */ o(J, { value: a.value, children: t(`editor.callout.type.${a.value}`) }, a.value)) })
123
127
  ] })
124
128
  ] }),
125
129
  /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
@@ -127,9 +131,9 @@ function ht() {
127
131
  /* @__PURE__ */ o(
128
132
  v,
129
133
  {
130
- onChange: (r) => b(r.target.value),
134
+ onChange: (a) => b(a.target.value),
131
135
  placeholder: t("editor.callout.dialog.title.placeholder"),
132
- value: p
136
+ value: h
133
137
  }
134
138
  )
135
139
  ] }),
@@ -138,21 +142,21 @@ function ht() {
138
142
  /* @__PURE__ */ o(
139
143
  v,
140
144
  {
141
- onChange: (r) => f(r.target.value),
145
+ onChange: (a) => g(a.target.value),
142
146
  placeholder: t("editor.callout.dialog.body.placeholder"),
143
- value: g
147
+ value: f
144
148
  }
145
149
  )
146
150
  ] })
147
151
  ] }),
148
- /* @__PURE__ */ l(U, { children: [
152
+ /* @__PURE__ */ l($, { children: [
149
153
  /* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
150
154
  /* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
151
155
  ] })
152
156
  ] })
153
- ] }) : /* @__PURE__ */ o(Y, {});
157
+ ] }) : /* @__PURE__ */ o(V, {});
154
158
  }
155
- function h(t) {
159
+ function p(t) {
156
160
  return (e) => e.getAttribute(t);
157
161
  }
158
162
  const lt = /* @__PURE__ */ H.create({
@@ -170,14 +174,14 @@ const lt = /* @__PURE__ */ H.create({
170
174
  HTMLAttributes: {
171
175
  class: "callout"
172
176
  },
173
- button: ({ editor: e, t: a }) => ({
177
+ button: ({ editor: e, t: r }) => ({
174
178
  component: T,
175
179
  componentProps: {
176
180
  action: () => !0,
177
181
  isActive: () => e.isActive("callout"),
178
182
  disabled: !1,
179
183
  icon: "Callout",
180
- tooltip: a("editor.callout.tooltip")
184
+ tooltip: r("editor.callout.tooltip")
181
185
  }
182
186
  })
183
187
  };
@@ -195,15 +199,15 @@ const lt = /* @__PURE__ */ H.create({
195
199
  return {
196
200
  type: {
197
201
  default: "",
198
- parseHTML: h("type")
202
+ parseHTML: p("type")
199
203
  },
200
204
  title: {
201
205
  default: "",
202
- parseHTML: h("title")
206
+ parseHTML: p("title")
203
207
  },
204
208
  body: {
205
209
  default: "",
206
- parseHTML: h("body")
210
+ parseHTML: p("body")
207
211
  }
208
212
  };
209
213
  },
@@ -221,5 +225,5 @@ const lt = /* @__PURE__ */ H.create({
221
225
  });
222
226
  export {
223
227
  lt as Callout,
224
- ht as RichTextCallout
228
+ gt as RichTextCallout
225
229
  };
package/lib/Clear.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),i=require("./index-De9MZVWQ.cjs");function v(){const t=i.useButtonProps(s.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:a=void 0,tooltipOptions:u={},action:c=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:r}=i.useActive(l),d=()=>{r||c&&c()};return t?n.jsx(i.ActionButton,{action:d,disabled:r,icon:e,shortcutKeys:a,tooltip:o,tooltipOptions:u}):n.jsx(n.Fragment,{})}const s=p.Node3.create({name:"clear",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:o})=>({componentProps:{action:()=>e.chain().focus().clearNodes().unsetAllMarks().run(),isActive:()=>e.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:o("editor.clear.tooltip")}})}}});exports.Clear=s;exports.RichTextClear=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),v=require("./toggle-C9tcMm1r.cjs"),c=require("./useButtonProps-D9ndBdmA.cjs");function f(){const t=c.useButtonProps(s.name),{icon:o=void 0,tooltip:e=void 0,shortcutKeys:a=void 0,tooltipOptions:u={},action:i=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:r}=c.useActive(l),d=()=>{r||i&&i()};return t?n.jsx(v.ActionButton,{action:d,disabled:r,icon:o,shortcutKeys:a,tooltip:e,tooltipOptions:u}):n.jsx(n.Fragment,{})}const s=p.Node3.create({name:"clear",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:o,t:e})=>({componentProps:{action:()=>o.chain().focus().clearNodes().unsetAllMarks().run(),isActive:()=>o.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:e("editor.clear.tooltip")}})}}});exports.Clear=s;exports.RichTextClear=f;
package/lib/Clear.js CHANGED
@@ -1,30 +1,31 @@
1
- import { N as l } from "./clsx-BUPZHhq3.js";
2
- import { jsx as r, Fragment as p } from "react/jsx-runtime";
3
- import { u as d, e as m, A as f } from "./index-B0d-u29p.js";
4
- function x() {
5
- const o = d(v.name), {
1
+ import { N as p } from "./clsx-m_C5j3RU.js";
2
+ import { jsx as e, Fragment as l } from "react/jsx-runtime";
3
+ import { A as d } from "./toggle-CaSwYCk4.js";
4
+ import { u as m, d as f } from "./useButtonProps-D-ruygH7.js";
5
+ function k() {
6
+ const o = m(v.name), {
6
7
  icon: t = void 0,
7
8
  tooltip: n = void 0,
8
9
  shortcutKeys: s = void 0,
9
10
  tooltipOptions: c = {},
10
11
  action: i = void 0,
11
12
  isActive: a = void 0
12
- } = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: e } = m(a), u = () => {
13
- e || i && i();
13
+ } = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: r } = f(a), u = () => {
14
+ r || i && i();
14
15
  };
15
- return o ? /* @__PURE__ */ r(
16
- f,
16
+ return o ? /* @__PURE__ */ e(
17
+ d,
17
18
  {
18
19
  action: u,
19
- disabled: e,
20
+ disabled: r,
20
21
  icon: t,
21
22
  shortcutKeys: s,
22
23
  tooltip: n,
23
24
  tooltipOptions: c
24
25
  }
25
- ) : /* @__PURE__ */ r(p, {});
26
+ ) : /* @__PURE__ */ e(l, {});
26
27
  }
27
- const v = /* @__PURE__ */ l.create({
28
+ const v = /* @__PURE__ */ p.create({
28
29
  name: "clear",
29
30
  //@ts-expect-error
30
31
  addOptions() {
@@ -45,5 +46,5 @@ const v = /* @__PURE__ */ l.create({
45
46
  });
46
47
  export {
47
48
  v as Clear,
48
- x as RichTextClear
49
+ k as RichTextClear
49
50
  };
package/lib/Code.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),i=require("react/jsx-runtime"),s=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");var h=/(^|[^`])`([^`]+)`(?!`)$/,x=/(^|[^`])`([^`]+)`(?!`)/g,C=o.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",o.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[o.markInputRule({find:h,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:x,type:this.type})]}});function v(){const e=s.useButtonProps(u.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:a,update:m}=s.useToggleActive(p),g=()=>{a||d&&(d(),m())};return e?i.jsx(s.ActionButton,{action:g,dataState:l,disabled:a,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):i.jsx(i.Fragment,{})}const u=C.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r,extension:n})=>({componentProps:{action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code"),disabled:!t.can().toggleCode(),icon:"Code",shortcutKeys:n.options.shortcutKeys??["mod","E"],tooltip:r("editor.code.tooltip")}})}}});exports.Code=u;exports.RichTextCode=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-C9tcMm1r.cjs"),a=require("./useButtonProps-D9ndBdmA.cjs");var x=/(^|[^`])`([^`]+)`(?!`)$/,C=/(^|[^`])`([^`]+)`(?!`)/g,v=o.Mark.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",o.mergeAttributes(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[o.markInputRule({find:x,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:C,type:this.type})]}});function M(){const e=a.useButtonProps(u.name),{icon:t=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:c={},action:d=void 0,isActive:p=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:l,disabled:i,update:g}=a.useToggleActive(p),m=()=>{i||d&&(d(),g())};return e?s.jsx(h.ActionButton,{action:m,dataState:l,disabled:i,icon:t,shortcutKeys:n,tooltip:r,tooltipOptions:c}):s.jsx(s.Fragment,{})}const u=v.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button:({editor:t,t:r,extension:n})=>({componentProps:{action:()=>t.commands.toggleCode(),isActive:()=>t.isActive("code"),disabled:!t.can().toggleCode(),icon:"Code",shortcutKeys:n.options.shortcutKeys??["mod","E"],tooltip:r("editor.code.tooltip")}})}}});exports.Code=u;exports.RichTextCode=M;
package/lib/Code.js CHANGED
@@ -1,8 +1,7 @@
1
- import { M as m, e as l, f as g, m as h } from "./clsx-BUPZHhq3.js";
1
+ import { M as m, e as l, f as g, m as h } from "./clsx-m_C5j3RU.js";
2
2
  import { jsx as a, Fragment as M } from "react/jsx-runtime";
3
- import { u as v, d as C, A as f } from "./index-B0d-u29p.js";
4
- import "react";
5
- import "./theme.js";
3
+ import { A as f } from "./toggle-CaSwYCk4.js";
4
+ import { u as v, c as C } from "./useButtonProps-D-ruygH7.js";
6
5
  var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
7
6
  name: "code",
8
7
  addOptions() {
@@ -51,7 +50,7 @@ var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
51
50
  ];
52
51
  }
53
52
  });
54
- function L() {
53
+ function K() {
55
54
  const t = v(A.name), {
56
55
  icon: e = void 0,
57
56
  tooltip: o = void 0,
@@ -96,5 +95,5 @@ const A = /* @__PURE__ */ y.extend({
96
95
  });
97
96
  export {
98
97
  A as Code,
99
- L as RichTextCode
98
+ K as RichTextCode
100
99
  };
package/lib/CodeBlock.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),u=require("./index-De9MZVWQ.cjs"),x=require("react");require("./theme.cjs");const S=require("prism-code-editor-lightweight"),p=require("prism-code-editor-lightweight/commands"),T=require("prism-code-editor-lightweight/cursor"),I=require("prism-code-editor-lightweight/guides"),B=require("prism-code-editor-lightweight/highlight-brackets"),R=require("prism-code-editor-lightweight/match-brackets"),E=require("prism-code-editor-lightweight/match-tags"),s=require("./select-DTNz0ZeE.cjs"),z=require("./delete-node-CosiBes5.cjs");require("prism-code-editor-lightweight/prism/languages/bash");require("prism-code-editor-lightweight/prism/languages/css");require("prism-code-editor-lightweight/prism/languages/css-extras");require("prism-code-editor-lightweight/prism/languages/ini");require("prism-code-editor-lightweight/prism/languages/kotlin");require("prism-code-editor-lightweight/prism/languages/xml");require("prism-code-editor-lightweight/prism/languages/markup");require("prism-code-editor-lightweight/prism/languages/r");require("prism-code-editor-lightweight/prism/languages/basic");require("prism-code-editor-lightweight/prism/languages/vbnet");require("prism-code-editor-lightweight/prism/languages/c");require("prism-code-editor-lightweight/prism/languages/opencl");require("prism-code-editor-lightweight/prism/languages/diff");require("prism-code-editor-lightweight/prism/languages/java");require("prism-code-editor-lightweight/prism/languages/less");require("prism-code-editor-lightweight/prism/languages/objectivec");require("prism-code-editor-lightweight/prism/languages/ruby");require("prism-code-editor-lightweight/prism/languages/sql");require("prism-code-editor-lightweight/prism/languages/wasm");require("prism-code-editor-lightweight/prism/languages/cpp");require("prism-code-editor-lightweight/prism/languages/go");require("prism-code-editor-lightweight/prism/languages/javascript");require("prism-code-editor-lightweight/prism/languages/js-templates");require("prism-code-editor-lightweight/prism/languages/jsx");require("prism-code-editor-lightweight/prism/languages/lua");require("prism-code-editor-lightweight/prism/languages/perl");require("prism-code-editor-lightweight/prism/languages/python");require("prism-code-editor-lightweight/prism/languages/rust");require("prism-code-editor-lightweight/prism/languages/swift");require("prism-code-editor-lightweight/prism/languages/clike");require("prism-code-editor-lightweight/prism/languages/csharp");require("prism-code-editor-lightweight/prism/languages/graphql");require("prism-code-editor-lightweight/prism/languages/json");require("prism-code-editor-lightweight/prism/languages/makefile");require("prism-code-editor-lightweight/prism/languages/scss");require("prism-code-editor-lightweight/prism/languages/typescript");require("prism-code-editor-lightweight/prism/languages/tsx");require("prism-code-editor-lightweight/prism/languages/yaml");require("prism-code-editor-lightweight/prism/languages/regex");require("prism-code-editor-lightweight/prism/languages/php");require("prism-code-editor-lightweight/prism/languages/markdown");function L(){const e=u.useButtonProps(C.name),{icon:a=void 0,tooltip:n=void 0,tooltipOptions:h={},action:c=void 0,isActive:m=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:o,disabled:b,update:v}=u.useToggleActive(m),f=()=>{b||c&&(c(),v())};return e?r.jsx(u.ActionButton,{action:f,dataState:o,disabled:b,icon:a,tooltip:n,tooltipOptions:h}):r.jsx(r.Fragment,{})}const M="_wrap_1x3wi_1",W="_blockInfoEditable_1x3wi_30",N={wrap:M,blockInfoEditable:W},g=[{value:"plaintext",label:"plaintext"},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"cpp",label:"C++"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"sql",label:"SQL"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"bash",label:"Bash"},{value:"php",label:"PHP"}],q=[2,4,8];function H(e){const a=u.useEditableEditor(),n=x.useRef(null),h=x.useCallback(()=>z.deleteNode(C.name,e==null?void 0:e.editor),[e==null?void 0:e.editor]),c=x.useRef(null),m=e.node.attrs.code||e.node.textContent||"",o=x.useCallback(t=>{t==null||t.stopPropagation(),setTimeout(()=>{var i,d,j;(j=(d=(i=c.current)==null?void 0:i.textarea)==null?void 0:d.focus)==null||j.call(d)},0)},[]),b=async()=>{if(m)try{if(navigator.clipboard)await navigator.clipboard.writeText(m);else{const t=document.createElement("textarea");t.value=m,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}catch(t){console.error("Error:",t)}finally{o()}},v=()=>{e.updateAttributes({lineNumbers:!e.node.attrs.lineNumbers}),o()},f=()=>{e.updateAttributes({wordWrap:!e.node.attrs.wordWrap}),o()},k=t=>{const i={...t};return i.language&&!g.some(d=>d.value===i.language)&&(i.language="plaintext",e.updateAttributes({language:"plaintext"})),i},w=x.useCallback(t=>{o(t)},[o]);return x.useEffect(()=>{if(n.current){const t=k(e.node.attrs);c.current=S.createEditor(n.current,{readOnly:!a,language:t.language||"plaintext",tabSize:t.tabSize??2,lineNumbers:t.lineNumbers??!0,wordWrap:t.wordWrap??!1,value:m,rtl:!1,onUpdate(i){queueMicrotask(()=>{e.updateAttributes({code:i})})}}),c.current.addExtensions(R.matchBrackets(),E.matchTags(),I.indentGuides(),B.highlightBracketPairs(),T.cursorPosition(),p.defaultCommands(),p.editHistory()),e.node.attrs.shouldFocus&&setTimeout(()=>{o(),e.updateAttributes({shouldFocus:!1})},0)}return()=>{var t,i;(t=c.current)!=null&&t.remove&&((i=c.current)==null||i.remove())}},[n]),x.useEffect(()=>{var t,i;if((t=c.current)!=null&&t.setOptions){const d=k(e.node.attrs);(i=c.current)==null||i.setOptions(d)}},[c,e.node.attrs]),r.jsx(l.NodeViewWrapper,{className:l.clsx(N.wrap,"render-wrapper"),children:r.jsx("div",{onClick:w,ref:n,className:l.clsx("richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]",{[N.blockInfoEditable]:!a}),children:r.jsxs("div",{className:"richtext-code-block-toolbar",children:[r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.language,disabled:!a,onValueChange:t=>{e.updateAttributes({language:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(s.SelectValue,{placeholder:"Select language"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:g==null?void 0:g.map(t=>r.jsx(s.SelectItem,{value:t.value,children:t.label},t.value))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:b,children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"Copy"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:v,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.lineNumbers}),children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"List"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:f,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.wordWrap}),children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"WrapText"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.tabSize,disabled:!a,onValueChange:t=>{e.updateAttributes({tabSize:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"IndentIncrease"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:q==null?void 0:q.map(t=>r.jsx(s.SelectItem,{value:t,children:t},t))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:h,children:r.jsx(u.IconComponent,{className:"richtext-size-4",name:"Trash2"})})]})})})}const y=/^`{3}([a-z]+)?\s$/,A=/^~{3}([a-z]+)?\s$/,C=l.Node3.create({name:"codeBlock",group:"block",atom:!0,content:"text*",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),languages:[],button:({editor:a,t:n})=>({componentProps:{action:()=>a.commands.setCodeBlock({}),isActive:()=>a.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}},addAttributes(){return{code:{default:"",parseHTML:e=>e.textContent||""},language:{default:"plaintext"},lineNumbers:{default:!0},wordWrap:{default:!1},tabSize:{default:2},shouldFocus:{default:!0,parseHTML:()=>!1,renderHTML:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})},{tag:"pre code",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})}]},renderHTML({HTMLAttributes:e,node:a}){var h;const n=a.attrs.code||((h=a.content.firstChild)==null?void 0:h.text)||"";return["pre",l.mergeAttributes(this.options.HTMLAttributes,e),["code",{},n]]},addNodeView(){return l.ReactNodeViewRenderer(H)},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.insertContent({type:this.name,attrs:{...e,shouldFocus:!0}})}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.setCodeBlock({})}},addInputRules(){return[l.textblockTypeInputRule({find:y,type:this.type,getAttributes:e=>({language:e[1]})}),l.textblockTypeInputRule({find:A,type:this.type,getAttributes:e=>({language:e[1]})})]}});exports.CodeBlock=C;exports.RichTextCodeBlock=L;exports.backtickInputRegex=y;exports.tildeInputRegex=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),T=require("./toggle-C9tcMm1r.cjs"),I=require("prism-code-editor-lightweight"),N=require("prism-code-editor-lightweight/commands"),B=require("prism-code-editor-lightweight/cursor"),R=require("prism-code-editor-lightweight/guides"),E=require("prism-code-editor-lightweight/highlight-brackets"),z=require("prism-code-editor-lightweight/match-brackets"),L=require("prism-code-editor-lightweight/match-tags"),d=require("react"),s=require("./select-B8HIWDXf.cjs"),C=require("./useButtonProps-D9ndBdmA.cjs"),M=require("./delete-node-CosiBes5.cjs");require("prism-code-editor-lightweight/prism/languages/bash");require("prism-code-editor-lightweight/prism/languages/css");require("prism-code-editor-lightweight/prism/languages/css-extras");require("prism-code-editor-lightweight/prism/languages/ini");require("prism-code-editor-lightweight/prism/languages/kotlin");require("prism-code-editor-lightweight/prism/languages/xml");require("prism-code-editor-lightweight/prism/languages/markup");require("prism-code-editor-lightweight/prism/languages/r");require("prism-code-editor-lightweight/prism/languages/basic");require("prism-code-editor-lightweight/prism/languages/vbnet");require("prism-code-editor-lightweight/prism/languages/c");require("prism-code-editor-lightweight/prism/languages/opencl");require("prism-code-editor-lightweight/prism/languages/diff");require("prism-code-editor-lightweight/prism/languages/java");require("prism-code-editor-lightweight/prism/languages/less");require("prism-code-editor-lightweight/prism/languages/objectivec");require("prism-code-editor-lightweight/prism/languages/ruby");require("prism-code-editor-lightweight/prism/languages/sql");require("prism-code-editor-lightweight/prism/languages/wasm");require("prism-code-editor-lightweight/prism/languages/cpp");require("prism-code-editor-lightweight/prism/languages/go");require("prism-code-editor-lightweight/prism/languages/javascript");require("prism-code-editor-lightweight/prism/languages/js-templates");require("prism-code-editor-lightweight/prism/languages/jsx");require("prism-code-editor-lightweight/prism/languages/lua");require("prism-code-editor-lightweight/prism/languages/perl");require("prism-code-editor-lightweight/prism/languages/python");require("prism-code-editor-lightweight/prism/languages/rust");require("prism-code-editor-lightweight/prism/languages/swift");require("prism-code-editor-lightweight/prism/languages/clike");require("prism-code-editor-lightweight/prism/languages/csharp");require("prism-code-editor-lightweight/prism/languages/graphql");require("prism-code-editor-lightweight/prism/languages/json");require("prism-code-editor-lightweight/prism/languages/makefile");require("prism-code-editor-lightweight/prism/languages/scss");require("prism-code-editor-lightweight/prism/languages/typescript");require("prism-code-editor-lightweight/prism/languages/tsx");require("prism-code-editor-lightweight/prism/languages/yaml");require("prism-code-editor-lightweight/prism/languages/regex");require("prism-code-editor-lightweight/prism/languages/php");require("prism-code-editor-lightweight/prism/languages/markdown");const m=require("./Icon-wjwoRc9F.cjs");function W(){const e=C.useButtonProps(k.name),{icon:a=void 0,tooltip:n=void 0,tooltipOptions:x={},action:c=void 0,isActive:h=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:o,disabled:b,update:v}=C.useToggleActive(h),f=()=>{b||c&&(c(),v())};return e?r.jsx(T.ActionButton,{action:f,dataState:o,disabled:b,icon:a,tooltip:n,tooltipOptions:x}):r.jsx(r.Fragment,{})}const P="_wrap_1x3wi_1",H="_blockInfoEditable_1x3wi_30",y={wrap:P,blockInfoEditable:H},g=[{value:"plaintext",label:"plaintext"},{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"cpp",label:"C++"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"sql",label:"SQL"},{value:"json",label:"JSON"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"bash",label:"Bash"},{value:"php",label:"PHP"}],q=[2,4,8];function V(e){const a=C.useEditableEditor(),n=d.useRef(null),x=d.useCallback(()=>M.deleteNode(k.name,e==null?void 0:e.editor),[e==null?void 0:e.editor]),c=d.useRef(null),h=e.node.attrs.code||e.node.textContent||"",o=d.useCallback(t=>{t==null||t.stopPropagation(),setTimeout(()=>{var i,u,p;(p=(u=(i=c.current)==null?void 0:i.textarea)==null?void 0:u.focus)==null||p.call(u)},0)},[]),b=async()=>{if(h)try{if(navigator.clipboard)await navigator.clipboard.writeText(h);else{const t=document.createElement("textarea");t.value=h,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}}catch(t){console.error("Error:",t)}finally{o()}},v=()=>{e.updateAttributes({lineNumbers:!e.node.attrs.lineNumbers}),o()},f=()=>{e.updateAttributes({wordWrap:!e.node.attrs.wordWrap}),o()},j=t=>{const i={...t};return i.language&&!g.some(u=>u.value===i.language)&&(i.language="plaintext",e.updateAttributes({language:"plaintext"})),i},S=d.useCallback(t=>{o(t)},[o]);return d.useEffect(()=>{if(n.current){const t=j(e.node.attrs);c.current=I.createEditor(n.current,{readOnly:!a,language:t.language||"plaintext",tabSize:t.tabSize??2,lineNumbers:t.lineNumbers??!0,wordWrap:t.wordWrap??!1,value:h,rtl:!1,onUpdate(i){queueMicrotask(()=>{e.updateAttributes({code:i})})}}),c.current.addExtensions(z.matchBrackets(),L.matchTags(),R.indentGuides(),E.highlightBracketPairs(),B.cursorPosition(),N.defaultCommands(),N.editHistory()),e.node.attrs.shouldFocus&&setTimeout(()=>{o(),e.updateAttributes({shouldFocus:!1})},0)}return()=>{var t,i;(t=c.current)!=null&&t.remove&&((i=c.current)==null||i.remove())}},[n]),d.useEffect(()=>{var t,i;if((t=c.current)!=null&&t.setOptions){const u=j(e.node.attrs);(i=c.current)==null||i.setOptions(u)}},[c,e.node.attrs]),r.jsx(l.NodeViewWrapper,{className:l.clsx(y.wrap,"render-wrapper"),children:r.jsx("div",{onClick:S,ref:n,className:l.clsx("richtext-node-container richtext-hover-shadow richtext-select-outline richtext-node-code-block !richtext-my-[10px]",{[y.blockInfoEditable]:!a}),children:r.jsxs("div",{className:"richtext-code-block-toolbar",children:[r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.language,disabled:!a,onValueChange:t=>{e.updateAttributes({language:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(s.SelectValue,{placeholder:"Select language"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:g==null?void 0:g.map(t=>r.jsx(s.SelectItem,{value:t.value,children:t.label},t.value))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:b,children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"Copy"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:v,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.lineNumbers}),children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"List"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{onClick:f,className:l.clsx("richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",{"richtext-bg-[#5a5d5e4f]":e==null?void 0:e.node.attrs.wordWrap}),children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"WrapText"})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{children:r.jsxs(s.Select,{defaultValue:e.node.attrs.tabSize,disabled:!a,onValueChange:t=>{e.updateAttributes({tabSize:t}),o()},children:[r.jsx(s.SelectTrigger,{className:"richtext-h-7 richtext-w-[60px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]",children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"IndentIncrease"})}),r.jsx(s.SelectContent,{onCloseAutoFocus:t=>t.preventDefault(),children:q==null?void 0:q.map(t=>r.jsx(s.SelectItem,{value:t,children:t},t))})]})}),r.jsx("div",{className:"toolbar-divider"}),r.jsx("div",{className:"richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",onClick:x,children:r.jsx(m.IconComponent,{className:"richtext-size-4",name:"Trash2"})})]})})})}const A=/^`{3}([a-z]+)?\s$/,w=/^~{3}([a-z]+)?\s$/,k=l.Node3.create({name:"codeBlock",group:"block",atom:!0,content:"text*",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),languages:[],button:({editor:a,t:n})=>({componentProps:{action:()=>a.commands.setCodeBlock({}),isActive:()=>a.isActive("codeBlock"),disabled:!1,icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}},addAttributes(){return{code:{default:"",parseHTML:e=>e.textContent||""},language:{default:"plaintext"},lineNumbers:{default:!0},wordWrap:{default:!1},tabSize:{default:2},shouldFocus:{default:!0,parseHTML:()=>!1,renderHTML:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})},{tag:"pre code",preserveWhitespace:"full",getAttrs:e=>({code:e.textContent||""})}]},renderHTML({HTMLAttributes:e,node:a}){var x;const n=a.attrs.code||((x=a.content.firstChild)==null?void 0:x.text)||"";return["pre",l.mergeAttributes(this.options.HTMLAttributes,e),["code",{},n]]},addNodeView(){return l.ReactNodeViewRenderer(V)},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.insertContent({type:this.name,attrs:{...e,shouldFocus:!0}})}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.setCodeBlock({})}},addInputRules(){return[l.textblockTypeInputRule({find:A,type:this.type,getAttributes:e=>({language:e[1]})}),l.textblockTypeInputRule({find:w,type:this.type,getAttributes:e=>({language:e[1]})})]}});exports.CodeBlock=k;exports.RichTextCodeBlock=W;exports.backtickInputRegex=A;exports.tildeInputRegex=w;
package/lib/CodeBlock.js CHANGED
@@ -1,16 +1,16 @@
1
- import { h as L, j as h, N as M, t as k, k as W, m as j } from "./clsx-BUPZHhq3.js";
1
+ import { h as L, j as h, N as M, t as k, k as W, m as j } from "./clsx-m_C5j3RU.js";
2
2
  import { jsx as r, Fragment as R, jsxs as f } from "react/jsx-runtime";
3
- import { u as H, d as V, A as P, w as F, I as u } from "./index-B0d-u29p.js";
3
+ import { A as H } from "./toggle-CaSwYCk4.js";
4
+ import { createEditor as V } from "prism-code-editor-lightweight";
5
+ import { defaultCommands as P, editHistory as F } from "prism-code-editor-lightweight/commands";
6
+ import { cursorPosition as O } from "prism-code-editor-lightweight/cursor";
7
+ import { indentGuides as _ } from "prism-code-editor-lightweight/guides";
8
+ import { highlightBracketPairs as J } from "prism-code-editor-lightweight/highlight-brackets";
9
+ import { matchBrackets as q } from "prism-code-editor-lightweight/match-brackets";
10
+ import { matchTags as D } from "prism-code-editor-lightweight/match-tags";
4
11
  import { useRef as y, useCallback as v, useEffect as A } from "react";
5
- import "./theme.js";
6
- import { createEditor as O } from "prism-code-editor-lightweight";
7
- import { defaultCommands as _, editHistory as J } from "prism-code-editor-lightweight/commands";
8
- import { cursorPosition as q } from "prism-code-editor-lightweight/cursor";
9
- import { indentGuides as D } from "prism-code-editor-lightweight/guides";
10
- import { highlightBracketPairs as G } from "prism-code-editor-lightweight/highlight-brackets";
11
- import { matchBrackets as U } from "prism-code-editor-lightweight/match-brackets";
12
- import { matchTags as $ } from "prism-code-editor-lightweight/match-tags";
13
- import { S as w, a as S, b as K, c as T, d as E } from "./select-D9wQw2qB.js";
12
+ import { S as w, a as S, b as G, c as T, d as E } from "./select-DSKqhVGR.js";
13
+ import { u as U, c as $, l as K } from "./useButtonProps-D-ruygH7.js";
14
14
  import { d as Q } from "./delete-node-eQHsyyhR.js";
15
15
  import "prism-code-editor-lightweight/prism/languages/bash";
16
16
  import "prism-code-editor-lightweight/prism/languages/css";
@@ -53,20 +53,21 @@ import "prism-code-editor-lightweight/prism/languages/yaml";
53
53
  import "prism-code-editor-lightweight/prism/languages/regex";
54
54
  import "prism-code-editor-lightweight/prism/languages/php";
55
55
  import "prism-code-editor-lightweight/prism/languages/markdown";
56
- function at() {
57
- const e = H(B.name), {
56
+ import { I as u } from "./Icon-BvGyfX2j.js";
57
+ function it() {
58
+ const e = U(B.name), {
58
59
  icon: i = void 0,
59
60
  tooltip: n = void 0,
60
61
  tooltipOptions: s = {},
61
62
  action: o = void 0,
62
63
  isActive: d = void 0
63
- } = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: b } = V(d), p = () => {
64
- m || o && (o(), b());
64
+ } = (e == null ? void 0 : e.componentProps) ?? {}, { dataState: c, disabled: m, update: p } = $(d), b = () => {
65
+ m || o && (o(), p());
65
66
  };
66
67
  return e ? /* @__PURE__ */ r(
67
- P,
68
+ H,
68
69
  {
69
- action: p,
70
+ action: b,
70
71
  dataState: c,
71
72
  disabled: m,
72
73
  icon: i,
@@ -97,7 +98,7 @@ const Y = "_wrap_1x3wi_1", X = "_blockInfoEditable_1x3wi_30", z = {
97
98
  { value: "php", label: "PHP" }
98
99
  ], g = [2, 4, 8];
99
100
  function Z(e) {
100
- const i = F(), n = y(null), s = v(() => Q(B.name, e == null ? void 0 : e.editor), [e == null ? void 0 : e.editor]), o = y(null), d = e.node.attrs.code || e.node.textContent || "", c = v((t) => {
101
+ const i = K(), n = y(null), s = v(() => Q(B.name, e == null ? void 0 : e.editor), [e == null ? void 0 : e.editor]), o = y(null), d = e.node.attrs.code || e.node.textContent || "", c = v((t) => {
101
102
  t == null || t.stopPropagation(), setTimeout(() => {
102
103
  var a, l, N;
103
104
  (N = (l = (a = o.current) == null ? void 0 : a.textarea) == null ? void 0 : l.focus) == null || N.call(l);
@@ -116,11 +117,11 @@ function Z(e) {
116
117
  } finally {
117
118
  c();
118
119
  }
119
- }, b = () => {
120
+ }, p = () => {
120
121
  e.updateAttributes({
121
122
  lineNumbers: !e.node.attrs.lineNumbers
122
123
  }), c();
123
- }, p = () => {
124
+ }, b = () => {
124
125
  e.updateAttributes({
125
126
  wordWrap: !e.node.attrs.wordWrap
126
127
  }), c();
@@ -138,7 +139,7 @@ function Z(e) {
138
139
  return A(() => {
139
140
  if (n.current) {
140
141
  const t = C(e.node.attrs);
141
- o.current = O(n.current, {
142
+ o.current = V(n.current, {
142
143
  readOnly: !i,
143
144
  language: t.language || "plaintext",
144
145
  tabSize: t.tabSize ?? 2,
@@ -152,13 +153,13 @@ function Z(e) {
152
153
  });
153
154
  }
154
155
  }), o.current.addExtensions(
155
- U(),
156
- $(),
157
- D(),
158
- G(),
159
156
  q(),
157
+ D(),
160
158
  _(),
161
- J()
159
+ J(),
160
+ O(),
161
+ P(),
162
+ F()
162
163
  ), e.node.attrs.shouldFocus && setTimeout(() => {
163
164
  c(), e.updateAttributes({
164
165
  shouldFocus: !1
@@ -198,7 +199,7 @@ function Z(e) {
198
199
  }), c();
199
200
  },
200
201
  children: [
201
- /* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(K, { placeholder: "Select language" }) }),
202
+ /* @__PURE__ */ r(S, { className: "richtext-h-7 richtext-w-[160px] richtext-border-none richtext-text-sm richtext-outline-none hover:richtext-bg-[#5a5d5e4f]", children: /* @__PURE__ */ r(G, { placeholder: "Select language" }) }),
202
203
  /* @__PURE__ */ r(T, { onCloseAutoFocus: (t) => t.preventDefault(), children: x == null ? void 0 : x.map((t) => /* @__PURE__ */ r(E, { value: t.value, children: t.label }, t.value)) })
203
204
  ]
204
205
  }
@@ -216,7 +217,7 @@ function Z(e) {
216
217
  /* @__PURE__ */ r(
217
218
  "div",
218
219
  {
219
- onClick: b,
220
+ onClick: p,
220
221
  className: h(
221
222
  "richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
222
223
  {
@@ -230,7 +231,7 @@ function Z(e) {
230
231
  /* @__PURE__ */ r(
231
232
  "div",
232
233
  {
233
- onClick: p,
234
+ onClick: b,
234
235
  className: h(
235
236
  "richtext-flex richtext-size-7 richtext-cursor-pointer richtext-items-center richtext-justify-center richtext-rounded-sm hover:richtext-bg-[#5a5d5e4f]",
236
237
  {
@@ -383,7 +384,7 @@ const ee = /^`{3}([a-z]+)?\s$/, te = /^~{3}([a-z]+)?\s$/, B = /* @__PURE__ */ M.
383
384
  });
384
385
  export {
385
386
  B as CodeBlock,
386
- at as RichTextCodeBlock,
387
+ it as RichTextCodeBlock,
387
388
  ee as backtickInputRegex,
388
389
  te as tildeInputRegex
389
390
  };
package/lib/CodeView.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),c=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");function v(){const e=c.useButtonProps(a.name),{icon:t=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:d={},action:s=void 0,isActive:l=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:u,disabled:r,update:p}=c.useToggleActive(l),g=()=>{r||s&&(s(),p())};return e?n.jsx(c.ActionButton,{action:g,dataState:u,disabled:r,icon:t,shortcutKeys:i,tooltip:o,tooltipOptions:d}):n.jsx(n.Fragment,{})}const a=m.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const i=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${i}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=a;exports.RichTextCodeView=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),v=require("./toggle-C9tcMm1r.cjs"),r=require("./useButtonProps-D9ndBdmA.cjs");function w(){const e=r.useButtonProps(a.name),{icon:t=void 0,tooltip:o=void 0,shortcutKeys:i=void 0,tooltipOptions:d={},action:s=void 0,isActive:l=void 0}=(e==null?void 0:e.componentProps)??{},{dataState:u,disabled:c,update:p}=r.useToggleActive(l),g=()=>{c||s&&(s(),p())};return e?n.jsx(v.ActionButton,{action:g,dataState:u,disabled:c,icon:t,shortcutKeys:i,tooltip:o,tooltipOptions:d}):n.jsx(n.Fragment,{})}const a=m.Extension.create({name:"codeView",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:t,t:o}){return{componentProps:{action:()=>{t.commands.toggleCodeView()},isActive:()=>t.storage.codeView.isActive,disabled:!1,icon:"Html",tooltip:o("editor.codeView.tooltip")||"View HTML Code",customClass:"tiptap-code-view-button"}}}}},addStorage(){return{isActive:!1,originalContent:""}},addCommands(){return{toggleCodeView:()=>({editor:e})=>{const t=e.storage.codeView.isActive;if(t)e.commands.setContent(e.getText());else{const o=e.getHTML();e.storage.codeView.originalContent=o;const i=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;");e.commands.setContent(`<div class="tiptap-code-view-wrapper">${i}</div>`)}return e.storage.codeView.isActive=!t,!0}}}});exports.CodeView=a;exports.RichTextCodeView=w;
package/lib/CodeView.js CHANGED
@@ -1,21 +1,20 @@
1
- import { E as l } from "./clsx-BUPZHhq3.js";
1
+ import { E as l } from "./clsx-m_C5j3RU.js";
2
2
  import { jsx as c, Fragment as g } from "react/jsx-runtime";
3
- import { u, d as v, A as w } from "./index-B0d-u29p.js";
4
- import "react";
5
- import "./theme.js";
6
- function h() {
7
- const t = u(C.name), {
3
+ import { A as u } from "./toggle-CaSwYCk4.js";
4
+ import { u as v, c as w } from "./useButtonProps-D-ruygH7.js";
5
+ function T() {
6
+ const t = v(C.name), {
8
7
  icon: e = void 0,
9
8
  tooltip: o = void 0,
10
9
  shortcutKeys: i = void 0,
11
10
  tooltipOptions: a = {},
12
11
  action: n = void 0,
13
12
  isActive: r = void 0
14
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } = v(r), m = () => {
13
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: d, disabled: s, update: p } = w(r), m = () => {
15
14
  s || n && (n(), p());
16
15
  };
17
16
  return t ? /* @__PURE__ */ c(
18
- w,
17
+ u,
19
18
  {
20
19
  action: m,
21
20
  dataState: d,
@@ -77,5 +76,5 @@ const C = /* @__PURE__ */ l.create({
77
76
  });
78
77
  export {
79
78
  C as CodeView,
80
- h as RichTextCodeView
79
+ T as RichTextCodeView
81
80
  };
package/lib/Color.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),d=require("react"),l=require("./index-De9MZVWQ.cjs"),g=require("./separator-D8lOAf8f.cjs");require("./theme.cjs");function v({fill:e}){return t.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:t.jsx("g",{transform:"translate(0.000000, 0.500000)",children:t.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[t.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:typeof e=="string"?e:"#000",fillRule:"evenodd"}),t.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),t.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function j(){const e=l.useButtonProps(C.name),{tooltip:o=void 0,isActive:s=void 0,defaultColor:r=void 0,colors:n,action:i}=(e==null?void 0:e.componentProps)??{},{disabled:c,dataState:u}=l.useActive(s),[f,a]=d.useState(r);d.useEffect(()=>{a(u)},[u]);function x(h){c||i&&(i==null||i(h),a(h))}return e?t.jsx(g.ColorPicker,{colors:n,disabled:c,onChange:x,value:f,children:t.jsx(l.ActionButton,{disabled:c,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(v,{fill:u}),t.jsx(l.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):t.jsx(t.Fragment,{})}const C=p.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:o,t:s,extension:r}){return{componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{if(typeof n=="string"){o.storage.color.currentColor=n,o.chain().focus().setColor(n).run();return}o.chain().focus().unsetColor().run()},isActive:()=>{const{color:n}=o.getAttributes("textStyle");return n},disabled:!1,shortcutKeys:r.options.shortcutKeys??["⇧","alt","C"],tooltip:s("editor.color.tooltip")}}}}},addKeyboardShortcuts(){var e;return{...(e=this.parent)==null?void 0:e.call(this),"Alt-Shift-c":()=>{const o=this.storage.currentColor||this.options.defaultColor;if(!o){const{color:r}=this.editor.getAttributes("textStyle");return r?this.editor.chain().focus().unsetColor().run():!1}return this.editor.isActive("textStyle",{color:o})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(o).run()}}}});exports.Color=C;exports.RichTextColor=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index-CjhjjJsN.cjs"),t=require("react/jsx-runtime"),d=require("react"),g=require("./toggle-C9tcMm1r.cjs"),v=require("./separator-D6ruF682.cjs"),h=require("./useButtonProps-D9ndBdmA.cjs"),j=require("./Icon-wjwoRc9F.cjs");function m({fill:e}){return t.jsx("svg",{height:"18px",version:"1.1",viewBox:"0 0 240 240",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:1,children:t.jsx("g",{transform:"translate(0.000000, 0.500000)",children:t.jsxs("g",{transform:"translate(39.000000, 17.353553)",children:[t.jsx("path",{d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:typeof e=="string"?e:"#000",fillRule:"evenodd"}),t.jsx("path",{d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor",fillRule:"nonzero"}),t.jsx("path",{d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor",fillRule:"nonzero"})]})})})})}function L(){const e=h.useButtonProps(C.name),{tooltip:o=void 0,isActive:s=void 0,defaultColor:r=void 0,colors:n,action:i}=(e==null?void 0:e.componentProps)??{},{disabled:l,dataState:c}=h.useActive(s),[f,u]=d.useState(r);d.useEffect(()=>{u(c)},[c]);function x(a){l||i&&(i==null||i(a),u(a))}return e?t.jsx(v.ColorPicker,{colors:n,disabled:l,onChange:x,value:f,children:t.jsx(g.ActionButton,{disabled:l,tooltip:o,children:t.jsxs("span",{className:"richtext-flex richtext-items-center richtext-justify-center richtext-gap-[4px] richtext-text-sm",children:[t.jsx(m,{fill:c}),t.jsx(j.IconComponent,{className:"!richtext-h-3 !richtext-w-3 richtext-text-zinc-500",name:"MenuDown"})]})})}):t.jsx(t.Fragment,{})}const C=p.Color.extend({addStorage(){return{currentColor:this.options.defaultColor||void 0}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),button({editor:o,t:s,extension:r}){return{componentProps:{colors:r.options.colors,defaultColor:r.options.defaultColor,action:n=>{if(typeof n=="string"){o.storage.color.currentColor=n,o.chain().focus().setColor(n).run();return}o.chain().focus().unsetColor().run()},isActive:()=>{const{color:n}=o.getAttributes("textStyle");return n},disabled:!1,shortcutKeys:r.options.shortcutKeys??["⇧","alt","C"],tooltip:s("editor.color.tooltip")}}}}},addKeyboardShortcuts(){var e;return{...(e=this.parent)==null?void 0:e.call(this),"Alt-Shift-c":()=>{const o=this.storage.currentColor||this.options.defaultColor;if(!o){const{color:r}=this.editor.getAttributes("textStyle");return r?this.editor.chain().focus().unsetColor().run():!1}return this.editor.isActive("textStyle",{color:o})?this.editor.chain().focus().unsetColor().run():this.editor.chain().focus().setColor(o).run()}}}});exports.Color=C;exports.RichTextColor=L;