@jsg-developer/vue-pack 0.0.9-beta-2 → 0.0.9-beta-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/THIRD_PARTY_LICENSES.json +1 -1
  2. package/dist/TabelData-D4BrZQVx.cjs +15 -0
  3. package/dist/TabelData-DwLu2vs2.js +8144 -0
  4. package/dist/init.cjs.js +1 -1
  5. package/dist/init.es.js +1 -1
  6. package/dist/jsgd-vue-pack.cjs.js +1 -1
  7. package/dist/jsgd-vue-pack.es.js +631 -228
  8. package/dist/resize-5FyL6R_t.js +1308 -0
  9. package/dist/resize-Cp7HnMN4.cjs +1 -0
  10. package/dist/style.css +1 -1
  11. package/dist/types/components/Form/FormModal.vue.d.ts +2 -2
  12. package/dist/types/components/Tabel/TabelData.vue.d.ts +2 -2
  13. package/dist/types/components/UI/Display/BaseLabel.vue.d.ts +1 -16
  14. package/dist/types/components/UI/Inputs/ComboboxComponent.vue.d.ts +2 -2
  15. package/dist/types/components/UI/Inputs/TextAreaQuill.vue.d.ts +1 -1
  16. package/dist/types/components/UI/Inputs/components/QuillAltModal.vue.d.ts +2 -2
  17. package/dist/types/components/UI/Inputs/components/QuillEmbedModal.vue.d.ts +2 -2
  18. package/dist/types/components/index.d.ts +1 -1
  19. package/dist/vue.cjs.js +1 -1
  20. package/dist/vue.es.js +42 -47
  21. package/package.json +4 -1
  22. package/dist/chunks/ArrayObject-BA88O7bP.cjs.js +0 -1
  23. package/dist/chunks/ArrayObject-DYnfWxW-.es.js +0 -4
  24. package/dist/chunks/ColorPicker-CqrPcGbi.es.js +0 -4
  25. package/dist/chunks/ColorPicker-W_cn5ezl.cjs.js +0 -1
  26. package/dist/chunks/ComboboxComponent-BU-VQz2u.es.js +0 -4
  27. package/dist/chunks/ComboboxComponent-Dwlhjcru.cjs.js +0 -1
  28. package/dist/chunks/CurrencyInput-CNQzGqgu.cjs.js +0 -1
  29. package/dist/chunks/CurrencyInput-DVlgxmiu.es.js +0 -4
  30. package/dist/chunks/DateInput-B1EpMWa0.es.js +0 -4
  31. package/dist/chunks/DateInput-DMFCzQCr.cjs.js +0 -1
  32. package/dist/chunks/DateTimeInput-8w4T-EZX.cjs.js +0 -1
  33. package/dist/chunks/DateTimeInput-CC70bKnU.es.js +0 -4
  34. package/dist/chunks/DateTimeInput.vue_vue_type_script_setup_true_lang-BLJgRk91.es.js +0 -142
  35. package/dist/chunks/DateTimeInput.vue_vue_type_script_setup_true_lang-DmmVjDPV.cjs.js +0 -2
  36. package/dist/chunks/EmailInput-B0F3AHeq.es.js +0 -4
  37. package/dist/chunks/EmailInput-EU4MR4Jw.cjs.js +0 -1
  38. package/dist/chunks/FileArrayInput-CR-seczb.cjs.js +0 -1
  39. package/dist/chunks/FileArrayInput-DljGrRxA.es.js +0 -5
  40. package/dist/chunks/FileArrayInput.vue_vue_type_script_setup_true_lang-C7UCpQqG.es.js +0 -198
  41. package/dist/chunks/FileArrayInput.vue_vue_type_script_setup_true_lang-DtC-rygi.cjs.js +0 -2
  42. package/dist/chunks/FileInput-A1qH_OLh.cjs.js +0 -1
  43. package/dist/chunks/FileInput-CC5a2_o2.es.js +0 -4
  44. package/dist/chunks/GroupRenderer-BL1UiQs5.cjs.js +0 -1
  45. package/dist/chunks/GroupRenderer-Cj7o8pSh.es.js +0 -4
  46. package/dist/chunks/ImageArrayInput-B3f9I0U1.cjs.js +0 -1
  47. package/dist/chunks/ImageArrayInput-Bl0af1_X.es.js +0 -5
  48. package/dist/chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-NqHOY8OF.es.js +0 -421
  49. package/dist/chunks/ImageArrayInput.vue_vue_type_script_setup_true_lang-d88H9xj4.cjs.js +0 -2
  50. package/dist/chunks/ImageInput-DL8tNIdV.es.js +0 -4
  51. package/dist/chunks/ImageInput-KmSPSWhK.cjs.js +0 -1
  52. package/dist/chunks/NumberInput-BOjP2XCy.es.js +0 -4
  53. package/dist/chunks/NumberInput-C47NQmuA.cjs.js +0 -1
  54. package/dist/chunks/ObjectInput-DLkhG2Ha.es.js +0 -4
  55. package/dist/chunks/ObjectInput-e0FX9gIv.cjs.js +0 -1
  56. package/dist/chunks/PasswordInput-CgeIq4tr.cjs.js +0 -1
  57. package/dist/chunks/PasswordInput-CkF4phav.es.js +0 -4
  58. package/dist/chunks/RateInput-C7irYBQy.cjs.js +0 -1
  59. package/dist/chunks/RateInput-DYD5aMQX.es.js +0 -4
  60. package/dist/chunks/TabelData-DV56gH8Y.cjs.js +0 -1
  61. package/dist/chunks/TabelData-jJvzQD8f.es.js +0 -2438
  62. package/dist/chunks/TagInput-B6F5GleV.es.js +0 -4
  63. package/dist/chunks/TagInput-DC9jPCR9.cjs.js +0 -1
  64. package/dist/chunks/TelInput-BTioT0Aa.cjs.js +0 -1
  65. package/dist/chunks/TelInput-BwtzcLzw.es.js +0 -4
  66. package/dist/chunks/TextAreaInput-B-dcc-ch.es.js +0 -4
  67. package/dist/chunks/TextAreaInput-BXlGB91c.cjs.js +0 -1
  68. package/dist/chunks/TextAreaQuill-CJyF1I1R.es.js +0 -637
  69. package/dist/chunks/TextAreaQuill-DKgdqbEG.cjs.js +0 -1
  70. package/dist/chunks/TextInput-BwgTx7Xt.es.js +0 -4
  71. package/dist/chunks/TextInput-CC8TbO0N.cjs.js +0 -1
  72. package/dist/chunks/TimeInput-BvUbIEtA.cjs.js +0 -1
  73. package/dist/chunks/TimeInput-DsiHBSIo.es.js +0 -4
  74. package/dist/chunks/ToggleInput-DfAKsRdZ.cjs.js +0 -1
  75. package/dist/chunks/ToggleInput-mQ_mnG4E.es.js +0 -4
  76. package/dist/chunks/UrlInput-C8bIoQBb.cjs.js +0 -1
  77. package/dist/chunks/UrlInput-o1uJulwN.es.js +0 -4
  78. package/dist/chunks/resize-2N3sqejU.es.js +0 -6012
  79. package/dist/chunks/resize-DsxsWx52.cjs.js +0 -12
@@ -1,4 +0,0 @@
1
- import { o } from "./resize-2N3sqejU.es.js";
2
- export {
3
- o as default
4
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./resize-DsxsWx52.cjs.js");exports.default=e._sfc_main$15;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./resize-DsxsWx52.cjs.js");exports.default=e._sfc_main$17;
@@ -1,4 +0,0 @@
1
- import { q as f } from "./resize-2N3sqejU.es.js";
2
- export {
3
- f as default
4
- };
@@ -1,4 +0,0 @@
1
- import { p as f } from "./resize-2N3sqejU.es.js";
2
- export {
3
- f as default
4
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./resize-DsxsWx52.cjs.js");exports.default=e._sfc_main$16;
@@ -1,637 +0,0 @@
1
- import { defineComponent as Q, ref as n, computed as M, watch as I, createBlock as B, openBlock as r, Transition as D, withCtx as E, createElementBlock as j, createCommentVNode as x, withModifiers as G, createVNode as P, createElementVNode as e, toDisplayString as C, normalizeClass as A, withDirectives as V, vModelText as z, withKeys as K, inject as le, onMounted as de, onUnmounted as ae, Teleport as oe, createTextVNode as F, unref as ne, vShow as re, Fragment as ie, renderList as ue } from "vue";
2
- import H from "dompurify";
3
- import { ac as N, U as ge, z as je, aa as _, a as ce } from "./resize-2N3sqejU.es.js";
4
- import "lodash.isequal";
5
- import "zod";
6
- const me = { class: "jsgd-w-full jsgd-max-w-md jsgd-bg-white jsgd-rounded-xl jsgd-shadow-2xl jsgd-overflow-hidden dark:jsgd-bg-slate-800" }, be = { class: "jsgd-p-5 jsgd-border-b jsgd-border-slate-200 dark:jsgd-border-slate-700" }, ve = { class: "jsgd-text-lg jsgd-font-bold jsgd-text-slate-900 dark:jsgd-text-slate-100" }, pe = { class: "jsgd-p-5 jsgd-flex jsgd-flex-col jsgd-gap-5" }, fe = {
7
- key: 0,
8
- class: "jsgd-flex jsgd-w-full jsgd-p-1 jsgd-bg-slate-100 jsgd-rounded-lg dark:jsgd-bg-slate-700"
9
- }, xe = { key: 1 }, he = {
10
- key: 2,
11
- class: "jsgd-box-border"
12
- }, ke = ["placeholder"], we = { key: 3 }, ye = ["accept"], qe = {
13
- key: 0,
14
- class: "jsgd-mt-4"
15
- }, Ue = ["src"], Te = { key: 4 }, Le = { class: "jsgd-p-4 jsgd-bg-slate-50 jsgd-flex jsgd-justify-end jsgd-gap-3 dark:jsgd-bg-slate-900/50" }, Me = ["disabled"], Ve = { key: 0 }, Se = { key: 1 }, $e = /* @__PURE__ */ Q({
16
- __name: "QuillEmbedModal",
17
- props: {
18
- show: { type: Boolean },
19
- mode: {},
20
- uploadUrl: {},
21
- initialValue: {},
22
- initialText: {}
23
- },
24
- emits: ["close", "submit"],
25
- setup(u, { emit: S }) {
26
- const s = u, h = S, l = n(""), b = n(""), v = n(null), k = n(""), p = n(null), f = n(!1), g = n("url"), w = M(() => !!s.uploadUrl), R = M(() => {
27
- switch (s.mode) {
28
- case "image":
29
- return "Insert Image";
30
- case "video":
31
- return "Embed Video";
32
- case "link":
33
- return "Insert Link";
34
- default:
35
- return "Insert Media";
36
- }
37
- }), c = M(() => s.mode === "video" ? "e.g., YouTube, Vimeo URL" : "https://...");
38
- I(
39
- () => s.show,
40
- (m) => {
41
- m && (g.value = w.value ? "upload" : "url", l.value = s.initialValue || "", k.value = s.initialText || "", b.value = "", v.value = null, p.value = null, f.value = !1);
42
- }
43
- );
44
- function U() {
45
- h("close");
46
- }
47
- function T(m) {
48
- const d = m.target;
49
- if (d.files && d.files[0] && (v.value = d.files[0], s.mode === "image")) {
50
- const i = new FileReader();
51
- i.onload = (L) => {
52
- p.value = L.target?.result;
53
- }, i.readAsDataURL(v.value);
54
- }
55
- }
56
- async function $() {
57
- f.value = !0;
58
- try {
59
- if (g.value === "upload" && w.value) {
60
- if (!v.value) {
61
- alert("Please select a file to upload.");
62
- return;
63
- }
64
- if (!s.uploadUrl) {
65
- alert("Upload API URL is not configured.");
66
- return;
67
- }
68
- const m = new FormData();
69
- m.append("file", v.value);
70
- const d = await fetch(s.uploadUrl, { method: "POST", body: m });
71
- if (!d.ok) throw new Error("Upload failed");
72
- const i = await d.json(), L = i.url || i.secure_url || i.path || i.data?.url || i.data?.path || i.data?.secure_url;
73
- if (!L) throw new Error("URL not found in upload response");
74
- h("submit", { url: L, alt: b.value, text: k.value });
75
- } else {
76
- if (!l.value) {
77
- alert("Please enter a URL.");
78
- return;
79
- }
80
- h("submit", { url: l.value, alt: b.value, text: k.value });
81
- }
82
- } catch (m) {
83
- console.error(m), alert(m.message || "An error occurred.");
84
- } finally {
85
- f.value = !1;
86
- }
87
- }
88
- return (m, d) => (r(), B(D, {
89
- name: "jsgd-modal-overlay",
90
- appear: ""
91
- }, {
92
- default: E(() => [
93
- u.show ? (r(), j("div", {
94
- key: 0,
95
- class: "jsgd-fixed jsgd-inset-0 jsgd-z-[10000000] jsgd-flex jsgd-items-center jsgd-justify-center jsgd-p-4 jsgd-bg-black/60 jsgd-backdrop-blur-sm",
96
- onClick: G(U, ["self"])
97
- }, [
98
- P(D, {
99
- name: "jsgd-modal-container",
100
- appear: ""
101
- }, {
102
- default: E(() => [
103
- e("div", me, [
104
- e("div", be, [
105
- e("h3", ve, C(R.value), 1)
106
- ]),
107
- e("div", pe, [
108
- w.value && u.mode !== "link" ? (r(), j("div", fe, [
109
- e("button", {
110
- onClick: d[0] || (d[0] = (i) => g.value = "upload"),
111
- class: A([
112
- "jsgd-flex-1 jsgd-py-1.5 jsgd-px-3 jsgd-text-sm jsgd-font-semibold jsgd-rounded-md jsgd-transition-colors jsgd-duration-200",
113
- g.value === "upload" ? "jsgd-bg-white jsgd-text-blue-600 jsgd-shadow-sm dark:jsgd-bg-slate-600 dark:jsgd-text-white" : "jsgd-bg-transparent jsgd-text-slate-500 hover:jsgd-text-slate-700 dark:jsgd-text-slate-400 dark:hover:jsgd-text-slate-200"
114
- ])
115
- }, " Upload ", 2),
116
- e("button", {
117
- onClick: d[1] || (d[1] = (i) => g.value = "url"),
118
- class: A([
119
- "jsgd-flex-1 jsgd-py-1.5 jsgd-px-3 jsgd-text-sm jsgd-font-semibold jsgd-rounded-md jsgd-transition-colors jsgd-duration-200",
120
- g.value === "url" ? "jsgd-bg-white jsgd-text-blue-600 jsgd-shadow-sm dark:jsgd-bg-slate-600 dark:jsgd-text-white" : "jsgd-bg-transparent jsgd-text-slate-500 hover:jsgd-text-slate-700 dark:jsgd-text-slate-400 dark:hover:jsgd-text-slate-200"
121
- ])
122
- }, " From URL ", 2)
123
- ])) : x("", !0),
124
- u.mode === "link" ? (r(), j("div", xe, [
125
- d[5] || (d[5] = e("label", { class: "jsgd-block jsgd-text-sm jsgd-font-medium jsgd-mb-1 dark:jsgd-text-slate-300" }, "Text to display", -1)),
126
- V(e("input", {
127
- "onUpdate:modelValue": d[2] || (d[2] = (i) => k.value = i),
128
- type: "text",
129
- placeholder: "If empty, URL will be shown",
130
- class: "jsgd-w-full jsgd-py-2 jsgd-px-3 jsgd-rounded-md jsgd-border jsgd-border-slate-300 dark:jsgd-bg-slate-700 dark:jsgd-border-slate-600 dark:jsgd-text-white"
131
- }, null, 512), [
132
- [z, k.value]
133
- ])
134
- ])) : x("", !0),
135
- g.value === "url" || u.mode === "link" ? (r(), j("div", he, [
136
- d[6] || (d[6] = e("label", { class: "jsgd-block jsgd-text-sm jsgd-font-medium jsgd-mb-1 dark:jsgd-text-slate-300" }, "URL", -1)),
137
- V(e("input", {
138
- "onUpdate:modelValue": d[3] || (d[3] = (i) => l.value = i),
139
- type: "text",
140
- placeholder: c.value,
141
- class: "jsgd-w-full jsgd-py-2 jsgd-px-3 jsgd-rounded-md jsgd-border jsgd-border-slate-300 dark:jsgd-bg-slate-700 dark:jsgd-border-slate-600 dark:jsgd-text-white",
142
- onKeydown: K($, ["enter"])
143
- }, null, 40, ke), [
144
- [z, l.value]
145
- ])
146
- ])) : x("", !0),
147
- g.value === "upload" && w.value ? (r(), j("div", we, [
148
- d[7] || (d[7] = e("label", { class: "jsgd-block jsgd-text-sm jsgd-font-medium jsgd-mb-1 dark:jsgd-text-slate-300" }, "Upload File", -1)),
149
- e("input", {
150
- type: "file",
151
- accept: u.mode === "image" ? "image/*" : "video/*",
152
- onChange: T,
153
- class: "jsgd-w-full jsgd-text-sm jsgd-text-slate-500 file:jsgd-mr-4 file:jsgd-py-2 file:jsgd-px-4 file:jsgd-rounded-full file:jsgd-border-0 file:jsgd-text-sm file:jsgd-font-semibold file:jsgd-bg-blue-50 file:jsgd-text-blue-700 hover:file:jsgd-bg-blue-100 dark:file:jsgd-bg-blue-900/50 dark:file:jsgd-text-blue-300 dark:hover:file:jsgd-bg-blue-900"
154
- }, null, 40, ye),
155
- p.value ? (r(), j("div", qe, [
156
- e("img", {
157
- src: p.value,
158
- class: "jsgd-max-w-full jsgd-max-h-40 jsgd-rounded-md",
159
- alt: "Upload Preview"
160
- }, null, 8, Ue)
161
- ])) : x("", !0)
162
- ])) : x("", !0),
163
- u.mode === "image" ? (r(), j("div", Te, [
164
- d[8] || (d[8] = e("label", { class: "jsgd-block jsgd-text-sm jsgd-font-medium jsgd-mb-1 dark:jsgd-text-slate-300" }, "Alt Text (Optional)", -1)),
165
- V(e("input", {
166
- "onUpdate:modelValue": d[4] || (d[4] = (i) => b.value = i),
167
- type: "text",
168
- placeholder: "Describe the image for accessibility",
169
- class: "jsgd-w-full jsgd-py-2 jsgd-px-3 jsgd-rounded-md jsgd-border jsgd-border-slate-300 dark:jsgd-bg-slate-700 dark:jsgd-border-slate-600 dark:jsgd-text-white"
170
- }, null, 512), [
171
- [z, b.value]
172
- ])
173
- ])) : x("", !0)
174
- ]),
175
- e("div", Le, [
176
- e("button", {
177
- onClick: U,
178
- class: "jsgd-px-4 jsgd-py-2 jsgd-rounded-md jsgd-text-sm jsgd-font-medium jsgd-bg-white jsgd-border jsgd-border-slate-300 hover:jsgd-bg-slate-50 dark:jsgd-bg-slate-700 dark:jsgd-text-slate-200 dark:jsgd-border-slate-600 dark:hover:jsgd-bg-slate-600"
179
- }, " Cancel "),
180
- e("button", {
181
- onClick: $,
182
- class: "jsgd-px-4 jsgd-py-2 jsgd-rounded-md jsgd-text-sm jsgd-font-medium jsgd-text-white jsgd-bg-blue-600 hover:jsgd-bg-blue-700 dark:jsgd-bg-blue-500 dark:hover:jsgd-bg-blue-600",
183
- disabled: f.value
184
- }, [
185
- f.value ? (r(), j("span", Ve, "Inserting...")) : (r(), j("span", Se, "Insert"))
186
- ], 8, Me)
187
- ])
188
- ])
189
- ]),
190
- _: 1
191
- })
192
- ])) : x("", !0)
193
- ]),
194
- _: 1
195
- }));
196
- }
197
- }), Ce = /* @__PURE__ */ N($e, [["__scopeId", "data-v-e9ba68c4"]]), Ie = { class: "jsgd-w-full jsgd-max-w-sm jsgd-bg-white jsgd-rounded-xl jsgd-shadow-2xl jsgd-overflow-hidden dark:jsgd-bg-slate-800" }, Ae = { class: "jsgd-p-5 jsgd-flex jsgd-flex-col jsgd-gap-4" }, ze = /* @__PURE__ */ Q({
198
- __name: "QuillAltModal",
199
- props: {
200
- show: { type: Boolean },
201
- initialValue: {}
202
- },
203
- emits: ["close", "submit"],
204
- setup(u, { emit: S }) {
205
- const s = u, h = S, l = n("");
206
- I(
207
- () => s.show,
208
- (k) => {
209
- k && (l.value = s.initialValue || "");
210
- }
211
- );
212
- function b() {
213
- h("close");
214
- }
215
- function v() {
216
- h("submit", l.value);
217
- }
218
- return (k, p) => (r(), B(D, {
219
- name: "jsgd-modal-overlay",
220
- appear: ""
221
- }, {
222
- default: E(() => [
223
- u.show ? (r(), j("div", {
224
- key: 0,
225
- class: "jsgd-fixed jsgd-inset-0 jsgd-z-[10001] jsgd-flex jsgd-items-center jsgd-justify-center jsgd-p-4 jsgd-bg-black/60 jsgd-backdrop-blur-sm",
226
- onClick: G(b, ["self"])
227
- }, [
228
- P(D, {
229
- name: "jsgd-modal-container",
230
- appear: ""
231
- }, {
232
- default: E(() => [
233
- e("div", Ie, [
234
- p[3] || (p[3] = e("div", { class: "jsgd-p-5 jsgd-border-b jsgd-border-slate-200 dark:jsgd-border-slate-700" }, [
235
- e("h3", { class: "jsgd-text-lg jsgd-font-bold jsgd-text-slate-900 dark:jsgd-text-slate-100" }, " Edit Image Alt Text ")
236
- ], -1)),
237
- e("div", Ae, [
238
- e("div", null, [
239
- p[1] || (p[1] = e("label", { class: "jsgd-block jsgd-text-sm jsgd-font-medium jsgd-mb-1 dark:jsgd-text-slate-300" }, "Alt Text", -1)),
240
- V(e("input", {
241
- "onUpdate:modelValue": p[0] || (p[0] = (f) => l.value = f),
242
- type: "text",
243
- placeholder: "Describe the image for accessibility",
244
- class: "jsgd-w-full jsgd-py-2 jsgd-px-3 jsgd-rounded-md jsgd-border jsgd-border-slate-300 dark:jsgd-bg-slate-700 dark:jsgd-border-slate-600 dark:jsgd-text-white",
245
- onKeydown: K(v, ["enter"])
246
- }, null, 544), [
247
- [z, l.value]
248
- ]),
249
- p[2] || (p[2] = e("p", { class: "jsgd-text-xs jsgd-text-slate-500 jsgd-mt-2 dark:jsgd-text-slate-400" }, " Good alt text is descriptive and helps screen readers understand the image content. ", -1))
250
- ])
251
- ]),
252
- e("div", { class: "jsgd-p-4 jsgd-bg-slate-50 jsgd-flex jsgd-justify-end jsgd-gap-3 dark:jsgd-bg-slate-900/50" }, [
253
- e("button", {
254
- onClick: b,
255
- class: "jsgd-px-4 jsgd-py-2 jsgd-rounded-md jsgd-text-sm jsgd-font-medium jsgd-bg-white jsgd-border jsgd-border-slate-300 hover:jsgd-bg-slate-50 dark:jsgd-bg-slate-700 dark:jsgd-text-slate-200 dark:jsgd-border-slate-600 dark:hover:jsgd-bg-slate-600"
256
- }, " Cancel "),
257
- e("button", {
258
- onClick: v,
259
- class: "jsgd-px-4 jsgd-py-2 jsgd-rounded-md jsgd-text-sm jsgd-font-medium jsgd-text-white jsgd-bg-blue-600 hover:jsgd-bg-blue-700 dark:jsgd-bg-blue-500 dark:hover:jsgd-bg-blue-600"
260
- }, " Save ")
261
- ])
262
- ])
263
- ]),
264
- _: 1
265
- })
266
- ])) : x("", !0)
267
- ]),
268
- _: 1
269
- }));
270
- }
271
- }), Ee = /* @__PURE__ */ N(ze, [["__scopeId", "data-v-4b0d2e4a"]]), Re = { class: "editor-header" }, _e = ["for"], Be = ["id"], De = { class: "ql-formats" }, Pe = {
272
- key: 0,
273
- viewBox: "0 0 18 18",
274
- width: "18",
275
- height: "18"
276
- }, Fe = {
277
- key: 1,
278
- viewBox: "0 0 18 18",
279
- width: "18",
280
- height: "18"
281
- }, He = { class: "editor-relative-container" }, Qe = {
282
- key: 0,
283
- class: "upload-overlay"
284
- }, Ne = ["id"], Oe = {
285
- key: 1,
286
- class: "error-message"
287
- }, Ge = /* @__PURE__ */ Q({
288
- __name: "TextAreaQuill",
289
- props: {
290
- id: { default: () => ge() },
291
- label: {},
292
- placeholder: {},
293
- modelValue: {},
294
- error: {},
295
- disabled: { type: Boolean },
296
- lang: {},
297
- validate: {},
298
- apiUploadImage: {},
299
- apiUploadVideo: {}
300
- },
301
- emits: ["update:modelValue", "push:error", "remove:error"],
302
- setup(u, { emit: S }) {
303
- const s = u, h = S;
304
- let l = null;
305
- const b = n(!1), v = n([]), k = n(!1), p = n(""), f = n(!1), g = n("link"), w = n(""), R = n("");
306
- let c = null;
307
- const U = n(!1), T = n(null), $ = n(""), m = n(!1), d = n(""), i = le("TableComponents", {
308
- labels: n(je[s.lang ?? "en"])
309
- }), L = M(
310
- () => s.placeholder ?? i.labels.value.placeholder?.quillEditor ?? "Write content here..."
311
- ), O = M(() => {
312
- const a = [];
313
- return s.validate?.minLength && a.push(_("textMinLength", { min: String(s.validate.minLength) }, s.lang)), s.validate?.maxLength && a.push(_("textMaxLength", { max: String(s.validate.maxLength) }, s.lang)), a.join(", ");
314
- }), W = () => {
315
- b.value = !b.value;
316
- };
317
- I(b, (a) => {
318
- document.body.style.overflow = a ? "hidden" : "";
319
- });
320
- const Y = () => {
321
- m.value = !m.value, m.value ? d.value = l?.root.innerHTML ?? s.modelValue ?? "" : l && (l.root.innerHTML = H.sanitize(d.value));
322
- };
323
- I(
324
- () => ({
325
- val: s.modelValue,
326
- disabled: s.disabled,
327
- validate: s.validate
328
- }),
329
- ({ val: a, disabled: t, validate: o }) => {
330
- if (t) {
331
- v.value = [], h("remove:error", s.id);
332
- return;
333
- }
334
- const y = String(a ?? "").replace(/<[^>]*>?/gm, "").trim(), q = [];
335
- o && (o.minLength && y.length < o.minLength && y.length !== 0 && q.push(
336
- _("textMinLength", { min: String(o.minLength) }, s.lang ?? "en")
337
- ), o.maxLength && y.length > o.maxLength && q.push(
338
- _("textMaxLength", { max: String(o.maxLength) }, s.lang ?? "en")
339
- )), v.value = q, q.length ? h("push:error", q, s.id) : h("remove:error", s.id);
340
- },
341
- { deep: !0, immediate: !0 }
342
- );
343
- const J = M(() => {
344
- if (g.value === "image") return s.apiUploadImage;
345
- if (g.value === "video") return s.apiUploadVideo;
346
- }), X = () => {
347
- g.value = "image", w.value = "", f.value = !0;
348
- }, Z = () => {
349
- g.value = "video", w.value = "", f.value = !0;
350
- }, ee = (a) => {
351
- c = l?.getSelection(), c || (c = { index: l?.getSelection(!0)?.index || 0, length: 0 });
352
- const t = l?.getText(c.index, c.length) || "";
353
- R.value = t, w.value = typeof a == "string" ? a : "", g.value = "link", f.value = !0;
354
- }, te = (a) => {
355
- if (l) {
356
- if (f.value = !1, g.value === "link") {
357
- if (!c) return;
358
- const t = a.text || a.url;
359
- l.setSelection(c.index, c.length, "silent"), c.length > 0 && l.deleteText(c.index, c.length, "user"), l.insertText(c.index, t, "link", a.url, "user"), l.setSelection(c.index + t.length, 0, "user");
360
- } else if (g.value === "image") {
361
- const t = l.getSelection(!0), o = a.alt?.replace(/"/g, "&quot;") || "", y = `<img src="${a.url}" alt="${o}" />`;
362
- l.clipboard.dangerouslyPasteHTML(t.index, y, "user"), l.setSelection(t.index + 1, 0);
363
- } else if (g.value === "video") {
364
- const t = l.getSelection(!0);
365
- l.insertEmbed(t.index, "video", a.url, "user"), l.setSelection(t.index + 1, 0);
366
- }
367
- c = null;
368
- }
369
- }, se = (a) => {
370
- T.value && T.value.setAttribute("alt", a), U.value = !1, T.value = null;
371
- };
372
- return de(async () => {
373
- if (typeof window > "u") return;
374
- const a = document.getElementById(`editor-container-${s.id}`);
375
- if (!a) return;
376
- const { default: t } = await import("quill");
377
- try {
378
- const { default: o } = await import("quill-resize-module");
379
- t.imports["modules/resize"] || t.register("modules/resize", o);
380
- } catch (o) {
381
- console.warn("Resize module error", o);
382
- }
383
- l = new t(a, {
384
- theme: "snow",
385
- readOnly: s.disabled ?? !1,
386
- placeholder: L.value,
387
- modules: {
388
- toolbar: {
389
- container: `#toolbar-container-${s.id}`,
390
- handlers: { image: X, video: Z, link: ee }
391
- },
392
- resize: {
393
- locale: {},
394
- embedTags: ["IMG", "VIDEO", "IFRAME"],
395
- tools: [
396
- "left",
397
- "center",
398
- "right",
399
- "full",
400
- {
401
- text: "Alt",
402
- attrs: { title: "Set image alt", class: "btn-alt" },
403
- verify: (o) => o && o.tagName === "IMG",
404
- handler: (o, y, q) => {
405
- T.value = q, $.value = q.getAttribute("alt") || "", U.value = !0;
406
- }
407
- }
408
- ]
409
- }
410
- }
411
- }), l.root.setAttribute("spellcheck", "true"), l.root.setAttribute("lang", s.lang === "id" ? "id" : "en"), s.modelValue && (l.root.innerHTML = H.sanitize(s.modelValue)), l.on("text-change", () => {
412
- const o = l.root.innerHTML;
413
- h("update:modelValue", H.sanitize(o), s.id);
414
- });
415
- }), I(
416
- () => s.disabled,
417
- (a) => l?.enable(!a)
418
- ), ae(() => {
419
- document.body.style.overflow = "";
420
- }), (a, t) => (r(), B(oe, {
421
- to: "body",
422
- disabled: !b.value
423
- }, [
424
- e("div", {
425
- class: A(["rich-text-editor-wrapper", { "editor-maximized": b.value }])
426
- }, [
427
- e("div", Re, [
428
- e("label", {
429
- for: u.id,
430
- class: A(["jsgd-inline-flex jsgd-items-center jsgd-gap-2 jsgd-text-sm jsgd-font-medium jsgd-mb-2 jsgd-text-slate-900 jsgd-transition-colors jsgd-duration-200 dark:jsgd-text-slate-100", { "jsgd-text-red-500 dark:jsgd-text-red-400": v.value }])
431
- }, [
432
- F(C(u.label) + " ", 1),
433
- O.value ? (r(), B(ne(ce), {
434
- key: 0,
435
- text: O.value,
436
- as: "strong"
437
- }, {
438
- default: E(() => [...t[3] || (t[3] = [
439
- F(" ❓", -1)
440
- ])]),
441
- _: 1
442
- }, 8, ["text"])) : x("", !0)
443
- ], 10, _e)
444
- ]),
445
- e("div", {
446
- id: `toolbar-container-${u.id}`,
447
- class: "quill-toolbar"
448
- }, [
449
- t[7] || (t[7] = e("span", { class: "ql-formats" }, [
450
- e("select", { class: "ql-font" }),
451
- e("select", { class: "ql-size" })
452
- ], -1)),
453
- t[8] || (t[8] = e("span", { class: "ql-formats" }, [
454
- e("button", { class: "ql-bold" }),
455
- e("button", { class: "ql-italic" }),
456
- e("button", { class: "ql-underline" }),
457
- e("button", { class: "ql-strike" })
458
- ], -1)),
459
- t[9] || (t[9] = e("span", { class: "ql-formats" }, [
460
- e("select", { class: "ql-color" }),
461
- e("select", { class: "ql-background" })
462
- ], -1)),
463
- t[10] || (t[10] = e("span", { class: "ql-formats" }, [
464
- e("button", {
465
- class: "ql-header",
466
- value: "1"
467
- }),
468
- e("button", {
469
- class: "ql-header",
470
- value: "2"
471
- }),
472
- e("button", { class: "ql-blockquote" }),
473
- e("button", { class: "ql-code-block" })
474
- ], -1)),
475
- t[11] || (t[11] = e("span", { class: "ql-formats" }, [
476
- e("button", {
477
- class: "ql-list",
478
- value: "ordered"
479
- }),
480
- e("button", {
481
- class: "ql-list",
482
- value: "bullet"
483
- }),
484
- e("button", {
485
- class: "ql-indent",
486
- value: "-1"
487
- }),
488
- e("button", {
489
- class: "ql-indent",
490
- value: "+1"
491
- })
492
- ], -1)),
493
- t[12] || (t[12] = e("span", { class: "ql-formats" }, [
494
- e("button", {
495
- class: "ql-direction",
496
- value: "rtl"
497
- }),
498
- e("select", { class: "ql-align" })
499
- ], -1)),
500
- t[13] || (t[13] = e("span", { class: "ql-formats" }, [
501
- e("button", { class: "ql-link" }),
502
- e("button", { class: "ql-image" }),
503
- F(),
504
- e("button", { class: "ql-video" })
505
- ], -1)),
506
- e("span", De, [
507
- e("button", {
508
- onClick: W,
509
- class: "maximize-button",
510
- type: "button"
511
- }, [
512
- b.value ? (r(), j("svg", Fe, [...t[5] || (t[5] = [
513
- e("rect", {
514
- class: "ql-stroke",
515
- x: "5",
516
- y: "5",
517
- width: "8",
518
- height: "8"
519
- }, null, -1),
520
- e("polyline", {
521
- class: "ql-stroke",
522
- points: "15 3 10 8"
523
- }, null, -1),
524
- e("polyline", {
525
- class: "ql-stroke",
526
- points: "3 15 8 10"
527
- }, null, -1)
528
- ])])) : (r(), j("svg", Pe, [...t[4] || (t[4] = [
529
- e("rect", {
530
- class: "ql-stroke",
531
- x: "3",
532
- y: "3",
533
- width: "12",
534
- height: "12"
535
- }, null, -1),
536
- e("rect", {
537
- class: "ql-stroke",
538
- x: "10",
539
- y: "10",
540
- width: "1",
541
- height: "1"
542
- }, null, -1),
543
- e("rect", {
544
- class: "ql-stroke",
545
- x: "7",
546
- y: "10",
547
- width: "1",
548
- height: "1"
549
- }, null, -1),
550
- e("rect", {
551
- class: "ql-stroke",
552
- x: "10",
553
- y: "7",
554
- width: "1",
555
- height: "1"
556
- }, null, -1),
557
- e("rect", {
558
- class: "ql-stroke",
559
- x: "7",
560
- y: "7",
561
- width: "1",
562
- height: "1"
563
- }, null, -1)
564
- ])]))
565
- ]),
566
- e("button", {
567
- onClick: Y,
568
- class: "code-view-button",
569
- type: "button",
570
- title: "Source"
571
- }, [...t[6] || (t[6] = [
572
- e("svg", {
573
- viewBox: "0 0 18 18",
574
- width: "18",
575
- height: "18"
576
- }, [
577
- e("polyline", {
578
- class: "ql-stroke",
579
- points: "5 3 2 9 5 15"
580
- }),
581
- e("polyline", {
582
- class: "ql-stroke",
583
- points: "13 3 16 9 13 15"
584
- })
585
- ], -1)
586
- ])])
587
- ])
588
- ], 8, Be),
589
- e("div", He, [
590
- k.value ? (r(), j("div", Qe, [
591
- t[14] || (t[14] = e("div", { class: "spinner" }, null, -1)),
592
- e("p", null, "Uploading " + C(p.value) + "...", 1)
593
- ])) : x("", !0),
594
- V(e("div", null, [
595
- e("div", {
596
- id: `editor-container-${u.id}`,
597
- class: A(["quill-editor-container", { "has-error": u.error }])
598
- }, null, 10, Ne)
599
- ], 512), [
600
- [re, !m.value]
601
- ]),
602
- m.value ? V((r(), j("textarea", {
603
- key: 1,
604
- "onUpdate:modelValue": t[0] || (t[0] = (o) => d.value = o),
605
- class: "code-view-editor",
606
- spellcheck: "false"
607
- }, null, 512)), [
608
- [z, d.value]
609
- ]) : x("", !0)
610
- ]),
611
- v.value.length !== 0 ? (r(!0), j(ie, { key: 0 }, ue(v.value, (o, y) => (r(), j("p", {
612
- key: y,
613
- class: "error-message"
614
- }, C(o), 1))), 128)) : x("", !0),
615
- typeof s.error == "string" && v.value.length === 0 ? (r(), j("p", Oe, C(u.error), 1)) : x("", !0),
616
- P(Ce, {
617
- show: f.value,
618
- mode: g.value,
619
- "upload-url": J.value,
620
- "initial-value": w.value,
621
- "initial-text": R.value,
622
- onClose: t[1] || (t[1] = (o) => f.value = !1),
623
- onSubmit: te
624
- }, null, 8, ["show", "mode", "upload-url", "initial-value", "initial-text"]),
625
- P(Ee, {
626
- show: U.value,
627
- "initial-value": $.value,
628
- onClose: t[2] || (t[2] = (o) => U.value = !1),
629
- onSubmit: se
630
- }, null, 8, ["show", "initial-value"])
631
- ], 2)
632
- ], 8, ["disabled"]));
633
- }
634
- }), Ze = /* @__PURE__ */ N(Ge, [["__scopeId", "data-v-c98af8b6"]]);
635
- export {
636
- Ze as default
637
- };