@aswin.dev/editor 0.7.1 → 0.7.3

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 (116) hide show
  1. package/LICENSE +56 -0
  2. package/dist/{AiChatSidebar-DWGPVtvC.js → AiChatSidebar-Dt5pvG5t.js} +37 -51
  3. package/dist/{AiFeatureMenu-duUFSfDf.js → AiFeatureMenu-BipxcGap.js} +1 -1
  4. package/dist/{CloudEditor-CFldoCOb.js → CloudEditor-CnUX0IOW.js} +283 -239
  5. package/dist/{CollaboratorBar-Bw-lbt61.js → CollaboratorBar-NaaZTjbs.js} +2 -2
  6. package/dist/{CommentsSidebar-BaD5F53-.js → CommentsSidebar-DE6ZsM4D.js} +9 -10
  7. package/dist/CountdownBlock-Ba3T-i2X.js +1536 -0
  8. package/dist/{CountdownToolbar-Dg4F8MTk.js → CountdownToolbar-CbhSp_uq.js} +1 -1
  9. package/dist/{DesignReferenceSidebar-BSH7uNP_.js → DesignReferenceSidebar-CZg97bbj.js} +1 -1
  10. package/dist/{ModuleBrowserModal-6phxZSKI.js → ModuleBrowserModal-D2EVdexc.js} +4 -4
  11. package/dist/{ModulePreviewCanvas-BW8L3eQX.js → ModulePreviewCanvas-P3N-nxkU.js} +52 -47
  12. package/dist/{NumberWithSuffix-BpUzQOJt.js → NumberWithSuffix-CihczoAd.js} +1 -1
  13. package/dist/{ParagraphEditor-DNSzAB-I.js → ParagraphEditor-BbRuKhWv.js} +7 -7
  14. package/dist/{SaveModuleDialog-zMQTpez7.js → SaveModuleDialog-DLZa3m3O.js} +2 -2
  15. package/dist/{SnapshotHistory-Do-A5rYU.js → SnapshotHistory-Csg1_jXi.js} +3 -3
  16. package/dist/{TestEmailModal-DGj_9V1u.js → TestEmailModal-m3okLbJz.js} +2 -2
  17. package/dist/{TitleEditor-C7IDnAoS.js → TitleEditor-CtJIS5ER.js} +2 -2
  18. package/dist/{TplModal-BAsVzcTb.js → TplModal-CQCrKeKP.js} +1 -1
  19. package/dist/{blockTypeIcons-C6LDKvmd.js → blockTypeIcons-Dah0pgt-.js} +50 -19
  20. package/dist/bundle-stats.json +8 -8
  21. package/dist/cdn/chunks/AccessibilityPanel-Bt_fD7QT.js +97 -0
  22. package/dist/cdn/chunks/AccessibilityPanel-Bt_fD7QT.js.map +1 -0
  23. package/dist/cdn/chunks/AiFeatureMenu-Bn-0rgfr.js +59 -0
  24. package/dist/cdn/chunks/AiFeatureMenu-Bn-0rgfr.js.map +1 -0
  25. package/dist/cdn/chunks/BlockA11yBadge-Cj18Iw0p.js +33 -0
  26. package/dist/cdn/chunks/BlockA11yBadge-Cj18Iw0p.js.map +1 -0
  27. package/dist/cdn/chunks/CloudEditor-56lVcdot.js +1220 -0
  28. package/dist/cdn/chunks/CloudEditor-56lVcdot.js.map +1 -0
  29. package/dist/cdn/chunks/CollaboratorBar-B7DCV3xp.js +51 -0
  30. package/dist/cdn/chunks/CollaboratorBar-B7DCV3xp.js.map +1 -0
  31. package/dist/cdn/chunks/CountdownToolbar-BtaD3d3-.js +212 -0
  32. package/dist/cdn/chunks/CountdownToolbar-BtaD3d3-.js.map +1 -0
  33. package/dist/cdn/chunks/ModuleBrowserModal-CiIY7ZGv.js +195 -0
  34. package/dist/cdn/chunks/ModuleBrowserModal-CiIY7ZGv.js.map +1 -0
  35. package/dist/cdn/chunks/ModulePreviewCanvas-M7_OGV2m.js +113 -0
  36. package/dist/cdn/chunks/ModulePreviewCanvas-M7_OGV2m.js.map +1 -0
  37. package/dist/cdn/chunks/NumberWithSuffix-DfVBnsgc.js +423 -0
  38. package/dist/cdn/chunks/NumberWithSuffix-DfVBnsgc.js.map +1 -0
  39. package/dist/cdn/chunks/ParagraphEditor-1XJOpiLX.js +544 -0
  40. package/dist/cdn/chunks/ParagraphEditor-1XJOpiLX.js.map +1 -0
  41. package/dist/cdn/chunks/RichTextEditorContent-C2q8sbp2.js +106 -0
  42. package/dist/cdn/chunks/RichTextEditorContent-C2q8sbp2.js.map +1 -0
  43. package/dist/cdn/chunks/SaveModuleDialog-BNxh1jPT.js +119 -0
  44. package/dist/cdn/chunks/SaveModuleDialog-BNxh1jPT.js.map +1 -0
  45. package/dist/cdn/chunks/TitleEditor-IF7VzLTk.js +171 -0
  46. package/dist/cdn/chunks/TitleEditor-IF7VzLTk.js.map +1 -0
  47. package/dist/cdn/chunks/blockTypeIcons-tPBKQ8WC.js +24 -0
  48. package/dist/cdn/chunks/blockTypeIcons-tPBKQ8WC.js.map +1 -0
  49. package/dist/cdn/chunks/de-B05yW8Gi.js +840 -0
  50. package/dist/cdn/chunks/de-B05yW8Gi.js.map +1 -0
  51. package/dist/cdn/chunks/de-BPHtelu7.js +209 -0
  52. package/dist/cdn/chunks/de-BPHtelu7.js.map +1 -0
  53. package/dist/cdn/chunks/de-BRDqJwJe.js +89 -0
  54. package/dist/cdn/chunks/de-BRDqJwJe.js.map +1 -0
  55. package/dist/cdn/chunks/draggable-C-1_gch3.js +11572 -0
  56. package/dist/cdn/chunks/draggable-C-1_gch3.js.map +1 -0
  57. package/dist/cdn/chunks/emojiData-DUHzsh4j.js +19 -0
  58. package/dist/cdn/chunks/emojiData-DUHzsh4j.js.map +1 -0
  59. package/dist/cdn/chunks/en-BII7695P.js +840 -0
  60. package/dist/cdn/chunks/en-BII7695P.js.map +1 -0
  61. package/dist/cdn/chunks/en-Cdj_Ikl1.js +89 -0
  62. package/dist/cdn/chunks/en-Cdj_Ikl1.js.map +1 -0
  63. package/dist/cdn/chunks/en-DejwuJhw.js +209 -0
  64. package/dist/cdn/chunks/en-DejwuJhw.js.map +1 -0
  65. package/dist/cdn/chunks/extensions-B0eT-yjf.js +598 -0
  66. package/dist/cdn/chunks/extensions-B0eT-yjf.js.map +1 -0
  67. package/dist/cdn/chunks/features-BrvE2Fzv.js +9677 -0
  68. package/dist/cdn/chunks/features-BrvE2Fzv.js.map +1 -0
  69. package/dist/cdn/chunks/icons-C7wtAD8p.js +1043 -0
  70. package/dist/cdn/chunks/icons-C7wtAD8p.js.map +1 -0
  71. package/dist/cdn/chunks/liquid.browser-CllF-us3.js +3279 -0
  72. package/dist/cdn/chunks/liquid.browser-CllF-us3.js.map +1 -0
  73. package/dist/cdn/chunks/media-library-Cl5XuaKy.js +6030 -0
  74. package/dist/cdn/chunks/media-library-Cl5XuaKy.js.map +1 -0
  75. package/dist/cdn/chunks/pusher-i7-OBujc.js +2508 -0
  76. package/dist/cdn/chunks/pusher-i7-OBujc.js.map +1 -0
  77. package/dist/cdn/chunks/quality-Va91a3N8.js +1456 -0
  78. package/dist/cdn/chunks/quality-Va91a3N8.js.map +1 -0
  79. package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js +32 -0
  80. package/dist/cdn/chunks/readableTextColor-DhoK4XiZ.js.map +1 -0
  81. package/dist/cdn/chunks/renderer-si0Zgxeb.js +642 -0
  82. package/dist/cdn/chunks/renderer-si0Zgxeb.js.map +1 -0
  83. package/dist/cdn/chunks/rolldown-runtime-BNuo_Jkg.js +20 -0
  84. package/dist/cdn/chunks/src-BLyYIbdZ.js +497 -0
  85. package/dist/cdn/chunks/src-BLyYIbdZ.js.map +1 -0
  86. package/dist/cdn/chunks/styleConstants-DfcU8u_r.js +57 -0
  87. package/dist/cdn/chunks/styleConstants-DfcU8u_r.js.map +1 -0
  88. package/dist/cdn/chunks/styles-C6BQLT9F.js +5807 -0
  89. package/dist/cdn/chunks/styles-C6BQLT9F.js.map +1 -0
  90. package/dist/cdn/chunks/tiptap-D8whBv5F.js +14654 -0
  91. package/dist/cdn/chunks/tiptap-D8whBv5F.js.map +1 -0
  92. package/dist/cdn/editor.css +2 -0
  93. package/dist/cdn/editor.js +367 -0
  94. package/dist/cdn/editor.js.map +1 -0
  95. package/dist/{cloud-6ZmAvF0j.js → cloud-BoS0J0vs.js} +1 -1
  96. package/dist/{de-DWcgp-7T.js → de-C74F9xK3.js} +112 -3
  97. package/dist/dist-C2grMquk.js +1261 -0
  98. package/dist/{dist-CivF9P8b.js → dist-Djgi0A6k.js} +92 -77
  99. package/dist/{en-Cxd4fhNm.js → en-B24jVTeO.js} +112 -3
  100. package/dist/{extensions-D__hOlV1.js → extensions-DsmjHqBF.js} +14 -14
  101. package/dist/index.d.ts +21 -10
  102. package/dist/{pencil-BZJPNYWR.js → pencil-Bpimrzzw.js} +5 -2
  103. package/dist/style.css +1 -1
  104. package/dist/styles-BMFMtR9R.js +6341 -0
  105. package/dist/templatical-editor.js +197 -139
  106. package/dist/undo-2-m1EUDbUg.js +16 -0
  107. package/dist/{useEditorCore-wslttMH-.js → useEditorCore-CtNAo0uy.js} +2154 -2025
  108. package/dist/useMergeTag-2vTcVpNo.js +34 -0
  109. package/package.json +12 -12
  110. package/dist/CountdownBlock-DaYGxKqo.js +0 -92
  111. package/dist/check-DJrpDKO_.js +0 -7
  112. package/dist/dist-C04s_fLA.js +0 -563
  113. package/dist/styles-B4tjX5SP.js +0 -5224
  114. package/dist/useMergeTag-DX0XG5V9.js +0 -34
  115. /package/dist/{clock-ik2pRJKG.js → clock-Ba4p3rJM.js} +0 -0
  116. /package/dist/{readableTextColor-DVuzNX1y.js → readableTextColor-C_9OpzBw.js} +0 -0
@@ -0,0 +1,598 @@
1
+ import { A as e, C as t, G as n, I as r, P as i, T as a, W as o, _ as s, c, ct as l, d as u, dt as d, f, ft as p, g as m, h, m as g, r as _, tt as v, u as y, ut as b, v as x } from "./draggable-C-1_gch3.js";
2
+ import { An as S, Bt as C, Dn as w, jn as T, kn as E, tt as D } from "./features-BrvE2Fzv.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-D8whBv5F.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__ */ t({
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 r = t, { syntax: a } = D(), { t: f } = C(), _ = g(() => T(r.node.attrs.value, a)), S = g(() => E(r.node.attrs.value, a)), w = v(!1), O = v(""), k = v(null), A = !1;
86
+ function M() {
87
+ O.value = r.node.attrs.value, A = !1, w.value = !0, e(() => {
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
+ w.value = !1;
97
+ return;
98
+ }
99
+ e !== r.node.attrs.value && r.updateAttributes({
100
+ value: e,
101
+ keyword: T(e, a) ? E(e, a) : ""
102
+ }), w.value = !1;
103
+ }
104
+ function P(e) {
105
+ e.key === "Enter" ? (e.preventDefault(), N()) : e.key === "Escape" && (w.value = !1);
106
+ }
107
+ return (e, r) => (i(), m(l(j), {
108
+ as: "span",
109
+ class: b(_.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: d(_.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: o(() => [w.value ? n((i(), x("input", {
114
+ key: 0,
115
+ ref_key: "inputRef",
116
+ ref: k,
117
+ "onUpdate:modelValue": r[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)), [[c, O.value]]) : _.value ? (i(), x("span", {
123
+ key: 1,
124
+ role: "button",
125
+ tabindex: "0",
126
+ "aria-label": l(f).mergeTag.editValue,
127
+ class: "tpl-tooltip tpl:cursor-pointer",
128
+ "data-tooltip": t.node.attrs.value,
129
+ onClick: u(M, ["stop"]),
130
+ onKeydown: [y(u(M, ["stop"]), ["enter"]), y(u(M, ["prevent", "stop"]), ["space"])]
131
+ }, p(S.value), 41, ee)) : (i(), x("span", {
132
+ key: 2,
133
+ role: "button",
134
+ tabindex: "0",
135
+ "aria-label": l(f).mergeTag.editValue,
136
+ onClick: u(M, ["stop"]),
137
+ onKeydown: [y(u(M, ["stop"]), ["enter"]), y(u(M, ["prevent", "stop"]), ["space"])]
138
+ }, p(t.node.attrs.value), 41, te)), _.value ? (i(), x("button", {
139
+ key: 3,
140
+ type: "button",
141
+ "aria-label": l(f).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: r[1] ||= u((...e) => t.deleteNode && t.deleteNode(...e), ["stop", "prevent"])
145
+ }, [...r[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)) : s("", !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 = E(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 = E(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 = E(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__ */ t({
264
+ __name: "MergeTagNodeView",
265
+ props: {
266
+ node: {},
267
+ deleteNode: { type: Function },
268
+ updateAttributes: { type: Function }
269
+ },
270
+ setup(t) {
271
+ let r = t, { getMergeTagLabel: a } = D(), { t: s } = C(), d = g(() => a(r.node.attrs.value)), f = v(!1), _ = v(""), b = v(null);
272
+ function S() {
273
+ _.value = r.node.attrs.value, f.value = !0, e(() => {
274
+ b.value?.focus(), b.value?.select();
275
+ });
276
+ }
277
+ function w() {
278
+ let e = _.value.trim();
279
+ e && e !== r.node.attrs.value && r.updateAttributes({
280
+ value: e,
281
+ label: a(e)
282
+ }), f.value = !1;
283
+ }
284
+ function T(e) {
285
+ e.key === "Enter" ? (e.preventDefault(), w()) : e.key === "Escape" && (f.value = !1);
286
+ }
287
+ return (e, r) => (i(), m(l(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: o(() => [f.value ? n((i(), x("input", {
294
+ key: 0,
295
+ ref_key: "inputRef",
296
+ ref: b,
297
+ "onUpdate:modelValue": r[0] ||= (e) => _.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: w,
301
+ onKeydown: T
302
+ }, null, 544)), [[c, _.value]]) : (i(), x("span", {
303
+ key: 1,
304
+ role: "button",
305
+ tabindex: "0",
306
+ "aria-label": l(s).mergeTag.editValue,
307
+ class: "tpl-tooltip tpl:cursor-pointer",
308
+ "data-tooltip": t.node.attrs.value,
309
+ onClick: u(S, ["stop"]),
310
+ onKeydown: [y(u(S, ["stop"]), ["enter"]), y(u(S, ["prevent", "stop"]), ["space"])]
311
+ }, p(d.value), 41, U)), h("button", {
312
+ type: "button",
313
+ "aria-label": l(s).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: r[1] ||= u((...e) => t.deleteNode && t.deleteNode(...e), ["stop", "prevent"])
317
+ }, [...r[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 = S(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 = S(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 = S(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__ */ t({
427
+ __name: "MergeTagSuggestionList",
428
+ props: {
429
+ items: {},
430
+ selectedIndex: {},
431
+ emptyText: {},
432
+ listId: {}
433
+ },
434
+ emits: ["select", "hover"],
435
+ setup(e) {
436
+ let t = e;
437
+ function n(e) {
438
+ return t.listId ? `${t.listId}-opt-${e}` : void 0;
439
+ }
440
+ return (t, a) => (i(), x("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 ? (i(), x("div", J, p(e.emptyText), 1)) : s("", !0), (i(!0), x(f, null, r(e.items, (r, a) => (i(), x("button", {
446
+ key: r.value,
447
+ id: n(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": r.value,
453
+ class: b(["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: u((e) => t.$emit("select", r), ["prevent", "stop"]),
455
+ onMousemove: (n) => a !== e.selectedIndex && t.$emit("hover", a)
456
+ }, [h("span", X, p(r.label), 1), h("span", re, p(r.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 e = this.options.mergeTags, t = this.options.emptyText, n = {
480
+ char: this.options.char,
481
+ allowSpaces: !1,
482
+ startOfLine: !1,
483
+ allowedPrefixes: null,
484
+ items: ({ query: t }) => Q(e, t),
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 e = null, n = null, r = null, i = v([]), o = v(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 (!n || !e || e.bottom < 0 || e.top > window.innerHeight) return;
524
+ n.style.position = "fixed", n.style.left = `${e.left}px`, n.style.zIndex = "9999", n.style.top = `${e.bottom}px`;
525
+ let t = n.offsetHeight;
526
+ if (t !== 0 && window.innerHeight - e.bottom < t) {
527
+ let r = Math.max(0, e.top - t);
528
+ n.style.top = `${r}px`;
529
+ }
530
+ }
531
+ function y(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 b(e) {
544
+ r && (e ? (r.setAttribute("role", "combobox"), r.setAttribute("aria-haspopup", "listbox"), r.setAttribute("aria-expanded", "true"), r.setAttribute("aria-controls", c)) : (r.removeAttribute("aria-expanded"), r.removeAttribute("aria-controls"), r.removeAttribute("aria-activedescendant"), r.removeAttribute("aria-haspopup"), r.removeAttribute("role")));
545
+ }
546
+ function x() {
547
+ if (r) {
548
+ if (i.value.length === 0) {
549
+ r.removeAttribute("aria-activedescendant");
550
+ return;
551
+ }
552
+ r.setAttribute("aria-activedescendant", `${c}-opt-${o.value}`);
553
+ }
554
+ }
555
+ function S(e) {
556
+ s?.(e);
557
+ }
558
+ return {
559
+ onStart: (u) => {
560
+ i.value = u.items, o.value = 0, s = (e) => u.command(e), n = document.createElement("div"), n.setAttribute("data-testid", "merge-tag-suggestion-popup");
561
+ let d = u.editor.view?.dom;
562
+ r = d ?? null, y(n, d ?? null), document.body.appendChild(n), e = _({ render() {
563
+ return a(ie, {
564
+ items: i.value,
565
+ selectedIndex: o.value,
566
+ emptyText: t,
567
+ listId: c,
568
+ onSelect: (e) => S(e),
569
+ onHover: (e) => {
570
+ o.value = e, x();
571
+ }
572
+ });
573
+ } }), e.mount(n), b(!0), x(), l = u.clientRect ?? null, f(), m(d ?? null);
574
+ },
575
+ onUpdate: (e) => {
576
+ i.value = e.items, o.value >= e.items.length && (o.value = 0), s = (t) => e.command(t), x(), l = e.clientRect ?? null, f();
577
+ },
578
+ onKeyDown: (e) => {
579
+ if (e.event.key === "Escape") return !0;
580
+ let t = $(e.event, i.value, o, S);
581
+ return t && x(), t;
582
+ },
583
+ onExit: () => {
584
+ h(), b(!1), e?.unmount(), n?.remove(), e = null, n = null, r = null, s = null, l = null;
585
+ }
586
+ };
587
+ }
588
+ };
589
+ return [N({
590
+ editor: this.editor,
591
+ ...n
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-B0eT-yjf.js.map