@paroicms/public-menu-plugin 0.1.0 → 0.2.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paroicms/public-menu-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Public menu plugin for ParoiCMS",
5
5
  "keywords": [
6
6
  "paroicms",
@@ -19,7 +19,8 @@
19
19
  "dev:public": "(cd public-front && vite)",
20
20
  "build": "npm run build:backend && npm run build:public",
21
21
  "build:backend": "(cd backend && tsc)",
22
- "build:public": "(cd public-front && tsc && vite build)",
22
+ "build:public": "(cd public-front && tsc && vite build && npm run minify:public)",
23
+ "minify:public": "terser public-front/dist/public-front-plugin.mjs --output public-front/dist/public-front-plugin.mjs",
23
24
  "build:public:watch": "(cd public-front && tsc && vite build --watch)",
24
25
  "clear": "rimraf backend/dist/* public-front/dist/*"
25
26
  },
@@ -31,18 +32,19 @@
31
32
  "@paroicms/public-server-lib": "0"
32
33
  },
33
34
  "devDependencies": {
34
- "@paroicms/public-anywhere-lib": "0.7.0",
35
- "@paroicms/public-server-lib": "0.13.0",
35
+ "@paroicms/public-anywhere-lib": "0.8.3",
36
+ "@paroicms/public-server-lib": "0.16.3",
36
37
  "@types/node": "~20.14.8",
37
38
  "@types/micromodal": "~0.3.5",
38
39
  "micromodal": "~0.4.10",
39
40
  "rimraf": "~6.0.1",
40
41
  "sass": "~1.77.8",
41
42
  "solid-devtools": "~0.30.1",
42
- "solid-js": "~1.8.20",
43
- "typescript": "~5.5.4",
44
- "vite": "~5.4.0",
45
- "vite-plugin-solid": "~2.10.2"
43
+ "solid-js": "1.9.3",
44
+ "typescript": "~5.6.3",
45
+ "vite": "~5.4.11",
46
+ "vite-plugin-solid": "~2.10.2",
47
+ "terser": "~5.36.0"
46
48
  },
47
49
  "main": "backend/dist/plugin.js",
48
50
  "files": [
@@ -1,497 +1 @@
1
- function le(e) {
2
- const n = e.dataset.activateMenuItems?.trim();
3
- if (!n) return;
4
- const { id: t, parents: o } = JSON.parse(n), i = new Set(o);
5
- i.add(t);
6
- const s = e.querySelectorAll("[data-menu-item-id]");
7
- for (const l of s) {
8
- const r = l.dataset.menuItemId;
9
- r !== void 0 && i.has(r) && l.classList.add("active");
10
- }
11
- }
12
- let re = J;
13
- const v = 1, A = 2, ae = {
14
- owned: null,
15
- cleanups: null,
16
- context: null,
17
- owner: null
18
- };
19
- var d = null;
20
- let k = null, ce = null, g = null, f = null, p = null, C = 0;
21
- function B(e, n, t) {
22
- const o = he(e, n, !1, v);
23
- R(o);
24
- }
25
- function ue(e) {
26
- if (g === null) return e();
27
- const n = g;
28
- g = null;
29
- try {
30
- return e();
31
- } finally {
32
- g = n;
33
- }
34
- }
35
- function fe(e, n, t) {
36
- let o = e.value;
37
- return (!e.comparator || !e.comparator(o, n)) && (e.value = n, e.observers && e.observers.length && $(() => {
38
- for (let i = 0; i < e.observers.length; i += 1) {
39
- const s = e.observers[i], l = k && k.running;
40
- l && k.disposed.has(s), (l ? !s.tState : !s.state) && (s.pure ? f.push(s) : p.push(s), s.observers && Q(s)), l || (s.state = v);
41
- }
42
- if (f.length > 1e6)
43
- throw f = [], new Error();
44
- })), n;
45
- }
46
- function R(e) {
47
- if (!e.fn) return;
48
- O(e);
49
- const n = C;
50
- de(
51
- e,
52
- e.value,
53
- n
54
- );
55
- }
56
- function de(e, n, t) {
57
- let o;
58
- const i = d, s = g;
59
- g = d = e;
60
- try {
61
- o = e.fn(n);
62
- } catch (l) {
63
- return e.pure && (e.state = v, e.owned && e.owned.forEach(O), e.owned = null), e.updatedAt = t + 1, X(l);
64
- } finally {
65
- g = s, d = i;
66
- }
67
- (!e.updatedAt || e.updatedAt <= t) && (e.updatedAt != null && "observers" in e ? fe(e, o) : e.value = o, e.updatedAt = t);
68
- }
69
- function he(e, n, t, o = v, i) {
70
- const s = {
71
- fn: e,
72
- state: o,
73
- updatedAt: null,
74
- owned: null,
75
- sources: null,
76
- sourceSlots: null,
77
- cleanups: null,
78
- value: n,
79
- owner: d,
80
- context: d ? d.context : null,
81
- pure: t
82
- };
83
- return d === null || d !== ae && (d.owned ? d.owned.push(s) : d.owned = [s]), s;
84
- }
85
- function W(e) {
86
- if (e.state === 0) return;
87
- if (e.state === A) return I(e);
88
- if (e.suspense && ue(e.suspense.inFallback)) return e.suspense.effects.push(e);
89
- const n = [e];
90
- for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < C); )
91
- e.state && n.push(e);
92
- for (let t = n.length - 1; t >= 0; t--)
93
- if (e = n[t], e.state === v)
94
- R(e);
95
- else if (e.state === A) {
96
- const o = f;
97
- f = null, $(() => I(e, n[0])), f = o;
98
- }
99
- }
100
- function $(e, n) {
101
- if (f) return e();
102
- let t = !1;
103
- f = [], p ? t = !0 : p = [], C++;
104
- try {
105
- const o = e();
106
- return me(t), o;
107
- } catch (o) {
108
- t || (p = null), f = null, X(o);
109
- }
110
- }
111
- function me(e) {
112
- if (f && (J(f), f = null), e) return;
113
- const n = p;
114
- p = null, n.length && $(() => re(n));
115
- }
116
- function J(e) {
117
- for (let n = 0; n < e.length; n++) W(e[n]);
118
- }
119
- function I(e, n) {
120
- e.state = 0;
121
- for (let t = 0; t < e.sources.length; t += 1) {
122
- const o = e.sources[t];
123
- if (o.sources) {
124
- const i = o.state;
125
- i === v ? o !== n && (!o.updatedAt || o.updatedAt < C) && W(o) : i === A && I(o, n);
126
- }
127
- }
128
- }
129
- function Q(e) {
130
- for (let n = 0; n < e.observers.length; n += 1) {
131
- const t = e.observers[n];
132
- t.state || (t.state = A, t.pure ? f.push(t) : p.push(t), t.observers && Q(t));
133
- }
134
- }
135
- function O(e) {
136
- let n;
137
- if (e.sources)
138
- for (; e.sources.length; ) {
139
- const t = e.sources.pop(), o = e.sourceSlots.pop(), i = t.observers;
140
- if (i && i.length) {
141
- const s = i.pop(), l = t.observerSlots.pop();
142
- o < i.length && (s.sourceSlots[l] = o, i[o] = s, t.observerSlots[o] = l);
143
- }
144
- }
145
- if (e.owned) {
146
- for (n = e.owned.length - 1; n >= 0; n--) O(e.owned[n]);
147
- e.owned = null;
148
- }
149
- if (e.cleanups) {
150
- for (n = e.cleanups.length - 1; n >= 0; n--) e.cleanups[n]();
151
- e.cleanups = null;
152
- }
153
- e.state = 0;
154
- }
155
- function ge(e) {
156
- return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
157
- cause: e
158
- });
159
- }
160
- function X(e, n = d) {
161
- throw ge(e);
162
- }
163
- function pe(e, n, t) {
164
- let o = t.length, i = n.length, s = o, l = 0, r = 0, a = n[i - 1].nextSibling, u = null;
165
- for (; l < i || r < s; ) {
166
- if (n[l] === t[r]) {
167
- l++, r++;
168
- continue;
169
- }
170
- for (; n[i - 1] === t[s - 1]; )
171
- i--, s--;
172
- if (i === l) {
173
- const c = s < o ? r ? t[r - 1].nextSibling : t[s - r] : a;
174
- for (; r < s; ) e.insertBefore(t[r++], c);
175
- } else if (s === r)
176
- for (; l < i; )
177
- (!u || !u.has(n[l])) && n[l].remove(), l++;
178
- else if (n[l] === t[s - 1] && t[r] === n[i - 1]) {
179
- const c = n[--i].nextSibling;
180
- e.insertBefore(t[r++], n[l++].nextSibling), e.insertBefore(t[--s], c), n[i] = t[s];
181
- } else {
182
- if (!u) {
183
- u = /* @__PURE__ */ new Map();
184
- let h = r;
185
- for (; h < s; ) u.set(t[h], h++);
186
- }
187
- const c = u.get(n[l]);
188
- if (c != null)
189
- if (r < c && c < s) {
190
- let h = l, y = 1, b;
191
- for (; ++h < i && h < s && !((b = u.get(n[h])) == null || b !== c + y); )
192
- y++;
193
- if (y > c - r) {
194
- const S = n[l];
195
- for (; r < c; ) e.insertBefore(t[r++], S);
196
- } else e.replaceChild(t[r++], n[l++]);
197
- } else l++;
198
- else n[l++].remove();
199
- }
200
- }
201
- }
202
- const U = "_$DX_DELEGATE";
203
- function Y(e, n, t) {
204
- let o;
205
- const i = () => {
206
- const l = document.createElement("template");
207
- return l.innerHTML = e, l.content.firstChild;
208
- }, s = () => (o || (o = i())).cloneNode(!0);
209
- return s.cloneNode = s, s;
210
- }
211
- function ve(e, n = window.document) {
212
- const t = n[U] || (n[U] = /* @__PURE__ */ new Set());
213
- for (let o = 0, i = e.length; o < i; o++) {
214
- const s = e[o];
215
- t.has(s) || (t.add(s), n.addEventListener(s, be));
216
- }
217
- }
218
- function ye(e, n, t, o) {
219
- if (o || (o = []), typeof n != "function") return M(e, n, o, t);
220
- B((i) => M(e, n(), i, t), o);
221
- }
222
- function be(e) {
223
- const n = `$$${e.type}`;
224
- let t = e.composedPath && e.composedPath()[0] || e.target;
225
- for (e.target !== t && Object.defineProperty(e, "target", {
226
- configurable: !0,
227
- value: t
228
- }), Object.defineProperty(e, "currentTarget", {
229
- configurable: !0,
230
- get() {
231
- return t || document;
232
- }
233
- }); t; ) {
234
- const o = t[n];
235
- if (o && !t.disabled) {
236
- const i = t[`${n}Data`];
237
- if (i !== void 0 ? o.call(t, i, e) : o.call(t, e), e.cancelBubble) return;
238
- }
239
- t = t._$host || t.parentNode || t.host;
240
- }
241
- }
242
- function M(e, n, t, o, i) {
243
- for (; typeof t == "function"; ) t = t();
244
- if (n === t) return t;
245
- const s = typeof n;
246
- if (e = t[0] && t[0].parentNode || e, s === "string" || s === "number") {
247
- if (s === "number" && (n = n.toString(), n === t))
248
- return t;
249
- {
250
- let l = t[0];
251
- l && l.nodeType === 3 ? l.data !== n && (l.data = n) : l = document.createTextNode(n), t = w(e, t, o, l);
252
- }
253
- } else if (n == null || s === "boolean")
254
- t = w(e, t, o);
255
- else {
256
- if (s === "function")
257
- return B(() => {
258
- let l = n();
259
- for (; typeof l == "function"; ) l = l();
260
- t = M(e, l, t, o);
261
- }), () => t;
262
- if (Array.isArray(n)) {
263
- const l = [], r = t && Array.isArray(t);
264
- if (N(l, n, t, i))
265
- return B(() => t = M(e, l, t, o, !0)), () => t;
266
- if (l.length === 0)
267
- return t = w(e, t, o), t;
268
- r ? t.length === 0 ? H(e, l, o) : pe(e, t, l) : (t && w(e), H(e, l)), t = l;
269
- } else if (n.nodeType) {
270
- if (Array.isArray(t))
271
- return t = w(e, t, o, n);
272
- t == null || t === "" || !e.firstChild ? e.appendChild(n) : e.replaceChild(n, e.firstChild), t = n;
273
- }
274
- }
275
- return t;
276
- }
277
- function N(e, n, t, o) {
278
- let i = !1;
279
- for (let s = 0, l = n.length; s < l; s++) {
280
- let r = n[s], a = t && t[e.length], u;
281
- if (!(r == null || r === !0 || r === !1)) if ((u = typeof r) == "object" && r.nodeType)
282
- e.push(r);
283
- else if (Array.isArray(r))
284
- i = N(e, r, a) || i;
285
- else if (u === "function")
286
- if (o) {
287
- for (; typeof r == "function"; ) r = r();
288
- i = N(
289
- e,
290
- Array.isArray(r) ? r : [r],
291
- Array.isArray(a) ? a : [a]
292
- ) || i;
293
- } else
294
- e.push(r), i = !0;
295
- else {
296
- const c = String(r);
297
- a && a.nodeType === 3 && a.data === c ? e.push(a) : e.push(document.createTextNode(c));
298
- }
299
- }
300
- return i;
301
- }
302
- function H(e, n, t = null) {
303
- for (let o = 0, i = n.length; o < i; o++) e.insertBefore(n[o], t);
304
- }
305
- function w(e, n, t, o) {
306
- if (t === void 0) return e.textContent = "";
307
- const i = o || document.createTextNode("");
308
- if (n.length) {
309
- let s = !1;
310
- for (let l = n.length - 1; l >= 0; l--) {
311
- const r = n[l];
312
- if (i !== r) {
313
- const a = r.parentNode === e;
314
- !s && !l ? a ? e.replaceChild(i, r) : e.insertBefore(i, t) : a && r.remove();
315
- } else s = !0;
316
- }
317
- } else e.insertBefore(i, t);
318
- return [i];
319
- }
320
- function we(e, n) {
321
- for (var t = 0; t < n.length; t++) {
322
- var o = n[t];
323
- o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o);
324
- }
325
- }
326
- function E(e) {
327
- return function(n) {
328
- if (Array.isArray(n)) return T(n);
329
- }(e) || function(n) {
330
- if (typeof Symbol < "u" && Symbol.iterator in Object(n)) return Array.from(n);
331
- }(e) || function(n, t) {
332
- if (n) {
333
- if (typeof n == "string") return T(n, t);
334
- var o = Object.prototype.toString.call(n).slice(8, -1);
335
- if (o === "Object" && n.constructor && (o = n.constructor.name), o === "Map" || o === "Set") return Array.from(n);
336
- if (o === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)) return T(n, t);
337
- }
338
- }(e) || function() {
339
- throw new TypeError(`Invalid attempt to spread non-iterable instance.
340
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
341
- }();
342
- }
343
- function T(e, n) {
344
- (n == null || n > e.length) && (n = e.length);
345
- for (var t = 0, o = new Array(n); t < n; t++) o[t] = e[t];
346
- return o;
347
- }
348
- var V, x, m, L, G, _ = (V = ["a[href]", "area[href]", 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', "select:not([disabled]):not([aria-hidden])", "textarea:not([disabled]):not([aria-hidden])", "button:not([disabled]):not([aria-hidden])", "iframe", "object", "embed", "[contenteditable]", '[tabindex]:not([tabindex^="-"])'], x = function() {
349
- function e(o) {
350
- var i = o.targetModal, s = o.triggers, l = s === void 0 ? [] : s, r = o.onShow, a = r === void 0 ? function() {
351
- } : r, u = o.onClose, c = u === void 0 ? function() {
352
- } : u, h = o.openTrigger, y = h === void 0 ? "data-micromodal-trigger" : h, b = o.closeTrigger, S = b === void 0 ? "data-micromodal-close" : b, j = o.openClass, Z = j === void 0 ? "is-open" : j, F = o.disableScroll, z = F !== void 0 && F, P = o.disableFocus, ee = P !== void 0 && P, D = o.awaitCloseAnimation, te = D !== void 0 && D, q = o.awaitOpenAnimation, ne = q !== void 0 && q, K = o.debugMode, oe = K !== void 0 && K;
353
- (function(ie, se) {
354
- if (!(ie instanceof se)) throw new TypeError("Cannot call a class as a function");
355
- })(this, e), this.modal = document.getElementById(i), this.config = { debugMode: oe, disableScroll: z, openTrigger: y, closeTrigger: S, openClass: Z, onShow: a, onClose: c, awaitCloseAnimation: te, awaitOpenAnimation: ne, disableFocus: ee }, l.length > 0 && this.registerTriggers.apply(this, E(l)), this.onClick = this.onClick.bind(this), this.onKeydown = this.onKeydown.bind(this);
356
- }
357
- var n, t;
358
- return n = e, (t = [{ key: "registerTriggers", value: function() {
359
- for (var o = this, i = arguments.length, s = new Array(i), l = 0; l < i; l++) s[l] = arguments[l];
360
- s.filter(Boolean).forEach(function(r) {
361
- r.addEventListener("click", function(a) {
362
- return o.showModal(a);
363
- });
364
- });
365
- } }, { key: "showModal", value: function() {
366
- var o = this, i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
367
- if (this.activeElement = document.activeElement, this.modal.setAttribute("aria-hidden", "false"), this.modal.classList.add(this.config.openClass), this.scrollBehaviour("disable"), this.addEventListeners(), this.config.awaitOpenAnimation) {
368
- var s = function l() {
369
- o.modal.removeEventListener("animationend", l, !1), o.setFocusToFirstNode();
370
- };
371
- this.modal.addEventListener("animationend", s, !1);
372
- } else this.setFocusToFirstNode();
373
- this.config.onShow(this.modal, this.activeElement, i);
374
- } }, { key: "closeModal", value: function() {
375
- var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null, i = this.modal;
376
- if (this.modal.setAttribute("aria-hidden", "true"), this.removeEventListeners(), this.scrollBehaviour("enable"), this.activeElement && this.activeElement.focus && this.activeElement.focus(), this.config.onClose(this.modal, this.activeElement, o), this.config.awaitCloseAnimation) {
377
- var s = this.config.openClass;
378
- this.modal.addEventListener("animationend", function l() {
379
- i.classList.remove(s), i.removeEventListener("animationend", l, !1);
380
- }, !1);
381
- } else i.classList.remove(this.config.openClass);
382
- } }, { key: "closeModalById", value: function(o) {
383
- this.modal = document.getElementById(o), this.modal && this.closeModal();
384
- } }, { key: "scrollBehaviour", value: function(o) {
385
- if (this.config.disableScroll) {
386
- var i = document.querySelector("body");
387
- switch (o) {
388
- case "enable":
389
- Object.assign(i.style, { overflow: "" });
390
- break;
391
- case "disable":
392
- Object.assign(i.style, { overflow: "hidden" });
393
- }
394
- }
395
- } }, { key: "addEventListeners", value: function() {
396
- this.modal.addEventListener("touchstart", this.onClick), this.modal.addEventListener("click", this.onClick), document.addEventListener("keydown", this.onKeydown);
397
- } }, { key: "removeEventListeners", value: function() {
398
- this.modal.removeEventListener("touchstart", this.onClick), this.modal.removeEventListener("click", this.onClick), document.removeEventListener("keydown", this.onKeydown);
399
- } }, { key: "onClick", value: function(o) {
400
- (o.target.hasAttribute(this.config.closeTrigger) || o.target.parentNode.hasAttribute(this.config.closeTrigger)) && (o.preventDefault(), o.stopPropagation(), this.closeModal(o));
401
- } }, { key: "onKeydown", value: function(o) {
402
- o.keyCode === 27 && this.closeModal(o), o.keyCode === 9 && this.retainFocus(o);
403
- } }, { key: "getFocusableNodes", value: function() {
404
- var o = this.modal.querySelectorAll(V);
405
- return Array.apply(void 0, E(o));
406
- } }, { key: "setFocusToFirstNode", value: function() {
407
- var o = this;
408
- if (!this.config.disableFocus) {
409
- var i = this.getFocusableNodes();
410
- if (i.length !== 0) {
411
- var s = i.filter(function(l) {
412
- return !l.hasAttribute(o.config.closeTrigger);
413
- });
414
- s.length > 0 && s[0].focus(), s.length === 0 && i[0].focus();
415
- }
416
- }
417
- } }, { key: "retainFocus", value: function(o) {
418
- var i = this.getFocusableNodes();
419
- if (i.length !== 0) if (i = i.filter(function(l) {
420
- return l.offsetParent !== null;
421
- }), this.modal.contains(document.activeElement)) {
422
- var s = i.indexOf(document.activeElement);
423
- o.shiftKey && s === 0 && (i[i.length - 1].focus(), o.preventDefault()), !o.shiftKey && i.length > 0 && s === i.length - 1 && (i[0].focus(), o.preventDefault());
424
- } else i[0].focus();
425
- } }]) && we(n.prototype, t), e;
426
- }(), m = null, L = function(e) {
427
- if (!document.getElementById(e)) return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(e, "'"), "background-color: #f8f9fa;color: #50596c;font-weight: bold;", "ID somewhere in your code. Refer example below to resolve it."), console.warn("%cExample:", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", '<div class="modal" id="'.concat(e, '"></div>')), !1;
428
- }, G = function(e, n) {
429
- if (function(o) {
430
- o.length <= 0 && (console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", "data attribute."), console.warn("%cExample:", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", '<a href="#" data-micromodal-trigger="my-modal"></a>'));
431
- }(e), !n) return !0;
432
- for (var t in n) L(t);
433
- return !0;
434
- }, { init: function(e) {
435
- var n = Object.assign({}, { openTrigger: "data-micromodal-trigger" }, e), t = E(document.querySelectorAll("[".concat(n.openTrigger, "]"))), o = function(l, r) {
436
- var a = [];
437
- return l.forEach(function(u) {
438
- var c = u.attributes[r].value;
439
- a[c] === void 0 && (a[c] = []), a[c].push(u);
440
- }), a;
441
- }(t, n.openTrigger);
442
- if (n.debugMode !== !0 || G(t, o) !== !1) for (var i in o) {
443
- var s = o[i];
444
- n.targetModal = i, n.triggers = E(s), m = new x(n);
445
- }
446
- }, show: function(e, n) {
447
- var t = n || {};
448
- t.targetModal = e, t.debugMode === !0 && L(e) === !1 || (m && m.removeEventListeners(), (m = new x(t)).showModal());
449
- }, close: function(e) {
450
- e ? m.closeModalById(e) : m.closeModal();
451
- } });
452
- typeof window < "u" && (window.MicroModal = _);
453
- var Ee = /* @__PURE__ */ Y('<div class="modal micromodal-slide"id=mobileMenu><div class=modal__overlay tabindex=-1 data-micromodal-close><div class="modal__container MobileMenu"role=dialog><button type=button class="modal__close MobileMenu-closeBtn"data-micromodal-close>&times;'), Ae = /* @__PURE__ */ Y('<button class=MobileMenuBtn type=button><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor data-testid=IconBurger width=35 height=35><title>IconBurger</title><path d="M4 18h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z">');
454
- function Me(e, n) {
455
- const o = window.getComputedStyle(e).getPropertyValue("--siteAppMobileMenuMaxWidth");
456
- if (!window.matchMedia(`(max-width: ${o})`).matches) return;
457
- const s = document.querySelector('[data-mobile-menu="button"]');
458
- if (!s) return;
459
- _.init(), Se(e);
460
- const l = (() => {
461
- var a = Ee(), u = a.firstChild, c = u.firstChild;
462
- return c.firstChild, ye(c, e, null), a;
463
- })();
464
- e.style.display === "none" && e.style.removeProperty("display"), document.body.appendChild(l);
465
- const r = (() => {
466
- var a = Ae();
467
- return a.$$click = Ce, a;
468
- })();
469
- s.appendChild(r);
470
- }
471
- function Ce() {
472
- _.show("mobileMenu");
473
- }
474
- function Se(e) {
475
- const n = document.querySelectorAll("[data-mobile-menu-part]");
476
- for (const t of n) {
477
- const o = t.dataset.mobileMenuPart, i = t.dataset.mobileMenuAction !== "move", s = e.querySelector(`[data-inject="${o}"]`);
478
- s && s.appendChild(i ? t.cloneNode(!0) : t);
479
- }
480
- }
481
- ve(["click"]);
482
- document.addEventListener("DOMContentLoaded", () => {
483
- const e = document.documentElement.lang, n = {
484
- mobileMenu: Me
485
- }, t = document.querySelectorAll("[data-effect]");
486
- for (const i of t) {
487
- const s = i.dataset.effect;
488
- if (!s) continue;
489
- const l = n[s];
490
- l && l(i, {
491
- language: e
492
- });
493
- }
494
- const o = document.querySelectorAll("[data-activate-menu-items]");
495
- for (const i of o)
496
- le(i);
497
- });
1
+ import{delegateEvents as q,insert as P,template as L}from"https://esm.sh/solid-js@1.9.3/web";function K(n){const t=n.dataset.activateMenuItems?.trim();if(!t)return;const{id:i,parents:e}=JSON.parse(t),o=new Set(e);o.add(i);const a=n.querySelectorAll("[data-menu-item-id]");for(const r of a){const l=r.dataset.menuItemId;l!==void 0&&o.has(l)&&r.classList.add("active")}}function D(n,t){for(var i=0;i<t.length;i++){var e=t[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function m(n){return function(t){if(Array.isArray(t))return f(t)}(n)||function(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}(n)||function(t,i){if(t){if(typeof t=="string")return f(t,i);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(t,i)}}(n)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function f(n,t){(t==null||t>n.length)&&(t=n.length);for(var i=0,e=new Array(t);i<t;i++)e[i]=n[i];return e}var A,h,u,v,S,g=(A=["a[href]","area[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'],h=function(){function n(e){var o=e.targetModal,a=e.triggers,r=a===void 0?[]:a,l=e.onShow,s=l===void 0?function(){}:l,d=e.onClose,c=d===void 0?function(){}:d,b=e.openTrigger,I=b===void 0?"data-micromodal-trigger":b,y=e.closeTrigger,T=y===void 0?"data-micromodal-close":y,p=e.openClass,B=p===void 0?"is-open":p,w=e.disableScroll,F=w!==void 0&&w,M=e.disableFocus,O=M!==void 0&&M,E=e.awaitCloseAnimation,x=E!==void 0&&E,k=e.awaitOpenAnimation,_=k!==void 0&&k,C=e.debugMode,j=C!==void 0&&C;(function(N,$){if(!(N instanceof $))throw new TypeError("Cannot call a class as a function")})(this,n),this.modal=document.getElementById(o),this.config={debugMode:j,disableScroll:F,openTrigger:I,closeTrigger:T,openClass:B,onShow:s,onClose:c,awaitCloseAnimation:x,awaitOpenAnimation:_,disableFocus:O},r.length>0&&this.registerTriggers.apply(this,m(r)),this.onClick=this.onClick.bind(this),this.onKeydown=this.onKeydown.bind(this)}var t,i;return t=n,(i=[{key:"registerTriggers",value:function(){for(var e=this,o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];a.filter(Boolean).forEach((function(l){l.addEventListener("click",(function(s){return e.showModal(s)}))}))}},{key:"showModal",value:function(){var e=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;if(this.activeElement=document.activeElement,this.modal.setAttribute("aria-hidden","false"),this.modal.classList.add(this.config.openClass),this.scrollBehaviour("disable"),this.addEventListeners(),this.config.awaitOpenAnimation){var a=function r(){e.modal.removeEventListener("animationend",r,!1),e.setFocusToFirstNode()};this.modal.addEventListener("animationend",a,!1)}else this.setFocusToFirstNode();this.config.onShow(this.modal,this.activeElement,o)}},{key:"closeModal",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,o=this.modal;if(this.modal.setAttribute("aria-hidden","true"),this.removeEventListeners(),this.scrollBehaviour("enable"),this.activeElement&&this.activeElement.focus&&this.activeElement.focus(),this.config.onClose(this.modal,this.activeElement,e),this.config.awaitCloseAnimation){var a=this.config.openClass;this.modal.addEventListener("animationend",(function r(){o.classList.remove(a),o.removeEventListener("animationend",r,!1)}),!1)}else o.classList.remove(this.config.openClass)}},{key:"closeModalById",value:function(e){this.modal=document.getElementById(e),this.modal&&this.closeModal()}},{key:"scrollBehaviour",value:function(e){if(this.config.disableScroll){var o=document.querySelector("body");switch(e){case"enable":Object.assign(o.style,{overflow:""});break;case"disable":Object.assign(o.style,{overflow:"hidden"})}}}},{key:"addEventListeners",value:function(){this.modal.addEventListener("touchstart",this.onClick),this.modal.addEventListener("click",this.onClick),document.addEventListener("keydown",this.onKeydown)}},{key:"removeEventListeners",value:function(){this.modal.removeEventListener("touchstart",this.onClick),this.modal.removeEventListener("click",this.onClick),document.removeEventListener("keydown",this.onKeydown)}},{key:"onClick",value:function(e){(e.target.hasAttribute(this.config.closeTrigger)||e.target.parentNode.hasAttribute(this.config.closeTrigger))&&(e.preventDefault(),e.stopPropagation(),this.closeModal(e))}},{key:"onKeydown",value:function(e){e.keyCode===27&&this.closeModal(e),e.keyCode===9&&this.retainFocus(e)}},{key:"getFocusableNodes",value:function(){var e=this.modal.querySelectorAll(A);return Array.apply(void 0,m(e))}},{key:"setFocusToFirstNode",value:function(){var e=this;if(!this.config.disableFocus){var o=this.getFocusableNodes();if(o.length!==0){var a=o.filter((function(r){return!r.hasAttribute(e.config.closeTrigger)}));a.length>0&&a[0].focus(),a.length===0&&o[0].focus()}}}},{key:"retainFocus",value:function(e){var o=this.getFocusableNodes();if(o.length!==0)if(o=o.filter((function(r){return r.offsetParent!==null})),this.modal.contains(document.activeElement)){var a=o.indexOf(document.activeElement);e.shiftKey&&a===0&&(o[o.length-1].focus(),e.preventDefault()),!e.shiftKey&&o.length>0&&a===o.length-1&&(o[0].focus(),e.preventDefault())}else o[0].focus()}}])&&D(t.prototype,i),n}(),u=null,v=function(n){if(!document.getElementById(n))return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(n,"'"),"background-color: #f8f9fa;color: #50596c;font-weight: bold;","ID somewhere in your code. Refer example below to resolve it."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<div class="modal" id="'.concat(n,'"></div>')),!1},S=function(n,t){if(function(e){e.length<=0&&(console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'","background-color: #f8f9fa;color: #50596c;font-weight: bold;","data attribute."),console.warn("%cExample:","background-color: #f8f9fa;color: #50596c;font-weight: bold;",'<a href="#" data-micromodal-trigger="my-modal"></a>'))}(n),!t)return!0;for(var i in t)v(i);return!0},{init:function(n){var t=Object.assign({},{openTrigger:"data-micromodal-trigger"},n),i=m(document.querySelectorAll("[".concat(t.openTrigger,"]"))),e=function(r,l){var s=[];return r.forEach((function(d){var c=d.attributes[l].value;s[c]===void 0&&(s[c]=[]),s[c].push(d)})),s}(i,t.openTrigger);if(t.debugMode!==!0||S(i,e)!==!1)for(var o in e){var a=e[o];t.targetModal=o,t.triggers=m(a),u=new h(t)}},show:function(n,t){var i=t||{};i.targetModal=n,i.debugMode===!0&&v(n)===!1||(u&&u.removeEventListeners(),(u=new h(i)).showModal())},close:function(n){n?u.closeModalById(n):u.closeModal()}});typeof window<"u"&&(window.MicroModal=g);var H=L('<div class="modal micromodal-slide"id=mobileMenu><div class=modal__overlay tabindex=-1 data-micromodal-close><div class="modal__container MobileMenu"role=dialog><button type=button class="modal__close MobileMenu-closeBtn"data-micromodal-close>&times;'),z=L('<button class=MobileMenuBtn type=button><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor data-testid=IconBurger width=35 height=35><title>IconBurger</title><path d="M4 18h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zm0-5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1zM3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1z">');function W(n,t){const e=window.getComputedStyle(n).getPropertyValue("--siteAppMobileMenuMaxWidth");if(!window.matchMedia(`(max-width: ${e})`).matches)return;const a=document.querySelector('[data-mobile-menu="button"]');if(!a)return;g.init(),R(n);const r=(()=>{var s=H(),d=s.firstChild,c=d.firstChild;return c.firstChild,P(c,n,null),s})();n.style.display==="none"&&n.style.removeProperty("display"),document.body.appendChild(r);const l=(()=>{var s=z();return s.$$click=J,s})();a.appendChild(l)}function J(){g.show("mobileMenu")}function R(n){const t=document.querySelectorAll("[data-mobile-menu-part]");for(const i of t){const e=i.dataset.mobileMenuPart,o=i.dataset.mobileMenuAction!=="move",a=n.querySelector(`[data-inject="${e}"]`);a&&a.appendChild(o?i.cloneNode(!0):i)}}q(["click"]);document.addEventListener("DOMContentLoaded",(()=>{const n=document.documentElement.lang,t={mobileMenu:W},i=document.querySelectorAll("[data-effect]");for(const o of i){const a=o.dataset.effect;if(!a)continue;const r=t[a];r&&r(o,{language:n})}const e=document.querySelectorAll("[data-activate-menu-items]");for(const o of e)K(o)}));