@aswin.dev/editor 0.6.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/AccessibilityPanel-CvQGLdu6.js +108 -0
  2. package/dist/AiChatSidebar-B3SJIKG_.js +229 -0
  3. package/dist/AiFeatureMenu-BLLKoOos.js +63 -0
  4. package/dist/BlockA11yBadge-CXDLqkcJ.js +34 -0
  5. package/dist/CloudEditor-BCz1ZTYC.js +1172 -0
  6. package/dist/CollaboratorBar-DuPYW5iF.js +95 -0
  7. package/dist/CommentsSidebar-B1pvJdqF.js +441 -0
  8. package/dist/CountdownBlock-BNSj1jvJ.js +92 -0
  9. package/dist/CountdownToolbar-ClJr2GzL.js +210 -0
  10. package/dist/DesignReferenceSidebar-B8V_F2yF.js +276 -0
  11. package/dist/LoadingTrack-B0CWFHXQ.js +10 -0
  12. package/dist/ModuleBrowserModal-DrUFMTDx.js +206 -0
  13. package/dist/ModulePreviewCanvas-CHdOwV_4.js +106 -0
  14. package/dist/NumberWithSuffix-DkXUez9t.js +422 -0
  15. package/dist/ParagraphEditor-D75wl3BX.js +695 -0
  16. package/dist/RichTextEditorContent-DYkIauIk.js +137 -0
  17. package/dist/SaveModuleDialog-FZ9lxY7_.js +123 -0
  18. package/dist/SnapshotHistory-BR3eV120.js +127 -0
  19. package/dist/TemplateScoringPanel-4GTNHej5.js +256 -0
  20. package/dist/TestEmailModal--ue5w9fT.js +94 -0
  21. package/dist/TitleEditor-fStSADI-.js +172 -0
  22. package/dist/TplModal-BwSfxIHf.js +44 -0
  23. package/dist/_plugin-vue_export-helper-B0hnzhyu.js +8 -0
  24. package/dist/accessibility-e8JYu_zd.js +27 -0
  25. package/dist/blockTypeIcons-BcTrDjmH.js +126 -0
  26. package/dist/bundle-stats.json +10 -0
  27. package/dist/cdn/chunks/AccessibilityPanel-B6DOjojm.js +97 -0
  28. package/dist/cdn/chunks/AccessibilityPanel-B6DOjojm.js.map +1 -0
  29. package/dist/cdn/chunks/AiFeatureMenu-qEdB2fZJ.js +59 -0
  30. package/dist/cdn/chunks/AiFeatureMenu-qEdB2fZJ.js.map +1 -0
  31. package/dist/cdn/chunks/BlockA11yBadge-DcEZftf6.js +33 -0
  32. package/dist/cdn/chunks/BlockA11yBadge-DcEZftf6.js.map +1 -0
  33. package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js +1143 -0
  34. package/dist/cdn/chunks/CloudEditor-D2GsEC_n.js.map +1 -0
  35. package/dist/cdn/chunks/CollaboratorBar--nO7TX6b.js +51 -0
  36. package/dist/cdn/chunks/CollaboratorBar--nO7TX6b.js.map +1 -0
  37. package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js +93 -0
  38. package/dist/cdn/chunks/CountdownBlock-5YdT1uUu.js.map +1 -0
  39. package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js +212 -0
  40. package/dist/cdn/chunks/CountdownToolbar-DXPXrbAA.js.map +1 -0
  41. package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js +195 -0
  42. package/dist/cdn/chunks/ModuleBrowserModal-DxoPp81s.js.map +1 -0
  43. package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js +107 -0
  44. package/dist/cdn/chunks/ModulePreviewCanvas-CoLdb4ar.js.map +1 -0
  45. package/dist/cdn/chunks/NumberWithSuffix-CE3NrZhH.js +423 -0
  46. package/dist/cdn/chunks/NumberWithSuffix-CE3NrZhH.js.map +1 -0
  47. package/dist/cdn/chunks/ParagraphEditor-B6Ygu-Mq.js +544 -0
  48. package/dist/cdn/chunks/ParagraphEditor-B6Ygu-Mq.js.map +1 -0
  49. package/dist/cdn/chunks/RichTextEditorContent-DL_y2SrR.js +106 -0
  50. package/dist/cdn/chunks/RichTextEditorContent-DL_y2SrR.js.map +1 -0
  51. package/dist/cdn/chunks/SaveModuleDialog-B0TnO_o9.js +119 -0
  52. package/dist/cdn/chunks/SaveModuleDialog-B0TnO_o9.js.map +1 -0
  53. package/dist/cdn/chunks/TitleEditor-BHpfxvwy.js +171 -0
  54. package/dist/cdn/chunks/TitleEditor-BHpfxvwy.js.map +1 -0
  55. package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js +22 -0
  56. package/dist/cdn/chunks/blockTypeIcons-BzzY9_kA.js.map +1 -0
  57. package/dist/cdn/chunks/de-Ce-LbJ2J.js +89 -0
  58. package/dist/cdn/chunks/de-Ce-LbJ2J.js.map +1 -0
  59. package/dist/cdn/chunks/de-D8CnZxV9.js +523 -0
  60. package/dist/cdn/chunks/de-D8CnZxV9.js.map +1 -0
  61. package/dist/cdn/chunks/de-RQrZR56a.js +209 -0
  62. package/dist/cdn/chunks/de-RQrZR56a.js.map +1 -0
  63. package/dist/cdn/chunks/draggable-Bcb86AsV.js +11572 -0
  64. package/dist/cdn/chunks/draggable-Bcb86AsV.js.map +1 -0
  65. package/dist/cdn/chunks/emojiData-EMFlj6FJ.js +19 -0
  66. package/dist/cdn/chunks/emojiData-EMFlj6FJ.js.map +1 -0
  67. package/dist/cdn/chunks/en-8FHaQv4V.js +523 -0
  68. package/dist/cdn/chunks/en-8FHaQv4V.js.map +1 -0
  69. package/dist/cdn/chunks/en-Bl1ecfRF.js +209 -0
  70. package/dist/cdn/chunks/en-Bl1ecfRF.js.map +1 -0
  71. package/dist/cdn/chunks/en-DiCWK5fG.js +89 -0
  72. package/dist/cdn/chunks/en-DiCWK5fG.js.map +1 -0
  73. package/dist/cdn/chunks/extensions-DIxF31tA.js +598 -0
  74. package/dist/cdn/chunks/extensions-DIxF31tA.js.map +1 -0
  75. package/dist/cdn/chunks/features-DEMb13KS.js +6814 -0
  76. package/dist/cdn/chunks/features-DEMb13KS.js.map +1 -0
  77. package/dist/cdn/chunks/icons-CsLTcirh.js +700 -0
  78. package/dist/cdn/chunks/icons-CsLTcirh.js.map +1 -0
  79. package/dist/cdn/chunks/liquid.browser-lQbkge2E.js +3279 -0
  80. package/dist/cdn/chunks/liquid.browser-lQbkge2E.js.map +1 -0
  81. package/dist/cdn/chunks/media-library-CVaNvhpM.js +6014 -0
  82. package/dist/cdn/chunks/media-library-CVaNvhpM.js.map +1 -0
  83. package/dist/cdn/chunks/pusher-CDbNlZBE.js +2508 -0
  84. package/dist/cdn/chunks/pusher-CDbNlZBE.js.map +1 -0
  85. package/dist/cdn/chunks/quality-BaBfc54_.js +1456 -0
  86. package/dist/cdn/chunks/quality-BaBfc54_.js.map +1 -0
  87. package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js +32 -0
  88. package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js.map +1 -0
  89. package/dist/cdn/chunks/renderer-CUxvx7ro.js +548 -0
  90. package/dist/cdn/chunks/renderer-CUxvx7ro.js.map +1 -0
  91. package/dist/cdn/chunks/rolldown-runtime-BNuo_Jkg.js +20 -0
  92. package/dist/cdn/chunks/src-CRaqN-p8.js +497 -0
  93. package/dist/cdn/chunks/src-CRaqN-p8.js.map +1 -0
  94. package/dist/cdn/chunks/styleConstants-DP1VOca8.js +57 -0
  95. package/dist/cdn/chunks/styleConstants-DP1VOca8.js.map +1 -0
  96. package/dist/cdn/chunks/styles-BHJULjNR.js +2947 -0
  97. package/dist/cdn/chunks/styles-BHJULjNR.js.map +1 -0
  98. package/dist/cdn/chunks/tiptap-ZhwKyFp7.js +14654 -0
  99. package/dist/cdn/chunks/tiptap-ZhwKyFp7.js.map +1 -0
  100. package/dist/cdn/editor.css +2 -0
  101. package/dist/cdn/editor.js +250 -0
  102. package/dist/cdn/editor.js.map +1 -0
  103. package/dist/check-Da05j8yl.js +7 -0
  104. package/dist/chevron-down-R2uY34iD.js +7 -0
  105. package/dist/circle-alert-DZuGWPX-.js +25 -0
  106. package/dist/clock-CRp2sIub.js +12 -0
  107. package/dist/cloud-DEk_b4CR.js +1733 -0
  108. package/dist/createLucideIcon-C3pa2siy.js +43 -0
  109. package/dist/de-Brqvgr43.js +521 -0
  110. package/dist/de-DCaaCE5s.js +207 -0
  111. package/dist/dist-B1IR0bpH.js +326 -0
  112. package/dist/dist-BFawx6IS.js +519 -0
  113. package/dist/dist-BaQIYPsn.js +35 -0
  114. package/dist/dist-Cp0zXPAD.js +189 -0
  115. package/dist/dist-D6uC2xhi.js +5 -0
  116. package/dist/dist-D90y8dvT.js +2082 -0
  117. package/dist/dist-DDJIWTRY.js +776 -0
  118. package/dist/dist-DJmnUmW9.js +362 -0
  119. package/dist/dist-DjviJBCi.js +74 -0
  120. package/dist/dist-KoBJjK1G.js +61 -0
  121. package/dist/dist-aRzjfSRN.js +35 -0
  122. package/dist/dist-iLBdeBDR.js +10658 -0
  123. package/dist/dist-us-RpCWN.js +47 -0
  124. package/dist/dist-wzMIGj-D.js +5 -0
  125. package/dist/emojiData-PQyVa4bU.js +17 -0
  126. package/dist/en-DXCyK4-X.js +207 -0
  127. package/dist/en-WDVp87TE.js +521 -0
  128. package/dist/extensions-CUcl9Ok4.js +799 -0
  129. package/dist/formatRelativeTime-BOEf47hq.js +12 -0
  130. package/dist/image-up-MBZKKg9p.js +23 -0
  131. package/dist/index.d.ts +275 -0
  132. package/dist/info-CJEC7piy.js +19 -0
  133. package/dist/keys-ciNfSSGj.js +10 -0
  134. package/dist/liquid.browser-CdMv1BTn.js +3277 -0
  135. package/dist/loader-circle-DsY5Yg33.js +7 -0
  136. package/dist/message-circle-yElBbR2C.js +7 -0
  137. package/dist/readableTextColor-CY3SiRnt.js +30 -0
  138. package/dist/refresh-cw-CE_AGtn8.js +29 -0
  139. package/dist/rolldown-runtime-BZGGJVDF.js +20 -0
  140. package/dist/scan-line-D0vcUekt.js +25 -0
  141. package/dist/send-DH4oDQqC.js +10 -0
  142. package/dist/shield-check-CfJgs2Hd.js +10 -0
  143. package/dist/sparkles-CvRXGqFs.js +23 -0
  144. package/dist/style.css +2 -0
  145. package/dist/styleConstants-fWzlIIwN.js +55 -0
  146. package/dist/styles-DEXEkBvg.js +3176 -0
  147. package/dist/templatical-editor.js +249 -0
  148. package/dist/text-align-start-BT9VUDxK.js +43 -0
  149. package/dist/timeouts-BSGxjuUF.js +4 -0
  150. package/dist/trash-2-DbP2Y6t2.js +25 -0
  151. package/dist/triangle-alert-aOXceTSe.js +17 -0
  152. package/dist/useCloudI18n-BuIwR6OE.js +23 -0
  153. package/dist/useEditorCore-C6ost42Q.js +9342 -0
  154. package/dist/useI18n-lb2DHDiu.js +17 -0
  155. package/dist/useMergeTag-CBwKnnNB.js +34 -0
  156. package/dist/vue.runtime.esm-bundler-DpvJL-nX.js +5775 -0
  157. package/dist/x-u2oVmjN_.js +10 -0
  158. package/package.json +1 -1
@@ -0,0 +1,598 @@
1
+ import { $ as e, F as t, H as n, N as r, S as i, U as a, _ as o, at as s, ct as c, d as l, g as u, h as d, k as f, l as p, lt as m, m as h, p as g, r as _, s as v, st as y, u as b, w as x } from "./draggable-Bcb86AsV.js";
2
+ import { Nt as S, Z as C, fn as w, gn as T, hn as E, mn as D } from "./features-DEMb13KS.js";
3
+ import { _ as O, g as k, h as A, n as j, r as M, t as N, v as P, y as F } from "./tiptap-ZhwKyFp7.js";
4
+ //#region src/extensions/FontSize.ts
5
+ var I = A.create({
6
+ name: "fontSize",
7
+ addOptions() {
8
+ return { types: ["textStyle"] };
9
+ },
10
+ addGlobalAttributes() {
11
+ return [{
12
+ types: this.options.types,
13
+ attributes: { fontSize: {
14
+ default: null,
15
+ parseHTML: (e) => e.style.fontSize?.replace(/['"]+/g, "") || null,
16
+ renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
17
+ } }
18
+ }];
19
+ },
20
+ addCommands() {
21
+ return {
22
+ setFontSize: (e) => ({ chain: t }) => t().setMark("textStyle", { fontSize: e }).run(),
23
+ unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
24
+ };
25
+ }
26
+ }), L = A.create({
27
+ name: "letterSpacing",
28
+ addOptions() {
29
+ return { types: ["textStyle"] };
30
+ },
31
+ addGlobalAttributes() {
32
+ return [{
33
+ types: this.options.types,
34
+ attributes: { letterSpacing: {
35
+ default: null,
36
+ parseHTML: (e) => e.style.letterSpacing?.replace(/['"]+/g, "") || null,
37
+ renderHTML: (e) => e.letterSpacing ? { style: `letter-spacing: ${e.letterSpacing}` } : {}
38
+ } }
39
+ }];
40
+ },
41
+ addCommands() {
42
+ return {
43
+ setLetterSpacing: (e) => ({ chain: t }) => t().setMark("textStyle", { letterSpacing: e }).run(),
44
+ unsetLetterSpacing: () => ({ chain: e }) => e().setMark("textStyle", { letterSpacing: null }).removeEmptyTextStyle().run()
45
+ };
46
+ }
47
+ }), R = A.create({
48
+ name: "lineHeight",
49
+ addOptions() {
50
+ return {
51
+ types: ["paragraph"],
52
+ defaultLineHeight: "1.5"
53
+ };
54
+ },
55
+ addGlobalAttributes() {
56
+ return [{
57
+ types: this.options.types,
58
+ attributes: { lineHeight: {
59
+ default: null,
60
+ parseHTML: (e) => e.style.lineHeight || null,
61
+ renderHTML: (e) => e.lineHeight ? { style: `line-height: ${e.lineHeight}` } : {}
62
+ } }
63
+ }];
64
+ },
65
+ addCommands() {
66
+ return {
67
+ setLineHeight: (e) => ({ commands: t }) => this.options.types.every((n) => t.updateAttributes(n, { lineHeight: e })),
68
+ unsetLineHeight: () => ({ commands: e }) => this.options.types.every((t) => e.resetAttributes(t, "lineHeight"))
69
+ };
70
+ }
71
+ }), ee = [
72
+ "aria-label",
73
+ "data-tooltip",
74
+ "onKeydown"
75
+ ], te = ["aria-label", "onKeydown"], ne = ["aria-label"], z = /* @__PURE__ */ i({
76
+ __name: "LogicMergeTagNodeView",
77
+ props: {
78
+ node: {},
79
+ editor: {},
80
+ getPos: { type: Function },
81
+ deleteNode: { type: Function },
82
+ updateAttributes: { type: Function }
83
+ },
84
+ setup(t) {
85
+ let i = t, { syntax: l } = C(), { t: _ } = S(), x = g(() => T(i.node.attrs.value, l)), w = g(() => D(i.node.attrs.value, l)), E = e(!1), O = e(""), k = e(null), A = !1;
86
+ function M() {
87
+ O.value = i.node.attrs.value, A = !1, E.value = !0, f(() => {
88
+ k.value?.focus(), k.value?.select();
89
+ });
90
+ }
91
+ function N() {
92
+ if (A) return;
93
+ A = !0;
94
+ let e = O.value.trim();
95
+ if (!e) {
96
+ E.value = !1;
97
+ return;
98
+ }
99
+ e !== i.node.attrs.value && i.updateAttributes({
100
+ value: e,
101
+ keyword: T(e, l) ? D(e, l) : ""
102
+ }), E.value = !1;
103
+ }
104
+ function P(e) {
105
+ e.key === "Enter" ? (e.preventDefault(), N()) : e.key === "Escape" && (E.value = !1);
106
+ }
107
+ return (e, i) => (r(), d(s(j), {
108
+ as: "span",
109
+ class: y(x.value ? "tpl-logic-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.8em] tpl:font-bold tpl:tracking-wide tpl:uppercase tpl:select-none" : ""),
110
+ style: c(x.value ? "background-color: transparent; border: 1.5px solid color-mix(in srgb, var(--tpl-primary) 50%, transparent); color: var(--tpl-primary);" : ""),
111
+ contenteditable: "false"
112
+ }, {
113
+ default: n(() => [E.value ? a((r(), o("input", {
114
+ key: 0,
115
+ ref_key: "inputRef",
116
+ ref: k,
117
+ "onUpdate:modelValue": i[0] ||= (e) => O.value = e,
118
+ type: "text",
119
+ class: "tpl:w-40 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:normal-case tpl:outline-none tpl:text-[var(--tpl-primary)]",
120
+ onBlur: N,
121
+ onKeydown: P
122
+ }, null, 544)), [[v, O.value]]) : x.value ? (r(), o("span", {
123
+ key: 1,
124
+ role: "button",
125
+ tabindex: "0",
126
+ "aria-label": s(_).mergeTag.editValue,
127
+ class: "tpl-tooltip tpl:cursor-pointer",
128
+ "data-tooltip": t.node.attrs.value,
129
+ onClick: b(M, ["stop"]),
130
+ onKeydown: [p(b(M, ["stop"]), ["enter"]), p(b(M, ["prevent", "stop"]), ["space"])]
131
+ }, m(w.value), 41, ee)) : (r(), o("span", {
132
+ key: 2,
133
+ role: "button",
134
+ tabindex: "0",
135
+ "aria-label": s(_).mergeTag.editValue,
136
+ onClick: b(M, ["stop"]),
137
+ onKeydown: [p(b(M, ["stop"]), ["enter"]), p(b(M, ["prevent", "stop"]), ["space"])]
138
+ }, m(t.node.attrs.value), 41, te)), x.value ? (r(), o("button", {
139
+ key: 3,
140
+ type: "button",
141
+ "aria-label": s(_).mergeTag.deleteMergeTag,
142
+ class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
143
+ contenteditable: "false",
144
+ onClick: i[1] ||= b((...e) => t.deleteNode && t.deleteNode(...e), ["stop", "prevent"])
145
+ }, [...i[2] ||= [h("svg", {
146
+ width: "10",
147
+ height: "10",
148
+ viewBox: "0 0 24 24",
149
+ fill: "none",
150
+ stroke: "currentColor",
151
+ "stroke-width": "3",
152
+ "aria-hidden": "true"
153
+ }, [h("line", {
154
+ x1: "18",
155
+ y1: "6",
156
+ x2: "6",
157
+ y2: "18"
158
+ }), h("line", {
159
+ x1: "6",
160
+ y1: "6",
161
+ x2: "18",
162
+ y2: "18"
163
+ })], -1)]], 8, ne)) : u("", !0)]),
164
+ _: 1
165
+ }, 8, ["class", "style"]));
166
+ }
167
+ });
168
+ //#endregion
169
+ //#region src/extensions/isNodeSelected.ts
170
+ function B(e, t) {
171
+ let { selection: n } = e.state, { $from: r, $to: i } = n, a = !1;
172
+ return e.state.doc.nodesBetween(r.pos, i.pos, (e) => {
173
+ if (e.type.name === t) return a = !0, !1;
174
+ }), !!(a || r.pos > 0 && r.nodeBefore?.type.name === t || r.nodeAfter?.type.name === t);
175
+ }
176
+ //#endregion
177
+ //#region src/extensions/renderVueNodeView.ts
178
+ function V(e) {
179
+ return M(e);
180
+ }
181
+ //#endregion
182
+ //#region src/extensions/LogicMergeTagNode.ts
183
+ var H = O.create({
184
+ name: "logicMergeTagNode",
185
+ group: "inline",
186
+ inline: !0,
187
+ atom: !0,
188
+ addOptions() {
189
+ return { syntax: w.liquid };
190
+ },
191
+ addAttributes() {
192
+ return {
193
+ value: {
194
+ default: "",
195
+ parseHTML: (e) => e.getAttribute("data-logic-merge-tag") || ""
196
+ },
197
+ keyword: {
198
+ default: "",
199
+ parseHTML: (e) => e.getAttribute("data-keyword") || e.textContent || ""
200
+ }
201
+ };
202
+ },
203
+ parseHTML() {
204
+ return [{ tag: "span[data-logic-merge-tag]" }];
205
+ },
206
+ renderHTML({ node: e, HTMLAttributes: t }) {
207
+ if (!T(e.attrs.value, this.options.syntax)) return [
208
+ "span",
209
+ {},
210
+ e.attrs.value
211
+ ];
212
+ let n = D(e.attrs.value, this.options.syntax);
213
+ return [
214
+ "span",
215
+ F(t, {
216
+ "data-logic-merge-tag": e.attrs.value,
217
+ "data-keyword": n
218
+ }),
219
+ n
220
+ ];
221
+ },
222
+ addNodeView() {
223
+ return V(z);
224
+ },
225
+ addKeyboardShortcuts() {
226
+ return {
227
+ Backspace: () => B(this.editor, this.name),
228
+ Delete: () => B(this.editor, this.name)
229
+ };
230
+ },
231
+ addInputRules() {
232
+ return [new k({
233
+ find: RegExp(this.options.syntax.logic.source + "$", ""),
234
+ handler: ({ state: e, range: t, match: n }) => {
235
+ let r = n[0];
236
+ if (!T(r, this.options.syntax)) return;
237
+ let i = D(r, this.options.syntax), a = this.type.create({
238
+ value: r,
239
+ keyword: i
240
+ });
241
+ e.tr.replaceWith(t.from, t.to, a);
242
+ }
243
+ })];
244
+ },
245
+ addPasteRules() {
246
+ return [new P({
247
+ find: new RegExp(this.options.syntax.logic.source, "g"),
248
+ handler: ({ state: e, range: t, match: n }) => {
249
+ let r = n[0];
250
+ if (!T(r, this.options.syntax)) return;
251
+ let i = D(r, this.options.syntax), a = this.type.create({
252
+ value: r,
253
+ keyword: i
254
+ });
255
+ e.tr.replaceWith(t.from, t.to, a);
256
+ }
257
+ })];
258
+ }
259
+ }), U = [
260
+ "aria-label",
261
+ "data-tooltip",
262
+ "onKeydown"
263
+ ], W = ["aria-label"], G = /* @__PURE__ */ i({
264
+ __name: "MergeTagNodeView",
265
+ props: {
266
+ node: {},
267
+ deleteNode: { type: Function },
268
+ updateAttributes: { type: Function }
269
+ },
270
+ setup(t) {
271
+ let i = t, { getMergeTagLabel: c } = C(), { t: l } = S(), u = g(() => c(i.node.attrs.value)), _ = e(!1), y = e(""), x = e(null);
272
+ function w() {
273
+ y.value = i.node.attrs.value, _.value = !0, f(() => {
274
+ x.value?.focus(), x.value?.select();
275
+ });
276
+ }
277
+ function T() {
278
+ let e = y.value.trim();
279
+ e && e !== i.node.attrs.value && i.updateAttributes({
280
+ value: e,
281
+ label: c(e)
282
+ }), _.value = !1;
283
+ }
284
+ function E(e) {
285
+ e.key === "Enter" ? (e.preventDefault(), T()) : e.key === "Escape" && (_.value = !1);
286
+ }
287
+ return (e, i) => (r(), d(s(j), {
288
+ as: "span",
289
+ class: "tpl-merge-tag-node tpl:group tpl:mx-0.5 tpl:inline-flex tpl:items-center tpl:gap-1 tpl:rounded tpl:px-1.5 tpl:py-0.5 tpl:text-[0.9em] tpl:font-medium tpl:select-none tpl:text-[var(--tpl-primary)]",
290
+ style: { "background-color": "color-mix(in srgb, var(--tpl-primary) 20%, transparent)" },
291
+ contenteditable: "false"
292
+ }, {
293
+ default: n(() => [_.value ? a((r(), o("input", {
294
+ key: 0,
295
+ ref_key: "inputRef",
296
+ ref: x,
297
+ "onUpdate:modelValue": i[0] ||= (e) => y.value = e,
298
+ type: "text",
299
+ class: "tpl:w-32 tpl:rounded tpl:border-none tpl:bg-transparent tpl:px-0.5 tpl:py-0 tpl:text-[1em] tpl:font-medium tpl:outline-none tpl:text-[var(--tpl-primary)]",
300
+ onBlur: T,
301
+ onKeydown: E
302
+ }, null, 544)), [[v, y.value]]) : (r(), o("span", {
303
+ key: 1,
304
+ role: "button",
305
+ tabindex: "0",
306
+ "aria-label": s(l).mergeTag.editValue,
307
+ class: "tpl-tooltip tpl:cursor-pointer",
308
+ "data-tooltip": t.node.attrs.value,
309
+ onClick: b(w, ["stop"]),
310
+ onKeydown: [p(b(w, ["stop"]), ["enter"]), p(b(w, ["prevent", "stop"]), ["space"])]
311
+ }, m(u.value), 41, U)), h("button", {
312
+ type: "button",
313
+ "aria-label": s(l).mergeTag.deleteMergeTag,
314
+ class: "tpl-merge-tag-delete tpl:flex tpl:size-5 tpl:cursor-pointer tpl:items-center tpl:justify-center tpl:rounded-full tpl:border-none tpl:bg-transparent tpl:p-0 tpl:opacity-60 tpl:transition-all hover:tpl:opacity-100 tpl:text-[var(--tpl-primary)]",
315
+ contenteditable: "false",
316
+ onClick: i[1] ||= b((...e) => t.deleteNode && t.deleteNode(...e), ["stop", "prevent"])
317
+ }, [...i[2] ||= [h("svg", {
318
+ width: "10",
319
+ height: "10",
320
+ viewBox: "0 0 24 24",
321
+ fill: "none",
322
+ stroke: "currentColor",
323
+ "stroke-width": "3",
324
+ "aria-hidden": "true"
325
+ }, [h("line", {
326
+ x1: "18",
327
+ y1: "6",
328
+ x2: "6",
329
+ y2: "18"
330
+ }), h("line", {
331
+ x1: "6",
332
+ y1: "6",
333
+ x2: "18",
334
+ y2: "18"
335
+ })], -1)]], 8, W)]),
336
+ _: 1
337
+ }));
338
+ }
339
+ }), K = O.create({
340
+ name: "mergeTagNode",
341
+ group: "inline",
342
+ inline: !0,
343
+ atom: !0,
344
+ addOptions() {
345
+ return {
346
+ mergeTags: [],
347
+ syntax: w.liquid
348
+ };
349
+ },
350
+ addAttributes() {
351
+ return {
352
+ label: {
353
+ default: "",
354
+ parseHTML: (e) => e.getAttribute("data-label") || e.textContent || ""
355
+ },
356
+ value: {
357
+ default: "",
358
+ parseHTML: (e) => e.getAttribute("data-merge-tag") || ""
359
+ }
360
+ };
361
+ },
362
+ parseHTML() {
363
+ return [{ tag: "span[data-merge-tag]" }];
364
+ },
365
+ renderHTML({ node: e, HTMLAttributes: t }) {
366
+ let n = E(e.attrs.value, this.options.mergeTags);
367
+ return [
368
+ "span",
369
+ F(t, {
370
+ "data-merge-tag": e.attrs.value,
371
+ "data-label": n
372
+ }),
373
+ n
374
+ ];
375
+ },
376
+ addNodeView() {
377
+ return V(G);
378
+ },
379
+ addCommands() {
380
+ return { insertMergeTag: (e) => ({ commands: t }) => t.insertContent({
381
+ type: this.name,
382
+ attrs: e
383
+ }) };
384
+ },
385
+ addKeyboardShortcuts() {
386
+ return {
387
+ Backspace: () => B(this.editor, this.name),
388
+ Delete: () => B(this.editor, this.name)
389
+ };
390
+ },
391
+ addInputRules() {
392
+ return [new k({
393
+ find: RegExp(this.options.syntax.value.source + "$", ""),
394
+ handler: ({ state: e, range: t, match: n }) => {
395
+ let r = n[0], i = E(r, this.options.mergeTags), a = this.type.create({
396
+ label: i,
397
+ value: r
398
+ });
399
+ e.tr.replaceWith(t.from, t.to, a);
400
+ }
401
+ })];
402
+ },
403
+ addPasteRules() {
404
+ return [new P({
405
+ find: new RegExp(this.options.syntax.value.source, "g"),
406
+ handler: ({ state: e, range: t, match: n }) => {
407
+ let r = n[0], i = E(r, this.options.mergeTags), a = this.type.create({
408
+ label: i,
409
+ value: r
410
+ });
411
+ e.tr.replaceWith(t.from, t.to, a);
412
+ }
413
+ })];
414
+ }
415
+ }), q = ["id"], J = {
416
+ key: 0,
417
+ class: "tpl:px-3 tpl:py-2 tpl:text-xs tpl:text-[var(--tpl-text-dim)]",
418
+ "data-testid": "merge-tag-suggestion-empty"
419
+ }, Y = [
420
+ "id",
421
+ "aria-selected",
422
+ "data-selected",
423
+ "data-merge-tag-value",
424
+ "onMousedown",
425
+ "onMousemove"
426
+ ], X = { class: "tpl:font-medium" }, re = { class: "tpl:text-[var(--tpl-text-dim)] tpl:font-mono" }, ie = /* @__PURE__ */ i({
427
+ __name: "MergeTagSuggestionList",
428
+ props: {
429
+ items: {},
430
+ selectedIndex: {},
431
+ emptyText: {},
432
+ listId: {}
433
+ },
434
+ emits: ["select", "hover"],
435
+ setup(e) {
436
+ let n = e;
437
+ function i(e) {
438
+ return n.listId ? `${n.listId}-opt-${e}` : void 0;
439
+ }
440
+ return (n, a) => (r(), o("div", {
441
+ id: e.listId,
442
+ class: "tpl:min-w-[200px] tpl:max-w-[320px] tpl:max-h-[50vh] tpl:overflow-y-auto tpl:rounded-[var(--tpl-radius)] tpl:border tpl:border-[var(--tpl-border)] tpl:bg-[var(--tpl-bg-elevated)] tpl:py-1 tpl:shadow-lg",
443
+ role: "listbox",
444
+ "data-testid": "merge-tag-suggestion-list"
445
+ }, [e.items.length === 0 ? (r(), o("div", J, m(e.emptyText), 1)) : u("", !0), (r(!0), o(l, null, t(e.items, (t, a) => (r(), o("button", {
446
+ key: t.value,
447
+ id: i(a),
448
+ type: "button",
449
+ role: "option",
450
+ "aria-selected": a === e.selectedIndex,
451
+ "data-selected": a === e.selectedIndex ? "true" : "false",
452
+ "data-merge-tag-value": t.value,
453
+ class: y(["tpl:flex tpl:w-full tpl:flex-col tpl:items-start tpl:gap-0.5 tpl:px-3 tpl:py-1.5 tpl:text-left tpl:text-xs tpl:transition-colors", a === e.selectedIndex ? "tpl:bg-[var(--tpl-primary-light)] tpl:text-[var(--tpl-primary)]" : "tpl:text-[var(--tpl-text)] hover:tpl:bg-[var(--tpl-bg-hover)]"]),
454
+ onMousedown: b((e) => n.$emit("select", t), ["prevent", "stop"]),
455
+ onMousemove: (t) => a !== e.selectedIndex && n.$emit("hover", a)
456
+ }, [h("span", X, m(t.label), 1), h("span", re, m(t.value), 1)], 42, Y))), 128))], 8, q));
457
+ }
458
+ }), Z = 10, ae = 0;
459
+ function Q(e, t) {
460
+ let n = t.trim().toLowerCase();
461
+ return n === "" ? e.slice(0, Z) : e.filter((e) => {
462
+ let t = e.label.toLowerCase(), r = e.value.toLowerCase();
463
+ return t.includes(n) || r.includes(n);
464
+ }).slice(0, Z);
465
+ }
466
+ function $(e, t, n, r) {
467
+ return t.length === 0 ? e.key === "Enter" || e.key === "Tab" : e.key === "ArrowDown" ? (n.value = (n.value + 1) % t.length, !0) : e.key === "ArrowUp" ? (n.value = (n.value - 1 + t.length) % t.length, !0) : e.key === "Enter" || e.key === "Tab" ? (r(t[n.value]), !0) : !1;
468
+ }
469
+ var oe = A.create({
470
+ name: "mergeTagSuggestion",
471
+ addOptions() {
472
+ return {
473
+ mergeTags: [],
474
+ char: "{{",
475
+ emptyText: "No matching merge tags"
476
+ };
477
+ },
478
+ addProseMirrorPlugins() {
479
+ let t = this.options.mergeTags, n = this.options.emptyText, r = {
480
+ char: this.options.char,
481
+ allowSpaces: !1,
482
+ startOfLine: !1,
483
+ allowedPrefixes: null,
484
+ items: ({ query: e }) => Q(t, e),
485
+ command: ({ editor: e, range: t, props: n }) => {
486
+ e.chain().focus().insertContentAt(t, {
487
+ type: "mergeTagNode",
488
+ attrs: {
489
+ label: n.label,
490
+ value: n.value
491
+ }
492
+ }).run();
493
+ },
494
+ render: () => {
495
+ let t = null, r = null, i = null, a = e([]), o = e(0), s = null, c = `tpl-merge-tag-suggestion-${++ae}`, l = null, u = [];
496
+ function d() {
497
+ g(l?.() ?? null);
498
+ }
499
+ function f() {
500
+ d(), requestAnimationFrame(d);
501
+ }
502
+ function p(e) {
503
+ let t = [], n = e?.parentElement ?? null;
504
+ for (; n && n !== document.body && n !== document.documentElement;) {
505
+ let e = window.getComputedStyle(n), r = e.overflow + e.overflowX + e.overflowY;
506
+ /(auto|scroll|overlay)/.test(r) && t.push(n), n = n.parentElement;
507
+ }
508
+ return t;
509
+ }
510
+ function m(e) {
511
+ u = [window, ...p(e)];
512
+ for (let e of u) e.addEventListener("scroll", d, {
513
+ passive: !0,
514
+ capture: !0
515
+ });
516
+ window.addEventListener("resize", d, { passive: !0 });
517
+ }
518
+ function h() {
519
+ for (let e of u) e.removeEventListener("scroll", d, { capture: !0 });
520
+ window.removeEventListener("resize", d), u = [];
521
+ }
522
+ function g(e) {
523
+ if (!r || !e || e.bottom < 0 || e.top > window.innerHeight) return;
524
+ r.style.position = "fixed", r.style.left = `${e.left}px`, r.style.zIndex = "9999", r.style.top = `${e.bottom}px`;
525
+ let t = r.offsetHeight;
526
+ if (t !== 0 && window.innerHeight - e.bottom < t) {
527
+ let n = Math.max(0, e.top - t);
528
+ r.style.top = `${n}px`;
529
+ }
530
+ }
531
+ function v(e, t) {
532
+ let n = t?.closest("[data-tpl-theme]");
533
+ if (!n) return;
534
+ let r = n.getAttribute("data-tpl-theme");
535
+ r && e.setAttribute("data-tpl-theme", r);
536
+ let i = window.getComputedStyle(n);
537
+ for (let t = 0; t < i.length; t++) {
538
+ let n = i[t];
539
+ n.startsWith("--tpl-") && e.style.setProperty(n, i.getPropertyValue(n));
540
+ }
541
+ e.style.fontFamily = i.fontFamily, e.style.fontSize = i.fontSize, e.style.lineHeight = i.lineHeight;
542
+ }
543
+ function y(e) {
544
+ i && (e ? (i.setAttribute("role", "combobox"), i.setAttribute("aria-haspopup", "listbox"), i.setAttribute("aria-expanded", "true"), i.setAttribute("aria-controls", c)) : (i.removeAttribute("aria-expanded"), i.removeAttribute("aria-controls"), i.removeAttribute("aria-activedescendant"), i.removeAttribute("aria-haspopup"), i.removeAttribute("role")));
545
+ }
546
+ function b() {
547
+ if (i) {
548
+ if (a.value.length === 0) {
549
+ i.removeAttribute("aria-activedescendant");
550
+ return;
551
+ }
552
+ i.setAttribute("aria-activedescendant", `${c}-opt-${o.value}`);
553
+ }
554
+ }
555
+ function S(e) {
556
+ s?.(e);
557
+ }
558
+ return {
559
+ onStart: (e) => {
560
+ a.value = e.items, o.value = 0, s = (t) => e.command(t), r = document.createElement("div"), r.setAttribute("data-testid", "merge-tag-suggestion-popup");
561
+ let u = e.editor.view?.dom;
562
+ i = u ?? null, v(r, u ?? null), document.body.appendChild(r), t = _({ render() {
563
+ return x(ie, {
564
+ items: a.value,
565
+ selectedIndex: o.value,
566
+ emptyText: n,
567
+ listId: c,
568
+ onSelect: (e) => S(e),
569
+ onHover: (e) => {
570
+ o.value = e, b();
571
+ }
572
+ });
573
+ } }), t.mount(r), y(!0), b(), l = e.clientRect ?? null, f(), m(u ?? null);
574
+ },
575
+ onUpdate: (e) => {
576
+ a.value = e.items, o.value >= e.items.length && (o.value = 0), s = (t) => e.command(t), b(), l = e.clientRect ?? null, f();
577
+ },
578
+ onKeyDown: (e) => {
579
+ if (e.event.key === "Escape") return !0;
580
+ let t = $(e.event, a.value, o, S);
581
+ return t && b(), t;
582
+ },
583
+ onExit: () => {
584
+ h(), y(!1), t?.unmount(), r?.remove(), t = null, r = null, i = null, s = null, l = null;
585
+ }
586
+ };
587
+ }
588
+ };
589
+ return [N({
590
+ editor: this.editor,
591
+ ...r
592
+ })];
593
+ }
594
+ });
595
+ //#endregion
596
+ export { I as FontSize, L as LetterSpacing, R as LineHeight, H as LogicMergeTagNode, K as MergeTagNode, oe as MergeTagSuggestion, Q as filterMergeTags, $ as handleSuggestionKeyDown };
597
+
598
+ //# sourceMappingURL=extensions-DIxF31tA.js.map