@faqir-ui/core 1.1.1 → 1.2.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.
- package/README.md +9 -8
- package/cdn.json +41 -36
- package/dist/faqir-core.js +568 -394
- package/dist/faqir-core.min.js +3 -3
- package/dist/faqir-core.min.js.map +3 -3
- package/dist/faqir-core.mjs +651 -532
- package/dist/faqir.aurora.css +6436 -1401
- package/dist/faqir.brutalist.css +6436 -1401
- package/dist/faqir.candy.css +6436 -1401
- package/dist/faqir.clay.css +19164 -0
- package/dist/faqir.clinical.css +6436 -1401
- package/dist/faqir.contrast.css +6436 -1401
- package/dist/faqir.deco.css +19247 -0
- package/dist/faqir.default.css +6436 -1401
- package/dist/faqir.document-serif.css +6436 -1401
- package/dist/faqir.document.css +6437 -1401
- package/dist/faqir.editorial-document.css +6436 -1401
- package/dist/faqir.editorial.css +6436 -1401
- package/dist/faqir.fintech.css +6436 -1401
- package/dist/faqir.glass.css +6436 -1401
- package/dist/faqir.ink-document.css +6436 -1401
- package/dist/faqir.ink.css +6436 -1401
- package/dist/faqir.luxe.css +6436 -1401
- package/dist/faqir.memphis.css +19163 -0
- package/dist/faqir.midnight.css +6436 -1401
- package/dist/faqir.monolith.css +19162 -0
- package/dist/faqir.neo.css +6436 -1401
- package/dist/faqir.neumorph.css +6436 -1401
- package/dist/faqir.nordic.css +6436 -1401
- package/dist/faqir.organic.css +6436 -1401
- package/dist/faqir.paper.css +6436 -1401
- package/dist/faqir.slate.css +6436 -1401
- package/dist/faqir.soft.css +6436 -1401
- package/dist/faqir.sunset.css +6436 -1401
- package/dist/faqir.swiss-document.css +6436 -1401
- package/dist/faqir.swiss.css +6436 -1401
- package/dist/faqir.terminal.css +6436 -1401
- package/dist/plugins/faqir-mask.js +1 -2
- package/dist/plugins/faqir-rules.js +1 -1
- package/dist/plugins/faqir-tweak.js +304 -0
- package/dist/plugins/faqir-validate.js +12 -4
- package/dist/sri.json +39 -34
- package/faqir-core.d.ts +52 -2
- package/package.json +1 -1
package/dist/faqir-core.mjs
CHANGED
|
@@ -3,21 +3,37 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
function __accessProp(key) {
|
|
7
|
+
return this[key];
|
|
8
|
+
}
|
|
9
|
+
var __toESMCache_node;
|
|
10
|
+
var __toESMCache_esm;
|
|
6
11
|
var __toESM = (mod, isNodeMode, target) => {
|
|
12
|
+
var canCache = mod != null && typeof mod === "object";
|
|
13
|
+
if (canCache) {
|
|
14
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
15
|
+
var cached = cache.get(mod);
|
|
16
|
+
if (cached)
|
|
17
|
+
return cached;
|
|
18
|
+
}
|
|
7
19
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
8
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
15
31
|
return to;
|
|
16
32
|
};
|
|
17
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
34
|
|
|
19
35
|
// registry/core/faqir-core.js
|
|
20
|
-
var require_faqir_core = __commonJS((exports, module)
|
|
36
|
+
var require_faqir_core = __commonJS(function(exports, module) {
|
|
21
37
|
(function(global, factory) {
|
|
22
38
|
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
23
39
|
module.exports = factory();
|
|
@@ -165,7 +181,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
165
181
|
function evaluate(expression, scope, el) {
|
|
166
182
|
try {
|
|
167
183
|
const fn = compileExpression(expression);
|
|
168
|
-
return fn.call(scope, scope, el);
|
|
184
|
+
return fn.call(scope, scope, el, el);
|
|
169
185
|
} catch (e) {
|
|
170
186
|
console.warn('[Faqir] Expression error: "' + expression + '"', e);
|
|
171
187
|
return;
|
|
@@ -174,7 +190,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
174
190
|
function evaluateAssignment(expression, scope, el) {
|
|
175
191
|
try {
|
|
176
192
|
const fn = compileStatement(expression);
|
|
177
|
-
fn.call(scope, scope, el);
|
|
193
|
+
fn.call(scope, scope, el, el);
|
|
178
194
|
} catch (e) {
|
|
179
195
|
console.warn('[Faqir] Statement error: "' + expression + '"', e);
|
|
180
196
|
}
|
|
@@ -191,7 +207,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
191
207
|
var key = "expr:" + expr;
|
|
192
208
|
if (expressionCache.has(key))
|
|
193
209
|
return expressionCache.get(key);
|
|
194
|
-
var fn = new Function("$scope", "$el", "with($scope) { return (" + expr + ") }");
|
|
210
|
+
var fn = new Function("$scope", "$el", "$this", "with($scope) { return (" + expr + ") }");
|
|
195
211
|
expressionCache.set(key, fn);
|
|
196
212
|
return fn;
|
|
197
213
|
}
|
|
@@ -199,7 +215,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
199
215
|
var key = "stmt:" + expr;
|
|
200
216
|
if (expressionCache.has(key))
|
|
201
217
|
return expressionCache.get(key);
|
|
202
|
-
var fn = new Function("$scope", "$el", "with($scope) { " + expr + " }");
|
|
218
|
+
var fn = new Function("$scope", "$el", "$this", "with($scope) { " + expr + " }");
|
|
203
219
|
expressionCache.set(key, fn);
|
|
204
220
|
return fn;
|
|
205
221
|
}
|
|
@@ -299,6 +315,32 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
299
315
|
teleport: 100
|
|
300
316
|
};
|
|
301
317
|
var ROOT_CONSUMED = { data: 1, source: 1, init: 1 };
|
|
318
|
+
var pendingInits = null;
|
|
319
|
+
function runInit(fn) {
|
|
320
|
+
if (pendingInits)
|
|
321
|
+
pendingInits.push(fn);
|
|
322
|
+
else
|
|
323
|
+
fn();
|
|
324
|
+
}
|
|
325
|
+
function renderThenInit(render) {
|
|
326
|
+
if (pendingInits)
|
|
327
|
+
return render();
|
|
328
|
+
var queue = pendingInits = [];
|
|
329
|
+
var nodes;
|
|
330
|
+
try {
|
|
331
|
+
nodes = render();
|
|
332
|
+
} finally {
|
|
333
|
+
pendingInits = null;
|
|
334
|
+
}
|
|
335
|
+
untrack(function() {
|
|
336
|
+
for (var i = 0;i < nodes.length; i++) {
|
|
337
|
+
if (nodes[i].nodeType === 1 && nodes[i].isConnected)
|
|
338
|
+
startControllers(nodes[i]);
|
|
339
|
+
}
|
|
340
|
+
for (var q = 0;q < queue.length; q++)
|
|
341
|
+
queue[q]();
|
|
342
|
+
});
|
|
343
|
+
}
|
|
302
344
|
function initTree(root, parentScope) {
|
|
303
345
|
var scope = initScope(root, parentScope);
|
|
304
346
|
var rootDirectives = parseDirectives(root);
|
|
@@ -319,7 +361,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
319
361
|
var children = [].slice.call(el.children);
|
|
320
362
|
for (var i = 0;i < children.length; i++) {
|
|
321
363
|
var child = children[i];
|
|
322
|
-
if (child.__faqirScope && !child.hasAttribute("l-data")) {
|
|
364
|
+
if (child.__faqirStray || child.__faqirScope && !child.hasAttribute("l-data")) {
|
|
323
365
|
continue;
|
|
324
366
|
}
|
|
325
367
|
if (child.hasAttribute("l-data")) {
|
|
@@ -345,6 +387,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
345
387
|
}
|
|
346
388
|
}
|
|
347
389
|
var strayScope = null;
|
|
390
|
+
var scopeRoots = new WeakMap;
|
|
348
391
|
function getStrayScope() {
|
|
349
392
|
if (!strayScope) {
|
|
350
393
|
if (!document.body.__scopeId)
|
|
@@ -352,6 +395,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
352
395
|
if (!document.body.__faqirCleanups)
|
|
353
396
|
document.body.__faqirCleanups = [];
|
|
354
397
|
strayScope = createScopeWithMagics({}, document.body, document.body);
|
|
398
|
+
scopeRoots.set(strayScope, document.body);
|
|
355
399
|
}
|
|
356
400
|
return strayScope;
|
|
357
401
|
}
|
|
@@ -392,6 +436,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
392
436
|
Object.assign(userData, propData);
|
|
393
437
|
var scopeId = ++scopeCounter;
|
|
394
438
|
var scope = createScopeWithMagics(userData, root, root);
|
|
439
|
+
scopeRoots.set(scope, root);
|
|
395
440
|
root.__faqirScope = scope;
|
|
396
441
|
root.__scopeId = scopeId;
|
|
397
442
|
root.__faqirCleanups = [];
|
|
@@ -405,7 +450,9 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
405
450
|
processSourceDirectives(root, scope);
|
|
406
451
|
var initExpr = root.getAttribute("l-init");
|
|
407
452
|
if (initExpr) {
|
|
408
|
-
|
|
453
|
+
runInit(function() {
|
|
454
|
+
evaluateAssignment(initExpr, scope, root);
|
|
455
|
+
});
|
|
409
456
|
}
|
|
410
457
|
return scope;
|
|
411
458
|
}
|
|
@@ -505,6 +552,11 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
505
552
|
var descriptors = Object.getOwnPropertyDescriptors(data);
|
|
506
553
|
Object.defineProperties(target, descriptors);
|
|
507
554
|
var scope = reactive(target);
|
|
555
|
+
for (var k in descriptors) {
|
|
556
|
+
var d = descriptors[k];
|
|
557
|
+
if (d.writable && typeof d.value === "function")
|
|
558
|
+
target[k] = d.value.bind(scope);
|
|
559
|
+
}
|
|
508
560
|
return scope;
|
|
509
561
|
}
|
|
510
562
|
function watchProperty(scope, key, cb) {
|
|
@@ -520,7 +572,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
520
572
|
return dispose;
|
|
521
573
|
}
|
|
522
574
|
function getScopeRefs(root) {
|
|
523
|
-
return root.__faqirRefs || {};
|
|
575
|
+
return root.__faqirRefs || (root.__faqirRefs = {});
|
|
524
576
|
}
|
|
525
577
|
function findScopeRoot(el) {
|
|
526
578
|
var node = el;
|
|
@@ -896,14 +948,24 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
896
948
|
"formnovalidate",
|
|
897
949
|
"inert"
|
|
898
950
|
]);
|
|
951
|
+
var PROPS = new Set(["checked", "selected", "muted", "indeterminate", "value"]);
|
|
952
|
+
function writeProp(el, name, value) {
|
|
953
|
+
if (!(name in el) || el[name] === value)
|
|
954
|
+
return;
|
|
955
|
+
el[name] = value;
|
|
956
|
+
if (name === "checked" || name === "selected") {
|
|
957
|
+
el.dispatchEvent(new CustomEvent("faqir:model", { bubbles: true }));
|
|
958
|
+
}
|
|
959
|
+
}
|
|
899
960
|
function handleBind(el, dir, scope) {
|
|
900
961
|
var attrName = dir.arg;
|
|
962
|
+
var prev = {};
|
|
901
963
|
var cl = effect(function() {
|
|
902
964
|
var value = evaluate(dir.expression, scope, el);
|
|
903
965
|
if (attrName === "class") {
|
|
904
|
-
applyClassBinding(el, value);
|
|
966
|
+
prev = applyClassBinding(el, value, prev);
|
|
905
967
|
} else if (attrName === "style") {
|
|
906
|
-
applyStyleBinding(el, value);
|
|
968
|
+
prev = applyStyleBinding(el, value, prev);
|
|
907
969
|
} else if (BOOLEAN_ATTRS.has(attrName)) {
|
|
908
970
|
if (value) {
|
|
909
971
|
el.setAttribute(attrName, "");
|
|
@@ -917,40 +979,69 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
917
979
|
el.setAttribute(attrName, String(value));
|
|
918
980
|
}
|
|
919
981
|
}
|
|
982
|
+
if (PROPS.has(attrName)) {
|
|
983
|
+
writeProp(el, attrName, attrName === "value" ? value == null || value === false ? "" : String(value) : !!value);
|
|
984
|
+
}
|
|
920
985
|
});
|
|
921
986
|
addCleanup(el, cl);
|
|
922
987
|
}
|
|
923
|
-
function
|
|
924
|
-
if (typeof
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
}
|
|
988
|
+
function classMap(v, out, on) {
|
|
989
|
+
if (typeof v === "string") {
|
|
990
|
+
v.split(/\s+/).forEach(function(c) {
|
|
991
|
+
if (c)
|
|
992
|
+
out[c] = on;
|
|
993
|
+
});
|
|
994
|
+
} else if (Array.isArray(v)) {
|
|
995
|
+
v.forEach(function(x) {
|
|
996
|
+
if (x)
|
|
997
|
+
classMap(x, out, true);
|
|
998
|
+
});
|
|
999
|
+
} else if (v && typeof v === "object") {
|
|
1000
|
+
for (var k in v)
|
|
1001
|
+
classMap(k, out, !!v[k]);
|
|
934
1002
|
}
|
|
1003
|
+
return out;
|
|
935
1004
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1005
|
+
function applyClassBinding(el, value, prev) {
|
|
1006
|
+
var next = classMap(value, {}, true), c;
|
|
1007
|
+
for (c in prev)
|
|
1008
|
+
if (prev[c] && !(c in next))
|
|
1009
|
+
el.classList.remove(c);
|
|
1010
|
+
for (c in next)
|
|
1011
|
+
el.classList.toggle(c, next[c]);
|
|
1012
|
+
return next;
|
|
1013
|
+
}
|
|
1014
|
+
var styleScratch;
|
|
1015
|
+
function styleMap(v, out) {
|
|
1016
|
+
if (typeof v === "string") {
|
|
1017
|
+
var s = (styleScratch || (styleScratch = document.createElement("div"))).style;
|
|
1018
|
+
s.cssText = v;
|
|
1019
|
+
for (var i = 0;i < s.length; i++) {
|
|
1020
|
+
out[s[i]] = [s.getPropertyValue(s[i]), s.getPropertyPriority(s[i])];
|
|
1021
|
+
}
|
|
1022
|
+
} else if (Array.isArray(v)) {
|
|
1023
|
+
v.forEach(function(x) {
|
|
1024
|
+
styleMap(x, out);
|
|
1025
|
+
});
|
|
1026
|
+
} else if (v && typeof v === "object") {
|
|
1027
|
+
for (var k in v) {
|
|
1028
|
+
out[/^--/.test(k) ? k : k.replace(/[A-Z]/g, "-$&").toLowerCase()] = v[k] == null || v[k] === false ? null : [String(v[k]), ""];
|
|
952
1029
|
}
|
|
953
1030
|
}
|
|
1031
|
+
return out;
|
|
1032
|
+
}
|
|
1033
|
+
function applyStyleBinding(el, value, prev) {
|
|
1034
|
+
var next = styleMap(value, {}), p;
|
|
1035
|
+
for (p in prev)
|
|
1036
|
+
if (prev[p] && !(p in next))
|
|
1037
|
+
el.style.removeProperty(p);
|
|
1038
|
+
for (p in next) {
|
|
1039
|
+
if (next[p])
|
|
1040
|
+
el.style.setProperty(p, next[p][0], next[p][1]);
|
|
1041
|
+
else
|
|
1042
|
+
el.style.removeProperty(p);
|
|
1043
|
+
}
|
|
1044
|
+
return next;
|
|
954
1045
|
}
|
|
955
1046
|
var KEY_MAP = {
|
|
956
1047
|
enter: "Enter",
|
|
@@ -1065,32 +1156,26 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1065
1156
|
}
|
|
1066
1157
|
function handleRef(el, dir, scope) {
|
|
1067
1158
|
var name = dir.expression;
|
|
1068
|
-
var
|
|
1069
|
-
|
|
1070
|
-
root.__faqirRefs = {};
|
|
1071
|
-
root.__faqirRefs[name] = el;
|
|
1159
|
+
var refs = reactive(getScopeRefs(scopeRoots.get(scope) || findScopeRoot(el)));
|
|
1160
|
+
refs[name] = el;
|
|
1072
1161
|
addCleanup(el, function() {
|
|
1073
|
-
if (
|
|
1074
|
-
|
|
1162
|
+
if (refs.__target[name] === el) {
|
|
1163
|
+
refs[name] = undefined;
|
|
1164
|
+
delete refs.__target[name];
|
|
1075
1165
|
}
|
|
1076
1166
|
});
|
|
1077
1167
|
}
|
|
1078
1168
|
function handleInit(el, dir, scope) {
|
|
1079
|
-
|
|
1080
|
-
}
|
|
1081
|
-
function handleEffect(el, dir, scope) {
|
|
1082
|
-
var cl = effect(function() {
|
|
1169
|
+
runInit(function() {
|
|
1083
1170
|
evaluateAssignment(dir.expression, scope, el);
|
|
1084
1171
|
});
|
|
1085
|
-
addCleanup(el, cl);
|
|
1086
1172
|
}
|
|
1087
|
-
function
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
document.head.appendChild(style);
|
|
1173
|
+
function handleEffect(el, dir, scope) {
|
|
1174
|
+
runInit(function() {
|
|
1175
|
+
addCleanup(el, effect(function() {
|
|
1176
|
+
evaluateAssignment(dir.expression, scope, el);
|
|
1177
|
+
}));
|
|
1178
|
+
});
|
|
1094
1179
|
}
|
|
1095
1180
|
function removeCloaks(within) {
|
|
1096
1181
|
var host = within || document;
|
|
@@ -1102,7 +1187,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1102
1187
|
els[i].removeAttribute("l-cloak");
|
|
1103
1188
|
}
|
|
1104
1189
|
}
|
|
1105
|
-
var MOTION_PRESETS = { fade: 1, "slide-up": 1, scale: 1 };
|
|
1190
|
+
var MOTION_PRESETS = { fade: 1, "slide-up": 1, "slide-down": 1, "slide-start": 1, "slide-end": 1, scale: 1, blur: 1, flip: 1 };
|
|
1106
1191
|
function prefersReducedMotion() {
|
|
1107
1192
|
return window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1108
1193
|
}
|
|
@@ -1131,7 +1216,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1131
1216
|
}
|
|
1132
1217
|
var preset = el.getAttribute("l-transition") || "fade";
|
|
1133
1218
|
if (!MOTION_PRESETS[preset]) {
|
|
1134
|
-
console.warn('[Faqir] l-transition: unknown preset "' + preset + '" — expected one of:
|
|
1219
|
+
console.warn('[Faqir] l-transition: unknown preset "' + preset + '" — expected one of: ' + Object.keys(MOTION_PRESETS).join(", "));
|
|
1135
1220
|
}
|
|
1136
1221
|
el.setAttribute("data-motion", phase);
|
|
1137
1222
|
el.offsetHeight;
|
|
@@ -1184,10 +1269,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1184
1269
|
function handleModel(el, dir, scope) {
|
|
1185
1270
|
var prop = dir.expression;
|
|
1186
1271
|
var modifiers = new Set(dir.modifiers);
|
|
1187
|
-
function bind(
|
|
1188
|
-
el.addEventListener(
|
|
1272
|
+
function bind(eventName, handler) {
|
|
1273
|
+
el.addEventListener(eventName, handler);
|
|
1189
1274
|
addCleanup(el, function() {
|
|
1190
|
-
el.removeEventListener(
|
|
1275
|
+
el.removeEventListener(eventName, handler);
|
|
1191
1276
|
});
|
|
1192
1277
|
}
|
|
1193
1278
|
var tag = el.tagName.toLowerCase();
|
|
@@ -1196,22 +1281,18 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1196
1281
|
if (isFaqirSwitch) {
|
|
1197
1282
|
var cl = effect(function() {
|
|
1198
1283
|
var value = evaluate(prop, scope, el);
|
|
1199
|
-
el
|
|
1284
|
+
writeProp(el, "checked", !!value);
|
|
1200
1285
|
el.dataset.state = value ? "on" : "off";
|
|
1201
1286
|
el.setAttribute("aria-checked", value ? "true" : "false");
|
|
1202
1287
|
});
|
|
1203
|
-
bind("
|
|
1204
|
-
writeModel(prop, el
|
|
1288
|
+
bind("click", function() {
|
|
1289
|
+
writeModel(prop, !evaluate(prop, scope, el), scope, el);
|
|
1205
1290
|
});
|
|
1206
1291
|
addCleanup(el, cl);
|
|
1207
1292
|
} else if (tag === "input" && type === "checkbox") {
|
|
1208
1293
|
var cl = effect(function() {
|
|
1209
1294
|
var current = evaluate(prop, scope, el);
|
|
1210
|
-
|
|
1211
|
-
el.checked = current.indexOf(el.value) >= 0;
|
|
1212
|
-
} else {
|
|
1213
|
-
el.checked = !!current;
|
|
1214
|
-
}
|
|
1295
|
+
writeProp(el, "checked", Array.isArray(current) ? current.indexOf(el.value) >= 0 : !!current);
|
|
1215
1296
|
});
|
|
1216
1297
|
bind("change", function() {
|
|
1217
1298
|
var current = evaluate(prop, scope, el);
|
|
@@ -1230,7 +1311,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1230
1311
|
addCleanup(el, cl);
|
|
1231
1312
|
} else if (tag === "input" && type === "radio") {
|
|
1232
1313
|
var cl = effect(function() {
|
|
1233
|
-
el
|
|
1314
|
+
writeProp(el, "checked", evaluate(prop, scope, el) === el.value);
|
|
1234
1315
|
});
|
|
1235
1316
|
bind("change", function() {
|
|
1236
1317
|
if (el.checked) {
|
|
@@ -1240,7 +1321,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1240
1321
|
addCleanup(el, cl);
|
|
1241
1322
|
} else if (tag === "select") {
|
|
1242
1323
|
var cl = effect(function() {
|
|
1243
|
-
el
|
|
1324
|
+
writeProp(el, "value", evaluate(prop, scope, el) || "");
|
|
1244
1325
|
});
|
|
1245
1326
|
bind("change", function() {
|
|
1246
1327
|
writeModel(prop, el.value, scope, el);
|
|
@@ -1303,30 +1384,32 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1303
1384
|
var cl = effect(function() {
|
|
1304
1385
|
var value = evaluate(dir.expression, scope, el);
|
|
1305
1386
|
if (value) {
|
|
1306
|
-
if (insertedNodes.length === 0)
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1387
|
+
if (insertedNodes.length === 0)
|
|
1388
|
+
renderThenInit(function() {
|
|
1389
|
+
var fragment = el.content.cloneNode(true);
|
|
1390
|
+
var nodes = [].slice.call(fragment.childNodes);
|
|
1391
|
+
for (var i = 0;i < nodes.length; i++) {
|
|
1392
|
+
if (nodes[i].nodeType !== 1)
|
|
1393
|
+
continue;
|
|
1394
|
+
if (nodes[i].hasAttribute("l-data")) {
|
|
1395
|
+
initTree(nodes[i], scope);
|
|
1396
|
+
continue;
|
|
1397
|
+
}
|
|
1398
|
+
nodes[i].__faqirScope = scope;
|
|
1399
|
+
nodes[i].__faqirCleanups = nodes[i].__faqirCleanups || [];
|
|
1400
|
+
processElement(nodes[i], scope);
|
|
1401
|
+
if (nodes[i].parentNode)
|
|
1402
|
+
walkChildren(nodes[i], scope);
|
|
1315
1403
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
insertedNodes = [].slice.call(fragment.childNodes);
|
|
1323
|
-
anchor.parentNode.insertBefore(fragment, anchor.nextSibling);
|
|
1324
|
-
for (var i = 0;i < insertedNodes.length; i++) {
|
|
1325
|
-
if (insertedNodes[i].nodeType === 1 && insertedNodes[i].hasAttribute("l-transition")) {
|
|
1326
|
-
runEnterTransition(insertedNodes[i]);
|
|
1404
|
+
insertedNodes = [].slice.call(fragment.childNodes);
|
|
1405
|
+
anchor.parentNode.insertBefore(fragment, anchor.nextSibling);
|
|
1406
|
+
for (var i = 0;i < insertedNodes.length; i++) {
|
|
1407
|
+
if (insertedNodes[i].nodeType === 1 && insertedNodes[i].hasAttribute("l-transition")) {
|
|
1408
|
+
runEnterTransition(insertedNodes[i]);
|
|
1409
|
+
}
|
|
1327
1410
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1411
|
+
return insertedNodes;
|
|
1412
|
+
});
|
|
1330
1413
|
} else {
|
|
1331
1414
|
for (var i = 0;i < insertedNodes.length; i++) {
|
|
1332
1415
|
var node = insertedNodes[i];
|
|
@@ -1472,6 +1555,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1472
1555
|
own[itemName] = item;
|
|
1473
1556
|
own[indexName] = i;
|
|
1474
1557
|
var childScope = createForItemScope(own, scope);
|
|
1558
|
+
scopeRoots.set(childScope, scopeRoots.get(scope));
|
|
1475
1559
|
for (var j = 0;j < nodes.length; j++) {
|
|
1476
1560
|
if (nodes[j].nodeType !== 1)
|
|
1477
1561
|
continue;
|
|
@@ -1488,10 +1572,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1488
1572
|
return { key, scope: childScope, nodes: [].slice.call(clone.childNodes) };
|
|
1489
1573
|
}
|
|
1490
1574
|
var currentEntries = [];
|
|
1491
|
-
|
|
1575
|
+
function renderList() {
|
|
1492
1576
|
var list = evaluate(listExpr, scope, el);
|
|
1493
|
-
var items = Array.isArray(list) ? list : typeof list === "number" ? Array.from({ length: list }, function(_,
|
|
1494
|
-
return
|
|
1577
|
+
var items = Array.isArray(list) ? list : typeof list === "number" ? Array.from({ length: list }, function(_, i) {
|
|
1578
|
+
return i + 1;
|
|
1495
1579
|
}) : [];
|
|
1496
1580
|
var oldMap = new Map;
|
|
1497
1581
|
for (var i = 0;i < currentEntries.length; i++) {
|
|
@@ -1518,11 +1602,11 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1518
1602
|
}
|
|
1519
1603
|
newEntries[i] = entry;
|
|
1520
1604
|
}
|
|
1521
|
-
oldMap.forEach(function(
|
|
1522
|
-
for (var e = 0;e <
|
|
1523
|
-
for (var
|
|
1524
|
-
destroyScope(
|
|
1525
|
-
|
|
1605
|
+
oldMap.forEach(function(olds) {
|
|
1606
|
+
for (var e = 0;e < olds.length; e++) {
|
|
1607
|
+
for (var j = 0;j < olds[e].nodes.length; j++) {
|
|
1608
|
+
destroyScope(olds[e].nodes[j]);
|
|
1609
|
+
olds[e].nodes[j].remove();
|
|
1526
1610
|
}
|
|
1527
1611
|
}
|
|
1528
1612
|
});
|
|
@@ -1542,6 +1626,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1542
1626
|
nextNode = entry.nodes[0];
|
|
1543
1627
|
}
|
|
1544
1628
|
currentEntries = newEntries;
|
|
1629
|
+
var fresh = [];
|
|
1630
|
+
for (var i = 0;i < n; i++)
|
|
1631
|
+
if (!source[i])
|
|
1632
|
+
fresh.push.apply(fresh, newEntries[i].nodes);
|
|
1633
|
+
return fresh;
|
|
1634
|
+
}
|
|
1635
|
+
var cl = effect(function() {
|
|
1636
|
+
renderThenInit(renderList);
|
|
1545
1637
|
});
|
|
1546
1638
|
addCleanup(el, cl, anchor);
|
|
1547
1639
|
}
|
|
@@ -1633,47 +1725,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1633
1725
|
scheduleFlush();
|
|
1634
1726
|
}
|
|
1635
1727
|
}
|
|
1636
|
-
var $ = function(selector, scope) {
|
|
1637
|
-
return (scope || document).querySelector(selector);
|
|
1638
|
-
};
|
|
1639
1728
|
var $$ = function(selector, scope) {
|
|
1640
1729
|
return [].slice.call((scope || document).querySelectorAll(selector));
|
|
1641
1730
|
};
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
el.setAttribute(keys[i], attrs[keys[i]]);
|
|
1648
|
-
}
|
|
1649
|
-
}
|
|
1650
|
-
for (var j = 2;j < arguments.length; j++) {
|
|
1651
|
-
var child = arguments[j];
|
|
1652
|
-
el.append(typeof child === "string" ? document.createTextNode(child) : child);
|
|
1653
|
-
}
|
|
1654
|
-
return el;
|
|
1655
|
-
}
|
|
1656
|
-
function delegate(root, event, selector, handler) {
|
|
1657
|
-
function listener(e) {
|
|
1658
|
-
var target = e.target.closest(selector);
|
|
1659
|
-
if (target && root.contains(target))
|
|
1660
|
-
handler(e, target);
|
|
1661
|
-
}
|
|
1662
|
-
root.addEventListener(event, listener);
|
|
1663
|
-
return function() {
|
|
1664
|
-
root.removeEventListener(event, listener);
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
function once(el, event, handler) {
|
|
1668
|
-
function listener(e) {
|
|
1669
|
-
cleanupOnce();
|
|
1670
|
-
handler(e);
|
|
1671
|
-
}
|
|
1672
|
-
function cleanupOnce() {
|
|
1673
|
-
el.removeEventListener(event, listener);
|
|
1674
|
-
}
|
|
1675
|
-
el.addEventListener(event, listener);
|
|
1676
|
-
return cleanupOnce;
|
|
1731
|
+
var OWNER = "[data-ui]:not([data-ui=stack],[data-ui=cluster],[data-ui=grid],[data-ui=container],[data-ui=surface],[data-ui=switcher],[data-ui=aspect-ratio])";
|
|
1732
|
+
function ownParts(root, part) {
|
|
1733
|
+
return $$("[data-part='" + part + "']", root).filter(function(el) {
|
|
1734
|
+
return el.parentElement.closest(OWNER) === root;
|
|
1735
|
+
});
|
|
1677
1736
|
}
|
|
1678
1737
|
function onOutsideClick(el, handler) {
|
|
1679
1738
|
function listener(e) {
|
|
@@ -1731,24 +1790,9 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1731
1790
|
container.removeEventListener("keydown", onKeyDown);
|
|
1732
1791
|
};
|
|
1733
1792
|
}
|
|
1734
|
-
function
|
|
1735
|
-
if (
|
|
1736
|
-
|
|
1737
|
-
var style = getComputedStyle(el);
|
|
1738
|
-
var hasDuration = parseFloat(style.transitionDuration) > 0 || style.animationName !== "none" && parseFloat(style.animationDuration) > 0;
|
|
1739
|
-
if (!hasDuration)
|
|
1740
|
-
return Promise.resolve();
|
|
1741
|
-
return new Promise(function(resolve) {
|
|
1742
|
-
function done(e) {
|
|
1743
|
-
if (e.target !== el)
|
|
1744
|
-
return;
|
|
1745
|
-
el.removeEventListener("transitionend", done);
|
|
1746
|
-
el.removeEventListener("animationend", done);
|
|
1747
|
-
resolve();
|
|
1748
|
-
}
|
|
1749
|
-
el.addEventListener("transitionend", done);
|
|
1750
|
-
el.addEventListener("animationend", done);
|
|
1751
|
-
});
|
|
1793
|
+
function returnFocus(root, target, active) {
|
|
1794
|
+
if ((!active || active === document.body || root.contains(active)) && target && target.isConnected && !target.closest("[hidden]"))
|
|
1795
|
+
target.focus();
|
|
1752
1796
|
}
|
|
1753
1797
|
var EXIT_EVENTS = ["transitionend", "transitioncancel", "animationend", "animationcancel"];
|
|
1754
1798
|
function longestTimeMs(value) {
|
|
@@ -1779,8 +1823,8 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1779
1823
|
clearTimeout(timer);
|
|
1780
1824
|
timer = null;
|
|
1781
1825
|
}
|
|
1782
|
-
for (var
|
|
1783
|
-
el.removeEventListener(EXIT_EVENTS[
|
|
1826
|
+
for (var i = 0;i < EXIT_EVENTS.length; i++)
|
|
1827
|
+
el.removeEventListener(EXIT_EVENTS[i], onMotionEvent);
|
|
1784
1828
|
}
|
|
1785
1829
|
function settle() {
|
|
1786
1830
|
if (settled)
|
|
@@ -1866,7 +1910,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1866
1910
|
function currentIndex() {
|
|
1867
1911
|
return items().indexOf(current());
|
|
1868
1912
|
}
|
|
1869
|
-
function
|
|
1913
|
+
function focusFirst() {
|
|
1870
1914
|
return focus(0);
|
|
1871
1915
|
}
|
|
1872
1916
|
function focusLast() {
|
|
@@ -1916,7 +1960,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1916
1960
|
}
|
|
1917
1961
|
if (event.key === "Home") {
|
|
1918
1962
|
event.preventDefault();
|
|
1919
|
-
|
|
1963
|
+
focusFirst();
|
|
1920
1964
|
return;
|
|
1921
1965
|
}
|
|
1922
1966
|
if (event.key === "End") {
|
|
@@ -1953,7 +1997,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1953
1997
|
current,
|
|
1954
1998
|
sync,
|
|
1955
1999
|
focus,
|
|
1956
|
-
focusFirst
|
|
2000
|
+
focusFirst,
|
|
1957
2001
|
focusLast,
|
|
1958
2002
|
focusNext,
|
|
1959
2003
|
focusPrevious,
|
|
@@ -1962,10 +2006,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
1962
2006
|
}
|
|
1963
2007
|
var controllerRegistry = {};
|
|
1964
2008
|
var createAccordion = controllerRegistry["accordion"] = function() {
|
|
1965
|
-
function
|
|
2009
|
+
function createAccordion(root) {
|
|
1966
2010
|
if (root._faqirAccordion)
|
|
1967
2011
|
return root._faqirAccordion;
|
|
1968
|
-
const getItems = () => [...root.querySelectorAll("[data-part='item']")];
|
|
2012
|
+
const getItems = () => [...root.querySelectorAll(":scope > [data-part='item']")];
|
|
1969
2013
|
const isSingle = () => root.dataset.variant === "single";
|
|
1970
2014
|
function expand(index) {
|
|
1971
2015
|
const items = getItems();
|
|
@@ -2021,30 +2065,24 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2021
2065
|
if (content)
|
|
2022
2066
|
content.hidden = true;
|
|
2023
2067
|
}
|
|
2024
|
-
function
|
|
2068
|
+
function triggerIndex(e) {
|
|
2025
2069
|
const trigger = e.target.closest("[data-part='trigger']");
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
const index =
|
|
2070
|
+
const item = trigger?.closest("[data-part='item']");
|
|
2071
|
+
if (!item || item.querySelector("[data-part='trigger']") !== trigger)
|
|
2072
|
+
return -1;
|
|
2073
|
+
return getItems().indexOf(item);
|
|
2074
|
+
}
|
|
2075
|
+
function onTriggerClick(e) {
|
|
2076
|
+
const index = triggerIndex(e);
|
|
2033
2077
|
if (index >= 0)
|
|
2034
2078
|
toggle(index);
|
|
2035
2079
|
}
|
|
2036
2080
|
function onKeyDown(e) {
|
|
2037
2081
|
if (e.key === "Enter" || e.key === " ") {
|
|
2038
|
-
const
|
|
2039
|
-
if (
|
|
2082
|
+
const index = triggerIndex(e);
|
|
2083
|
+
if (index >= 0) {
|
|
2040
2084
|
e.preventDefault();
|
|
2041
|
-
|
|
2042
|
-
if (!item)
|
|
2043
|
-
return;
|
|
2044
|
-
const items = getItems();
|
|
2045
|
-
const index = items.indexOf(item);
|
|
2046
|
-
if (index >= 0)
|
|
2047
|
-
toggle(index);
|
|
2085
|
+
toggle(index);
|
|
2048
2086
|
}
|
|
2049
2087
|
}
|
|
2050
2088
|
}
|
|
@@ -2059,17 +2097,17 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2059
2097
|
root._faqirAccordion = api;
|
|
2060
2098
|
return api;
|
|
2061
2099
|
}
|
|
2062
|
-
return
|
|
2100
|
+
return createAccordion;
|
|
2063
2101
|
}();
|
|
2064
2102
|
var createAlertDialog = controllerRegistry["alert-dialog"] = function() {
|
|
2065
|
-
function
|
|
2103
|
+
function createAlertDialog(root) {
|
|
2066
2104
|
const dialogFactory = typeof createDialog === "function" && createDialog || typeof controllerRegistry !== "undefined" && controllerRegistry["dialog"];
|
|
2067
2105
|
if (typeof dialogFactory !== "function") {
|
|
2068
2106
|
throw new Error("alert-dialog requires the dialog controller to be available");
|
|
2069
2107
|
}
|
|
2070
2108
|
return dialogFactory(root);
|
|
2071
2109
|
}
|
|
2072
|
-
return
|
|
2110
|
+
return createAlertDialog;
|
|
2073
2111
|
}();
|
|
2074
2112
|
var createBarcode = controllerRegistry["barcode"] = function() {
|
|
2075
2113
|
const CODE128_PATTERNS = Object.freeze([
|
|
@@ -2204,7 +2242,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2204
2242
|
weighted += data[i] * (i + 1);
|
|
2205
2243
|
const checksum = weighted % 103;
|
|
2206
2244
|
const codewords = [START_B, ...data, checksum, STOP];
|
|
2207
|
-
const pattern = codewords.map((
|
|
2245
|
+
const pattern = codewords.map((value) => CODE128_PATTERNS[value]).join("");
|
|
2208
2246
|
return { checksum, codewords, pattern };
|
|
2209
2247
|
}
|
|
2210
2248
|
function patternToSVG(encoded) {
|
|
@@ -2242,7 +2280,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2242
2280
|
svg.appendChild(bars);
|
|
2243
2281
|
return svg;
|
|
2244
2282
|
}
|
|
2245
|
-
function
|
|
2283
|
+
function createBarcode(root) {
|
|
2246
2284
|
if (root._faqirBarcode)
|
|
2247
2285
|
return root._faqirBarcode;
|
|
2248
2286
|
function removeGeneratedSVG() {
|
|
@@ -2293,7 +2331,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2293
2331
|
render();
|
|
2294
2332
|
return api;
|
|
2295
2333
|
}
|
|
2296
|
-
return
|
|
2334
|
+
return createBarcode;
|
|
2297
2335
|
}();
|
|
2298
2336
|
var createCalendar = controllerRegistry["calendar"] = function() {
|
|
2299
2337
|
const MONTH_NAMES = [
|
|
@@ -2325,7 +2363,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2325
2363
|
const d = new Date(str + "T00:00:00");
|
|
2326
2364
|
return isNaN(d.getTime()) ? null : d;
|
|
2327
2365
|
}
|
|
2328
|
-
function
|
|
2366
|
+
function createCalendar(root) {
|
|
2329
2367
|
if (root._faqirCalendar)
|
|
2330
2368
|
return root._faqirCalendar;
|
|
2331
2369
|
const navPrev = root.querySelector("[data-part='nav-prev']");
|
|
@@ -2507,12 +2545,12 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2507
2545
|
viewYear = target.getFullYear();
|
|
2508
2546
|
buildGrid();
|
|
2509
2547
|
} else {
|
|
2510
|
-
gridBody.querySelectorAll("[data-part='day']").forEach((
|
|
2511
|
-
|
|
2548
|
+
gridBody.querySelectorAll("[data-part='day']").forEach((btn) => {
|
|
2549
|
+
btn.tabIndex = -1;
|
|
2512
2550
|
});
|
|
2513
|
-
const
|
|
2514
|
-
if (
|
|
2515
|
-
|
|
2551
|
+
const btn = dayButton(target);
|
|
2552
|
+
if (btn)
|
|
2553
|
+
btn.tabIndex = 0;
|
|
2516
2554
|
}
|
|
2517
2555
|
const btn = dayButton(target);
|
|
2518
2556
|
if (btn)
|
|
@@ -2734,22 +2772,22 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2734
2772
|
root._faqirCalendar = api;
|
|
2735
2773
|
return api;
|
|
2736
2774
|
}
|
|
2737
|
-
return
|
|
2775
|
+
return createCalendar;
|
|
2738
2776
|
}();
|
|
2739
2777
|
var createCarousel = controllerRegistry["carousel"] = function() {
|
|
2740
|
-
function
|
|
2778
|
+
function createCarousel(root) {
|
|
2741
2779
|
if (root._faqirCarousel)
|
|
2742
2780
|
return root._faqirCarousel;
|
|
2743
2781
|
const viewport = root.querySelector("[data-part='viewport']");
|
|
2744
2782
|
if (!viewport)
|
|
2745
2783
|
return null;
|
|
2746
2784
|
const loop = root.hasAttribute("data-loop");
|
|
2747
|
-
const slides = () => [...viewport.querySelectorAll("[data-part='slide']")];
|
|
2748
|
-
const dots = () =>
|
|
2749
|
-
const prevBtn = root
|
|
2750
|
-
const nextBtn = root
|
|
2751
|
-
const status = root
|
|
2752
|
-
const enhanced = [...root
|
|
2785
|
+
const slides = () => [...viewport.querySelectorAll(":scope > [data-part='slide']")];
|
|
2786
|
+
const dots = () => ownParts(root, "dot");
|
|
2787
|
+
const [prevBtn] = ownParts(root, "prev");
|
|
2788
|
+
const [nextBtn] = ownParts(root, "next");
|
|
2789
|
+
const [status] = ownParts(root, "status");
|
|
2790
|
+
const enhanced = [...ownParts(root, "controls"), ...ownParts(root, "dots")];
|
|
2753
2791
|
let index = 0;
|
|
2754
2792
|
const reducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && !!window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2755
2793
|
const isRtl = () => {
|
|
@@ -2826,16 +2864,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2826
2864
|
const next = () => goTo(index + 1);
|
|
2827
2865
|
const prev = () => goTo(index - 1);
|
|
2828
2866
|
function onClick(e) {
|
|
2829
|
-
const btn = e.target.closest
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
const part = btn.dataset.part;
|
|
2833
|
-
if (part === "next")
|
|
2867
|
+
const btn = e.target.closest("[data-part]");
|
|
2868
|
+
const dot = dots().indexOf(btn);
|
|
2869
|
+
if (btn === nextBtn)
|
|
2834
2870
|
next();
|
|
2835
|
-
else if (
|
|
2871
|
+
else if (btn === prevBtn)
|
|
2836
2872
|
prev();
|
|
2837
|
-
else if (
|
|
2838
|
-
goTo(
|
|
2873
|
+
else if (dot >= 0)
|
|
2874
|
+
goTo(dot);
|
|
2839
2875
|
}
|
|
2840
2876
|
const schedule = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (fn) => setTimeout(fn, 16);
|
|
2841
2877
|
let ticking = false;
|
|
@@ -2866,10 +2902,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
2866
2902
|
root._faqirCarousel = api;
|
|
2867
2903
|
return api;
|
|
2868
2904
|
}
|
|
2869
|
-
return
|
|
2905
|
+
return createCarousel;
|
|
2870
2906
|
}();
|
|
2871
2907
|
var createCombobox = controllerRegistry["combobox"] = function() {
|
|
2872
|
-
function
|
|
2908
|
+
function createCombobox(root) {
|
|
2873
2909
|
if (root._faqirCombobox)
|
|
2874
2910
|
return root._faqirCombobox;
|
|
2875
2911
|
const input = root.querySelector("[data-part='input']");
|
|
@@ -3055,10 +3091,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3055
3091
|
root._faqirCombobox = api;
|
|
3056
3092
|
return api;
|
|
3057
3093
|
}
|
|
3058
|
-
return
|
|
3094
|
+
return createCombobox;
|
|
3059
3095
|
}();
|
|
3060
3096
|
var createCommandPalette = controllerRegistry["command-palette"] = function() {
|
|
3061
|
-
function
|
|
3097
|
+
function createCommandPalette(root) {
|
|
3062
3098
|
if (root._faqirCommandPalette)
|
|
3063
3099
|
return root._faqirCommandPalette;
|
|
3064
3100
|
const overlay = root.querySelector("[data-part='overlay']");
|
|
@@ -3094,8 +3130,9 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3094
3130
|
}
|
|
3095
3131
|
}
|
|
3096
3132
|
function close() {
|
|
3133
|
+
const active = document.activeElement;
|
|
3097
3134
|
dismiss();
|
|
3098
|
-
previouslyFocused
|
|
3135
|
+
returnFocus(root, previouslyFocused, active);
|
|
3099
3136
|
}
|
|
3100
3137
|
function itemId(item) {
|
|
3101
3138
|
if (!item.id)
|
|
@@ -3250,13 +3287,18 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3250
3287
|
}
|
|
3251
3288
|
}
|
|
3252
3289
|
function onGlobalKeyDown(e) {
|
|
3253
|
-
if (
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3290
|
+
if (e.defaultPrevented || !root.isConnected || root.hasAttribute("data-no-shortcut"))
|
|
3291
|
+
return;
|
|
3292
|
+
if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || e.repeat || e.isComposing)
|
|
3293
|
+
return;
|
|
3294
|
+
const k = (e.key || "").toLowerCase();
|
|
3295
|
+
if (k !== "k" && (/^[a-z]$/.test(k) || e.code !== "KeyK"))
|
|
3296
|
+
return;
|
|
3297
|
+
e.preventDefault();
|
|
3298
|
+
if (root.dataset.state === "open") {
|
|
3299
|
+
close();
|
|
3300
|
+
} else {
|
|
3301
|
+
open();
|
|
3260
3302
|
}
|
|
3261
3303
|
}
|
|
3262
3304
|
searchInput?.addEventListener("input", onSearchInput);
|
|
@@ -3279,14 +3321,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3279
3321
|
root._faqirCommandPalette = api;
|
|
3280
3322
|
return api;
|
|
3281
3323
|
}
|
|
3282
|
-
return
|
|
3324
|
+
return createCommandPalette;
|
|
3283
3325
|
}();
|
|
3284
3326
|
var createContextMenu = controllerRegistry["context-menu"] = function() {
|
|
3285
|
-
function
|
|
3327
|
+
function createContextMenu(root) {
|
|
3286
3328
|
if (root._faqirContextMenu)
|
|
3287
3329
|
return root._faqirContextMenu;
|
|
3288
|
-
const target = root
|
|
3289
|
-
const menu = root
|
|
3330
|
+
const [target] = ownParts(root, "target");
|
|
3331
|
+
const [menu] = ownParts(root, "menu");
|
|
3290
3332
|
if (!target || !menu) {
|
|
3291
3333
|
console.warn("[Faqir] context-menu needs [data-part='target'] and [data-part='menu'] — " + `missing ${[!target && "target", !menu && "menu"].filter(Boolean).join(" and ")}. ` + "Component left inert.", root);
|
|
3292
3334
|
const inert = { open() {}, close() {}, destroy() {} };
|
|
@@ -3370,7 +3412,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3370
3412
|
root._faqirContextMenu = api;
|
|
3371
3413
|
return api;
|
|
3372
3414
|
}
|
|
3373
|
-
return
|
|
3415
|
+
return createContextMenu;
|
|
3374
3416
|
}();
|
|
3375
3417
|
var createDatePicker = controllerRegistry["date-picker"] = function() {
|
|
3376
3418
|
const MONTH_NAMES = [
|
|
@@ -3387,7 +3429,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3387
3429
|
"November",
|
|
3388
3430
|
"December"
|
|
3389
3431
|
];
|
|
3390
|
-
function
|
|
3432
|
+
function createDatePicker(root) {
|
|
3391
3433
|
if (root._faqirDatePicker)
|
|
3392
3434
|
return root._faqirDatePicker;
|
|
3393
3435
|
const trigger = root.querySelector("[data-part='trigger']");
|
|
@@ -3495,19 +3537,21 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3495
3537
|
root._faqirDatePicker = api;
|
|
3496
3538
|
return api;
|
|
3497
3539
|
}
|
|
3498
|
-
return
|
|
3540
|
+
return createDatePicker;
|
|
3499
3541
|
}();
|
|
3500
3542
|
var createDialog = controllerRegistry["dialog"] = function() {
|
|
3501
|
-
function
|
|
3543
|
+
function createDialog(root) {
|
|
3502
3544
|
if (root._faqirDialog)
|
|
3503
3545
|
return root._faqirDialog;
|
|
3504
|
-
const trigger = root
|
|
3505
|
-
const overlay = root.querySelector("[data-part='overlay']");
|
|
3506
|
-
const panel = root.querySelector("[data-part='panel']");
|
|
3507
|
-
const closeButtons = root
|
|
3508
|
-
const confirmButtons = root
|
|
3509
|
-
const cancelButtons = root
|
|
3546
|
+
const [trigger] = ownParts(root, "trigger");
|
|
3547
|
+
const overlay = root.querySelector(":scope > [data-part='overlay']");
|
|
3548
|
+
const panel = root.querySelector(":scope > [data-part='panel']");
|
|
3549
|
+
const closeButtons = ownParts(root, "close");
|
|
3550
|
+
const confirmButtons = ownParts(root, "confirm");
|
|
3551
|
+
const cancelButtons = ownParts(root, "cancel");
|
|
3510
3552
|
const isAlert = !!panel && panel.getAttribute("role") === "alertdialog";
|
|
3553
|
+
if (panel && !panel.hasAttribute("tabindex"))
|
|
3554
|
+
panel.setAttribute("tabindex", "-1");
|
|
3511
3555
|
let focusCleanup = null;
|
|
3512
3556
|
let previouslyFocused = null;
|
|
3513
3557
|
function confirmRequired() {
|
|
@@ -3524,7 +3568,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3524
3568
|
}
|
|
3525
3569
|
function focusInitial() {
|
|
3526
3570
|
if (isAlert) {
|
|
3527
|
-
const target =
|
|
3571
|
+
const target = cancelButtons[0] || closeButtons[0] || panel;
|
|
3528
3572
|
target?.focus?.();
|
|
3529
3573
|
} else {
|
|
3530
3574
|
panel?.focus?.();
|
|
@@ -3551,13 +3595,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3551
3595
|
root.dataset.state = "closing";
|
|
3552
3596
|
const onEnd = () => {
|
|
3553
3597
|
cancelExitWait = null;
|
|
3598
|
+
const active = document.activeElement;
|
|
3554
3599
|
root.dataset.state = "closed";
|
|
3555
3600
|
overlay.hidden = true;
|
|
3556
3601
|
panel.hidden = true;
|
|
3557
3602
|
if (focusCleanup)
|
|
3558
3603
|
focusCleanup();
|
|
3559
3604
|
focusCleanup = null;
|
|
3560
|
-
previouslyFocused
|
|
3605
|
+
returnFocus(root, previouslyFocused, active);
|
|
3561
3606
|
};
|
|
3562
3607
|
cancelExitWait = whenExitDone(panel, null, onEnd);
|
|
3563
3608
|
}
|
|
@@ -3638,16 +3683,18 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3638
3683
|
root._faqirDialog = api;
|
|
3639
3684
|
return api;
|
|
3640
3685
|
}
|
|
3641
|
-
return
|
|
3686
|
+
return createDialog;
|
|
3642
3687
|
}();
|
|
3643
3688
|
var createDrawer = controllerRegistry["drawer"] = function() {
|
|
3644
|
-
function
|
|
3689
|
+
function createDrawer(root) {
|
|
3645
3690
|
if (root._faqirDrawer)
|
|
3646
3691
|
return root._faqirDrawer;
|
|
3647
|
-
const trigger = root
|
|
3648
|
-
const overlay = root.querySelector("[data-part='overlay']");
|
|
3649
|
-
const panel = root.querySelector("[data-part='panel']");
|
|
3650
|
-
const closeButtons = root
|
|
3692
|
+
const [trigger] = ownParts(root, "trigger");
|
|
3693
|
+
const overlay = root.querySelector(":scope > [data-part='overlay']");
|
|
3694
|
+
const panel = root.querySelector(":scope > [data-part='panel']");
|
|
3695
|
+
const closeButtons = ownParts(root, "close");
|
|
3696
|
+
if (panel && !panel.hasAttribute("tabindex"))
|
|
3697
|
+
panel.setAttribute("tabindex", "-1");
|
|
3651
3698
|
let focusCleanup = null;
|
|
3652
3699
|
let previouslyFocused = null;
|
|
3653
3700
|
let prevBodyOverflow = null;
|
|
@@ -3681,6 +3728,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3681
3728
|
root.dataset.state = "closing";
|
|
3682
3729
|
const onEnd = () => {
|
|
3683
3730
|
cancelExitWait = null;
|
|
3731
|
+
const active = document.activeElement;
|
|
3684
3732
|
root.dataset.state = "closed";
|
|
3685
3733
|
overlay.hidden = true;
|
|
3686
3734
|
panel.hidden = true;
|
|
@@ -3688,7 +3736,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3688
3736
|
if (focusCleanup)
|
|
3689
3737
|
focusCleanup();
|
|
3690
3738
|
focusCleanup = null;
|
|
3691
|
-
previouslyFocused
|
|
3739
|
+
returnFocus(root, previouslyFocused, active);
|
|
3692
3740
|
};
|
|
3693
3741
|
cancelExitWait = whenExitDone(panel, "transform", onEnd);
|
|
3694
3742
|
}
|
|
@@ -3746,10 +3794,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3746
3794
|
root._faqirDrawer = api;
|
|
3747
3795
|
return api;
|
|
3748
3796
|
}
|
|
3749
|
-
return
|
|
3797
|
+
return createDrawer;
|
|
3750
3798
|
}();
|
|
3751
3799
|
var createDropdown = controllerRegistry["dropdown"] = function() {
|
|
3752
|
-
function
|
|
3800
|
+
function createDropdown(root) {
|
|
3753
3801
|
if (root._faqirDropdown)
|
|
3754
3802
|
return root._faqirDropdown;
|
|
3755
3803
|
const trigger = root.querySelector("[data-part='trigger']");
|
|
@@ -3833,10 +3881,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3833
3881
|
root._faqirDropdown = api;
|
|
3834
3882
|
return api;
|
|
3835
3883
|
}
|
|
3836
|
-
return
|
|
3884
|
+
return createDropdown;
|
|
3837
3885
|
}();
|
|
3838
3886
|
var createFileUpload = controllerRegistry["file-upload"] = function() {
|
|
3839
|
-
function
|
|
3887
|
+
function createFileUpload(root) {
|
|
3840
3888
|
if (root._faqirFileUpload)
|
|
3841
3889
|
return root._faqirFileUpload;
|
|
3842
3890
|
let dropzone = root.querySelector("[data-part='dropzone']");
|
|
@@ -3892,15 +3940,15 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3892
3940
|
const transfer = new DataTransfer;
|
|
3893
3941
|
for (const file of files)
|
|
3894
3942
|
transfer.items.add(file);
|
|
3895
|
-
const
|
|
3896
|
-
if (
|
|
3897
|
-
return
|
|
3943
|
+
const list = transfer.files;
|
|
3944
|
+
if (list instanceof FileList)
|
|
3945
|
+
return list;
|
|
3898
3946
|
try {
|
|
3899
3947
|
const fallback = new FileList;
|
|
3900
3948
|
fallback.push(...files);
|
|
3901
3949
|
return fallback;
|
|
3902
3950
|
} catch {
|
|
3903
|
-
return
|
|
3951
|
+
return list;
|
|
3904
3952
|
}
|
|
3905
3953
|
}
|
|
3906
3954
|
function syncState() {
|
|
@@ -3941,14 +3989,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
3941
3989
|
const metadata = document.createElement("span");
|
|
3942
3990
|
metadata.setAttribute("data-part", "metadata");
|
|
3943
3991
|
metadata.textContent = `${file.type || "Unknown type"} · ${formatSize(file.size)}`;
|
|
3944
|
-
const
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3992
|
+
const remove = document.createElement("button");
|
|
3993
|
+
remove.setAttribute("data-part", "remove");
|
|
3994
|
+
remove.setAttribute("type", "button");
|
|
3995
|
+
remove.setAttribute("aria-label", `Remove ${file.name}`);
|
|
3996
|
+
remove.textContent = "Remove";
|
|
3997
|
+
remove.disabled = isDisabled();
|
|
3950
3998
|
details.append(name, metadata);
|
|
3951
|
-
row.append(details,
|
|
3999
|
+
row.append(details, remove);
|
|
3952
4000
|
list.appendChild(row);
|
|
3953
4001
|
}
|
|
3954
4002
|
syncState();
|
|
@@ -4128,10 +4176,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4128
4176
|
root._faqirFileUpload = api;
|
|
4129
4177
|
return api;
|
|
4130
4178
|
}
|
|
4131
|
-
return
|
|
4179
|
+
return createFileUpload;
|
|
4132
4180
|
}();
|
|
4133
4181
|
var createInputOTP = controllerRegistry["input-otp"] = function() {
|
|
4134
|
-
function
|
|
4182
|
+
function createInputOTP(root) {
|
|
4135
4183
|
if (root._faqirInputOTP)
|
|
4136
4184
|
return root._faqirInputOTP;
|
|
4137
4185
|
const N = clampInt(root.getAttribute("data-length"), 6, 1, 12);
|
|
@@ -4223,9 +4271,9 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4223
4271
|
updateActive();
|
|
4224
4272
|
}
|
|
4225
4273
|
function updateActive() {
|
|
4226
|
-
for (const
|
|
4227
|
-
|
|
4228
|
-
|
|
4274
|
+
for (const seg of segments) {
|
|
4275
|
+
seg.removeAttribute("data-active");
|
|
4276
|
+
seg.removeAttribute("data-caret");
|
|
4229
4277
|
}
|
|
4230
4278
|
if (!focused || isDisabled())
|
|
4231
4279
|
return;
|
|
@@ -4463,10 +4511,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4463
4511
|
return fallback;
|
|
4464
4512
|
return Math.max(lo, Math.min(hi, n));
|
|
4465
4513
|
}
|
|
4466
|
-
return
|
|
4514
|
+
return createInputOTP;
|
|
4467
4515
|
}();
|
|
4468
4516
|
var createMenubar = controllerRegistry["menubar"] = function() {
|
|
4469
|
-
function
|
|
4517
|
+
function createMenubar(root) {
|
|
4470
4518
|
if (root._faqirMenubar)
|
|
4471
4519
|
return root._faqirMenubar;
|
|
4472
4520
|
const submenus = [...root.querySelectorAll("[data-part='submenu'][role='menu']")].filter((menu) => menu.closest("[data-ui='menubar']") === root);
|
|
@@ -4671,10 +4719,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4671
4719
|
root._faqirMenubar = api;
|
|
4672
4720
|
return api;
|
|
4673
4721
|
}
|
|
4674
|
-
return
|
|
4722
|
+
return createMenubar;
|
|
4675
4723
|
}();
|
|
4676
4724
|
var createPagination = controllerRegistry["pagination"] = function() {
|
|
4677
|
-
function
|
|
4725
|
+
function createPagination(root) {
|
|
4678
4726
|
if (root._faqirPagination)
|
|
4679
4727
|
return root._faqirPagination;
|
|
4680
4728
|
const nav = root.querySelector("[data-part='nav']");
|
|
@@ -4823,15 +4871,15 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4823
4871
|
...endPages
|
|
4824
4872
|
];
|
|
4825
4873
|
}
|
|
4826
|
-
return
|
|
4874
|
+
return createPagination;
|
|
4827
4875
|
}();
|
|
4828
4876
|
var createPopover = controllerRegistry["popover"] = function() {
|
|
4829
|
-
function
|
|
4877
|
+
function createPopover(root) {
|
|
4830
4878
|
if (root._faqirPopover)
|
|
4831
4879
|
return root._faqirPopover;
|
|
4832
4880
|
const trigger = root.querySelector("[data-part='trigger']");
|
|
4833
4881
|
const content = root.querySelector("[data-part='content']");
|
|
4834
|
-
const closeBtn = root
|
|
4882
|
+
const [closeBtn] = ownParts(root, "close");
|
|
4835
4883
|
let outsideClickCleanup = null;
|
|
4836
4884
|
function open() {
|
|
4837
4885
|
root.dataset.state = "open";
|
|
@@ -4882,7 +4930,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4882
4930
|
root._faqirPopover = api;
|
|
4883
4931
|
return api;
|
|
4884
4932
|
}
|
|
4885
|
-
return
|
|
4933
|
+
return createPopover;
|
|
4886
4934
|
}();
|
|
4887
4935
|
var createQRCode = controllerRegistry["qr-code"] = function() {
|
|
4888
4936
|
const EXP = new Uint8Array(256);
|
|
@@ -4926,37 +4974,105 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4926
4974
|
return msg.slice(data.length);
|
|
4927
4975
|
}
|
|
4928
4976
|
const ECL_MAP = { L: 0, M: 1, Q: 2, H: 3 };
|
|
4929
|
-
const
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4977
|
+
const EC_PER_BLOCK = [
|
|
4978
|
+
7,
|
|
4979
|
+
10,
|
|
4980
|
+
13,
|
|
4981
|
+
17,
|
|
4982
|
+
10,
|
|
4983
|
+
16,
|
|
4984
|
+
22,
|
|
4985
|
+
28,
|
|
4986
|
+
15,
|
|
4987
|
+
26,
|
|
4988
|
+
18,
|
|
4989
|
+
22,
|
|
4990
|
+
20,
|
|
4991
|
+
18,
|
|
4992
|
+
26,
|
|
4993
|
+
16,
|
|
4994
|
+
26,
|
|
4995
|
+
24,
|
|
4996
|
+
18,
|
|
4997
|
+
22,
|
|
4998
|
+
18,
|
|
4999
|
+
16,
|
|
5000
|
+
24,
|
|
5001
|
+
28,
|
|
5002
|
+
20,
|
|
5003
|
+
18,
|
|
5004
|
+
18,
|
|
5005
|
+
26,
|
|
5006
|
+
24,
|
|
5007
|
+
22,
|
|
5008
|
+
22,
|
|
5009
|
+
26,
|
|
5010
|
+
30,
|
|
5011
|
+
22,
|
|
5012
|
+
20,
|
|
5013
|
+
24,
|
|
5014
|
+
18,
|
|
5015
|
+
26,
|
|
5016
|
+
24,
|
|
5017
|
+
28
|
|
4941
5018
|
];
|
|
4942
|
-
const
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
5019
|
+
const BLOCKS = [
|
|
5020
|
+
1,
|
|
5021
|
+
1,
|
|
5022
|
+
1,
|
|
5023
|
+
1,
|
|
5024
|
+
1,
|
|
5025
|
+
1,
|
|
5026
|
+
1,
|
|
5027
|
+
1,
|
|
5028
|
+
1,
|
|
5029
|
+
1,
|
|
5030
|
+
2,
|
|
5031
|
+
2,
|
|
5032
|
+
1,
|
|
5033
|
+
2,
|
|
5034
|
+
2,
|
|
5035
|
+
4,
|
|
5036
|
+
1,
|
|
5037
|
+
2,
|
|
5038
|
+
4,
|
|
5039
|
+
4,
|
|
5040
|
+
2,
|
|
5041
|
+
4,
|
|
5042
|
+
4,
|
|
5043
|
+
4,
|
|
5044
|
+
2,
|
|
5045
|
+
4,
|
|
5046
|
+
6,
|
|
5047
|
+
5,
|
|
5048
|
+
2,
|
|
5049
|
+
4,
|
|
5050
|
+
6,
|
|
5051
|
+
6,
|
|
5052
|
+
2,
|
|
5053
|
+
5,
|
|
5054
|
+
8,
|
|
5055
|
+
8,
|
|
5056
|
+
4,
|
|
5057
|
+
5,
|
|
5058
|
+
8,
|
|
5059
|
+
8
|
|
4954
5060
|
];
|
|
5061
|
+
const TOTAL_CODEWORDS = [26, 44, 70, 100, 134, 172, 196, 242, 292, 346];
|
|
5062
|
+
function versionInfo(version, eclIdx) {
|
|
5063
|
+
const i = (version - 1) * 4 + eclIdx;
|
|
5064
|
+
const ec = EC_PER_BLOCK[i];
|
|
5065
|
+
const b = BLOCKS[i];
|
|
5066
|
+
return { dc: TOTAL_CODEWORDS[version - 1] - ec * b, ec, b };
|
|
5067
|
+
}
|
|
5068
|
+
function alignmentPositions(v) {
|
|
5069
|
+
return v < 2 ? [] : v < 7 ? [6, 4 * v + 10] : [6, 2 * v + 8, 4 * v + 10];
|
|
5070
|
+
}
|
|
4955
5071
|
function selectVersion(dataLen, ecl) {
|
|
4956
5072
|
const eclIdx = ECL_MAP[ecl] ?? 1;
|
|
4957
5073
|
for (let v = 1;v <= 10; v++) {
|
|
4958
|
-
const info =
|
|
4959
|
-
if (dataLen <= info.dc)
|
|
5074
|
+
const info = versionInfo(v, eclIdx);
|
|
5075
|
+
if (dataLen + (v < 10 ? 2 : 3) <= info.dc)
|
|
4960
5076
|
return v;
|
|
4961
5077
|
}
|
|
4962
5078
|
return -1;
|
|
@@ -4975,16 +5091,16 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
4975
5091
|
function placeFinderPattern(matrix, reserved, row, col) {
|
|
4976
5092
|
for (let r = -1;r <= 7; r++) {
|
|
4977
5093
|
for (let c = -1;c <= 7; c++) {
|
|
4978
|
-
const
|
|
4979
|
-
setModule(matrix, row + r, col + c,
|
|
5094
|
+
const d = Math.max(Math.abs(r - 3), Math.abs(c - 3));
|
|
5095
|
+
setModule(matrix, row + r, col + c, d !== 2 && d !== 4 ? 1 : 0, reserved);
|
|
4980
5096
|
}
|
|
4981
5097
|
}
|
|
4982
5098
|
}
|
|
4983
5099
|
function placeAlignmentPattern(matrix, reserved, row, col) {
|
|
4984
5100
|
for (let r = -2;r <= 2; r++) {
|
|
4985
5101
|
for (let c = -2;c <= 2; c++) {
|
|
4986
|
-
const
|
|
4987
|
-
setModule(matrix, row + r, col + c,
|
|
5102
|
+
const d = Math.max(Math.abs(r), Math.abs(c));
|
|
5103
|
+
setModule(matrix, row + r, col + c, d !== 1 ? 1 : 0, reserved);
|
|
4988
5104
|
}
|
|
4989
5105
|
}
|
|
4990
5106
|
}
|
|
@@ -5007,23 +5123,35 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5007
5123
|
setModule(reserved, 8, 8, 1);
|
|
5008
5124
|
setModule(matrix, s - 8, 8, 1, reserved);
|
|
5009
5125
|
}
|
|
5126
|
+
function placeVersionInfo(matrix, reserved, version) {
|
|
5127
|
+
if (version < 7)
|
|
5128
|
+
return;
|
|
5129
|
+
const s = matrix.length;
|
|
5130
|
+
let rem = version;
|
|
5131
|
+
for (let i = 0;i < 12; i++)
|
|
5132
|
+
rem = rem << 1 ^ (rem >> 11) * 7973;
|
|
5133
|
+
const bits = version << 12 | rem;
|
|
5134
|
+
for (let i = 0;i < 18; i++) {
|
|
5135
|
+
const bit = bits >> i & 1;
|
|
5136
|
+
const a = s - 11 + i % 3;
|
|
5137
|
+
const b = i / 3 | 0;
|
|
5138
|
+
setModule(matrix, b, a, bit, reserved);
|
|
5139
|
+
setModule(matrix, a, b, bit, reserved);
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5010
5142
|
function placeData(matrix, reserved, bits) {
|
|
5011
5143
|
const s = matrix.length;
|
|
5012
5144
|
let bitIdx = 0;
|
|
5013
|
-
let upward = true;
|
|
5014
|
-
for (let col = s - 1;col >= 1; col -= 2) {
|
|
5145
|
+
for (let col = s - 1, upward = true;col >= 1; col -= 2, upward = !upward) {
|
|
5015
5146
|
if (col === 6)
|
|
5016
5147
|
col = 5;
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
for (let
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
continue;
|
|
5023
|
-
matrix[row][cc] = bitIdx < bits.length ? bits[bitIdx++] : 0;
|
|
5148
|
+
for (let i = 0;i < s; i++) {
|
|
5149
|
+
const row = upward ? s - 1 - i : i;
|
|
5150
|
+
for (let cc = col;cc > col - 2; cc--) {
|
|
5151
|
+
if (!reserved[row][cc])
|
|
5152
|
+
matrix[row][cc] = bits[bitIdx++] | 0;
|
|
5024
5153
|
}
|
|
5025
5154
|
}
|
|
5026
|
-
upward = !upward;
|
|
5027
5155
|
}
|
|
5028
5156
|
}
|
|
5029
5157
|
function applyMask(matrix, reserved, maskId) {
|
|
@@ -5067,7 +5195,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5067
5195
|
matrix[7][8] = bit;
|
|
5068
5196
|
else
|
|
5069
5197
|
matrix[14 - i][8] = bit;
|
|
5070
|
-
if (i <
|
|
5198
|
+
if (i < 7)
|
|
5071
5199
|
matrix[s - 1 - i][8] = bit;
|
|
5072
5200
|
else
|
|
5073
5201
|
matrix[8][s - 15 + i] = bit;
|
|
@@ -5110,7 +5238,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5110
5238
|
if (version < 0)
|
|
5111
5239
|
throw new Error("Data too long for QR versions 1–10");
|
|
5112
5240
|
const eclIdx = ECL_MAP[ecl] ?? 1;
|
|
5113
|
-
const info =
|
|
5241
|
+
const info = versionInfo(version, eclIdx);
|
|
5114
5242
|
const size = version * 4 + 17;
|
|
5115
5243
|
const codewords = [];
|
|
5116
5244
|
const ccBits = version <= 9 ? 8 : 16;
|
|
@@ -5140,7 +5268,6 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5140
5268
|
}
|
|
5141
5269
|
const blocks = [];
|
|
5142
5270
|
const ecBlocks = [];
|
|
5143
|
-
const ecPerBlock = info.ec / info.b;
|
|
5144
5271
|
const dcPerBlock = Math.floor(info.dc / info.b);
|
|
5145
5272
|
const remainder = info.dc % info.b;
|
|
5146
5273
|
let offset = 0;
|
|
@@ -5149,7 +5276,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5149
5276
|
const blockData = codewords.slice(offset, offset + blockDc);
|
|
5150
5277
|
offset += blockDc;
|
|
5151
5278
|
blocks.push(blockData);
|
|
5152
|
-
ecBlocks.push(rsEncode(blockData,
|
|
5279
|
+
ecBlocks.push(rsEncode(blockData, info.ec));
|
|
5153
5280
|
}
|
|
5154
5281
|
const interleaved = [];
|
|
5155
5282
|
const maxDc = Math.max(...blocks.map((b) => b.length));
|
|
@@ -5159,11 +5286,9 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5159
5286
|
interleaved.push(block[i]);
|
|
5160
5287
|
}
|
|
5161
5288
|
}
|
|
5162
|
-
for (let i = 0;i <
|
|
5163
|
-
for (const ec of ecBlocks)
|
|
5164
|
-
|
|
5165
|
-
interleaved.push(ec[i]);
|
|
5166
|
-
}
|
|
5289
|
+
for (let i = 0;i < info.ec; i++) {
|
|
5290
|
+
for (const ec of ecBlocks)
|
|
5291
|
+
interleaved.push(ec[i]);
|
|
5167
5292
|
}
|
|
5168
5293
|
const bits = [];
|
|
5169
5294
|
interleaved.forEach((byte) => {
|
|
@@ -5175,7 +5300,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5175
5300
|
placeFinderPattern(matrix, reserved, 0, 0);
|
|
5176
5301
|
placeFinderPattern(matrix, reserved, 0, size - 7);
|
|
5177
5302
|
placeFinderPattern(matrix, reserved, size - 7, 0);
|
|
5178
|
-
const alignPos =
|
|
5303
|
+
const alignPos = alignmentPositions(version);
|
|
5179
5304
|
for (const r of alignPos) {
|
|
5180
5305
|
for (const c of alignPos) {
|
|
5181
5306
|
if (reserved[r]?.[c])
|
|
@@ -5185,6 +5310,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5185
5310
|
}
|
|
5186
5311
|
placeTimingPatterns(matrix, reserved);
|
|
5187
5312
|
reserveFormatArea(matrix, reserved);
|
|
5313
|
+
placeVersionInfo(matrix, reserved, version);
|
|
5188
5314
|
let bestMask = 0;
|
|
5189
5315
|
let bestScore = Infinity;
|
|
5190
5316
|
for (let m = 0;m < 8; m++) {
|
|
@@ -5230,7 +5356,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5230
5356
|
svg.appendChild(path);
|
|
5231
5357
|
return svg;
|
|
5232
5358
|
}
|
|
5233
|
-
function
|
|
5359
|
+
function createQRCode(root) {
|
|
5234
5360
|
if (root._faqirQR)
|
|
5235
5361
|
return root._faqirQR;
|
|
5236
5362
|
function render() {
|
|
@@ -5282,10 +5408,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5282
5408
|
root._faqirQR = api;
|
|
5283
5409
|
return api;
|
|
5284
5410
|
}
|
|
5285
|
-
return
|
|
5411
|
+
return createQRCode;
|
|
5286
5412
|
}();
|
|
5287
5413
|
var createSelectCustom = controllerRegistry["select-custom"] = function() {
|
|
5288
|
-
function
|
|
5414
|
+
function createSelectCustom(root) {
|
|
5289
5415
|
if (root._faqirSelectCustom)
|
|
5290
5416
|
return root._faqirSelectCustom;
|
|
5291
5417
|
const trigger = root.querySelector("[data-part='trigger']");
|
|
@@ -5529,16 +5655,18 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5529
5655
|
root._faqirSelectCustom = api;
|
|
5530
5656
|
return api;
|
|
5531
5657
|
}
|
|
5532
|
-
return
|
|
5658
|
+
return createSelectCustom;
|
|
5533
5659
|
}();
|
|
5534
5660
|
var createSheet = controllerRegistry["sheet"] = function() {
|
|
5535
|
-
function
|
|
5661
|
+
function createSheet(root) {
|
|
5536
5662
|
if (root._faqirSheet)
|
|
5537
5663
|
return root._faqirSheet;
|
|
5538
|
-
const trigger = root
|
|
5539
|
-
const overlay = root.querySelector("[data-part='overlay']");
|
|
5540
|
-
const panel = root.querySelector("[data-part='panel']");
|
|
5541
|
-
const closeButtons = root
|
|
5664
|
+
const [trigger] = ownParts(root, "trigger");
|
|
5665
|
+
const overlay = root.querySelector(":scope > [data-part='overlay']");
|
|
5666
|
+
const panel = root.querySelector(":scope > [data-part='panel']");
|
|
5667
|
+
const closeButtons = ownParts(root, "close");
|
|
5668
|
+
if (panel && !panel.hasAttribute("tabindex"))
|
|
5669
|
+
panel.setAttribute("tabindex", "-1");
|
|
5542
5670
|
let focusCleanup = null;
|
|
5543
5671
|
let previouslyFocused = null;
|
|
5544
5672
|
let prevBodyOverflow = null;
|
|
@@ -5572,6 +5700,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5572
5700
|
root.dataset.state = "closing";
|
|
5573
5701
|
const onEnd = () => {
|
|
5574
5702
|
cancelExitWait = null;
|
|
5703
|
+
const active = document.activeElement;
|
|
5575
5704
|
root.dataset.state = "closed";
|
|
5576
5705
|
overlay.hidden = true;
|
|
5577
5706
|
panel.hidden = true;
|
|
@@ -5579,7 +5708,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5579
5708
|
if (focusCleanup)
|
|
5580
5709
|
focusCleanup();
|
|
5581
5710
|
focusCleanup = null;
|
|
5582
|
-
previouslyFocused
|
|
5711
|
+
returnFocus(root, previouslyFocused, active);
|
|
5583
5712
|
};
|
|
5584
5713
|
cancelExitWait = whenExitDone(panel, "transform", onEnd);
|
|
5585
5714
|
}
|
|
@@ -5630,15 +5759,15 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5630
5759
|
root._faqirSheet = api;
|
|
5631
5760
|
return api;
|
|
5632
5761
|
}
|
|
5633
|
-
return
|
|
5762
|
+
return createSheet;
|
|
5634
5763
|
}();
|
|
5635
5764
|
var createSidebar = controllerRegistry["sidebar"] = function() {
|
|
5636
|
-
function
|
|
5765
|
+
function createSidebar(root) {
|
|
5637
5766
|
if (root._faqirSidebar)
|
|
5638
5767
|
return root._faqirSidebar;
|
|
5639
|
-
const overlay = root.querySelector("[data-part='overlay']");
|
|
5640
|
-
const panel = root.querySelector("[data-part='panel']") || root;
|
|
5641
|
-
const internalTriggers =
|
|
5768
|
+
const overlay = root.querySelector(":scope > [data-part='overlay']");
|
|
5769
|
+
const panel = root.querySelector(":scope > [data-part='panel']") || root;
|
|
5770
|
+
const internalTriggers = ownParts(root, "trigger");
|
|
5642
5771
|
const externalTriggers = root.id ? [...document.querySelectorAll(`[data-sidebar-toggle="${root.id}"]`)] : [];
|
|
5643
5772
|
const triggers = [...internalTriggers, ...externalTriggers];
|
|
5644
5773
|
const declared = root.dataset.state || "expanded";
|
|
@@ -5788,10 +5917,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
5788
5917
|
root._faqirSidebar = api;
|
|
5789
5918
|
return api;
|
|
5790
5919
|
}
|
|
5791
|
-
return
|
|
5920
|
+
return createSidebar;
|
|
5792
5921
|
}();
|
|
5793
5922
|
var createSlider = controllerRegistry["slider"] = function() {
|
|
5794
|
-
function
|
|
5923
|
+
function createSlider(root) {
|
|
5795
5924
|
if (root._faqirSlider)
|
|
5796
5925
|
return root._faqirSlider;
|
|
5797
5926
|
const track = root.querySelector("[data-part='track']");
|
|
@@ -6081,16 +6210,17 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6081
6210
|
const n = Number(raw);
|
|
6082
6211
|
return Number.isFinite(n) ? n : fallback;
|
|
6083
6212
|
}
|
|
6084
|
-
return
|
|
6213
|
+
return createSlider;
|
|
6085
6214
|
}();
|
|
6086
6215
|
var createTable = controllerRegistry["table"] = function() {
|
|
6087
|
-
function
|
|
6216
|
+
function createTable(root) {
|
|
6088
6217
|
if (root._faqirTable)
|
|
6089
6218
|
return root._faqirTable;
|
|
6219
|
+
const mine = (el) => el.closest("[data-ui='table']") === root;
|
|
6090
6220
|
const table = root.querySelector("[data-part='table']");
|
|
6091
6221
|
const thead = root.querySelector("[data-part='thead']");
|
|
6092
6222
|
const tbody = root.querySelector("[data-part='tbody']");
|
|
6093
|
-
const tfoot = root.
|
|
6223
|
+
const tfoot = [...root.querySelectorAll("[data-part='tfoot']")].find(mine);
|
|
6094
6224
|
const headerCheckbox = thead?.querySelector("[data-part='checkbox']");
|
|
6095
6225
|
const opts = {
|
|
6096
6226
|
multiSort: root.hasAttribute("data-multi-sort"),
|
|
@@ -6130,7 +6260,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6130
6260
|
const originalIndex = new WeakMap;
|
|
6131
6261
|
let originSeq = 0;
|
|
6132
6262
|
const collator = new Intl.Collator(opts.locale, { numeric: true, sensitivity: "base" });
|
|
6133
|
-
const toggleAttr = (el, name,
|
|
6263
|
+
const toggleAttr = (el, name, on) => on ? el.setAttribute(name, "") : el.removeAttribute(name);
|
|
6134
6264
|
const later = (fn, ms) => {
|
|
6135
6265
|
const t = setTimeout(() => {
|
|
6136
6266
|
timers.delete(t);
|
|
@@ -6291,23 +6421,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6291
6421
|
return type;
|
|
6292
6422
|
}
|
|
6293
6423
|
function formatValue(n, fmt) {
|
|
6424
|
+
const o = fmt === "currency" ? { style: fmt, currency: opts.currency, currencySign: accounting ? "accounting" : "standard" } : fmt === "percent" ? { style: fmt, maximumFractionDigits: 2 } : fmt === "number" && { maximumFractionDigits: 2 };
|
|
6294
6425
|
try {
|
|
6295
|
-
if (
|
|
6296
|
-
return new Intl.NumberFormat(opts.locale,
|
|
6297
|
-
style: "currency",
|
|
6298
|
-
currency: opts.currency,
|
|
6299
|
-
currencySign: accounting ? "accounting" : "standard"
|
|
6300
|
-
}).format(n);
|
|
6301
|
-
}
|
|
6302
|
-
if (fmt === "percent") {
|
|
6303
|
-
return new Intl.NumberFormat(opts.locale, {
|
|
6304
|
-
style: "percent",
|
|
6305
|
-
maximumFractionDigits: 2
|
|
6306
|
-
}).format(n / 100);
|
|
6307
|
-
}
|
|
6308
|
-
if (fmt === "number") {
|
|
6309
|
-
return new Intl.NumberFormat(opts.locale, { maximumFractionDigits: 2 }).format(n);
|
|
6310
|
-
}
|
|
6426
|
+
if (o)
|
|
6427
|
+
return new Intl.NumberFormat(opts.locale, o).format(fmt === "percent" ? n / 100 : n);
|
|
6311
6428
|
} catch {}
|
|
6312
6429
|
return String(n);
|
|
6313
6430
|
}
|
|
@@ -6429,10 +6546,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6429
6546
|
if (!rb)
|
|
6430
6547
|
return -1;
|
|
6431
6548
|
if (type === "date") {
|
|
6432
|
-
const
|
|
6433
|
-
const
|
|
6434
|
-
if (!isNaN(
|
|
6435
|
-
return
|
|
6549
|
+
const na = parseDateValue(ra);
|
|
6550
|
+
const nb = parseDateValue(rb);
|
|
6551
|
+
if (!isNaN(na) && !isNaN(nb))
|
|
6552
|
+
return na - nb;
|
|
6436
6553
|
}
|
|
6437
6554
|
const na = parseNumeric(ra);
|
|
6438
6555
|
const nb = parseNumeric(rb);
|
|
@@ -6555,13 +6672,16 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6555
6672
|
});
|
|
6556
6673
|
refreshStripes();
|
|
6557
6674
|
}
|
|
6675
|
+
function sortChanged() {
|
|
6676
|
+
applySorts();
|
|
6677
|
+
emit("sort", { sorts: sorts.map((s) => ({ column: s.index, direction: s.dir })) });
|
|
6678
|
+
scheduleStateSave();
|
|
6679
|
+
}
|
|
6558
6680
|
function sort(columnIndex, direction) {
|
|
6559
6681
|
if (!tbody || bodyRows().length === 0)
|
|
6560
6682
|
return;
|
|
6561
6683
|
sorts = [{ index: columnIndex, dir: direction }];
|
|
6562
|
-
|
|
6563
|
-
emit("sort", { sorts: sorts.map((s) => ({ column: s.index, direction: s.dir })) });
|
|
6564
|
-
scheduleStateSave();
|
|
6684
|
+
sortChanged();
|
|
6565
6685
|
}
|
|
6566
6686
|
function sortBy(specs) {
|
|
6567
6687
|
if (!tbody || bodyRows().length === 0)
|
|
@@ -6570,17 +6690,13 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6570
6690
|
index: s.column != null ? s.column : s.index,
|
|
6571
6691
|
dir: s.direction || s.dir || "ascending"
|
|
6572
6692
|
})).filter((s) => Number.isInteger(s.index) && s.index >= 0 && s.index < columnCount());
|
|
6573
|
-
|
|
6574
|
-
emit("sort", { sorts: sorts.map((s) => ({ column: s.index, direction: s.dir })) });
|
|
6575
|
-
scheduleStateSave();
|
|
6693
|
+
sortChanged();
|
|
6576
6694
|
}
|
|
6577
6695
|
function clearSort() {
|
|
6578
6696
|
if (!sorts.length)
|
|
6579
6697
|
return;
|
|
6580
6698
|
sorts = [];
|
|
6581
|
-
|
|
6582
|
-
emit("sort", { sorts: [] });
|
|
6583
|
-
scheduleStateSave();
|
|
6699
|
+
sortChanged();
|
|
6584
6700
|
}
|
|
6585
6701
|
function handleSortRequest(idx, additive) {
|
|
6586
6702
|
const existing = sorts.find((s) => s.index === idx);
|
|
@@ -6601,9 +6717,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6601
6717
|
} else {
|
|
6602
6718
|
sorts = dir === null ? [] : [{ index: idx, dir }];
|
|
6603
6719
|
}
|
|
6604
|
-
|
|
6605
|
-
emit("sort", { sorts: sorts.map((s) => ({ column: s.index, direction: s.dir })) });
|
|
6606
|
-
scheduleStateSave();
|
|
6720
|
+
sortChanged();
|
|
6607
6721
|
}
|
|
6608
6722
|
function setRowSelected(row, selected) {
|
|
6609
6723
|
toggleAttr(row, "data-selected", selected);
|
|
@@ -6618,8 +6732,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6618
6732
|
const row = rows[index];
|
|
6619
6733
|
setRowSelected(row, !row.hasAttribute("data-selected"));
|
|
6620
6734
|
lastSelectedIndex = index;
|
|
6621
|
-
|
|
6622
|
-
emit("selection-change", { selected: getSelected() });
|
|
6735
|
+
selectionChanged();
|
|
6623
6736
|
}
|
|
6624
6737
|
function selectAll() {
|
|
6625
6738
|
const filtered = !!globalFilter || columnFilters.size > 0;
|
|
@@ -6628,15 +6741,13 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6628
6741
|
continue;
|
|
6629
6742
|
setRowSelected(row, true);
|
|
6630
6743
|
}
|
|
6631
|
-
|
|
6632
|
-
emit("selection-change", { selected: getSelected() });
|
|
6744
|
+
selectionChanged();
|
|
6633
6745
|
}
|
|
6634
6746
|
function deselectAll() {
|
|
6635
6747
|
for (const row of bodyRows())
|
|
6636
6748
|
setRowSelected(row, false);
|
|
6637
6749
|
lastSelectedIndex = -1;
|
|
6638
|
-
|
|
6639
|
-
emit("selection-change", { selected: getSelected() });
|
|
6750
|
+
selectionChanged();
|
|
6640
6751
|
}
|
|
6641
6752
|
function getSelected() {
|
|
6642
6753
|
return bodyRows().map((row, index) => ({ row, index })).filter(({ row }) => row.hasAttribute("data-selected")).map(({ index }) => index);
|
|
@@ -6649,23 +6760,18 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6649
6760
|
if (i >= 0 && i < rows.length && isRowVisible(rows[i]))
|
|
6650
6761
|
setRowSelected(rows[i], true);
|
|
6651
6762
|
}
|
|
6763
|
+
}
|
|
6764
|
+
function selectionChanged() {
|
|
6652
6765
|
updateHeaderCheckbox();
|
|
6766
|
+
emit("selection-change", { selected: getSelected() });
|
|
6653
6767
|
}
|
|
6654
6768
|
function updateHeaderCheckbox() {
|
|
6655
6769
|
if (!headerCheckbox)
|
|
6656
6770
|
return;
|
|
6657
6771
|
const rows = visibleBodyRows();
|
|
6658
|
-
const
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
headerCheckbox.indeterminate = false;
|
|
6662
|
-
} else if (selected.length === rows.length) {
|
|
6663
|
-
headerCheckbox.checked = true;
|
|
6664
|
-
headerCheckbox.indeterminate = false;
|
|
6665
|
-
} else {
|
|
6666
|
-
headerCheckbox.checked = false;
|
|
6667
|
-
headerCheckbox.indeterminate = true;
|
|
6668
|
-
}
|
|
6772
|
+
const n = rows.filter((r) => r.hasAttribute("data-selected")).length;
|
|
6773
|
+
headerCheckbox.checked = n > 0 && n === rows.length;
|
|
6774
|
+
headerCheckbox.indeterminate = n > 0 && n < rows.length;
|
|
6669
6775
|
}
|
|
6670
6776
|
function matchQuery(cell, query, type) {
|
|
6671
6777
|
const q = String(query).trim();
|
|
@@ -6762,6 +6868,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6762
6868
|
refreshStripes();
|
|
6763
6869
|
updateHeaderCheckbox();
|
|
6764
6870
|
computeAggregates();
|
|
6871
|
+
setupNavigability();
|
|
6765
6872
|
emit("filter", { query: globalFilter, visible, total: rows.length });
|
|
6766
6873
|
scheduleStateSave();
|
|
6767
6874
|
}
|
|
@@ -6783,7 +6890,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6783
6890
|
applyFilters();
|
|
6784
6891
|
}
|
|
6785
6892
|
function syncFilterInputs() {
|
|
6786
|
-
const g = root.
|
|
6893
|
+
const g = [...root.querySelectorAll("[data-part='filter']")].find(mine);
|
|
6787
6894
|
if (g && g.value !== globalFilter)
|
|
6788
6895
|
g.value = globalFilter;
|
|
6789
6896
|
const fr = filterRowEl();
|
|
@@ -6809,6 +6916,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6809
6916
|
toggleAttr(m, "data-collapsed", !expand);
|
|
6810
6917
|
refreshStripes();
|
|
6811
6918
|
updateHeaderCheckbox();
|
|
6919
|
+
setupNavigability();
|
|
6812
6920
|
emit("group-toggle", { group: gh, expanded: expand });
|
|
6813
6921
|
}
|
|
6814
6922
|
function revealChildren(row) {
|
|
@@ -6837,6 +6945,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6837
6945
|
}
|
|
6838
6946
|
refreshStripes();
|
|
6839
6947
|
updateHeaderCheckbox();
|
|
6948
|
+
setupNavigability();
|
|
6840
6949
|
emit("tree-toggle", { row, expanded: expand });
|
|
6841
6950
|
}
|
|
6842
6951
|
function toggleDetail(rowOrIndex, force) {
|
|
@@ -6849,30 +6958,20 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6849
6958
|
row.querySelector("[data-part='row-toggle']")?.setAttribute("aria-expanded", String(expand));
|
|
6850
6959
|
emit("row-expand", { row, detail, expanded: expand });
|
|
6851
6960
|
}
|
|
6852
|
-
function
|
|
6853
|
-
mutedRun(() => {
|
|
6854
|
-
for (const gh of groupHeaders())
|
|
6855
|
-
toggleGroup(gh, true);
|
|
6856
|
-
if (opts.tree) {
|
|
6857
|
-
for (const r of bodyRows())
|
|
6858
|
-
if (isTreeParent(r))
|
|
6859
|
-
toggleRow(r, true);
|
|
6860
|
-
}
|
|
6861
|
-
});
|
|
6862
|
-
refreshStripes();
|
|
6863
|
-
}
|
|
6864
|
-
function collapseAll() {
|
|
6961
|
+
function setAllExpanded(expand) {
|
|
6865
6962
|
mutedRun(() => {
|
|
6866
6963
|
for (const gh of groupHeaders())
|
|
6867
|
-
toggleGroup(gh,
|
|
6964
|
+
toggleGroup(gh, expand);
|
|
6868
6965
|
if (opts.tree) {
|
|
6869
6966
|
for (const r of bodyRows())
|
|
6870
6967
|
if (isTreeParent(r))
|
|
6871
|
-
toggleRow(r,
|
|
6968
|
+
toggleRow(r, expand);
|
|
6872
6969
|
}
|
|
6873
6970
|
});
|
|
6874
6971
|
refreshStripes();
|
|
6875
6972
|
}
|
|
6973
|
+
const expandAll = () => setAllExpanded(true);
|
|
6974
|
+
const collapseAll = () => setAllExpanded(false);
|
|
6876
6975
|
function writeAggregate(cell, rows, ownIndex) {
|
|
6877
6976
|
const fn = cell.getAttribute("data-aggregate");
|
|
6878
6977
|
const col = cell.hasAttribute("data-col") ? parseInt(cell.getAttribute("data-col"), 10) : ownIndex != null ? ownIndex : cellsOf(cell.parentElement).indexOf(cell);
|
|
@@ -6911,7 +7010,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6911
7010
|
return;
|
|
6912
7011
|
}
|
|
6913
7012
|
cell.setAttribute("data-value", String(out));
|
|
6914
|
-
const fmt = fn === "count" ? cell.getAttribute("data-format") : cell
|
|
7013
|
+
const fmt = fn === "count" ? cell.getAttribute("data-format") : cellFormatOf(cell, col) || "number";
|
|
6915
7014
|
cell.textContent = fmt ? formatValue(out, fmt) : String(out);
|
|
6916
7015
|
applyNegativeFlag(cell);
|
|
6917
7016
|
}
|
|
@@ -6986,9 +7085,9 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
6986
7085
|
if (a instanceof Element)
|
|
6987
7086
|
cell = a;
|
|
6988
7087
|
else {
|
|
6989
|
-
const
|
|
6990
|
-
if (
|
|
6991
|
-
cell = cellsOf(
|
|
7088
|
+
const row = bodyRows()[a];
|
|
7089
|
+
if (row)
|
|
7090
|
+
cell = cellsOf(row)[b] || null;
|
|
6992
7091
|
}
|
|
6993
7092
|
if (!cell || !isCellEditable(cell))
|
|
6994
7093
|
return false;
|
|
@@ -7107,17 +7206,15 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7107
7206
|
function onEditorKeydown(e) {
|
|
7108
7207
|
if (!editing)
|
|
7109
7208
|
return;
|
|
7209
|
+
e.stopPropagation();
|
|
7110
7210
|
if (e.key === "Enter") {
|
|
7111
7211
|
e.preventDefault();
|
|
7112
|
-
e.stopPropagation();
|
|
7113
7212
|
commitEdit(true);
|
|
7114
7213
|
} else if (e.key === "Escape") {
|
|
7115
7214
|
e.preventDefault();
|
|
7116
|
-
e.stopPropagation();
|
|
7117
7215
|
cancelEdit(true);
|
|
7118
7216
|
} else if (e.key === "Tab") {
|
|
7119
7217
|
e.preventDefault();
|
|
7120
|
-
e.stopPropagation();
|
|
7121
7218
|
const from = editing.cell;
|
|
7122
7219
|
if (commitEdit()) {
|
|
7123
7220
|
const next = nextEditableCell(from, e.shiftKey ? -1 : 1);
|
|
@@ -7126,7 +7223,6 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7126
7223
|
}
|
|
7127
7224
|
} else {
|
|
7128
7225
|
e.target.removeAttribute("data-invalid");
|
|
7129
|
-
e.stopPropagation();
|
|
7130
7226
|
}
|
|
7131
7227
|
}
|
|
7132
7228
|
function onEditorBlur(e) {
|
|
@@ -7171,6 +7267,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7171
7267
|
return;
|
|
7172
7268
|
forEachColumnCell(i, (cell) => toggleAttr(cell, "data-col-hidden", hidden));
|
|
7173
7269
|
refreshPins();
|
|
7270
|
+
setupNavigability();
|
|
7174
7271
|
emit("col-visibility", { column: i, hidden: !!hidden });
|
|
7175
7272
|
scheduleStateSave();
|
|
7176
7273
|
}
|
|
@@ -7282,14 +7379,11 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7282
7379
|
}
|
|
7283
7380
|
}
|
|
7284
7381
|
function elementAt(e) {
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
return null;
|
|
7290
|
-
}
|
|
7382
|
+
try {
|
|
7383
|
+
return document.elementFromPoint(e.clientX, e.clientY);
|
|
7384
|
+
} catch {
|
|
7385
|
+
return null;
|
|
7291
7386
|
}
|
|
7292
|
-
return null;
|
|
7293
7387
|
}
|
|
7294
7388
|
function resolveRowAt(e) {
|
|
7295
7389
|
let row = elementAt(e)?.closest?.("[data-part='tr']");
|
|
@@ -7297,18 +7391,13 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7297
7391
|
row = e.target?.closest?.("[data-part='tr']");
|
|
7298
7392
|
return row && tbody?.contains(row) ? row : null;
|
|
7299
7393
|
}
|
|
7300
|
-
function dropPos(e, el) {
|
|
7301
|
-
const rect = el.getBoundingClientRect?.();
|
|
7302
|
-
if (!rect || !rect.height)
|
|
7303
|
-
return "after";
|
|
7304
|
-
return e.clientY < rect.top + rect.height / 2 ? "before" : "after";
|
|
7305
|
-
}
|
|
7306
|
-
function dropPosX(e, el) {
|
|
7394
|
+
function dropPos(e, el, horizontal) {
|
|
7307
7395
|
const rect = el.getBoundingClientRect?.();
|
|
7308
|
-
|
|
7396
|
+
const size = rect && (horizontal ? rect.width : rect.height);
|
|
7397
|
+
if (!size)
|
|
7309
7398
|
return "after";
|
|
7310
|
-
const before = e.clientX < rect.left + rect.
|
|
7311
|
-
return before
|
|
7399
|
+
const before = horizontal ? e.clientX < rect.left + size / 2 !== isRTL : e.clientY < rect.top + size / 2;
|
|
7400
|
+
return before ? "before" : "after";
|
|
7312
7401
|
}
|
|
7313
7402
|
function bindDocDrag() {
|
|
7314
7403
|
document.addEventListener("pointermove", onDocPointerMove);
|
|
@@ -7411,7 +7500,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7411
7500
|
if (!th || th === drag.th || !headerRowEl()?.contains(th))
|
|
7412
7501
|
return;
|
|
7413
7502
|
th.setAttribute("data-drop-target", "");
|
|
7414
|
-
th.setAttribute("data-drop-pos",
|
|
7503
|
+
th.setAttribute("data-drop-pos", dropPos(e, th, true));
|
|
7415
7504
|
}
|
|
7416
7505
|
}
|
|
7417
7506
|
function onDocPointerUp() {
|
|
@@ -7622,15 +7711,13 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7622
7711
|
existing.remove();
|
|
7623
7712
|
existing = null;
|
|
7624
7713
|
}
|
|
7625
|
-
|
|
7626
|
-
if (isParent)
|
|
7627
|
-
el = document.createElement("button");
|
|
7714
|
+
const el = document.createElement(isParent ? "button" : "span");
|
|
7715
|
+
if (isParent)
|
|
7628
7716
|
el.type = "button";
|
|
7629
|
-
|
|
7717
|
+
el.setAttribute("data-part", "expander");
|
|
7718
|
+
if (isParent)
|
|
7630
7719
|
el.setAttribute("aria-label", "Toggle");
|
|
7631
|
-
|
|
7632
|
-
el = document.createElement("span");
|
|
7633
|
-
el.setAttribute("data-part", "expander");
|
|
7720
|
+
else {
|
|
7634
7721
|
el.setAttribute("data-leaf", "");
|
|
7635
7722
|
el.setAttribute("aria-hidden", "true");
|
|
7636
7723
|
}
|
|
@@ -7739,16 +7826,26 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7739
7826
|
rows.push(r);
|
|
7740
7827
|
return rows;
|
|
7741
7828
|
}
|
|
7829
|
+
const demoted = new WeakMap;
|
|
7830
|
+
const cellControls = (cell) => [...cell.querySelectorAll("input,select,textarea,button,a[href],[tabindex]")].filter((el) => mine(el) && !el.closest("[data-part='checkbox'],[data-part='drag-handle'],[data-part='expander'],[data-part='row-toggle']"));
|
|
7742
7831
|
function setupNavigability() {
|
|
7743
7832
|
if (opts.navigable) {
|
|
7833
|
+
const rows = navMatrix();
|
|
7834
|
+
if (activeCell && (!rows.includes(activeCell.parentElement) || activeCell.hasAttribute("data-col-hidden"))) {
|
|
7835
|
+
activeCell.setAttribute("tabindex", "-1");
|
|
7836
|
+
activeCell = null;
|
|
7837
|
+
}
|
|
7744
7838
|
let first = null;
|
|
7745
|
-
for (const row of
|
|
7839
|
+
for (const row of rows) {
|
|
7746
7840
|
for (const cell of cellsOf(row)) {
|
|
7747
|
-
if (cell.hasAttribute("data-col-hidden"))
|
|
7748
|
-
continue;
|
|
7749
|
-
if (!first && !activeCell)
|
|
7841
|
+
if (!first && !activeCell && !cell.hasAttribute("data-col-hidden"))
|
|
7750
7842
|
first = cell;
|
|
7751
7843
|
cell.setAttribute("tabindex", cell === (activeCell || first) ? "0" : "-1");
|
|
7844
|
+
for (const el of cellControls(cell)) {
|
|
7845
|
+
if (!demoted.has(el))
|
|
7846
|
+
demoted.set(el, el.getAttribute("tabindex"));
|
|
7847
|
+
el.setAttribute("tabindex", "-1");
|
|
7848
|
+
}
|
|
7752
7849
|
}
|
|
7753
7850
|
}
|
|
7754
7851
|
if (!activeCell)
|
|
@@ -7765,9 +7862,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7765
7862
|
activeCell.setAttribute("tabindex", "-1");
|
|
7766
7863
|
activeCell = cell;
|
|
7767
7864
|
cell.setAttribute("tabindex", "0");
|
|
7768
|
-
|
|
7769
|
-
cell.focus();
|
|
7770
|
-
} catch {}
|
|
7865
|
+
cell.focus();
|
|
7771
7866
|
}
|
|
7772
7867
|
function moveFocus(rowDelta, colDelta, edge) {
|
|
7773
7868
|
const cell = activeCell;
|
|
@@ -7811,7 +7906,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7811
7906
|
const cell = e.target.closest("[data-part='td'],[data-part='th']");
|
|
7812
7907
|
if (!cell || cell === activeCell || !root.contains(cell))
|
|
7813
7908
|
return;
|
|
7814
|
-
if (e.target !== cell)
|
|
7909
|
+
if (e.target !== cell && !demoted.has(e.target))
|
|
7815
7910
|
return;
|
|
7816
7911
|
if (activeCell)
|
|
7817
7912
|
activeCell.setAttribute("tabindex", "-1");
|
|
@@ -7852,13 +7947,12 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7852
7947
|
if (e.shiftKey && lastSelectedIndex >= 0) {
|
|
7853
7948
|
e.preventDefault();
|
|
7854
7949
|
selectRange(lastSelectedIndex, index);
|
|
7855
|
-
|
|
7950
|
+
selectionChanged();
|
|
7856
7951
|
return;
|
|
7857
7952
|
}
|
|
7858
7953
|
toggleAttr(row, "data-selected", checkbox.checked);
|
|
7859
7954
|
lastSelectedIndex = index;
|
|
7860
|
-
|
|
7861
|
-
emit("selection-change", { selected: getSelected() });
|
|
7955
|
+
selectionChanged();
|
|
7862
7956
|
}
|
|
7863
7957
|
function onRootClick(e) {
|
|
7864
7958
|
if (Date.now() < suppressClickUntil)
|
|
@@ -7903,7 +7997,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7903
7997
|
return;
|
|
7904
7998
|
if (e.shiftKey && lastSelectedIndex >= 0) {
|
|
7905
7999
|
selectRange(lastSelectedIndex, index);
|
|
7906
|
-
|
|
8000
|
+
selectionChanged();
|
|
7907
8001
|
return;
|
|
7908
8002
|
}
|
|
7909
8003
|
if (opts.selectable != null) {
|
|
@@ -7916,8 +8010,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7916
8010
|
setRowSelected(row, !row.hasAttribute("data-selected"));
|
|
7917
8011
|
}
|
|
7918
8012
|
lastSelectedIndex = index;
|
|
7919
|
-
|
|
7920
|
-
emit("selection-change", { selected: getSelected() });
|
|
8013
|
+
selectionChanged();
|
|
7921
8014
|
}
|
|
7922
8015
|
}
|
|
7923
8016
|
function onDblClick(e) {
|
|
@@ -7968,9 +8061,14 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
7968
8061
|
}
|
|
7969
8062
|
return;
|
|
7970
8063
|
}
|
|
8064
|
+
const cell = target.closest?.("[data-part='td'],[data-part='th']");
|
|
8065
|
+
if (e.key === "Escape" && demoted.has(target)) {
|
|
8066
|
+
e.preventDefault();
|
|
8067
|
+
focusCell(cell);
|
|
8068
|
+
return;
|
|
8069
|
+
}
|
|
7971
8070
|
if (target.closest?.("input,select,textarea,button,a"))
|
|
7972
8071
|
return;
|
|
7973
|
-
const cell = target.closest?.("[data-part='td'],[data-part='th']");
|
|
7974
8072
|
const inHeader = cell && thead?.contains(cell);
|
|
7975
8073
|
if (inHeader && (e.key === "Enter" || e.key === " ") && cell.hasAttribute("data-sortable")) {
|
|
7976
8074
|
e.preventDefault();
|
|
@@ -8055,6 +8153,12 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8055
8153
|
if (isCellEditable(cell)) {
|
|
8056
8154
|
e.preventDefault();
|
|
8057
8155
|
startEdit(cell);
|
|
8156
|
+
return;
|
|
8157
|
+
}
|
|
8158
|
+
const ctl = cellControls(cell)[0];
|
|
8159
|
+
if (ctl) {
|
|
8160
|
+
e.preventDefault();
|
|
8161
|
+
ctl.focus();
|
|
8058
8162
|
}
|
|
8059
8163
|
return;
|
|
8060
8164
|
}
|
|
@@ -8090,7 +8194,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8090
8194
|
toggleAttr(root, "data-stacked", width < stackBreakpoint());
|
|
8091
8195
|
}
|
|
8092
8196
|
function measureSticky() {
|
|
8093
|
-
const needsHeaderVar = root.hasAttribute("data-sticky-header") ||
|
|
8197
|
+
const needsHeaderVar = root.hasAttribute("data-sticky-header") || bodyRows().some((r) => r.dataset.pin === "top");
|
|
8094
8198
|
if (needsHeaderVar && thead && thead.offsetHeight) {
|
|
8095
8199
|
root.style.setProperty("--table-thead-h", thead.offsetHeight + "px");
|
|
8096
8200
|
}
|
|
@@ -8127,6 +8231,12 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8127
8231
|
cleanups.length = 0;
|
|
8128
8232
|
observer?.disconnect();
|
|
8129
8233
|
observer = null;
|
|
8234
|
+
for (const el of root.querySelectorAll("[tabindex]")) {
|
|
8235
|
+
if (demoted.has(el)) {
|
|
8236
|
+
const t = demoted.get(el);
|
|
8237
|
+
t == null ? el.removeAttribute("tabindex") : el.setAttribute("tabindex", t);
|
|
8238
|
+
}
|
|
8239
|
+
}
|
|
8130
8240
|
for (const t of timers)
|
|
8131
8241
|
clearTimeout(t);
|
|
8132
8242
|
timers.clear();
|
|
@@ -8137,14 +8247,15 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8137
8247
|
on(thead, "click", onHeaderClick);
|
|
8138
8248
|
if (headerCheckbox)
|
|
8139
8249
|
on(headerCheckbox, "change", onHeaderCheckboxChange);
|
|
8250
|
+
const onOwn = (target, ev, fn) => on(target, ev, (e) => mine(e.target) && fn(e));
|
|
8140
8251
|
if (tbody)
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8252
|
+
onOwn(tbody, "change", onRowCheckboxChange);
|
|
8253
|
+
onOwn(root, "click", onRootClick);
|
|
8254
|
+
onOwn(root, "dblclick", onDblClick);
|
|
8255
|
+
onOwn(root, "keydown", onKeydown);
|
|
8256
|
+
onOwn(root, "input", onFilterInput);
|
|
8257
|
+
onOwn(root, "pointerdown", onPointerDown);
|
|
8258
|
+
onOwn(root, "focusin", onFocusIn);
|
|
8148
8259
|
if (typeof window !== "undefined") {
|
|
8149
8260
|
let resizeTimer = null;
|
|
8150
8261
|
const onWinResize = () => {
|
|
@@ -8209,15 +8320,17 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8209
8320
|
root._faqirTable = api;
|
|
8210
8321
|
return api;
|
|
8211
8322
|
}
|
|
8212
|
-
return
|
|
8323
|
+
return createTable;
|
|
8213
8324
|
}();
|
|
8214
8325
|
var createTabs = controllerRegistry["tabs"] = function() {
|
|
8215
|
-
function
|
|
8326
|
+
function createTabs(root) {
|
|
8216
8327
|
if (root._faqirTabs)
|
|
8217
8328
|
return root._faqirTabs;
|
|
8218
|
-
const list = root.querySelector("[data-part='list']");
|
|
8219
|
-
const triggers = () => [
|
|
8220
|
-
|
|
8329
|
+
const list = root.querySelector(":scope > [data-part='list']");
|
|
8330
|
+
const triggers = () => [
|
|
8331
|
+
...root.querySelectorAll(":scope > [data-part='list'] > [data-part='trigger']")
|
|
8332
|
+
];
|
|
8333
|
+
const panels = () => [...root.querySelectorAll(":scope > [data-part='panel']")];
|
|
8221
8334
|
function activate(index) {
|
|
8222
8335
|
const allTriggers = triggers();
|
|
8223
8336
|
const allPanels = panels();
|
|
@@ -8282,10 +8395,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8282
8395
|
root._faqirTabs = api;
|
|
8283
8396
|
return api;
|
|
8284
8397
|
}
|
|
8285
|
-
return
|
|
8398
|
+
return createTabs;
|
|
8286
8399
|
}();
|
|
8287
8400
|
var createTagInput = controllerRegistry["tag-input"] = function() {
|
|
8288
|
-
function
|
|
8401
|
+
function createTagInput(root) {
|
|
8289
8402
|
if (root._faqirTagInput)
|
|
8290
8403
|
return root._faqirTagInput;
|
|
8291
8404
|
const taglist = root.querySelector("[data-part='taglist']");
|
|
@@ -8580,10 +8693,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8580
8693
|
root._faqirTagInput = api;
|
|
8581
8694
|
return api;
|
|
8582
8695
|
}
|
|
8583
|
-
return
|
|
8696
|
+
return createTagInput;
|
|
8584
8697
|
}();
|
|
8585
8698
|
var createToastContainer = controllerRegistry["toast"] = function() {
|
|
8586
|
-
function
|
|
8699
|
+
function createToastContainer(root) {
|
|
8587
8700
|
if (root._faqirToast)
|
|
8588
8701
|
return root._faqirToast;
|
|
8589
8702
|
const toasts = new Map;
|
|
@@ -8712,10 +8825,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8712
8825
|
root._faqirToast = api;
|
|
8713
8826
|
return api;
|
|
8714
8827
|
}
|
|
8715
|
-
return
|
|
8828
|
+
return createToastContainer;
|
|
8716
8829
|
}();
|
|
8717
8830
|
var createToggleGroup = controllerRegistry["toggle-group"] = function() {
|
|
8718
|
-
function
|
|
8831
|
+
function createToggleGroup(root) {
|
|
8719
8832
|
if (root._faqirToggleGroup)
|
|
8720
8833
|
return root._faqirToggleGroup;
|
|
8721
8834
|
const mode = root.dataset.mode === "multi" ? "multi" : "single";
|
|
@@ -8852,26 +8965,34 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8852
8965
|
if (el)
|
|
8853
8966
|
select(el);
|
|
8854
8967
|
}
|
|
8968
|
+
const form = root.closest("form");
|
|
8969
|
+
const onReset = () => setTimeout(syncState, 0);
|
|
8855
8970
|
root.addEventListener("change", onChange);
|
|
8971
|
+
root.addEventListener("faqir:model", syncState);
|
|
8856
8972
|
root.addEventListener("keydown", onKeyDown);
|
|
8973
|
+
if (form)
|
|
8974
|
+
form.addEventListener("reset", onReset);
|
|
8857
8975
|
syncState();
|
|
8858
8976
|
function destroy() {
|
|
8859
8977
|
root.removeEventListener("change", onChange);
|
|
8978
|
+
root.removeEventListener("faqir:model", syncState);
|
|
8860
8979
|
root.removeEventListener("keydown", onKeyDown);
|
|
8980
|
+
if (form)
|
|
8981
|
+
form.removeEventListener("reset", onReset);
|
|
8861
8982
|
delete root._faqirToggleGroup;
|
|
8862
8983
|
}
|
|
8863
8984
|
const api = { getValue, setValue, toggle, destroy };
|
|
8864
8985
|
root._faqirToggleGroup = api;
|
|
8865
8986
|
return api;
|
|
8866
8987
|
}
|
|
8867
|
-
return
|
|
8988
|
+
return createToggleGroup;
|
|
8868
8989
|
}();
|
|
8869
8990
|
var createTooltip = controllerRegistry["tooltip"] = function() {
|
|
8870
|
-
function
|
|
8991
|
+
function createTooltip(root) {
|
|
8871
8992
|
if (root._faqirTooltip)
|
|
8872
8993
|
return root._faqirTooltip;
|
|
8873
8994
|
const trigger = root.querySelector("[data-part='trigger']");
|
|
8874
|
-
const content = root
|
|
8995
|
+
const [content] = ownParts(root, "content");
|
|
8875
8996
|
let showTimer = null;
|
|
8876
8997
|
let hideTimer = null;
|
|
8877
8998
|
function show() {
|
|
@@ -8934,10 +9055,10 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
8934
9055
|
root._faqirTooltip = api;
|
|
8935
9056
|
return api;
|
|
8936
9057
|
}
|
|
8937
|
-
return
|
|
9058
|
+
return createTooltip;
|
|
8938
9059
|
}();
|
|
8939
9060
|
var createTreeView = controllerRegistry["tree-view"] = function() {
|
|
8940
|
-
function
|
|
9061
|
+
function createTreeView(root) {
|
|
8941
9062
|
if (root._faqirTreeView) {
|
|
8942
9063
|
root._faqirTreeView.refresh();
|
|
8943
9064
|
return root._faqirTreeView;
|
|
@@ -9335,7 +9456,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9335
9456
|
refresh();
|
|
9336
9457
|
return api;
|
|
9337
9458
|
}
|
|
9338
|
-
return
|
|
9459
|
+
return createTreeView;
|
|
9339
9460
|
}();
|
|
9340
9461
|
var customMagics = new Map;
|
|
9341
9462
|
function findParentScope(el) {
|
|
@@ -9350,7 +9471,8 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9350
9471
|
var SNAPSHOT_MAX_DEPTH = 4;
|
|
9351
9472
|
function snapshotValue(value, stack, depth) {
|
|
9352
9473
|
if (typeof value === "function") {
|
|
9353
|
-
|
|
9474
|
+
var name = String(value.name || "").replace(/^bound /, "");
|
|
9475
|
+
return "[Function" + (name ? " " + name : "") + "]";
|
|
9354
9476
|
}
|
|
9355
9477
|
if (value === null || typeof value !== "object")
|
|
9356
9478
|
return value;
|
|
@@ -9535,17 +9657,26 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9535
9657
|
console.error('[Faqir] Controller "' + name + '" failed to initialize', el, err);
|
|
9536
9658
|
}
|
|
9537
9659
|
}
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9660
|
+
function startControllers(root) {
|
|
9661
|
+
var own = root.getAttribute && root.getAttribute("data-ui");
|
|
9662
|
+
if (own && controllerRegistry[own])
|
|
9663
|
+
initController(own, root);
|
|
9542
9664
|
var names = Object.keys(controllerRegistry);
|
|
9543
9665
|
for (var n = 0;n < names.length; n++) {
|
|
9544
|
-
var els =
|
|
9545
|
-
for (var e = 0;e < els.length; e++)
|
|
9666
|
+
var els = root.querySelectorAll('[data-ui="' + names[n] + '"]');
|
|
9667
|
+
for (var e = 0;e < els.length; e++)
|
|
9546
9668
|
initController(names[n], els[e]);
|
|
9547
|
-
}
|
|
9548
9669
|
}
|
|
9670
|
+
}
|
|
9671
|
+
function publicInitTree(root, parentScope) {
|
|
9672
|
+
if (root.isConnected)
|
|
9673
|
+
startControllers(root);
|
|
9674
|
+
initTree(root, parentScope);
|
|
9675
|
+
}
|
|
9676
|
+
var mutationObserver = null;
|
|
9677
|
+
var observedBody = null;
|
|
9678
|
+
function bootstrap() {
|
|
9679
|
+
startControllers(document);
|
|
9549
9680
|
var roots = document.querySelectorAll("[l-data], [data-ui]");
|
|
9550
9681
|
var processed = new Set;
|
|
9551
9682
|
for (var r = 0;r < roots.length; r++) {
|
|
@@ -9587,12 +9718,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9587
9718
|
}
|
|
9588
9719
|
}
|
|
9589
9720
|
walkUnscoped(document.body, getStrayScope());
|
|
9590
|
-
|
|
9591
|
-
var els2 = document.querySelectorAll('[data-ui="' + names[n2] + '"]');
|
|
9592
|
-
for (var e2 = 0;e2 < els2.length; e2++) {
|
|
9593
|
-
initController(names[n2], els2[e2]);
|
|
9594
|
-
}
|
|
9595
|
-
}
|
|
9721
|
+
startControllers(document);
|
|
9596
9722
|
removeCloaks();
|
|
9597
9723
|
if (mutationObserver && observedBody === document.body)
|
|
9598
9724
|
return;
|
|
@@ -9610,22 +9736,13 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9610
9736
|
if (node.nodeType !== 1)
|
|
9611
9737
|
continue;
|
|
9612
9738
|
removeCloaks(node);
|
|
9613
|
-
|
|
9614
|
-
if (uiName && controllerRegistry[uiName]) {
|
|
9615
|
-
initController(uiName, node);
|
|
9616
|
-
}
|
|
9739
|
+
startControllers(node);
|
|
9617
9740
|
if (node.__faqirScope) {} else if (node.hasAttribute && node.hasAttribute("l-data")) {
|
|
9618
9741
|
initTree(node, findParentScope(node));
|
|
9619
9742
|
} else if (node.hasAttribute && node.hasAttribute("data-ui") && !findParentScope(node)) {
|
|
9620
9743
|
initTree(node, null);
|
|
9621
9744
|
}
|
|
9622
9745
|
if (node.querySelectorAll) {
|
|
9623
|
-
var cNames = Object.keys(controllerRegistry);
|
|
9624
|
-
for (var cn = 0;cn < cNames.length; cn++) {
|
|
9625
|
-
var cEls = node.querySelectorAll('[data-ui="' + cNames[cn] + '"]');
|
|
9626
|
-
for (var ce = 0;ce < cEls.length; ce++)
|
|
9627
|
-
initController(cNames[cn], cEls[ce]);
|
|
9628
|
-
}
|
|
9629
9746
|
var scopeEls = node.querySelectorAll("[l-data]");
|
|
9630
9747
|
for (var se = 0;se < scopeEls.length; se++) {
|
|
9631
9748
|
if (!scopeEls[se].__faqirScope) {
|
|
@@ -9663,7 +9780,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9663
9780
|
}
|
|
9664
9781
|
}
|
|
9665
9782
|
var Faqir = {
|
|
9666
|
-
version: "1.
|
|
9783
|
+
version: "1.2.0",
|
|
9667
9784
|
reactive,
|
|
9668
9785
|
effect,
|
|
9669
9786
|
batch,
|
|
@@ -9683,6 +9800,8 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9683
9800
|
customDirectives.set(name, handler);
|
|
9684
9801
|
},
|
|
9685
9802
|
magic: function(name, callback) {
|
|
9803
|
+
if (name === "this")
|
|
9804
|
+
throw new Error('[Faqir] "this" is reserved: $this is the directive element');
|
|
9686
9805
|
customMagics.set(name, callback);
|
|
9687
9806
|
},
|
|
9688
9807
|
plugin: function(fn) {
|
|
@@ -9692,7 +9811,7 @@ var require_faqir_core = __commonJS((exports, module) => {
|
|
|
9692
9811
|
controllerRegistry[name] = factory;
|
|
9693
9812
|
},
|
|
9694
9813
|
start: bootstrap,
|
|
9695
|
-
initTree,
|
|
9814
|
+
initTree: publicInitTree,
|
|
9696
9815
|
inspect,
|
|
9697
9816
|
devtools,
|
|
9698
9817
|
destroy: destroyScope
|
|
@@ -9728,24 +9847,24 @@ var destroy = import_faqir_core.default.destroy;
|
|
|
9728
9847
|
var inspect = import_faqir_core.default.inspect;
|
|
9729
9848
|
var devtools = import_faqir_core.default.devtools;
|
|
9730
9849
|
export {
|
|
9731
|
-
|
|
9732
|
-
untrack,
|
|
9733
|
-
store,
|
|
9734
|
-
start,
|
|
9735
|
-
reactive,
|
|
9736
|
-
plugin,
|
|
9737
|
-
nextTick,
|
|
9738
|
-
magic,
|
|
9739
|
-
inspect,
|
|
9740
|
-
initTree,
|
|
9741
|
-
evaluateAssignment,
|
|
9742
|
-
evaluate,
|
|
9743
|
-
effect,
|
|
9744
|
-
directive,
|
|
9745
|
-
devtools,
|
|
9746
|
-
destroy,
|
|
9747
|
-
esm_entry_default as default,
|
|
9748
|
-
data,
|
|
9850
|
+
batch,
|
|
9749
9851
|
controller,
|
|
9750
|
-
|
|
9852
|
+
data,
|
|
9853
|
+
esm_entry_default as default,
|
|
9854
|
+
destroy,
|
|
9855
|
+
devtools,
|
|
9856
|
+
directive,
|
|
9857
|
+
effect,
|
|
9858
|
+
evaluate,
|
|
9859
|
+
evaluateAssignment,
|
|
9860
|
+
initTree,
|
|
9861
|
+
inspect,
|
|
9862
|
+
magic,
|
|
9863
|
+
nextTick,
|
|
9864
|
+
plugin,
|
|
9865
|
+
reactive,
|
|
9866
|
+
start,
|
|
9867
|
+
store,
|
|
9868
|
+
untrack,
|
|
9869
|
+
version
|
|
9751
9870
|
};
|