@qualityunit/liveagent-components-editor 0.0.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.
@@ -0,0 +1 @@
1
+ "use strict";const t=require("./ckeditor5-EBIBA6Vx.cjs");function k(l){return l?.length!==void 0?l:Array.from(l)}function v(l,e,o){const n=l.slice();return n[4]=e[o],n}function E(l){let e,o=l[4].text+"",n,i,r,s,f;return{c(){e=t.element("button"),n=t.text(o),t.attr(e,"class",i=l[4].style),t.attr(e,"title",r=l[4].text)},m(c,a){t.insert(c,e,a),t.append(e,n),s||(f=t.listen(e,"click",function(){t.is_function(l[4].handler)&&l[4].handler.apply(this,arguments)}),s=!0)},p(c,a){l=c,a&1&&o!==(o=l[4].text+"")&&t.set_data(n,o),a&1&&i!==(i=l[4].style)&&t.attr(e,"class",i),a&1&&r!==(r=l[4].text)&&t.attr(e,"title",r)},d(c){c&&t.detach(e),s=!1,f()}}}function C(l){let e,o,n,i,r,s,f,c=k(l[0]),a=[];for(let u=0;u<c.length;u+=1)a[u]=E(v(l,c,u));return{c(){e=t.element("div"),o=t.element("button"),o.textContent="HTML",n=t.space(),i=t.element("button"),i.textContent="Plain",r=t.space();for(let u=0;u<a.length;u+=1)a[u].c();t.attr(o,"class","HTMLEditor"),t.attr(i,"class","PlainEditor")},m(u,d){t.insert(u,e,d),t.append(e,o),t.append(e,n),t.append(e,i),t.append(e,r);for(let _=0;_<a.length;_+=1)a[_]&&a[_].m(e,null);s||(f=[t.listen(o,"click",l[1]),t.listen(i,"click",l[2])],s=!0)},p(u,[d]){if(d&1){c=k(u[0]);let _;for(_=0;_<c.length;_+=1){const b=v(u,c,_);a[_]?a[_].p(b,d):(a[_]=E(b),a[_].c(),a[_].m(e,null))}for(;_<a.length;_+=1)a[_].d(1);a.length=c.length}},i:t.noop,o:t.noop,d(u){u&&t.detach(e),t.destroy_each(a,u),s=!1,t.run_all(f)}}}function y(l,e,o){const n=t.createEventDispatcher();let{buttons:i=[]}=e;function r(){n("html",{})}function s(){n("plain",{})}return l.$$set=f=>{"buttons"in f&&o(0,i=f.buttons)},[i,r,s]}class $ extends t.SvelteComponent{constructor(e){super(),t.init(this,e,y,C,t.safe_not_equal,{buttons:0})}get buttons(){return this.$$.ctx[0]}set buttons(e){this.$$set({buttons:e}),t.flush()}}t.create_custom_element($,{buttons:{}},[],[],!0);function w(l){let e,o,n;return{c(){e=t.element("textarea")},m(i,r){t.insert(i,e,r),t.set_input_value(e,l[0]),o||(n=t.listen(e,"input",l[6]),o=!0)},p(i,r){r&1&&t.set_input_value(e,i[0])},i:t.noop,o:t.noop,d(i){i&&t.detach(e),o=!1,n()}}}function H(l){let e,o,n;function i(s){l[5](s)}let r={};return l[0]!==void 0&&(r.value=l[0]),e=new t.CKEditor5Classic_1({props:r}),t.binding_callbacks.push(()=>t.bind(e,"value",i)),{c(){t.create_component(e.$$.fragment)},m(s,f){t.mount_component(e,s,f),n=!0},p(s,f){const c={};!o&&f&1&&(o=!0,c.value=s[0],t.add_flush_callback(()=>o=!1)),e.$set(c)},i(s){n||(t.transition_in(e.$$.fragment,s),n=!0)},o(s){t.transition_out(e.$$.fragment,s),n=!1},d(s){t.destroy_component(e,s)}}}function P(l){let e,o,n,i,r,s,f,c;const a=[H,w],u=[];function d(h,m){return h[2]?0:1}n=d(l),i=u[n]=a[n](l);function _(h){l[7](h)}let b={};return l[1]!==void 0&&(b.buttons=l[1]),s=new $({props:b}),t.binding_callbacks.push(()=>t.bind(s,"buttons",_)),s.$on("html",l[3]),s.$on("plain",l[4]),{c(){e=t.element("main"),o=t.element("div"),i.c(),r=t.space(),t.create_component(s.$$.fragment),t.attr(o,"class","Editor")},m(h,m){t.insert(h,e,m),t.append(e,o),u[n].m(o,null),t.append(e,r),t.mount_component(s,e,null),c=!0},p(h,[m]){let p=n;n=d(h),n===p?u[n].p(h,m):(t.group_outros(),t.transition_out(u[p],1,1,()=>{u[p]=null}),t.check_outros(),i=u[n],i?i.p(h,m):(i=u[n]=a[n](h),i.c()),t.transition_in(i,1),i.m(o,null));const g={};!f&&m&2&&(f=!0,g.buttons=h[1],t.add_flush_callback(()=>f=!1)),s.$set(g)},i(h){c||(t.transition_in(i),t.transition_in(s.$$.fragment,h),c=!0)},o(h){t.transition_out(i),t.transition_out(s.$$.fragment,h),c=!1},d(h){h&&t.detach(e),u[n].d(),t.destroy_component(s)}}}function q(l,e,o){let{value:n=""}=e,{buttons:i=[]}=e,{html:r=!0}=e;function s(){r||o(2,r=!0)}function f(){r&&(o(0,n=n.replace(/<[^>]*>?/gm,"")),o(2,r=!1))}function c(d){n=d,o(0,n)}function a(){n=this.value,o(0,n)}function u(d){i=d,o(1,i)}return l.$$set=d=>{"value"in d&&o(0,n=d.value),"buttons"in d&&o(1,i=d.buttons),"html"in d&&o(2,r=d.html)},[n,i,r,s,f,c,a,u]}class S extends t.SvelteComponent{constructor(e){super(),t.init(this,e,q,P,t.safe_not_equal,{value:0,buttons:1,html:2})}get value(){return this.$$.ctx[0]}set value(e){this.$$set({value:e}),t.flush()}get buttons(){return this.$$.ctx[1]}set buttons(e){this.$$set({buttons:e}),t.flush()}get html(){return this.$$.ctx[2]}set html(e){this.$$set({html:e}),t.flush()}}customElements.define("switchable-editor",t.create_custom_element(S,{value:{},buttons:{},html:{type:"Boolean"}},[],[],!1));
@@ -0,0 +1,298 @@
1
+ import { c as L, S as M, i as T, f as k, s as j, e as d, a as P, b as h, d as w, g as m, l as C, n as $, h as y, j as O, r as Q, k as R, t as U, m as V, o as W, p as z, q as K, u as F, v as G, w as v, x as X, y as E, z as I, A as J, B as Y, C as S, D as Z } from "./ckeditor5-DMTIEzP4.js";
2
+ function q(n) {
3
+ return n?.length !== void 0 ? n : Array.from(n);
4
+ }
5
+ function A(n, t, s) {
6
+ const e = n.slice();
7
+ return e[4] = t[s], e;
8
+ }
9
+ function D(n) {
10
+ let t, s = (
11
+ /*button*/
12
+ n[4].text + ""
13
+ ), e, l, i, u, f;
14
+ return {
15
+ c() {
16
+ t = d("button"), e = U(s), h(t, "class", l = /*button*/
17
+ n[4].style), h(t, "title", i = /*button*/
18
+ n[4].text);
19
+ },
20
+ m(r, a) {
21
+ w(r, t, a), m(t, e), u || (f = C(t, "click", function() {
22
+ V(
23
+ /*button*/
24
+ n[4].handler
25
+ ) && n[4].handler.apply(this, arguments);
26
+ }), u = !0);
27
+ },
28
+ p(r, a) {
29
+ n = r, a & /*buttons*/
30
+ 1 && s !== (s = /*button*/
31
+ n[4].text + "") && W(e, s), a & /*buttons*/
32
+ 1 && l !== (l = /*button*/
33
+ n[4].style) && h(t, "class", l), a & /*buttons*/
34
+ 1 && i !== (i = /*button*/
35
+ n[4].text) && h(t, "title", i);
36
+ },
37
+ d(r) {
38
+ r && y(t), u = !1, f();
39
+ }
40
+ };
41
+ }
42
+ function x(n) {
43
+ let t, s, e, l, i, u, f, r = q(
44
+ /*buttons*/
45
+ n[0]
46
+ ), a = [];
47
+ for (let o = 0; o < r.length; o += 1)
48
+ a[o] = D(A(n, r, o));
49
+ return {
50
+ c() {
51
+ t = d("div"), s = d("button"), s.textContent = "HTML", e = P(), l = d("button"), l.textContent = "Plain", i = P();
52
+ for (let o = 0; o < a.length; o += 1)
53
+ a[o].c();
54
+ h(s, "class", "HTMLEditor"), h(l, "class", "PlainEditor");
55
+ },
56
+ m(o, _) {
57
+ w(o, t, _), m(t, s), m(t, e), m(t, l), m(t, i);
58
+ for (let c = 0; c < a.length; c += 1)
59
+ a[c] && a[c].m(t, null);
60
+ u || (f = [
61
+ C(
62
+ s,
63
+ "click",
64
+ /*onHtml*/
65
+ n[1]
66
+ ),
67
+ C(
68
+ l,
69
+ "click",
70
+ /*onPlain*/
71
+ n[2]
72
+ )
73
+ ], u = !0);
74
+ },
75
+ p(o, [_]) {
76
+ if (_ & /*buttons*/
77
+ 1) {
78
+ r = q(
79
+ /*buttons*/
80
+ o[0]
81
+ );
82
+ let c;
83
+ for (c = 0; c < r.length; c += 1) {
84
+ const g = A(o, r, c);
85
+ a[c] ? a[c].p(g, _) : (a[c] = D(g), a[c].c(), a[c].m(t, null));
86
+ }
87
+ for (; c < a.length; c += 1)
88
+ a[c].d(1);
89
+ a.length = r.length;
90
+ }
91
+ },
92
+ i: $,
93
+ o: $,
94
+ d(o) {
95
+ o && y(t), O(a, o), u = !1, Q(f);
96
+ }
97
+ };
98
+ }
99
+ function tt(n, t, s) {
100
+ const e = R();
101
+ let { buttons: l = [] } = t;
102
+ function i() {
103
+ e("html", {});
104
+ }
105
+ function u() {
106
+ e("plain", {});
107
+ }
108
+ return n.$$set = (f) => {
109
+ "buttons" in f && s(0, l = f.buttons);
110
+ }, [l, i, u];
111
+ }
112
+ class N extends M {
113
+ constructor(t) {
114
+ super(), T(this, t, tt, x, j, { buttons: 0 });
115
+ }
116
+ get buttons() {
117
+ return this.$$.ctx[0];
118
+ }
119
+ set buttons(t) {
120
+ this.$$set({ buttons: t }), k();
121
+ }
122
+ }
123
+ L(N, { buttons: {} }, [], [], !0);
124
+ function et(n) {
125
+ let t, s, e;
126
+ return {
127
+ c() {
128
+ t = d("textarea");
129
+ },
130
+ m(l, i) {
131
+ w(l, t, i), S(
132
+ t,
133
+ /*value*/
134
+ n[0]
135
+ ), s || (e = C(
136
+ t,
137
+ "input",
138
+ /*textarea_input_handler*/
139
+ n[6]
140
+ ), s = !0);
141
+ },
142
+ p(l, i) {
143
+ i & /*value*/
144
+ 1 && S(
145
+ t,
146
+ /*value*/
147
+ l[0]
148
+ );
149
+ },
150
+ i: $,
151
+ o: $,
152
+ d(l) {
153
+ l && y(t), s = !1, e();
154
+ }
155
+ };
156
+ }
157
+ function nt(n) {
158
+ let t, s, e;
159
+ function l(u) {
160
+ n[5](u);
161
+ }
162
+ let i = {};
163
+ return (
164
+ /*value*/
165
+ n[0] !== void 0 && (i.value = /*value*/
166
+ n[0]), t = new Z({ props: i }), z.push(() => K(t, "value", l)), {
167
+ c() {
168
+ F(t.$$.fragment);
169
+ },
170
+ m(u, f) {
171
+ G(t, u, f), e = !0;
172
+ },
173
+ p(u, f) {
174
+ const r = {};
175
+ !s && f & /*value*/
176
+ 1 && (s = !0, r.value = /*value*/
177
+ u[0], I(() => s = !1)), t.$set(r);
178
+ },
179
+ i(u) {
180
+ e || (E(t.$$.fragment, u), e = !0);
181
+ },
182
+ o(u) {
183
+ v(t.$$.fragment, u), e = !1;
184
+ },
185
+ d(u) {
186
+ J(t, u);
187
+ }
188
+ }
189
+ );
190
+ }
191
+ function st(n) {
192
+ let t, s, e, l, i, u, f, r;
193
+ const a = [nt, et], o = [];
194
+ function _(b, p) {
195
+ return (
196
+ /*html*/
197
+ b[2] ? 0 : 1
198
+ );
199
+ }
200
+ e = _(n), l = o[e] = a[e](n);
201
+ function c(b) {
202
+ n[7](b);
203
+ }
204
+ let g = {};
205
+ return (
206
+ /*buttons*/
207
+ n[1] !== void 0 && (g.buttons = /*buttons*/
208
+ n[1]), u = new N({ props: g }), z.push(() => K(u, "buttons", c)), u.$on(
209
+ "html",
210
+ /*handleHtml*/
211
+ n[3]
212
+ ), u.$on(
213
+ "plain",
214
+ /*handlePlain*/
215
+ n[4]
216
+ ), {
217
+ c() {
218
+ t = d("main"), s = d("div"), l.c(), i = P(), F(u.$$.fragment), h(s, "class", "Editor");
219
+ },
220
+ m(b, p) {
221
+ w(b, t, p), m(t, s), o[e].m(s, null), m(t, i), G(u, t, null), r = !0;
222
+ },
223
+ p(b, [p]) {
224
+ let H = e;
225
+ e = _(b), e === H ? o[e].p(b, p) : (Y(), v(o[H], 1, 1, () => {
226
+ o[H] = null;
227
+ }), X(), l = o[e], l ? l.p(b, p) : (l = o[e] = a[e](b), l.c()), E(l, 1), l.m(s, null));
228
+ const B = {};
229
+ !f && p & /*buttons*/
230
+ 2 && (f = !0, B.buttons = /*buttons*/
231
+ b[1], I(() => f = !1)), u.$set(B);
232
+ },
233
+ i(b) {
234
+ r || (E(l), E(u.$$.fragment, b), r = !0);
235
+ },
236
+ o(b) {
237
+ v(l), v(u.$$.fragment, b), r = !1;
238
+ },
239
+ d(b) {
240
+ b && y(t), o[e].d(), J(u);
241
+ }
242
+ }
243
+ );
244
+ }
245
+ function lt(n, t, s) {
246
+ let { value: e = "" } = t, { buttons: l = [] } = t, { html: i = !0 } = t;
247
+ function u() {
248
+ i || s(2, i = !0);
249
+ }
250
+ function f() {
251
+ i && (s(0, e = e.replace(/<[^>]*>?/gm, "")), s(2, i = !1));
252
+ }
253
+ function r(_) {
254
+ e = _, s(0, e);
255
+ }
256
+ function a() {
257
+ e = this.value, s(0, e);
258
+ }
259
+ function o(_) {
260
+ l = _, s(1, l);
261
+ }
262
+ return n.$$set = (_) => {
263
+ "value" in _ && s(0, e = _.value), "buttons" in _ && s(1, l = _.buttons), "html" in _ && s(2, i = _.html);
264
+ }, [
265
+ e,
266
+ l,
267
+ i,
268
+ u,
269
+ f,
270
+ r,
271
+ a,
272
+ o
273
+ ];
274
+ }
275
+ class ut extends M {
276
+ constructor(t) {
277
+ super(), T(this, t, lt, st, j, { value: 0, buttons: 1, html: 2 });
278
+ }
279
+ get value() {
280
+ return this.$$.ctx[0];
281
+ }
282
+ set value(t) {
283
+ this.$$set({ value: t }), k();
284
+ }
285
+ get buttons() {
286
+ return this.$$.ctx[1];
287
+ }
288
+ set buttons(t) {
289
+ this.$$set({ buttons: t }), k();
290
+ }
291
+ get html() {
292
+ return this.$$.ctx[2];
293
+ }
294
+ set html(t) {
295
+ this.$$set({ html: t }), k();
296
+ }
297
+ }
298
+ customElements.define("switchable-editor", L(ut, { value: {}, buttons: {}, html: { type: "Boolean" } }, [], [], !1));