@vc-shell/framework 1.2.4-beta.6 → 1.2.4-beta.8

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 (83) hide show
  1. package/dist/framework.js +35065 -464
  2. package/dist/index.css +1 -1
  3. package/dist/shared/components/dashboard-charts/index.d.ts +3 -6
  4. package/dist/shared/components/dashboard-charts/index.d.ts.map +1 -1
  5. package/dist/shared/components/draggable-dashboard/DraggableDashboard.vue.d.ts.map +1 -1
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts +1 -1
  8. package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts.map +1 -1
  9. package/dist/ui/components/molecules/vc-editor/index.d.ts +2 -3
  10. package/dist/ui/components/molecules/vc-editor/index.d.ts.map +1 -1
  11. package/dist/ui/components/molecules/vc-slider/index.d.ts +3 -5
  12. package/dist/ui/components/molecules/vc-slider/index.d.ts.map +1 -1
  13. package/dist/ui/components/organisms/vc-table/VcDataTable.vue.d.ts.map +1 -1
  14. package/dist/{vendor-cheerio-3JDxU-TZ.js → vendor-cheerio-DrsWhxJH.js} +4 -4
  15. package/dist/{vendor-cheerio-select-B7cQ9HP4.js → vendor-cheerio-select-jw4C2SiT.js} +2 -2
  16. package/dist/{vendor-css-select-CaVL4gMJ.js → vendor-css-select-BwGMmTuc.js} +1 -1
  17. package/dist/{vendor-dom-serializer-Sk3xHhQk.js → vendor-dom-serializer-BbVuF1MQ.js} +1 -1
  18. package/dist/{vendor-domutils-o2IJSx7k.js → vendor-domutils-DDRq_ial.js} +1 -1
  19. package/dist/{vendor-entities-CCReaWqU.js → vendor-entities-J86Og8IU.js} +2 -2
  20. package/dist/{vendor-htmlparser2-nRkKyNhl.js → vendor-htmlparser2-BxKKzWLL.js} +1 -1
  21. package/dist/{vendor-markdown-it-pxD-Y9qk.js → vendor-markdown-it-Bs9KEWkF.js} +1 -1
  22. package/dist/{vendor-prosemirror-commands-Dml_M5TN.js → vendor-prosemirror-commands-Bv4ChObl.js} +2 -2
  23. package/dist/{vendor-prosemirror-dropcursor-BpoETgOQ.js → vendor-prosemirror-dropcursor-kF5UKNFM.js} +2 -2
  24. package/dist/{vendor-prosemirror-gapcursor-VVbNCx01.js → vendor-prosemirror-gapcursor-BAwEBHgE.js} +3 -3
  25. package/dist/{vendor-prosemirror-history-CZUb2jWK.js → vendor-prosemirror-history-CQYKHz3u.js} +2 -2
  26. package/dist/{vendor-prosemirror-keymap-D5bacBom.js → vendor-prosemirror-keymap-CAfQyvJ7.js} +1 -1
  27. package/dist/{vendor-prosemirror-markdown-C-c5VoFH.js → vendor-prosemirror-markdown-rpUTSG_Q.js} +1 -1
  28. package/dist/{vendor-prosemirror-schema-list-BZ-Z46DO.js → vendor-prosemirror-schema-list-BNJkECdS.js} +1 -1
  29. package/dist/{vendor-prosemirror-state-DYjHje5i.js → vendor-prosemirror-state-IeimrELV.js} +1 -1
  30. package/dist/{vendor-prosemirror-tables-CjY-gm1w.js → vendor-prosemirror-tables-zVUKdbdQ.js} +4 -4
  31. package/dist/{vendor-prosemirror-transform-6xBwIzbI.js → vendor-prosemirror-transform-BUjWd5Tb.js} +4 -4
  32. package/dist/{vendor-prosemirror-view-CzBOGIAq.js → vendor-prosemirror-view-DFpBkGRq.js} +2 -2
  33. package/dist/{vendor-tiptap-core-BNrmxwcD.js → vendor-tiptap-core-BfrE48R3.js} +16 -16
  34. package/dist/{vendor-tiptap-extension-blockquote-DBYgJvrA.js → vendor-tiptap-extension-blockquote-DG5eEgV_.js} +1 -1
  35. package/dist/{vendor-tiptap-extension-bold-BaDsyhkA.js → vendor-tiptap-extension-bold-CqPrSfgB.js} +1 -1
  36. package/dist/{vendor-tiptap-extension-code-DmMmyuE8.js → vendor-tiptap-extension-code-Dj9HfL9x.js} +1 -1
  37. package/dist/{vendor-tiptap-extension-code-block-Cryhc4vR.js → vendor-tiptap-extension-code-block-YnlbQcbJ.js} +2 -2
  38. package/dist/{vendor-tiptap-extension-document-DTFkPYG-.js → vendor-tiptap-extension-document-DyG2LNKD.js} +1 -1
  39. package/dist/{vendor-tiptap-extension-hard-break-DLmFSWL4.js → vendor-tiptap-extension-hard-break-mzhqFFEq.js} +1 -1
  40. package/dist/{vendor-tiptap-extension-heading-DlpNyZOc.js → vendor-tiptap-extension-heading-DGnriW33.js} +1 -1
  41. package/dist/{vendor-tiptap-extension-horizontal-rule-CI2nC7l5.js → vendor-tiptap-extension-horizontal-rule-pR7MlJHI.js} +2 -2
  42. package/dist/{vendor-tiptap-extension-image-g6grWBFQ.js → vendor-tiptap-extension-image-BsXHNscz.js} +1 -1
  43. package/dist/{vendor-tiptap-extension-italic-DsMLQC-Z.js → vendor-tiptap-extension-italic-aoCbIXRj.js} +1 -1
  44. package/dist/{vendor-tiptap-extension-link-CF-euSmX.js → vendor-tiptap-extension-link-DiV7DqnY.js} +3 -3
  45. package/dist/{vendor-tiptap-extension-list-DA57LKdr.js → vendor-tiptap-extension-list-BGYRWOyu.js} +5 -5
  46. package/dist/{vendor-tiptap-extension-paragraph-CrvWamNP.js → vendor-tiptap-extension-paragraph-BEBEvW1W.js} +1 -1
  47. package/dist/vendor-tiptap-extension-placeholder-ZfoeEW0T.js +1 -0
  48. package/dist/{vendor-tiptap-extension-strike-caeBdU8d.js → vendor-tiptap-extension-strike-6vob8J1A.js} +1 -1
  49. package/dist/{vendor-tiptap-extension-table-DBQupXqd.js → vendor-tiptap-extension-table-CH-0UqG-.js} +8 -8
  50. package/dist/vendor-tiptap-extension-table-cell-_uzaJkJG.js +1 -0
  51. package/dist/vendor-tiptap-extension-table-header-_uzaJkJG.js +1 -0
  52. package/dist/vendor-tiptap-extension-table-row-_uzaJkJG.js +1 -0
  53. package/dist/{vendor-tiptap-extension-text-CYaZSxyC.js → vendor-tiptap-extension-text-CnqQVbB2.js} +1 -1
  54. package/dist/{vendor-tiptap-extension-text-style-C8Uqg46V.js → vendor-tiptap-extension-text-style-Bj4bCZI1.js} +1 -1
  55. package/dist/{vendor-tiptap-extension-underline-Ct9ZgKsw.js → vendor-tiptap-extension-underline-CVBZMhrs.js} +1 -1
  56. package/dist/{vendor-tiptap-extensions-Dg7-f1Pi.js → vendor-tiptap-extensions-2ZbpCG7T.js} +8 -8
  57. package/dist/{vendor-tiptap-markdown-DDkltz0i.js → vendor-tiptap-markdown-B7Wvo0s5.js} +4 -4
  58. package/dist/vendor-tiptap-pm-DSHuSumV.js +1 -0
  59. package/dist/{vendor-tiptap-starter-kit-C1nkrZcr.js → vendor-tiptap-starter-kit-ipneJHYV.js} +17 -17
  60. package/dist/{vendor-tiptap-vue-3-B3dwsJj3.js → vendor-tiptap-vue-3-IfJcIOl5.js} +1 -1
  61. package/dist/{vendor-truncate-html-C77Epb-R.js → vendor-truncate-html-r2r8GKvW.js} +1 -1
  62. package/package.json +5 -5
  63. package/shared/components/dashboard-charts/index.ts +3 -27
  64. package/shared/components/draggable-dashboard/DraggableDashboard.vue +69 -75
  65. package/ui/components/molecules/vc-editor/index.ts +2 -11
  66. package/ui/components/molecules/vc-slider/index.ts +3 -11
  67. package/ui/components/organisms/vc-table/VcDataTable.vue +39 -18
  68. package/dist/DashboardBarChart-BzfKkUke.js +0 -123
  69. package/dist/DashboardDonutChart-CWfe85Xq.js +0 -89
  70. package/dist/DashboardLineChart-kdA8VnrR.js +0 -125
  71. package/dist/GridstackDashboard-CGHYkReX.js +0 -131
  72. package/dist/GridstackDashboard.css +0 -1
  73. package/dist/chart-utils-BTs6UFaZ.js +0 -83
  74. package/dist/index-tgmgQAD9.js +0 -33730
  75. package/dist/vc-editor-BNrG1GAG.js +0 -848
  76. package/dist/vc-editor.css +0 -1
  77. package/dist/vc-slider-Ce0X1_1m.js +0 -83
  78. package/dist/vc-slider.css +0 -1
  79. package/dist/vendor-tiptap-extension-placeholder-DVCL5REL.js +0 -1
  80. package/dist/vendor-tiptap-extension-table-cell-A6UIxsTF.js +0 -1
  81. package/dist/vendor-tiptap-extension-table-header-A6UIxsTF.js +0 -1
  82. package/dist/vendor-tiptap-extension-table-row-A6UIxsTF.js +0 -1
  83. package/dist/vendor-tiptap-pm-BbD2LeB7.js +0 -1
@@ -1,848 +0,0 @@
1
- import { defineComponent as D, openBlock as o, createElementBlock as s, normalizeClass as U, createVNode as b, unref as B, computed as L, createBlock as c, resolveDynamicComponent as ee, mergeProps as te, createElementVNode as h, Fragment as F, renderList as R, toDisplayString as M, createCommentVNode as g, ref as T, onMounted as ie, onUnmounted as oe, withModifiers as le, withDirectives as ne, withKeys as ae, vModelText as re, watch as O, onBeforeUnmount as de, createSlots as se, withCtx as V, createTextVNode as W, Transition as ue, renderSlot as ce } from "vue";
2
- import { u as me, E as j } from "./vendor-tiptap-vue-3-B3dwsJj3.js";
3
- import { S as ve } from "./vendor-tiptap-starter-kit-C1nkrZcr.js";
4
- import { U as be } from "./vendor-tiptap-extension-underline-Ct9ZgKsw.js";
5
- import { T as fe, a as ge, b as he, c as ke } from "./vendor-tiptap-extension-table-DBQupXqd.js";
6
- import { L as ye } from "./vendor-tiptap-extension-link-CF-euSmX.js";
7
- import { I as we } from "./vendor-tiptap-extension-image-g6grWBFQ.js";
8
- import { P as Ae } from "./vendor-tiptap-extensions-Dg7-f1Pi.js";
9
- import { T as Be } from "./vendor-tiptap-extension-text-style-C8Uqg46V.js";
10
- import { M as xe } from "./vendor-tiptap-markdown-DDkltz0i.js";
11
- import { k as Se } from "./vendor-tiptap-core-BNrmxwcD.js";
12
- import { J as $e, p as Le } from "./vendor-prettier-CoRReRqw.js";
13
- import { p as pe } from "./vendor-dompurify-BGaRrCfO.js";
14
- import { d as N, e as Ce, V as Te } from "./index-tgmgQAD9.js";
15
- import "./assets/d5f9664ebbfb104b.svg";
16
- import "./assets/4e43c74354534fb3.svg";
17
- import "./assets/e98196a9f8dcb2f0.svg";
18
- import "./assets/74ed5f8a78e71106.svg";
19
- import "./assets/1ea01de36eb5491b.svg";
20
- import "./assets/d5a5b8630120073d.svg";
21
- import "./assets/6798e4dd4add9b48.svg";
22
- import "./assets/2d4e6190eec72737.svg";
23
- import "./assets/9392bf1d591e1abb.svg";
24
- import "./assets/204eaf512fde2023.svg";
25
- import "./assets/0ba156439a339f2a.svg";
26
- import "./assets/2857c513073467da.svg";
27
- import "./assets/b645a4a2181b9dc1.svg";
28
- import "./assets/b94421fadd23b0f2.svg";
29
- import "./assets/6a3e73faf406cf33.svg";
30
- import "./assets/e38acaa1757232e0.svg";
31
- import "./assets/ca791c5ca5848a03.svg";
32
- import "./assets/10768e2cc79fc60b.svg";
33
- import "./assets/67230f05dc94a265.svg";
34
- import "./assets/4d7a77b0e5373992.svg";
35
- import "./assets/f7fc8bf46089d8b2.svg";
36
- import "./assets/92508f8707159b51.svg";
37
- import "./assets/b6499ddce0a4ef7d.svg";
38
- import "./assets/fed13b0d59903483.svg";
39
- import "./assets/34ff7dd0c2285956.svg";
40
- import "./assets/bb28fb0f27f1c11b.svg";
41
- import "./assets/21220a9d10e6c558.svg";
42
- import "./assets/b372390551ca2fa1.svg";
43
- import "./assets/262f46a0b6d94bb6.svg";
44
- import "./assets/042c75b764bc78a7.svg";
45
- import "./assets/b1a596e31ad1185a.svg";
46
- import "./assets/15e91cdd649cde9a.svg";
47
- import "./assets/e72bb11356af94c7.svg";
48
- import "./assets/4fe75f5117100705.svg";
49
- import "./assets/dd05d43ff0df2fc7.svg";
50
- import "./assets/b325adcae33bbe7a.svg";
51
- import "./assets/f09d89268e4c0317.svg";
52
- import "./assets/9cb83236f6bb7ab1.svg";
53
- import "./assets/d084bda16abe8a56.svg";
54
- import "./assets/7eda727273fd98d3.svg";
55
- import "./assets/572bb1bb4156a9c1.svg";
56
- import "./assets/41275bcb979cb650.svg";
57
- import "./assets/1de63eb118636cce.svg";
58
- import "./assets/e5adb5ae3a3698f6.svg";
59
- import "./assets/b5bb1e8fc975decd.svg";
60
- import "./assets/157b8721e0600ea8.svg";
61
- import "./assets/a18404194e3f9047.svg";
62
- import "./assets/a2017fe7f0a26510.svg";
63
- import "./assets/0f590f8a94577092.svg";
64
- import "./assets/259e6ad461a52ad7.svg";
65
- import "./assets/7d55399c2a7bc985.svg";
66
- import "./assets/910b0d99b9e26568.svg";
67
- import "./assets/e4a8550f1c7ffe36.svg";
68
- import "./assets/2088983edf42e153.svg";
69
- import "./assets/225da11d23968333.svg";
70
- import "./assets/d32b129cae2fffd6.svg";
71
- import "./assets/abf88f301a0730f4.svg";
72
- import "./assets/0fc5820f8be53a1b.svg";
73
- import "./assets/d3f792f54ae4c307.svg";
74
- import "./assets/208f810a9321a327.svg";
75
- import "./assets/72de3a63bc0b70dd.svg";
76
- import "vee-validate";
77
- import "./vendor-iso-639-1-rPqx9HMT.js";
78
- const Me = Se.create({
79
- name: "fontSize",
80
- addOptions() {
81
- return {
82
- types: ["textStyle"]
83
- };
84
- },
85
- addGlobalAttributes() {
86
- return [
87
- {
88
- types: this.options.types,
89
- attributes: {
90
- fontSize: {
91
- default: null,
92
- parseHTML: (e) => e.style.fontSize?.replace(/['"]+/g, ""),
93
- renderHTML: (e) => e.fontSize ? {
94
- style: `font-size: ${e.fontSize}`
95
- } : {}
96
- }
97
- }
98
- }
99
- ];
100
- },
101
- addCommands() {
102
- return {
103
- setFontSize: (e) => ({ chain: a }) => a().setMark("textStyle", { fontSize: e }).run(),
104
- unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).run()
105
- };
106
- }
107
- }), ze = ["disabled", "aria-pressed", "aria-label"], r = /* @__PURE__ */ D({
108
- __name: "vc-editor-button",
109
- props: {
110
- icon: {},
111
- active: { type: Boolean },
112
- disabled: { type: Boolean, default: !1 },
113
- ariaLabel: {}
114
- },
115
- emits: ["action"],
116
- setup(e) {
117
- return (a, i) => (o(), s("button", {
118
- type: "button",
119
- class: U(["vc-editor-button", { "vc-editor-button--active": e.active }]),
120
- disabled: e.disabled,
121
- "aria-pressed": e.active != null ? e.active : void 0,
122
- "aria-label": e.ariaLabel,
123
- onClick: i[0] || (i[0] = (m) => a.$emit("action"))
124
- }, [
125
- b(B(N), {
126
- icon: e.icon,
127
- size: "s",
128
- "use-container": !1,
129
- "aria-hidden": "true"
130
- }, null, 8, ["icon"])
131
- ], 10, ze));
132
- }
133
- });
134
- function J(e) {
135
- return "options" in e;
136
- }
137
- function P(e) {
138
- return !("options" in e);
139
- }
140
- const Ie = {
141
- key: 2,
142
- class: "vc-editor-dropdown"
143
- }, Fe = ["disabled"], He = ["value"], De = /* @__PURE__ */ D({
144
- __name: "vc-editor-custom-button",
145
- props: {
146
- editor: {},
147
- customButton: {},
148
- disabled: { type: Boolean }
149
- },
150
- setup(e) {
151
- const a = e, i = L(() => P(a.customButton) && a.customButton.isActive ? a.customButton.isActive(a.editor) : !1), m = L(() => a.customButton.isDisabled ? a.customButton.isDisabled(a.editor) : !1);
152
- function x() {
153
- P(a.customButton) && a.customButton.action(a.editor);
154
- }
155
- function f(p) {
156
- const k = p.target;
157
- if (J(a.customButton)) {
158
- const v = a.customButton.options.find((t) => t.value === k.value);
159
- v && v.action(a.editor, k.value);
160
- }
161
- }
162
- return (p, k) => B(P)(e.customButton) && e.customButton.component ? (o(), c(ee(e.customButton.component), te({
163
- key: 0,
164
- editor: e.editor,
165
- disabled: e.disabled || m.value
166
- }, e.customButton.componentProps || {}), null, 16, ["editor", "disabled"])) : B(P)(e.customButton) ? (o(), c(r, {
167
- key: 1,
168
- icon: e.customButton.icon,
169
- active: i.value,
170
- disabled: e.disabled || m.value,
171
- onAction: x
172
- }, null, 8, ["icon", "active", "disabled"])) : B(J)(e.customButton) ? (o(), s("div", Ie, [
173
- h("select", {
174
- disabled: e.disabled || m.value,
175
- onChange: f
176
- }, [
177
- (o(!0), s(F, null, R(e.customButton.options, (v) => (o(), s("option", {
178
- key: v.value,
179
- value: v.value
180
- }, M(v.label), 9, He))), 128))
181
- ], 40, Fe)
182
- ])) : g("", !0);
183
- }
184
- }), Ee = { class: "vc-editor-font-selector" }, Ve = { class: "vc-editor-font-selector__dropdown" }, Pe = ["disabled"], Ue = {
185
- key: 0,
186
- class: "vc-editor-font-selector__size-value"
187
- }, Re = ["onClick"], qe = { class: "vc-editor-font-selector__custom" }, Oe = /* @__PURE__ */ D({
188
- __name: "vc-editor-font-selector",
189
- props: {
190
- editor: {},
191
- disabled: { type: Boolean }
192
- },
193
- setup(e) {
194
- const a = e, i = T(!1), m = T(null), x = [8, 10, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72], f = L(() => {
195
- const y = a.editor.getAttributes("textStyle");
196
- return y.fontSize ? parseInt(y.fontSize.replace("px", "")) : null;
197
- });
198
- function p() {
199
- i.value = !i.value;
200
- }
201
- function k(y) {
202
- a.editor.chain().focus().setFontSize(`${y}px`).run(), i.value = !1;
203
- }
204
- function v() {
205
- m.value && m.value >= 8 && m.value <= 72 && (a.editor.chain().focus().setFontSize(`${m.value}px`).run(), m.value = null, i.value = !1);
206
- }
207
- function t() {
208
- i.value = !1;
209
- }
210
- function l(y) {
211
- y.target.closest(".vc-editor-font-selector") || t();
212
- }
213
- return ie(() => {
214
- document.addEventListener("click", l);
215
- }), oe(() => {
216
- document.removeEventListener("click", l);
217
- }), (y, u) => (o(), s("div", Ee, [
218
- h("div", Ve, [
219
- h("button", {
220
- type: "button",
221
- class: "vc-editor-font-selector__button",
222
- disabled: e.disabled,
223
- onClick: p
224
- }, [
225
- b(B(N), {
226
- icon: "lucide-a-large-small",
227
- size: "s",
228
- "use-container": !1
229
- }),
230
- f.value ? (o(), s("span", Ue, M(f.value) + "px", 1)) : g("", !0),
231
- b(B(N), {
232
- icon: "lucide-chevron-down",
233
- size: "xs",
234
- "use-container": !1
235
- })
236
- ], 8, Pe),
237
- i.value ? (o(), s("div", {
238
- key: 0,
239
- class: "vc-editor-font-selector__menu",
240
- onClick: u[1] || (u[1] = le(() => {
241
- }, ["stop"]))
242
- }, [
243
- (o(), s(F, null, R(x, (w) => h("div", {
244
- key: w,
245
- class: U(["vc-editor-font-selector__option", { "vc-editor-font-selector__option--active": f.value === w }]),
246
- onClick: (G) => k(w)
247
- }, M(w) + "px ", 11, Re)), 64)),
248
- h("div", qe, [
249
- ne(h("input", {
250
- "onUpdate:modelValue": u[0] || (u[0] = (w) => m.value = w),
251
- type: "number",
252
- min: "8",
253
- max: "72",
254
- placeholder: "Custom",
255
- class: "vc-editor-font-selector__input",
256
- onKeydown: ae(v, ["enter"]),
257
- onBlur: v
258
- }, null, 544), [
259
- [re, m.value]
260
- ])
261
- ])
262
- ])) : g("", !0)
263
- ])
264
- ]));
265
- }
266
- }), Ne = {
267
- class: "vc-editor-toolbar",
268
- role: "toolbar",
269
- "aria-label": "Text formatting"
270
- }, Ge = {
271
- key: 0,
272
- class: "vc-editor-toolbar__separator"
273
- }, Ke = /* @__PURE__ */ D({
274
- __name: "vc-editor-toolbar",
275
- props: {
276
- editor: {},
277
- disabled: { type: Boolean },
278
- contentType: { default: "html" },
279
- toolbar: {},
280
- customButtons: { default: () => [] }
281
- },
282
- emits: ["uploadImage"],
283
- setup(e, { emit: a }) {
284
- const i = e, m = a, x = L(() => i.toolbar || []), f = L(() => [...i.customButtons].sort((v, t) => {
285
- const l = v.group || "default", y = t.group || "default", u = v.order || 0, w = t.order || 0;
286
- return l !== y ? l.localeCompare(y) : u - w;
287
- }));
288
- function p() {
289
- const v = i.editor.getAttributes("link").href, t = window.prompt("URL", v);
290
- if (t !== null) {
291
- if (t === "") {
292
- i.editor.chain().focus().extendMarkRange("link").unsetLink().run();
293
- return;
294
- }
295
- i.editor.chain().focus().extendMarkRange("link").setLink({ href: t }).run();
296
- }
297
- }
298
- function k() {
299
- m("uploadImage");
300
- }
301
- return (v, t) => (o(), s("div", Ne, [
302
- (o(!0), s(F, null, R(x.value, (l, y) => (o(), s(F, { key: y }, [
303
- l === "separator" ? (o(), s("div", Ge)) : l === "bold" ? (o(), c(r, {
304
- key: 1,
305
- icon: "lucide-bold",
306
- "aria-label": "Bold",
307
- active: e.editor.isActive("bold"),
308
- disabled: !e.editor.can().toggleBold() || e.disabled,
309
- onAction: t[0] || (t[0] = (u) => e.editor.chain().focus().toggleBold().run())
310
- }, null, 8, ["active", "disabled"])) : l === "italic" ? (o(), c(r, {
311
- key: 2,
312
- icon: "lucide-italic",
313
- "aria-label": "Italic",
314
- active: e.editor.isActive("italic"),
315
- disabled: !e.editor.can().toggleItalic() || e.disabled,
316
- onAction: t[1] || (t[1] = (u) => e.editor.chain().focus().toggleItalic().run())
317
- }, null, 8, ["active", "disabled"])) : l === "underline" ? (o(), c(r, {
318
- key: 3,
319
- icon: "lucide-underline",
320
- "aria-label": "Underline",
321
- active: e.editor.isActive("underline"),
322
- disabled: !e.editor.can().toggleUnderline() || e.disabled,
323
- onAction: t[2] || (t[2] = (u) => e.editor.chain().focus().toggleUnderline().run())
324
- }, null, 8, ["active", "disabled"])) : l === "strikethrough" ? (o(), c(r, {
325
- key: 4,
326
- icon: "lucide-strikethrough",
327
- "aria-label": "Strikethrough",
328
- active: e.editor.isActive("strike"),
329
- disabled: !e.editor.can().toggleStrike() || e.disabled,
330
- onAction: t[3] || (t[3] = (u) => e.editor.chain().focus().toggleStrike().run())
331
- }, null, 8, ["active", "disabled"])) : l === "heading1" ? (o(), c(r, {
332
- key: 5,
333
- icon: "lucide-heading-1",
334
- "aria-label": "Heading 1",
335
- active: e.editor.isActive("heading", { level: 1 }),
336
- disabled: !e.editor.can().toggleHeading({ level: 1 }) || e.disabled,
337
- onAction: t[4] || (t[4] = (u) => e.editor.chain().focus().toggleHeading({ level: 1 }).run())
338
- }, null, 8, ["active", "disabled"])) : l === "heading2" ? (o(), c(r, {
339
- key: 6,
340
- icon: "lucide-heading-2",
341
- "aria-label": "Heading 2",
342
- active: e.editor.isActive("heading", { level: 2 }),
343
- disabled: !e.editor.can().toggleHeading({ level: 2 }) || e.disabled,
344
- onAction: t[5] || (t[5] = (u) => e.editor.chain().focus().toggleHeading({ level: 2 }).run())
345
- }, null, 8, ["active", "disabled"])) : l === "heading3" ? (o(), c(r, {
346
- key: 7,
347
- icon: "lucide-heading-3",
348
- "aria-label": "Heading 3",
349
- active: e.editor.isActive("heading", { level: 3 }),
350
- disabled: !e.editor.can().toggleHeading({ level: 3 }) || e.disabled,
351
- onAction: t[6] || (t[6] = (u) => e.editor.chain().focus().toggleHeading({ level: 3 }).run())
352
- }, null, 8, ["active", "disabled"])) : l === "bulletList" ? (o(), c(r, {
353
- key: 8,
354
- icon: "lucide-list",
355
- "aria-label": "Bullet list",
356
- active: e.editor.isActive("bulletList"),
357
- disabled: !e.editor.can().toggleBulletList() || e.disabled,
358
- onAction: t[7] || (t[7] = (u) => e.editor.chain().focus().toggleBulletList().run())
359
- }, null, 8, ["active", "disabled"])) : l === "orderedList" ? (o(), c(r, {
360
- key: 9,
361
- icon: "lucide-list-ordered",
362
- "aria-label": "Numbered list",
363
- active: e.editor.isActive("orderedList"),
364
- disabled: !e.editor.can().toggleOrderedList() || e.disabled,
365
- onAction: t[8] || (t[8] = (u) => e.editor.chain().focus().toggleOrderedList().run())
366
- }, null, 8, ["active", "disabled"])) : l === "blockquote" ? (o(), c(r, {
367
- key: 10,
368
- icon: "lucide-quote",
369
- "aria-label": "Blockquote",
370
- active: e.editor.isActive("blockquote"),
371
- disabled: !e.editor.can().toggleBlockquote() || e.disabled,
372
- onAction: t[9] || (t[9] = (u) => e.editor.chain().focus().toggleBlockquote().run())
373
- }, null, 8, ["active", "disabled"])) : l === "link" ? (o(), c(r, {
374
- key: 11,
375
- icon: "lucide-link",
376
- "aria-label": "Insert link",
377
- active: e.editor.isActive("link"),
378
- disabled: e.disabled,
379
- onAction: p
380
- }, null, 8, ["active", "disabled"])) : l === "image" ? (o(), c(r, {
381
- key: 12,
382
- icon: "lucide-image",
383
- "aria-label": "Insert image",
384
- disabled: e.disabled,
385
- onAction: k
386
- }, null, 8, ["disabled"])) : l === "table" ? (o(), c(r, {
387
- key: 13,
388
- icon: "lucide-table",
389
- "aria-label": "Insert table",
390
- disabled: e.disabled,
391
- onAction: t[10] || (t[10] = (u) => e.editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run())
392
- }, null, 8, ["disabled"])) : l === "fontSize" ? (o(), c(Oe, {
393
- key: 14,
394
- editor: e.editor,
395
- disabled: e.disabled
396
- }, null, 8, ["editor", "disabled"])) : g("", !0)
397
- ], 64))), 128)),
398
- i.customButtons.length > 0 ? (o(), s(F, { key: 0 }, [
399
- t[18] || (t[18] = h("div", { class: "vc-editor-toolbar__separator" }, null, -1)),
400
- (o(!0), s(F, null, R(f.value, (l) => (o(), c(De, {
401
- key: l.id,
402
- editor: e.editor,
403
- "custom-button": l,
404
- disabled: e.disabled
405
- }, null, 8, ["editor", "custom-button", "disabled"]))), 128))
406
- ], 64)) : g("", !0),
407
- e.editor.isActive("table") ? (o(), s(F, { key: 1 }, [
408
- t[19] || (t[19] = h("div", { class: "vc-editor-toolbar__separator" }, null, -1)),
409
- b(r, {
410
- icon: "lucide-delete",
411
- "aria-label": "Delete table",
412
- disabled: e.disabled,
413
- onAction: t[11] || (t[11] = (l) => e.editor.chain().focus().deleteTable().run())
414
- }, null, 8, ["disabled"]),
415
- b(r, {
416
- icon: "lucide-arrow-left-from-line",
417
- "aria-label": "Add column before",
418
- disabled: e.disabled,
419
- onAction: t[12] || (t[12] = (l) => e.editor.chain().focus().addColumnBefore().run())
420
- }, null, 8, ["disabled"]),
421
- b(r, {
422
- icon: "lucide-arrow-right-from-line",
423
- "aria-label": "Add column after",
424
- disabled: e.disabled,
425
- onAction: t[13] || (t[13] = (l) => e.editor.chain().focus().addColumnAfter().run())
426
- }, null, 8, ["disabled"]),
427
- b(r, {
428
- icon: "lucide-arrow-up-from-line",
429
- "aria-label": "Add row before",
430
- disabled: e.disabled,
431
- onAction: t[14] || (t[14] = (l) => e.editor.chain().focus().addRowBefore().run())
432
- }, null, 8, ["disabled"]),
433
- b(r, {
434
- icon: "lucide-arrow-down-from-line",
435
- "aria-label": "Add row after",
436
- disabled: e.disabled,
437
- onAction: t[15] || (t[15] = (l) => e.editor.chain().focus().addRowAfter().run())
438
- }, null, 8, ["disabled"]),
439
- b(r, {
440
- icon: "lucide-trash-2",
441
- "aria-label": "Delete column",
442
- disabled: e.disabled,
443
- onAction: t[16] || (t[16] = (l) => e.editor.chain().focus().deleteColumn().run())
444
- }, null, 8, ["disabled"]),
445
- b(r, {
446
- icon: "lucide-trash",
447
- "aria-label": "Delete row",
448
- disabled: e.disabled,
449
- onAction: t[17] || (t[17] = (l) => e.editor.chain().focus().deleteRow().run())
450
- }, null, 8, ["disabled"])
451
- ], 64)) : g("", !0)
452
- ]));
453
- }
454
- }), We = ["aria-label", "aria-invalid", "aria-disabled"], je = {
455
- key: 1,
456
- class: "vc-editor__header"
457
- }, Je = { class: "vc-editor__header-actions" }, Xe = { class: "vc-editor__body" }, Ze = ["innerHTML"], Qe = ["value", "maxlength"], Ye = {
458
- key: 3,
459
- class: "vc-editor__split-view"
460
- }, _e = { class: "vc-editor__split-editor" }, et = { class: "vc-editor__split-preview" }, tt = ["value", "maxlength"], it = { key: 0 }, Li = /* @__PURE__ */ D({
461
- __name: "vc-editor",
462
- props: {
463
- placeholder: {},
464
- modelValue: { default: "" },
465
- required: { type: Boolean },
466
- disabled: { type: Boolean, default: !1 },
467
- label: {},
468
- tooltip: {},
469
- errorMessage: {},
470
- assetsFolder: {},
471
- multilanguage: { type: Boolean },
472
- currentLanguage: {},
473
- maxlength: {},
474
- toolbar: {},
475
- extensions: {},
476
- customButtons: {}
477
- },
478
- emits: ["update:modelValue", "upload-image"],
479
- setup(e, { emit: a }) {
480
- const i = e, m = a, x = T(!1), f = T(!1), p = T(null), k = T("markdown"), v = L(() => i.toolbar ? i.toolbar : [
481
- "bold",
482
- "italic",
483
- "underline",
484
- "strikethrough",
485
- "separator",
486
- "heading1",
487
- "heading2",
488
- "heading3",
489
- "separator",
490
- "bulletList",
491
- "orderedList",
492
- "blockquote",
493
- "separator",
494
- "link",
495
- "image",
496
- "table",
497
- "fontSize"
498
- ]), t = L(() => (i.modelValue || "").length), l = L(() => i.maxlength ? t.value > i.maxlength * 0.9 : !1);
499
- function y(n) {
500
- if (!n || n.trim() === "") return "markdown";
501
- const d = [
502
- /<[^>]+>/g,
503
- // HTML tags
504
- /&[a-zA-Z]+;/g
505
- // HTML entities
506
- ], $ = [
507
- /^#{1,6}\s/m,
508
- // Headers
509
- /^\*\s/m,
510
- // Bullet lists
511
- /^\d+\.\s/m,
512
- // Numbered lists
513
- /\*\*[^*]+\*\*/g,
514
- // Bold
515
- /\*[^*]+\*/g,
516
- // Italic
517
- /\[[^\]]+\]\([^)]+\)/g,
518
- // Links
519
- /```[\s\S]*?```/g,
520
- // Code blocks
521
- /`[^`]+`/g,
522
- // Inline code
523
- /^>/m
524
- // Blockquotes
525
- ];
526
- let H = 0, I = 0;
527
- return d.forEach((E) => {
528
- const C = n.match(E);
529
- C && (H += C.length);
530
- }), $.forEach((E) => {
531
- const C = n.match(E);
532
- C && (I += C.length);
533
- }), H > I * 2 ? "html" : "markdown";
534
- }
535
- const u = L(() => {
536
- const n = [
537
- ve,
538
- be,
539
- Be,
540
- Me,
541
- ke.configure({ resizable: !0 }),
542
- fe,
543
- ge,
544
- he,
545
- ye.configure({ openOnClick: !1 }),
546
- we,
547
- Ae.configure({ placeholder: i.placeholder }),
548
- xe.configure({
549
- html: !0,
550
- // Allow HTML input/output
551
- tightLists: !0,
552
- // No <p> inside <li> in markdown output
553
- tightListClass: "tight",
554
- // Add class to <ul> allowing you to remove <p> margins when tight
555
- bulletListMarker: "-",
556
- // <li> prefix in markdown output
557
- linkify: !1,
558
- // Create links from "https://..." text
559
- breaks: !0,
560
- // New lines (\n) in markdown input are converted to <br>
561
- transformPastedText: !1,
562
- // Allow to paste markdown text in the editor
563
- transformCopiedText: !1
564
- // Copied text is transformed to markdown
565
- })
566
- ];
567
- return i.extensions && i.extensions.length > 0 && n.push(...i.extensions), n;
568
- }), w = T(i.modelValue || "");
569
- O(
570
- () => i.modelValue,
571
- async (n) => {
572
- if (k.value = y(n || ""), k.value === "html")
573
- try {
574
- w.value = await $e(n || "", {
575
- parser: "html",
576
- plugins: [Le],
577
- vueIndentScriptAndStyle: !0
578
- });
579
- } catch {
580
- w.value = n || "";
581
- }
582
- else
583
- w.value = n || "";
584
- },
585
- { immediate: !0 }
586
- );
587
- const G = L(() => {
588
- let n = "";
589
- return k.value === "markdown" && A.value ? n = A.value.getHTML() : n = i.modelValue || "", pe.sanitize(n, {
590
- // Allow safe HTML tags and attributes
591
- ALLOWED_TAGS: [
592
- "p",
593
- "br",
594
- "strong",
595
- "em",
596
- "u",
597
- "s",
598
- "h1",
599
- "h2",
600
- "h3",
601
- "h4",
602
- "h5",
603
- "h6",
604
- "ul",
605
- "ol",
606
- "li",
607
- "blockquote",
608
- "pre",
609
- "code",
610
- "a",
611
- "img",
612
- "table",
613
- "thead",
614
- "tbody",
615
- "tr",
616
- "th",
617
- "td",
618
- "hr",
619
- "div",
620
- "span"
621
- ],
622
- ALLOWED_ATTR: ["href", "src", "alt", "title", "class", "id", "style", "colspan", "rowspan", "align", "valign"],
623
- // Remove dangerous protocols
624
- ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))/i,
625
- // Keep relative URLs
626
- KEEP_CONTENT: !0,
627
- // Remove script tags and event handlers
628
- FORBID_TAGS: ["script", "object", "embed", "form", "input"],
629
- FORBID_ATTR: ["onerror", "onload", "onclick", "onmouseover", "onfocus", "onblur"]
630
- });
631
- }), z = T("editor"), S = L(() => z.value);
632
- function X() {
633
- z.value = z.value === "preview" ? "editor" : "preview";
634
- }
635
- function Z() {
636
- z.value = z.value === "source" ? "editor" : "source";
637
- }
638
- function Q() {
639
- z.value = z.value === "split" ? "editor" : "split";
640
- }
641
- let q = !1;
642
- const A = me({
643
- content: i.modelValue,
644
- editable: !i.disabled,
645
- extensions: u.value,
646
- onUpdate: ({ editor: n }) => {
647
- if (q) return;
648
- const d = k.value === "html" ? n.getHTML() : n.storage.markdown?.getMarkdown?.() || n.getHTML();
649
- i.maxlength && d.length > i.maxlength || m("update:modelValue", d);
650
- },
651
- onFocus: () => {
652
- x.value = !0;
653
- },
654
- onBlur: () => {
655
- x.value = !1;
656
- }
657
- });
658
- O(
659
- () => i.modelValue,
660
- (n) => {
661
- if (!A.value) return;
662
- (k.value === "html" ? A.value.getHTML() : A.value.storage.markdown?.getMarkdown?.() || A.value.getHTML()) !== n && (q = !0, A.value.commands.setContent(n || ""), q = !1);
663
- }
664
- ), O(
665
- () => i.disabled,
666
- (n) => {
667
- A.value?.setEditable(!n);
668
- }
669
- ), de(() => {
670
- A.value?.destroy();
671
- });
672
- function Y() {
673
- p.value?.click();
674
- }
675
- function K(n) {
676
- const d = n.target, $ = d.value;
677
- if (i.maxlength && $.length > i.maxlength) {
678
- d.value = $.substring(0, i.maxlength);
679
- return;
680
- }
681
- m("update:modelValue", $);
682
- }
683
- async function _(n) {
684
- const d = n.target;
685
- if (!d.files?.length || !i.assetsFolder) return;
686
- const $ = Array.from(d.files), H = new FormData();
687
- $.forEach((I) => H.append("image", I));
688
- try {
689
- (await (await fetch(`/api/assets?folderUrl=/${i.assetsFolder}`, {
690
- method: "POST",
691
- body: H
692
- })).json()).forEach((C) => {
693
- C.url && A.value?.chain().focus().setImage({ src: C.url }).run();
694
- });
695
- } catch (I) {
696
- console.error("Image upload failed:", I);
697
- }
698
- }
699
- return (n, d) => (o(), s("div", {
700
- class: U(["vc-editor", {
701
- "vc-editor--error": !!e.errorMessage,
702
- "vc-editor--disabled": e.disabled,
703
- "vc-editor--focused": x.value,
704
- "vc-editor--fullscreen": f.value,
705
- "vc-editor--side-by-side": S.value === "split"
706
- }]),
707
- "aria-label": e.label,
708
- "aria-invalid": !!e.errorMessage || void 0,
709
- "aria-disabled": e.disabled || void 0
710
- }, [
711
- e.label && !f.value ? (o(), c(B(Ce), {
712
- key: 0,
713
- class: "vc-editor__label",
714
- required: e.required,
715
- multilanguage: e.multilanguage,
716
- "current-language": e.currentLanguage,
717
- error: !!e.errorMessage
718
- }, se({
719
- default: V(() => [
720
- h("span", null, M(e.label), 1)
721
- ]),
722
- _: 2
723
- }, [
724
- e.tooltip ? {
725
- name: "tooltip",
726
- fn: V(() => [
727
- W(M(e.tooltip), 1)
728
- ]),
729
- key: "0"
730
- } : void 0
731
- ]), 1032, ["required", "multilanguage", "current-language", "error"])) : g("", !0),
732
- B(A) ? (o(), s("div", je, [
733
- S.value === "editor" || S.value === "split" ? (o(), c(Ke, {
734
- key: 0,
735
- editor: B(A),
736
- disabled: e.disabled,
737
- "content-type": k.value,
738
- toolbar: v.value,
739
- "custom-buttons": i.customButtons || [],
740
- onUploadImage: Y
741
- }, null, 8, ["editor", "disabled", "content-type", "toolbar", "custom-buttons"])) : g("", !0),
742
- h("div", Je, [
743
- b(r, {
744
- icon: "lucide-eye",
745
- "aria-label": "Preview",
746
- active: S.value === "preview",
747
- disabled: e.disabled,
748
- onAction: X
749
- }, null, 8, ["active", "disabled"]),
750
- b(r, {
751
- icon: "lucide-columns-2",
752
- "aria-label": "Side-by-side view",
753
- active: S.value === "split",
754
- onAction: Q
755
- }, null, 8, ["active"]),
756
- b(r, {
757
- icon: "lucide-code",
758
- "aria-label": "Source code",
759
- active: S.value === "source",
760
- disabled: e.disabled,
761
- onAction: Z
762
- }, null, 8, ["active", "disabled"]),
763
- b(r, {
764
- icon: f.value ? "lucide-shrink" : "lucide-expand",
765
- "aria-label": f.value ? "Exit fullscreen" : "Fullscreen",
766
- onAction: d[0] || (d[0] = ($) => f.value = !f.value)
767
- }, null, 8, ["icon", "aria-label"])
768
- ])
769
- ])) : g("", !0),
770
- h("div", Xe, [
771
- S.value === "editor" ? (o(), c(B(j), {
772
- key: 0,
773
- editor: B(A),
774
- class: "vc-editor__content"
775
- }, null, 8, ["editor"])) : g("", !0),
776
- S.value === "preview" ? (o(), s("div", {
777
- key: 1,
778
- class: "vc-editor__preview ProseMirror",
779
- innerHTML: G.value
780
- }, null, 8, Ze)) : g("", !0),
781
- S.value === "source" ? (o(), s("textarea", {
782
- key: 2,
783
- class: "vc-editor__source ProseMirror",
784
- value: w.value,
785
- maxlength: e.maxlength,
786
- onInput: K,
787
- onFocus: d[1] || (d[1] = ($) => x.value = !0),
788
- onBlur: d[2] || (d[2] = ($) => x.value = !1)
789
- }, null, 40, Qe)) : g("", !0),
790
- S.value === "split" ? (o(), s("div", Ye, [
791
- h("div", _e, [
792
- b(B(j), {
793
- editor: B(A),
794
- class: "vc-editor__content"
795
- }, null, 8, ["editor"])
796
- ]),
797
- h("div", et, [
798
- h("textarea", {
799
- class: "vc-editor__source ProseMirror",
800
- value: w.value,
801
- maxlength: e.maxlength,
802
- onInput: K,
803
- onFocus: d[3] || (d[3] = ($) => x.value = !0),
804
- onBlur: d[4] || (d[4] = ($) => x.value = !1)
805
- }, null, 40, tt)
806
- ])
807
- ])) : g("", !0)
808
- ]),
809
- e.maxlength && (S.value === "source" || S.value === "split") ? (o(), s("div", {
810
- key: 2,
811
- class: U(["vc-editor__char-count", { "vc-editor__char-count--warning": l.value }])
812
- }, M(t.value) + " / " + M(e.maxlength), 3)) : g("", !0),
813
- h("input", {
814
- ref_key: "imageInput",
815
- ref: p,
816
- type: "file",
817
- hidden: "",
818
- multiple: "",
819
- accept: "image/*",
820
- onChange: _
821
- }, null, 544),
822
- b(ue, {
823
- name: "slide-up",
824
- mode: "out-in"
825
- }, {
826
- default: V(() => [
827
- e.errorMessage && !f.value ? (o(), s("div", it, [
828
- ce(n.$slots, "error", {}, () => [
829
- b(B(Te), {
830
- class: "vc-editor__error-hint",
831
- error: !0
832
- }, {
833
- default: V(() => [
834
- W(M(e.errorMessage), 1)
835
- ]),
836
- _: 1
837
- })
838
- ])
839
- ])) : g("", !0)
840
- ]),
841
- _: 3
842
- })
843
- ], 10, We));
844
- }
845
- });
846
- export {
847
- Li as default
848
- };