@nickaux/form-configurator 1.1.240 → 1.1.242

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,532 @@
1
+ var O = function(l, i) {
2
+ if (!(l instanceof i))
3
+ throw new TypeError("Cannot call a class as a function");
4
+ }, R = function() {
5
+ function l(i, e) {
6
+ for (var t = 0; t < e.length; t++) {
7
+ var r = e[t];
8
+ r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(i, r.key, r);
9
+ }
10
+ }
11
+ return function(i, e, t) {
12
+ return e && l(i.prototype, e), t && l(i, t), i;
13
+ };
14
+ }(), y = function() {
15
+ function l(i, e) {
16
+ var t = [], r = !0, n = !1, o = void 0;
17
+ try {
18
+ for (var c = i[Symbol.iterator](), a; !(r = (a = c.next()).done) && (t.push(a.value), !(e && t.length === e)); r = !0)
19
+ ;
20
+ } catch (s) {
21
+ n = !0, o = s;
22
+ } finally {
23
+ try {
24
+ !r && c.return && c.return();
25
+ } finally {
26
+ if (n)
27
+ throw o;
28
+ }
29
+ }
30
+ return t;
31
+ }
32
+ return function(i, e) {
33
+ if (Array.isArray(i))
34
+ return i;
35
+ if (Symbol.iterator in Object(i))
36
+ return l(i, e);
37
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
38
+ };
39
+ }();
40
+ String.prototype.startsWith = String.prototype.startsWith || function(l) {
41
+ return this.indexOf(l) === 0;
42
+ };
43
+ String.prototype.padStart = String.prototype.padStart || function(l, i) {
44
+ for (var e = this; e.length < l; )
45
+ e = i + e;
46
+ return e;
47
+ };
48
+ var N = { cb: "0f8ff", tqw: "aebd7", q: "-ffff", qmrn: "7fffd4", zr: "0ffff", bg: "5f5dc", bsq: "e4c4", bck: "---", nch: "ebcd", b: "--ff", bvt: "8a2be2", brwn: "a52a2a", brw: "deb887", ctb: "5f9ea0", hrt: "7fff-", chcT: "d2691e", cr: "7f50", rnw: "6495ed", crns: "8dc", crms: "dc143c", cn: "-ffff", Db: "--8b", Dcn: "-8b8b", Dgnr: "b8860b", Dgr: "a9a9a9", Dgrn: "-64-", Dkhk: "bdb76b", Dmgn: "8b-8b", Dvgr: "556b2f", Drng: "8c-", Drch: "9932cc", Dr: "8b--", Dsmn: "e9967a", Dsgr: "8fbc8f", DsTb: "483d8b", DsTg: "2f4f4f", Dtrq: "-ced1", Dvt: "94-d3", ppnk: "1493", pskb: "-bfff", mgr: "696969", grb: "1e90ff", rbrc: "b22222", rwht: "af0", stg: "228b22", chs: "-ff", gnsb: "dcdcdc", st: "8f8ff", g: "d7-", gnr: "daa520", gr: "808080", grn: "-8-0", grnw: "adff2f", hnw: "0fff0", htpn: "69b4", nnr: "cd5c5c", ng: "4b-82", vr: "0", khk: "0e68c", vnr: "e6e6fa", nrb: "0f5", wngr: "7cfc-", mnch: "acd", Lb: "add8e6", Lcr: "08080", Lcn: "e0ffff", Lgnr: "afad2", Lgr: "d3d3d3", Lgrn: "90ee90", Lpnk: "b6c1", Lsmn: "a07a", Lsgr: "20b2aa", Lskb: "87cefa", LsTg: "778899", Lstb: "b0c4de", Lw: "e0", m: "-ff-", mgrn: "32cd32", nn: "af0e6", mgnt: "-ff", mrn: "8--0", mqm: "66cdaa", mmb: "--cd", mmrc: "ba55d3", mmpr: "9370db", msg: "3cb371", mmsT: "7b68ee", "": "-fa9a", mtr: "48d1cc", mmvt: "c71585", mnLb: "191970", ntc: "5fffa", mstr: "e4e1", mccs: "e4b5", vjw: "dead", nv: "--80", c: "df5e6", v: "808-0", vrb: "6b8e23", rng: "a5-", rngr: "45-", rch: "da70d6", pgnr: "eee8aa", pgrn: "98fb98", ptrq: "afeeee", pvtr: "db7093", ppwh: "efd5", pchp: "dab9", pr: "cd853f", pnk: "c0cb", pm: "dda0dd", pwrb: "b0e0e6", prp: "8-080", cc: "663399", r: "--", sbr: "bc8f8f", rb: "4169e1", sbrw: "8b4513", smn: "a8072", nbr: "4a460", sgrn: "2e8b57", ssh: "5ee", snn: "a0522d", svr: "c0c0c0", skb: "87ceeb", sTb: "6a5acd", sTgr: "708090", snw: "afa", n: "-ff7f", stb: "4682b4", tn: "d2b48c", t: "-8080", thst: "d8bfd8", tmT: "6347", trqs: "40e0d0", vt: "ee82ee", whT: "5deb3", wht: "", hts: "5f5f5", w: "-", wgrn: "9acd32" };
49
+ function A(l) {
50
+ var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1, e = i > 0 ? l.toFixed(i).replace(/0+$/, "").replace(/\.$/, "") : l.toString();
51
+ return e || "0";
52
+ }
53
+ var z = function() {
54
+ function l(i, e, t, r) {
55
+ O(this, l);
56
+ var n = this;
57
+ function o(a) {
58
+ if (a.startsWith("hsl")) {
59
+ var s = a.match(/([\-\d\.e]+)/g).map(Number), p = y(s, 4), u = p[0], f = p[1], d = p[2], b = p[3];
60
+ b === void 0 && (b = 1), u /= 360, f /= 100, d /= 100, n.hsla = [u, f, d, b];
61
+ } else if (a.startsWith("rgb")) {
62
+ var m = a.match(/([\-\d\.e]+)/g).map(Number), h = y(m, 4), v = h[0], g = h[1], E = h[2], k = h[3];
63
+ k === void 0 && (k = 1), n.rgba = [v, g, E, k];
64
+ } else
65
+ a.startsWith("#") ? n.rgba = l.hexToRgb(a) : n.rgba = l.nameToRgb(a) || l.hexToRgb(a);
66
+ }
67
+ if (i !== void 0)
68
+ if (Array.isArray(i))
69
+ this.rgba = i;
70
+ else if (t === void 0) {
71
+ var c = i && "" + i;
72
+ c && o(c.toLowerCase());
73
+ } else
74
+ this.rgba = [i, e, t, r === void 0 ? 1 : r];
75
+ }
76
+ return R(l, [{
77
+ key: "printRGB",
78
+ value: function(e) {
79
+ var t = e ? this.rgba : this.rgba.slice(0, 3), r = t.map(function(n, o) {
80
+ return A(n, o === 3 ? 3 : 0);
81
+ });
82
+ return e ? "rgba(" + r + ")" : "rgb(" + r + ")";
83
+ }
84
+ }, {
85
+ key: "printHSL",
86
+ value: function(e) {
87
+ var t = [360, 100, 100, 1], r = ["", "%", "%", ""], n = e ? this.hsla : this.hsla.slice(0, 3), o = n.map(function(c, a) {
88
+ return A(c * t[a], a === 3 ? 3 : 1) + r[a];
89
+ });
90
+ return e ? "hsla(" + o + ")" : "hsl(" + o + ")";
91
+ }
92
+ }, {
93
+ key: "printHex",
94
+ value: function(e) {
95
+ var t = this.hex;
96
+ return e ? t : t.substring(0, 7);
97
+ }
98
+ }, {
99
+ key: "rgba",
100
+ get: function() {
101
+ if (this._rgba)
102
+ return this._rgba;
103
+ if (!this._hsla)
104
+ throw new Error("No color is set");
105
+ return this._rgba = l.hslToRgb(this._hsla);
106
+ },
107
+ set: function(e) {
108
+ e.length === 3 && (e[3] = 1), this._rgba = e, this._hsla = null;
109
+ }
110
+ }, {
111
+ key: "rgbString",
112
+ get: function() {
113
+ return this.printRGB();
114
+ }
115
+ }, {
116
+ key: "rgbaString",
117
+ get: function() {
118
+ return this.printRGB(!0);
119
+ }
120
+ }, {
121
+ key: "hsla",
122
+ get: function() {
123
+ if (this._hsla)
124
+ return this._hsla;
125
+ if (!this._rgba)
126
+ throw new Error("No color is set");
127
+ return this._hsla = l.rgbToHsl(this._rgba);
128
+ },
129
+ set: function(e) {
130
+ e.length === 3 && (e[3] = 1), this._hsla = e, this._rgba = null;
131
+ }
132
+ }, {
133
+ key: "hslString",
134
+ get: function() {
135
+ return this.printHSL();
136
+ }
137
+ }, {
138
+ key: "hslaString",
139
+ get: function() {
140
+ return this.printHSL(!0);
141
+ }
142
+ }, {
143
+ key: "hex",
144
+ get: function() {
145
+ var e = this.rgba, t = e.map(function(r, n) {
146
+ return n < 3 ? r.toString(16) : Math.round(r * 255).toString(16);
147
+ });
148
+ return "#" + t.map(function(r) {
149
+ return r.padStart(2, "0");
150
+ }).join("");
151
+ },
152
+ set: function(e) {
153
+ this.rgba = l.hexToRgb(e);
154
+ }
155
+ }], [{
156
+ key: "hexToRgb",
157
+ value: function(e) {
158
+ var t = (e.startsWith("#") ? e.slice(1) : e).replace(/^(\w{3})$/, "$1F").replace(/^(\w)(\w)(\w)(\w)$/, "$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/, "$1FF");
159
+ if (!t.match(/^([0-9a-fA-F]{8})$/))
160
+ throw new Error("Unknown hex color; " + e);
161
+ var r = t.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map(function(n) {
162
+ return parseInt(n, 16);
163
+ });
164
+ return r[3] = r[3] / 255, r;
165
+ }
166
+ }, {
167
+ key: "nameToRgb",
168
+ value: function(e) {
169
+ var t = e.toLowerCase().replace("at", "T").replace(/[aeiouyldf]/g, "").replace("ght", "L").replace("rk", "D").slice(-5, 4), r = N[t];
170
+ return r === void 0 ? r : l.hexToRgb(r.replace(/\-/g, "00").padStart(6, "f"));
171
+ }
172
+ }, {
173
+ key: "rgbToHsl",
174
+ value: function(e) {
175
+ var t = y(e, 4), r = t[0], n = t[1], o = t[2], c = t[3];
176
+ r /= 255, n /= 255, o /= 255;
177
+ var a = Math.max(r, n, o), s = Math.min(r, n, o), p = void 0, u = void 0, f = (a + s) / 2;
178
+ if (a === s)
179
+ p = u = 0;
180
+ else {
181
+ var d = a - s;
182
+ switch (u = f > 0.5 ? d / (2 - a - s) : d / (a + s), a) {
183
+ case r:
184
+ p = (n - o) / d + (n < o ? 6 : 0);
185
+ break;
186
+ case n:
187
+ p = (o - r) / d + 2;
188
+ break;
189
+ case o:
190
+ p = (r - n) / d + 4;
191
+ break;
192
+ }
193
+ p /= 6;
194
+ }
195
+ return [p, u, f, c];
196
+ }
197
+ }, {
198
+ key: "hslToRgb",
199
+ value: function(e) {
200
+ var t = y(e, 4), r = t[0], n = t[1], o = t[2], c = t[3], a = void 0, s = void 0, p = void 0;
201
+ if (n === 0)
202
+ a = s = p = o;
203
+ else {
204
+ var u = function(h, v, g) {
205
+ return g < 0 && (g += 1), g > 1 && (g -= 1), g < 0.16666666666666666 ? h + (v - h) * 6 * g : g < 0.5 ? v : g < 0.6666666666666666 ? h + (v - h) * (0.6666666666666666 - g) * 6 : h;
206
+ }, f = o < 0.5 ? o * (1 + n) : o + n - o * n, d = 2 * o - f;
207
+ a = u(d, f, r + 1 / 3), s = u(d, f, r), p = u(d, f, r - 1 / 3);
208
+ }
209
+ var b = [a * 255, s * 255, p * 255].map(Math.round);
210
+ return b[3] = c, b;
211
+ }
212
+ }]), l;
213
+ }(), F = function() {
214
+ function l() {
215
+ O(this, l), this._events = [];
216
+ }
217
+ return R(l, [{
218
+ key: "add",
219
+ value: function(e, t, r) {
220
+ e.addEventListener(t, r, !1), this._events.push({
221
+ target: e,
222
+ type: t,
223
+ handler: r
224
+ });
225
+ }
226
+ }, {
227
+ key: "remove",
228
+ value: function(e, t, r) {
229
+ this._events = this._events.filter(function(n) {
230
+ var o = !0;
231
+ return e && e !== n.target && (o = !1), t && t !== n.type && (o = !1), r && r !== n.handler && (o = !1), o && l._doRemove(n.target, n.type, n.handler), !o;
232
+ });
233
+ }
234
+ }, {
235
+ key: "destroy",
236
+ value: function() {
237
+ this._events.forEach(function(e) {
238
+ return l._doRemove(e.target, e.type, e.handler);
239
+ }), this._events = [];
240
+ }
241
+ }], [{
242
+ key: "_doRemove",
243
+ value: function(e, t, r) {
244
+ e.removeEventListener(t, r, !1);
245
+ }
246
+ }]), l;
247
+ }();
248
+ function U(l) {
249
+ var i = document.createElement("div");
250
+ return i.innerHTML = l, i.firstElementChild;
251
+ }
252
+ function L(l, i, e) {
253
+ var t = !1;
254
+ function r(a, s, p) {
255
+ return Math.max(s, Math.min(a, p));
256
+ }
257
+ function n(a, s, p) {
258
+ if (p && (t = !0), !!t) {
259
+ a.preventDefault();
260
+ var u = i.getBoundingClientRect(), f = u.width, d = u.height, b = s.clientX, m = s.clientY, h = r(b - u.left, 0, f), v = r(m - u.top, 0, d);
261
+ e(h / f, v / d);
262
+ }
263
+ }
264
+ function o(a, s) {
265
+ var p = a.buttons === void 0 ? a.which : a.buttons;
266
+ p === 1 ? n(a, a, s) : t = !1;
267
+ }
268
+ function c(a, s) {
269
+ a.touches.length === 1 ? n(a, a.touches[0], s) : t = !1;
270
+ }
271
+ l.add(i, "mousedown", function(a) {
272
+ o(a, !0);
273
+ }), l.add(i, "touchstart", function(a) {
274
+ c(a, !0);
275
+ }), l.add(window, "mousemove", o), l.add(i, "touchmove", c), l.add(window, "mouseup", function(a) {
276
+ t = !1;
277
+ }), l.add(i, "touchend", function(a) {
278
+ t = !1;
279
+ }), l.add(i, "touchcancel", function(a) {
280
+ t = !1;
281
+ });
282
+ }
283
+ var B = `linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,
284
+ linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em`, G = 360, P = "keydown", x = "mousedown", T = "focusin";
285
+ function _(l, i) {
286
+ return (i || document).querySelector(l);
287
+ }
288
+ function M(l) {
289
+ l.preventDefault(), l.stopPropagation();
290
+ }
291
+ function H(l, i, e, t, r) {
292
+ l.add(i, P, function(n) {
293
+ e.indexOf(n.key) >= 0 && (r && M(n), t(n));
294
+ });
295
+ }
296
+ var W = function() {
297
+ function l(i) {
298
+ O(this, l), this.settings = {
299
+ popup: "right",
300
+ layout: "default",
301
+ alpha: !0,
302
+ editor: !0,
303
+ editorFormat: "hex",
304
+ cancelButton: !1,
305
+ defaultColor: "#0cf"
306
+ }, this._events = new F(), this.onChange = null, this.onDone = null, this.onOpen = null, this.onClose = null, this.setOptions(i);
307
+ }
308
+ return R(l, [{
309
+ key: "setOptions",
310
+ value: function(e) {
311
+ var t = this;
312
+ if (!e)
313
+ return;
314
+ var r = this.settings;
315
+ function n(s, p, u) {
316
+ for (var f in s)
317
+ u && u.indexOf(f) >= 0 || (p[f] = s[f]);
318
+ }
319
+ if (e instanceof HTMLElement)
320
+ r.parent = e;
321
+ else {
322
+ r.parent && e.parent && r.parent !== e.parent && (this._events.remove(r.parent), this._popupInited = !1), n(e, r), e.onChange && (this.onChange = e.onChange), e.onDone && (this.onDone = e.onDone), e.onOpen && (this.onOpen = e.onOpen), e.onClose && (this.onClose = e.onClose);
323
+ var o = e.color || e.colour;
324
+ o && this._setColor(o);
325
+ }
326
+ var c = r.parent;
327
+ if (c && r.popup && !this._popupInited) {
328
+ var a = function(p) {
329
+ return t.openHandler(p);
330
+ };
331
+ this._events.add(c, "click", a), H(this._events, c, [" ", "Spacebar", "Enter"], a), this._popupInited = !0;
332
+ } else
333
+ e.parent && !r.popup && this.show();
334
+ }
335
+ }, {
336
+ key: "openHandler",
337
+ value: function(e) {
338
+ if (this.show()) {
339
+ e && e.preventDefault(), this.settings.parent.style.pointerEvents = "none";
340
+ var t = e && e.type === P ? this._domEdit : this.domElement;
341
+ setTimeout(function() {
342
+ return t.focus();
343
+ }, 100), this.onOpen && this.onOpen(this.colour);
344
+ }
345
+ }
346
+ }, {
347
+ key: "closeHandler",
348
+ value: function(e) {
349
+ var t = e && e.type, r = !1;
350
+ if (!e)
351
+ r = !0;
352
+ else if (t === x || t === T) {
353
+ var n = (this.__containedEvent || 0) + 100;
354
+ e.timeStamp > n && (r = !0);
355
+ } else
356
+ M(e), r = !0;
357
+ r && this.hide() && (this.settings.parent.style.pointerEvents = "", t !== x && this.settings.parent.focus(), this.onClose && this.onClose(this.colour));
358
+ }
359
+ }, {
360
+ key: "movePopup",
361
+ value: function(e, t) {
362
+ this.closeHandler(), this.setOptions(e), t && this.openHandler();
363
+ }
364
+ }, {
365
+ key: "setColor",
366
+ value: function(e, t) {
367
+ this._setColor(e, { silent: t });
368
+ }
369
+ }, {
370
+ key: "_setColor",
371
+ value: function(e, t) {
372
+ if (typeof e == "string" && (e = e.trim()), !!e) {
373
+ t = t || {};
374
+ var r = void 0;
375
+ try {
376
+ r = new z(e);
377
+ } catch (o) {
378
+ if (t.failSilently)
379
+ return;
380
+ throw o;
381
+ }
382
+ if (!this.settings.alpha) {
383
+ var n = r.hsla;
384
+ n[3] = 1, r.hsla = n;
385
+ }
386
+ this.colour = this.color = r, this._setHSLA(null, null, null, null, t);
387
+ }
388
+ }
389
+ }, {
390
+ key: "setColour",
391
+ value: function(e, t) {
392
+ this.setColor(e, t);
393
+ }
394
+ }, {
395
+ key: "show",
396
+ value: function() {
397
+ var e = this.settings.parent;
398
+ if (!e)
399
+ return !1;
400
+ if (this.domElement) {
401
+ var t = this._toggleDOM(!0);
402
+ return this._setPosition(), t;
403
+ }
404
+ var r = this.settings.template || '<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>', n = U(r);
405
+ return this.domElement = n, this._domH = _(".picker_hue", n), this._domSL = _(".picker_sl", n), this._domA = _(".picker_alpha", n), this._domEdit = _(".picker_editor input", n), this._domSample = _(".picker_sample", n), this._domOkay = _(".picker_done button", n), this._domCancel = _(".picker_cancel button", n), n.classList.add("layout_" + this.settings.layout), this.settings.alpha || n.classList.add("no_alpha"), this.settings.editor || n.classList.add("no_editor"), this.settings.cancelButton || n.classList.add("no_cancel"), this._ifPopup(function() {
406
+ return n.classList.add("popup");
407
+ }), this._setPosition(), this.colour ? this._updateUI() : this._setColor(this.settings.defaultColor), this._bindEvents(), !0;
408
+ }
409
+ }, {
410
+ key: "hide",
411
+ value: function() {
412
+ return this._toggleDOM(!1);
413
+ }
414
+ }, {
415
+ key: "destroy",
416
+ value: function() {
417
+ this._events.destroy(), this.domElement && this.settings.parent.removeChild(this.domElement);
418
+ }
419
+ }, {
420
+ key: "_bindEvents",
421
+ value: function() {
422
+ var e = this, t = this, r = this.domElement, n = this._events;
423
+ function o(s, p, u) {
424
+ n.add(s, p, u);
425
+ }
426
+ o(r, "click", function(s) {
427
+ return s.preventDefault();
428
+ }), L(n, this._domH, function(s, p) {
429
+ return t._setHSLA(s);
430
+ }), L(n, this._domSL, function(s, p) {
431
+ return t._setHSLA(null, s, 1 - p);
432
+ }), this.settings.alpha && L(n, this._domA, function(s, p) {
433
+ return t._setHSLA(null, null, null, 1 - p);
434
+ });
435
+ var c = this._domEdit;
436
+ o(c, "input", function(s) {
437
+ t._setColor(this.value, { fromEditor: !0, failSilently: !0 });
438
+ }), o(c, "focus", function(s) {
439
+ var p = this;
440
+ p.selectionStart === p.selectionEnd && p.select();
441
+ }), this._ifPopup(function() {
442
+ var s = function(f) {
443
+ return e.closeHandler(f);
444
+ };
445
+ o(window, x, s), o(window, T, s), H(n, r, ["Esc", "Escape"], s);
446
+ var p = function(f) {
447
+ e.__containedEvent = f.timeStamp;
448
+ };
449
+ o(r, x, p), o(r, T, p), o(e._domCancel, "click", s);
450
+ });
451
+ var a = function(p) {
452
+ e._ifPopup(function() {
453
+ return e.closeHandler(p);
454
+ }), e.onDone && e.onDone(e.colour);
455
+ };
456
+ o(this._domOkay, "click", a), H(n, r, ["Enter"], a);
457
+ }
458
+ }, {
459
+ key: "_setPosition",
460
+ value: function() {
461
+ var e = this.settings.parent, t = this.domElement;
462
+ e !== t.parentNode && e.appendChild(t), this._ifPopup(function(r) {
463
+ getComputedStyle(e).position === "static" && (e.style.position = "relative");
464
+ var n = r === !0 ? "popup_right" : "popup_" + r;
465
+ ["popup_top", "popup_bottom", "popup_left", "popup_right"].forEach(function(o) {
466
+ o === n ? t.classList.add(o) : t.classList.remove(o);
467
+ }), t.classList.add(n);
468
+ });
469
+ }
470
+ }, {
471
+ key: "_setHSLA",
472
+ value: function(e, t, r, n, o) {
473
+ o = o || {};
474
+ var c = this.colour, a = c.hsla;
475
+ [e, t, r, n].forEach(function(s, p) {
476
+ (s || s === 0) && (a[p] = s);
477
+ }), c.hsla = a, this._updateUI(o), this.onChange && !o.silent && this.onChange(c);
478
+ }
479
+ }, {
480
+ key: "_updateUI",
481
+ value: function(e) {
482
+ if (!this.domElement)
483
+ return;
484
+ e = e || {};
485
+ var t = this.colour, r = t.hsla, n = "hsl(" + r[0] * G + ", 100%, 50%)", o = t.hslString, c = t.hslaString, a = this._domH, s = this._domSL, p = this._domA, u = _(".picker_selector", a), f = _(".picker_selector", s), d = _(".picker_selector", p);
486
+ function b(I, S, C) {
487
+ S.style.left = C * 100 + "%";
488
+ }
489
+ function m(I, S, C) {
490
+ S.style.top = C * 100 + "%";
491
+ }
492
+ b(a, u, r[0]), this._domSL.style.backgroundColor = this._domH.style.color = n, b(s, f, r[1]), m(s, f, 1 - r[2]), s.style.color = o, m(p, d, 1 - r[3]);
493
+ var h = o, v = h.replace("hsl", "hsla").replace(")", ", 0)"), g = "linear-gradient(" + [h, v] + ")";
494
+ if (this._domA.style.background = g + ", " + B, !e.fromEditor) {
495
+ var E = this.settings.editorFormat, k = this.settings.alpha, w = void 0;
496
+ switch (E) {
497
+ case "rgb":
498
+ w = t.printRGB(k);
499
+ break;
500
+ case "hsl":
501
+ w = t.printHSL(k);
502
+ break;
503
+ default:
504
+ w = t.printHex(k);
505
+ }
506
+ this._domEdit.value = w;
507
+ }
508
+ this._domSample.style.color = c;
509
+ }
510
+ }, {
511
+ key: "_ifPopup",
512
+ value: function(e, t) {
513
+ this.settings.parent && this.settings.popup ? e && e(this.settings.popup) : t && t();
514
+ }
515
+ }, {
516
+ key: "_toggleDOM",
517
+ value: function(e) {
518
+ var t = this.domElement;
519
+ if (!t)
520
+ return !1;
521
+ var r = e ? "" : "none", n = t.style.display !== r;
522
+ return n && (t.style.display = r), n;
523
+ }
524
+ }]), l;
525
+ }();
526
+ {
527
+ var D = document.createElement("style");
528
+ D.textContent = '.picker_wrapper.no_alpha .picker_alpha{display:none}.picker_wrapper.no_editor .picker_editor{position:absolute;z-index:-1;opacity:0}.picker_wrapper.no_cancel .picker_cancel{display:none}.layout_default.picker_wrapper{display:flex;flex-flow:row wrap;justify-content:space-between;align-items:stretch;font-size:10px;width:25em;padding:.5em}.layout_default.picker_wrapper input,.layout_default.picker_wrapper button{font-size:1rem}.layout_default.picker_wrapper>*{margin:.5em}.layout_default.picker_wrapper::before{content:"";display:block;width:100%;height:0;order:1}.layout_default .picker_slider,.layout_default .picker_selector{padding:1em}.layout_default .picker_hue{width:100%}.layout_default .picker_sl{flex:1 1 auto}.layout_default .picker_sl::before{content:"";display:block;padding-bottom:100%}.layout_default .picker_editor{order:1;width:6.5rem}.layout_default .picker_editor input{width:100%;height:100%}.layout_default .picker_sample{order:1;flex:1 1 auto}.layout_default .picker_done,.layout_default .picker_cancel{order:1}.picker_wrapper{box-sizing:border-box;background:#f2f2f2;box-shadow:0 0 0 1px silver;cursor:default;font-family:sans-serif;color:#444;pointer-events:auto}.picker_wrapper:focus{outline:none}.picker_wrapper button,.picker_wrapper input{box-sizing:border-box;border:none;box-shadow:0 0 0 1px silver;outline:none}.picker_wrapper button:focus,.picker_wrapper button:active,.picker_wrapper input:focus,.picker_wrapper input:active{box-shadow:0 0 2px 1px #1e90ff}.picker_wrapper button{padding:.4em .6em;cursor:pointer;background-color:#f5f5f5;background-image:linear-gradient(0deg, gainsboro, transparent)}.picker_wrapper button:active{background-image:linear-gradient(0deg, transparent, gainsboro)}.picker_wrapper button:hover{background-color:#fff}.picker_selector{position:absolute;z-index:1;display:block;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);border:2px solid #fff;border-radius:100%;box-shadow:0 0 3px 1px #67b9ff;background:currentColor;cursor:pointer}.picker_slider .picker_selector{border-radius:2px}.picker_hue{position:relative;background-image:linear-gradient(90deg, red, yellow, lime, cyan, blue, magenta, red);box-shadow:0 0 0 1px silver}.picker_sl{position:relative;box-shadow:0 0 0 1px silver;background-image:linear-gradient(180deg, white, rgba(255, 255, 255, 0) 50%),linear-gradient(0deg, black, rgba(0, 0, 0, 0) 50%),linear-gradient(90deg, #808080, rgba(128, 128, 128, 0))}.picker_alpha,.picker_sample{position:relative;background:linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0/2em 2em,linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em/2em 2em;box-shadow:0 0 0 1px silver}.picker_alpha .picker_selector,.picker_sample .picker_selector{background:none}.picker_editor input{font-family:monospace;padding:.2em .4em}.picker_sample::before{content:"";position:absolute;display:block;width:100%;height:100%;background:currentColor}.picker_arrow{position:absolute;z-index:-1}.picker_wrapper.popup{position:absolute;z-index:2;margin:1.5em}.picker_wrapper.popup,.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{background:#f2f2f2;box-shadow:0 0 10px 1px rgba(0,0,0,.4)}.picker_wrapper.popup .picker_arrow{width:3em;height:3em;margin:0}.picker_wrapper.popup .picker_arrow::before,.picker_wrapper.popup .picker_arrow::after{content:"";display:block;position:absolute;top:0;left:0;z-index:-99}.picker_wrapper.popup .picker_arrow::before{width:100%;height:100%;-webkit-transform:skew(45deg);transform:skew(45deg);-webkit-transform-origin:0 100%;transform-origin:0 100%}.picker_wrapper.popup .picker_arrow::after{width:150%;height:150%;box-shadow:none}.popup.popup_top{bottom:100%;left:0}.popup.popup_top .picker_arrow{bottom:0;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.popup.popup_bottom{top:100%;left:0}.popup.popup_bottom .picker_arrow{top:0;left:0;-webkit-transform:rotate(90deg) scale(1, -1);transform:rotate(90deg) scale(1, -1)}.popup.popup_left{top:0;right:100%}.popup.popup_left .picker_arrow{top:0;right:0;-webkit-transform:scale(-1, 1);transform:scale(-1, 1)}.popup.popup_right{top:0;left:100%}.popup.popup_right .picker_arrow{top:0;left:0}', document.documentElement.firstElementChild.appendChild(D), W.StyleElement = D;
529
+ }
530
+ export {
531
+ W as default
532
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nickaux/form-configurator",
3
- "version": "1.1.240",
3
+ "version": "1.1.242",
4
4
  "description": "A React form manager",
5
5
  "type": "module",
6
6
  "main": "dist/FormConfigurator.cjs.js",
@@ -21,11 +21,11 @@
21
21
  "docs": "vite --port 3000 --config vite.docs.config.js",
22
22
  "start": "vite",
23
23
  "build": "vite build",
24
- "watch-build": "chokidar \"src/**/*.{js,jsx,ts,tsx,css}\" -c \"npm run build\"",
24
+ "watch-build": "chokidar \"src/**/*.{js,jsx,ts,tsx,css}\" -c \"pnpm run build\"",
25
25
  "preview": "vite preview",
26
- "update-browserslist": "npx browserslist@latest --update-db",
27
- "build:publish": "npm run update-browserslist && git add . && git commit -m 'publish_npm' && npm version patch && npm publish",
28
- "watch": "chokidar \"src/**/*.{js,jsx,ts,tsx,scss}\" -c \"npm run build\"",
26
+ "update-browserslist": "pnpm exec browserslist@latest --update-db",
27
+ "build:publish": "pnpm run update-browserslist && git add . && git commit -m 'publish_npm' && pnpm version patch && pnpm publish",
28
+ "watch": "chokidar \"src/**/*.{js,jsx,ts,tsx,scss}\" -c \"pnpm run build\"",
29
29
  "test": "npx playwright test",
30
30
  "test:headed": "npx playwright test --headed",
31
31
  "test:debug": "npx playwright test --debug",
@@ -33,7 +33,7 @@
33
33
  "test:trace": "npx playwright test --trace on",
34
34
  "test:report": "npx playwright show-report test-results/html-report",
35
35
  "test:clean": "node scripts/clean-tests.js",
36
- "test:full": "npm run test:clean && npm run test && npm run test:report"
36
+ "test:full": "pnpm run test:clean && pnpm run test && pnpm run test:report"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "react": "^18.2.0",
@@ -89,14 +89,12 @@
89
89
  "vite": "^4.4.9",
90
90
  "vite-plugin-lib-inject-css": "^2.1.1"
91
91
  },
92
- "overrides": {
93
- "react-json-view": {
94
- "react": "$react",
95
- "react-dom": "$react-dom"
96
- },
97
- "react-paginate": {
98
- "react": "$react",
99
- "react-dom": "$react-dom"
92
+ "pnpm": {
93
+ "overrides": {
94
+ "react-json-view>react": "$react",
95
+ "react-json-view>react-dom": "$react-dom",
96
+ "react-paginate>react": "$react",
97
+ "react-paginate>react-dom": "$react-dom"
100
98
  }
101
99
  }
102
100
  }