@lundal/zed-solid 0.0.17 → 0.0.19
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/dist/index.js +34 -45
- package/package.json +13 -17
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
import "@fontsource/inter/400.css";
|
|
3
3
|
import "@fontsource/inter/500.css";
|
|
4
|
-
import { sharedConfig,
|
|
4
|
+
import { sharedConfig, createMemo, untrack, createRenderEffect, createComponent, For, createSignal, onMount, onCleanup } from "solid-js";
|
|
5
5
|
import { A } from "@solidjs/router";
|
|
6
|
+
const memo = (fn) => createMemo(() => fn());
|
|
6
7
|
function reconcileArrays(parentNode, a, b) {
|
|
7
8
|
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
8
9
|
while (aStart < aEnd || bStart < bEnd) {
|
|
@@ -52,12 +53,12 @@ function reconcileArrays(parentNode, a, b) {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
const $$EVENTS = "_$DX_DELEGATE";
|
|
55
|
-
function template(html, isImportNode, isSVG) {
|
|
56
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
56
57
|
let node;
|
|
57
58
|
const create = () => {
|
|
58
|
-
const t = document.createElement("template");
|
|
59
|
+
const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
|
|
59
60
|
t.innerHTML = html;
|
|
60
|
-
return isSVG ? t.content.firstChild.firstChild : t.content.firstChild;
|
|
61
|
+
return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
|
|
61
62
|
};
|
|
62
63
|
const fn = isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
|
|
63
64
|
fn.cloneNode = fn;
|
|
@@ -260,11 +261,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
|
260
261
|
} else if (t === "function") {
|
|
261
262
|
if (unwrap) {
|
|
262
263
|
while (typeof item === "function") item = item();
|
|
263
|
-
dynamic = normalizeIncomingArray(
|
|
264
|
-
normalized,
|
|
265
|
-
Array.isArray(item) ? item : [item],
|
|
266
|
-
Array.isArray(prev) ? prev : [prev]
|
|
267
|
-
) || dynamic;
|
|
264
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
268
265
|
} else {
|
|
269
266
|
normalized.push(item);
|
|
270
267
|
dynamic = true;
|
|
@@ -289,8 +286,7 @@ function cleanChildren(parent, current, marker, replacement) {
|
|
|
289
286
|
const el = current[i];
|
|
290
287
|
if (node !== el) {
|
|
291
288
|
const isParent = el.parentNode === parent;
|
|
292
|
-
if (!inserted && !i)
|
|
293
|
-
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
289
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
294
290
|
else isParent && el.remove();
|
|
295
291
|
} else inserted = true;
|
|
296
292
|
}
|
|
@@ -401,7 +397,7 @@ function CheckBoxes(props) {
|
|
|
401
397
|
})()
|
|
402
398
|
}), null);
|
|
403
399
|
insert(_el$, (() => {
|
|
404
|
-
var _c$ =
|
|
400
|
+
var _c$ = memo(() => !!props.error);
|
|
405
401
|
return () => _c$() && (() => {
|
|
406
402
|
var _el$6 = _tmpl$3$3();
|
|
407
403
|
insert(_el$6, () => props.error);
|
|
@@ -410,7 +406,7 @@ function CheckBoxes(props) {
|
|
|
410
406
|
})();
|
|
411
407
|
})(), null);
|
|
412
408
|
insert(_el$, (() => {
|
|
413
|
-
var _c$2 =
|
|
409
|
+
var _c$2 = memo(() => !!(!props.error && props.errorPlaceholder !== false));
|
|
414
410
|
return () => _c$2() && _tmpl$4$2();
|
|
415
411
|
})(), null);
|
|
416
412
|
createRenderEffect((_p$) => {
|
|
@@ -451,13 +447,13 @@ function Dialog(props) {
|
|
|
451
447
|
}
|
|
452
448
|
let dialog;
|
|
453
449
|
onMount(() => {
|
|
454
|
-
dialog
|
|
455
|
-
dialog
|
|
450
|
+
dialog?.showModal();
|
|
451
|
+
dialog?.classList.add("z-dialog--open");
|
|
456
452
|
});
|
|
457
453
|
function close() {
|
|
458
|
-
dialog
|
|
454
|
+
dialog?.classList.remove("z-dialog--open");
|
|
459
455
|
setTimeout(() => {
|
|
460
|
-
dialog
|
|
456
|
+
dialog?.close();
|
|
461
457
|
props.onClose();
|
|
462
458
|
}, 100);
|
|
463
459
|
}
|
|
@@ -497,7 +493,7 @@ function Field(props) {
|
|
|
497
493
|
return (() => {
|
|
498
494
|
var _el$ = _tmpl$$f();
|
|
499
495
|
insert(_el$, (() => {
|
|
500
|
-
var _c$ =
|
|
496
|
+
var _c$ = memo(() => !!props.label);
|
|
501
497
|
return () => _c$() && (() => {
|
|
502
498
|
var _el$2 = _tmpl$2$4();
|
|
503
499
|
insert(_el$2, () => props.label);
|
|
@@ -511,7 +507,7 @@ function Field(props) {
|
|
|
511
507
|
errorId: props.error ? `${props.id}-error` : void 0
|
|
512
508
|
})), null);
|
|
513
509
|
insert(_el$, (() => {
|
|
514
|
-
var _c$2 =
|
|
510
|
+
var _c$2 = memo(() => !!props.error);
|
|
515
511
|
return () => _c$2() && (() => {
|
|
516
512
|
var _el$3 = _tmpl$3$2();
|
|
517
513
|
insert(_el$3, () => props.error);
|
|
@@ -520,7 +516,7 @@ function Field(props) {
|
|
|
520
516
|
})();
|
|
521
517
|
})(), null);
|
|
522
518
|
insert(_el$, (() => {
|
|
523
|
-
var _c$3 =
|
|
519
|
+
var _c$3 = memo(() => !!(!props.error && props.errorPlaceholder !== false));
|
|
524
520
|
return () => _c$3() && _tmpl$4$1();
|
|
525
521
|
})(), null);
|
|
526
522
|
createRenderEffect((_p$) => {
|
|
@@ -625,7 +621,7 @@ function H3(props) {
|
|
|
625
621
|
return _el$3;
|
|
626
622
|
})();
|
|
627
623
|
}
|
|
628
|
-
var _tmpl$$b = /* @__PURE__ */ template(`<svg>`), _tmpl$2$2 = /* @__PURE__ */ template(`<svg><path fill=currentColor></svg>`, false, true);
|
|
624
|
+
var _tmpl$$b = /* @__PURE__ */ template(`<svg>`), _tmpl$2$2 = /* @__PURE__ */ template(`<svg><path fill=currentColor></svg>`, false, true, false);
|
|
629
625
|
function Icon(props) {
|
|
630
626
|
const data = createMemo(() => {
|
|
631
627
|
const [width, height, , , paths] = props.definition.icon;
|
|
@@ -707,30 +703,25 @@ function Link(props) {
|
|
|
707
703
|
}
|
|
708
704
|
});
|
|
709
705
|
}
|
|
710
|
-
|
|
711
|
-
* Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com
|
|
712
|
-
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
713
|
-
* Copyright 2024 Fonticons, Inc.
|
|
714
|
-
*/
|
|
715
|
-
const faCircleCheck = {
|
|
706
|
+
var faCircleXmark = {
|
|
716
707
|
prefix: "fas",
|
|
717
|
-
iconName: "circle-
|
|
718
|
-
icon: [512, 512, [
|
|
708
|
+
iconName: "circle-xmark",
|
|
709
|
+
icon: [512, 512, [61532, "times-circle", "xmark-circle"], "f057", "M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM167 167c9.4-9.4 24.6-9.4 33.9 0l55 55 55-55c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-55 55 55 55c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-55-55-55 55c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l55-55-55-55c-9.4-9.4-9.4-24.6 0-33.9z"]
|
|
719
710
|
};
|
|
720
|
-
|
|
711
|
+
var faCircleCheck = {
|
|
721
712
|
prefix: "fas",
|
|
722
|
-
iconName: "circle-
|
|
723
|
-
icon: [512, 512, ["
|
|
713
|
+
iconName: "circle-check",
|
|
714
|
+
icon: [512, 512, [61533, "check-circle"], "f058", "M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zM374 145.7c-10.7-7.8-25.7-5.4-33.5 5.3L221.1 315.2 169 263.1c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l72 72c5 5 11.8 7.5 18.8 7s13.4-4.1 17.5-9.8L379.3 179.2c7.8-10.7 5.4-25.7-5.3-33.5z"]
|
|
724
715
|
};
|
|
725
|
-
|
|
716
|
+
var faTriangleExclamation = {
|
|
726
717
|
prefix: "fas",
|
|
727
718
|
iconName: "triangle-exclamation",
|
|
728
|
-
icon: [512, 512, [9888, "exclamation-triangle", "warning"], "f071", "M256
|
|
719
|
+
icon: [512, 512, [9888, "exclamation-triangle", "warning"], "f071", "M256 0c14.7 0 28.2 8.1 35.2 21l216 400c6.7 12.4 6.4 27.4-.8 39.5S486.1 480 472 480L40 480c-14.1 0-27.2-7.4-34.4-19.5s-7.5-27.1-.8-39.5l216-400c7-12.9 20.5-21 35.2-21zm0 352a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.5 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]
|
|
729
720
|
};
|
|
730
|
-
|
|
721
|
+
var faCircleInfo = {
|
|
731
722
|
prefix: "fas",
|
|
732
|
-
iconName: "circle-
|
|
733
|
-
icon: [512, 512, [
|
|
723
|
+
iconName: "circle-info",
|
|
724
|
+
icon: [512, 512, ["info-circle"], "f05a", "M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zM224 160a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm-8 64l48 0c13.3 0 24 10.7 24 24l0 88 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l24 0 0-64-24 0c-13.3 0-24-10.7-24-24s10.7-24 24-24z"]
|
|
734
725
|
};
|
|
735
726
|
var _tmpl$$9 = /* @__PURE__ */ template(`<div><div class=z-message--icon></div><div class=z-message--text>`);
|
|
736
727
|
function Message(props) {
|
|
@@ -820,7 +811,7 @@ function NavLink(props) {
|
|
|
820
811
|
},
|
|
821
812
|
end: true,
|
|
822
813
|
get children() {
|
|
823
|
-
return [
|
|
814
|
+
return [memo(() => props.icon), (() => {
|
|
824
815
|
var _el$ = _tmpl$$6();
|
|
825
816
|
insert(_el$, () => props.text);
|
|
826
817
|
return _el$;
|
|
@@ -878,7 +869,7 @@ function RadioButtons(props) {
|
|
|
878
869
|
})()
|
|
879
870
|
}), null);
|
|
880
871
|
insert(_el$, (() => {
|
|
881
|
-
var _c$ =
|
|
872
|
+
var _c$ = memo(() => !!props.error);
|
|
882
873
|
return () => _c$() && (() => {
|
|
883
874
|
var _el$6 = _tmpl$3();
|
|
884
875
|
insert(_el$6, () => props.error);
|
|
@@ -887,7 +878,7 @@ function RadioButtons(props) {
|
|
|
887
878
|
})();
|
|
888
879
|
})(), null);
|
|
889
880
|
insert(_el$, (() => {
|
|
890
|
-
var _c$2 =
|
|
881
|
+
var _c$2 = memo(() => !!(!props.error && props.errorPlaceholder !== false));
|
|
891
882
|
return () => _c$2() && _tmpl$4();
|
|
892
883
|
})(), null);
|
|
893
884
|
createRenderEffect((_p$) => {
|
|
@@ -1032,13 +1023,11 @@ function createForm(options) {
|
|
|
1032
1023
|
}
|
|
1033
1024
|
setState({ type: "Submitting" });
|
|
1034
1025
|
options.submitter(fields()).then((value) => {
|
|
1035
|
-
var _a;
|
|
1036
1026
|
setState({ type: "Success", value });
|
|
1037
|
-
|
|
1027
|
+
options.onSuccess?.(value);
|
|
1038
1028
|
}).catch((error) => {
|
|
1039
|
-
var _a;
|
|
1040
1029
|
setState({ type: "Failure", error });
|
|
1041
|
-
|
|
1030
|
+
options.onFailure?.(error);
|
|
1042
1031
|
});
|
|
1043
1032
|
}
|
|
1044
1033
|
};
|
|
@@ -1073,7 +1062,7 @@ function createSize(element) {
|
|
|
1073
1062
|
observer.observe(_element);
|
|
1074
1063
|
});
|
|
1075
1064
|
onCleanup(() => {
|
|
1076
|
-
observer
|
|
1065
|
+
observer?.disconnect();
|
|
1077
1066
|
observer = void 0;
|
|
1078
1067
|
});
|
|
1079
1068
|
return size;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lundal/zed-solid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -15,26 +15,22 @@
|
|
|
15
15
|
"format": "prettier --write src"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@fortawesome/free-
|
|
18
|
+
"@fontsource/inter": "5.2.8",
|
|
19
|
+
"@fortawesome/free-regular-svg-icons": "7.1.0",
|
|
20
|
+
"@fortawesome/free-solid-svg-icons": "7.1.0",
|
|
20
21
|
"@lundal/zed-css": "file:../css",
|
|
21
|
-
"@solidjs/router": "0.15",
|
|
22
|
-
"solid-js": "1",
|
|
23
|
-
"prettier": "3",
|
|
24
|
-
"typescript": "5",
|
|
25
|
-
"vite": "
|
|
26
|
-
"vite-plugin-dts": "4",
|
|
27
|
-
"vite-plugin-libcss": "1",
|
|
28
|
-
"vite-plugin-solid": "2"
|
|
22
|
+
"@solidjs/router": "0.15.4",
|
|
23
|
+
"solid-js": "1.9.10",
|
|
24
|
+
"prettier": "3.7.1",
|
|
25
|
+
"typescript": "5.9.3",
|
|
26
|
+
"vite": "7.2.4",
|
|
27
|
+
"vite-plugin-dts": "4.5.4",
|
|
28
|
+
"vite-plugin-libcss": "1.1.2",
|
|
29
|
+
"vite-plugin-solid": "2.11.10"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
32
|
+
"@fontsource/inter": "*",
|
|
31
33
|
"@solidjs/router": "*",
|
|
32
34
|
"solid-js": "*"
|
|
33
|
-
},
|
|
34
|
-
"optionalDependencies": {
|
|
35
|
-
"@fortawesome/free-solid-svg-icons": "6"
|
|
36
|
-
},
|
|
37
|
-
"dependencies": {
|
|
38
|
-
"@fontsource/inter": "5"
|
|
39
35
|
}
|
|
40
36
|
}
|