@remarkablejames/editor 0.0.2 → 0.0.4

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 (193) hide show
  1. package/lib/{ActionMenuButton-Bmn3RME4.js → ActionMenuButton-BUtJUsfO.js} +9 -10
  2. package/lib/ActionMenuButton-M55VtCZ5.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.js +166 -133
  5. package/lib/Blockquote.cjs +2 -2
  6. package/lib/Blockquote.js +13 -12
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +11 -10
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +9 -8
  11. package/lib/Callout.cjs +1 -1
  12. package/lib/Callout.js +42 -46
  13. package/lib/Clear.cjs +1 -1
  14. package/lib/Clear.js +13 -14
  15. package/lib/Code.cjs +1 -1
  16. package/lib/Code.js +6 -5
  17. package/lib/CodeBlock.cjs +1 -1
  18. package/lib/CodeBlock.js +30 -31
  19. package/lib/CodeView.cjs +1 -1
  20. package/lib/CodeView.js +9 -8
  21. package/lib/Color.cjs +1 -1
  22. package/lib/Color.js +18 -19
  23. package/lib/Column.cjs +1 -1
  24. package/lib/Column.js +9 -8
  25. package/lib/Drawer-CdQBnwUs.cjs +2 -0
  26. package/lib/{Drawer-DvGh9aXG.js → Drawer-mlmJ2nCT.js} +41 -47
  27. package/lib/Drawer.cjs +1 -1
  28. package/lib/Drawer.js +3 -3
  29. package/lib/Emoji.cjs +1 -1
  30. package/lib/Emoji.js +15 -16
  31. package/lib/Excalidraw.cjs +1 -1
  32. package/lib/Excalidraw.js +24 -28
  33. package/lib/ExportPdf.cjs +3 -3
  34. package/lib/ExportPdf.js +14 -13
  35. package/lib/ExportWord.cjs +1 -1
  36. package/lib/ExportWord.js +6 -6
  37. package/lib/FontFamily.cjs +1 -1
  38. package/lib/FontFamily.js +8 -7
  39. package/lib/FontSize.cjs +1 -1
  40. package/lib/FontSize.js +16 -15
  41. package/lib/Heading.cjs +1 -1
  42. package/lib/Heading.js +27 -27
  43. package/lib/Highlight.cjs +1 -1
  44. package/lib/Highlight.js +22 -23
  45. package/lib/History.cjs +1 -1
  46. package/lib/History.js +11 -11
  47. package/lib/HorizontalRule.cjs +1 -1
  48. package/lib/HorizontalRule.js +10 -9
  49. package/lib/Iframe-B_a_AoZc.cjs +1 -0
  50. package/lib/{Iframe-CnnvV6cK.js → Iframe-CYgR99Ny.js} +11 -13
  51. package/lib/Iframe.cjs +1 -1
  52. package/lib/Iframe.js +2 -2
  53. package/lib/Image.cjs +1 -1
  54. package/lib/Image.js +4 -5
  55. package/lib/ImageGif.cjs +1 -1
  56. package/lib/ImageGif.js +79 -82
  57. package/lib/ImportWord.cjs +1 -1
  58. package/lib/ImportWord.js +26 -27
  59. package/lib/Indent-BAcoFdaq.cjs +1 -0
  60. package/lib/{Indent-Bsj8gKvT.js → Indent-BMz2ILRl.js} +31 -30
  61. package/lib/Indent.cjs +1 -1
  62. package/lib/Indent.js +2 -2
  63. package/lib/Italic.cjs +1 -1
  64. package/lib/Italic.js +12 -11
  65. package/lib/{Katex-CilGTz7u.js → Katex-DOlb4iTP.js} +19 -22
  66. package/lib/Katex-bIhj82VV.cjs +4 -0
  67. package/lib/Katex.cjs +1 -1
  68. package/lib/Katex.js +2 -2
  69. package/lib/LineHeight.cjs +1 -1
  70. package/lib/LineHeight.js +19 -20
  71. package/lib/Link.cjs +1 -1
  72. package/lib/Link.js +2 -2
  73. package/lib/LinkEditBlock-Cqs5RxjV.cjs +5 -0
  74. package/lib/{LinkEditBlock-BD_WvA3r.js → LinkEditBlock-xnokk4G7.js} +19 -24
  75. package/lib/Mention.js +3 -3
  76. package/lib/{Mermaid-BrjU75Bs.js → Mermaid-Bs3pIGc6.js} +45 -48
  77. package/lib/Mermaid-DiOdgQv1.cjs +2 -0
  78. package/lib/Mermaid.cjs +1 -1
  79. package/lib/Mermaid.js +2 -2
  80. package/lib/MoreMark.cjs +1 -1
  81. package/lib/MoreMark.js +26 -28
  82. package/lib/OrderedList.cjs +1 -1
  83. package/lib/OrderedList.js +11 -10
  84. package/lib/SearchAndReplace.cjs +1 -1
  85. package/lib/SearchAndReplace.js +37 -42
  86. package/lib/SlashCommand.cjs +1 -1
  87. package/lib/SlashCommand.js +6 -6
  88. package/lib/SlashCommandNodeView-CLimjqhb.cjs +1 -0
  89. package/lib/{SlashCommandNodeView-COx5qZ2y.js → SlashCommandNodeView-CYcf7mVz.js} +67 -79
  90. package/lib/Strike.cjs +1 -1
  91. package/lib/Strike.js +12 -11
  92. package/lib/{Table-BlM8yMhr.js → Table-bz1Wcojf.js} +47 -47
  93. package/lib/Table-dlXTKKwJ.cjs +5 -0
  94. package/lib/Table.cjs +1 -1
  95. package/lib/Table.js +1 -1
  96. package/lib/TaskList.cjs +1 -1
  97. package/lib/TaskList.js +12 -11
  98. package/lib/TextAlign.cjs +1 -1
  99. package/lib/TextAlign.js +26 -27
  100. package/lib/TextDirection.cjs +1 -1
  101. package/lib/TextDirection.js +18 -19
  102. package/lib/TextUnderline.cjs +1 -1
  103. package/lib/TextUnderline.js +9 -8
  104. package/lib/{Twitter-BP8sYXX7.js → Twitter-CNTXzgt0.js} +18 -22
  105. package/lib/Twitter-DhEnGg6P.cjs +1 -0
  106. package/lib/Twitter.cjs +1 -1
  107. package/lib/Twitter.js +2 -2
  108. package/lib/Video.cjs +1 -1
  109. package/lib/Video.js +5 -6
  110. package/lib/bubble.cjs +3 -3
  111. package/lib/bubble.js +78 -87
  112. package/lib/{clsx-m_C5j3RU.js → clsx-CDyrfCnw.js} +24 -24
  113. package/lib/{dropdown-menu-C1hdPLCZ.js → dropdown-menu-BuSlU2uN.js} +1 -1
  114. package/lib/{dropdown-menu-CkHN04Mx.cjs → dropdown-menu-CfWNst4v.cjs} +1 -1
  115. package/lib/extensions/Attachment/Attachment.d.ts +22 -2
  116. package/lib/extensions/Image/Image.d.ts +11 -0
  117. package/lib/extensions/Image/components/ImageCropper.d.ts +1 -1
  118. package/lib/index-8B00E8e4.js +5055 -0
  119. package/lib/index-BrxL7y9p.cjs +1 -0
  120. package/lib/index-Bt9LiArC.cjs +10 -0
  121. package/lib/{index-B3Ijnbxs.js → index-C-tDsIKJ.js} +1 -1
  122. package/lib/{index-C1KQsOcg.js → index-C1WCZhyA.js} +1 -1
  123. package/lib/{index-C8FjP66D.js → index-CsSfYR30.js} +1 -1
  124. package/lib/{index-4Q5IhypJ.js → index-DZfkCNKr.js} +15 -9
  125. package/lib/{index-s3l5RdyW.js → index-DjDf4BK8.js} +1 -1
  126. package/lib/index.cjs +4 -4
  127. package/lib/index.js +147 -392
  128. package/lib/locale-bundle.cjs +1 -1
  129. package/lib/locale-bundle.js +1 -1
  130. package/lib/locales/en.d.ts +189 -188
  131. package/lib/locales/fi.d.ts +189 -188
  132. package/lib/locales/hu.d.ts +189 -188
  133. package/lib/locales/index.d.ts +1134 -1128
  134. package/lib/locales/pt-br.d.ts +189 -188
  135. package/lib/locales/vi.d.ts +189 -188
  136. package/lib/locales/zh-cn.d.ts +189 -188
  137. package/lib/{popover-B05Fd8lC.cjs → popover-51mwx3UY.cjs} +1 -1
  138. package/lib/{popover-CsSXh7w6.js → popover-DMPRgXD3.js} +1 -1
  139. package/lib/{renderNodeView-C_hPIdEs.js → renderNodeView-BJSrgyGj.js} +2 -2
  140. package/lib/{select-7ubC1NF0.cjs → select-B7v1Scb-.cjs} +1 -1
  141. package/lib/{select-B3-5wTqn.js → select-BxFDMaZi.js} +1 -1
  142. package/lib/{separator-CYCA8tSn.js → separator-CpqX9KQC.js} +12 -13
  143. package/lib/separator-kB9YUfeO.cjs +1 -0
  144. package/lib/style.css +1 -1
  145. package/lib/{textarea-1FhpmBkP.js → textarea-C5DsgzSy.js} +1 -1
  146. package/lib/{textarea-Bjhcpp76.cjs → textarea-bQSzjqg3.cjs} +1 -1
  147. package/lib/theme/theme.d.ts +1 -1
  148. package/lib/{updatePosition-DvfTZHcH.js → updatePosition-e90ZrFWW.js} +2 -2
  149. package/package.json +1 -1
  150. package/lib/ActionMenuButton-C5P0Kzrb.cjs +0 -1
  151. package/lib/Drawer-gz9U5ArC.cjs +0 -2
  152. package/lib/Icon-CKM0tYbW.js +0 -15
  153. package/lib/Icon-CQyFgXeo.cjs +0 -1
  154. package/lib/Iframe-Ds6gG2YO.cjs +0 -1
  155. package/lib/ImageCropper-BKhXlnXN.cjs +0 -1
  156. package/lib/ImageCropper-DUzu_9-6.js +0 -896
  157. package/lib/Indent-D_7HOYYd.cjs +0 -1
  158. package/lib/Katex-lL3bHXJd.cjs +0 -4
  159. package/lib/LinkEditBlock-D3HSHmsU.cjs +0 -5
  160. package/lib/Mermaid-BfeLPzoS.cjs +0 -2
  161. package/lib/SlashCommandNodeView-DD-nlhM-.cjs +0 -1
  162. package/lib/Table-C21AlUrh.cjs +0 -5
  163. package/lib/Twitter-D46MnvPr.cjs +0 -1
  164. package/lib/Video-Bpd8W8l6.js +0 -231
  165. package/lib/Video-BwrHx6B1.cjs +0 -1
  166. package/lib/button-BmTP96NR.cjs +0 -1
  167. package/lib/button-CDIxPURh.js +0 -35
  168. package/lib/checkbox-7sfSdzy9.js +0 -29
  169. package/lib/checkbox-DyVlLWHv.cjs +0 -1
  170. package/lib/dialog-B-jOQ5i3.cjs +0 -1
  171. package/lib/dialog-QWWUWOGP.js +0 -95
  172. package/lib/events.constant-Bh2uzJud.js +0 -71
  173. package/lib/events.constant-ELn21EzG.cjs +0 -1
  174. package/lib/file-BLas99n7.js +0 -43
  175. package/lib/file-i7e4nQY2.cjs +0 -1
  176. package/lib/index-CAiZY1nx.js +0 -2741
  177. package/lib/index-DWSAk_9a.cjs +0 -1
  178. package/lib/index-bVGIXhRg.cjs +0 -1
  179. package/lib/input-qvpuOf-3.js +0 -21
  180. package/lib/input-s0JD5kf2.cjs +0 -1
  181. package/lib/isNumber-BTYSVlKo.cjs +0 -1
  182. package/lib/isNumber-WaBzl_0s.js +0 -15
  183. package/lib/label-CFax-gzo.cjs +0 -1
  184. package/lib/label-DC37f2RQ.js +0 -11
  185. package/lib/separator-ncbdw4oq.cjs +0 -1
  186. package/lib/tabs-BeHxylKH.js +0 -46
  187. package/lib/tabs-DBqNpGAq.cjs +0 -1
  188. package/lib/throttle-CRNq0z-O.js +0 -249
  189. package/lib/throttle-gTTvqDTW.cjs +0 -1
  190. package/lib/toggle-DoJTBdvy.js +0 -89
  191. package/lib/toggle-oFwBZC4x.cjs +0 -1
  192. package/lib/useButtonProps-BE10eHkG.js +0 -165
  193. package/lib/useButtonProps-CFu0GHzW.cjs +0 -1
package/lib/Bold.js CHANGED
@@ -1,8 +1,9 @@
1
- import { M as _, e as a, f as i, m as f } from "./clsx-m_C5j3RU.js";
1
+ import { M as _, e as a, f as i, m as y } from "./clsx-CDyrfCnw.js";
2
2
  import { h as d } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { A as l } from "./toggle-DoJTBdvy.js";
4
- import { jsx as u, Fragment as y } from "react/jsx-runtime";
5
- import { u as M, c as v } from "./useButtonProps-BE10eHkG.js";
3
+ import { u as f, d as M, A as l } from "./index-8B00E8e4.js";
4
+ import { jsx as u, Fragment as v } from "react/jsx-runtime";
5
+ import "react";
6
+ import "./theme.js";
6
7
  var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, A = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, R = _.create({
7
8
  name: "bold",
8
9
  addOptions() {
@@ -30,7 +31,7 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
30
31
  ];
31
32
  },
32
33
  renderHTML({ HTMLAttributes: t }) {
33
- return /* @__PURE__ */ d("strong", { ...f(this.options.HTMLAttributes, t), children: /* @__PURE__ */ d("slot", {}) });
34
+ return /* @__PURE__ */ d("strong", { ...y(this.options.HTMLAttributes, t), children: /* @__PURE__ */ d("slot", {}) });
34
35
  },
35
36
  markdownTokenName: "strong",
36
37
  parseMarkdown: (t, e) => e.applyMark("bold", e.parseInline(t.tokens || [])),
@@ -73,15 +74,15 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
73
74
  ];
74
75
  }
75
76
  });
76
- function H() {
77
- const t = M(x.name), {
77
+ function K() {
78
+ const t = f(x.name), {
78
79
  icon: e = void 0,
79
80
  tooltip: o = void 0,
80
81
  shortcutKeys: r = void 0,
81
82
  tooltipOptions: p = {},
82
83
  action: n = void 0,
83
84
  isActive: m = void 0
84
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: s, update: g } = v(m), h = () => {
85
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: s, update: g } = M(m), h = () => {
85
86
  s || n && (n(), g());
86
87
  };
87
88
  return t ? /* @__PURE__ */ u(
@@ -95,7 +96,7 @@ function H() {
95
96
  tooltip: o,
96
97
  tooltipOptions: p
97
98
  }
98
- ) : /* @__PURE__ */ u(y, {});
99
+ ) : /* @__PURE__ */ u(v, {});
99
100
  }
100
101
  const x = /* @__PURE__ */ R.extend({
101
102
  //@ts-expect-error
@@ -118,5 +119,5 @@ const x = /* @__PURE__ */ R.extend({
118
119
  });
119
120
  export {
120
121
  x as Bold,
121
- H as RichTextBold
122
+ K as RichTextBold
122
123
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-BCzvbrf5.cjs"),s=require("react/jsx-runtime"),m=require("./toggle-oFwBZC4x.cjs"),u=require("./useButtonProps-CFu0GHzW.cjs");function B(){const t=u.useButtonProps(l.name),{icon:o=void 0,tooltip:e=void 0,shortcutKeys:i=void 0,tooltipOptions:r={},action:n=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:c,update:p}=u.useToggleActive(d),v=()=>{c||n&&(n(),p())};return t?s.jsx(m.ActionButton,{action:v,dataState:a,disabled:c,icon:o,shortcutKeys:i,tooltip:e,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=g.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:o,t:e,extension:i})=>({componentProps:{action:()=>o.commands.toggleBulletList(),isActive:()=>o.isActive("bulletList"),disabled:!1,shortcutKeys:i.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:e("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BCzvbrf5.cjs"),s=require("react/jsx-runtime"),n=require("./index-Bt9LiArC.cjs");require("react");require("./theme.cjs");function g(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=g;
package/lib/BulletList.js CHANGED
@@ -1,20 +1,21 @@
1
- import { B as d } from "./index-s3l5RdyW.js";
1
+ import { B as d } from "./index-DjDf4BK8.js";
2
2
  import { jsx as c, Fragment as m } from "react/jsx-runtime";
3
- import { A as f } from "./toggle-DoJTBdvy.js";
4
- import { u as v, c as A } from "./useButtonProps-BE10eHkG.js";
5
- function x() {
6
- const t = v(B.name), {
3
+ import { u as f, d as v, A } from "./index-8B00E8e4.js";
4
+ import "react";
5
+ import "./theme.js";
6
+ function y() {
7
+ const t = f(B.name), {
7
8
  icon: o = void 0,
8
9
  tooltip: i = void 0,
9
10
  shortcutKeys: s = void 0,
10
11
  tooltipOptions: r = {},
11
12
  action: e = void 0,
12
13
  isActive: l = void 0
13
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: u, disabled: n, update: a } = A(l), p = () => {
14
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: u, disabled: n, update: a } = v(l), p = () => {
14
15
  n || e && (e(), a());
15
16
  };
16
17
  return t ? /* @__PURE__ */ c(
17
- f,
18
+ A,
18
19
  {
19
20
  action: p,
20
21
  dataState: u,
@@ -48,5 +49,5 @@ const B = /* @__PURE__ */ d.extend({
48
49
  });
49
50
  export {
50
51
  B as BulletList,
51
- x as RichTextBulletList
52
+ y as RichTextBulletList
52
53
  };
package/lib/Callout.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),L=require("./toggle-oFwBZC4x.cjs"),t=require("react/jsx-runtime"),n=require("lucide-react"),x=require("react"),c=require("./dialog-B-jOQ5i3.cjs"),s=require("./select-7ubC1NF0.cjs"),p=require("./useButtonProps-CFu0GHzW.cjs"),H=require("./index-bVGIXhRg.cjs"),b=require("./label-CFax-gzo.cjs"),y=require("./input-s0JD5kf2.cjs"),T=require("./button-BmTP96NR.cjs"),A=[{value:"note",label:"Note",icon:n.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:n.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:n.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:n.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:n.OctagonAlert,color:"#f85149",background:"#f851491f"}];function R({node:e}){const{type:l="note",title:o="",body:u=""}=e.attrs,d=(A.find(h=>h.value===l)||A[0]).icon;return t.jsx(i.NodeViewWrapper,{children:t.jsxs("div",{className:i.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":l==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":l==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":l==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":l==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":l==="caution"}),children:[t.jsxs("div",{className:i.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":l==="note","richtext-text-[#238636]":l==="tip","richtext-text-[#ab7df8]":l==="important","richtext-text-[#d29922]":l==="warning","richtext-text-[#f85149]":l==="caution"}),children:[t.jsx(d,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:o})]}),u&&t.jsx("p",{className:"richtext-pl-[28px]",children:u})]})})}const D=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function P(){const{t:e}=H.useLocale(),l=p.useEditorInstance(),o=p.useButtonProps(N.name),[u,a]=x.useState(!1),[d,h]=x.useState("note"),[f,v]=x.useState(""),[m,j]=x.useState(""),{icon:S=void 0,tooltip:q=void 0,shortcutKeys:I=void 0,tooltipOptions:O={},isActive:k=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:w,disabled:C}=p.useToggleActive(k),B=()=>{l&&(l.chain().focus().setCallout({type:d,title:f,body:m}).run(),a(!1),h("note"),v(""),j(""))},M=()=>{C||a(!0)};return o?t.jsxs(c.Dialog,{onOpenChange:a,open:u,children:[t.jsx(c.DialogTrigger,{asChild:!0,children:t.jsx(L.ActionButton,{action:M,dataState:w,disabled:C,icon:S,shortcutKeys:I,tooltip:q,tooltipOptions:O})}),t.jsxs(c.DialogContent,{children:[t.jsx(c.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(b.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(s.Select,{onValueChange:h,value:d,children:[t.jsx(s.SelectTrigger,{children:t.jsx(s.SelectValue,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(s.SelectContent,{children:D.map(r=>t.jsx(s.SelectItem,{value:r.value,children:e(`editor.callout.type.${r.value}`)},r.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(b.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(y.Input,{onChange:r=>v(r.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:f})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(b.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(y.Input,{onChange:r=>j(r.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:m})]})]}),t.jsxs(c.DialogFooter,{children:[t.jsx(T.Button,{onClick:()=>a(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(T.Button,{onClick:B,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function g(e){return l=>l.getAttribute(e)}const N=i.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:l,t:o})=>({component:L.ActionButton,componentProps:{action:()=>!0,isActive:()=>l.isActive("callout"),disabled:!1,icon:"Callout",tooltip:o("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",i.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:g("type")},title:{default:"",parseHTML:g("title")},body:{default:"",parseHTML:g("body")}}},addCommands(){return{setCallout:e=>({chain:l})=>l().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return i.ReactNodeViewRenderer(R)}});exports.Callout=N;exports.RichTextCallout=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./clsx-CXbNJWDD.cjs"),o=require("./index-Bt9LiArC.cjs"),t=require("react/jsx-runtime"),x=require("react");require("./theme.cjs");const c=require("lucide-react"),s=require("./select-B7v1Scb-.cjs"),k=require("./index-BrxL7y9p.cjs"),j=[{value:"note",label:"Note",icon:c.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:c.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:c.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:c.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:c.OctagonAlert,color:"#f85149",background:"#f851491f"}];function q({node:e}){const{type:l="note",title:r="",body:u=""}=e.attrs,d=(j.find(h=>h.value===l)||j[0]).icon;return t.jsx(a.NodeViewWrapper,{children:t.jsxs("div",{className:a.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":l==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":l==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":l==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":l==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":l==="caution"}),children:[t.jsxs("div",{className:a.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":l==="note","richtext-text-[#238636]":l==="tip","richtext-text-[#ab7df8]":l==="important","richtext-text-[#d29922]":l==="warning","richtext-text-[#f85149]":l==="caution"}),children:[t.jsx(d,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:r})]}),u&&t.jsx("p",{className:"richtext-pl-[28px]",children:u})]})})}const w=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function M(){const{t:e}=k.useLocale(),l=o.useEditorInstance(),r=o.useButtonProps(C.name),[u,n]=x.useState(!1),[d,h]=x.useState("note"),[b,g]=x.useState(""),[f,v]=x.useState(""),{icon:y=void 0,tooltip:T=void 0,shortcutKeys:A=void 0,tooltipOptions:L={},isActive:N=void 0}=(r==null?void 0:r.componentProps)??{},{dataState:S,disabled:m}=o.useToggleActive(N),I=()=>{l&&(l.chain().focus().setCallout({type:d,title:b,body:f}).run(),n(!1),h("note"),g(""),v(""))},O=()=>{m||n(!0)};return r?t.jsxs(o.Dialog,{onOpenChange:n,open:u,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:O,dataState:S,disabled:m,icon:y,shortcutKeys:A,tooltip:T,tooltipOptions:L})}),t.jsxs(o.DialogContent,{children:[t.jsx(o.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(s.Select,{onValueChange:h,value:d,children:[t.jsx(s.SelectTrigger,{children:t.jsx(s.SelectValue,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(s.SelectContent,{children:w.map(i=>t.jsx(s.SelectItem,{value:i.value,children:e(`editor.callout.type.${i.value}`)},i.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(o.Input,{onChange:i=>g(i.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:b})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(o.Input,{onChange:i=>v(i.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:f})]})]}),t.jsxs(o.DialogFooter,{children:[t.jsx(o.Button,{onClick:()=>n(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(o.Button,{onClick:I,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function p(e){return l=>l.getAttribute(e)}const C=a.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:l,t:r})=>({component:o.ActionButton,componentProps:{action:()=>!0,isActive:()=>l.isActive("callout"),disabled:!1,icon:"Callout",tooltip:r("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",a.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:p("type")},title:{default:"",parseHTML:p("title")},body:{default:"",parseHTML:p("body")}}},addCommands(){return{setCallout:e=>({chain:l})=>l().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return a.ReactNodeViewRenderer(q)}});exports.Callout=C;exports.RichTextCallout=M;
package/lib/Callout.js CHANGED
@@ -1,54 +1,50 @@
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-DoJTBdvy.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";
1
+ import { h as D, j as x, N as H, k as M, m as B } from "./clsx-CDyrfCnw.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-8B00E8e4.js";
3
+ import { jsx as o, jsxs as l, Fragment as Y } from "react/jsx-runtime";
5
4
  import { useState as s } from "react";
6
- import { D as F, a as U, b as Y, c as _, d as $ } from "./dialog-QWWUWOGP.js";
7
- import { S as z, a as K, b as q, c as G, d as J } from "./select-B3-5wTqn.js";
8
- import { f as Q, u as X, c as Z } from "./useButtonProps-BE10eHkG.js";
9
- import { u as tt } from "./index-4Q5IhypJ.js";
10
- import { L as u } from "./label-DC37f2RQ.js";
11
- import { I as v } from "./input-qvpuOf-3.js";
12
- import { B as C } from "./button-CDIxPURh.js";
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-BxFDMaZi.js";
8
+ import { u as tt } from "./index-DZfkCNKr.js";
13
9
  const y = [
14
10
  {
15
11
  value: "note",
16
12
  label: "Note",
17
- icon: P,
13
+ icon: _,
18
14
  color: "#1f6feb",
19
15
  background: "#1f6feb1f"
20
16
  },
21
17
  {
22
18
  value: "tip",
23
19
  label: "Tip",
24
- icon: j,
20
+ icon: $,
25
21
  color: "#238636",
26
22
  background: "#2386361f"
27
23
  },
28
24
  {
29
25
  value: "important",
30
26
  label: "Important",
31
- icon: E,
27
+ icon: z,
32
28
  color: "#ab7df8",
33
29
  background: "#ab7df81f"
34
30
  },
35
31
  {
36
32
  value: "warning",
37
33
  label: "Warning",
38
- icon: R,
34
+ icon: K,
39
35
  color: "#d29922",
40
36
  background: "#d299221f"
41
37
  },
42
38
  {
43
39
  value: "caution",
44
40
  label: "Caution",
45
- icon: W,
41
+ icon: q,
46
42
  color: "#f85149",
47
43
  background: "#f851491f"
48
44
  }
49
45
  ];
50
46
  function et({ node: t }) {
51
- const { type: e = "note", title: r = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
47
+ const { type: e = "note", title: a = "", body: n = "" } = t.attrs, c = (y.find((d) => d.value === e) || y[0]).icon;
52
48
  return /* @__PURE__ */ o(D, { children: /* @__PURE__ */ l(
53
49
  "div",
54
50
  {
@@ -75,7 +71,7 @@ function et({ node: t }) {
75
71
  }),
76
72
  children: [
77
73
  /* @__PURE__ */ o(c, { className: "richtext-size-5" }),
78
- /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: r })
74
+ /* @__PURE__ */ o("span", { className: "richtext-font-semibold", children: a })
79
75
  ]
80
76
  }
81
77
  ),
@@ -91,39 +87,39 @@ const ot = [
91
87
  { value: "warning", label: "Warning", icon: "TriangleAlert" },
92
88
  { value: "caution", label: "Caution", icon: "OctagonAlert" }
93
89
  ];
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(""), {
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(""), {
96
92
  icon: A = void 0,
97
93
  tooltip: N = void 0,
98
94
  shortcutKeys: L = void 0,
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(""));
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(""));
103
99
  }, O = () => {
104
100
  m || i(!0);
105
101
  };
106
- return r ? /* @__PURE__ */ l(F, { onOpenChange: i, open: n, children: [
107
- /* @__PURE__ */ o(U, { asChild: !0, children: /* @__PURE__ */ o(
102
+ return a ? /* @__PURE__ */ l(E, { onOpenChange: i, open: n, children: [
103
+ /* @__PURE__ */ o(R, { asChild: !0, children: /* @__PURE__ */ o(
108
104
  T,
109
105
  {
110
106
  action: O,
111
- dataState: k,
107
+ dataState: I,
112
108
  disabled: m,
113
109
  icon: A,
114
110
  shortcutKeys: L,
115
111
  tooltip: N,
116
- tooltipOptions: I
112
+ tooltipOptions: S
117
113
  }
118
114
  ) }),
119
- /* @__PURE__ */ l(Y, { children: [
120
- /* @__PURE__ */ o(_, { children: t("editor.callout.dialog.title") }),
115
+ /* @__PURE__ */ l(W, { children: [
116
+ /* @__PURE__ */ o(F, { children: t("editor.callout.dialog.title") }),
121
117
  /* @__PURE__ */ l("div", { className: "richtext-space-y-4 richtext-py-4", children: [
122
118
  /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
123
119
  /* @__PURE__ */ o(u, { children: t("editor.callout.dialog.type") }),
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)) })
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)) })
127
123
  ] })
128
124
  ] }),
129
125
  /* @__PURE__ */ l("div", { className: "richtext-space-y-2", children: [
@@ -131,9 +127,9 @@ function gt() {
131
127
  /* @__PURE__ */ o(
132
128
  v,
133
129
  {
134
- onChange: (a) => b(a.target.value),
130
+ onChange: (r) => b(r.target.value),
135
131
  placeholder: t("editor.callout.dialog.title.placeholder"),
136
- value: h
132
+ value: p
137
133
  }
138
134
  )
139
135
  ] }),
@@ -142,21 +138,21 @@ function gt() {
142
138
  /* @__PURE__ */ o(
143
139
  v,
144
140
  {
145
- onChange: (a) => g(a.target.value),
141
+ onChange: (r) => f(r.target.value),
146
142
  placeholder: t("editor.callout.dialog.body.placeholder"),
147
- value: f
143
+ value: g
148
144
  }
149
145
  )
150
146
  ] })
151
147
  ] }),
152
- /* @__PURE__ */ l($, { children: [
148
+ /* @__PURE__ */ l(U, { children: [
153
149
  /* @__PURE__ */ o(C, { onClick: () => i(!1), variant: "outline", children: t("editor.callout.dialog.button.cancel") }),
154
150
  /* @__PURE__ */ o(C, { onClick: w, children: t("editor.callout.dialog.button.apply") })
155
151
  ] })
156
152
  ] })
157
- ] }) : /* @__PURE__ */ o(V, {});
153
+ ] }) : /* @__PURE__ */ o(Y, {});
158
154
  }
159
- function p(t) {
155
+ function h(t) {
160
156
  return (e) => e.getAttribute(t);
161
157
  }
162
158
  const lt = /* @__PURE__ */ H.create({
@@ -174,14 +170,14 @@ const lt = /* @__PURE__ */ H.create({
174
170
  HTMLAttributes: {
175
171
  class: "callout"
176
172
  },
177
- button: ({ editor: e, t: r }) => ({
173
+ button: ({ editor: e, t: a }) => ({
178
174
  component: T,
179
175
  componentProps: {
180
176
  action: () => !0,
181
177
  isActive: () => e.isActive("callout"),
182
178
  disabled: !1,
183
179
  icon: "Callout",
184
- tooltip: r("editor.callout.tooltip")
180
+ tooltip: a("editor.callout.tooltip")
185
181
  }
186
182
  })
187
183
  };
@@ -199,15 +195,15 @@ const lt = /* @__PURE__ */ H.create({
199
195
  return {
200
196
  type: {
201
197
  default: "",
202
- parseHTML: p("type")
198
+ parseHTML: h("type")
203
199
  },
204
200
  title: {
205
201
  default: "",
206
- parseHTML: p("title")
202
+ parseHTML: h("title")
207
203
  },
208
204
  body: {
209
205
  default: "",
210
- parseHTML: p("body")
206
+ parseHTML: h("body")
211
207
  }
212
208
  };
213
209
  },
@@ -225,5 +221,5 @@ const lt = /* @__PURE__ */ H.create({
225
221
  });
226
222
  export {
227
223
  lt as Callout,
228
- gt as RichTextCallout
224
+ ht as RichTextCallout
229
225
  };
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"),v=require("./toggle-oFwBZC4x.cjs"),c=require("./useButtonProps-CFu0GHzW.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./clsx-CXbNJWDD.cjs"),n=require("react/jsx-runtime"),i=require("./index-Bt9LiArC.cjs");function v(){const t=i.useButtonProps(s.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:a=void 0,tooltipOptions:u={},action:r=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{disabled:c}=i.useActive(l),d=()=>{c||r&&r()};return t?n.jsx(i.ActionButton,{action:d,disabled:c,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;
package/lib/Clear.js CHANGED
@@ -1,31 +1,30 @@
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-DoJTBdvy.js";
4
- import { u as m, d as f } from "./useButtonProps-BE10eHkG.js";
5
- function k() {
6
- const o = m(v.name), {
1
+ import { N as l } from "./clsx-CDyrfCnw.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-8B00E8e4.js";
4
+ function x() {
5
+ const o = d(v.name), {
7
6
  icon: t = void 0,
8
7
  tooltip: n = void 0,
9
8
  shortcutKeys: s = void 0,
10
9
  tooltipOptions: c = {},
11
10
  action: i = void 0,
12
11
  isActive: a = void 0
13
- } = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: r } = f(a), u = () => {
14
- r || i && i();
12
+ } = (o == null ? void 0 : o.componentProps) ?? {}, { disabled: e } = m(a), u = () => {
13
+ e || i && i();
15
14
  };
16
- return o ? /* @__PURE__ */ e(
17
- d,
15
+ return o ? /* @__PURE__ */ r(
16
+ f,
18
17
  {
19
18
  action: u,
20
- disabled: r,
19
+ disabled: e,
21
20
  icon: t,
22
21
  shortcutKeys: s,
23
22
  tooltip: n,
24
23
  tooltipOptions: c
25
24
  }
26
- ) : /* @__PURE__ */ e(l, {});
25
+ ) : /* @__PURE__ */ r(p, {});
27
26
  }
28
- const v = /* @__PURE__ */ p.create({
27
+ const v = /* @__PURE__ */ l.create({
29
28
  name: "clear",
30
29
  //@ts-expect-error
31
30
  addOptions() {
@@ -46,5 +45,5 @@ const v = /* @__PURE__ */ p.create({
46
45
  });
47
46
  export {
48
47
  v as Clear,
49
- k as RichTextClear
48
+ x as RichTextClear
50
49
  };
package/lib/Code.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),s=require("react/jsx-runtime"),h=require("./toggle-oFwBZC4x.cjs"),a=require("./useButtonProps-CFu0GHzW.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),i=require("react/jsx-runtime"),s=require("./index-Bt9LiArC.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;
package/lib/Code.js CHANGED
@@ -1,7 +1,8 @@
1
- import { M as m, e as l, f as g, m as h } from "./clsx-m_C5j3RU.js";
1
+ import { M as m, e as l, f as g, m as h } from "./clsx-CDyrfCnw.js";
2
2
  import { jsx as a, Fragment as M } from "react/jsx-runtime";
3
- import { A as f } from "./toggle-DoJTBdvy.js";
4
- import { u as v, c as C } from "./useButtonProps-BE10eHkG.js";
3
+ import { u as v, d as C, A as f } from "./index-8B00E8e4.js";
4
+ import "react";
5
+ import "./theme.js";
5
6
  var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
6
7
  name: "code",
7
8
  addOptions() {
@@ -50,7 +51,7 @@ var k = /(^|[^`])`([^`]+)`(?!`)$/, x = /(^|[^`])`([^`]+)`(?!`)/g, y = m.create({
50
51
  ];
51
52
  }
52
53
  });
53
- function K() {
54
+ function L() {
54
55
  const t = v(A.name), {
55
56
  icon: e = void 0,
56
57
  tooltip: o = void 0,
@@ -95,5 +96,5 @@ const A = /* @__PURE__ */ y.extend({
95
96
  });
96
97
  export {
97
98
  A as Code,
98
- K as RichTextCode
99
+ L as RichTextCode
99
100
  };
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"),T=require("./toggle-oFwBZC4x.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-7ubC1NF0.cjs"),C=require("./useButtonProps-CFu0GHzW.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-CQyFgXeo.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./clsx-CXbNJWDD.cjs"),r=require("react/jsx-runtime"),u=require("./index-Bt9LiArC.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-B7v1Scb-.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;