stimulus_plumbers 0.2.9 → 0.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +5 -4
- data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.es.js +246 -269
- data/app/assets/javascripts/stimulus-plumbers/stimulus-plumbers-controllers.umd.js +1 -1
- data/lib/stimulus_plumbers/components/avatar.rb +4 -3
- data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_month.rb +58 -39
- data/lib/stimulus_plumbers/components/calendar/month/turbo/days_of_week.rb +13 -10
- data/lib/stimulus_plumbers/components/calendar.rb +36 -13
- data/lib/stimulus_plumbers/components/combobox/trigger.rb +6 -6
- data/lib/stimulus_plumbers/components/date_picker/navigation.rb +14 -22
- data/lib/stimulus_plumbers/components/icon.rb +14 -20
- data/lib/stimulus_plumbers/components/popover.rb +11 -6
- data/lib/stimulus_plumbers/configuration.rb +3 -18
- data/lib/stimulus_plumbers/engine.rb +2 -2
- data/lib/stimulus_plumbers/form/builder.rb +1 -1
- data/lib/stimulus_plumbers/form/fields/combobox.rb +7 -4
- data/lib/stimulus_plumbers/form/fields/renderer.rb +5 -2
- data/lib/stimulus_plumbers/plumber/base.rb +1 -1
- data/lib/stimulus_plumbers/plumber/dispatcher/callable_inspector.rb +19 -0
- data/lib/stimulus_plumbers/plumber/dispatcher/instance_exec.rb +35 -0
- data/lib/stimulus_plumbers/plumber/dispatcher/klass_proxy.rb +34 -0
- data/lib/stimulus_plumbers/plumber/dispatcher/method_call.rb +36 -0
- data/lib/stimulus_plumbers/plumber/dispatcher.rb +4 -87
- data/lib/stimulus_plumbers/plumber/html_options.rb +6 -5
- data/lib/stimulus_plumbers/plumber/renderer.rb +2 -2
- data/lib/stimulus_plumbers/themes/base.rb +25 -5
- data/lib/stimulus_plumbers/themes/configuration.rb +38 -0
- data/lib/stimulus_plumbers/themes/schema/form/ranges.rb +14 -0
- data/lib/stimulus_plumbers/themes/schema/icon.rb +32 -0
- data/lib/stimulus_plumbers/themes/schema/ranges.rb +1 -1
- data/lib/stimulus_plumbers/themes/schema.rb +10 -4
- data/lib/stimulus_plumbers/version.rb +1 -1
- metadata +9 -11
- data/lib/stimulus_plumbers/themes/tailwind/action_list.rb +0 -33
- data/lib/stimulus_plumbers/themes/tailwind/avatar.rb +0 -52
- data/lib/stimulus_plumbers/themes/tailwind/button.rb +0 -89
- data/lib/stimulus_plumbers/themes/tailwind/calendar.rb +0 -80
- data/lib/stimulus_plumbers/themes/tailwind/card.rb +0 -24
- data/lib/stimulus_plumbers/themes/tailwind/combobox.rb +0 -75
- data/lib/stimulus_plumbers/themes/tailwind/form.rb +0 -108
- data/lib/stimulus_plumbers/themes/tailwind/layout.rb +0 -25
- data/lib/stimulus_plumbers/themes/tailwind_theme.rb +0 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Controller as e } from "@hotwired/stimulus";
|
|
2
|
-
//#region src/focus.js
|
|
2
|
+
//#region src/accessibility/focus.js
|
|
3
3
|
var t = [
|
|
4
4
|
"a[href]",
|
|
5
5
|
"area[href]",
|
|
@@ -58,7 +58,7 @@ var a = class {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region src/keyboard.js
|
|
61
|
+
//#region src/accessibility/keyboard.js
|
|
62
62
|
function s(e, t) {
|
|
63
63
|
return e.key === t;
|
|
64
64
|
}
|
|
@@ -124,54 +124,97 @@ function p(e, t = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
var m = (e = "a11y") => `${e}-${Math.random().toString(36).substr(2, 9)}`, h = (e, t = "element") => e.id ||= m(t), g = (e, t, n) => {
|
|
126
126
|
e.setAttribute(t, n.toString());
|
|
127
|
-
},
|
|
128
|
-
function
|
|
127
|
+
}, ee = (e, t) => g(e, "aria-expanded", t), _ = (e, t) => g(e, "aria-pressed", t), v = (e, t) => g(e, "aria-checked", t);
|
|
128
|
+
function te(e, t) {
|
|
129
129
|
g(e, "aria-disabled", t), t ? e.setAttribute("tabindex", "-1") : e.removeAttribute("tabindex");
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var y = {
|
|
132
132
|
menu: "menu",
|
|
133
133
|
listbox: "listbox",
|
|
134
134
|
tree: "tree",
|
|
135
135
|
grid: "grid",
|
|
136
136
|
dialog: "dialog"
|
|
137
|
-
},
|
|
137
|
+
}, b = (e, t, n) => {
|
|
138
138
|
Object.entries(t).forEach(([t, r]) => {
|
|
139
139
|
e.setAttribute(t, r), n[t] = r;
|
|
140
140
|
});
|
|
141
|
-
},
|
|
142
|
-
function
|
|
141
|
+
}, x = (e, t, n) => n || !e.hasAttribute(t);
|
|
142
|
+
function S({ trigger: e, target: t, role: n = null, override: r = !1 }) {
|
|
143
143
|
let i = {
|
|
144
144
|
trigger: {},
|
|
145
145
|
target: {}
|
|
146
146
|
};
|
|
147
147
|
if (!e || !t) return i;
|
|
148
148
|
let a = {}, o = {};
|
|
149
|
-
if (n &&
|
|
150
|
-
let e =
|
|
149
|
+
if (n && x(t, "role", r) && (o.role = n), t.id && (x(e, "aria-controls", r) && (a["aria-controls"] = t.id), n === "tooltip" && x(e, "aria-describedby", r) && (a["aria-describedby"] = t.id)), n && x(e, "aria-haspopup", r)) {
|
|
150
|
+
let e = y[n] || "true";
|
|
151
151
|
e && (a["aria-haspopup"] = e);
|
|
152
152
|
}
|
|
153
|
-
return
|
|
153
|
+
return b(t, o, i.target), b(e, a, i.trigger), i;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
155
|
+
var C = (e, t) => {
|
|
156
156
|
t.forEach((t) => {
|
|
157
157
|
e.hasAttribute(t) && e.removeAttribute(t);
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
|
-
function
|
|
161
|
-
!e || !t || (
|
|
160
|
+
function ne({ trigger: e, target: t, attributes: n = null }) {
|
|
161
|
+
!e || !t || (C(e, n || [
|
|
162
162
|
"aria-controls",
|
|
163
163
|
"aria-haspopup",
|
|
164
164
|
"aria-describedby"
|
|
165
|
-
]), (!n || n.includes("role")) &&
|
|
165
|
+
]), (!n || n.includes("role")) && C(t, ["role"]));
|
|
166
166
|
}
|
|
167
167
|
//#endregion
|
|
168
|
-
//#region src/
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
//#region src/requestor.js
|
|
169
|
+
var w = class {
|
|
170
|
+
constructor() {
|
|
171
|
+
this._abortController = null, this._timer = null;
|
|
172
|
+
}
|
|
173
|
+
schedule(e, t) {
|
|
174
|
+
clearTimeout(this._timer), this._timer = setTimeout(e, t);
|
|
175
|
+
}
|
|
176
|
+
async request(e, t = {}) {
|
|
177
|
+
this._abortController?.abort(), this._abortController = new AbortController();
|
|
178
|
+
let n = await fetch(e, {
|
|
179
|
+
...t,
|
|
180
|
+
signal: this._abortController.signal
|
|
181
|
+
});
|
|
182
|
+
if (!n.ok) throw Error(`${n.status}`);
|
|
183
|
+
return n;
|
|
184
|
+
}
|
|
185
|
+
cancel() {
|
|
186
|
+
clearTimeout(this._timer), this._abortController?.abort();
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/researcher.js
|
|
191
|
+
function T(e, t) {
|
|
192
|
+
let n = 0;
|
|
193
|
+
for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
|
|
194
|
+
return n === e.length;
|
|
195
|
+
}
|
|
196
|
+
function re(e, t) {
|
|
197
|
+
return t.includes(e);
|
|
198
|
+
}
|
|
199
|
+
function ie(e, t) {
|
|
200
|
+
return t.startsWith(e);
|
|
201
|
+
}
|
|
202
|
+
function ae(e) {
|
|
203
|
+
return e === "contains" ? re : e === "prefix" ? ie : T;
|
|
204
|
+
}
|
|
205
|
+
function oe(e, t) {
|
|
206
|
+
return t === "textContent" ? e.textContent?.trim().toLowerCase() ?? "" : (e.getAttribute(t) ?? "").toLowerCase();
|
|
207
|
+
}
|
|
208
|
+
function E(e, t, n = {}) {
|
|
209
|
+
let { strategy: r = "fuzzy", matcher: i, fields: a = ["textContent"] } = n, o = typeof i == "function" ? i : ae(r), s = t.toLowerCase(), c = 0;
|
|
210
|
+
return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
|
|
211
|
+
let t = a.some((t) => o(s, oe(e, t)));
|
|
212
|
+
e.hidden = !t, t && c++;
|
|
213
|
+
}), c;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/plumbers/plumber/geometry.js
|
|
217
|
+
var D = {
|
|
175
218
|
get top() {
|
|
176
219
|
return "bottom";
|
|
177
220
|
},
|
|
@@ -185,7 +228,7 @@ var T = {
|
|
|
185
228
|
return "left";
|
|
186
229
|
}
|
|
187
230
|
};
|
|
188
|
-
function
|
|
231
|
+
function O({ x: e, y: t, width: n, height: r }) {
|
|
189
232
|
return {
|
|
190
233
|
x: e,
|
|
191
234
|
y: t,
|
|
@@ -197,47 +240,39 @@ function D({ x: e, y: t, width: n, height: r }) {
|
|
|
197
240
|
bottom: t + r
|
|
198
241
|
};
|
|
199
242
|
}
|
|
200
|
-
function
|
|
201
|
-
return
|
|
243
|
+
function k() {
|
|
244
|
+
return O({
|
|
202
245
|
x: 0,
|
|
203
246
|
y: 0,
|
|
204
247
|
width: window.innerWidth || document.documentElement.clientWidth,
|
|
205
248
|
height: window.innerHeight || document.documentElement.clientHeight
|
|
206
249
|
});
|
|
207
250
|
}
|
|
208
|
-
function
|
|
251
|
+
function se(e) {
|
|
209
252
|
if (!(e instanceof HTMLElement)) return !1;
|
|
210
|
-
let t =
|
|
253
|
+
let t = k(), n = e.getBoundingClientRect(), r = n.top <= t.height && n.top + n.height > 0, i = n.left <= t.width && n.left + n.width > 0;
|
|
211
254
|
return r && i;
|
|
212
255
|
}
|
|
213
|
-
function k(e) {
|
|
214
|
-
return e instanceof Date && !isNaN(e);
|
|
215
|
-
}
|
|
216
|
-
function A(...e) {
|
|
217
|
-
if (e.length === 0) throw "Missing values to parse as date";
|
|
218
|
-
if (e.length === 1) {
|
|
219
|
-
let t = new Date(e[0]);
|
|
220
|
-
if (e[0] && k(t)) return t;
|
|
221
|
-
} else {
|
|
222
|
-
let t = new Date(...e);
|
|
223
|
-
if (k(t)) return t;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
256
|
//#endregion
|
|
227
|
-
//#region src/plumbers/plumber/
|
|
228
|
-
var
|
|
257
|
+
//#region src/plumbers/plumber/config.js
|
|
258
|
+
var A = {
|
|
259
|
+
get visibleOnly() {
|
|
260
|
+
return !0;
|
|
261
|
+
},
|
|
262
|
+
hiddenClass: null
|
|
263
|
+
}, ce = {
|
|
229
264
|
element: null,
|
|
230
265
|
visible: null,
|
|
231
266
|
dispatch: !0,
|
|
232
267
|
prefix: ""
|
|
233
|
-
},
|
|
268
|
+
}, j = class {
|
|
234
269
|
constructor(e, t = {}) {
|
|
235
270
|
this.controller = e;
|
|
236
|
-
let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({},
|
|
237
|
-
this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r :
|
|
271
|
+
let { element: n, visible: r, dispatch: i, prefix: a } = Object.assign({}, ce, t);
|
|
272
|
+
this.element = n || e.element, this.visibleOnly = typeof r == "boolean" ? r : A.visibleOnly, this.visibleCallback = typeof r == "string" ? r : null, this.notify = !!i, this.prefix = typeof a == "string" && a ? a : e.identifier;
|
|
238
273
|
}
|
|
239
274
|
get visible() {
|
|
240
|
-
return this.element instanceof HTMLElement ? this.visibleOnly ?
|
|
275
|
+
return this.element instanceof HTMLElement ? this.visibleOnly ? se(this.element) && this.isVisible(this.element) : !0 : !1;
|
|
241
276
|
}
|
|
242
277
|
isVisible(e) {
|
|
243
278
|
if (this.visibleCallback) {
|
|
@@ -266,7 +301,7 @@ var j = {
|
|
|
266
301
|
return n instanceof Promise ? await n : n;
|
|
267
302
|
}
|
|
268
303
|
}
|
|
269
|
-
},
|
|
304
|
+
}, le = {
|
|
270
305
|
normalize(e) {
|
|
271
306
|
return typeof e == "string" ? e : "";
|
|
272
307
|
},
|
|
@@ -276,7 +311,7 @@ var j = {
|
|
|
276
311
|
};
|
|
277
312
|
//#endregion
|
|
278
313
|
//#region src/plumbers/formatters/credit_card.js
|
|
279
|
-
function
|
|
314
|
+
function ue(e) {
|
|
280
315
|
let t = 0, n = !1;
|
|
281
316
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
282
317
|
let i = parseInt(e[r], 10);
|
|
@@ -284,32 +319,32 @@ function ie(e) {
|
|
|
284
319
|
}
|
|
285
320
|
return t % 10 == 0;
|
|
286
321
|
}
|
|
287
|
-
var
|
|
322
|
+
var de = /\D/g, fe = /^\d{13,19}$/, pe = /(.{4})(?=.)/g, me = {
|
|
288
323
|
normalize(e) {
|
|
289
|
-
return typeof e == "string" ? e.replace(
|
|
324
|
+
return typeof e == "string" ? e.replace(de, "") : "";
|
|
290
325
|
},
|
|
291
326
|
validate(e) {
|
|
292
|
-
return typeof e != "string" || !
|
|
327
|
+
return typeof e != "string" || !fe.test(e) ? !1 : ue(e);
|
|
293
328
|
},
|
|
294
329
|
format(e) {
|
|
295
|
-
return typeof e == "string" ? e.replace(
|
|
330
|
+
return typeof e == "string" ? e.replace(pe, "$1 ") : "";
|
|
296
331
|
}
|
|
297
|
-
},
|
|
332
|
+
}, M = { 1: 10 }, N = /\D/g, he = /^\+\d{7,15}$/, ge = {
|
|
298
333
|
normalize(e) {
|
|
299
334
|
if (typeof e != "string") return "";
|
|
300
|
-
let t = e.trimStart().startsWith("+"), n = e.replace(
|
|
335
|
+
let t = e.trimStart().startsWith("+"), n = e.replace(N, "");
|
|
301
336
|
return t ? `+${n}` : n;
|
|
302
337
|
},
|
|
303
338
|
validate(e) {
|
|
304
339
|
if (typeof e != "string") return !1;
|
|
305
|
-
if (
|
|
306
|
-
let t = e.replace(
|
|
307
|
-
return Object.values(
|
|
340
|
+
if (he.test(e)) return !0;
|
|
341
|
+
let t = e.replace(N, "");
|
|
342
|
+
return Object.values(M).includes(t.length);
|
|
308
343
|
},
|
|
309
344
|
format(e) {
|
|
310
345
|
if (typeof e != "string") return "";
|
|
311
|
-
let t = e.replace(
|
|
312
|
-
for (let [e, n] of Object.entries(
|
|
346
|
+
let t = e.replace(N, "");
|
|
347
|
+
for (let [e, n] of Object.entries(M)) {
|
|
313
348
|
if (t.length === n) return `(${t.slice(0, 3)}) ${t.slice(3, 6)}-${t.slice(6)}`;
|
|
314
349
|
let r = n + e.length;
|
|
315
350
|
if (t.length === r && t.startsWith(e)) {
|
|
@@ -319,16 +354,16 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
319
354
|
}
|
|
320
355
|
return e;
|
|
321
356
|
}
|
|
322
|
-
},
|
|
357
|
+
}, _e = /[^\d.,-]/g, P = /^-?\d+(\.\d+)?$/, F = {
|
|
323
358
|
normalize(e) {
|
|
324
359
|
if (typeof e != "string") return "";
|
|
325
|
-
let t = e.replace(
|
|
360
|
+
let t = e.replace(_e, "");
|
|
326
361
|
if (!t) return "";
|
|
327
362
|
let n = t.lastIndexOf(","), r = t.lastIndexOf(".");
|
|
328
363
|
return n > -1 && r > -1 ? n > r ? t.replace(/\./g, "").replace(",", ".") : t.replace(/,/g, "") : n > -1 ? t.slice(n + 1).length <= 2 ? t.replace(",", ".") : t.replace(/,/g, "") : t;
|
|
329
364
|
},
|
|
330
365
|
validate(e) {
|
|
331
|
-
return typeof e == "string" ?
|
|
366
|
+
return typeof e == "string" ? P.test(e) : !1;
|
|
332
367
|
},
|
|
333
368
|
format(e, t = {}) {
|
|
334
369
|
if (typeof e != "string") return "";
|
|
@@ -348,18 +383,18 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
348
383
|
return e;
|
|
349
384
|
}
|
|
350
385
|
}
|
|
351
|
-
}, I = /^\d{4}-\d{2}-\d{2}$/,
|
|
386
|
+
}, I = /^\d{4}-\d{2}-\d{2}$/, ve = /^(\d{1,4})[/\-.](\d{1,2})[/\-.](\d{1,4})$/, ye = /\D/g, L = {
|
|
352
387
|
normalize(e) {
|
|
353
388
|
if (typeof e != "string") return "";
|
|
354
389
|
let t = e.trim();
|
|
355
390
|
if (I.test(t)) return t;
|
|
356
|
-
let n = t.match(
|
|
391
|
+
let n = t.match(ve);
|
|
357
392
|
if (n) {
|
|
358
393
|
let [, e, t, r] = n;
|
|
359
394
|
if (e.length === 4) return `${e}-${t.padStart(2, "0")}-${r.padStart(2, "0")}`;
|
|
360
395
|
if (r.length === 4) return `${r}-${e.padStart(2, "0")}-${t.padStart(2, "0")}`;
|
|
361
396
|
}
|
|
362
|
-
let r = t.replace(
|
|
397
|
+
let r = t.replace(ye, "");
|
|
363
398
|
if (r.length === 8) {
|
|
364
399
|
let e = parseInt(r.slice(0, 4), 10);
|
|
365
400
|
return e >= 1e3 && e <= 9999 ? `${r.slice(0, 4)}-${r.slice(4, 6)}-${r.slice(6, 8)}` : `${r.slice(4, 8)}-${r.slice(0, 2)}-${r.slice(2, 4)}`;
|
|
@@ -368,7 +403,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
368
403
|
},
|
|
369
404
|
validate(e) {
|
|
370
405
|
if (typeof e != "string") return !1;
|
|
371
|
-
let t =
|
|
406
|
+
let t = L.normalize(e);
|
|
372
407
|
if (!I.test(t)) return !1;
|
|
373
408
|
let n = /* @__PURE__ */ new Date(`${t}T00:00:00Z`);
|
|
374
409
|
return !isNaN(n.getTime()) && n.toISOString().startsWith(t);
|
|
@@ -389,11 +424,11 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
389
424
|
return e;
|
|
390
425
|
}
|
|
391
426
|
}
|
|
392
|
-
},
|
|
427
|
+
}, be = /^([01]?\d|2[0-3]):([0-5]\d)$/, R = {
|
|
393
428
|
normalize(e) {
|
|
394
429
|
if (typeof e != "string") return "";
|
|
395
430
|
let t = e.trim();
|
|
396
|
-
if (
|
|
431
|
+
if (be.test(t)) {
|
|
397
432
|
let [e, n] = t.split(":");
|
|
398
433
|
return `${String(parseInt(e, 10)).padStart(2, "0")}:${n}`;
|
|
399
434
|
}
|
|
@@ -405,7 +440,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
405
440
|
return "";
|
|
406
441
|
},
|
|
407
442
|
validate(e) {
|
|
408
|
-
return
|
|
443
|
+
return R.normalize(e) !== "";
|
|
409
444
|
},
|
|
410
445
|
format(e, t = {}) {
|
|
411
446
|
if (typeof e != "string") return "";
|
|
@@ -416,32 +451,32 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
416
451
|
let a = r < 12 ? "AM" : "PM";
|
|
417
452
|
return `${r % 12 || 12}:${i} ${a}`;
|
|
418
453
|
}
|
|
419
|
-
},
|
|
454
|
+
}, z = {
|
|
420
455
|
PLAIN: "plain",
|
|
421
456
|
CREDIT_CARD: "creditCard",
|
|
422
457
|
PHONE: "phone",
|
|
423
458
|
CURRENCY: "currency",
|
|
424
459
|
DATE: "date",
|
|
425
460
|
TIME: "time"
|
|
426
|
-
},
|
|
427
|
-
[
|
|
428
|
-
[
|
|
429
|
-
[
|
|
430
|
-
[
|
|
431
|
-
[
|
|
432
|
-
[
|
|
433
|
-
]),
|
|
434
|
-
type:
|
|
461
|
+
}, B = new Map([
|
|
462
|
+
[z.PLAIN, le],
|
|
463
|
+
[z.CREDIT_CARD, me],
|
|
464
|
+
[z.PHONE, ge],
|
|
465
|
+
[z.CURRENCY, F],
|
|
466
|
+
[z.DATE, L],
|
|
467
|
+
[z.TIME, R]
|
|
468
|
+
]), V = {
|
|
469
|
+
type: z.PLAIN,
|
|
435
470
|
options: {}
|
|
436
|
-
},
|
|
471
|
+
}, H = class extends j {
|
|
437
472
|
static register(e, t) {
|
|
438
|
-
|
|
473
|
+
B.set(e, t);
|
|
439
474
|
}
|
|
440
475
|
constructor(e, t = {}) {
|
|
441
|
-
super(e, t), this.type = t.type ??
|
|
476
|
+
super(e, t), this.type = t.type ?? V.type, this.options = t.options ?? V.options, this.enhance();
|
|
442
477
|
}
|
|
443
478
|
enhance() {
|
|
444
|
-
let e = this, t =
|
|
479
|
+
let e = this, t = B.get(e.type) ?? B.get(z.PLAIN), n = {
|
|
445
480
|
normalize: (n) => t.normalize?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
446
481
|
validate: (n) => t.validate?.(n, e.options) ?? !0,
|
|
447
482
|
format: (n) => t.format?.(n, e.options) ?? (typeof n == "string" ? n : ""),
|
|
@@ -455,7 +490,25 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
455
490
|
configurable: !0
|
|
456
491
|
});
|
|
457
492
|
}
|
|
458
|
-
},
|
|
493
|
+
}, U = (e, t) => new H(e, t);
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region src/plumbers/plumber/date.js
|
|
496
|
+
function W(e) {
|
|
497
|
+
return e instanceof Date && !isNaN(e);
|
|
498
|
+
}
|
|
499
|
+
function G(...e) {
|
|
500
|
+
if (e.length === 0) throw "Missing values to parse as date";
|
|
501
|
+
if (e.length === 1) {
|
|
502
|
+
let t = new Date(e[0]);
|
|
503
|
+
if (e[0] && W(t)) return t;
|
|
504
|
+
} else {
|
|
505
|
+
let t = new Date(...e);
|
|
506
|
+
if (W(t)) return t;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/plumbers/calendar.js
|
|
511
|
+
var K = 7, q = {
|
|
459
512
|
locales: ["default"],
|
|
460
513
|
today: "",
|
|
461
514
|
day: null,
|
|
@@ -470,15 +523,15 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
470
523
|
disabledYears: [],
|
|
471
524
|
firstDayOfWeek: 0,
|
|
472
525
|
onNavigated: "navigated"
|
|
473
|
-
},
|
|
526
|
+
}, xe = class extends j {
|
|
474
527
|
constructor(e, t = {}) {
|
|
475
528
|
super(e, t);
|
|
476
|
-
let n = Object.assign({},
|
|
477
|
-
this.onNavigated = r, this.since =
|
|
529
|
+
let n = Object.assign({}, q, t), { onNavigated: r, since: i, till: a, firstDayOfWeek: o } = n;
|
|
530
|
+
this.onNavigated = r, this.since = G(i), this.till = G(a), this.firstDayOfWeek = 0 <= o && o < 7 ? o : q.firstDayOfWeek;
|
|
478
531
|
let { disabledDates: s, disabledWeekdays: c, disabledDays: l, disabledMonths: u, disabledYears: d } = n;
|
|
479
532
|
this.disabledDates = Array.isArray(s) ? s : [], this.disabledWeekdays = Array.isArray(c) ? c : [], this.disabledDays = Array.isArray(l) ? l : [], this.disabledMonths = Array.isArray(u) ? u : [], this.disabledYears = Array.isArray(d) ? d : [];
|
|
480
533
|
let { today: f, day: p, month: m, year: h } = n;
|
|
481
|
-
this.now =
|
|
534
|
+
this.now = G(f) || /* @__PURE__ */ new Date(), typeof h == "number" && typeof m == "number" && typeof p == "number" ? this.current = G(h, m, p) : this.current = this.now, this.build(), this.enhance();
|
|
482
535
|
}
|
|
483
536
|
build() {
|
|
484
537
|
this.daysOfWeek = this.buildDaysOfWeek(), this.daysOfMonth = this.buildDaysOfMonth(), this.monthsOfYear = this.buildMonthsOfYear();
|
|
@@ -514,7 +567,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
514
567
|
let a = new Date(t, e, i);
|
|
515
568
|
n.push(r(a));
|
|
516
569
|
}
|
|
517
|
-
let s = n.length %
|
|
570
|
+
let s = n.length % K, c = s === 0 ? 0 : K - s;
|
|
518
571
|
for (let i = 1; i <= c; i++) {
|
|
519
572
|
let a = new Date(t, e + 1, i);
|
|
520
573
|
n.push(r(a));
|
|
@@ -539,18 +592,18 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
539
592
|
return this.now;
|
|
540
593
|
}
|
|
541
594
|
set today(e) {
|
|
542
|
-
if (!
|
|
595
|
+
if (!W(e)) return;
|
|
543
596
|
let t = this.month ? this.month : e.getMonth(), n = this.year ? this.year : e.getFullYear(), r = t == e.getMonth() && n == e.getFullYear(), i = this.hasDayValue ? this.day : r ? e.getDate() : 1;
|
|
544
597
|
this.now = new Date(n, t, i).toISOString();
|
|
545
598
|
}
|
|
546
599
|
get current() {
|
|
547
|
-
return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ?
|
|
600
|
+
return typeof this.year == "number" && typeof this.month == "number" && typeof this.day == "number" ? G(this.year, this.month, this.day) : null;
|
|
548
601
|
}
|
|
549
602
|
set current(e) {
|
|
550
|
-
|
|
603
|
+
W(e) && (this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear());
|
|
551
604
|
}
|
|
552
605
|
navigate = async (e) => {
|
|
553
|
-
if (!
|
|
606
|
+
if (!W(e)) return;
|
|
554
607
|
let t = this.current, n = e.toISOString(), r = t.toISOString();
|
|
555
608
|
this.dispatch("navigate", { detail: {
|
|
556
609
|
from: r,
|
|
@@ -581,7 +634,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
581
634
|
await this.navigate(n);
|
|
582
635
|
};
|
|
583
636
|
isDisabled = (e) => {
|
|
584
|
-
if (!
|
|
637
|
+
if (!W(e)) return !1;
|
|
585
638
|
if (this.disabledDates.length) {
|
|
586
639
|
let t = e.getTime();
|
|
587
640
|
for (let e of this.disabledDates) if (t === new Date(e).getTime()) return !0;
|
|
@@ -611,7 +664,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
611
664
|
return !1;
|
|
612
665
|
};
|
|
613
666
|
isWithinRange = (e) => {
|
|
614
|
-
if (!
|
|
667
|
+
if (!W(e)) return !1;
|
|
615
668
|
let t = !0;
|
|
616
669
|
return this.since && (t &&= e >= this.since), this.till && (t &&= e <= this.till), t;
|
|
617
670
|
};
|
|
@@ -674,84 +727,41 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
674
727
|
};
|
|
675
728
|
} });
|
|
676
729
|
}
|
|
677
|
-
},
|
|
678
|
-
constructor(e, t = {}) {
|
|
679
|
-
super(e, t), this.debounceTimer = null, this.abortController = null;
|
|
680
|
-
}
|
|
681
|
-
fuzzyFilter(e, t) {
|
|
682
|
-
let n = t.toLowerCase(), r = 0;
|
|
683
|
-
return e.querySelectorAll("[role=\"option\"]").forEach((e) => {
|
|
684
|
-
let t = this.fuzzyMatch(n, e.textContent.trim().toLowerCase());
|
|
685
|
-
e.hidden = !t, t && r++;
|
|
686
|
-
}), r;
|
|
687
|
-
}
|
|
688
|
-
fuzzyMatch(e, t) {
|
|
689
|
-
let n = 0;
|
|
690
|
-
for (let r = 0; r < t.length && n < e.length; r++) t[r] === e[n] && n++;
|
|
691
|
-
return n === e.length;
|
|
692
|
-
}
|
|
693
|
-
scheduleFetch(e, t, n) {
|
|
694
|
-
clearTimeout(this.debounceTimer), this.debounceTimer = setTimeout(() => this.fetch(e, n), t);
|
|
695
|
-
}
|
|
696
|
-
async fetch(e, { url: t, field: n, onLoading: r, onLoaded: i, onError: a }) {
|
|
697
|
-
this.abortController?.abort(), this.abortController = new AbortController(), r?.(!0);
|
|
698
|
-
let o = new URL(t, window.location.href);
|
|
699
|
-
o.searchParams.set(n, e);
|
|
700
|
-
try {
|
|
701
|
-
let e = await fetch(o, {
|
|
702
|
-
signal: this.abortController.signal,
|
|
703
|
-
headers: {
|
|
704
|
-
Accept: "text/html",
|
|
705
|
-
"X-Requested-With": "XMLHttpRequest"
|
|
706
|
-
}
|
|
707
|
-
});
|
|
708
|
-
if (!e.ok) throw Error(`${e.status}`);
|
|
709
|
-
i?.(await e.text());
|
|
710
|
-
} catch (e) {
|
|
711
|
-
e.name !== "AbortError" && a?.(e);
|
|
712
|
-
} finally {
|
|
713
|
-
r?.(!1);
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
cancel() {
|
|
717
|
-
clearTimeout(this.debounceTimer), this.abortController?.abort();
|
|
718
|
-
}
|
|
719
|
-
}, ge = (e, t) => new he(e, t), Y = {
|
|
730
|
+
}, Se = (e, t) => new xe(e, t), J = {
|
|
720
731
|
content: null,
|
|
721
732
|
url: "",
|
|
722
733
|
reload: "never",
|
|
723
734
|
stale: 3600,
|
|
724
735
|
onLoad: "canLoad",
|
|
725
|
-
onLoading: "contentLoading",
|
|
726
736
|
onLoaded: "contentLoaded"
|
|
727
|
-
},
|
|
737
|
+
}, Ce = class extends j {
|
|
728
738
|
constructor(e, t = {}) {
|
|
729
739
|
super(e, t);
|
|
730
|
-
let n = Object.assign({},
|
|
731
|
-
this.content = r, this.url = i, this.reload = typeof a == "string" ? a :
|
|
732
|
-
let { onLoad: s,
|
|
733
|
-
this.onLoad = s, this.
|
|
740
|
+
let n = Object.assign({}, J, t), { content: r, url: i, reload: a, stale: o } = n;
|
|
741
|
+
this.content = r, this.url = i, this.reload = typeof a == "string" ? a : J.reload, this.stale = typeof o == "number" ? o : J.stale;
|
|
742
|
+
let { onLoad: s, onLoaded: c } = n;
|
|
743
|
+
this.onLoad = s, this.onLoaded = c, this._requestor = new w(), this.enhance();
|
|
734
744
|
}
|
|
735
745
|
get reloadable() {
|
|
736
746
|
switch (this.reload) {
|
|
737
747
|
case "never": return !1;
|
|
738
748
|
case "always": return !0;
|
|
739
749
|
default: {
|
|
740
|
-
let e =
|
|
750
|
+
let e = G(this.loadedAt);
|
|
741
751
|
return e && /* @__PURE__ */ new Date() - e > this.stale * 1e3;
|
|
742
752
|
}
|
|
743
753
|
}
|
|
744
754
|
}
|
|
745
755
|
contentLoadable = ({ url: e }) => !!e;
|
|
746
|
-
contentLoading = async ({ url: e }) => e ? await this.remoteContentLoader(e) : await this.contentLoader();
|
|
747
756
|
contentLoader = async () => "";
|
|
748
|
-
remoteContentLoader = async (e) => (await
|
|
757
|
+
remoteContentLoader = async (e) => (await this._requestor.request(e)).text();
|
|
749
758
|
load = async () => {
|
|
750
759
|
if (this.loadedAt && !this.reloadable) return;
|
|
751
760
|
let e = this.findCallback(this.onLoad), t = await this.awaitCallback(e || this.contentLoadable, { url: this.url });
|
|
752
761
|
if (this.dispatch("load", { detail: { url: this.url } }), !t) return;
|
|
762
|
+
this.dispatch("loading", { detail: { url: this.url } });
|
|
753
763
|
let n = this.url ? await this.remoteContentLoader(this.url) : await this.contentLoader();
|
|
754
|
-
|
|
764
|
+
n && (await this.awaitCallback(this.onLoaded, {
|
|
755
765
|
url: this.url,
|
|
756
766
|
content: n
|
|
757
767
|
}), this.loadedAt = (/* @__PURE__ */ new Date()).getTime(), this.dispatch("loaded", { detail: {
|
|
@@ -763,37 +773,34 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
763
773
|
let e = this;
|
|
764
774
|
Object.assign(this.controller, { load: e.load.bind(e) });
|
|
765
775
|
}
|
|
766
|
-
},
|
|
776
|
+
}, we = (e, t) => new Ce(e, t), Y = class extends j {
|
|
777
|
+
observe(e) {
|
|
778
|
+
this._handler = e, this.events.forEach((t) => window.addEventListener(t, e, !0));
|
|
779
|
+
}
|
|
780
|
+
unobserve() {
|
|
781
|
+
this._handler && this.events.forEach((e) => window.removeEventListener(e, this._handler, !0));
|
|
782
|
+
}
|
|
783
|
+
enhance() {
|
|
784
|
+
let e = this, t = this.controller.disconnect?.bind(this.controller) || (() => {});
|
|
785
|
+
this.controller.disconnect = () => {
|
|
786
|
+
e.unobserve(), t();
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
}, Te = {
|
|
767
790
|
trigger: null,
|
|
768
791
|
events: ["click"],
|
|
769
792
|
onDismissed: "dismissed"
|
|
770
|
-
},
|
|
793
|
+
}, Ee = class extends Y {
|
|
771
794
|
constructor(e, t = {}) {
|
|
772
795
|
super(e, t);
|
|
773
|
-
let { trigger: n, events: r, onDismissed: i } = Object.assign({},
|
|
774
|
-
this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe();
|
|
796
|
+
let { trigger: n, events: r, onDismissed: i } = Object.assign({}, Te, t);
|
|
797
|
+
this.onDismissed = i, this.trigger = n || this.element, this.events = r, this.enhance(), this.observe(this.dismiss);
|
|
775
798
|
}
|
|
776
799
|
dismiss = async (e) => {
|
|
777
800
|
let { target: t } = e;
|
|
778
801
|
t instanceof HTMLElement && (this.element.contains(t) || this.visible && (this.dispatch("dismiss"), await this.awaitCallback(this.onDismissed, { target: this.trigger }), this.dispatch("dismissed")));
|
|
779
802
|
};
|
|
780
|
-
|
|
781
|
-
this.events.forEach((e) => {
|
|
782
|
-
window.addEventListener(e, this.dismiss, !0);
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
unobserve() {
|
|
786
|
-
this.events.forEach((e) => {
|
|
787
|
-
window.removeEventListener(e, this.dismiss, !0);
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
enhance() {
|
|
791
|
-
let e = this, t = e.controller.disconnect.bind(e.controller);
|
|
792
|
-
Object.assign(this.controller, { disconnect: () => {
|
|
793
|
-
e.unobserve(), t();
|
|
794
|
-
} });
|
|
795
|
-
}
|
|
796
|
-
}, X = (e, t) => new be(e, t), xe = {
|
|
803
|
+
}, X = (e, t) => new Ee(e, t), De = {
|
|
797
804
|
anchor: null,
|
|
798
805
|
events: ["click"],
|
|
799
806
|
placement: "bottom",
|
|
@@ -801,15 +808,15 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
801
808
|
onFlipped: "flipped",
|
|
802
809
|
ariaRole: null,
|
|
803
810
|
respectMotion: !0
|
|
804
|
-
},
|
|
811
|
+
}, Oe = class extends Y {
|
|
805
812
|
constructor(e, t = {}) {
|
|
806
813
|
super(e, t);
|
|
807
|
-
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({},
|
|
808
|
-
this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element &&
|
|
814
|
+
let { anchor: n, events: r, placement: i, alignment: a, onFlipped: o, ariaRole: s, respectMotion: c } = Object.assign({}, De, t);
|
|
815
|
+
this.anchor = n, this.events = r, this.placement = i, this.alignment = a, this.onFlipped = o, this.ariaRole = s, this.respectMotion = c, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.anchor && this.element && S({
|
|
809
816
|
trigger: this.anchor,
|
|
810
817
|
target: this.element,
|
|
811
818
|
role: this.ariaRole
|
|
812
|
-
}), this.enhance(), this.observe();
|
|
819
|
+
}), this.enhance(), this.observe(this.flip);
|
|
813
820
|
}
|
|
814
821
|
flip = async () => {
|
|
815
822
|
if (!this.visible) return;
|
|
@@ -823,7 +830,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
823
830
|
}), this.dispatch("flipped", { detail: { placement: e } });
|
|
824
831
|
};
|
|
825
832
|
flippedRect(e, t) {
|
|
826
|
-
let n = this.quadrumRect(e,
|
|
833
|
+
let n = this.quadrumRect(e, k()), r = [this.placement, D[this.placement]], i = {};
|
|
827
834
|
for (; !Object.keys(i).length && r.length > 0;) {
|
|
828
835
|
let a = r.shift();
|
|
829
836
|
if (!this.biggerRectThan(n[a], t)) continue;
|
|
@@ -834,25 +841,25 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
834
841
|
}
|
|
835
842
|
quadrumRect(e, t) {
|
|
836
843
|
return {
|
|
837
|
-
left:
|
|
844
|
+
left: O({
|
|
838
845
|
x: t.x,
|
|
839
846
|
y: t.y,
|
|
840
847
|
width: e.x - t.x,
|
|
841
848
|
height: t.height
|
|
842
849
|
}),
|
|
843
|
-
right:
|
|
850
|
+
right: O({
|
|
844
851
|
x: e.x + e.width,
|
|
845
852
|
y: t.y,
|
|
846
853
|
width: t.width - (e.x + e.width),
|
|
847
854
|
height: t.height
|
|
848
855
|
}),
|
|
849
|
-
top:
|
|
856
|
+
top: O({
|
|
850
857
|
x: t.x,
|
|
851
858
|
y: t.y,
|
|
852
859
|
width: t.width,
|
|
853
860
|
height: e.y - t.y
|
|
854
861
|
}),
|
|
855
|
-
bottom:
|
|
862
|
+
bottom: O({
|
|
856
863
|
x: t.x,
|
|
857
864
|
y: e.y + e.height,
|
|
858
865
|
width: t.width,
|
|
@@ -862,25 +869,25 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
862
869
|
}
|
|
863
870
|
quadrumPlacement(e, t, n) {
|
|
864
871
|
switch (t) {
|
|
865
|
-
case "top": return
|
|
872
|
+
case "top": return O({
|
|
866
873
|
x: n.x,
|
|
867
874
|
y: e.y - n.height,
|
|
868
875
|
width: n.width,
|
|
869
876
|
height: n.height
|
|
870
877
|
});
|
|
871
|
-
case "bottom": return
|
|
878
|
+
case "bottom": return O({
|
|
872
879
|
x: n.x,
|
|
873
880
|
y: e.y + e.height,
|
|
874
881
|
width: n.width,
|
|
875
882
|
height: n.height
|
|
876
883
|
});
|
|
877
|
-
case "left": return
|
|
884
|
+
case "left": return O({
|
|
878
885
|
x: e.x - n.width,
|
|
879
886
|
y: n.y,
|
|
880
887
|
width: n.width,
|
|
881
888
|
height: n.height
|
|
882
889
|
});
|
|
883
|
-
case "right": return
|
|
890
|
+
case "right": return O({
|
|
884
891
|
x: e.x + e.width,
|
|
885
892
|
y: n.y,
|
|
886
893
|
width: n.width,
|
|
@@ -894,7 +901,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
894
901
|
case "top":
|
|
895
902
|
case "bottom": {
|
|
896
903
|
let t = e.x;
|
|
897
|
-
return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width),
|
|
904
|
+
return this.alignment === "center" ? t = e.x + e.width / 2 - n.width / 2 : this.alignment === "end" && (t = e.x + e.width - n.width), O({
|
|
898
905
|
x: t,
|
|
899
906
|
y: n.y,
|
|
900
907
|
width: n.width,
|
|
@@ -904,7 +911,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
904
911
|
case "left":
|
|
905
912
|
case "right": {
|
|
906
913
|
let t = e.y;
|
|
907
|
-
return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height),
|
|
914
|
+
return this.alignment === "center" ? t = e.y + e.height / 2 - n.height / 2 : this.alignment === "end" && (t = e.y + e.height - n.height), O({
|
|
908
915
|
x: n.x,
|
|
909
916
|
y: t,
|
|
910
917
|
width: n.width,
|
|
@@ -917,26 +924,10 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
917
924
|
biggerRectThan(e, t) {
|
|
918
925
|
return e.height >= t.height && e.width >= t.width;
|
|
919
926
|
}
|
|
920
|
-
observe() {
|
|
921
|
-
this.events.forEach((e) => {
|
|
922
|
-
window.addEventListener(e, this.flip, !0);
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
unobserve() {
|
|
926
|
-
this.events.forEach((e) => {
|
|
927
|
-
window.removeEventListener(e, this.flip, !0);
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
927
|
enhance() {
|
|
931
|
-
|
|
932
|
-
Object.assign(this.controller, {
|
|
933
|
-
disconnect: () => {
|
|
934
|
-
e.unobserve(), t();
|
|
935
|
-
},
|
|
936
|
-
flip: e.flip.bind(e)
|
|
937
|
-
});
|
|
928
|
+
super.enhance(), this.controller.flip = this.flip;
|
|
938
929
|
}
|
|
939
|
-
},
|
|
930
|
+
}, ke = (e, t) => new Oe(e, t), Ae = {
|
|
940
931
|
events: ["resize"],
|
|
941
932
|
boundaries: [
|
|
942
933
|
"top",
|
|
@@ -945,11 +936,11 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
945
936
|
],
|
|
946
937
|
onShifted: "shifted",
|
|
947
938
|
respectMotion: !0
|
|
948
|
-
},
|
|
939
|
+
}, je = class extends Y {
|
|
949
940
|
constructor(e, t = {}) {
|
|
950
941
|
super(e, t);
|
|
951
|
-
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({},
|
|
952
|
-
this.onShifted = n, this.events = r, this.boundaries = i, this.respectMotion = a, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.enhance(), this.observe();
|
|
942
|
+
let { onShifted: n, events: r, boundaries: i, respectMotion: a } = Object.assign({}, Ae, t);
|
|
943
|
+
this.onShifted = n, this.events = r, this.boundaries = i, this.respectMotion = a, this.prefersReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.enhance(), this.observe(this.shift);
|
|
953
944
|
}
|
|
954
945
|
shift = async () => {
|
|
955
946
|
if (!this.visible) return;
|
|
@@ -958,14 +949,14 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
958
949
|
this.element.style.transition = this.respectMotion && this.prefersReducedMotion ? "none" : "", this.element.style.transform = `translate(${t}px, ${n}px)`, await this.awaitCallback(this.onShifted, e), this.dispatch("shifted", { detail: e });
|
|
959
950
|
};
|
|
960
951
|
overflowRect(e, t) {
|
|
961
|
-
let n = {}, r =
|
|
952
|
+
let n = {}, r = k(), i = O({
|
|
962
953
|
x: e.x - t.x,
|
|
963
954
|
y: e.y - t.y,
|
|
964
955
|
width: e.width,
|
|
965
956
|
height: e.height
|
|
966
957
|
});
|
|
967
958
|
for (let e of this.boundaries) {
|
|
968
|
-
let t = this.directionDistance(i, e, r), a =
|
|
959
|
+
let t = this.directionDistance(i, e, r), a = D[e];
|
|
969
960
|
t < 0 ? i[a] + t >= r[a] && !n[a] && (n[e] = t) : n[e] = "";
|
|
970
961
|
}
|
|
971
962
|
return n;
|
|
@@ -994,42 +985,26 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
994
985
|
y: 0
|
|
995
986
|
};
|
|
996
987
|
}
|
|
997
|
-
observe() {
|
|
998
|
-
this.events.forEach((e) => {
|
|
999
|
-
window.addEventListener(e, this.shift, !0);
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
unobserve() {
|
|
1003
|
-
this.events.forEach((e) => {
|
|
1004
|
-
window.removeEventListener(e, this.shift, !0);
|
|
1005
|
-
});
|
|
1006
|
-
}
|
|
1007
988
|
enhance() {
|
|
1008
|
-
|
|
1009
|
-
Object.assign(this.controller, {
|
|
1010
|
-
disconnect: () => {
|
|
1011
|
-
e.unobserve(), t();
|
|
1012
|
-
},
|
|
1013
|
-
shift: e.shift.bind(e)
|
|
1014
|
-
});
|
|
989
|
+
super.enhance(), this.controller.shift = this.shift;
|
|
1015
990
|
}
|
|
1016
|
-
},
|
|
991
|
+
}, Me = (e, t) => new je(e, t), Z = {
|
|
1017
992
|
visibility: "visibility",
|
|
1018
993
|
onShown: "shown",
|
|
1019
994
|
onHidden: "hidden"
|
|
1020
|
-
},
|
|
995
|
+
}, Ne = class extends j {
|
|
1021
996
|
constructor(e, t = {}) {
|
|
1022
997
|
let { visibility: n, onShown: r, onHidden: i, activator: a } = Object.assign({}, Z, t), o = typeof n == "string" ? n : Z.namespace, s = typeof t.visible == "string" ? t.visible : "isVisible";
|
|
1023
998
|
(typeof t.visible != "boolean" || t.visible) && (t.visible = `${o}.${s}`), super(e, t), this.visibility = o, this.visibilityResolver = s, this.onShown = r, this.onHidden = i, this.activator = a instanceof HTMLElement ? a : null, this.enhance(), this.element instanceof HTMLElement && this.activate(this.isVisible(this.element));
|
|
1024
999
|
}
|
|
1025
1000
|
isVisible(e) {
|
|
1026
1001
|
if (!(e instanceof HTMLElement)) return !1;
|
|
1027
|
-
let t =
|
|
1002
|
+
let t = A.hiddenClass;
|
|
1028
1003
|
return t ? !e.classList.contains(t) : !e.hasAttribute("hidden");
|
|
1029
1004
|
}
|
|
1030
1005
|
toggle(e, t) {
|
|
1031
1006
|
if (!(e instanceof HTMLElement)) return;
|
|
1032
|
-
let n =
|
|
1007
|
+
let n = A.hiddenClass;
|
|
1033
1008
|
n ? t ? e.classList.remove(n) : e.classList.add(n) : t ? e.removeAttribute("hidden") : e.setAttribute("hidden", !0);
|
|
1034
1009
|
}
|
|
1035
1010
|
activate(e) {
|
|
@@ -1052,9 +1027,13 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1052
1027
|
return t;
|
|
1053
1028
|
} });
|
|
1054
1029
|
}
|
|
1055
|
-
}, Q = (e, t) => new
|
|
1030
|
+
}, Q = (e, t) => new Ne(e, t), Pe = class extends e {
|
|
1056
1031
|
static targets = ["daysOfWeek", "daysOfMonth"];
|
|
1057
|
-
static classes = [
|
|
1032
|
+
static classes = [
|
|
1033
|
+
"dayOfWeek",
|
|
1034
|
+
"dayOfMonth",
|
|
1035
|
+
"week"
|
|
1036
|
+
];
|
|
1058
1037
|
static values = {
|
|
1059
1038
|
locales: {
|
|
1060
1039
|
type: Array,
|
|
@@ -1074,7 +1053,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1074
1053
|
}
|
|
1075
1054
|
};
|
|
1076
1055
|
initialize() {
|
|
1077
|
-
|
|
1056
|
+
Se(this);
|
|
1078
1057
|
}
|
|
1079
1058
|
connect() {
|
|
1080
1059
|
this.draw();
|
|
@@ -1097,7 +1076,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1097
1076
|
r.setAttribute("role", "columnheader"), r.title = n.long, this.hasDayOfWeekClass && r.classList.add(...this.dayOfWeekClasses), t.push(r);
|
|
1098
1077
|
}
|
|
1099
1078
|
let n = document.createElement("div");
|
|
1100
|
-
n.setAttribute("role", "row"), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
|
|
1079
|
+
n.setAttribute("role", "row"), this.hasWeekClass && n.classList.add(...this.weekClasses), n.replaceChildren(...t), this.daysOfWeekTarget.replaceChildren(n);
|
|
1101
1080
|
}
|
|
1102
1081
|
drawDaysOfMonth() {
|
|
1103
1082
|
if (!this.hasDaysOfMonthTarget) return;
|
|
@@ -1114,13 +1093,13 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1114
1093
|
let r = [];
|
|
1115
1094
|
for (let e = 0; e < n.length; e += 7) {
|
|
1116
1095
|
let t = document.createElement("div");
|
|
1117
|
-
t.setAttribute("role", "row");
|
|
1096
|
+
t.setAttribute("role", "row"), this.hasWeekClass && t.classList.add(...this.weekClasses);
|
|
1118
1097
|
for (let r of n.slice(e, e + 7)) r.setAttribute("role", "gridcell"), t.appendChild(r);
|
|
1119
1098
|
r.push(t);
|
|
1120
1099
|
}
|
|
1121
1100
|
this.daysOfMonthTarget.replaceChildren(...r);
|
|
1122
1101
|
}
|
|
1123
|
-
},
|
|
1102
|
+
}, Fe = class extends e {
|
|
1124
1103
|
onSelect(e) {
|
|
1125
1104
|
if (!(e.target instanceof HTMLElement)) return;
|
|
1126
1105
|
e.preventDefault();
|
|
@@ -1129,18 +1108,18 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1129
1108
|
this.dispatch("selecting", { target: t });
|
|
1130
1109
|
let n = e.target instanceof HTMLTimeElement ? e.target : e.target.querySelector("time");
|
|
1131
1110
|
if (!n) return console.error(`unable to locate time element within ${t}`);
|
|
1132
|
-
let r =
|
|
1111
|
+
let r = G(n.dateTime);
|
|
1133
1112
|
if (!r) return console.error(`unable to parse ${n.dateTime} found within the time element`);
|
|
1134
1113
|
this.select(r.toISOString());
|
|
1135
1114
|
}
|
|
1136
1115
|
select(e) {
|
|
1137
|
-
let t =
|
|
1116
|
+
let t = G(e);
|
|
1138
1117
|
t && this.dispatch("selected", { detail: {
|
|
1139
1118
|
epoch: t.getTime(),
|
|
1140
1119
|
iso: e
|
|
1141
1120
|
} });
|
|
1142
1121
|
}
|
|
1143
|
-
},
|
|
1122
|
+
}, Ie = class extends e {
|
|
1144
1123
|
static targets = ["source"];
|
|
1145
1124
|
static values = { type: {
|
|
1146
1125
|
type: String,
|
|
@@ -1170,7 +1149,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1170
1149
|
});
|
|
1171
1150
|
}
|
|
1172
1151
|
}
|
|
1173
|
-
},
|
|
1152
|
+
}, Le = class extends e {
|
|
1174
1153
|
static targets = [
|
|
1175
1154
|
"previous",
|
|
1176
1155
|
"next",
|
|
@@ -1203,7 +1182,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1203
1182
|
}
|
|
1204
1183
|
async calendarMonthOutletConnected() {
|
|
1205
1184
|
if (this.dateValue) {
|
|
1206
|
-
let e =
|
|
1185
|
+
let e = G(this.dateValue);
|
|
1207
1186
|
e && await this.calendarMonthOutlet.calendar.navigate(e);
|
|
1208
1187
|
}
|
|
1209
1188
|
this.draw();
|
|
@@ -1250,7 +1229,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1250
1229
|
let { year: e } = this.calendarMonthOutlet.calendar;
|
|
1251
1230
|
this.yearTarget.textContent = new Intl.DateTimeFormat(this.localesValue, { year: this.yearFormatValue }).format(new Date(e, 0));
|
|
1252
1231
|
}
|
|
1253
|
-
},
|
|
1232
|
+
}, $ = class extends e {
|
|
1254
1233
|
static targets = [
|
|
1255
1234
|
"listbox",
|
|
1256
1235
|
"loading",
|
|
@@ -1271,7 +1250,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1271
1250
|
}
|
|
1272
1251
|
};
|
|
1273
1252
|
initialize() {
|
|
1274
|
-
this.
|
|
1253
|
+
this._requestor = new w();
|
|
1275
1254
|
}
|
|
1276
1255
|
onSelect(e) {
|
|
1277
1256
|
let t = e.target.closest("[role=\"option\"]");
|
|
@@ -1307,17 +1286,15 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1307
1286
|
!i || i === n || (t.forEach((e) => e.setAttribute("aria-selected", "false")), i.setAttribute("aria-selected", "true"), i.scrollIntoView({ block: "nearest" }));
|
|
1308
1287
|
}
|
|
1309
1288
|
filter(e) {
|
|
1310
|
-
if (this.urlValue)
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
onLoading: (e) => this.setLoading(e),
|
|
1314
|
-
onLoaded: (e) => {
|
|
1289
|
+
if (this.urlValue) {
|
|
1290
|
+
let t = new URL(this.urlValue, window.location.href);
|
|
1291
|
+
t.searchParams.set(this.fieldValue, e), this.setLoading(!0), this._requestor.schedule(() => this._requestor.request(t).then((e) => e.text()).then((e) => {
|
|
1315
1292
|
this.listboxTarget.innerHTML = e, this.setEmpty(this.listboxTarget.querySelectorAll("[role=\"option\"]").length === 0);
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
else {
|
|
1320
|
-
let t =
|
|
1293
|
+
}).catch((e) => {
|
|
1294
|
+
e.name !== "AbortError" && console.error("[combobox-dropdown] fetch failed", e);
|
|
1295
|
+
}).finally(() => this.setLoading(!1)), this.delayValue);
|
|
1296
|
+
} else {
|
|
1297
|
+
let t = E(this.listboxTarget, e);
|
|
1321
1298
|
this.setEmpty(t === 0);
|
|
1322
1299
|
}
|
|
1323
1300
|
}
|
|
@@ -1331,9 +1308,9 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1331
1308
|
this.hasEmptyTarget && (this.emptyTarget.hidden = !e);
|
|
1332
1309
|
}
|
|
1333
1310
|
disconnect() {
|
|
1334
|
-
this.
|
|
1311
|
+
this._requestor.cancel();
|
|
1335
1312
|
}
|
|
1336
|
-
},
|
|
1313
|
+
}, Re = class extends e {
|
|
1337
1314
|
static targets = [
|
|
1338
1315
|
"hour",
|
|
1339
1316
|
"minute",
|
|
@@ -1369,12 +1346,12 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1369
1346
|
selectedValue(e) {
|
|
1370
1347
|
return e?.querySelector("[aria-selected=\"true\"]")?.dataset.value ?? null;
|
|
1371
1348
|
}
|
|
1372
|
-
},
|
|
1349
|
+
}, ze = class extends e {
|
|
1373
1350
|
static targets = ["trigger"];
|
|
1374
1351
|
connect() {
|
|
1375
1352
|
X(this, { trigger: this.hasTriggerTarget ? this.triggerTarget : null });
|
|
1376
1353
|
}
|
|
1377
|
-
},
|
|
1354
|
+
}, Be = class extends e {
|
|
1378
1355
|
static targets = ["anchor", "reference"];
|
|
1379
1356
|
static values = {
|
|
1380
1357
|
placement: {
|
|
@@ -1399,7 +1376,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1399
1376
|
console.error("FlipperController requires an anchor target. Add data-flipper-target=\"anchor\" to your element.");
|
|
1400
1377
|
return;
|
|
1401
1378
|
}
|
|
1402
|
-
|
|
1379
|
+
ke(this, {
|
|
1403
1380
|
element: this.referenceTarget,
|
|
1404
1381
|
anchor: this.anchorTarget,
|
|
1405
1382
|
placement: this.placementValue,
|
|
@@ -1407,7 +1384,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1407
1384
|
ariaRole: this.roleValue
|
|
1408
1385
|
});
|
|
1409
1386
|
}
|
|
1410
|
-
},
|
|
1387
|
+
}, Ve = class extends e {
|
|
1411
1388
|
static targets = [
|
|
1412
1389
|
"trigger",
|
|
1413
1390
|
"popover",
|
|
@@ -1460,7 +1437,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1460
1437
|
valueValueChanged(e) {
|
|
1461
1438
|
this.hasValueTarget && (this.valueTarget.value = e), this.dispatch("changed", { detail: { value: e } });
|
|
1462
1439
|
}
|
|
1463
|
-
},
|
|
1440
|
+
}, He = class extends e {
|
|
1464
1441
|
static targets = ["input", "toggle"];
|
|
1465
1442
|
static values = {
|
|
1466
1443
|
type: {
|
|
@@ -1477,19 +1454,19 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1477
1454
|
}
|
|
1478
1455
|
};
|
|
1479
1456
|
connect() {
|
|
1480
|
-
|
|
1457
|
+
U(this, {
|
|
1481
1458
|
type: this.typeValue,
|
|
1482
1459
|
options: this.optionsValue
|
|
1483
1460
|
}), this.format(this.readValue()), this.drawToggle();
|
|
1484
1461
|
}
|
|
1485
1462
|
typeValueChanged() {
|
|
1486
|
-
this.formatter && (
|
|
1463
|
+
this.formatter && (U(this, {
|
|
1487
1464
|
type: this.typeValue,
|
|
1488
1465
|
options: this.optionsValue
|
|
1489
1466
|
}), this.format(this.readValue()), this.drawToggle());
|
|
1490
1467
|
}
|
|
1491
1468
|
optionsValueChanged() {
|
|
1492
|
-
this.formatter && (
|
|
1469
|
+
this.formatter && (U(this, {
|
|
1493
1470
|
type: this.typeValue,
|
|
1494
1471
|
options: this.optionsValue
|
|
1495
1472
|
}), this.format(this.readValue()));
|
|
@@ -1515,7 +1492,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1515
1492
|
drawToggle() {
|
|
1516
1493
|
if (!this.hasToggleTarget) return;
|
|
1517
1494
|
let e = this.formatter?.maskable() || this.typeValue === "password";
|
|
1518
|
-
this.toggleTarget.hidden = !e, e &&
|
|
1495
|
+
this.toggleTarget.hidden = !e, e && _(this.toggleTarget, this.revealedValue);
|
|
1519
1496
|
}
|
|
1520
1497
|
readValue() {
|
|
1521
1498
|
return this.hasInputTarget ? this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value : this.inputTarget.textContent : "";
|
|
@@ -1529,7 +1506,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1529
1506
|
let t = this.formatter.normalize(e), n = this.revealedValue || !this.formatter.maskable() ? this.formatter.format(t) : this.formatter.mask(t);
|
|
1530
1507
|
this.hasInputTarget && (this.inputTarget instanceof HTMLInputElement ? this.inputTarget.value = n : this.inputTarget.textContent = n), this.dispatch("formatted", { detail: { value: n } });
|
|
1531
1508
|
}
|
|
1532
|
-
},
|
|
1509
|
+
}, Ue = class extends e {
|
|
1533
1510
|
static targets = ["input", "clear"];
|
|
1534
1511
|
initialize() {
|
|
1535
1512
|
this.onInput = this.draw.bind(this), this.onEscape = this.handleEscape.bind(this);
|
|
@@ -1552,7 +1529,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1552
1529
|
handleEscape(e) {
|
|
1553
1530
|
e.key === "Escape" && this.inputTarget.value !== "" && (e.preventDefault(), this.clear());
|
|
1554
1531
|
}
|
|
1555
|
-
},
|
|
1532
|
+
}, We = class extends e {
|
|
1556
1533
|
static targets = ["modal", "overlay"];
|
|
1557
1534
|
initialize() {
|
|
1558
1535
|
this.onCancel = this.close.bind(this);
|
|
@@ -1595,12 +1572,12 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1595
1572
|
let t = this.modalTarget.getBoundingClientRect();
|
|
1596
1573
|
(e.clientY < t.top || e.clientY > t.bottom || e.clientX < t.left || e.clientX > t.right) && this.close();
|
|
1597
1574
|
};
|
|
1598
|
-
},
|
|
1575
|
+
}, Ge = class extends e {
|
|
1599
1576
|
static targets = ["content"];
|
|
1600
1577
|
connect() {
|
|
1601
|
-
|
|
1578
|
+
Me(this, { element: this.hasContentTarget ? this.contentTarget : null });
|
|
1602
1579
|
}
|
|
1603
|
-
},
|
|
1580
|
+
}, Ke = class extends e {
|
|
1604
1581
|
static targets = [
|
|
1605
1582
|
"content",
|
|
1606
1583
|
"template",
|
|
@@ -1621,7 +1598,7 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1621
1598
|
}
|
|
1622
1599
|
};
|
|
1623
1600
|
connect() {
|
|
1624
|
-
|
|
1601
|
+
we(this, {
|
|
1625
1602
|
element: this.hasContentTarget ? this.contentTarget : null,
|
|
1626
1603
|
url: this.hasUrlValue ? this.urlValue : null
|
|
1627
1604
|
}), this.hasContentTarget && Q(this, {
|
|
@@ -1662,4 +1639,4 @@ var ae = /\D/g, oe = /^\d{13,19}$/, se = /(.{4})(?=.)/g, ce = {
|
|
|
1662
1639
|
}
|
|
1663
1640
|
};
|
|
1664
1641
|
//#endregion
|
|
1665
|
-
export {
|
|
1642
|
+
export { y as ARIA_HASPOPUP_VALUES, Pe as CalendarMonthController, Fe as CalendarMonthObserverController, Ie as ClipboardController, Le as ComboboxDateController, $ as ComboboxDropdownController, Re as ComboboxTimeController, ze as DismisserController, t as FOCUSABLE_SELECTOR, z as FORMATTER_TYPES, Be as FlipperController, o as FocusRestoration, a as FocusTrap, H as Formatter, Ve as InputComboboxController, He as InputFormatController, Ue as InputSearchController, We as ModalController, Ge as PannerController, Ke as PopoverController, w as Requestor, d as RovingTabIndex, p as announce, S as connectTriggerToTarget, ne as disconnectTriggerFromTarget, h as ensureId, E as filterOptions, i as focusFirst, T as fuzzyMatcher, m as generateId, n as getFocusableElements, c as isActivationKey, l as isArrowKey, s as isKey, r as isVisible, u as preventDefault, g as setAriaState, v as setChecked, te as setDisabled, ee as setExpanded, _ as setPressed };
|