@plitzi/sdk-authoring 0.38.4 → 0.38.5
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/CHANGELOG.md +329 -0
- package/dist/index-compactSvg.js +4 -1
- package/dist/index.d.ts +430 -170
- package/dist/index.js +1450 -904
- package/dist/node.d.ts +55 -0
- package/dist/node.js +41 -13
- package/package.json +8 -7
- package/skills/plitzi-authoring/CHEATSHEET.md +4 -2
- package/skills/plitzi-authoring/SKILL.md +20 -19
- package/skills/plitzi-authoring/recipes/plugin.ts +1 -1
- package/skills/plitzi-authoring/recipes/server-data.ts +3 -3
- package/skills/plitzi-authoring/recipes/show-data.ts +3 -2
- package/skills/plitzi-authoring/recipes/typed-data.ts +1 -1
- package/skills/plitzi-authoring/reference/authoring-errors.md +8 -2
- package/skills/plitzi-authoring/reference/colours-and-motion.md +3 -1
- package/skills/plitzi-authoring/reference/data-and-visibility.md +24 -22
- package/skills/plitzi-authoring/reference/drawing.md +24 -0
- package/skills/plitzi-authoring/reference/efficiency.md +19 -2
- package/skills/plitzi-authoring/reference/flows.md +3 -0
- package/skills/plitzi-authoring/reference/layouts.md +8 -23
- package/skills/plitzi-authoring/reference/performance.md +2 -2
- package/skills/plitzi-authoring/reference/plugins.md +51 -38
- package/skills/plitzi-authoring/reference/review-checklist.md +2 -0
- package/skills/plitzi-authoring/reference/structure.md +32 -1
- package/skills/plitzi-authoring/reference/templates.md +5 -2
- package/skills/plitzi-authoring/reference/testing.md +9 -2
- package/skills/plitzi-authoring/reference/typed-sources.md +3 -1
- package/skills/plitzi-authoring/reference/validation.md +1 -1
package/dist/index.js
CHANGED
|
@@ -13,18 +13,18 @@ var __exportAll = (all, no_symbols) => {
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region ../sdk-shared/dist/helpers/twigWrapper/tokens/tokenPatterns.mjs
|
|
15
15
|
var e$37 = "[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*";
|
|
16
|
-
var t$
|
|
17
|
-
var n$
|
|
18
|
-
var r$
|
|
19
|
-
var i$
|
|
20
|
-
var a$
|
|
21
|
-
var o$
|
|
22
|
-
var s$
|
|
16
|
+
var t$59 = `(?:${e$37}|\\d+)`;
|
|
17
|
+
var n$43 = `\\[\\s*(?:\\d+|'[^']*'|"[^"]*"|${e$37}(?:\\.${t$59})*)\\s*\\]`;
|
|
18
|
+
var r$31 = `${`${e$37}(?:${n$43})*(?:\\??\\.${t$59}(?:${n$43})*)*`}(?:\\s*\\?\\?\\s*[^|{}]+?)?(?:\\s*\\|\\s*[a-zA-Z_]+(?:\\([^)]*\\))?)*`;
|
|
19
|
+
var i$25 = `\\{\\{\\s*${r$31}\\s*\\}\\}`;
|
|
20
|
+
var a$21 = `(?:${`\\{\\{\\{\\s*${r$31}\\s*\\}\\}\\}`}|${i$25})`;
|
|
21
|
+
var o$24 = new RegExp(a$21, "g");
|
|
22
|
+
var s$20 = RegExp(`^${a$21}$`);
|
|
23
23
|
//#endregion
|
|
24
24
|
//#region ../sdk-shared/dist/helpers/twigWrapper/tokens/hasValidToken.mjs
|
|
25
|
-
var n$
|
|
25
|
+
var n$42 = (n, r = !1) => {
|
|
26
26
|
if (typeof n != "string") return !1;
|
|
27
|
-
let i = r ? s$
|
|
27
|
+
let i = r ? s$20 : o$24;
|
|
28
28
|
return i.lastIndex = 0, i.test(n.trim());
|
|
29
29
|
};
|
|
30
30
|
//#endregion
|
|
@@ -39,12 +39,12 @@ var n$1 = (e, t, n) => {
|
|
|
39
39
|
for (let [i, a] of Object.entries(n)) a.required && e[i] === void 0 && (!a.when || a.when(t)) && r.push(i);
|
|
40
40
|
return r;
|
|
41
41
|
};
|
|
42
|
-
var r$
|
|
43
|
-
var i$
|
|
44
|
-
var a$
|
|
42
|
+
var r$30 = (e) => e.trim() !== "" && Number.isFinite(Number(e));
|
|
43
|
+
var i$24 = (t) => typeof t == "string" && n$42(t);
|
|
44
|
+
var a$20 = (e, t) => {
|
|
45
45
|
switch (t.type) {
|
|
46
46
|
case "boolean": return typeof e == "boolean";
|
|
47
|
-
case "number": return typeof e == "number" || typeof e == "string" && r$
|
|
47
|
+
case "number": return typeof e == "number" || typeof e == "string" && r$30(e);
|
|
48
48
|
case "select": return typeof e == "string" && (!t.options || t.options.includes(e));
|
|
49
49
|
case "scalar": return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
50
50
|
case "json": return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "object" && !!e;
|
|
@@ -58,7 +58,7 @@ var o$1 = (e, t, n) => {
|
|
|
58
58
|
let r = [];
|
|
59
59
|
for (let [o, s] of Object.entries(n)) {
|
|
60
60
|
let n = e[o];
|
|
61
|
-
n === void 0 || i$
|
|
61
|
+
n === void 0 || i$24(n) || s.when && !s.when(t) || a$20(n, s) || r.push({
|
|
62
62
|
key: o,
|
|
63
63
|
expected: s.type,
|
|
64
64
|
got: n === null ? "null" : typeof n,
|
|
@@ -76,16 +76,16 @@ var s$1 = (e, t, n) => {
|
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region ../sdk-shared/dist/helpers/scroll.mjs
|
|
78
78
|
var e$36 = ["smooth", "auto"];
|
|
79
|
-
var t$
|
|
79
|
+
var t$58 = [
|
|
80
80
|
"start",
|
|
81
81
|
"center",
|
|
82
82
|
"end",
|
|
83
83
|
"nearest"
|
|
84
84
|
];
|
|
85
|
-
var s$
|
|
85
|
+
var s$19 = "onScroll";
|
|
86
86
|
//#endregion
|
|
87
87
|
//#region ../sdk-shared/dist/authoring/elementCallbacks.mjs
|
|
88
|
-
var r$
|
|
88
|
+
var r$29 = {
|
|
89
89
|
type: "select",
|
|
90
90
|
description: "How it moves: \"smooth\" glides there, \"auto\" jumps.",
|
|
91
91
|
default: "smooth",
|
|
@@ -107,7 +107,7 @@ var i$1 = {
|
|
|
107
107
|
description: "How far down, the same way; negative goes up.",
|
|
108
108
|
default: ""
|
|
109
109
|
},
|
|
110
|
-
behavior: r$
|
|
110
|
+
behavior: r$29
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
scrollTo: {
|
|
@@ -125,7 +125,7 @@ var i$1 = {
|
|
|
125
125
|
description: "Where down, the same way. Empty stays.",
|
|
126
126
|
default: ""
|
|
127
127
|
},
|
|
128
|
-
behavior: r$
|
|
128
|
+
behavior: r$29
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
scrollIntoView: {
|
|
@@ -137,15 +137,15 @@ var i$1 = {
|
|
|
137
137
|
type: "select",
|
|
138
138
|
description: "Where the element lands, top to bottom.",
|
|
139
139
|
default: "start",
|
|
140
|
-
options: [...t$
|
|
140
|
+
options: [...t$58]
|
|
141
141
|
},
|
|
142
142
|
inline: {
|
|
143
143
|
type: "select",
|
|
144
144
|
description: "Where it lands, side to side.",
|
|
145
145
|
default: "nearest",
|
|
146
|
-
options: [...t$
|
|
146
|
+
options: [...t$58]
|
|
147
147
|
},
|
|
148
|
-
behavior: r$
|
|
148
|
+
behavior: r$29
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
};
|
|
@@ -297,7 +297,8 @@ var elementAttributeNames = {
|
|
|
297
297
|
"decorative",
|
|
298
298
|
"label",
|
|
299
299
|
"live",
|
|
300
|
-
"subType"
|
|
300
|
+
"subType",
|
|
301
|
+
"title"
|
|
301
302
|
],
|
|
302
303
|
custom: null,
|
|
303
304
|
dialogContainer: [
|
|
@@ -712,7 +713,7 @@ var elementAttributeNames = {
|
|
|
712
713
|
tabContainerBody: [],
|
|
713
714
|
tabContainerHeader: [],
|
|
714
715
|
tabContainerItem: [],
|
|
715
|
-
text: ["content"],
|
|
716
|
+
text: ["content", "title"],
|
|
716
717
|
themeToggle: [
|
|
717
718
|
"darkLabel",
|
|
718
719
|
"lightLabel",
|
|
@@ -906,7 +907,7 @@ var e$1 = () => (e) => e;
|
|
|
906
907
|
var t$1 = () => (e) => e;
|
|
907
908
|
//#endregion
|
|
908
909
|
//#region ../sdk-elements/dist/elements/advanced/BlockHtml/declaration.mjs
|
|
909
|
-
var t$
|
|
910
|
+
var t$57 = t$1()({
|
|
910
911
|
type: "blockHtml",
|
|
911
912
|
content: {
|
|
912
913
|
attributes: { content: "" },
|
|
@@ -946,7 +947,7 @@ var t$56 = t$1()({
|
|
|
946
947
|
});
|
|
947
948
|
//#endregion
|
|
948
949
|
//#region ../sdk-elements/dist/elements/advanced/BlockJsx/declaration.mjs
|
|
949
|
-
var t$
|
|
950
|
+
var t$56 = t$1()({
|
|
950
951
|
type: "blockJsx",
|
|
951
952
|
content: {
|
|
952
953
|
attributes: {
|
|
@@ -991,7 +992,7 @@ var t$55 = t$1()({
|
|
|
991
992
|
});
|
|
992
993
|
//#endregion
|
|
993
994
|
//#region ../sdk-elements/dist/elements/advanced/Custom/declaration.mjs
|
|
994
|
-
var t$
|
|
995
|
+
var t$55 = t$1()({
|
|
995
996
|
type: "custom",
|
|
996
997
|
content: {
|
|
997
998
|
attributes: {
|
|
@@ -1037,7 +1038,7 @@ var t$54 = t$1()({
|
|
|
1037
1038
|
});
|
|
1038
1039
|
//#endregion
|
|
1039
1040
|
//#region ../sdk-elements/dist/elements/advanced/NodeHtml/declaration.mjs
|
|
1040
|
-
var t$
|
|
1041
|
+
var t$54 = t$1()({
|
|
1041
1042
|
type: "nodeHtml",
|
|
1042
1043
|
content: {
|
|
1043
1044
|
attributes: { subType: "div" },
|
|
@@ -1083,7 +1084,7 @@ var t$53 = t$1()({
|
|
|
1083
1084
|
});
|
|
1084
1085
|
//#endregion
|
|
1085
1086
|
//#region ../sdk-elements/dist/elements/advanced/Reference/declaration.mjs
|
|
1086
|
-
var t$
|
|
1087
|
+
var t$53 = t$1()({
|
|
1087
1088
|
type: "reference",
|
|
1088
1089
|
content: {
|
|
1089
1090
|
attributes: {
|
|
@@ -1127,7 +1128,7 @@ var t$52 = t$1()({
|
|
|
1127
1128
|
});
|
|
1128
1129
|
//#endregion
|
|
1129
1130
|
//#region ../sdk-elements/dist/elements/basic/Button/declaration.mjs
|
|
1130
|
-
var n$
|
|
1131
|
+
var n$41 = t$1()({
|
|
1131
1132
|
type: "button",
|
|
1132
1133
|
attributeValues: {
|
|
1133
1134
|
subType: e$1()([
|
|
@@ -1175,7 +1176,7 @@ var n$40 = t$1()({
|
|
|
1175
1176
|
license: "MIT",
|
|
1176
1177
|
website: "https://plitzi.com",
|
|
1177
1178
|
backgroundColor: "#4422ee",
|
|
1178
|
-
icon: "fa-solid fa-
|
|
1179
|
+
icon: "fa-solid fa-hand-pointer"
|
|
1179
1180
|
},
|
|
1180
1181
|
defaultStyle: {
|
|
1181
1182
|
name: "Button",
|
|
@@ -1240,7 +1241,7 @@ var n$40 = t$1()({
|
|
|
1240
1241
|
});
|
|
1241
1242
|
//#endregion
|
|
1242
1243
|
//#region ../sdk-elements/dist/elements/basic/Dropdown/declaration.mjs
|
|
1243
|
-
var n$
|
|
1244
|
+
var n$40 = t$1()({
|
|
1244
1245
|
type: "dropdown",
|
|
1245
1246
|
attributeValues: { popupPlacement: e$1()([
|
|
1246
1247
|
"left",
|
|
@@ -1314,7 +1315,7 @@ var n$39 = t$1()({
|
|
|
1314
1315
|
});
|
|
1315
1316
|
//#endregion
|
|
1316
1317
|
//#region ../sdk-elements/dist/elements/basic/Dropdown/DropdownPopup/declaration.mjs
|
|
1317
|
-
var t$
|
|
1318
|
+
var t$52 = t$1()({
|
|
1318
1319
|
type: "dropdownPopup",
|
|
1319
1320
|
ancestorType: "dropdown",
|
|
1320
1321
|
content: {
|
|
@@ -1344,7 +1345,7 @@ var t$51 = t$1()({
|
|
|
1344
1345
|
license: "MIT",
|
|
1345
1346
|
website: "https://plitzi.com",
|
|
1346
1347
|
backgroundColor: "#4422ee",
|
|
1347
|
-
icon: ""
|
|
1348
|
+
icon: "fa-regular fa-window-restore"
|
|
1348
1349
|
},
|
|
1349
1350
|
defaultStyle: {
|
|
1350
1351
|
name: "Dropdown Popup",
|
|
@@ -1373,7 +1374,7 @@ var t$51 = t$1()({
|
|
|
1373
1374
|
});
|
|
1374
1375
|
//#endregion
|
|
1375
1376
|
//#region ../sdk-elements/dist/elements/basic/Heading/declaration.mjs
|
|
1376
|
-
var n$
|
|
1377
|
+
var n$39 = t$1()({
|
|
1377
1378
|
type: "heading",
|
|
1378
1379
|
attributeValues: { subType: e$1()([
|
|
1379
1380
|
"h1",
|
|
@@ -1492,7 +1493,7 @@ var n$38 = t$1()({
|
|
|
1492
1493
|
});
|
|
1493
1494
|
//#endregion
|
|
1494
1495
|
//#region ../sdk-elements/dist/elements/basic/Link/declaration.mjs
|
|
1495
|
-
var n$
|
|
1496
|
+
var n$38 = t$1()({
|
|
1496
1497
|
type: "link",
|
|
1497
1498
|
attributeValues: {
|
|
1498
1499
|
mode: e$1()([
|
|
@@ -1565,7 +1566,7 @@ var n$37 = t$1()({
|
|
|
1565
1566
|
});
|
|
1566
1567
|
//#endregion
|
|
1567
1568
|
//#region ../sdk-elements/dist/elements/basic/Markdown/declaration.mjs
|
|
1568
|
-
var t$
|
|
1569
|
+
var t$51 = t$1()({
|
|
1569
1570
|
type: "markdown",
|
|
1570
1571
|
content: {
|
|
1571
1572
|
attributes: { content: "Markdown" },
|
|
@@ -1608,7 +1609,7 @@ var t$50 = t$1()({
|
|
|
1608
1609
|
});
|
|
1609
1610
|
//#endregion
|
|
1610
1611
|
//#region ../sdk-elements/dist/elements/basic/Paragraph/declaration.mjs
|
|
1611
|
-
var t$
|
|
1612
|
+
var t$50 = t$1()({
|
|
1612
1613
|
type: "paragraph",
|
|
1613
1614
|
content: {
|
|
1614
1615
|
attributes: { content: "Paragraph" },
|
|
@@ -1651,7 +1652,7 @@ var t$49 = t$1()({
|
|
|
1651
1652
|
});
|
|
1652
1653
|
//#endregion
|
|
1653
1654
|
//#region ../sdk-elements/dist/elements/basic/RichText/declaration.mjs
|
|
1654
|
-
var n$
|
|
1655
|
+
var n$37 = t$1()({
|
|
1655
1656
|
type: "richText",
|
|
1656
1657
|
attributeValues: { format: e$1()([
|
|
1657
1658
|
"html",
|
|
@@ -1689,7 +1690,7 @@ var n$36 = t$1()({
|
|
|
1689
1690
|
license: "MIT",
|
|
1690
1691
|
website: "https://plitzi.com",
|
|
1691
1692
|
backgroundColor: "#4422ee",
|
|
1692
|
-
icon: "fa-solid fa-
|
|
1693
|
+
icon: "fa-solid fa-file-lines"
|
|
1693
1694
|
},
|
|
1694
1695
|
defaultStyle: {
|
|
1695
1696
|
name: "Rich Text",
|
|
@@ -1702,7 +1703,7 @@ var n$36 = t$1()({
|
|
|
1702
1703
|
});
|
|
1703
1704
|
//#endregion
|
|
1704
1705
|
//#region ../sdk-elements/dist/elements/basic/Text/declaration.mjs
|
|
1705
|
-
var t$
|
|
1706
|
+
var t$49 = t$1()({
|
|
1706
1707
|
type: "text",
|
|
1707
1708
|
content: {
|
|
1708
1709
|
attributes: { content: "Text" },
|
|
@@ -1746,7 +1747,7 @@ var t$48 = t$1()({
|
|
|
1746
1747
|
});
|
|
1747
1748
|
//#endregion
|
|
1748
1749
|
//#region ../sdk-elements/dist/elements/basic/ThemeToggle/declaration.mjs
|
|
1749
|
-
var n$
|
|
1750
|
+
var n$36 = t$1()({
|
|
1750
1751
|
type: "themeToggle",
|
|
1751
1752
|
attributeValues: { subType: e$1()(["switch", "segmented"]) },
|
|
1752
1753
|
triggers: { onThemeChange: {
|
|
@@ -1810,7 +1811,7 @@ var n$35 = t$1()({
|
|
|
1810
1811
|
});
|
|
1811
1812
|
//#endregion
|
|
1812
1813
|
//#region ../sdk-elements/dist/elements/form/Form/declaration.mjs
|
|
1813
|
-
var n$
|
|
1814
|
+
var n$35 = t$1()({
|
|
1814
1815
|
type: "form",
|
|
1815
1816
|
attributeValues: { method: e$1()(["get", "post"]) },
|
|
1816
1817
|
sourceType: "apiContainer",
|
|
@@ -1902,7 +1903,8 @@ var n$34 = t$1()({
|
|
|
1902
1903
|
verified: !0,
|
|
1903
1904
|
license: "MIT",
|
|
1904
1905
|
website: "https://plitzi.com",
|
|
1905
|
-
backgroundColor: "#4422ee"
|
|
1906
|
+
backgroundColor: "#4422ee",
|
|
1907
|
+
icon: "fa-solid fa-rectangle-list"
|
|
1906
1908
|
},
|
|
1907
1909
|
defaultStyle: {
|
|
1908
1910
|
name: "Form",
|
|
@@ -1914,7 +1916,7 @@ var n$34 = t$1()({
|
|
|
1914
1916
|
});
|
|
1915
1917
|
//#endregion
|
|
1916
1918
|
//#region ../sdk-elements/dist/elements/form/FormControl/declaration.mjs
|
|
1917
|
-
var n$
|
|
1919
|
+
var n$34 = {
|
|
1918
1920
|
width: "100%",
|
|
1919
1921
|
display: "flex",
|
|
1920
1922
|
"align-items": "center",
|
|
@@ -1944,7 +1946,7 @@ var n$33 = {
|
|
|
1944
1946
|
outline: "none",
|
|
1945
1947
|
position: "relative"
|
|
1946
1948
|
};
|
|
1947
|
-
var r$
|
|
1949
|
+
var r$28 = {
|
|
1948
1950
|
display: "flex",
|
|
1949
1951
|
cursor: "pointer",
|
|
1950
1952
|
"font-weight": "600",
|
|
@@ -1953,16 +1955,16 @@ var r$26 = {
|
|
|
1953
1955
|
color: "#6b7280",
|
|
1954
1956
|
"user-select": "none"
|
|
1955
1957
|
};
|
|
1956
|
-
var i$
|
|
1957
|
-
...r$
|
|
1958
|
+
var i$23 = {
|
|
1959
|
+
...r$28,
|
|
1958
1960
|
"margin-bottom": "4px"
|
|
1959
1961
|
};
|
|
1960
|
-
var a$
|
|
1962
|
+
var a$19 = {
|
|
1961
1963
|
display: "block",
|
|
1962
1964
|
color: "red",
|
|
1963
1965
|
"margin-top": "4px"
|
|
1964
1966
|
};
|
|
1965
|
-
var o$
|
|
1967
|
+
var o$23 = t$1()({
|
|
1966
1968
|
type: "formControl",
|
|
1967
1969
|
attributeValues: { subType: e$1()([
|
|
1968
1970
|
"text",
|
|
@@ -2019,7 +2021,7 @@ var o$22 = t$1()({
|
|
|
2019
2021
|
definition: {
|
|
2020
2022
|
label: "Form Control",
|
|
2021
2023
|
type: "formControl",
|
|
2022
|
-
description: "A single labelled input (text/select/checkbox/… per its subType) inside a form; captures one field of user input.",
|
|
2024
|
+
description: "A single labelled input (text/select/checkbox/… per its subType) inside a form; captures one field of user input. A select offers its `options`: `[{ label, value }, …]` — the text shown, and what the field takes.",
|
|
2023
2025
|
bindings: {},
|
|
2024
2026
|
styleSelectors: {
|
|
2025
2027
|
base: "",
|
|
@@ -2044,7 +2046,8 @@ var o$22 = t$1()({
|
|
|
2044
2046
|
verified: !0,
|
|
2045
2047
|
license: "MIT",
|
|
2046
2048
|
website: "https://plitzi.com",
|
|
2047
|
-
backgroundColor: "#4422ee"
|
|
2049
|
+
backgroundColor: "#4422ee",
|
|
2050
|
+
icon: "fa-solid fa-i-cursor"
|
|
2048
2051
|
},
|
|
2049
2052
|
defaultStyle: {
|
|
2050
2053
|
name: "Form Control",
|
|
@@ -2057,8 +2060,8 @@ var o$22 = t$1()({
|
|
|
2057
2060
|
style: {
|
|
2058
2061
|
base: {},
|
|
2059
2062
|
input: { default: {} },
|
|
2060
|
-
label: { default: i$
|
|
2061
|
-
error: { default: a$
|
|
2063
|
+
label: { default: i$23 },
|
|
2064
|
+
error: { default: a$19 }
|
|
2062
2065
|
}
|
|
2063
2066
|
},
|
|
2064
2067
|
text: {
|
|
@@ -2066,9 +2069,9 @@ var o$22 = t$1()({
|
|
|
2066
2069
|
displayMode: "desktop",
|
|
2067
2070
|
style: {
|
|
2068
2071
|
base: { default: {} },
|
|
2069
|
-
input: { default: n$
|
|
2070
|
-
label: { default: i$
|
|
2071
|
-
error: { default: a$
|
|
2072
|
+
input: { default: n$34 },
|
|
2073
|
+
label: { default: i$23 },
|
|
2074
|
+
error: { default: a$19 }
|
|
2072
2075
|
}
|
|
2073
2076
|
},
|
|
2074
2077
|
password: {
|
|
@@ -2076,9 +2079,9 @@ var o$22 = t$1()({
|
|
|
2076
2079
|
displayMode: "desktop",
|
|
2077
2080
|
style: {
|
|
2078
2081
|
base: { default: {} },
|
|
2079
|
-
input: { default: n$
|
|
2080
|
-
label: { default: i$
|
|
2081
|
-
error: { default: a$
|
|
2082
|
+
input: { default: n$34 },
|
|
2083
|
+
label: { default: i$23 },
|
|
2084
|
+
error: { default: a$19 }
|
|
2082
2085
|
}
|
|
2083
2086
|
},
|
|
2084
2087
|
number: {
|
|
@@ -2086,9 +2089,9 @@ var o$22 = t$1()({
|
|
|
2086
2089
|
displayMode: "desktop",
|
|
2087
2090
|
style: {
|
|
2088
2091
|
base: { default: {} },
|
|
2089
|
-
input: { default: n$
|
|
2090
|
-
label: { default: i$
|
|
2091
|
-
error: { default: a$
|
|
2092
|
+
input: { default: n$34 },
|
|
2093
|
+
label: { default: i$23 },
|
|
2094
|
+
error: { default: a$19 }
|
|
2092
2095
|
}
|
|
2093
2096
|
},
|
|
2094
2097
|
email: {
|
|
@@ -2096,9 +2099,9 @@ var o$22 = t$1()({
|
|
|
2096
2099
|
displayMode: "desktop",
|
|
2097
2100
|
style: {
|
|
2098
2101
|
base: { default: {} },
|
|
2099
|
-
input: { default: n$
|
|
2100
|
-
label: { default: i$
|
|
2101
|
-
error: { default: a$
|
|
2102
|
+
input: { default: n$34 },
|
|
2103
|
+
label: { default: i$23 },
|
|
2104
|
+
error: { default: a$19 }
|
|
2102
2105
|
}
|
|
2103
2106
|
},
|
|
2104
2107
|
textarea: {
|
|
@@ -2106,9 +2109,9 @@ var o$22 = t$1()({
|
|
|
2106
2109
|
displayMode: "desktop",
|
|
2107
2110
|
style: {
|
|
2108
2111
|
base: { default: {} },
|
|
2109
|
-
input: { default: n$
|
|
2110
|
-
label: { default: i$
|
|
2111
|
-
error: { default: a$
|
|
2112
|
+
input: { default: n$34 },
|
|
2113
|
+
label: { default: i$23 },
|
|
2114
|
+
error: { default: a$19 }
|
|
2112
2115
|
}
|
|
2113
2116
|
},
|
|
2114
2117
|
checkbox: {
|
|
@@ -2122,8 +2125,8 @@ var o$22 = t$1()({
|
|
|
2122
2125
|
"margin-left": "0px",
|
|
2123
2126
|
"margin-right": "4px"
|
|
2124
2127
|
} },
|
|
2125
|
-
label: { default: r$
|
|
2126
|
-
error: { default: a$
|
|
2128
|
+
label: { default: r$28 },
|
|
2129
|
+
error: { default: a$19 }
|
|
2127
2130
|
}
|
|
2128
2131
|
},
|
|
2129
2132
|
select: {
|
|
@@ -2132,11 +2135,11 @@ var o$22 = t$1()({
|
|
|
2132
2135
|
style: {
|
|
2133
2136
|
base: { default: {} },
|
|
2134
2137
|
input: { default: {
|
|
2135
|
-
...n$
|
|
2138
|
+
...n$34,
|
|
2136
2139
|
cursor: "pointer"
|
|
2137
2140
|
} },
|
|
2138
|
-
label: i$
|
|
2139
|
-
error: { default: a$
|
|
2141
|
+
label: i$23,
|
|
2142
|
+
error: { default: a$19 }
|
|
2140
2143
|
}
|
|
2141
2144
|
}
|
|
2142
2145
|
}
|
|
@@ -2146,7 +2149,7 @@ var o$22 = t$1()({
|
|
|
2146
2149
|
});
|
|
2147
2150
|
//#endregion
|
|
2148
2151
|
//#region ../sdk-elements/dist/elements/internal/LayoutContainer/declaration.mjs
|
|
2149
|
-
var n$
|
|
2152
|
+
var n$33 = t$1()({
|
|
2150
2153
|
type: "layoutContainer",
|
|
2151
2154
|
attributeValues: { subType: e$1()([
|
|
2152
2155
|
"div",
|
|
@@ -2200,7 +2203,7 @@ var n$32 = t$1()({
|
|
|
2200
2203
|
});
|
|
2201
2204
|
//#endregion
|
|
2202
2205
|
//#region ../sdk-elements/dist/elements/internal/Loading/declaration.mjs
|
|
2203
|
-
var t$
|
|
2206
|
+
var t$48 = t$1()({
|
|
2204
2207
|
type: "loading",
|
|
2205
2208
|
content: {
|
|
2206
2209
|
attributes: {},
|
|
@@ -2240,7 +2243,7 @@ var t$47 = t$1()({
|
|
|
2240
2243
|
});
|
|
2241
2244
|
//#endregion
|
|
2242
2245
|
//#region ../sdk-elements/dist/elements/internal/NotFound/declaration.mjs
|
|
2243
|
-
var t$
|
|
2246
|
+
var t$47 = t$1()({
|
|
2244
2247
|
type: "notFound",
|
|
2245
2248
|
content: {
|
|
2246
2249
|
attributes: {},
|
|
@@ -2280,7 +2283,7 @@ var t$46 = t$1()({
|
|
|
2280
2283
|
});
|
|
2281
2284
|
//#endregion
|
|
2282
2285
|
//#region ../sdk-elements/dist/elements/internal/Page/declaration.mjs
|
|
2283
|
-
var t$
|
|
2286
|
+
var t$46 = t$1()({
|
|
2284
2287
|
type: "page",
|
|
2285
2288
|
triggers: { onPageLoad: {
|
|
2286
2289
|
action: "onPageLoad",
|
|
@@ -2354,7 +2357,7 @@ var t$45 = t$1()({
|
|
|
2354
2357
|
});
|
|
2355
2358
|
//#endregion
|
|
2356
2359
|
//#region ../sdk-elements/dist/elements/media/Embed/declaration.mjs
|
|
2357
|
-
var t$
|
|
2360
|
+
var t$45 = t$1()({
|
|
2358
2361
|
type: "embed",
|
|
2359
2362
|
content: {
|
|
2360
2363
|
attributes: {
|
|
@@ -2406,7 +2409,7 @@ var t$44 = t$1()({
|
|
|
2406
2409
|
});
|
|
2407
2410
|
//#endregion
|
|
2408
2411
|
//#region ../sdk-elements/dist/elements/media/FontAwesome/declaration.mjs
|
|
2409
|
-
var t$
|
|
2412
|
+
var t$44 = t$1()({
|
|
2410
2413
|
type: "fontAwesome",
|
|
2411
2414
|
content: {
|
|
2412
2415
|
attributes: {
|
|
@@ -2453,7 +2456,7 @@ var t$43 = t$1()({
|
|
|
2453
2456
|
});
|
|
2454
2457
|
//#endregion
|
|
2455
2458
|
//#region ../sdk-elements/dist/elements/media/Image/declaration.mjs
|
|
2456
|
-
var n$
|
|
2459
|
+
var n$32 = t$1()({
|
|
2457
2460
|
type: "image",
|
|
2458
2461
|
attributeValues: {
|
|
2459
2462
|
fetchPriority: e$1()([
|
|
@@ -2515,7 +2518,7 @@ var n$31 = t$1()({
|
|
|
2515
2518
|
});
|
|
2516
2519
|
//#endregion
|
|
2517
2520
|
//#region ../sdk-elements/dist/elements/media/Svg/declaration.mjs
|
|
2518
|
-
var t$
|
|
2521
|
+
var t$43 = t$1()({
|
|
2519
2522
|
type: "svg",
|
|
2520
2523
|
content: {
|
|
2521
2524
|
attributes: {
|
|
@@ -2562,7 +2565,7 @@ var t$42 = t$1()({
|
|
|
2562
2565
|
});
|
|
2563
2566
|
//#endregion
|
|
2564
2567
|
//#region ../sdk-elements/dist/elements/media/Video/declaration.mjs
|
|
2565
|
-
var t$
|
|
2568
|
+
var t$42 = t$1()({
|
|
2566
2569
|
type: "video",
|
|
2567
2570
|
content: {
|
|
2568
2571
|
attributes: {
|
|
@@ -2612,7 +2615,7 @@ var t$41 = t$1()({
|
|
|
2612
2615
|
});
|
|
2613
2616
|
//#endregion
|
|
2614
2617
|
//#region ../sdk-elements/dist/elements/provider/ApiContainer/declaration.mjs
|
|
2615
|
-
var n$
|
|
2618
|
+
var n$31 = t$1()({
|
|
2616
2619
|
type: "apiContainer",
|
|
2617
2620
|
attributeValues: {
|
|
2618
2621
|
subType: e$1()([
|
|
@@ -2686,6 +2689,13 @@ var n$30 = t$1()({
|
|
|
2686
2689
|
description: "Values handed to a server-driven provider with its request, beside the page’s own route and query params — a search, a filter. Kept for the pages it loads after (`loadMore`, `goToPage`) until the next query."
|
|
2687
2690
|
} }
|
|
2688
2691
|
},
|
|
2692
|
+
cancelQuery: {
|
|
2693
|
+
action: "cancelQuery",
|
|
2694
|
+
title: "Cancel Query",
|
|
2695
|
+
type: "callback",
|
|
2696
|
+
preview: {},
|
|
2697
|
+
params: {}
|
|
2698
|
+
},
|
|
2689
2699
|
loadMore: {
|
|
2690
2700
|
action: "loadMore",
|
|
2691
2701
|
title: "Load More",
|
|
@@ -2781,7 +2791,7 @@ var n$30 = t$1()({
|
|
|
2781
2791
|
});
|
|
2782
2792
|
//#endregion
|
|
2783
2793
|
//#region ../sdk-elements/dist/elements/provider/Channel/declaration.mjs
|
|
2784
|
-
var n$
|
|
2794
|
+
var n$30 = t$1()({
|
|
2785
2795
|
type: "channel",
|
|
2786
2796
|
attributeValues: { subType: e$1()([
|
|
2787
2797
|
"",
|
|
@@ -2904,7 +2914,7 @@ var n$29 = t$1()({
|
|
|
2904
2914
|
});
|
|
2905
2915
|
//#endregion
|
|
2906
2916
|
//#region ../sdk-elements/dist/elements/structure/Carousel/declaration.mjs
|
|
2907
|
-
var t$
|
|
2917
|
+
var t$41 = t$1()({
|
|
2908
2918
|
type: "carousel",
|
|
2909
2919
|
sourceType: "carousel",
|
|
2910
2920
|
triggers: { onChange: {
|
|
@@ -3008,7 +3018,7 @@ var t$40 = t$1()({
|
|
|
3008
3018
|
});
|
|
3009
3019
|
//#endregion
|
|
3010
3020
|
//#region ../sdk-elements/dist/elements/structure/Carousel/CarouselTrack/declaration.mjs
|
|
3011
|
-
var t$
|
|
3021
|
+
var t$40 = t$1()({
|
|
3012
3022
|
type: "carouselTrack",
|
|
3013
3023
|
ancestorType: "carousel",
|
|
3014
3024
|
content: {
|
|
@@ -3050,7 +3060,7 @@ var t$39 = t$1()({
|
|
|
3050
3060
|
});
|
|
3051
3061
|
//#endregion
|
|
3052
3062
|
//#region ../sdk-elements/dist/elements/structure/Container/declaration.mjs
|
|
3053
|
-
var n$
|
|
3063
|
+
var n$29 = [
|
|
3054
3064
|
"div",
|
|
3055
3065
|
"header",
|
|
3056
3066
|
"footer",
|
|
@@ -3064,13 +3074,13 @@ var n$28 = [
|
|
|
3064
3074
|
//#endregion
|
|
3065
3075
|
//#region ../sdk-elements/dist/elements/declarations/index.mjs
|
|
3066
3076
|
var B = {
|
|
3067
|
-
ApiContainer: n$
|
|
3068
|
-
BlockHtml: t$
|
|
3069
|
-
BlockJsx: t$
|
|
3070
|
-
Button: n$
|
|
3071
|
-
Carousel: t$
|
|
3072
|
-
CarouselTrack: t$
|
|
3073
|
-
Channel: n$
|
|
3077
|
+
ApiContainer: n$31,
|
|
3078
|
+
BlockHtml: t$57,
|
|
3079
|
+
BlockJsx: t$56,
|
|
3080
|
+
Button: n$41,
|
|
3081
|
+
Carousel: t$41,
|
|
3082
|
+
CarouselTrack: t$40,
|
|
3083
|
+
Channel: n$30,
|
|
3074
3084
|
Container: t$1()({
|
|
3075
3085
|
type: "container",
|
|
3076
3086
|
attributeValues: {
|
|
@@ -3131,7 +3141,7 @@ var B = {
|
|
|
3131
3141
|
license: "MIT",
|
|
3132
3142
|
website: "https://plitzi.com",
|
|
3133
3143
|
backgroundColor: "#4422ee",
|
|
3134
|
-
icon: "fa-
|
|
3144
|
+
icon: "fa-solid fa-crop-simple"
|
|
3135
3145
|
},
|
|
3136
3146
|
defaultStyle: {
|
|
3137
3147
|
name: "Container",
|
|
@@ -3142,7 +3152,7 @@ var B = {
|
|
|
3142
3152
|
settings: {}
|
|
3143
3153
|
}
|
|
3144
3154
|
}),
|
|
3145
|
-
Custom: t$
|
|
3155
|
+
Custom: t$55,
|
|
3146
3156
|
DialogContainer: t$1()({
|
|
3147
3157
|
type: "dialogContainer",
|
|
3148
3158
|
sourceType: "dialogContainer",
|
|
@@ -3251,7 +3261,7 @@ var B = {
|
|
|
3251
3261
|
license: "MIT",
|
|
3252
3262
|
website: "https://plitzi.com",
|
|
3253
3263
|
backgroundColor: "#4422ee",
|
|
3254
|
-
icon: "fa-regular fa-
|
|
3264
|
+
icon: "fa-regular fa-message"
|
|
3255
3265
|
},
|
|
3256
3266
|
defaultStyle: {
|
|
3257
3267
|
name: "Dialog Container",
|
|
@@ -3330,16 +3340,16 @@ var B = {
|
|
|
3330
3340
|
},
|
|
3331
3341
|
initialItems: ["container"]
|
|
3332
3342
|
}),
|
|
3333
|
-
Dropdown: n$
|
|
3334
|
-
DropdownPopup: t$
|
|
3335
|
-
Embed: t$
|
|
3336
|
-
FontAwesome: t$
|
|
3337
|
-
Form: n$
|
|
3338
|
-
FormControl: o$
|
|
3339
|
-
Heading: n$
|
|
3340
|
-
Image: n$
|
|
3341
|
-
LayoutContainer: n$
|
|
3342
|
-
Link: n$
|
|
3343
|
+
Dropdown: n$40,
|
|
3344
|
+
DropdownPopup: t$52,
|
|
3345
|
+
Embed: t$45,
|
|
3346
|
+
FontAwesome: t$44,
|
|
3347
|
+
Form: n$35,
|
|
3348
|
+
FormControl: o$23,
|
|
3349
|
+
Heading: n$39,
|
|
3350
|
+
Image: n$32,
|
|
3351
|
+
LayoutContainer: n$33,
|
|
3352
|
+
Link: n$38,
|
|
3343
3353
|
List: t$1()({
|
|
3344
3354
|
type: "list",
|
|
3345
3355
|
attributeValues: {
|
|
@@ -3442,7 +3452,7 @@ var B = {
|
|
|
3442
3452
|
license: "MIT",
|
|
3443
3453
|
website: "https://plitzi.com",
|
|
3444
3454
|
backgroundColor: "#4422ee",
|
|
3445
|
-
icon: "fa-solid fa-
|
|
3455
|
+
icon: "fa-solid fa-grip-lines"
|
|
3446
3456
|
},
|
|
3447
3457
|
defaultStyle: {
|
|
3448
3458
|
name: "List Item",
|
|
@@ -3452,8 +3462,8 @@ var B = {
|
|
|
3452
3462
|
settings: {}
|
|
3453
3463
|
}
|
|
3454
3464
|
}),
|
|
3455
|
-
Loading: t$
|
|
3456
|
-
Markdown: t$
|
|
3465
|
+
Loading: t$48,
|
|
3466
|
+
Markdown: t$51,
|
|
3457
3467
|
ModalContainer: t$1()({
|
|
3458
3468
|
type: "modalContainer",
|
|
3459
3469
|
sourceType: "modalContainer",
|
|
@@ -3616,9 +3626,9 @@ var B = {
|
|
|
3616
3626
|
},
|
|
3617
3627
|
initialItems: ["container"]
|
|
3618
3628
|
}),
|
|
3619
|
-
NodeHtml: t$
|
|
3620
|
-
NotFound: t$
|
|
3621
|
-
Page: t$
|
|
3629
|
+
NodeHtml: t$54,
|
|
3630
|
+
NotFound: t$47,
|
|
3631
|
+
Page: t$46,
|
|
3622
3632
|
Pagination: t$1()({
|
|
3623
3633
|
type: "pagination",
|
|
3624
3634
|
attributeValues: {
|
|
@@ -3684,10 +3694,10 @@ var B = {
|
|
|
3684
3694
|
settings: {}
|
|
3685
3695
|
}
|
|
3686
3696
|
}),
|
|
3687
|
-
Paragraph: t$
|
|
3688
|
-
Reference: t$
|
|
3689
|
-
RichText: n$
|
|
3690
|
-
Svg: t$
|
|
3697
|
+
Paragraph: t$50,
|
|
3698
|
+
Reference: t$53,
|
|
3699
|
+
RichText: n$37,
|
|
3700
|
+
Svg: t$43,
|
|
3691
3701
|
TabContainer: t$1()({
|
|
3692
3702
|
type: "tabContainer",
|
|
3693
3703
|
content: {
|
|
@@ -3854,7 +3864,7 @@ var B = {
|
|
|
3854
3864
|
license: "MIT",
|
|
3855
3865
|
website: "https://plitzi.com",
|
|
3856
3866
|
backgroundColor: "#4422ee",
|
|
3857
|
-
icon: "fa-
|
|
3867
|
+
icon: "fa-regular fa-folder"
|
|
3858
3868
|
},
|
|
3859
3869
|
defaultStyle: {
|
|
3860
3870
|
name: "Tab Container Item",
|
|
@@ -3865,9 +3875,9 @@ var B = {
|
|
|
3865
3875
|
settings: {}
|
|
3866
3876
|
}
|
|
3867
3877
|
}),
|
|
3868
|
-
Text: t$
|
|
3869
|
-
ThemeToggle: n$
|
|
3870
|
-
Video: t$
|
|
3878
|
+
Text: t$49,
|
|
3879
|
+
ThemeToggle: n$36,
|
|
3880
|
+
Video: t$42
|
|
3871
3881
|
};
|
|
3872
3882
|
//#endregion
|
|
3873
3883
|
//#region src/elements/catalog.ts
|
|
@@ -4376,6 +4386,11 @@ var AUTHORING_CODES = {
|
|
|
4376
4386
|
means: "an `apiContainer` that asks nothing",
|
|
4377
4387
|
fix: "a `query` (or `action`, `connector`, `resource`)"
|
|
4378
4388
|
},
|
|
4389
|
+
"action-output-path": {
|
|
4390
|
+
kind: "warned",
|
|
4391
|
+
means: "a read of `.data` on a provider fed by a server action — it publishes the action’s output at its root, and `.data` is a `query` provider’s answer",
|
|
4392
|
+
fix: "the output’s own field — `apiContainer_feed.stories`, not `apiContainer_feed.data.stories`"
|
|
4393
|
+
},
|
|
4379
4394
|
"path-not-in-data": {
|
|
4380
4395
|
kind: "warned",
|
|
4381
4396
|
means: "a binding onto a provider whose answer the author could read (`data`), through a path that answer does not have",
|
|
@@ -4386,6 +4401,11 @@ var AUTHORING_CODES = {
|
|
|
4386
4401
|
means: "a `runtime: 'server'` element inside a component: the page server resolves a page's and its layouts', never a component's",
|
|
4387
4402
|
fix: "put the provider on the page, around the instance, and hand the component its rows as a prop"
|
|
4388
4403
|
},
|
|
4404
|
+
"server-data-in-browser": {
|
|
4405
|
+
kind: "refused",
|
|
4406
|
+
means: "a provider asking for the project's own data (`/data/…`, read by its server from `src/data/` and never served) from the browser",
|
|
4407
|
+
fix: "`runtime: 'server'` on the provider: the page arrives with the data in it"
|
|
4408
|
+
},
|
|
4389
4409
|
"server-data-without-rsc": {
|
|
4390
4410
|
kind: "warned",
|
|
4391
4411
|
means: "a `runtime: 'server'` provider — `connector`, `action` or `query` — in a space that turns server data off (`rsc: { enabled: false }`)",
|
|
@@ -4668,7 +4688,7 @@ var AUTHORING_CODES = {
|
|
|
4668
4688
|
},
|
|
4669
4689
|
"while-running": {
|
|
4670
4690
|
kind: "refused",
|
|
4671
|
-
means: "`whileRunning` on a step that is not the trigger, or a mode other than `skip`, `parallel`, `queue`",
|
|
4691
|
+
means: "`whileRunning` on a step that is not the trigger, or a mode other than `skip`, `parallel`, `queue`, `latest`",
|
|
4672
4692
|
fix: "`[whileRunning('queue', onClick()), …]`"
|
|
4673
4693
|
},
|
|
4674
4694
|
"callback-not-answered": {
|
|
@@ -4825,6 +4845,26 @@ var AUTHORING_CODES = {
|
|
|
4825
4845
|
kind: "suggested",
|
|
4826
4846
|
means: "keyframes animating what the browser repaints or lays out again on every frame — a size, a position, a blur, a shadow, or a colour in a loop — which stutters whenever the page is busy, most of all while it loads",
|
|
4827
4847
|
fix: "`opacity` and `transform`: a size or a position is `translate`/`scale`, a blur or a shadow is the `opacity` of a layer carrying it; a loop that must animate anything else starts `paused` and runs under `[data-hydrated]`"
|
|
4848
|
+
},
|
|
4849
|
+
"unused-class": {
|
|
4850
|
+
kind: "suggested",
|
|
4851
|
+
means: "a class declared in `classes` that no element, binding, flow or other class names",
|
|
4852
|
+
fix: "remove it from `classes` — or wear it where it was meant to go"
|
|
4853
|
+
},
|
|
4854
|
+
"unused-token": {
|
|
4855
|
+
kind: "suggested",
|
|
4856
|
+
means: "a token of `variables` no `var(--…)` reads — not a class, an element, `customCss` nor another token",
|
|
4857
|
+
fix: "remove it, or write it where its colour is written out"
|
|
4858
|
+
},
|
|
4859
|
+
"literal-colour": {
|
|
4860
|
+
kind: "suggested",
|
|
4861
|
+
means: "a colour written out in a class where the space has a token of that value — it stays put in the dark scheme",
|
|
4862
|
+
fix: "`var(--token)` when it should follow the scheme; a token of one value of its own when it must stay the same in both"
|
|
4863
|
+
},
|
|
4864
|
+
"unused-component": {
|
|
4865
|
+
kind: "suggested",
|
|
4866
|
+
means: "a component no page, layout or other component places",
|
|
4867
|
+
fix: "remove it from `components`, or place it where it was meant to go"
|
|
4828
4868
|
}
|
|
4829
4869
|
};
|
|
4830
4870
|
var isAuthoringCode = (code) => Object.hasOwn(AUTHORING_CODES, code);
|
|
@@ -4919,6 +4959,13 @@ var didYouMean = (name, candidates) => {
|
|
|
4919
4959
|
//#region src/elements/source.ts
|
|
4920
4960
|
var PATH = Symbol("plitzi.sourcePath");
|
|
4921
4961
|
var SHAPE = Symbol("plitzi.sourceShape");
|
|
4962
|
+
var PROVIDER_STATE = {
|
|
4963
|
+
isLoading: false,
|
|
4964
|
+
isEmpty: false,
|
|
4965
|
+
hasError: false,
|
|
4966
|
+
errorMessage: "",
|
|
4967
|
+
isStale: false
|
|
4968
|
+
};
|
|
4922
4969
|
/** What a path leads to in the sample, or `UNKNOWN` below a point the sample does not describe (`null`, `[]`). */
|
|
4923
4970
|
var UNKNOWN = Symbol("plitzi.unknownShape");
|
|
4924
4971
|
/** Every item of a list read as one: the fields any of them has, so an optional field in the sample still counts. */
|
|
@@ -4973,11 +5020,28 @@ var source = (id, sample) => {
|
|
|
4973
5020
|
const full = scoped(id);
|
|
4974
5021
|
const published = {
|
|
4975
5022
|
data: sample,
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
5023
|
+
...PROVIDER_STATE
|
|
5024
|
+
};
|
|
5025
|
+
return pathTo(`apiContainer_${full}`, published, { id: full });
|
|
5026
|
+
};
|
|
5027
|
+
/**
|
|
5028
|
+
* The `apiContainer` with this id, fed by a server action, as a typed source: the action's OUTPUT is published at its
|
|
5029
|
+
* root — `feed.stories`, never `feed.data.stories` — typed and checked by a sample of that output:
|
|
5030
|
+
*
|
|
5031
|
+
* ```ts
|
|
5032
|
+
* const feed = actionSource('feed', { stories: [{ id: 'a', title: '' }], updatedAt: '' });
|
|
5033
|
+
* apiContainer({ id: feed.id, runtime: 'server', action: 'world-report', children: [
|
|
5034
|
+
* list({ id: 'stories', items: feed.stories, row: s => listItem({ children: [text({ from: s.item.title })] }) })
|
|
5035
|
+
* ] });
|
|
5036
|
+
* ```
|
|
5037
|
+
*
|
|
5038
|
+
* The output is what the action's last step answers — a sample written by hand, or the type of the task's result.
|
|
5039
|
+
*/
|
|
5040
|
+
var actionSource = (id, sample) => {
|
|
5041
|
+
const full = scoped(id);
|
|
5042
|
+
const published = {
|
|
5043
|
+
...sample,
|
|
5044
|
+
...PROVIDER_STATE
|
|
4981
5045
|
};
|
|
4982
5046
|
return pathTo(`apiContainer_${full}`, published, { id: full });
|
|
4983
5047
|
};
|
|
@@ -5040,20 +5104,20 @@ var e$33 = {
|
|
|
5040
5104
|
LowerR: 114,
|
|
5041
5105
|
LowerT: 116
|
|
5042
5106
|
};
|
|
5043
|
-
var t$
|
|
5044
|
-
var n$
|
|
5045
|
-
var r$
|
|
5046
|
-
var i$
|
|
5047
|
-
var a$
|
|
5048
|
-
var o$
|
|
5107
|
+
var t$31 = (t) => t >= 97 && t <= 122 || t >= 65 && t <= 90 || t === e$33.Underscore;
|
|
5108
|
+
var n$26 = (n) => t$31(n) || n >= e$33.Zero && n <= e$33.Nine;
|
|
5109
|
+
var r$26 = (t) => n$26(t) || t === e$33.Minus;
|
|
5110
|
+
var i$22 = (t) => t >= e$33.Zero && t <= e$33.Nine;
|
|
5111
|
+
var a$18 = (t) => t === e$33.Space || t === e$33.Tab || t === e$33.Newline || t === e$33.CarriageReturn;
|
|
5112
|
+
var o$22 = (e) => {
|
|
5049
5113
|
let r = e.length;
|
|
5050
|
-
if (r === 0 || !t$
|
|
5051
|
-
for (let t = 1; t < r; t++) if (!n$
|
|
5114
|
+
if (r === 0 || !t$31(e.charCodeAt(0))) return !1;
|
|
5115
|
+
for (let t = 1; t < r; t++) if (!n$26(e.charCodeAt(t))) return !1;
|
|
5052
5116
|
return !0;
|
|
5053
5117
|
};
|
|
5054
|
-
var s$
|
|
5118
|
+
var s$18 = (r) => {
|
|
5055
5119
|
let a = r.length;
|
|
5056
|
-
if (a === 0 || !t$
|
|
5120
|
+
if (a === 0 || !t$31(r.charCodeAt(0))) return !1;
|
|
5057
5121
|
let o = !1, s = !1;
|
|
5058
5122
|
for (let c = 1; c < a; c++) {
|
|
5059
5123
|
let a = r.charCodeAt(c);
|
|
@@ -5063,15 +5127,15 @@ var s$17 = (r) => {
|
|
|
5063
5127
|
continue;
|
|
5064
5128
|
}
|
|
5065
5129
|
if (o) {
|
|
5066
|
-
if (s = i$
|
|
5130
|
+
if (s = i$22(a), !s && !t$31(a)) return !1;
|
|
5067
5131
|
o = !1;
|
|
5068
5132
|
continue;
|
|
5069
5133
|
}
|
|
5070
|
-
if (s ? !i$
|
|
5134
|
+
if (s ? !i$22(a) : !n$26(a)) return !1;
|
|
5071
5135
|
}
|
|
5072
5136
|
return !o;
|
|
5073
5137
|
};
|
|
5074
|
-
var c$
|
|
5138
|
+
var c$15 = (e) => o$22(e);
|
|
5075
5139
|
//#endregion
|
|
5076
5140
|
//#region ../sdk-shared/dist/helpers/twigWrapper/Lexer/Lexer.mjs
|
|
5077
5141
|
var e$32 = (e) => {
|
|
@@ -5127,7 +5191,7 @@ var e$32 = (e) => {
|
|
|
5127
5191
|
//#endregion
|
|
5128
5192
|
//#region ../sdk-shared/dist/helpers/twigWrapper/Lexer/types.mjs
|
|
5129
5193
|
var e$31 = (e, t) => t ? `{{{${e}}}}` : `{{${e}}}`;
|
|
5130
|
-
var t$
|
|
5194
|
+
var t$30 = (t) => {
|
|
5131
5195
|
switch (t.type) {
|
|
5132
5196
|
case "text": return t.value;
|
|
5133
5197
|
case "variable": return e$31(t.content, t.raw);
|
|
@@ -5136,7 +5200,7 @@ var t$29 = (t) => {
|
|
|
5136
5200
|
};
|
|
5137
5201
|
//#endregion
|
|
5138
5202
|
//#region ../sdk-shared/dist/helpers/twigWrapper/Parser/Cursor.mjs
|
|
5139
|
-
var o$
|
|
5203
|
+
var o$21 = class {
|
|
5140
5204
|
src;
|
|
5141
5205
|
pos = 0;
|
|
5142
5206
|
constructor(e) {
|
|
@@ -5153,16 +5217,16 @@ var o$20 = class {
|
|
|
5153
5217
|
return t < this.src.length ? this.src.charCodeAt(t) : -1;
|
|
5154
5218
|
}
|
|
5155
5219
|
skipWs() {
|
|
5156
|
-
for (; this.pos < this.src.length && a$
|
|
5220
|
+
for (; this.pos < this.src.length && a$18(this.src.charCodeAt(this.pos));) this.pos++;
|
|
5157
5221
|
}
|
|
5158
5222
|
scanName() {
|
|
5159
5223
|
let e = this.pos;
|
|
5160
|
-
if (!this.eof() && t$
|
|
5224
|
+
if (!this.eof() && t$31(this.src.charCodeAt(this.pos))) for (this.pos++; !this.eof() && r$26(this.src.charCodeAt(this.pos));) this.pos++;
|
|
5161
5225
|
return this.src.slice(e, this.pos);
|
|
5162
5226
|
}
|
|
5163
5227
|
scanIndex() {
|
|
5164
5228
|
let e = this.pos;
|
|
5165
|
-
for (; !this.eof() && i$
|
|
5229
|
+
for (; !this.eof() && i$22(this.src.charCodeAt(this.pos));) this.pos++;
|
|
5166
5230
|
return this.src.slice(e, this.pos);
|
|
5167
5231
|
}
|
|
5168
5232
|
scanStringLiteral() {
|
|
@@ -5178,15 +5242,15 @@ var o$20 = class {
|
|
|
5178
5242
|
}
|
|
5179
5243
|
scanNumber() {
|
|
5180
5244
|
let n = this.pos;
|
|
5181
|
-
for (this.src.charCodeAt(this.pos) === e$33.Minus && this.pos++; this.pos < this.src.length && i$
|
|
5182
|
-
if (this.src.charCodeAt(this.pos) === e$33.Dot) for (this.pos++; this.pos < this.src.length && i$
|
|
5245
|
+
for (this.src.charCodeAt(this.pos) === e$33.Minus && this.pos++; this.pos < this.src.length && i$22(this.src.charCodeAt(this.pos));) this.pos++;
|
|
5246
|
+
if (this.src.charCodeAt(this.pos) === e$33.Dot) for (this.pos++; this.pos < this.src.length && i$22(this.src.charCodeAt(this.pos));) this.pos++;
|
|
5183
5247
|
return Number(this.src.slice(n, this.pos));
|
|
5184
5248
|
}
|
|
5185
5249
|
matchKeyword(e) {
|
|
5186
5250
|
let t = this.pos + e.length;
|
|
5187
5251
|
if (t > this.src.length) return !1;
|
|
5188
5252
|
for (let t = 0; t < e.length; t++) if (this.src.charCodeAt(this.pos + t) !== e.charCodeAt(t)) return !1;
|
|
5189
|
-
return t < this.src.length && n$
|
|
5253
|
+
return t < this.src.length && n$26(this.src.charCodeAt(t)) ? !1 : (this.pos = t, this.skipWs(), !0);
|
|
5190
5254
|
}
|
|
5191
5255
|
matchBinaryOp() {
|
|
5192
5256
|
this.skipWs();
|
|
@@ -5202,17 +5266,17 @@ var o$20 = class {
|
|
|
5202
5266
|
};
|
|
5203
5267
|
//#endregion
|
|
5204
5268
|
//#region ../sdk-shared/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs
|
|
5205
|
-
var r$
|
|
5206
|
-
let n = new s$
|
|
5269
|
+
var r$25 = (e, t) => {
|
|
5270
|
+
let n = new s$17(e, t), r = n.parseTernary();
|
|
5207
5271
|
return n.expectEnd(), r;
|
|
5208
5272
|
};
|
|
5209
|
-
var i$
|
|
5210
|
-
let n = new s$
|
|
5273
|
+
var i$21 = (e, t) => {
|
|
5274
|
+
let n = new s$17(e, t), r = n.parseApplyChain();
|
|
5211
5275
|
return n.expectEnd(), r;
|
|
5212
5276
|
};
|
|
5213
|
-
var a$
|
|
5214
|
-
var o$
|
|
5215
|
-
var s$
|
|
5277
|
+
var a$17 = ["same as", "divisible by"];
|
|
5278
|
+
var o$20 = "`matches` is not supported: templates evaluate no regular expressions. Use `starts with`, `ends with` or `in`.";
|
|
5279
|
+
var s$17 = class extends o$21 {
|
|
5216
5280
|
issues;
|
|
5217
5281
|
constructor(e, t) {
|
|
5218
5282
|
super(e), this.issues = t;
|
|
@@ -5326,7 +5390,7 @@ var s$16 = class extends o$20 {
|
|
|
5326
5390
|
return this.pos = this.src.length, {
|
|
5327
5391
|
type: "unary",
|
|
5328
5392
|
operator: "not",
|
|
5329
|
-
operand: r$
|
|
5393
|
+
operand: r$25(t, this.issues)
|
|
5330
5394
|
};
|
|
5331
5395
|
}
|
|
5332
5396
|
if (this.matchKeyword("in")) {
|
|
@@ -5349,7 +5413,7 @@ var s$16 = class extends o$20 {
|
|
|
5349
5413
|
continue;
|
|
5350
5414
|
}
|
|
5351
5415
|
if (this.matchKeyword("matches")) {
|
|
5352
|
-
this.report(o$
|
|
5416
|
+
this.report(o$20), e = {
|
|
5353
5417
|
type: "binary",
|
|
5354
5418
|
operator: "matches",
|
|
5355
5419
|
left: e,
|
|
@@ -5373,7 +5437,7 @@ var s$16 = class extends o$20 {
|
|
|
5373
5437
|
}
|
|
5374
5438
|
matchWordedTest() {
|
|
5375
5439
|
let e = this.pos;
|
|
5376
|
-
for (let t of a$
|
|
5440
|
+
for (let t of a$17) {
|
|
5377
5441
|
let [n, r] = t.split(" ");
|
|
5378
5442
|
if (this.matchKeyword(n)) {
|
|
5379
5443
|
if (this.skipWs(), this.matchKeyword(r)) return t;
|
|
@@ -5440,7 +5504,7 @@ var s$16 = class extends o$20 {
|
|
|
5440
5504
|
});
|
|
5441
5505
|
}
|
|
5442
5506
|
parseSignedAtom() {
|
|
5443
|
-
return this.peek() === e$33.Minus && i$
|
|
5507
|
+
return this.peek() === e$33.Minus && i$22(this.at(1)) ? this.maybeTrailingFilters({
|
|
5444
5508
|
type: "literal",
|
|
5445
5509
|
value: this.scanNumber()
|
|
5446
5510
|
}) : this.peek() === e$33.Minus ? (this.pos++, this.skipWs(), {
|
|
@@ -5450,7 +5514,7 @@ var s$16 = class extends o$20 {
|
|
|
5450
5514
|
}) : this.parseAtom();
|
|
5451
5515
|
}
|
|
5452
5516
|
parseDefault() {
|
|
5453
|
-
if (this.skipWs(), this.peek() === e$33.Minus && i$
|
|
5517
|
+
if (this.skipWs(), this.peek() === e$33.Minus && i$22(this.at(1))) return this.maybeTrailingFilters({
|
|
5454
5518
|
type: "literal",
|
|
5455
5519
|
value: this.scanNumber()
|
|
5456
5520
|
});
|
|
@@ -5486,7 +5550,7 @@ var s$16 = class extends o$20 {
|
|
|
5486
5550
|
type: "literal",
|
|
5487
5551
|
value: this.scanStringLiteral()
|
|
5488
5552
|
});
|
|
5489
|
-
if (i$
|
|
5553
|
+
if (i$22(n)) return this.maybeTrailingFilters({
|
|
5490
5554
|
type: "literal",
|
|
5491
5555
|
value: this.scanNumber()
|
|
5492
5556
|
});
|
|
@@ -5617,7 +5681,7 @@ var s$16 = class extends o$20 {
|
|
|
5617
5681
|
type: "literal",
|
|
5618
5682
|
value: this.scanStringLiteral()
|
|
5619
5683
|
};
|
|
5620
|
-
if (i$
|
|
5684
|
+
if (i$22(n)) return {
|
|
5621
5685
|
type: "literal",
|
|
5622
5686
|
value: this.scanNumber()
|
|
5623
5687
|
};
|
|
@@ -5660,12 +5724,12 @@ var s$16 = class extends o$20 {
|
|
|
5660
5724
|
};
|
|
5661
5725
|
//#endregion
|
|
5662
5726
|
//#region ../sdk-shared/dist/helpers/twigWrapper/Parser/helpers.mjs
|
|
5663
|
-
var n$
|
|
5727
|
+
var n$25 = (e) => {
|
|
5664
5728
|
let n = 0;
|
|
5665
|
-
for (; n < e.length && !a$
|
|
5729
|
+
for (; n < e.length && !a$18(e.charCodeAt(n));) n++;
|
|
5666
5730
|
return e.slice(0, n);
|
|
5667
5731
|
};
|
|
5668
|
-
var r$
|
|
5732
|
+
var r$24 = (t) => {
|
|
5669
5733
|
let n = 0;
|
|
5670
5734
|
for (let r = 0; r + 1 < t.length; r++) {
|
|
5671
5735
|
let i = t.charCodeAt(r);
|
|
@@ -5677,13 +5741,13 @@ var r$22 = (t) => {
|
|
|
5677
5741
|
};
|
|
5678
5742
|
//#endregion
|
|
5679
5743
|
//#region ../sdk-shared/dist/helpers/twigWrapper/Parser/Parser.mjs
|
|
5680
|
-
var c$
|
|
5744
|
+
var c$14 = (e, t = !1, n) => {
|
|
5681
5745
|
let r = new f$7(e, t, n), i = r.parseBody();
|
|
5682
5746
|
if (!r.error) {
|
|
5683
5747
|
let e = r.peek();
|
|
5684
5748
|
if (e && e.type === "tag") {
|
|
5685
|
-
let t = n$
|
|
5686
|
-
l$
|
|
5749
|
+
let t = n$25(e.content.trim());
|
|
5750
|
+
l$10.has(t) && (r.error = `Orphan closing tag: {% ${t} %} without matching opening tag`);
|
|
5687
5751
|
}
|
|
5688
5752
|
}
|
|
5689
5753
|
return {
|
|
@@ -5691,7 +5755,7 @@ var c$13 = (e, t = !1, n) => {
|
|
|
5691
5755
|
error: r.error
|
|
5692
5756
|
};
|
|
5693
5757
|
};
|
|
5694
|
-
var l$
|
|
5758
|
+
var l$10 = /* @__PURE__ */ new Set([
|
|
5695
5759
|
"endif",
|
|
5696
5760
|
"endfor",
|
|
5697
5761
|
"endset",
|
|
@@ -5746,7 +5810,7 @@ var f$7 = class {
|
|
|
5746
5810
|
let e = [];
|
|
5747
5811
|
for (; this.pos < this.tokens.length;) {
|
|
5748
5812
|
let t = this.peek();
|
|
5749
|
-
if (!t || t.type === "tag" && l$
|
|
5813
|
+
if (!t || t.type === "tag" && l$10.has(n$25(t.content.trim()))) break;
|
|
5750
5814
|
let n = this.parseNode();
|
|
5751
5815
|
n && e.push(n);
|
|
5752
5816
|
}
|
|
@@ -5771,7 +5835,7 @@ var f$7 = class {
|
|
|
5771
5835
|
source: ""
|
|
5772
5836
|
};
|
|
5773
5837
|
let r = t.content.trim(), i = this.keepEmptyTokens ? e$31(t.content, t.raw) : "";
|
|
5774
|
-
if (o$
|
|
5838
|
+
if (o$22(r)) return {
|
|
5775
5839
|
type: "variable",
|
|
5776
5840
|
raw: t.raw,
|
|
5777
5841
|
expression: {
|
|
@@ -5780,7 +5844,7 @@ var f$7 = class {
|
|
|
5780
5844
|
},
|
|
5781
5845
|
source: i
|
|
5782
5846
|
};
|
|
5783
|
-
let o = r$
|
|
5847
|
+
let o = r$25(r, this.issues);
|
|
5784
5848
|
return {
|
|
5785
5849
|
type: "variable",
|
|
5786
5850
|
raw: t.raw,
|
|
@@ -5791,7 +5855,7 @@ var f$7 = class {
|
|
|
5791
5855
|
parseTag() {
|
|
5792
5856
|
let e = this.peek();
|
|
5793
5857
|
if (!e || e.type !== "tag") return null;
|
|
5794
|
-
let n = n$
|
|
5858
|
+
let n = n$25(e.content.trim());
|
|
5795
5859
|
switch (n) {
|
|
5796
5860
|
case "if": return this.parseIf();
|
|
5797
5861
|
case "for": return this.parseFor();
|
|
@@ -5808,14 +5872,14 @@ var f$7 = class {
|
|
|
5808
5872
|
if (e.type !== "tag") return this.error = "Malformed {% if %} tag", u$8();
|
|
5809
5873
|
let t = e.content.trim(), n = t.indexOf(" ") === -1 ? "" : t.slice(t.indexOf(" ") + 1).trim();
|
|
5810
5874
|
if (!n) return this.error = "Malformed {% if %} tag: missing condition", u$8();
|
|
5811
|
-
let r = r$
|
|
5875
|
+
let r = r$25(n, this.issues), i = this.parseBody(), s = [], c = null, l = !1;
|
|
5812
5876
|
for (; this.peek();) {
|
|
5813
5877
|
let e = this.peek();
|
|
5814
5878
|
if (!e || e.type !== "tag") break;
|
|
5815
|
-
let t = n$
|
|
5879
|
+
let t = n$25(e.content.trim());
|
|
5816
5880
|
if (t === "elseif") {
|
|
5817
5881
|
this.advance();
|
|
5818
|
-
let t = e.content.trim(), r = r$
|
|
5882
|
+
let t = e.content.trim(), r = r$25(t.slice(t.indexOf(" ") + 1).trim(), this.issues), i = this.parseBody();
|
|
5819
5883
|
s.push({
|
|
5820
5884
|
condition: r,
|
|
5821
5885
|
body: i
|
|
@@ -5841,20 +5905,20 @@ var f$7 = class {
|
|
|
5841
5905
|
if (n.type !== "tag") return d$9();
|
|
5842
5906
|
let r = n.content.trim(), i = r.slice(r.indexOf(" ") + 1).trim(), c = /\sin\s/.exec(i);
|
|
5843
5907
|
if (!c) return this.error = "Invalid {% for %} syntax: missing the `in` keyword", d$9();
|
|
5844
|
-
let l = i.slice(0, c.index).trim(), u = i.slice(c.index + c[0].length).trim(), f = r$
|
|
5908
|
+
let l = i.slice(0, c.index).trim(), u = i.slice(c.index + c[0].length).trim(), f = r$24(u), p = f ? {
|
|
5845
5909
|
type: "range",
|
|
5846
|
-
start: r$
|
|
5847
|
-
end: r$
|
|
5848
|
-
} : r$
|
|
5849
|
-
if (!c$
|
|
5850
|
-
if (h !== null && !c$
|
|
5910
|
+
start: r$25(f[0], this.issues),
|
|
5911
|
+
end: r$25(f[1], this.issues)
|
|
5912
|
+
} : r$25(u, this.issues), m = l.indexOf(","), h = m === -1 ? null : l.slice(0, m).trim(), g = m === -1 ? l : l.slice(m + 1).trim();
|
|
5913
|
+
if (!c$15(g)) return this.error = `Invalid {% for %} variable name: "${g}"`, d$9();
|
|
5914
|
+
if (h !== null && !c$15(h)) return this.error = `Invalid {% for %} key variable name: "${h}"`, d$9();
|
|
5851
5915
|
let _ = this.parseBody(), v = null;
|
|
5852
5916
|
if (this.peek()) {
|
|
5853
5917
|
let e = this.peek();
|
|
5854
|
-
e && e.type === "tag" && n$
|
|
5918
|
+
e && e.type === "tag" && n$25(e.content.trim()) === "else" && (this.advance(), v = this.parseBody());
|
|
5855
5919
|
}
|
|
5856
5920
|
let y = this.peek();
|
|
5857
|
-
y && y.type === "tag" && n$
|
|
5921
|
+
y && y.type === "tag" && n$25(y.content.trim()) === "endfor" ? this.advance() : this.error = "Malformed {% for %} block: missing {% endfor %}";
|
|
5858
5922
|
let b = this.keepEmptyTokens ? this.reconstructRange(e, this.pos) : void 0;
|
|
5859
5923
|
return {
|
|
5860
5924
|
type: "for",
|
|
@@ -5868,7 +5932,7 @@ var f$7 = class {
|
|
|
5868
5932
|
}
|
|
5869
5933
|
reconstructRange(e, t) {
|
|
5870
5934
|
let n = "";
|
|
5871
|
-
for (let i = e; i < t; i++) n += t$
|
|
5935
|
+
for (let i = e; i < t; i++) n += t$30(this.tokens[i]);
|
|
5872
5936
|
return n;
|
|
5873
5937
|
}
|
|
5874
5938
|
parseSet() {
|
|
@@ -5894,7 +5958,7 @@ var f$7 = class {
|
|
|
5894
5958
|
return {
|
|
5895
5959
|
type: "set",
|
|
5896
5960
|
name: n.slice(0, r).trim(),
|
|
5897
|
-
value: r$
|
|
5961
|
+
value: r$25(n.slice(r + 1).trim(), this.issues)
|
|
5898
5962
|
};
|
|
5899
5963
|
}
|
|
5900
5964
|
parseApply() {
|
|
@@ -5905,7 +5969,7 @@ var f$7 = class {
|
|
|
5905
5969
|
filters: [],
|
|
5906
5970
|
body: []
|
|
5907
5971
|
};
|
|
5908
|
-
let t = e.content.trim(), r = i$
|
|
5972
|
+
let t = e.content.trim(), r = i$21(t.slice(t.indexOf(" ") + 1).trim(), this.issues), a = this.parseBody(), o = this.peek();
|
|
5909
5973
|
return o && o.type === "tag" && this.advance(), {
|
|
5910
5974
|
type: "apply",
|
|
5911
5975
|
filters: r,
|
|
@@ -5915,13 +5979,13 @@ var f$7 = class {
|
|
|
5915
5979
|
};
|
|
5916
5980
|
//#endregion
|
|
5917
5981
|
//#region ../sdk-shared/dist/helpers/twigWrapper/TemplateCache/TemplateCache.mjs
|
|
5918
|
-
var r$
|
|
5919
|
-
var i$
|
|
5920
|
-
var a$
|
|
5982
|
+
var r$23 = /* @__PURE__ */ new Map();
|
|
5983
|
+
var i$20 = 1024;
|
|
5984
|
+
var a$16 = {
|
|
5921
5985
|
hits: 0,
|
|
5922
5986
|
misses: 0
|
|
5923
5987
|
};
|
|
5924
|
-
var c$
|
|
5988
|
+
var c$13 = (t) => {
|
|
5925
5989
|
let n = !1, r = !0;
|
|
5926
5990
|
for (let i = 0; i < t.length; i++) {
|
|
5927
5991
|
let a = t[i];
|
|
@@ -5929,7 +5993,7 @@ var c$12 = (t) => {
|
|
|
5929
5993
|
n = !0;
|
|
5930
5994
|
break;
|
|
5931
5995
|
}
|
|
5932
|
-
if (a.type === "variable" && !s$
|
|
5996
|
+
if (a.type === "variable" && !s$18(a.content.trim())) {
|
|
5933
5997
|
r = !1;
|
|
5934
5998
|
break;
|
|
5935
5999
|
}
|
|
@@ -5939,24 +6003,24 @@ var c$12 = (t) => {
|
|
|
5939
6003
|
allSimpleOrDotted: r
|
|
5940
6004
|
};
|
|
5941
6005
|
};
|
|
5942
|
-
var l$
|
|
5943
|
-
if (r$
|
|
5944
|
-
let e = r$
|
|
5945
|
-
e !== void 0 && r$
|
|
6006
|
+
var l$9 = () => {
|
|
6007
|
+
if (r$23.size >= i$20) {
|
|
6008
|
+
let e = r$23.keys().next().value;
|
|
6009
|
+
e !== void 0 && r$23.delete(e);
|
|
5946
6010
|
}
|
|
5947
6011
|
};
|
|
5948
6012
|
var u$7 = (e) => {
|
|
5949
6013
|
let r = e$32(e);
|
|
5950
6014
|
if (r.error) return null;
|
|
5951
|
-
let i = r.tokens, { hasTags: a, allSimpleOrDotted: o } = c$
|
|
6015
|
+
let i = r.tokens, { hasTags: a, allSimpleOrDotted: o } = c$13(i), s = a || !o, l = null, u = null;
|
|
5952
6016
|
if (s) {
|
|
5953
|
-
let e = c$
|
|
6017
|
+
let e = c$14(i, !1);
|
|
5954
6018
|
if (e.error) return null;
|
|
5955
6019
|
l = e.nodes;
|
|
5956
|
-
let t = c$
|
|
6020
|
+
let t = c$14(i, !0);
|
|
5957
6021
|
t.error || (u = t.nodes);
|
|
5958
6022
|
} else {
|
|
5959
|
-
let e = c$
|
|
6023
|
+
let e = c$14(i, !0);
|
|
5960
6024
|
e.error || (u = e.nodes);
|
|
5961
6025
|
}
|
|
5962
6026
|
return {
|
|
@@ -5968,17 +6032,17 @@ var u$7 = (e) => {
|
|
|
5968
6032
|
};
|
|
5969
6033
|
};
|
|
5970
6034
|
var d$8 = (e) => {
|
|
5971
|
-
let t = r$
|
|
5972
|
-
if (t) return a$
|
|
5973
|
-
a$
|
|
6035
|
+
let t = r$23.get(e);
|
|
6036
|
+
if (t) return a$16.hits++, t;
|
|
6037
|
+
a$16.misses++;
|
|
5974
6038
|
let n = u$7(e);
|
|
5975
|
-
return n ? (l$
|
|
6039
|
+
return n ? (l$9(), r$23.set(e, n), n) : null;
|
|
5976
6040
|
};
|
|
5977
6041
|
//#endregion
|
|
5978
6042
|
//#region ../sdk-shared/dist/helpers/twigWrapper/templateRoots.mjs
|
|
5979
|
-
var t$
|
|
6043
|
+
var t$29 = (e, n) => {
|
|
5980
6044
|
if (Array.isArray(e)) {
|
|
5981
|
-
for (let r of e) t$
|
|
6045
|
+
for (let r of e) t$29(r, n);
|
|
5982
6046
|
return;
|
|
5983
6047
|
}
|
|
5984
6048
|
if (typeof e == "object" && e) {
|
|
@@ -5987,16 +6051,16 @@ var t$28 = (e, n) => {
|
|
|
5987
6051
|
t.length > 0 && n.add(t.join("."));
|
|
5988
6052
|
return;
|
|
5989
6053
|
}
|
|
5990
|
-
for (let r of Object.values(e)) t$
|
|
6054
|
+
for (let r of Object.values(e)) t$29(r, n);
|
|
5991
6055
|
}
|
|
5992
6056
|
};
|
|
5993
|
-
var n$
|
|
6057
|
+
var n$24 = (n) => {
|
|
5994
6058
|
let r = d$8(n);
|
|
5995
6059
|
if (!r) return [];
|
|
5996
6060
|
let i = /* @__PURE__ */ new Set();
|
|
5997
|
-
return t$
|
|
6061
|
+
return t$29(r.nodes ?? r.nodesWithSource, i), [...i];
|
|
5998
6062
|
};
|
|
5999
|
-
var r$
|
|
6063
|
+
var r$22 = (e) => [...new Set(n$24(e).map((e) => e.split(".")[0]))];
|
|
6000
6064
|
//#endregion
|
|
6001
6065
|
//#region ../sdk-shared/dist/style/styleConstants.mjs
|
|
6002
6066
|
var e$30 = {
|
|
@@ -6014,7 +6078,7 @@ var e$30 = {
|
|
|
6014
6078
|
fonts: [],
|
|
6015
6079
|
cache: ""
|
|
6016
6080
|
};
|
|
6017
|
-
var t$
|
|
6081
|
+
var t$28 = {
|
|
6018
6082
|
DISPLAY: "display",
|
|
6019
6083
|
FLEX_WRAP: "flex-wrap",
|
|
6020
6084
|
FLEX_DIRECTION: "flex-direction",
|
|
@@ -6210,40 +6274,40 @@ var t$27 = {
|
|
|
6210
6274
|
STROKE: "stroke",
|
|
6211
6275
|
STROKE_WIDTH: "stroke-width"
|
|
6212
6276
|
};
|
|
6213
|
-
var n$
|
|
6214
|
-
t$
|
|
6215
|
-
t$
|
|
6216
|
-
t$
|
|
6217
|
-
t$
|
|
6218
|
-
t$
|
|
6219
|
-
t$
|
|
6220
|
-
t$
|
|
6221
|
-
t$
|
|
6222
|
-
t$
|
|
6223
|
-
t$
|
|
6224
|
-
t$
|
|
6225
|
-
t$
|
|
6226
|
-
t$
|
|
6227
|
-
t$
|
|
6228
|
-
t$
|
|
6229
|
-
t$
|
|
6230
|
-
t$
|
|
6231
|
-
t$
|
|
6232
|
-
t$
|
|
6233
|
-
t$
|
|
6234
|
-
t$
|
|
6235
|
-
t$
|
|
6277
|
+
var n$23 = [
|
|
6278
|
+
t$28.FONT_FAMILY,
|
|
6279
|
+
t$28.FONT_SIZE,
|
|
6280
|
+
t$28.FONT_STYLE,
|
|
6281
|
+
t$28.FONT_VARIANT,
|
|
6282
|
+
t$28.FONT_VARIANT_NUMERIC,
|
|
6283
|
+
t$28.FONT_FEATURE_SETTINGS,
|
|
6284
|
+
t$28.FONT_WEIGHT,
|
|
6285
|
+
t$28.COLOR,
|
|
6286
|
+
t$28.LINE_HEIGHT,
|
|
6287
|
+
t$28.LETTER_SPACING,
|
|
6288
|
+
t$28.TEXT_ALIGN,
|
|
6289
|
+
t$28.TEXT_DECORATION,
|
|
6290
|
+
t$28.TEXT_INDENT,
|
|
6291
|
+
t$28.TEXT_SHADOW,
|
|
6292
|
+
t$28.TEXT_TRANSFORM,
|
|
6293
|
+
t$28.TEXT_WRAP,
|
|
6294
|
+
t$28.TEXT_OVERFLOW,
|
|
6295
|
+
t$28.WHITE_SPACE,
|
|
6296
|
+
t$28.DIRECTION,
|
|
6297
|
+
t$28.CURSOR,
|
|
6298
|
+
t$28.LIST_STYLE,
|
|
6299
|
+
t$28.LIST_STYLE_TYPE
|
|
6236
6300
|
];
|
|
6237
|
-
Object.values(t$
|
|
6301
|
+
Object.values(t$28).map((e) => ({
|
|
6238
6302
|
path: e,
|
|
6239
6303
|
label: e
|
|
6240
6304
|
}));
|
|
6241
|
-
t$
|
|
6305
|
+
t$28.DISPLAY, t$28.FLEX_WRAP, t$28.FLEX_DIRECTION, t$28.ALIGN_ITEMS, t$28.JUSTIFY_ITEMS, t$28.JUSTIFY_CONTENT, t$28.ALIGN_CONTENT, t$28.ROW_GAP, t$28.COLUMN_GAP, t$28.GRID_ROW_GAP, t$28.GRID_COLUMN_GAP, t$28.GRID_TEMPLATE_AREAS, t$28.GRID_TEMPLATE_COLUMNS, t$28.GRID_TEMPLATE_ROWS, t$28.GRID_AUTO_FLOW, t$28.GRID_AUTO_ROWS, t$28.GRID_AUTO_COLUMNS, t$28.GRID_ROW_START, t$28.GRID_COLUMN_START, t$28.GRID_ROW_END, t$28.GRID_COLUMN_END, t$28.ALIGN_SELF, t$28.JUSTIFY_SELF, t$28.ORDER, t$28.FLEX_GROW, t$28.FLEX_SHRINK, t$28.FLEX_BASIS, t$28.LIST_STYLE, t$28.LIST_STYLE_TYPE, t$28.LIST_STYLE_POSITION, t$28.LIST_STYLE_IMAGE, t$28.BACKGROUND_COLOR, t$28.BACKGROUND_IMAGE, t$28.BACKGROUND_POSITION, t$28.BACKGROUND_SIZE, t$28.BACKGROUND_CLIP, t$28.BACKGROUND_ORIGIN, t$28.BACKGROUND_REPEAT, t$28.BACKGROUND_ATTACHMENT, t$28.BACKGROUND_BLEND_MODE, t$28.MASK_IMAGE, t$28.MASK_SIZE, t$28.MASK_POSITION, t$28.MASK_REPEAT, t$28.MASK_COMPOSITE, t$28.WEBKIT_MASK_IMAGE, t$28.BORDER_TOP_STYLE, t$28.BORDER_TOP_WIDTH, t$28.BORDER_TOP_COLOR, t$28.BORDER_BOTTOM_STYLE, t$28.BORDER_BOTTOM_WIDTH, t$28.BORDER_BOTTOM_COLOR, t$28.BORDER_LEFT_STYLE, t$28.BORDER_LEFT_WIDTH, t$28.BORDER_LEFT_COLOR, t$28.BORDER_RIGHT_STYLE, t$28.BORDER_RIGHT_WIDTH, t$28.BORDER_RIGHT_COLOR, t$28.BORDER_TOP_LEFT_RADIUS, t$28.BORDER_TOP_RIGHT_RADIUS, t$28.BORDER_BOTTOM_LEFT_RADIUS, t$28.BORDER_BOTTOM_RIGHT_RADIUS, t$28.BORDER_COLLAPSE, t$28.BORDER_SPACING, t$28.TABLE_LAYOUT, t$28.OPACITY, t$28.VISIBILITY, t$28.CURSOR, t$28.TRANSITION, t$28.TRANSITION_PROPERTY, t$28.TRANSITION_DURATION, t$28.TRANSITION_TIMING_FUNCTION, t$28.TRANSITION_DELAY, t$28.TRANSITION_BEHAVIOR, t$28.ANIMATION, t$28.ANIMATION_NAME, t$28.ANIMATION_DURATION, t$28.ANIMATION_TIMING_FUNCTION, t$28.ANIMATION_DELAY, t$28.ANIMATION_ITERATION_COUNT, t$28.ANIMATION_DIRECTION, t$28.ANIMATION_FILL_MODE, t$28.ANIMATION_PLAY_STATE, t$28.ANIMATION_TIMELINE, t$28.ANIMATION_RANGE, t$28.BOX_SHADOW, t$28.FILTER, t$28.BACKDROP_FILTER, t$28.MIX_BLEND_MODE, t$28.ISOLATION, t$28.CLIP_PATH, t$28.TRANSFORM, t$28.TRANSFORM_ORIGIN, t$28.TRANSLATE, t$28.ROTATE, t$28.SCALE, t$28.TRANSFORM_STYLE, t$28.PERSPECTIVE, t$28.PERSPECTIVE_ORIGIN, t$28.BACKFACE_VISIBILITY, t$28.WILL_CHANGE, t$28.OUTLINE_WIDTH, t$28.OUTLINE_STYLE, t$28.OUTLINE_COLOR, t$28.OUTLINE_OFFSET, t$28.POINTER_EVENTS, t$28.USER_SELECT, t$28.TOUCH_ACTION, t$28.RESIZE, t$28.APPEARANCE, t$28.SCROLL_BEHAVIOR, t$28.OVERSCROLL_BEHAVIOR, t$28.SCROLL_SNAP_TYPE, t$28.SCROLL_SNAP_ALIGN, t$28.SCROLL_SNAP_STOP, t$28.SCROLL_PADDING_TOP, t$28.SCROLL_MARGIN_TOP, t$28.ACCENT_COLOR, t$28.CARET_COLOR, t$28.COLOR_SCHEME, t$28.POSITION, t$28.FLOAT, t$28.CLEAR, t$28.Z_INDEX, t$28.TOP, t$28.BOTTOM, t$28.LEFT, t$28.RIGHT, t$28.BOX_SIZING, t$28.ASPECT_RATIO, t$28.WIDTH, t$28.HEIGHT, t$28.MIN_WIDTH, t$28.MIN_HEIGHT, t$28.MAX_WIDTH, t$28.MAX_HEIGHT, t$28.OVERFLOW, t$28.OVERFLOW_X, t$28.OVERFLOW_Y, t$28.SCROLLBAR_WIDTH, t$28.SCROLLBAR_COLOR, t$28.CONTAINER_TYPE, t$28.CONTAINER_NAME, t$28.OBJECT_FIT, t$28.OBJECT_POSITION, t$28.COLUMN_WIDTH, t$28.COLUMN_COUNT, t$28.MARGIN_TOP, t$28.MARGIN_BOTTOM, t$28.MARGIN_LEFT, t$28.MARGIN_RIGHT, t$28.PADDING_TOP, t$28.PADDING_BOTTOM, t$28.PADDING_LEFT, t$28.PADDING_RIGHT, t$28.FONT_FAMILY, t$28.FONT_WEIGHT, t$28.FONT_SIZE, t$28.LINE_HEIGHT, t$28.COLOR, t$28.TEXT_ALIGN, t$28.FONT_STYLE, t$28.FONT_VARIANT, t$28.FONT_VARIANT_NUMERIC, t$28.FONT_FEATURE_SETTINGS, t$28.TEXT_DECORATION, t$28.TEXT_DECORATION_LINE, t$28.TEXT_DECORATION_COLOR, t$28.TEXT_DECORATION_STYLE, t$28.TEXT_DECORATION_THICKNESS, t$28.TEXT_UNDERLINE_OFFSET, t$28.LETTER_SPACING, t$28.WORD_SPACING, t$28.TEXT_INDENT, t$28.TEXT_TRANSFORM, t$28.DIRECTION, t$28.WHITE_SPACE, t$28.TEXT_WRAP, t$28.WORD_BREAK, t$28.OVERFLOW_WRAP, t$28.HYPHENS, t$28.VERTICAL_ALIGN, t$28.TEXT_OVERFLOW, t$28.TEXT_SHADOW, t$28.LINE_CLAMP, t$28.WEBKIT_LINE_CLAMP, t$28.WEBKIT_BOX_ORIENT, t$28.WEBKIT_TEXT_FILL_COLOR, t$28.WEBKIT_BACKGROUND_CLIP, t$28.BOX_DECORATION_BREAK, t$28.WEBKIT_BOX_DECORATION_BREAK, t$28.FILL, t$28.STROKE, t$28.STROKE_WIDTH;
|
|
6242
6306
|
//#endregion
|
|
6243
6307
|
//#region ../sdk-shared/dist/schema/schemaConstants.mjs
|
|
6244
|
-
var t$
|
|
6245
|
-
var n$
|
|
6246
|
-
var r$
|
|
6308
|
+
var t$27 = /var\(\s*--([a-zA-Z0-9_-]+)\s*\)|\{\{\s*([a-zA-Z0-9_-]+)\s*\}\}/;
|
|
6309
|
+
var n$22 = "props";
|
|
6310
|
+
var r$20 = {
|
|
6247
6311
|
schema: {
|
|
6248
6312
|
definition: {
|
|
6249
6313
|
name: "",
|
|
@@ -6279,7 +6343,7 @@ var r$18 = {
|
|
|
6279
6343
|
*/
|
|
6280
6344
|
var GLOBAL_SOURCES = e$34;
|
|
6281
6345
|
/** What an element inside a component can read besides its own tree: the globals, and what its instance hands in. */
|
|
6282
|
-
var COMPONENT_SOURCES = [...GLOBAL_SOURCES, n$
|
|
6346
|
+
var COMPONENT_SOURCES = [...GLOBAL_SOURCES, n$22];
|
|
6283
6347
|
/**
|
|
6284
6348
|
* Turns what an author wrote into the name the runtime resolves.
|
|
6285
6349
|
*
|
|
@@ -6298,7 +6362,7 @@ var resolveSource = (source, index, where, globals = GLOBAL_SOURCES) => {
|
|
|
6298
6362
|
if (globals.includes(head)) return source;
|
|
6299
6363
|
const prefix = index.get(head);
|
|
6300
6364
|
if (!prefix) {
|
|
6301
|
-
const inComponent = globals.includes(n$
|
|
6365
|
+
const inComponent = globals.includes(n$22);
|
|
6302
6366
|
throw new AuthoringError("binding-source-unknown", `${where} binds to "${source}", but nothing ${inComponent ? "in this component" : "in this space"} answers to "${head}"${didYouMean(head, [...index.keys(), ...globals]) || "."} A source names an element by its id, or one of the globals: ${globals.join(", ")}.${inComponent ? " A component is closed: what it needs from where it is placed comes in as a prop." : ""}`);
|
|
6303
6367
|
}
|
|
6304
6368
|
return field ? `${prefix}_${head}.${field}` : `${prefix}_${head}`;
|
|
@@ -6462,7 +6526,7 @@ var activeOn = (cls, pages, options = {}) => {
|
|
|
6462
6526
|
* one only has to be one of them.
|
|
6463
6527
|
*/
|
|
6464
6528
|
var conditionSource = (template) => {
|
|
6465
|
-
const roots = r$
|
|
6529
|
+
const roots = r$22(template);
|
|
6466
6530
|
const global = roots.find((root) => GLOBAL_SOURCES.includes(root));
|
|
6467
6531
|
if (global) return global;
|
|
6468
6532
|
const element = roots.find((root) => root.includes("_"));
|
|
@@ -6506,7 +6570,7 @@ var MAIN_ATTRIBUTES = {
|
|
|
6506
6570
|
//#endregion
|
|
6507
6571
|
//#region src/schema/writtenAt.ts
|
|
6508
6572
|
/**
|
|
6509
|
-
* Where in the author's own code an element was written — `src/
|
|
6573
|
+
* Where in the author's own code an element was written — `src/space/layout.ts:417` — for a refusal to point at.
|
|
6510
6574
|
*
|
|
6511
6575
|
* A factory (`container(…)`, `text(…)`) keeps an `Error` on the spec it returns, under a symbol nothing enumerates: it
|
|
6512
6576
|
* does not travel with the spec through a spread, a clone or `JSON.stringify`, and the stack it carries is only
|
|
@@ -6878,30 +6942,30 @@ var video = defineElement(B.Video);
|
|
|
6878
6942
|
//#endregion
|
|
6879
6943
|
//#region ../sdk-schema/dist/helpers/elementId.mjs
|
|
6880
6944
|
var e$29 = /^[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/;
|
|
6881
|
-
var t$
|
|
6882
|
-
var r$
|
|
6883
|
-
var i$
|
|
6884
|
-
var a$
|
|
6945
|
+
var t$26 = (t) => e$29.test(t);
|
|
6946
|
+
var r$19 = (e) => new Set(Object.keys(e));
|
|
6947
|
+
var i$18 = (e, n, r) => t$26(n) ? e[n] && n !== r ? `"${n}" is already used by another element here` : null : `"${n}" is not a valid name: start with a letter, then letters, numbers, hyphens and underscores`;
|
|
6948
|
+
var a$15 = (e, t) => {
|
|
6885
6949
|
let n = /* @__PURE__ */ new Set();
|
|
6886
6950
|
for (let r of t) {
|
|
6887
|
-
if (n.has(r.id) || i$
|
|
6951
|
+
if (n.has(r.id) || i$18(e, r.id)) return !1;
|
|
6888
6952
|
n.add(r.id);
|
|
6889
6953
|
}
|
|
6890
6954
|
return !0;
|
|
6891
6955
|
};
|
|
6892
|
-
var o$
|
|
6893
|
-
var s$
|
|
6894
|
-
var c$
|
|
6895
|
-
let n = o$
|
|
6956
|
+
var o$19 = (e) => e.replace(/[^A-Za-z0-9]/g, "") || "element";
|
|
6957
|
+
var s$16 = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
6958
|
+
var c$12 = (e, t) => {
|
|
6959
|
+
let n = o$19(e);
|
|
6896
6960
|
for (let e = 0; e < 100; e += 1) {
|
|
6897
6961
|
let e = "";
|
|
6898
|
-
for (let t = 0; t < 4; t += 1) e += s$
|
|
6962
|
+
for (let t = 0; t < 4; t += 1) e += s$16[Math.floor(Math.random() * s$16.length)];
|
|
6899
6963
|
if (!t(`${n}-${e}`)) return `${n}-${e}`;
|
|
6900
6964
|
}
|
|
6901
|
-
return l$
|
|
6965
|
+
return l$8(e, t);
|
|
6902
6966
|
};
|
|
6903
|
-
var l$
|
|
6904
|
-
let n = o$
|
|
6967
|
+
var l$8 = (e, t) => {
|
|
6968
|
+
let n = o$19(e), r = 1;
|
|
6905
6969
|
for (; t(`${n}-${r}`);) r += 1;
|
|
6906
6970
|
return `${n}-${r}`;
|
|
6907
6971
|
};
|
|
@@ -7163,7 +7227,7 @@ function assertKnownKeys(value, keys, where, hint = "") {
|
|
|
7163
7227
|
/** Refuses an id nothing can name: empty, or with characters a template or a selector cannot carry. */
|
|
7164
7228
|
var assertId = (id, where) => {
|
|
7165
7229
|
if (id === void 0) return;
|
|
7166
|
-
if (typeof id !== "string" || !t$
|
|
7230
|
+
if (typeof id !== "string" || !t$26(id)) throw new AuthoringError("id-invalid", `${where}: the id ${JSON.stringify(id)} is not one a binding, a template or a test can name. Use a letter first, then letters, digits, "-" and "_" — like "hero-title".`);
|
|
7167
7231
|
};
|
|
7168
7232
|
/**
|
|
7169
7233
|
* A binding's own shape: the two fields it cannot be written without, and no field it ignores. What the binding
|
|
@@ -7200,14 +7264,14 @@ var paramIssue = (params, spec, where) => {
|
|
|
7200
7264
|
//#endregion
|
|
7201
7265
|
//#region ../sdk-schema/dist/helpers/elementTree.mjs
|
|
7202
7266
|
var e$27 = (e, t) => t && Object.hasOwn(e, t) ? e[t] : void 0;
|
|
7203
|
-
var t$
|
|
7267
|
+
var t$25 = (t, n) => {
|
|
7204
7268
|
let r = [], i = /* @__PURE__ */ new Set([n]);
|
|
7205
7269
|
for (let a = e$27(t, e$27(t, n)?.definition.parentId); a && !i.has(a.id);) i.add(a.id), r.push(a.id), a = e$27(t, a.definition.parentId);
|
|
7206
7270
|
return r;
|
|
7207
7271
|
};
|
|
7208
|
-
var n$
|
|
7272
|
+
var n$21 = (n, r) => {
|
|
7209
7273
|
let i = [], a = /* @__PURE__ */ new Set([r]), o = (s) => {
|
|
7210
|
-
for (let c of [s, ...t$
|
|
7274
|
+
for (let c of [s, ...t$25(n, s)]) {
|
|
7211
7275
|
let t = e$27(n, c);
|
|
7212
7276
|
if (c !== s || s !== r) {
|
|
7213
7277
|
if (a.has(c)) continue;
|
|
@@ -7219,7 +7283,7 @@ var n$20 = (n, r) => {
|
|
|
7219
7283
|
};
|
|
7220
7284
|
return o(r), i;
|
|
7221
7285
|
};
|
|
7222
|
-
var r$
|
|
7286
|
+
var r$18 = (t, n) => {
|
|
7223
7287
|
let r = [], i = /* @__PURE__ */ new Set([n]), a = (n) => {
|
|
7224
7288
|
for (let o of e$27(t, n)?.definition.items ?? []) !i.has(o) && e$27(t, o) && (i.add(o), r.push(o), a(o));
|
|
7225
7289
|
};
|
|
@@ -7232,7 +7296,7 @@ var e$26 = {
|
|
|
7232
7296
|
tablet: 768,
|
|
7233
7297
|
mobile: 0
|
|
7234
7298
|
};
|
|
7235
|
-
var t$
|
|
7299
|
+
var t$24 = (t) => e$26[t] === 0 ? "0" : `${String(e$26[t] / 16)}rem`;
|
|
7236
7300
|
//#endregion
|
|
7237
7301
|
//#region ../sdk-shared/dist/style/displayModes.mjs
|
|
7238
7302
|
var e$25 = [
|
|
@@ -7240,10 +7304,10 @@ var e$25 = [
|
|
|
7240
7304
|
"tablet",
|
|
7241
7305
|
"mobile"
|
|
7242
7306
|
];
|
|
7243
|
-
var t$
|
|
7307
|
+
var t$23 = (t) => e$25.some((e) => e === t);
|
|
7244
7308
|
//#endregion
|
|
7245
7309
|
//#region ../sdk-shared/dist/style/fonts.mjs
|
|
7246
|
-
var i$
|
|
7310
|
+
var i$17 = (e) => {
|
|
7247
7311
|
try {
|
|
7248
7312
|
let t = new URL(e);
|
|
7249
7313
|
return t.protocol === "https:" && !t.username && !t.password;
|
|
@@ -7253,77 +7317,77 @@ var i$16 = (e) => {
|
|
|
7253
7317
|
};
|
|
7254
7318
|
//#endregion
|
|
7255
7319
|
//#region ../sdk-shared/dist/style/fontValidation.mjs
|
|
7256
|
-
var n$
|
|
7320
|
+
var n$20 = /* @__PURE__ */ new Set([
|
|
7257
7321
|
"system",
|
|
7258
7322
|
"google",
|
|
7259
7323
|
"remote",
|
|
7260
7324
|
"hosted"
|
|
7261
7325
|
]);
|
|
7262
|
-
var r$
|
|
7326
|
+
var r$17 = /* @__PURE__ */ new Set([
|
|
7263
7327
|
"auto",
|
|
7264
7328
|
"block",
|
|
7265
7329
|
"swap",
|
|
7266
7330
|
"fallback",
|
|
7267
7331
|
"optional"
|
|
7268
7332
|
]);
|
|
7269
|
-
var i$
|
|
7270
|
-
var a$
|
|
7271
|
-
var o$
|
|
7333
|
+
var i$16 = /* @__PURE__ */ new Set(["woff2", "woff"]);
|
|
7334
|
+
var a$14 = 100;
|
|
7335
|
+
var o$18 = (e) => {
|
|
7272
7336
|
for (let t = 0; t < e.length; t += 1) {
|
|
7273
7337
|
let n = e.charCodeAt(t);
|
|
7274
7338
|
if (n < 32 || n === 127) return !0;
|
|
7275
7339
|
}
|
|
7276
7340
|
return !1;
|
|
7277
7341
|
};
|
|
7278
|
-
var s$
|
|
7279
|
-
var c$
|
|
7280
|
-
throw new s$
|
|
7342
|
+
var s$15 = class extends Error {};
|
|
7343
|
+
var c$11 = (e) => {
|
|
7344
|
+
throw new s$15(e);
|
|
7281
7345
|
};
|
|
7282
|
-
var l$
|
|
7283
|
-
if (typeof e != "string") return c$
|
|
7346
|
+
var l$7 = (e) => {
|
|
7347
|
+
if (typeof e != "string") return c$11("font.family must be a string");
|
|
7284
7348
|
let t = e.trim();
|
|
7285
|
-
return t ? t.length > a$
|
|
7349
|
+
return t ? t.length > a$14 ? c$11(`font.family cannot be longer than ${a$14} characters`) : o$18(t) ? c$11("font.family cannot contain control characters") : t : c$11("font.family cannot be empty");
|
|
7286
7350
|
};
|
|
7287
7351
|
var u$5 = (e) => {
|
|
7288
7352
|
if (e === void 0) return [400];
|
|
7289
|
-
if (!Array.isArray(e) || e.length === 0) return c$
|
|
7290
|
-
let t = e.map((e) => typeof e != "number" || !Number.isInteger(e) || e < 1 || e > 1e3 ? c$
|
|
7353
|
+
if (!Array.isArray(e) || e.length === 0) return c$11("font.weights must be a non-empty list of numbers");
|
|
7354
|
+
let t = e.map((e) => typeof e != "number" || !Number.isInteger(e) || e < 1 || e > 1e3 ? c$11("font.weights must hold whole numbers between 1 and 1000") : e);
|
|
7291
7355
|
return [...new Set(t)].sort((e, t) => e - t);
|
|
7292
7356
|
};
|
|
7293
7357
|
var d$6 = (e) => {
|
|
7294
7358
|
if (e === void 0) return ["normal"];
|
|
7295
|
-
if (!Array.isArray(e) || e.length === 0) return c$
|
|
7296
|
-
let t = e.map((e) => e !== "normal" && e !== "italic" ? c$
|
|
7359
|
+
if (!Array.isArray(e) || e.length === 0) return c$11("font.styles must be a non-empty list");
|
|
7360
|
+
let t = e.map((e) => e !== "normal" && e !== "italic" ? c$11("font.styles may only hold \"normal\" or \"italic\"") : e);
|
|
7297
7361
|
return [...new Set(t)];
|
|
7298
7362
|
};
|
|
7299
7363
|
var f$5 = (t, n) => {
|
|
7300
|
-
if (!e$28(t)) return c$
|
|
7364
|
+
if (!e$28(t)) return c$11(`font.files[${n}] must be an object`);
|
|
7301
7365
|
let { weight: r, style: a, format: o, unicodeRange: s } = t;
|
|
7302
|
-
if (typeof r != "number" || !Number.isInteger(r) || r < 1 || r > 1e3) return c$
|
|
7303
|
-
if (a !== "normal" && a !== "italic") return c$
|
|
7304
|
-
if (typeof o != "string" || !i$
|
|
7366
|
+
if (typeof r != "number" || !Number.isInteger(r) || r < 1 || r > 1e3) return c$11(`font.files[${n}].weight must be a whole number between 1 and 1000`);
|
|
7367
|
+
if (a !== "normal" && a !== "italic") return c$11(`font.files[${n}].style must be "normal" or "italic"`);
|
|
7368
|
+
if (typeof o != "string" || !i$16.has(o)) return c$11(`font.files[${n}].format must be "woff2" or "woff"`);
|
|
7305
7369
|
let l = {
|
|
7306
7370
|
weight: r,
|
|
7307
7371
|
style: a,
|
|
7308
7372
|
format: o
|
|
7309
7373
|
};
|
|
7310
7374
|
if (s !== void 0) {
|
|
7311
|
-
if (typeof s != "string") return c$
|
|
7375
|
+
if (typeof s != "string") return c$11(`font.files[${n}].unicodeRange must be a string`);
|
|
7312
7376
|
l.unicodeRange = s;
|
|
7313
7377
|
}
|
|
7314
7378
|
return l;
|
|
7315
7379
|
};
|
|
7316
|
-
var p$5 = (e, t) => typeof e != "string" || !e ? c$
|
|
7317
|
-
var m$4 = (e) => !Array.isArray(e) || e.length === 0 ? c$
|
|
7380
|
+
var p$5 = (e, t) => typeof e != "string" || !e ? c$11(`font.files[${t}].path must be a non-empty string`) : e.includes("://") || e.startsWith("/") ? c$11(`font.files[${t}].path must be relative to the font store, not a URL`) : e.split("/").includes("..") ? c$11(`font.files[${t}].path cannot climb out of the font store`) : e;
|
|
7381
|
+
var m$4 = (e) => !Array.isArray(e) || e.length === 0 ? c$11("font.files must be a non-empty list") : e;
|
|
7318
7382
|
var h$3 = (i) => {
|
|
7319
|
-
if (!e$28(i)) return c$
|
|
7383
|
+
if (!e$28(i)) return c$11("a font must be an object");
|
|
7320
7384
|
let { source: a, fallback: o, display: s, preload: h } = i;
|
|
7321
|
-
if (typeof a != "string" || !n$
|
|
7322
|
-
if (typeof o != "string" || !o.trim()) return c$
|
|
7323
|
-
if (s !== void 0 && (typeof s != "string" || !r$
|
|
7324
|
-
if (h !== void 0 && typeof h != "boolean") return c$
|
|
7385
|
+
if (typeof a != "string" || !n$20.has(a)) return c$11("font.source must be one of: system, google, remote, hosted");
|
|
7386
|
+
if (typeof o != "string" || !o.trim()) return c$11("font.fallback is required: it is what renders until the face arrives");
|
|
7387
|
+
if (s !== void 0 && (typeof s != "string" || !r$17.has(s))) return c$11("font.display must be one of: auto, block, swap, fallback, optional");
|
|
7388
|
+
if (h !== void 0 && typeof h != "boolean") return c$11("font.preload must be a boolean");
|
|
7325
7389
|
let g = {
|
|
7326
|
-
family: l$
|
|
7390
|
+
family: l$7(i.family),
|
|
7327
7391
|
fallback: o.trim(),
|
|
7328
7392
|
weights: u$5(i.weights),
|
|
7329
7393
|
styles: d$6(i.styles),
|
|
@@ -7336,7 +7400,7 @@ var h$3 = (i) => {
|
|
|
7336
7400
|
};
|
|
7337
7401
|
if (a === "google") {
|
|
7338
7402
|
let { subsets: e } = i;
|
|
7339
|
-
return e !== void 0 && (!Array.isArray(e) || e.some((e) => typeof e != "string")) ? c$
|
|
7403
|
+
return e !== void 0 && (!Array.isArray(e) || e.some((e) => typeof e != "string")) ? c$11("font.subsets must be a list of strings") : {
|
|
7340
7404
|
...g,
|
|
7341
7405
|
source: "google",
|
|
7342
7406
|
...e === void 0 ? {} : { subsets: e }
|
|
@@ -7344,17 +7408,17 @@ var h$3 = (i) => {
|
|
|
7344
7408
|
}
|
|
7345
7409
|
if (a === "remote") {
|
|
7346
7410
|
let { stylesheet: e, files: n } = i;
|
|
7347
|
-
return e === void 0 && n === void 0 ? c$
|
|
7411
|
+
return e === void 0 && n === void 0 ? c$11("a remote font needs either a stylesheet URL or the font files themselves") : e === void 0 ? {
|
|
7348
7412
|
...g,
|
|
7349
7413
|
source: "remote",
|
|
7350
7414
|
files: m$4(n).map((e, n) => {
|
|
7351
7415
|
let r = f$5(e, n), { url: i } = e;
|
|
7352
|
-
return typeof i != "string" || !i$
|
|
7416
|
+
return typeof i != "string" || !i$17(i) ? c$11(`font.files[${n}].url must be an https URL with no credentials in it`) : {
|
|
7353
7417
|
...r,
|
|
7354
7418
|
url: i
|
|
7355
7419
|
};
|
|
7356
7420
|
})
|
|
7357
|
-
} : typeof e != "string" || !i$
|
|
7421
|
+
} : typeof e != "string" || !i$17(e) ? c$11("font.stylesheet must be an https URL with no credentials in it") : {
|
|
7358
7422
|
...g,
|
|
7359
7423
|
source: "remote",
|
|
7360
7424
|
stylesheet: e
|
|
@@ -7374,8 +7438,8 @@ var h$3 = (i) => {
|
|
|
7374
7438
|
var e$24 = /* @__PURE__ */ function(e) {
|
|
7375
7439
|
return e.COLOR = "color", e.SPACING = "spacing", e.SHADOW = "shadow", e.CUSTOM = "custom", e;
|
|
7376
7440
|
}({});
|
|
7377
|
-
var t$
|
|
7378
|
-
var n$
|
|
7441
|
+
var t$22 = Object.values(e$24);
|
|
7442
|
+
var n$19 = (e) => typeof e == "string" && t$22.includes(e);
|
|
7379
7443
|
//#endregion
|
|
7380
7444
|
//#region ../sdk-shared/dist/style/styleStates.mjs
|
|
7381
7445
|
var e$23 = [
|
|
@@ -7390,8 +7454,8 @@ var e$23 = [
|
|
|
7390
7454
|
"current",
|
|
7391
7455
|
"hidden"
|
|
7392
7456
|
];
|
|
7393
|
-
var t$
|
|
7394
|
-
var r$
|
|
7457
|
+
var t$21 = "plitzi-component--hidden";
|
|
7458
|
+
var r$16 = {
|
|
7395
7459
|
visited: 0,
|
|
7396
7460
|
checked: 1,
|
|
7397
7461
|
current: 2,
|
|
@@ -7403,12 +7467,12 @@ var r$14 = {
|
|
|
7403
7467
|
disabled: 8,
|
|
7404
7468
|
hidden: 9
|
|
7405
7469
|
};
|
|
7406
|
-
var i$
|
|
7407
|
-
var a$
|
|
7408
|
-
var o$
|
|
7409
|
-
var s$
|
|
7410
|
-
var c$
|
|
7411
|
-
var l$
|
|
7470
|
+
var i$15 = (e) => Object.hasOwn(r$16, e);
|
|
7471
|
+
var a$13 = (t) => i$15(t) ? r$16[t] : e$23.length;
|
|
7472
|
+
var o$17 = (e) => Object.entries(e).sort(([e], [t]) => a$13(e) - a$13(t));
|
|
7473
|
+
var s$14 = "[aria-current=\"page\"]";
|
|
7474
|
+
var c$10 = (e) => e === "hidden" ? `.${t$21}` : e === "current" ? s$14 : `:${e}`;
|
|
7475
|
+
var l$6 = (e) => e === "hidden";
|
|
7412
7476
|
//#endregion
|
|
7413
7477
|
//#region ../../node_modules/@plitzi/plitzi-ui/dist/helpers/lodash/shared.js
|
|
7414
7478
|
function e$22(e) {
|
|
@@ -7418,7 +7482,7 @@ function e$22(e) {
|
|
|
7418
7482
|
}
|
|
7419
7483
|
return null;
|
|
7420
7484
|
}
|
|
7421
|
-
function t$
|
|
7485
|
+
function t$20(t, n) {
|
|
7422
7486
|
if (!t || t.startsWith(".") || t.endsWith(".") || /[^a-zA-Z0-9_.[\]-]/.test(t) || n && (/\.\.|(\[\])/g.test(t) || (t.match(/\[/g) || []).length !== (t.match(/\]/g) || []).length || /\][^.[]/.test(t))) return [];
|
|
7423
7487
|
let r = [], i = /([^.[\]]+)|\[(\d+)\]/g, a;
|
|
7424
7488
|
for (; a = i.exec(t);) if (a[1]) {
|
|
@@ -7433,7 +7497,7 @@ function t$19(t, n) {
|
|
|
7433
7497
|
}
|
|
7434
7498
|
return r.length ? r : [];
|
|
7435
7499
|
}
|
|
7436
|
-
function n$
|
|
7500
|
+
function n$18(t, n) {
|
|
7437
7501
|
if (!Array.isArray(t)) return [];
|
|
7438
7502
|
let r = [];
|
|
7439
7503
|
for (let i of t) {
|
|
@@ -7443,14 +7507,14 @@ function n$17(t, n) {
|
|
|
7443
7507
|
}
|
|
7444
7508
|
return r;
|
|
7445
7509
|
}
|
|
7446
|
-
function r$
|
|
7447
|
-
return e ? typeof e == "string" ? t$
|
|
7510
|
+
function r$15(e, r = !0) {
|
|
7511
|
+
return e ? typeof e == "string" ? t$20(e, r) : Array.isArray(e) ? n$18(e, r) : [] : [];
|
|
7448
7512
|
}
|
|
7449
7513
|
//#endregion
|
|
7450
7514
|
//#region ../../node_modules/@plitzi/plitzi-ui/dist/helpers/lodash/get.js
|
|
7451
|
-
function t$
|
|
7515
|
+
function t$19(t, n, r) {
|
|
7452
7516
|
if (t == null || !n) return r;
|
|
7453
|
-
let i = r$
|
|
7517
|
+
let i = r$15(n);
|
|
7454
7518
|
if (!i.length) return r;
|
|
7455
7519
|
let a = t;
|
|
7456
7520
|
for (let e of i) {
|
|
@@ -7464,8 +7528,8 @@ function t$18(t, n, r) {
|
|
|
7464
7528
|
}
|
|
7465
7529
|
//#endregion
|
|
7466
7530
|
//#region ../../node_modules/@plitzi/plitzi-ui/dist/helpers/lodash/set.js
|
|
7467
|
-
function t$
|
|
7468
|
-
let i = r$
|
|
7531
|
+
function t$18(t, n, r) {
|
|
7532
|
+
let i = r$15(n);
|
|
7469
7533
|
if (!i.length) return t;
|
|
7470
7534
|
let a = t;
|
|
7471
7535
|
for (let e = 0; e < i.length - 1; e++) {
|
|
@@ -7483,17 +7547,17 @@ function t$17(t, n, r) {
|
|
|
7483
7547
|
}
|
|
7484
7548
|
//#endregion
|
|
7485
7549
|
//#region ../../node_modules/@plitzi/plitzi-ui/dist/helpers/lodash/pick.js
|
|
7486
|
-
function n$
|
|
7550
|
+
function n$17(n, r) {
|
|
7487
7551
|
let i = {}, a = Array.isArray(r) ? r : [r];
|
|
7488
7552
|
for (let r of a) {
|
|
7489
|
-
let a = t$
|
|
7490
|
-
a !== void 0 && t$
|
|
7553
|
+
let a = t$19(n, r);
|
|
7554
|
+
a !== void 0 && t$18(i, r, a);
|
|
7491
7555
|
}
|
|
7492
7556
|
return i;
|
|
7493
7557
|
}
|
|
7494
7558
|
//#endregion
|
|
7495
7559
|
//#region ../sdk-style/dist/helpers/calculateInheriting.mjs
|
|
7496
|
-
var r$
|
|
7560
|
+
var r$14 = (e, t) => {
|
|
7497
7561
|
let n = [], r = t;
|
|
7498
7562
|
for (; r;) {
|
|
7499
7563
|
n.push(r);
|
|
@@ -7502,7 +7566,7 @@ var r$12 = (e, t) => {
|
|
|
7502
7566
|
}
|
|
7503
7567
|
return n;
|
|
7504
7568
|
};
|
|
7505
|
-
var i$
|
|
7569
|
+
var i$14 = (e, t, n, r, i) => {
|
|
7506
7570
|
let a = [], o = /* @__PURE__ */ new Set(), { definition: { styleSelectors: s, type: c }, attributes: { subType: l } } = e, u = (s[r] || "").split(" ").filter(Boolean);
|
|
7507
7571
|
for (let e of [...u, ...i]) {
|
|
7508
7572
|
if (o.has(e)) continue;
|
|
@@ -7522,18 +7586,18 @@ var i$13 = (e, t, n, r, i) => {
|
|
|
7522
7586
|
}
|
|
7523
7587
|
return a;
|
|
7524
7588
|
};
|
|
7525
|
-
var a$
|
|
7526
|
-
let a = t$
|
|
7589
|
+
var a$12 = (e, n, r, i) => {
|
|
7590
|
+
let a = t$19(i, `${e}.defaultStyle`, void 0);
|
|
7527
7591
|
if (a) return a.subTypes && !n && (n = Object.keys(a.subTypes)[0]), n && a.subTypes?.[n] && (a = a.subTypes[n]), {
|
|
7528
7592
|
name: "defaultStyle",
|
|
7529
|
-
attributes: { [r]: t$
|
|
7593
|
+
attributes: { [r]: t$19(a, `style.${r}`, {}) },
|
|
7530
7594
|
componentType: e,
|
|
7531
7595
|
isParent: !1,
|
|
7532
7596
|
isAncestor: !1,
|
|
7533
7597
|
isDefault: !0
|
|
7534
7598
|
};
|
|
7535
7599
|
};
|
|
7536
|
-
var o$
|
|
7600
|
+
var o$16 = (e, t, n, r, i) => {
|
|
7537
7601
|
let a = e[t];
|
|
7538
7602
|
if (!a) return {};
|
|
7539
7603
|
let o = a.default ?? {};
|
|
@@ -7554,13 +7618,13 @@ var o$15 = (e, t, n, r, i) => {
|
|
|
7554
7618
|
...l
|
|
7555
7619
|
};
|
|
7556
7620
|
};
|
|
7557
|
-
var s$
|
|
7558
|
-
var c$
|
|
7621
|
+
var s$13 = (e, t, n, r, i) => o$16(e.attributes, t, n, r, i);
|
|
7622
|
+
var c$9 = (t, o, c, l, u = {}, d = {}) => {
|
|
7559
7623
|
let { componentSubType: f, styleSelector: p = "base", styleState: m, styleVariant: h, styleAncestor: g, includeSelf: _ = !1, skipSelectors: v = [], addSelectors: y = [] } = d, b = {
|
|
7560
7624
|
tree: [],
|
|
7561
7625
|
style: {},
|
|
7562
7626
|
parentStyle: {}
|
|
7563
|
-
}, x = t ? r$
|
|
7627
|
+
}, x = t ? r$14(c, t) : [], S = /* @__PURE__ */ new Set();
|
|
7564
7628
|
for (let e of Object.keys(l)) {
|
|
7565
7629
|
let n = l[e];
|
|
7566
7630
|
if (n) {
|
|
@@ -7578,7 +7642,7 @@ var c$8 = (t, o, c, l, u = {}, d = {}) => {
|
|
|
7578
7642
|
continue;
|
|
7579
7643
|
}
|
|
7580
7644
|
if (!t && o) {
|
|
7581
|
-
let t = i$
|
|
7645
|
+
let t = i$14({
|
|
7582
7646
|
definition: {
|
|
7583
7647
|
type: o,
|
|
7584
7648
|
styleSelectors: {},
|
|
@@ -7593,7 +7657,7 @@ var c$8 = (t, o, c, l, u = {}, d = {}) => {
|
|
|
7593
7657
|
isParent: !1,
|
|
7594
7658
|
isAncestor: !1
|
|
7595
7659
|
});
|
|
7596
|
-
let r = a$
|
|
7660
|
+
let r = a$12(o, f, p, u);
|
|
7597
7661
|
r && b.tree.push({
|
|
7598
7662
|
...r,
|
|
7599
7663
|
displayMode: e
|
|
@@ -7601,7 +7665,7 @@ var c$8 = (t, o, c, l, u = {}, d = {}) => {
|
|
|
7601
7665
|
continue;
|
|
7602
7666
|
}
|
|
7603
7667
|
for (let r of x) {
|
|
7604
|
-
let s = t?.definition.parentId === r.id, c = r.id !== t?.id, l = i$
|
|
7668
|
+
let s = t?.definition.parentId === r.id, c = r.id !== t?.id, l = i$14(r, r.definition.type === o ? o : void 0, n, p, y);
|
|
7605
7669
|
!_ && !c && !m && !h && Object.keys(l).length && (l = l.filter((e) => e.type === "element"));
|
|
7606
7670
|
for (let t of l) (!v.includes(t.name) || c) && b.tree.push({
|
|
7607
7671
|
name: t.name,
|
|
@@ -7612,7 +7676,7 @@ var c$8 = (t, o, c, l, u = {}, d = {}) => {
|
|
|
7612
7676
|
isAncestor: c,
|
|
7613
7677
|
isDefault: !1
|
|
7614
7678
|
});
|
|
7615
|
-
let d = a$
|
|
7679
|
+
let d = a$12(r.definition.type, r.attributes.subType, p, u);
|
|
7616
7680
|
d && !S.has(r.definition.type) && (S.add(r.definition.type), b.tree.push({
|
|
7617
7681
|
...d,
|
|
7618
7682
|
displayMode: e,
|
|
@@ -7624,8 +7688,8 @@ var c$8 = (t, o, c, l, u = {}, d = {}) => {
|
|
|
7624
7688
|
}
|
|
7625
7689
|
let C = {};
|
|
7626
7690
|
for (let t of b.tree) {
|
|
7627
|
-
let r = s$
|
|
7628
|
-
if (r && Object.keys(r).length && ((t.isAncestor || t.isDefault && t.componentType !== o) && (r = n$
|
|
7691
|
+
let r = s$13(t, p, m, h, g);
|
|
7692
|
+
if (r && Object.keys(r).length && ((t.isAncestor || t.isDefault && t.componentType !== o) && (r = n$17(r, n$23)), Object.keys(r).length)) for (let e of Object.keys(r)) C[e] || (C[e] = []), C[e].push({
|
|
7629
7693
|
key: t.name,
|
|
7630
7694
|
value: r[e],
|
|
7631
7695
|
displayMode: t.displayMode
|
|
@@ -7633,7 +7697,7 @@ var c$8 = (t, o, c, l, u = {}, d = {}) => {
|
|
|
7633
7697
|
}
|
|
7634
7698
|
let w = b.tree.filter((e) => e.isParent).reduce((e, t) => ({
|
|
7635
7699
|
...e,
|
|
7636
|
-
...s$
|
|
7700
|
+
...s$13(t, p, m, h, g)
|
|
7637
7701
|
}), {});
|
|
7638
7702
|
return {
|
|
7639
7703
|
...b,
|
|
@@ -7652,10 +7716,10 @@ var d$5 = class {
|
|
|
7652
7716
|
constructor(e = {}) {
|
|
7653
7717
|
let { flat: t, variables: r, pages: i, mintId: a, takenElsewhere: o } = e;
|
|
7654
7718
|
if (!t) throw Error("Flat is required");
|
|
7655
|
-
this.flat = t, this.variables = r ?? [], this.pages = i ?? [], this.mintId = a ?? c$
|
|
7719
|
+
this.flat = t, this.variables = r ?? [], this.pages = i ?? [], this.mintId = a ?? c$12, this.takenElsewhere = o ?? (() => !1);
|
|
7656
7720
|
}
|
|
7657
7721
|
nextId = (e, t = () => !1) => {
|
|
7658
|
-
let n = r$
|
|
7722
|
+
let n = r$19(this.flat);
|
|
7659
7723
|
return this.mintId(e, (e) => n.has(e) || this.takenElsewhere(e) || t(e));
|
|
7660
7724
|
};
|
|
7661
7725
|
addElement = (e, n, r = "inside", i = {}) => {
|
|
@@ -7663,7 +7727,7 @@ var d$5 = class {
|
|
|
7663
7727
|
...e,
|
|
7664
7728
|
id: this.nextId(e.definition.type)
|
|
7665
7729
|
}, o = [a, ...Object.values(i)];
|
|
7666
|
-
if (!this.isValidElement(a) || !a$
|
|
7730
|
+
if (!this.isValidElement(a) || !a$15(this.flat, o) || o.some((e) => this.takenElsewhere(e.id))) return !1;
|
|
7667
7731
|
if (r !== "custom") {
|
|
7668
7732
|
let e = this.placement(n, r, [a.id]);
|
|
7669
7733
|
if (!e) return !1;
|
|
@@ -7687,15 +7751,15 @@ var d$5 = class {
|
|
|
7687
7751
|
});
|
|
7688
7752
|
};
|
|
7689
7753
|
updateElement = (e) => !e || !this.flat[e.id] ? !1 : (this.flat[e.id] = e, !0);
|
|
7690
|
-
renameElement = (t, n) => this.flat[t] ? t === n ? [] : i$
|
|
7754
|
+
renameElement = (t, n) => this.flat[t] ? t === n ? [] : i$18(this.flat, n) || this.takenElsewhere(n) ? !1 : _$2(this.flat, { [t]: n }, this.pages) : !1;
|
|
7691
7755
|
moveElement = (e, t, n, r = "inside") => {
|
|
7692
7756
|
let i = this.flat[e], a = this.flat[n];
|
|
7693
|
-
if (!i || !a || n === t || t$
|
|
7757
|
+
if (!i || !a || n === t || t$25(this.flat, t).includes(n)) return !1;
|
|
7694
7758
|
let o = this.placement(t, r, [n], n);
|
|
7695
7759
|
return o ? (i.definition.items = (i.definition.items ?? []).filter((e) => e !== n), o.parent.definition.items = o.items, a.definition.parentId = o.parent.id, this.carryRoot(n, o.parent.definition.rootId), !0) : !1;
|
|
7696
7760
|
};
|
|
7697
7761
|
carryRoot = (e, t) => {
|
|
7698
|
-
if (this.flat[e].definition.rootId !== t) for (let n of [e, ...r$
|
|
7762
|
+
if (this.flat[e].definition.rootId !== t) for (let n of [e, ...r$18(this.flat, e)]) this.flat[n].definition.rootId = t;
|
|
7699
7763
|
};
|
|
7700
7764
|
cloneElements = (e, t = "", n = "", s = !1) => {
|
|
7701
7765
|
let c = {
|
|
@@ -7703,7 +7767,7 @@ var d$5 = class {
|
|
|
7703
7767
|
item: void 0
|
|
7704
7768
|
}, l = {}, u = this.flat[e];
|
|
7705
7769
|
if (!u) return c;
|
|
7706
|
-
let d = [e, ...r$
|
|
7770
|
+
let d = [e, ...r$18(this.flat, e)], f = r$19(this.flat);
|
|
7707
7771
|
for (let e of d) {
|
|
7708
7772
|
let t = u$6(e, (e) => f.has(e) || this.takenElsewhere(e));
|
|
7709
7773
|
f.add(t), l[e] = t;
|
|
@@ -7720,7 +7784,7 @@ var d$5 = class {
|
|
|
7720
7784
|
removeElement = (e, t = !1) => {
|
|
7721
7785
|
let n = this.flat[e];
|
|
7722
7786
|
if (!n || n.definition.type === "page" && !t || t && n.attributes.default) return !1;
|
|
7723
|
-
for (let t of r$
|
|
7787
|
+
for (let t of r$18(this.flat, e)) delete this.flat[t];
|
|
7724
7788
|
let r = n.definition.parentId ? this.flat[n.definition.parentId] : void 0;
|
|
7725
7789
|
return r?.definition.items && (r.definition.items = r.definition.items.filter((t) => t !== e)), delete this.flat[e], !0;
|
|
7726
7790
|
};
|
|
@@ -7779,7 +7843,7 @@ var d$5 = class {
|
|
|
7779
7843
|
let o = this.cloneElements(t, a.definition.parentId);
|
|
7780
7844
|
return o.item ? (Object.values(o.acum).forEach((t) => {
|
|
7781
7845
|
let { id: n } = t;
|
|
7782
|
-
if (o.item && (t.definition.rootId = o.item.id), c$
|
|
7846
|
+
if (o.item && (t.definition.rootId = o.item.id), c$9(t, t.definition.type, this.flat, e.platform, {}, { includeSelf: !0 }).tree.forEach((t) => {
|
|
7783
7847
|
let { displayMode: n, name: i } = t;
|
|
7784
7848
|
!(i in r.platform[n]) && i in e.platform[n] && (r.platform[n][i] = e.platform[n][i]);
|
|
7785
7849
|
}), this.variables.length > 0) {
|
|
@@ -7802,7 +7866,7 @@ var d$5 = class {
|
|
|
7802
7866
|
getElementVariables = (e, t, n = this.flat, r = this.variables) => {
|
|
7803
7867
|
let i = [], a = n[t]?.definition.styleSelectors;
|
|
7804
7868
|
if (!a) return i;
|
|
7805
|
-
let o = new RegExp(t$
|
|
7869
|
+
let o = new RegExp(t$27, "g");
|
|
7806
7870
|
return Object.values(a).filter(Boolean).forEach((t) => {
|
|
7807
7871
|
Object.values(e.platform).forEach((e) => {
|
|
7808
7872
|
let n = e[t];
|
|
@@ -7837,7 +7901,7 @@ var d$5 = class {
|
|
|
7837
7901
|
};
|
|
7838
7902
|
//#endregion
|
|
7839
7903
|
//#region ../sdk-schema/dist/helpers/components.mjs
|
|
7840
|
-
var o$
|
|
7904
|
+
var o$15 = /* @__PURE__ */ new Set([
|
|
7841
7905
|
"referenceType",
|
|
7842
7906
|
"referenceId",
|
|
7843
7907
|
"slot",
|
|
@@ -7847,20 +7911,20 @@ var o$14 = /* @__PURE__ */ new Set([
|
|
|
7847
7911
|
"ref",
|
|
7848
7912
|
"id"
|
|
7849
7913
|
]);
|
|
7850
|
-
var s$
|
|
7851
|
-
var c$
|
|
7914
|
+
var s$12 = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
7915
|
+
var c$8 = (e) => s$12.test(e) ? o$15.has(e) ? `"${e}" is an attribute every instance already has` : null : `"${e}" is not a valid prop name: start with a letter, then letters, numbers and underscores — it is read as {{ props.${e} }}`;
|
|
7852
7916
|
var p$4 = (e, t) => Object.hasOwn(e.components, t) ? e.components[t] : void 0;
|
|
7853
7917
|
var m$3 = (e, t) => e.definition.type === "reference" && e.attributes.referenceType === "component" && (t === void 0 || e.attributes.referenceId === t);
|
|
7854
7918
|
//#endregion
|
|
7855
7919
|
//#region ../sdk-shared/dist/navigation/routes.mjs
|
|
7856
|
-
var r$
|
|
7857
|
-
var i$
|
|
7858
|
-
var a$
|
|
7920
|
+
var r$13 = (e) => e.replaceAll(/\/+/g, "/");
|
|
7921
|
+
var i$13 = (e) => r$13(e.replace(/{{([a-zA-Z0-9-_:*/]+)}}/gi, ":$1"));
|
|
7922
|
+
var a$11 = (e, t) => {
|
|
7859
7923
|
if (!t || !e[t]) return "";
|
|
7860
7924
|
let { slug: n, parentId: r } = e[t];
|
|
7861
|
-
return r ? `${a$
|
|
7925
|
+
return r ? `${a$11(e, r)}/${n}` : n;
|
|
7862
7926
|
};
|
|
7863
|
-
function o$
|
|
7927
|
+
function o$14(e, t, n, o = !1) {
|
|
7864
7928
|
let s = n.replace(/^\/+/, ""), { slug: c = "", folder: l, default: u } = e[s]?.attributes ?? {
|
|
7865
7929
|
slug: s,
|
|
7866
7930
|
folder: "",
|
|
@@ -7872,25 +7936,25 @@ function o$13(e, t, n, o = !1) {
|
|
|
7872
7936
|
};
|
|
7873
7937
|
if (u && o) return "/";
|
|
7874
7938
|
if (!l && !o) return {
|
|
7875
|
-
[i$
|
|
7876
|
-
[i$
|
|
7939
|
+
[i$13(`/${c}`)]: n,
|
|
7940
|
+
[i$13(`/${n}`)]: n
|
|
7877
7941
|
};
|
|
7878
|
-
if (!l && o) return r$
|
|
7879
|
-
if (!t.find((e) => e.id === l)) return o ? r$
|
|
7880
|
-
[i$
|
|
7881
|
-
[i$
|
|
7942
|
+
if (!l && o) return r$13(`/${c}`);
|
|
7943
|
+
if (!t.find((e) => e.id === l)) return o ? r$13(`/${c}`) : {
|
|
7944
|
+
[i$13(`/${c}`)]: n,
|
|
7945
|
+
[i$13(`/${n}`)]: n
|
|
7882
7946
|
};
|
|
7883
|
-
let d = [a$
|
|
7947
|
+
let d = [a$11(t.reduce((e, t) => ({
|
|
7884
7948
|
...e,
|
|
7885
7949
|
[t.id]: t
|
|
7886
7950
|
}), {}), l), c].filter(Boolean).join("/");
|
|
7887
|
-
return o ? r$
|
|
7888
|
-
[i$
|
|
7889
|
-
[i$
|
|
7951
|
+
return o ? r$13(`/${d}`) : {
|
|
7952
|
+
[i$13(`/${d}`)]: n,
|
|
7953
|
+
[i$13(`/${n}`)]: n
|
|
7890
7954
|
};
|
|
7891
7955
|
}
|
|
7892
7956
|
var d$4 = (e) => !e || typeof e != "string" ? [] : (e.match(/:[a-zA-Z0-9-_:*]+/gim) || []).map((e) => e.replace(":", ""));
|
|
7893
|
-
var f$4 = (e) => d$4(i$
|
|
7957
|
+
var f$4 = (e) => d$4(i$13(e));
|
|
7894
7958
|
//#endregion
|
|
7895
7959
|
//#region src/schema/lint/context.ts
|
|
7896
7960
|
/**
|
|
@@ -8014,14 +8078,14 @@ var LintContext = class {
|
|
|
8014
8078
|
}
|
|
8015
8079
|
/** The elements `id` is nested in, as the document stores them — what "inside a form" means. */
|
|
8016
8080
|
ancestors(id) {
|
|
8017
|
-
return new Set(t$
|
|
8081
|
+
return new Set(t$25(this.flat, id));
|
|
8018
8082
|
}
|
|
8019
8083
|
/**
|
|
8020
8084
|
* The elements whose sources `id` can read: everything it renders inside, the layout shells around its page included
|
|
8021
8085
|
* — the walk the runtime makes, so a provider beside the slot in a layout is not in it.
|
|
8022
8086
|
*/
|
|
8023
8087
|
scope(id) {
|
|
8024
|
-
return new Set(n$
|
|
8088
|
+
return new Set(n$21(this.flat, id));
|
|
8025
8089
|
}
|
|
8026
8090
|
/** The route params an element's page declares; a layout renders on every page, so it sees all of them. */
|
|
8027
8091
|
routeParams(id) {
|
|
@@ -8129,17 +8193,17 @@ var withPluginCatalogs = (options) => {
|
|
|
8129
8193
|
leafTypes: [...rest.leafTypes ?? [], ...plugins.filter((declaration) => declaration.content?.definition && !Array.isArray(declaration.content.definition.items)).map((declaration) => declaration.type)]
|
|
8130
8194
|
};
|
|
8131
8195
|
};
|
|
8132
|
-
var n$
|
|
8196
|
+
var n$16 = (e) => {
|
|
8133
8197
|
let t = typeof e == "string" && e.trim() !== "" ? Number(e) : e;
|
|
8134
8198
|
return typeof t == "number" && Number.isInteger(t) && t >= 250 ? t : void 0;
|
|
8135
8199
|
};
|
|
8136
|
-
var t$
|
|
8200
|
+
var t$17 = [
|
|
8137
8201
|
"ctrl",
|
|
8138
8202
|
"alt",
|
|
8139
8203
|
"shift",
|
|
8140
8204
|
"meta"
|
|
8141
8205
|
];
|
|
8142
|
-
var n$
|
|
8206
|
+
var n$15 = {
|
|
8143
8207
|
ctrl: "ctrl",
|
|
8144
8208
|
control: "ctrl",
|
|
8145
8209
|
alt: "alt",
|
|
@@ -8150,7 +8214,7 @@ var n$14 = {
|
|
|
8150
8214
|
command: "meta",
|
|
8151
8215
|
mod: "mod"
|
|
8152
8216
|
};
|
|
8153
|
-
var r$
|
|
8217
|
+
var r$12 = {
|
|
8154
8218
|
esc: "escape",
|
|
8155
8219
|
space: "space",
|
|
8156
8220
|
spacebar: "space",
|
|
@@ -8163,7 +8227,7 @@ var r$10 = {
|
|
|
8163
8227
|
del: "delete",
|
|
8164
8228
|
return: "enter"
|
|
8165
8229
|
};
|
|
8166
|
-
var i$
|
|
8230
|
+
var i$12 = /* @__PURE__ */ new Set([
|
|
8167
8231
|
"escape",
|
|
8168
8232
|
"enter",
|
|
8169
8233
|
"tab",
|
|
@@ -8181,25 +8245,25 @@ var i$11 = /* @__PURE__ */ new Set([
|
|
|
8181
8245
|
"pagedown",
|
|
8182
8246
|
...Array.from({ length: 12 }, (e, t) => `f${t + 1}`)
|
|
8183
8247
|
]);
|
|
8184
|
-
var a$
|
|
8185
|
-
var o$
|
|
8248
|
+
var a$10 = (e, n) => [...t$17.filter((t) => e.has(t)), n].join("+");
|
|
8249
|
+
var o$13 = (e, t) => {
|
|
8186
8250
|
let o = e.trim().toLowerCase();
|
|
8187
8251
|
if (!o) return { problem: "an empty shortcut (two commas in a row, or one at the end)" };
|
|
8188
8252
|
let s = o.endsWith("++") ? [...o.slice(0, -2).split("+"), "+"] : o.split("+"), c = o === "+" ? ["+"] : s.filter((e) => e !== ""), l = /* @__PURE__ */ new Set(), u = [];
|
|
8189
8253
|
for (let e of c) {
|
|
8190
|
-
if (Object.hasOwn(n$
|
|
8191
|
-
let r = n$
|
|
8254
|
+
if (Object.hasOwn(n$15, e)) {
|
|
8255
|
+
let r = n$15[e];
|
|
8192
8256
|
l.add(r === "mod" ? t ? "meta" : "ctrl" : r);
|
|
8193
8257
|
continue;
|
|
8194
8258
|
}
|
|
8195
|
-
u.push(Object.hasOwn(r$
|
|
8259
|
+
u.push(Object.hasOwn(r$12, e) ? r$12[e] : e);
|
|
8196
8260
|
}
|
|
8197
8261
|
if (u.length !== 1) return { problem: `"${e.trim()}" names ${u.length ? `${u.length} keys (${u.join(", ")})` : "no key, only modifiers"}: a shortcut is modifiers and ONE key, like "shift+f"` };
|
|
8198
8262
|
let [d] = u;
|
|
8199
|
-
return d.length !== 1 && !i$
|
|
8263
|
+
return d.length !== 1 && !i$12.has(d) ? { problem: `"${d}" in "${e.trim()}" is not a key: use one character ("f", "?", "+") or a key's name (${[...i$12].slice(0, 15).join(", ")}, f1…f12)` } : { combo: a$10(l, d) };
|
|
8200
8264
|
};
|
|
8201
|
-
var s$
|
|
8202
|
-
let n = e.split(",").map((e) => o$
|
|
8265
|
+
var s$11 = (e, t = !1) => {
|
|
8266
|
+
let n = e.split(",").map((e) => o$13(e, t));
|
|
8203
8267
|
return {
|
|
8204
8268
|
combos: n.flatMap((e) => e.combo ? [e.combo] : []),
|
|
8205
8269
|
problems: n.flatMap((e) => e.problem ? [e.problem] : [])
|
|
@@ -8209,6 +8273,7 @@ var s$10 = (e, t = !1) => {
|
|
|
8209
8273
|
//#region src/elements/steps.ts
|
|
8210
8274
|
var steps_exports$1 = /* @__PURE__ */ __exportAll({
|
|
8211
8275
|
announceOn: () => announceOn,
|
|
8276
|
+
cancelApi: () => cancelApi,
|
|
8212
8277
|
carouselGoTo: () => carouselGoTo,
|
|
8213
8278
|
carouselNext: () => carouselNext,
|
|
8214
8279
|
carouselPause: () => carouselPause,
|
|
@@ -8284,7 +8349,7 @@ var onLoad = () => on("onLoad");
|
|
|
8284
8349
|
* editing even then (⌘A, ⌘Z, ⌘C/⌘V, moving by word). `{{ <this step's id>.key }}` is the key pressed, canonical (`shift+f`) — for one flow answering several shortcuts.
|
|
8285
8350
|
*/
|
|
8286
8351
|
var onKey = (keys) => {
|
|
8287
|
-
const { problems } = s$
|
|
8352
|
+
const { problems } = s$11(keys);
|
|
8288
8353
|
if (problems.length || !keys.trim()) throw new AuthoringError("trigger-keys", `onKey('${keys}') is not a shortcut: ${problems.join("; ") || "it is empty"}. Write one or several, with commas: 'f', 'shift+f', 'mod+k', 'escape, q'.`);
|
|
8289
8354
|
return on("onKey", { keys });
|
|
8290
8355
|
};
|
|
@@ -8296,7 +8361,7 @@ var onKey = (keys) => {
|
|
|
8296
8361
|
* (`when(...)`) — a state an `onMouseEnter` sets, say. `{{ <this step's id>.count }}` is how many times it has ticked.
|
|
8297
8362
|
*/
|
|
8298
8363
|
var onInterval = (ms) => {
|
|
8299
|
-
if (n$
|
|
8364
|
+
if (n$16(ms) === void 0) throw new AuthoringError("trigger-interval", `onInterval(${String(ms)}) is not an interval a flow can repeat on: it takes a whole number of milliseconds, at least 250 — \`onInterval(5000)\` is every five seconds.`);
|
|
8300
8365
|
return on("onInterval", { interval: ms });
|
|
8301
8366
|
};
|
|
8302
8367
|
/**
|
|
@@ -8311,7 +8376,7 @@ var onInterval = (ms) => {
|
|
|
8311
8376
|
* and hide the arrow at the end already reached: `[named('row', onScroll()), setState({ key: 'atEnd', type:
|
|
8312
8377
|
* 'boolean', value: '{{ row.atEnd }}' })]`.
|
|
8313
8378
|
*/
|
|
8314
|
-
var onScroll = () => on(s$
|
|
8379
|
+
var onScroll = () => on(s$19);
|
|
8315
8380
|
var onPageLoad = () => on("onPageLoad");
|
|
8316
8381
|
/**
|
|
8317
8382
|
* The end of a server action this element started — the trigger a `detached` run needs, because that step returns
|
|
@@ -8387,6 +8452,20 @@ var reloadApi = (target, input) => ({
|
|
|
8387
8452
|
params: input ? { input } : {}
|
|
8388
8453
|
});
|
|
8389
8454
|
/**
|
|
8455
|
+
* Stops an `apiContainer`'s request in flight, by id — a STOP for a slow report: the request is dropped, on the
|
|
8456
|
+
* server too, and what the container shows stays. Its `isLoading` turns false.
|
|
8457
|
+
*
|
|
8458
|
+
* A newer `reloadApi` of the same container already drops the older one, so this is only for the visitor who is done
|
|
8459
|
+
* waiting. An element callback, so `target` is the CONTAINER's id.
|
|
8460
|
+
*/
|
|
8461
|
+
var cancelApi = (target) => ({
|
|
8462
|
+
type: "callback",
|
|
8463
|
+
action: "cancelQuery",
|
|
8464
|
+
title: "Cancel",
|
|
8465
|
+
on: target,
|
|
8466
|
+
params: {}
|
|
8467
|
+
});
|
|
8468
|
+
/**
|
|
8390
8469
|
* Opens a `modalContainer`, by id.
|
|
8391
8470
|
*
|
|
8392
8471
|
* A modal starts OPEN: declare it `visible: false` — its starting state, not a condition — and open it with this.
|
|
@@ -8555,7 +8634,7 @@ var e$19 = {
|
|
|
8555
8634
|
elements: "Only these containers",
|
|
8556
8635
|
none: "None — this only reads"
|
|
8557
8636
|
};
|
|
8558
|
-
var t$
|
|
8637
|
+
var t$16 = (t, n = () => !0) => ({
|
|
8559
8638
|
invalidateQueries: {
|
|
8560
8639
|
type: "select",
|
|
8561
8640
|
description: "What to refresh once the write succeeded, so the page shows the new data: the cached requests to the same site, all of them, only the api containers named in `invalidateElements`, or none for a step that only reads. Containers on screen ask again at once; the rest when they are shown.",
|
|
@@ -8577,7 +8656,7 @@ var t$15 = (t, n = () => !0) => ({
|
|
|
8577
8656
|
});
|
|
8578
8657
|
//#endregion
|
|
8579
8658
|
//#region ../sdk-interactions/dist/sources/ActionsSource/callbacks.mjs
|
|
8580
|
-
var t$
|
|
8659
|
+
var t$15 = {
|
|
8581
8660
|
runServerAction: {
|
|
8582
8661
|
source: "actions",
|
|
8583
8662
|
title: "Run Server Action",
|
|
@@ -8617,7 +8696,7 @@ var t$14 = {
|
|
|
8617
8696
|
default: "",
|
|
8618
8697
|
when: (e) => e.mode !== "detached"
|
|
8619
8698
|
},
|
|
8620
|
-
...t$
|
|
8699
|
+
...t$16([
|
|
8621
8700
|
"all",
|
|
8622
8701
|
"elements",
|
|
8623
8702
|
"none"
|
|
@@ -9027,7 +9106,7 @@ var BUILTIN_GLOBAL_CALLBACKS = {
|
|
|
9027
9106
|
...e$17,
|
|
9028
9107
|
...e$16,
|
|
9029
9108
|
...e$18,
|
|
9030
|
-
...t$
|
|
9109
|
+
...t$15,
|
|
9031
9110
|
...e$15
|
|
9032
9111
|
};
|
|
9033
9112
|
/** The built-in globalCallback for an action, or undefined when the action is not a known built-in (a plugin
|
|
@@ -9258,7 +9337,7 @@ var webHook = (params) => utilityStep("webHook", params);
|
|
|
9258
9337
|
var twigTemplate = (params) => utilityStep("twigTemplate", params);
|
|
9259
9338
|
//#endregion
|
|
9260
9339
|
//#region ../sdk-interactions/dist/utility/webHookSpec.mjs
|
|
9261
|
-
var t$
|
|
9340
|
+
var t$14 = (e) => {
|
|
9262
9341
|
let t = typeof e.method == "string" ? e.method.toLowerCase() : "get";
|
|
9263
9342
|
return t === "get" || t === "head";
|
|
9264
9343
|
};
|
|
@@ -9353,21 +9432,21 @@ var BUILTIN_UTILITIES = {
|
|
|
9353
9432
|
description: "Serve a GET from the page’s query cache while it is fresh, and keep the answer there — shared with any api container asking the same thing.",
|
|
9354
9433
|
default: !1,
|
|
9355
9434
|
label: "Cache response",
|
|
9356
|
-
when: t$
|
|
9435
|
+
when: t$14
|
|
9357
9436
|
},
|
|
9358
9437
|
staleTime: {
|
|
9359
9438
|
type: "number",
|
|
9360
9439
|
description: "With `cache`: seconds the answer is served without asking again.",
|
|
9361
9440
|
default: 30,
|
|
9362
9441
|
label: "Fresh for (s)",
|
|
9363
|
-
when: (e) => t$
|
|
9442
|
+
when: (e) => t$14(e) && (e.cache === !0 || e.cache === "true")
|
|
9364
9443
|
},
|
|
9365
|
-
...t$
|
|
9444
|
+
...t$16([
|
|
9366
9445
|
"origin",
|
|
9367
9446
|
"all",
|
|
9368
9447
|
"elements",
|
|
9369
9448
|
"none"
|
|
9370
|
-
], (e) => !t$
|
|
9449
|
+
], (e) => !t$14(e))
|
|
9371
9450
|
},
|
|
9372
9451
|
preview: { response: {
|
|
9373
9452
|
status: "",
|
|
@@ -9395,13 +9474,14 @@ var applyUtility = (action, params) => {
|
|
|
9395
9474
|
var e$13 = "flow.onFailure";
|
|
9396
9475
|
//#endregion
|
|
9397
9476
|
//#region ../sdk-shared/dist/actions/functions.mjs
|
|
9398
|
-
var
|
|
9477
|
+
var a$9 = (e) => e === "/fn" || e.startsWith("/fn/");
|
|
9399
9478
|
//#endregion
|
|
9400
9479
|
//#region ../sdk-shared/dist/types/SchemaTypes.mjs
|
|
9401
9480
|
var e$12 = [
|
|
9402
9481
|
"skip",
|
|
9403
9482
|
"parallel",
|
|
9404
|
-
"queue"
|
|
9483
|
+
"queue",
|
|
9484
|
+
"latest"
|
|
9405
9485
|
];
|
|
9406
9486
|
//#endregion
|
|
9407
9487
|
//#region src/schema/flows.ts
|
|
@@ -9423,7 +9503,7 @@ var hostFor = (step, host) => step.type === "trigger" || step.type === "callback
|
|
|
9423
9503
|
var assertStepIds = (ids, where) => {
|
|
9424
9504
|
const seen = /* @__PURE__ */ new Set();
|
|
9425
9505
|
for (const id of ids) {
|
|
9426
|
-
if (!t$
|
|
9506
|
+
if (!t$26(id)) throw new AuthoringError("step-name", `Step "${id}" in ${where} is not a valid name: start with a letter, then letters, numbers, hyphens and underscores. A later step reads this one as {{ ${id}.field }}.`);
|
|
9427
9507
|
if (seen.has(id)) throw new AuthoringError("step-duplicate", `${where} names the step "${id}" twice. A flow's steps are keyed by id, so the second wins.`);
|
|
9428
9508
|
seen.add(id);
|
|
9429
9509
|
}
|
|
@@ -9529,7 +9609,8 @@ var both = (inner, outer) => inner.combinator === "and" && outer.combinator ===
|
|
|
9529
9609
|
*
|
|
9530
9610
|
* `skip` is what happens without this: the new firing is ignored — which is what keeps a double click from submitting
|
|
9531
9611
|
* twice, and exactly wrong for a stream of events a flow must answer every one of. `queue` runs each firing after the
|
|
9532
|
-
* last, in order; `parallel` runs them all at once
|
|
9612
|
+
* last, in order; `parallel` runs them all at once; `latest` stops the run in progress — the server action or request
|
|
9613
|
+
* it waits on included — and runs the new one: a search as you type, where only the last question matters.
|
|
9533
9614
|
*
|
|
9534
9615
|
* ```ts
|
|
9535
9616
|
* [whileRunning('queue', named('arrived', on('onArrival'))), addNotification({ … }), delay(8000), …]
|
|
@@ -9738,18 +9819,18 @@ var authoringCodesTable = (kind) => {
|
|
|
9738
9819
|
};
|
|
9739
9820
|
//#endregion
|
|
9740
9821
|
//#region ../sdk-shared/dist/flags/schemaFlag.mjs
|
|
9741
|
-
var t$
|
|
9742
|
-
var n$
|
|
9743
|
-
RegExp(`^!?${t$
|
|
9744
|
-
var i$
|
|
9822
|
+
var t$13 = "[A-Za-z_][A-Za-z0-9_]*";
|
|
9823
|
+
var n$13 = RegExp(`^${t$13}$`);
|
|
9824
|
+
RegExp(`^!?${t$13}$`);
|
|
9825
|
+
var i$11 = /* @__PURE__ */ new Set([
|
|
9745
9826
|
"__proto__",
|
|
9746
9827
|
"constructor",
|
|
9747
9828
|
"prototype"
|
|
9748
9829
|
]);
|
|
9749
|
-
var a$8 = (e) => n$
|
|
9830
|
+
var a$8 = (e) => n$13.test(e) && !i$11.has(e);
|
|
9750
9831
|
//#endregion
|
|
9751
9832
|
//#region ../sdk-shared/dist/flags/resolveFlags.mjs
|
|
9752
|
-
var i$
|
|
9833
|
+
var i$10 = (e) => typeof e == "object" && !!e && "rules" in e && Array.isArray(e.rules) && e.rules.some((e) => typeof e == "object" && !!e && !("enabled" in e && e.enabled === !1));
|
|
9753
9834
|
//#endregion
|
|
9754
9835
|
//#region src/schema/flags.ts
|
|
9755
9836
|
/**
|
|
@@ -10034,8 +10115,8 @@ var warnClickOnStaticElement = (ctx, element, where) => {
|
|
|
10034
10115
|
var warnIgnoredRegionName = (ctx, element, where) => {
|
|
10035
10116
|
if (element.definition.type !== "container" || !says(ctx, element, "label")) return;
|
|
10036
10117
|
const subType = textOf(attributeValue(ctx, element, "subType"), "div");
|
|
10037
|
-
if (n$
|
|
10038
|
-
ctx.warn("label-ignored", `${where} is a "${subType}" with a \`label\`, which nobody reads: it takes its name from what it holds. Put the words inside it — or, if it is a part of the page of its own, make it one of ${n$
|
|
10118
|
+
if (n$29.some((tag) => tag === subType)) return;
|
|
10119
|
+
ctx.warn("label-ignored", `${where} is a "${subType}" with a \`label\`, which nobody reads: it takes its name from what it holds. Put the words inside it — or, if it is a part of the page of its own, make it one of ${n$29.map((tag) => `'${tag}'`).join(", ")}.`, element.id);
|
|
10039
10120
|
};
|
|
10040
10121
|
/**
|
|
10041
10122
|
* Whether `id`'s subtree holds something a keyboard can reach — or markup the linter cannot read, which may — leaving
|
|
@@ -10110,31 +10191,70 @@ var lintAccessibility = (ctx) => {
|
|
|
10110
10191
|
warnSkippedHeadings(ctx);
|
|
10111
10192
|
};
|
|
10112
10193
|
//#endregion
|
|
10194
|
+
//#region src/schema/lint/actionOutput.ts
|
|
10195
|
+
var PROVIDER$2 = "apiContainer_";
|
|
10196
|
+
/** A provider's `.data`, wherever a template reads it: `apiContainer_feed.data`, its id `-` and all. */
|
|
10197
|
+
var DATA_READ = /(?<![\w.])apiContainer_([A-Za-z0-9_-]+)\.data(?![\w-])/g;
|
|
10198
|
+
/**
|
|
10199
|
+
* A provider fed by a server action publishes the action's output at its root, beside its state (`isLoading`, …).
|
|
10200
|
+
* `.data` is what a `query` provider answers with, in either runtime, so a read of it on an action's provider is the
|
|
10201
|
+
* template that renders nothing — authored without a word, and found on a page served empty.
|
|
10202
|
+
*/
|
|
10203
|
+
var checkRead = (ctx, providerId, path, where, id) => {
|
|
10204
|
+
const provider = ctx.element(providerId);
|
|
10205
|
+
const action = textOf(provider?.attributes.action);
|
|
10206
|
+
if (!provider || provider.definition.type !== "apiContainer" || !action || textOf(provider.attributes.connector)) return;
|
|
10207
|
+
const rest = path.slice(`${PROVIDER$2}${providerId}.data`.length);
|
|
10208
|
+
ctx.warn("action-output-path", `${where} reads \`${path}\`, but "${providerId}" is fed by the server action "${action}", which it publishes at its root: \`${PROVIDER$2}${providerId}${rest}\`. \`.data\` is a query provider's answer. (An output whose own top field is \`data\` reads the same as a query's — name it otherwise.)`, id, { source: path });
|
|
10209
|
+
};
|
|
10210
|
+
/** Every template's reads of `<provider>.data` — see {@link checkRead}. */
|
|
10211
|
+
var checkActionOutputReads = (ctx, template, where, id) => {
|
|
10212
|
+
for (const match of template.matchAll(DATA_READ)) {
|
|
10213
|
+
const [path, providerId = ""] = match;
|
|
10214
|
+
checkRead(ctx, providerId, `${path}${/^[\w.-]*/.exec(template.slice(match.index + path.length))?.[0] ?? ""}`, where, id);
|
|
10215
|
+
}
|
|
10216
|
+
};
|
|
10217
|
+
/** Every binding's source that reads `<provider>.data` — see {@link checkRead}. */
|
|
10218
|
+
var lintActionOutputBindings = (ctx) => {
|
|
10219
|
+
for (const element of Object.values(ctx.flat)) for (const binding of Object.values(element.definition.bindings ?? {}).flat()) {
|
|
10220
|
+
if (binding.enabled === false || !binding.source.startsWith(PROVIDER$2)) continue;
|
|
10221
|
+
const [root = "", next] = binding.source.split(".");
|
|
10222
|
+
if (next === "data") checkRead(ctx, root.slice(13), binding.source, ctx.describe(element.id), element.id);
|
|
10223
|
+
}
|
|
10224
|
+
};
|
|
10225
|
+
//#endregion
|
|
10113
10226
|
//#region ../sdk-schema/dist/helpers/styleWithoutTag.mjs
|
|
10114
10227
|
var e$11 = (e) => Object.keys(e ?? {}).length > 0;
|
|
10115
|
-
var t$
|
|
10116
|
-
var n$
|
|
10117
|
-
var r$
|
|
10118
|
-
var i$
|
|
10228
|
+
var t$12 = (t) => Object.values(t ?? {}).some(e$11);
|
|
10229
|
+
var n$12 = (n) => e$11(n.default) || t$12(n.states) || Object.values(n.variants ?? {}).some((n) => e$11(n.default) || t$12(n.states));
|
|
10230
|
+
var r$10 = (e, t) => Object.values(e.platform).some((e) => Object.hasOwn(e, t) && Object.values(e[t].attributes).some(n$12));
|
|
10231
|
+
var i$9 = /* @__PURE__ */ new Set(["apiContainer", "channel"]);
|
|
10232
|
+
var a$7 = (e) => {
|
|
10119
10233
|
let t = e.attributes.subType;
|
|
10120
|
-
return e.definition.type
|
|
10234
|
+
return i$9.has(e.definition.type) && (typeof t != "string" || t === "");
|
|
10121
10235
|
};
|
|
10122
|
-
var
|
|
10123
|
-
if (!
|
|
10124
|
-
let { styleSelectors: n, initialState:
|
|
10236
|
+
var o$12 = (e, t) => {
|
|
10237
|
+
if (!a$7(e)) return;
|
|
10238
|
+
let { styleSelectors: n, initialState: i, bindings: o } = e.definition, s = Object.values(n).some((e) => e.split(" ").some((e) => e && r$10(t, e))), c = Object.keys(i?.styleVariant ?? {}).length > 0, l = (o?.style?.length ?? 0) > 0;
|
|
10125
10239
|
if (s || c || l) return "has style but no `subType` (container tag), so it renders no element of its own and the style applies to nothing — its children lay out in its parent. Give it a tag (a `subType` of `div`, `section`, …) or move the style onto its parent or a child.";
|
|
10126
10240
|
};
|
|
10127
10241
|
//#endregion
|
|
10128
10242
|
//#region ../sdk-shared/dist/schema/anchor.mjs
|
|
10129
10243
|
var e$10 = /^[a-z][a-z0-9-]*$/;
|
|
10130
|
-
var t$
|
|
10244
|
+
var t$11 = (t) => typeof t == "string" && e$10.test(t);
|
|
10245
|
+
var n$11 = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^[^a-z]+|-+$/g, "") || "section";
|
|
10246
|
+
var r$9 = (e, t) => {
|
|
10247
|
+
let r = n$11(e), i = r;
|
|
10248
|
+
for (let e = 2; t.has(i); e += 1) i = `${r}-${String(e)}`;
|
|
10249
|
+
return t.add(i), i;
|
|
10250
|
+
};
|
|
10131
10251
|
//#endregion
|
|
10132
10252
|
//#region ../sdk-shared/dist/schema/layoutChain.mjs
|
|
10133
10253
|
var e$9 = (e, t) => {
|
|
10134
10254
|
let n = e?.attributes[t];
|
|
10135
10255
|
return typeof n == "string" ? n : "";
|
|
10136
10256
|
};
|
|
10137
|
-
var t$
|
|
10257
|
+
var t$10 = (t, n, r) => {
|
|
10138
10258
|
let i = [], a = /* @__PURE__ */ new Set(), o = n, s = r;
|
|
10139
10259
|
for (; o && !a.has(o) && i.length < 16;) {
|
|
10140
10260
|
let n = t(o);
|
|
@@ -10146,7 +10266,7 @@ var t$9 = (t, n, r) => {
|
|
|
10146
10266
|
}
|
|
10147
10267
|
return i;
|
|
10148
10268
|
};
|
|
10149
|
-
var n$
|
|
10269
|
+
var n$10 = (t, n) => {
|
|
10150
10270
|
let r = [], i = n;
|
|
10151
10271
|
for (; i && r.length <= 16;) {
|
|
10152
10272
|
if (r.includes(i)) return [...r.slice(r.indexOf(i)), i];
|
|
@@ -10155,9 +10275,30 @@ var n$9 = (t, n) => {
|
|
|
10155
10275
|
return [];
|
|
10156
10276
|
};
|
|
10157
10277
|
//#endregion
|
|
10158
|
-
//#region
|
|
10159
|
-
|
|
10160
|
-
var
|
|
10278
|
+
//#region ../sdk-shared/dist/schema/markdownHeadings.mjs
|
|
10279
|
+
var t$9 = /^ {0,3}(`{3,}|~{3,})/;
|
|
10280
|
+
var n$9 = /^ {0,3}(#{1,6})[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/;
|
|
10281
|
+
var r$8 = (e) => e.replace(/!\[[^\]]*\]\([^)]*\)/g, "").replace(/<[^>]+>/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/`+([^`]*?)`+/g, "$1").replace(/(\*\*|~~)(.+?)\1/g, "$2").replace(/\*(.+?)\*/g, "$1").replace(/\b__(.+?)__\b/g, "$1").replace(/\b_(.+?)_\b/g, "$1").replace(/\\([\\`*_{}[\]()#+\-.!|~>])/g, "$1").trim();
|
|
10282
|
+
var i$8 = (i) => {
|
|
10283
|
+
let a = /* @__PURE__ */ new Set(), o = [], s;
|
|
10284
|
+
for (let c of i.split("\n")) {
|
|
10285
|
+
let i = t$9.exec(c)?.[1];
|
|
10286
|
+
if (i) {
|
|
10287
|
+
s ? i[0] === s[0] && i.length >= s.length && (s = void 0) : s = i;
|
|
10288
|
+
continue;
|
|
10289
|
+
}
|
|
10290
|
+
let l = s ? null : n$9.exec(c);
|
|
10291
|
+
if (l) {
|
|
10292
|
+
let t = r$8(l[2]);
|
|
10293
|
+
o.push({
|
|
10294
|
+
level: l[1].length,
|
|
10295
|
+
text: t,
|
|
10296
|
+
anchor: r$9(t, a)
|
|
10297
|
+
});
|
|
10298
|
+
}
|
|
10299
|
+
}
|
|
10300
|
+
return o;
|
|
10301
|
+
};
|
|
10161
10302
|
//#endregion
|
|
10162
10303
|
//#region src/schema/lint/anchors.ts
|
|
10163
10304
|
/** The element types that render their children once per row, so an `id` inside them would repeat in the DOM. */
|
|
@@ -10167,23 +10308,28 @@ var attributeText = (element, key) => {
|
|
|
10167
10308
|
const value = element.attributes[key];
|
|
10168
10309
|
return typeof value === "string" ? value : "";
|
|
10169
10310
|
};
|
|
10170
|
-
/**
|
|
10311
|
+
/**
|
|
10312
|
+
* Every anchor a rendered page carries — its own tree and the layouts around it — with the elements that carry it: an
|
|
10313
|
+
* element's own `anchor`, and the `id` of every heading a Markdown element renders.
|
|
10314
|
+
*/
|
|
10171
10315
|
var anchorsOfPage = (ctx, pageId) => {
|
|
10172
10316
|
const page = ctx.element(pageId);
|
|
10173
|
-
const chain = page ? t$
|
|
10317
|
+
const chain = page ? t$10((id) => ctx.element(id), attributeText(page, "layout"), attributeText(page, "layoutContainer")) : [];
|
|
10174
10318
|
const roots = /* @__PURE__ */ new Set([pageId, ...chain.map((link) => link.layout)]);
|
|
10175
10319
|
const anchors = /* @__PURE__ */ new Map();
|
|
10176
10320
|
Object.values(ctx.flat).forEach((element) => {
|
|
10177
|
-
|
|
10178
|
-
|
|
10321
|
+
if (!roots.has(element.definition.rootId)) return;
|
|
10322
|
+
const own = element.definition.anchor ? [element.definition.anchor] : [];
|
|
10323
|
+
const headings = element.definition.type === "markdown" ? i$8(attributeText(element, "content")).map((heading) => heading.anchor) : [];
|
|
10324
|
+
[...own, ...headings].forEach((anchor) => anchors.set(anchor, [...anchors.get(anchor) ?? [], element.id]));
|
|
10179
10325
|
});
|
|
10180
10326
|
return anchors;
|
|
10181
10327
|
};
|
|
10182
10328
|
/** One element's own anchor: well formed, on something that renders, and rendered once. */
|
|
10183
10329
|
var lintOwnAnchor = (ctx, element, anchor) => {
|
|
10184
10330
|
const where = ctx.describe(element.id);
|
|
10185
|
-
if (!t$
|
|
10186
|
-
if (
|
|
10331
|
+
if (!t$11(anchor)) ctx.error("anchor-invalid", `${where} has the anchor ${JSON.stringify(anchor)}. An anchor is the element's id in the URL (\`/page#anchor\`): ${FORMAT} — "${n$11(anchor)}".`, element.id);
|
|
10332
|
+
if (a$7(element)) ctx.error("anchor-no-tag", `${where} has the anchor "${anchor}" but renders no element of its own (no \`subType\`), so there is nothing to scroll to. Put the anchor on the section it wraps, or give it a tag.`, element.id);
|
|
10187
10333
|
if (ctx.component) {
|
|
10188
10334
|
ctx.error("anchor-repeated", `${where} has the anchor "${anchor}", and a component renders its tree once per instance — two instances would put the same id in the page twice. Put the anchor on the element around the instance, on the page.`, element.id);
|
|
10189
10335
|
return;
|
|
@@ -10196,14 +10342,14 @@ var lintLinkHash = (ctx, link, anchorsByPage) => {
|
|
|
10196
10342
|
const hash = attributeText(link, "hash");
|
|
10197
10343
|
if (!hash || attributeText(link, "mode") === "external") return;
|
|
10198
10344
|
const where = ctx.describe(link.id);
|
|
10199
|
-
if (!t$
|
|
10345
|
+
if (!t$11(hash)) {
|
|
10200
10346
|
ctx.error("anchor-invalid", `${where} goes to the section ${JSON.stringify(hash)}: an anchor is ${FORMAT}, written without the "#".`, link.id);
|
|
10201
10347
|
return;
|
|
10202
10348
|
}
|
|
10203
10349
|
if ((attributeText(link, "mode") || "page") !== "page") return;
|
|
10204
10350
|
const { flat, schema } = ctx;
|
|
10205
|
-
const path = o$
|
|
10206
|
-
const pageId = [...ctx.pageIds].find((id) => o$
|
|
10351
|
+
const path = o$14(flat, schema.pageFolders, attributeText(link, "href"), true);
|
|
10352
|
+
const pageId = [...ctx.pageIds].find((id) => o$14(flat, schema.pageFolders, id, true) === path);
|
|
10207
10353
|
if (!pageId) return;
|
|
10208
10354
|
const anchors = anchorsByPage(pageId);
|
|
10209
10355
|
if (!anchors.has(hash)) {
|
|
@@ -10226,7 +10372,7 @@ var lintControls = (ctx) => {
|
|
|
10226
10372
|
Object.values(ctx.flat).forEach((element) => {
|
|
10227
10373
|
const controls = attributeText(element, "controls");
|
|
10228
10374
|
if (element.definition.type !== "button" || controls === "" || anchors.has(controls)) return;
|
|
10229
|
-
ctx.warn("controls-no-anchor", `${ctx.describe(element.id)} controls "${controls}", and no element carries that anchor, so a screen reader is pointed at nothing. Give the element it shows and hides \`anchor: '${
|
|
10375
|
+
ctx.warn("controls-no-anchor", `${ctx.describe(element.id)} controls "${controls}", and no element carries that anchor, so a screen reader is pointed at nothing. Give the element it shows and hides \`anchor: '${n$11(controls)}'\` and name that.`, element.id);
|
|
10230
10376
|
});
|
|
10231
10377
|
};
|
|
10232
10378
|
var lintAnchors = (ctx) => {
|
|
@@ -10270,16 +10416,16 @@ var a$6 = (e, t) => {
|
|
|
10270
10416
|
};
|
|
10271
10417
|
};
|
|
10272
10418
|
var o$11 = /^(?=.)[A-Za-z0-9:_.-]*(\{[A-Za-z0-9_]+\}[A-Za-z0-9:_.-]*)*$/;
|
|
10273
|
-
var s$
|
|
10419
|
+
var s$10 = /* @__PURE__ */ new Set([
|
|
10274
10420
|
"public",
|
|
10275
10421
|
"session",
|
|
10276
10422
|
"role"
|
|
10277
10423
|
]);
|
|
10278
|
-
var c$
|
|
10424
|
+
var c$7 = (t, n) => {
|
|
10279
10425
|
let r = [];
|
|
10280
10426
|
if (o$11.test(t) || r.push("a pattern is letters, digits and `:_.-`, with `{name}` for the part a page fills in — `board:{id}`"), !e$28(n)) return [...r, "a channel is an object: `{ access: { mode: \"public\" } }`"];
|
|
10281
10427
|
let { access: i, publish: a, presence: c, grant: l, maxMessageBytes: u, messagesPerSecond: d } = n, f = e$28(i) ? i.mode : void 0;
|
|
10282
|
-
typeof f != "string" || !s$
|
|
10428
|
+
typeof f != "string" || !s$10.has(f) ? r.push("`access` is { mode: \"public\" }, { mode: \"session\" } or { mode: \"role\", permissions: […] }") : f === "role" && !(e$28(i) && Array.isArray(i.permissions) && i.permissions.every((e) => typeof e == "string")) && r.push("`access: { mode: \"role\" }` names the permissions it needs: `permissions: [\"boardEdit\"]`"), a !== void 0 && a !== "clients" && a !== "server" && r.push("`publish` is \"clients\" (pages send) or \"server\" (only a flow's realtime.publish)"), c !== void 0 && typeof c != "boolean" && r.push("`presence` is true or false"), l !== void 0 && typeof l != "boolean" && r.push("`grant` is true (a page needs a grant from `realtime.grant` to open a topic) or false");
|
|
10283
10429
|
for (let [e, t] of [["maxMessageBytes", u], ["messagesPerSecond", d]]) t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t <= 0) && r.push(`\`${e}\` is a whole number above zero`);
|
|
10284
10430
|
return r;
|
|
10285
10431
|
};
|
|
@@ -10294,7 +10440,7 @@ var SAMPLE_SEGMENT = "x";
|
|
|
10294
10440
|
var lintChannels = (ctx) => {
|
|
10295
10441
|
const declared = ctx.schema.settings.channels;
|
|
10296
10442
|
const patterns = Object.keys(declared ?? {});
|
|
10297
|
-
for (const pattern of patterns) for (const problem of c$
|
|
10443
|
+
for (const pattern of patterns) for (const problem of c$7(pattern, declared?.[pattern])) ctx.error("channel-declaration", `Channel "${pattern}": ${problem}.`);
|
|
10298
10444
|
for (const element of Object.values(ctx.flat)) {
|
|
10299
10445
|
if (element.definition.type !== "channel") continue;
|
|
10300
10446
|
if (element.definition.bindings?.attributes?.some((binding) => binding.to === "topic")) continue;
|
|
@@ -10389,14 +10535,27 @@ var PUBLISHED_STATE = {
|
|
|
10389
10535
|
};
|
|
10390
10536
|
var PROVIDER$1 = "apiContainer_";
|
|
10391
10537
|
/**
|
|
10538
|
+
* A provider asking for the project's own data (`/data/…`, kept where the server reads it and never serves it) from the
|
|
10539
|
+
* browser: it is answered nothing there, and renders its error state on every page that holds it.
|
|
10540
|
+
*/
|
|
10541
|
+
var lintServerDataReads = (ctx) => {
|
|
10542
|
+
for (const element of Object.values(ctx.flat)) {
|
|
10543
|
+
const query = textOf(element.attributes.query);
|
|
10544
|
+
const fed = ["connector", "action"].some((key) => textOf(element.attributes[key]) !== "");
|
|
10545
|
+
if (!query.startsWith("/data/") || fed || element.definition.runtime === "server") continue;
|
|
10546
|
+
ctx.error("server-data-in-browser", `${ctx.describe(element.id)} asks for ${query} from the browser, and the project's data (\`src/data/\`) is read by its server alone — never served, so the browser is answered nothing. Give it \`runtime: 'server'\`: the page then arrives with the data in it.`, element.id);
|
|
10547
|
+
}
|
|
10548
|
+
};
|
|
10549
|
+
/**
|
|
10392
10550
|
* Every binding onto a provider whose answer the author can read (`data` — a JSON file the project serves), held to
|
|
10393
10551
|
* that answer: a path it does not have is the binding that renders nothing, found where it is written instead of on a
|
|
10394
10552
|
* page that was served empty. A provider fed by a connector or an action publishes its own slice, which no file says,
|
|
10395
10553
|
* and a `query` with `{{tokens}}` is asked of the visitor's route and state: both are left unchecked.
|
|
10396
10554
|
*/
|
|
10397
10555
|
var lintDataPaths = (ctx) => {
|
|
10398
|
-
const
|
|
10399
|
-
if (!
|
|
10556
|
+
const { data, serverData } = ctx.catalogs;
|
|
10557
|
+
if (!data && !serverData) return;
|
|
10558
|
+
const answerOf = (query) => serverData?.(query) ?? data?.(query);
|
|
10400
10559
|
const answers = /* @__PURE__ */ new Map();
|
|
10401
10560
|
const answer = (providerId) => {
|
|
10402
10561
|
if (answers.has(providerId)) return answers.get(providerId);
|
|
@@ -10412,6 +10571,7 @@ var lintDataPaths = (ctx) => {
|
|
|
10412
10571
|
answers.set(providerId, published);
|
|
10413
10572
|
return published;
|
|
10414
10573
|
};
|
|
10574
|
+
if (serverData) lintServerDataReads(ctx);
|
|
10415
10575
|
for (const element of Object.values(ctx.flat)) for (const binding of Object.values(element.definition.bindings ?? {}).flat()) {
|
|
10416
10576
|
if (binding.enabled === false || !binding.source.startsWith(PROVIDER$1)) continue;
|
|
10417
10577
|
const [root, ...path] = pathSteps(binding.source);
|
|
@@ -10446,7 +10606,7 @@ var o$10 = (e) => {
|
|
|
10446
10606
|
for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
|
|
10447
10607
|
return new TextDecoder().decode(n);
|
|
10448
10608
|
};
|
|
10449
|
-
var s$
|
|
10609
|
+
var s$9 = (e) => {
|
|
10450
10610
|
let t = [
|
|
10451
10611
|
7,
|
|
10452
10612
|
12,
|
|
@@ -10536,10 +10696,10 @@ var s$8 = (e) => {
|
|
|
10536
10696
|
};
|
|
10537
10697
|
return p(c) + p(l) + p(u) + p(d);
|
|
10538
10698
|
};
|
|
10539
|
-
var c$
|
|
10699
|
+
var c$6 = "__PLITZI_RAW__";
|
|
10540
10700
|
var u$4 = (e) => ({
|
|
10541
10701
|
__raw: e,
|
|
10542
|
-
__marker: c$
|
|
10702
|
+
__marker: c$6
|
|
10543
10703
|
});
|
|
10544
10704
|
var f$3 = [
|
|
10545
10705
|
"Sun",
|
|
@@ -10875,7 +11035,7 @@ var y = {
|
|
|
10875
11035
|
},
|
|
10876
11036
|
base64_encode: (e) => typeof e == "string" ? a$5(e) : e,
|
|
10877
11037
|
base64_decode: (e) => typeof e == "string" ? o$10(e) : e,
|
|
10878
|
-
md5: (e) => typeof e == "string" ? s$
|
|
11038
|
+
md5: (e) => typeof e == "string" ? s$9(e) : e,
|
|
10879
11039
|
without: (e, t) => {
|
|
10880
11040
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
10881
11041
|
let n = t.map(i$5), r = {};
|
|
@@ -10942,8 +11102,18 @@ var r$4 = /* @__PURE__ */ new Set([
|
|
|
10942
11102
|
"min",
|
|
10943
11103
|
"range"
|
|
10944
11104
|
]);
|
|
10945
|
-
var i$4 =
|
|
10946
|
-
var a$4 =
|
|
11105
|
+
var i$4 = (e) => `value|round(0, '${e}')`;
|
|
11106
|
+
var a$4 = {
|
|
11107
|
+
floor: i$4("floor"),
|
|
11108
|
+
ceil: i$4("ceil"),
|
|
11109
|
+
clamp: "min(max(value, low), high)"
|
|
11110
|
+
};
|
|
11111
|
+
var o$9 = (t) => {
|
|
11112
|
+
let n = Object.hasOwn(y, t) ? `value|${t}` : a$4[t];
|
|
11113
|
+
return `Unknown function "${t}()"${n ? ` — write \`${n}\`` : ""}: the functions are ${[...r$4].join(", ")}`;
|
|
11114
|
+
};
|
|
11115
|
+
var s$8 = "loop";
|
|
11116
|
+
var c$5 = class {
|
|
10947
11117
|
issues = [];
|
|
10948
11118
|
freeNames = /* @__PURE__ */ new Set();
|
|
10949
11119
|
nodes(e, t) {
|
|
@@ -10965,7 +11135,7 @@ var a$4 = class {
|
|
|
10965
11135
|
let e = /* @__PURE__ */ new Set([
|
|
10966
11136
|
...n,
|
|
10967
11137
|
t.valueVar,
|
|
10968
|
-
|
|
11138
|
+
s$8,
|
|
10969
11139
|
...t.keyVar ? [t.keyVar] : []
|
|
10970
11140
|
]);
|
|
10971
11141
|
this.nodes(t.body, e), n = /* @__PURE__ */ new Set([...n, ...this.setsIn(t.body)]), t.elseBody && this.nodes(t.elseBody, n);
|
|
@@ -11006,7 +11176,7 @@ var a$4 = class {
|
|
|
11006
11176
|
this.expression(e.object, t), this.expression(e.index, t);
|
|
11007
11177
|
return;
|
|
11008
11178
|
case "function":
|
|
11009
|
-
r$4.has(e.name) || this.issues.push(
|
|
11179
|
+
r$4.has(e.name) || this.issues.push(o$9(e.name)), e.args.forEach((e) => this.expression(e, t));
|
|
11010
11180
|
return;
|
|
11011
11181
|
case "filter":
|
|
11012
11182
|
this.expression(e.subject, t), this.filterNames(e.filters.map((e) => e.name));
|
|
@@ -11031,14 +11201,14 @@ var a$4 = class {
|
|
|
11031
11201
|
}
|
|
11032
11202
|
}
|
|
11033
11203
|
};
|
|
11034
|
-
var
|
|
11204
|
+
var l$5 = (e) => {
|
|
11035
11205
|
let r = e$32(e);
|
|
11036
11206
|
if (r.error) return {
|
|
11037
11207
|
issues: [r.error],
|
|
11038
11208
|
freeNames: []
|
|
11039
11209
|
};
|
|
11040
|
-
let i = new
|
|
11041
|
-
return
|
|
11210
|
+
let i = new c$5(), { nodes: a, error: o } = c$14(r.tokens, !1, i.issues);
|
|
11211
|
+
return o && i.issues.push(o), i.nodes(a, /* @__PURE__ */ new Set()), {
|
|
11042
11212
|
issues: [...new Set(i.issues)],
|
|
11043
11213
|
freeNames: [...i.freeNames]
|
|
11044
11214
|
};
|
|
@@ -11083,7 +11253,7 @@ var lintPages = (ctx) => {
|
|
|
11083
11253
|
const { accessLevel, slug, folder } = page.attributes;
|
|
11084
11254
|
if (accessLevel !== void 0 && accessLevel !== "" && !ACCESS_LEVELS.includes(accessLevel)) ctx.error("page-access-level", `${where}: \`accessLevel\` is ${JSON.stringify(accessLevel)}. It is one of ${ACCESS_LEVELS.map((level) => `'${level}'`).join(", ")}.`, pageId);
|
|
11085
11255
|
const path = `/${[typeof folder === "string" && folder ? folderPath(ctx, folder) : "", textOf(slug)].filter(Boolean).join("/")}`;
|
|
11086
|
-
if (
|
|
11256
|
+
if (a$9(path)) ctx.error("page-route-reserved", `${where} answers at ${path}, under /fn — which is where the space's functions answer, never a page. Give it another slug (or its folder another one).`, pageId);
|
|
11087
11257
|
const key = `${path} ${typeof accessLevel === "string" && accessLevel ? accessLevel : "everyone"}`;
|
|
11088
11258
|
const earlier = routes.get(key);
|
|
11089
11259
|
if (earlier !== void 0) ctx.error("page-route-taken", `${where} answers at ${path} for the same visitors as ${earlier}, so one of them can never be reached. Give it another slug — or, for a sign-in page and the page behind it, \`accessLevel\` 'public' on one and 'authenticated' on the other.`, pageId);
|
|
@@ -11167,7 +11337,7 @@ var checkName = (ctx, name, template, where, site, scope, id) => {
|
|
|
11167
11337
|
*/
|
|
11168
11338
|
var checkTemplate = (ctx, template, where, site, scope = /* @__PURE__ */ new Set(), id) => {
|
|
11169
11339
|
if (!e$7(template)) return;
|
|
11170
|
-
const { issues, freeNames } =
|
|
11340
|
+
const { issues, freeNames } = l$5(template);
|
|
11171
11341
|
checkComputedReads(ctx, template, where, site, id);
|
|
11172
11342
|
checkFlagReads(ctx, template, where, id);
|
|
11173
11343
|
for (const [path] of template.matchAll(/(?<![\w.])props\.[A-Za-z_][A-Za-z0-9_]*/g)) checkPropsRead(ctx, path, where, id);
|
|
@@ -11175,6 +11345,7 @@ var checkTemplate = (ctx, template, where, site, scope = /* @__PURE__ */ new Set
|
|
|
11175
11345
|
ctx.error("template-unreadable", `${where}: the template "${shorten$1(template)}" cannot be read as written — ${issues.join("; ")}. The interpreter would skip what it cannot read and render a value nobody wrote.`, id);
|
|
11176
11346
|
return;
|
|
11177
11347
|
}
|
|
11348
|
+
checkActionOutputReads(ctx, template, where, id);
|
|
11178
11349
|
if (!ctx.catalogs.sourceTypes || site.kind === "step") return;
|
|
11179
11350
|
for (const name of freeNames) checkName(ctx, name, template, where, site, scope, id);
|
|
11180
11351
|
};
|
|
@@ -11267,7 +11438,7 @@ var checkAttributes = (ctx, element, where) => {
|
|
|
11267
11438
|
ctx.error("unknown-attribute", `${where} sets "${name}", which a "${type}" never reads${didYouMean(name, names) || "."}${trigger || ` It reads ${names.join(", ")}.`}`, element.id);
|
|
11268
11439
|
continue;
|
|
11269
11440
|
}
|
|
11270
|
-
if (value === void 0 || value === null || typeof value === "string" && n$
|
|
11441
|
+
if (value === void 0 || value === null || typeof value === "string" && n$42(value)) continue;
|
|
11271
11442
|
if (Object.hasOwn(enums, name) && !(typeof value === "string" && enums[name].includes(value))) {
|
|
11272
11443
|
ctx.error("attribute-value", `${where}: \`${name}\` is ${JSON.stringify(value)}${typeof value === "string" && didYouMean(value, enums[name]) || "."} It is one of ${enums[name].map((item) => `'${item}'`).join(", ")}.`, element.id);
|
|
11273
11444
|
continue;
|
|
@@ -11367,10 +11538,10 @@ var checkBindings = (ctx, element, where) => {
|
|
|
11367
11538
|
*/
|
|
11368
11539
|
var checkAttributeTemplates = (ctx, element, where) => {
|
|
11369
11540
|
if (PROSE_TYPES.has(element.definition.type)) return;
|
|
11370
|
-
for (const value of stringsIn$1(element.attributes)) if (e$7(value) && !n$
|
|
11541
|
+
for (const value of stringsIn$1(element.attributes)) if (e$7(value) && !n$42(value)) ctx.warn("template-never-resolved", `${where} carries "${shorten(value)}", which is never resolved: an attribute only reads a name with filters (\`{{ post.slug|upper }}\`). Move the expression into a binding's \`twigTemplate\`, where it is evaluated in full.`, element.id, { value });
|
|
11371
11542
|
const routeParams = ctx.routeParams(element.id);
|
|
11372
11543
|
const scope = ctx.scope(element.id);
|
|
11373
|
-
for (const [name, value] of Object.entries(element.attributes)) if (typeof value === "string" && n$
|
|
11544
|
+
for (const [name, value] of Object.entries(element.attributes)) if (typeof value === "string" && n$42(value)) checkTemplate(ctx, value, `${where}: its "${name}"`, {
|
|
11374
11545
|
kind: "attribute",
|
|
11375
11546
|
routeParams
|
|
11376
11547
|
}, scope, element.id);
|
|
@@ -11572,7 +11743,7 @@ var lintDeclaration = (ctx, name, flag) => {
|
|
|
11572
11743
|
ctx.error("flag-rule-shape", `${at} is ${JSON.stringify(rule)}. A rule is { when: { … }, value: true | false }.`);
|
|
11573
11744
|
return;
|
|
11574
11745
|
}
|
|
11575
|
-
if (!i$
|
|
11746
|
+
if (!i$10(rule.when)) ctx.warn("flag-rule-empty", `${at} has no conditions, so it never decides anything — an unfinished rule is skipped, not read as "always". Give it a condition (\`{ field: 'environment', operator: '=', value: 'staging' }\`), or set the flag's \`value\` instead.`);
|
|
11576
11747
|
});
|
|
11577
11748
|
};
|
|
11578
11749
|
/**
|
|
@@ -11672,13 +11843,13 @@ var checkAction = (ctx, node, where, hostId) => {
|
|
|
11672
11843
|
var checkTriggerKeys = (ctx, node, where, hostId) => {
|
|
11673
11844
|
if (node.action !== "onKey") return;
|
|
11674
11845
|
const { keys } = node.params;
|
|
11675
|
-
const problems = typeof keys === "string" && keys.trim() ? s$
|
|
11846
|
+
const problems = typeof keys === "string" && keys.trim() ? s$11(keys).problems : ["no keys at all"];
|
|
11676
11847
|
if (!problems.length) return;
|
|
11677
11848
|
ctx.error("trigger-keys", `${where} starts a flow on a keyboard shortcut that cannot fire: ${problems.join("; ")}. Write one or several, with commas: \`onKey('f')\`, \`onKey('shift+f')\`, \`onKey('mod+k, escape')\`.`, hostId);
|
|
11678
11849
|
};
|
|
11679
11850
|
/** A repeating flow whose interval cannot repeat: not a whole number of milliseconds, or faster than the floor. */
|
|
11680
11851
|
var checkTriggerInterval = (ctx, node, where, hostId) => {
|
|
11681
|
-
if (node.action !== "onInterval" || n$
|
|
11852
|
+
if (node.action !== "onInterval" || n$16(node.params.interval) !== void 0) return;
|
|
11682
11853
|
ctx.error("trigger-interval", `${where} repeats a flow every ${JSON.stringify(node.params.interval)} ms, which never ticks: an interval is a whole number of milliseconds, at least 250 — \`onInterval(5000)\`.`, hostId);
|
|
11683
11854
|
};
|
|
11684
11855
|
/**
|
|
@@ -12045,7 +12216,7 @@ var f$2 = /* @__PURE__ */ new Set([
|
|
|
12045
12216
|
"loop"
|
|
12046
12217
|
]);
|
|
12047
12218
|
var p$2 = (i) => {
|
|
12048
|
-
if (!e$28(i)) return ["motion is an object: `{ enter:
|
|
12219
|
+
if (!e$28(i)) return ["motion is an object: `{ enter: \"fade-up\", on: \"view\" }`"];
|
|
12049
12220
|
let a = [];
|
|
12050
12221
|
for (let e of Object.keys(i)) f$2.has(e) || a.push(`motion has no "${e}" — it takes enter, on, duration, delay, stagger and loop`);
|
|
12051
12222
|
i.enter !== void 0 && !d$3(t, i.enter) && a.push(`motion.enter is one of ${t.join(", ")}`), i.on !== void 0 && !d$3(n, i.on) && a.push(`motion.on is ${n.slice(0, -1).join(", ")} or ${String(n.at(-1))}`), i.loop !== void 0 && !d$3(r, i.loop) && a.push(`motion.loop is one of ${r.join(", ")}`);
|
|
@@ -12078,7 +12249,7 @@ var lintMotion = (ctx) => {
|
|
|
12078
12249
|
const where = ctx.describe(element.id);
|
|
12079
12250
|
const problems = p$2(motion);
|
|
12080
12251
|
if (problems.length > 0) ctx.error("motion-invalid", `${where} has a motion the page cannot play: ${problems.join("; ")}. For example \`motion: { enter: 'fade-up', on: 'view' }\`.`, element.id);
|
|
12081
|
-
if (
|
|
12252
|
+
if (a$7(element)) ctx.error("motion-no-tag", `${where} has a motion but renders no element of its own (no \`subType\`), so there is nothing to move. Put the motion on what it wraps, or give it a tag.`, element.id);
|
|
12082
12253
|
});
|
|
12083
12254
|
};
|
|
12084
12255
|
//#endregion
|
|
@@ -12444,6 +12615,7 @@ var lintSpace$1 = ({ schema, style }, catalogs = {}) => {
|
|
|
12444
12615
|
lintFlags(ctx);
|
|
12445
12616
|
lintElements(ctx);
|
|
12446
12617
|
lintDataPaths(ctx);
|
|
12618
|
+
lintActionOutputBindings(ctx);
|
|
12447
12619
|
lintAnchors(ctx);
|
|
12448
12620
|
lintMotion(ctx);
|
|
12449
12621
|
lintQuiet(ctx);
|
|
@@ -12552,6 +12724,31 @@ var notificationsCss = (spec) => s$6(checked(spec));
|
|
|
12552
12724
|
/** The space's custom CSS with its notifications' rule after it; refuses a spec that is not sound. */
|
|
12553
12725
|
var withNotificationsCss = (customCss, spec) => c$3(customCss, checked(spec));
|
|
12554
12726
|
//#endregion
|
|
12727
|
+
//#region src/schema/pageFamily.ts
|
|
12728
|
+
/**
|
|
12729
|
+
* Pages of one shape, each from its entry — the docs pages from their list, a menu's sections, a team's profiles.
|
|
12730
|
+
*
|
|
12731
|
+
* A function a space writes for itself does the same, and every space wrote the same one: the id, the slug, the titles,
|
|
12732
|
+
* the folder, the layout, and the prefix every id inside needs, because ids are one namespace for the whole space and
|
|
12733
|
+
* two pages of one shape give the same ones. Here it is once: the entries are data — an array in `src/data/`, typed —
|
|
12734
|
+
* and adding a page is adding an entry. Two entries with one id or one slug are refused as any two pages are.
|
|
12735
|
+
*
|
|
12736
|
+
* For one shape over a collection the visitor browses — a product, a post — a single page with a route param
|
|
12737
|
+
* (`slug: 'posts/:postId'`) reading the record is the answer instead: one page, as many addresses as records, and
|
|
12738
|
+
* nothing to author per record.
|
|
12739
|
+
*/
|
|
12740
|
+
var pageFamily = ({ folder, layout, accessLevel, seoTitle, body }, entries) => entries.map((entry) => ({
|
|
12741
|
+
id: entry.id,
|
|
12742
|
+
name: entry.title,
|
|
12743
|
+
slug: entry.slug,
|
|
12744
|
+
seoTitle: seoTitle ? seoTitle(entry) : entry.title,
|
|
12745
|
+
...entry.description ? { seoDescription: entry.description } : {},
|
|
12746
|
+
...folder ? { folder } : {},
|
|
12747
|
+
...layout ? { layout } : {},
|
|
12748
|
+
...accessLevel ? { accessLevel } : {},
|
|
12749
|
+
body: scope(entry.id, (ref) => body(entry, ref))
|
|
12750
|
+
}));
|
|
12751
|
+
//#endregion
|
|
12555
12752
|
//#region src/schema/refusals.ts
|
|
12556
12753
|
/** What a thrown problem says as a refusal: its code and sentence when it is an `AuthoringError`, its message otherwise. */
|
|
12557
12754
|
var refusalOf = (error) => {
|
|
@@ -12788,7 +12985,7 @@ var n$3 = (n) => {
|
|
|
12788
12985
|
dark: []
|
|
12789
12986
|
};
|
|
12790
12987
|
return Object.entries(r).forEach(([n, r]) => {
|
|
12791
|
-
switch (n$
|
|
12988
|
+
switch (n$19(n) ? n : e$24.CUSTOM) {
|
|
12792
12989
|
case e$24.COLOR:
|
|
12793
12990
|
Object.keys(r).forEach((e) => {
|
|
12794
12991
|
let t = r[e];
|
|
@@ -12825,15 +13022,15 @@ var d = (e, t, n) => {
|
|
|
12825
13022
|
let o = t ? "," : ", ", s = [];
|
|
12826
13023
|
for (let [c, { default: l, states: d, variants: f }] of Object.entries(e)) {
|
|
12827
13024
|
l?.length && s.push(m(`:where(.${c}) &`, l, {}, t, n));
|
|
12828
|
-
for (let [e, o] of o$
|
|
13025
|
+
for (let [e, o] of o$17(d ?? {})) s.push(m(`:where(.${c}${c$10(e)}) &`, o, {}, t, n)), l$6(e) && s.push(p(`:where(.${c}) &`, o, t, n));
|
|
12829
13026
|
for (let [e, l] of Object.entries(f ?? {})) {
|
|
12830
13027
|
if (l.default.length) {
|
|
12831
13028
|
let r = u(`.${c}`, e).join(o);
|
|
12832
13029
|
s.push(m(`:where(${r}) &`, l.default, {}, t, n));
|
|
12833
13030
|
}
|
|
12834
|
-
for (let [d, f] of o$
|
|
12835
|
-
let r = u(`.${c}`, e, c$
|
|
12836
|
-
if (s.push(m(`:where(${r}) &`, f, {}, t, n)), l$
|
|
13031
|
+
for (let [d, f] of o$17(l.states ?? {})) {
|
|
13032
|
+
let r = u(`.${c}`, e, c$10(d)).join(o);
|
|
13033
|
+
if (s.push(m(`:where(${r}) &`, f, {}, t, n)), l$6(d)) {
|
|
12837
13034
|
let r = u(`.${c}`, e).join(o);
|
|
12838
13035
|
s.push(p(`:where(${r}) &`, f, t, n));
|
|
12839
13036
|
}
|
|
@@ -12843,9 +13040,9 @@ var d = (e, t, n) => {
|
|
|
12843
13040
|
return s;
|
|
12844
13041
|
};
|
|
12845
13042
|
var f = (e, t, n, c = !0, l = o$5) => {
|
|
12846
|
-
let { states: u, variants: f, ancestors: h } = n, g = c ? t.join("") : t.map((e) => `${s$4(l + o$5)}${e}`).join("\n").replaceAll(":", ": "), _ = u ? o$
|
|
12847
|
-
let n = m(`&${c$
|
|
12848
|
-
return l$
|
|
13043
|
+
let { states: u, variants: f, ancestors: h } = n, g = c ? t.join("") : t.map((e) => `${s$4(l + o$5)}${e}`).join("\n").replaceAll(":", ": "), _ = u ? o$17(u).flatMap(([e, t]) => {
|
|
13044
|
+
let n = m(`&${c$10(e)}`, t, {}, c, l + o$5);
|
|
13045
|
+
return l$6(e) ? [n, p("&", t, c, l + o$5)] : [n];
|
|
12849
13046
|
}) : [], v = e.replace("plitzi__", ""), y = f ? Object.entries(f).map(([e, t]) => m(`&[data-variant="${e}"]${c ? "," : ", "}&${v}--${e}`, t.default, { states: t.states }, c, l + o$5)) : [], b = h ? d(h, c, l + o$5) : [];
|
|
12850
13047
|
if (c) return `${g}${_.join("")}${y.join("")}${b.join("")}`;
|
|
12851
13048
|
let x = g ? [g] : [];
|
|
@@ -12894,9 +13091,9 @@ var o$4 = (e, t = ":root", n = 2, r = !0) => {
|
|
|
12894
13091
|
};
|
|
12895
13092
|
//#endregion
|
|
12896
13093
|
//#region ../sdk-style/dist/StyleHelper.mjs
|
|
12897
|
-
var s$3 = Object.fromEntries(e$25.map((e) => [e, t$
|
|
13094
|
+
var s$3 = Object.fromEntries(e$25.map((e) => [e, t$24(e)]));
|
|
12898
13095
|
var c = (e) => {
|
|
12899
|
-
if (t$
|
|
13096
|
+
if (t$23(e)) return e$26[e];
|
|
12900
13097
|
let t = e.match(/(\d*\.?\d+)(px|rem)/);
|
|
12901
13098
|
if (!t) return 0;
|
|
12902
13099
|
let r = parseFloat(t[1]);
|
|
@@ -12919,7 +13116,7 @@ var l = (e) => {
|
|
|
12919
13116
|
//#region src/style/properties.ts
|
|
12920
13117
|
/** Every kebab-case CSS property Plitzi's style engine understands. Values written to a definition must use these
|
|
12921
13118
|
* exact keys — camelCase or unknown keys are rejected. */
|
|
12922
|
-
var cssProperties = Array.from(new Set(Object.values(t$
|
|
13119
|
+
var cssProperties = Array.from(new Set(Object.values(t$28))).sort();
|
|
12923
13120
|
var cssPropertySet = new Set(cssProperties);
|
|
12924
13121
|
var isCssProperty = (key) => cssPropertySet.has(key);
|
|
12925
13122
|
var toKebab = (key) => key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
@@ -15591,7 +15788,7 @@ var declarationsIn = (body) => splitTopLevel(body, ";").flatMap((declaration) =>
|
|
|
15591
15788
|
});
|
|
15592
15789
|
//#endregion
|
|
15593
15790
|
//#region src/decompile/customCss.ts
|
|
15594
|
-
var STATE_SET$1 = new Set(STYLE_STATES.filter((state) => state === "current" || c$
|
|
15791
|
+
var STATE_SET$1 = new Set(STYLE_STATES.filter((state) => state === "current" || c$10(state) === `:${state}`));
|
|
15595
15792
|
/** `[aria-current="page"]`, in either quotes, written as the state it is, so one pattern reads every state. */
|
|
15596
15793
|
var asStateNames = (selector) => selector.replaceAll(/\[aria-current=(["'])page\1\]/g, ":current");
|
|
15597
15794
|
var isStyleState$1 = (state) => STATE_SET$1.has(state);
|
|
@@ -15741,6 +15938,160 @@ var suggestCustomCss = (schema, style) => {
|
|
|
15741
15938
|
return suggestions;
|
|
15742
15939
|
};
|
|
15743
15940
|
//#endregion
|
|
15941
|
+
//#region src/schema/advice/declarations.ts
|
|
15942
|
+
/**
|
|
15943
|
+
* What a space declares and nothing reads, and what it says by hand where it has a name for it — the drift a big space
|
|
15944
|
+
* gathers as it is edited: a class kept after the last element wearing it went, a token nobody points at, a colour
|
|
15945
|
+
* written out where its token was meant, a component no page places.
|
|
15946
|
+
*
|
|
15947
|
+
* Two tokens of one value are not among them: `background` and `on-primary` may agree today and mean different things.
|
|
15948
|
+
*
|
|
15949
|
+
* Each is read generously, so a suggestion is never wrong: a name counts as used wherever it appears as a word — in an
|
|
15950
|
+
* element, a binding, a flow, another class's `ancestors`, `customCss` — even where it may only be prose.
|
|
15951
|
+
*/
|
|
15952
|
+
var NAME = /[\w-]+/g;
|
|
15953
|
+
/** Every word the space's documents say outside the declaration being asked about. */
|
|
15954
|
+
var wordsOf = (...texts) => new Set(texts.flatMap((text) => text.match(NAME) ?? []));
|
|
15955
|
+
var TOKEN_USE = /var\(\s*--([\w-]+)/g;
|
|
15956
|
+
var tokensRead = (...texts) => new Set(texts.flatMap((text) => Array.from(text.matchAll(TOKEN_USE), (match) => match[1])));
|
|
15957
|
+
var list$1 = (names, limit = 6) => `${names.slice(0, limit).map((name) => `\`${name}\``).join(", ")}${names.length > limit ? `, and ${String(names.length - limit)} more` : ""}`;
|
|
15958
|
+
var plural = (count, one, many) => count === 1 ? one : many;
|
|
15959
|
+
/**
|
|
15960
|
+
* The space's own classes, and for every word the stylesheet says, which of its items say it — so a class named only in
|
|
15961
|
+
* its own rules (at another breakpoint, say) is not taken for one another class's `ancestors` names.
|
|
15962
|
+
*/
|
|
15963
|
+
var classesOf$1 = (style) => {
|
|
15964
|
+
const items = Object.values(style.platform).flatMap((byName) => Object.values(byName));
|
|
15965
|
+
const namedBy = /* @__PURE__ */ new Map();
|
|
15966
|
+
for (const item of items) for (const word of wordsOf(JSON.stringify(item.attributes))) namedBy.set(word, /* @__PURE__ */ new Set([...namedBy.get(word) ?? [], item.name]));
|
|
15967
|
+
return {
|
|
15968
|
+
names: new Set(items.filter((item) => item.type === "class").map((item) => item.name)),
|
|
15969
|
+
namedBy
|
|
15970
|
+
};
|
|
15971
|
+
};
|
|
15972
|
+
var unusedClassNames = (schema, style) => {
|
|
15973
|
+
const { names, namedBy } = classesOf$1(style);
|
|
15974
|
+
if (names.size === 0) return [];
|
|
15975
|
+
const schemaWords = wordsOf(JSON.stringify(schema));
|
|
15976
|
+
return [...names].filter((name) => !schemaWords.has(name) && ![...namedBy.get(name) ?? []].some((item) => item !== name)).sort();
|
|
15977
|
+
};
|
|
15978
|
+
var unusedClasses = (unused) => {
|
|
15979
|
+
if (unused.length === 0) return [];
|
|
15980
|
+
return [{
|
|
15981
|
+
code: "unused-class",
|
|
15982
|
+
elementIds: [],
|
|
15983
|
+
subjects: unused,
|
|
15984
|
+
saves: 0,
|
|
15985
|
+
message: `${String(unused.length)} ${plural(unused.length, "class is", "classes are")} declared and worn by nothing — no element, binding, flow or other class names ${plural(unused.length, "it", "them")}: ${list$1(unused)}. Remove ${plural(unused.length, "it", "them")} from \`classes\`; a class kept "for later" is one the next reader has to check is safe to change.`
|
|
15986
|
+
}];
|
|
15987
|
+
};
|
|
15988
|
+
var HEX = /^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/;
|
|
15989
|
+
/** A colour as one text whatever way it was written: `#ABC` and `#aabbcc` are one, so are `rgb(1,2,3)` and `rgb(1, 2, 3)`. */
|
|
15990
|
+
var normalColour = (text) => {
|
|
15991
|
+
const lower = text.trim().toLowerCase().replace(/\s+/g, "");
|
|
15992
|
+
const hex = HEX.exec(lower)?.[1];
|
|
15993
|
+
if (hex && hex.length <= 4) return `#${hex.replace(/./g, (digit) => digit + digit)}`;
|
|
15994
|
+
return lower;
|
|
15995
|
+
};
|
|
15996
|
+
var tokensOf$1 = (style) => Object.values(style.variables).flatMap((group) => Object.entries(group).map(([name, value]) => ({
|
|
15997
|
+
name,
|
|
15998
|
+
value
|
|
15999
|
+
})));
|
|
16000
|
+
var unusedTokenNames = (schema, style) => {
|
|
16001
|
+
const tokens = tokensOf$1(style);
|
|
16002
|
+
if (tokens.length === 0) return [];
|
|
16003
|
+
const items = Object.values(style.platform).flatMap((byName) => Object.values(byName));
|
|
16004
|
+
const read = tokensRead(JSON.stringify(schema), ...items.map((item) => JSON.stringify(item.attributes)), ...items.map((item) => JSON.stringify(item.variables ?? {})), JSON.stringify(style.variables), JSON.stringify(style.fonts ?? []));
|
|
16005
|
+
return tokens.map((token) => token.name).filter((name) => !read.has(name)).sort();
|
|
16006
|
+
};
|
|
16007
|
+
var unusedTokens = (unused) => {
|
|
16008
|
+
if (unused.length === 0) return [];
|
|
16009
|
+
return [{
|
|
16010
|
+
code: "unused-token",
|
|
16011
|
+
elementIds: [],
|
|
16012
|
+
subjects: unused,
|
|
16013
|
+
saves: 0,
|
|
16014
|
+
message: `${String(unused.length)} ${plural(unused.length, "token is", "tokens are")} declared and read nowhere — no \`var(--…)\` in a class, an element, \`customCss\` or another token: ${list$1(unused)}. Remove ${plural(unused.length, "it", "them")} from \`variables\`, or use ${plural(unused.length, "it", "them")} where a colour is written out instead.`
|
|
16015
|
+
}];
|
|
16016
|
+
};
|
|
16017
|
+
var ABSOLUTE = /* @__PURE__ */ new Set([
|
|
16018
|
+
"#ffffff",
|
|
16019
|
+
"#ffffffff",
|
|
16020
|
+
"#000000",
|
|
16021
|
+
"#000000ff",
|
|
16022
|
+
"rgb(255,255,255)",
|
|
16023
|
+
"rgb(0,0,0)"
|
|
16024
|
+
]);
|
|
16025
|
+
var COLOUR_LITERAL = /#(?:[\da-fA-F]{8}|[\da-fA-F]{6}|[\da-fA-F]{3,4})\b|(?:rgba?|hsla?)\([^)]*\)/g;
|
|
16026
|
+
/** Every string value in a style item's attributes, at any depth: states, variants, ancestors, breakpoints. */
|
|
16027
|
+
var stringsOf = (value) => {
|
|
16028
|
+
if (typeof value === "string") return [value];
|
|
16029
|
+
if (value && typeof value === "object") return Object.values(value).flatMap(stringsOf);
|
|
16030
|
+
return [];
|
|
16031
|
+
};
|
|
16032
|
+
var literalColours = (style) => {
|
|
16033
|
+
const tokenOf = /* @__PURE__ */ new Map();
|
|
16034
|
+
for (const { name, value } of tokensOf$1(style)) {
|
|
16035
|
+
if (typeof value !== "object" || !value.light || !value.dark) continue;
|
|
16036
|
+
const light = normalColour(value.light);
|
|
16037
|
+
if (light !== normalColour(value.dark) && !light.startsWith("var(") && !ABSOLUTE.has(light)) tokenOf.set(light, name);
|
|
16038
|
+
}
|
|
16039
|
+
if (tokenOf.size === 0) return [];
|
|
16040
|
+
const colourTokens = new Set(Object.keys(style.variables.color ?? {}));
|
|
16041
|
+
const paintedFromPalette = (text) => Array.from(text.matchAll(TOKEN_USE), (match) => match[1]).some((name) => colourTokens.has(name));
|
|
16042
|
+
const written = /* @__PURE__ */ new Map();
|
|
16043
|
+
for (const [, byName] of Object.entries(style.platform)) for (const item of Object.values(byName)) {
|
|
16044
|
+
if (!paintedFromPalette(JSON.stringify(item.attributes))) continue;
|
|
16045
|
+
for (const text of stringsOf(item.attributes)) for (const literal of text.match(COLOUR_LITERAL) ?? []) {
|
|
16046
|
+
const token = tokenOf.get(normalColour(literal));
|
|
16047
|
+
if (token) written.set(token, /* @__PURE__ */ new Set([...written.get(token) ?? [], item.name]));
|
|
16048
|
+
}
|
|
16049
|
+
}
|
|
16050
|
+
if (written.size === 0) return [];
|
|
16051
|
+
const uses = [...written.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
16052
|
+
return [{
|
|
16053
|
+
code: "literal-colour",
|
|
16054
|
+
elementIds: [],
|
|
16055
|
+
subjects: uses.flatMap(([token, items]) => [...items].map((item) => `${item}:${token}`)),
|
|
16056
|
+
saves: 0,
|
|
16057
|
+
message: `A class painted from the palette writes a colour out that is a token's light value: ${uses.slice(0, 5).map(([token, items]) => `\`--${token}\` in ${list$1([...items], 3)}`).join("; ")}${uses.length > 5 ? "; …" : ""}. In the dark scheme the literal stays put while the palette moves. Write \`var(--token)\` when it should follow; when it must stay — dark words on a light chip in both schemes — name it: a token of one value (\`ink-on-chip: '#14131a'\`), so the next reader knows it is meant.`
|
|
16058
|
+
}];
|
|
16059
|
+
};
|
|
16060
|
+
var unusedComponentIds = (schema) => {
|
|
16061
|
+
const ids = Object.keys(schema.components);
|
|
16062
|
+
if (ids.length === 0) return [];
|
|
16063
|
+
const placed = new Set([schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat)).filter((element) => element.definition.type === "reference").map((element) => element.attributes.referenceId).filter((id) => typeof id === "string"));
|
|
16064
|
+
return ids.filter((id) => !placed.has(id)).sort();
|
|
16065
|
+
};
|
|
16066
|
+
var unusedComponents = (schema, unused) => {
|
|
16067
|
+
if (unused.length === 0) return [];
|
|
16068
|
+
return [{
|
|
16069
|
+
code: "unused-component",
|
|
16070
|
+
elementIds: [],
|
|
16071
|
+
subjects: unused,
|
|
16072
|
+
saves: unused.reduce((total, id) => total + Object.keys(schema.components[id].flat).length, 0),
|
|
16073
|
+
message: `${String(unused.length)} ${plural(unused.length, "component is", "components are")} declared and placed on no page, layout or other component: ${list$1(unused)}. Remove ${plural(unused.length, "it", "them")} from \`components\` — the builder still lists a component nobody uses, and every reader wonders where it shows.`
|
|
16074
|
+
}];
|
|
16075
|
+
};
|
|
16076
|
+
/**
|
|
16077
|
+
* What a space declares and nothing uses — its classes, tokens and components — by the one rule the suggestions, the
|
|
16078
|
+
* builder's Usages panel and anything else that says "unused" read, so they never disagree.
|
|
16079
|
+
*/
|
|
16080
|
+
var unusedDeclarations = (schema, style) => ({
|
|
16081
|
+
classes: unusedClassNames(schema, style),
|
|
16082
|
+
tokens: unusedTokenNames(schema, style),
|
|
16083
|
+
components: unusedComponentIds(schema)
|
|
16084
|
+
});
|
|
16085
|
+
var suggestDeclarations = (schema, style) => {
|
|
16086
|
+
const unused = unusedDeclarations(schema, style);
|
|
16087
|
+
return [
|
|
16088
|
+
...unusedComponents(schema, unused.components),
|
|
16089
|
+
...unusedClasses(unused.classes),
|
|
16090
|
+
...unusedTokens(unused.tokens),
|
|
16091
|
+
...literalColours(style)
|
|
16092
|
+
];
|
|
16093
|
+
};
|
|
16094
|
+
//#endregion
|
|
15744
16095
|
//#region src/schema/advice/motion.ts
|
|
15745
16096
|
/** What the compositor animates alone — and the two a keyframe may say about its own timing. */
|
|
15746
16097
|
var COMPOSITED = /* @__PURE__ */ new Set([
|
|
@@ -16106,9 +16457,10 @@ var quietCodes = (schema) => new Map([schema.flat, ...Object.values(schema.compo
|
|
|
16106
16457
|
* Not the linter. `lintSpace` reports what renders something other than what was written, and a space is refused or
|
|
16107
16458
|
* warned for it; nothing here is wrong — the page renders exactly as written. These are the platform's own ways to say
|
|
16108
16459
|
* it once instead of many times (layouts, components, lists, an element's own `content`, a class's states, the SDK's
|
|
16109
|
-
* defaults)
|
|
16110
|
-
* that did not know them, or a person who has not met them yet.
|
|
16111
|
-
* elements say how many it saves, which is what they are ranked
|
|
16460
|
+
* defaults), to move it cheaply (the compositor's properties), and what it declares and never uses or says twice —
|
|
16461
|
+
* offered to whoever wrote it the long way: an agent that did not know them, or a person who has not met them yet.
|
|
16462
|
+
* Each names what to write instead, and the ones about elements say how many it saves, which is what they are ranked
|
|
16463
|
+
* by.
|
|
16112
16464
|
*/
|
|
16113
16465
|
var suggestSpace = ({ schema, style }) => {
|
|
16114
16466
|
const quiets = quietCodes(schema);
|
|
@@ -16116,7 +16468,8 @@ var suggestSpace = ({ schema, style }) => {
|
|
|
16116
16468
|
...suggestRepeats(schema, style),
|
|
16117
16469
|
...suggestContent(schema, style),
|
|
16118
16470
|
...suggestCustomCss(schema, style),
|
|
16119
|
-
...suggestMotion(schema, style)
|
|
16471
|
+
...suggestMotion(schema, style),
|
|
16472
|
+
...suggestDeclarations(schema, style)
|
|
16120
16473
|
].filter((suggestion) => !suggestion.elementIds.some((id) => quiets.get(id)?.includes(suggestion.code) === true)).sort((a, b) => b.saves - a.saves);
|
|
16121
16474
|
};
|
|
16122
16475
|
//#endregion
|
|
@@ -16344,7 +16697,7 @@ var o$3 = (i, a) => {
|
|
|
16344
16697
|
}, E = () => {
|
|
16345
16698
|
let e = /* @__PURE__ */ new Set();
|
|
16346
16699
|
_().forEach((t) => {
|
|
16347
|
-
let n = n$
|
|
16700
|
+
let n = n$10(g, t);
|
|
16348
16701
|
n.length === 0 || e.has(n[0]) || (n.forEach((t) => e.add(t)), s.push({
|
|
16349
16702
|
code: "LAYOUT_CYCLE",
|
|
16350
16703
|
message: `Layouts sit inside each other in a circle: ${n.join(" → ")}`,
|
|
@@ -16396,7 +16749,7 @@ var o$3 = (i, a) => {
|
|
|
16396
16749
|
});
|
|
16397
16750
|
}, k = () => {
|
|
16398
16751
|
Object.values(l).forEach((t) => {
|
|
16399
|
-
t && (t$
|
|
16752
|
+
t && (t$26(t.id) || s.push({
|
|
16400
16753
|
code: "INVALID_ELEMENT_ID",
|
|
16401
16754
|
message: `Element "${t.id}" has a name that must start with a letter, then letters, numbers, hyphens and underscores (no hyphen or underscore at the start, and no hyphen at the end)`,
|
|
16402
16755
|
elementId: t.id
|
|
@@ -16448,7 +16801,7 @@ var o$3 = (i, a) => {
|
|
|
16448
16801
|
if (!r) return;
|
|
16449
16802
|
let i = Object.keys(r);
|
|
16450
16803
|
Object.entries(r).forEach(([r, a]) => {
|
|
16451
|
-
t$
|
|
16804
|
+
t$26(r) || s.push({
|
|
16452
16805
|
code: "INVALID_INTERACTION_ID",
|
|
16453
16806
|
message: `Interaction "${r}" on element "${n.id}" has a name that must start with a letter, then letters, numbers, hyphens and underscores — a later step reads it as {{ ${r}.field }}`,
|
|
16454
16807
|
elementId: n.id
|
|
@@ -16511,7 +16864,7 @@ var o$3 = (i, a) => {
|
|
|
16511
16864
|
code: "COMPONENT_ID_MISMATCH",
|
|
16512
16865
|
message: `${d} has id "${l.id}"`,
|
|
16513
16866
|
componentId: t
|
|
16514
|
-
}), t$
|
|
16867
|
+
}), t$26(t) || s.push({
|
|
16515
16868
|
code: "INVALID_COMPONENT_ID",
|
|
16516
16869
|
message: `${d} has a name that must start with a letter, then letters, numbers, hyphens and underscores`,
|
|
16517
16870
|
componentId: t
|
|
@@ -16539,7 +16892,7 @@ var o$3 = (i, a) => {
|
|
|
16539
16892
|
componentId: t
|
|
16540
16893
|
});
|
|
16541
16894
|
}), Object.keys(l.props ?? {}).forEach((e) => {
|
|
16542
|
-
let r = c$
|
|
16895
|
+
let r = c$8(e);
|
|
16543
16896
|
r && s.push({
|
|
16544
16897
|
code: "INVALID_COMPONENT_PROP",
|
|
16545
16898
|
message: `${d}: ${r}`,
|
|
@@ -16657,7 +17010,7 @@ var validateStyle = (style) => {
|
|
|
16657
17010
|
};
|
|
16658
17011
|
/** Style the page will never show: on an element that renders nothing of its own. Needs both documents. */
|
|
16659
17012
|
var validateStyleTargets = (schema, style) => Object.values(schema.flat).flatMap((element) => {
|
|
16660
|
-
const issue =
|
|
17013
|
+
const issue = o$12(element, style);
|
|
16661
17014
|
return issue ? [{
|
|
16662
17015
|
code: "STYLE_WITHOUT_TAG",
|
|
16663
17016
|
message: `Element "${element.id}" ${issue}`,
|
|
@@ -17254,7 +17607,7 @@ var SpaceAuthor = class {
|
|
|
17254
17607
|
throw new AuthoringError("controls-unknown", `Button "${element.id}" controls "${controls}", which is no element of the space${didYouMean(controls, Object.keys(flat)) || "."} Name the element it shows and hides by its id: \`controls: 'faq-answer'\`.`);
|
|
17255
17608
|
}
|
|
17256
17609
|
const target = flat[controls];
|
|
17257
|
-
const anchor = target.definition.anchor ??
|
|
17610
|
+
const anchor = target.definition.anchor ?? n$11(target.id);
|
|
17258
17611
|
target.definition.anchor = anchor;
|
|
17259
17612
|
element.attributes.controls = anchor;
|
|
17260
17613
|
}
|
|
@@ -17295,11 +17648,11 @@ var SpaceAuthor = class {
|
|
|
17295
17648
|
const where = `Component "${component.id}"`;
|
|
17296
17649
|
assertKnownKeys(component, COMPONENT_SPEC_KEYS, where);
|
|
17297
17650
|
const id = component.id;
|
|
17298
|
-
if (typeof id !== "string" || !t$
|
|
17651
|
+
if (typeof id !== "string" || !t$26(id)) throw new AuthoringError("component-id", `${where} needs an \`id\` that starts with a letter, then letters, numbers, hyphens and underscores — it is the name an instance places it by: \`component('${String(id)}')\`.`);
|
|
17299
17652
|
if (componentIds.has(component.id)) throw new AuthoringError("component-duplicate", `Two components are called "${component.id}". A component's id is the one name it is placed by.`);
|
|
17300
17653
|
componentIds.add(component.id);
|
|
17301
17654
|
for (const name of Object.keys(component.props ?? {})) {
|
|
17302
|
-
const problem = c$
|
|
17655
|
+
const problem = c$8(name);
|
|
17303
17656
|
if (problem) throw new AuthoringError("prop-name", `${where}: ${problem}.`);
|
|
17304
17657
|
}
|
|
17305
17658
|
}
|
|
@@ -17334,7 +17687,7 @@ var SpaceAuthor = class {
|
|
|
17334
17687
|
assertChannels() {
|
|
17335
17688
|
if (this.spec.settings?.channels !== void 0) throw new AuthoringError("setting-misplaced", "`settings.channels` is written through `channels` at the top of the space, not inside `settings`.");
|
|
17336
17689
|
for (const [pattern, declaration] of Object.entries(this.spec.channels ?? {})) {
|
|
17337
|
-
const [problem] = c$
|
|
17690
|
+
const [problem] = c$7(pattern, declaration);
|
|
17338
17691
|
if (problem) throw new AuthoringError("channel-declaration", `Channel "${pattern}": ${problem}.`);
|
|
17339
17692
|
}
|
|
17340
17693
|
}
|
|
@@ -17395,7 +17748,7 @@ var SpaceAuthor = class {
|
|
|
17395
17748
|
}
|
|
17396
17749
|
/** The element about to be placed under `parentId`, and everything that one is nested in. */
|
|
17397
17750
|
ancestorsOf(parentId, flat) {
|
|
17398
|
-
return Object.hasOwn(flat, parentId) ? /* @__PURE__ */ new Set([parentId, ...t$
|
|
17751
|
+
return Object.hasOwn(flat, parentId) ? /* @__PURE__ */ new Set([parentId, ...t$25(flat, parentId)]) : /* @__PURE__ */ new Set();
|
|
17399
17752
|
}
|
|
17400
17753
|
/**
|
|
17401
17754
|
* Where a page's ids are derived from — its slug, unless another page already claimed it.
|
|
@@ -17564,7 +17917,7 @@ var SpaceAuthor = class {
|
|
|
17564
17917
|
if (!target) throw new AuthoringError("component-undeclared", `${where} places component "${String(componentId)}", which this space does not declare${typeof componentId === "string" ? didYouMean(componentId, declared.map((candidate) => candidate.id)) || "." : "."} Declare it in \`components\`.`);
|
|
17565
17918
|
const props = target.props ?? {};
|
|
17566
17919
|
const names = Object.keys(props);
|
|
17567
|
-
const given = Object.fromEntries(Object.entries(spec.attributes ?? {}).filter(([name]) => !o$
|
|
17920
|
+
const given = Object.fromEntries(Object.entries(spec.attributes ?? {}).filter(([name]) => !o$15.has(name)));
|
|
17568
17921
|
for (const name of Object.keys(given)) if (!names.includes(name)) throw new AuthoringError("prop-unknown", `${where} hands component "${target.id}" "${name}", which it does not declare${didYouMean(name, names) || "."} It declares ${names.length > 0 ? names.join(", ") : "no props"}.`);
|
|
17569
17922
|
const bound = new Set(spec.bind === void 0 ? [] : toBindingSpecs(spec.bind).map((binding) => binding.to));
|
|
17570
17923
|
for (const [name, prop] of Object.entries(props)) if (prop.required && given[name] === void 0 && !bound.has(name)) throw new AuthoringError("prop-missing", `${where} places component "${target.id}" without "${name}", which it requires${prop.description ? ` — ${prop.description}` : ""}. Hand it in: \`component('${target.id}', { props: { ${name}: … } })\`, or bind it.`);
|
|
@@ -17848,7 +18201,7 @@ var SpaceAuthor = class {
|
|
|
17848
18201
|
named: spec.id !== void 0,
|
|
17849
18202
|
...conditional ? { conditional: true } : {},
|
|
17850
18203
|
...[...ancestors].some((ancestor) => REPEATING_TYPES.has(tree.map.flat[ancestor].definition.type)) ? { repeated: true } : {},
|
|
17851
|
-
...
|
|
18204
|
+
...a$7(element) || this.drawsNothing(element) ? { boxless: true } : {}
|
|
17852
18205
|
});
|
|
17853
18206
|
(spec.row === void 0 ? spec.children : this.rowChildren(spec, spec.row, id, where))?.forEach((child, index) => this.addElement(child, `${path}/${index}`, placeOf(child, place, index), ownRootId, id, conditional, tree));
|
|
17854
18207
|
return id;
|
|
@@ -18116,7 +18469,7 @@ var validateSnippet$1 = (snippet, options = {}) => {
|
|
|
18116
18469
|
}));
|
|
18117
18470
|
const { errors: spaceErrors, warnings } = validateSpace$1({
|
|
18118
18471
|
schema: {
|
|
18119
|
-
...r$
|
|
18472
|
+
...r$20.schema,
|
|
18120
18473
|
...schema
|
|
18121
18474
|
},
|
|
18122
18475
|
style
|
|
@@ -18371,7 +18724,7 @@ var categoryOf = (variable) => {
|
|
|
18371
18724
|
/** The name an element carried beside its id before the id became the name, where it carries a usable one. */
|
|
18372
18725
|
var idRefOf = (element) => {
|
|
18373
18726
|
const stored = element;
|
|
18374
|
-
if (!e$28(stored) || typeof stored.idRef !== "string" || !t$
|
|
18727
|
+
if (!e$28(stored) || typeof stored.idRef !== "string" || !t$26(stored.idRef)) return;
|
|
18375
18728
|
return stored.idRef;
|
|
18376
18729
|
};
|
|
18377
18730
|
/**
|
|
@@ -18387,7 +18740,7 @@ var idRefOf = (element) => {
|
|
|
18387
18740
|
var withNamedIds = (schema) => {
|
|
18388
18741
|
const stale = Object.values(schema.flat).filter((element) => {
|
|
18389
18742
|
const idRef = idRefOf(element);
|
|
18390
|
-
return idRef ? idRef !== element.id : !t$
|
|
18743
|
+
return idRef ? idRef !== element.id : !t$26(element.id);
|
|
18391
18744
|
});
|
|
18392
18745
|
if (stale.length === 0) return {
|
|
18393
18746
|
schema,
|
|
@@ -18398,7 +18751,7 @@ var withNamedIds = (schema) => {
|
|
|
18398
18751
|
const isTaken = (candidate) => taken.has(candidate);
|
|
18399
18752
|
const renames = stale.map((element) => {
|
|
18400
18753
|
const idRef = idRefOf(element);
|
|
18401
|
-
const to = idRef ? u$6(idRef, isTaken) : l$
|
|
18754
|
+
const to = idRef ? u$6(idRef, isTaken) : l$8(element.definition.type, isTaken);
|
|
18402
18755
|
taken.add(to);
|
|
18403
18756
|
return {
|
|
18404
18757
|
from: element.id,
|
|
@@ -20725,6 +21078,7 @@ var BUILDER_SIGNATURES = {
|
|
|
20725
21078
|
resetForm: "resetForm('form-id')",
|
|
20726
21079
|
setFieldValue: "setFieldValue('form-id', 'field', value)",
|
|
20727
21080
|
reloadApi: "reloadApi('provider-id', input?)",
|
|
21081
|
+
cancelApi: "cancelApi('provider-id')",
|
|
20728
21082
|
openModal: "openModal('modal-id', data?)",
|
|
20729
21083
|
closeModal: "closeModal('modal-id')",
|
|
20730
21084
|
openDialog: "openDialog('dialog-id', data?)",
|
|
@@ -20777,6 +21131,11 @@ var AUTHORING_HELPERS = {
|
|
|
20777
21131
|
summary: "Runs a step only when a rule holds — what is conditional in a flow is said on its steps, not by branching.",
|
|
20778
21132
|
example: "when({ field: 'saved.ok', operator: '=', value: true }, navigate({ to: 'thanks' }))"
|
|
20779
21133
|
},
|
|
21134
|
+
whileRunning: {
|
|
21135
|
+
signature: "whileRunning('skip' | 'queue' | 'parallel' | 'latest', trigger)",
|
|
21136
|
+
summary: "What a trigger does when it fires again while its flow still runs: ignore it (the default), queue it, run both, or stop the running one and run the new — `latest`, for a search as you type.",
|
|
21137
|
+
example: "[whileRunning('latest', named('typed', on('onChange'))), runServerAction({ … })]"
|
|
21138
|
+
},
|
|
20780
21139
|
named: {
|
|
20781
21140
|
signature: "named(id, step)",
|
|
20782
21141
|
summary: "Names a step, so a later one reads what it produced: `{{ <id>.field }}`.",
|
|
@@ -20856,8 +21215,11 @@ var BUILDER_NAMES = {
|
|
|
20856
21215
|
setState: "updateElement",
|
|
20857
21216
|
toggleState: "toggleElement",
|
|
20858
21217
|
performQuery: "reloadApi",
|
|
21218
|
+
cancelQuery: "cancelApi",
|
|
20859
21219
|
delayTime: "delay"
|
|
20860
21220
|
};
|
|
21221
|
+
/** The step a builder writes when the builder is not named after it: `reloadApi` is how `performQuery` is written. */
|
|
21222
|
+
var stepOfBuilder = (name) => Object.entries(BUILDER_NAMES).find(([, builder]) => builder === name)?.[0];
|
|
20861
21223
|
var builderOf = (action, type) => {
|
|
20862
21224
|
const named = type === "globalCallback" ? action : BUILDER_NAMES[action] ?? action;
|
|
20863
21225
|
return builders.has(named) ? named : void 0;
|
|
@@ -20958,6 +21320,7 @@ var explain = (name) => {
|
|
|
20958
21320
|
const trigger = explainTrigger(name);
|
|
20959
21321
|
const transformer = Object.hasOwn(BUILTIN_TRANSFORMERS, name) ? BUILTIN_TRANSFORMERS[name] : void 0;
|
|
20960
21322
|
const helper = Object.hasOwn(HELPERS, name) ? HELPERS[name] : void 0;
|
|
21323
|
+
const builtStep = stepOfBuilder(name);
|
|
20961
21324
|
return [
|
|
20962
21325
|
...code ? [{
|
|
20963
21326
|
kind: "code",
|
|
@@ -20969,6 +21332,7 @@ var explain = (name) => {
|
|
|
20969
21332
|
...element ? [element] : [],
|
|
20970
21333
|
...trigger ? [trigger] : [],
|
|
20971
21334
|
...explainSteps(name),
|
|
21335
|
+
...builtStep ? explainSteps(builtStep) : [],
|
|
20972
21336
|
...transformer ? [{
|
|
20973
21337
|
kind: "transformer",
|
|
20974
21338
|
name,
|
|
@@ -21608,7 +21972,7 @@ var importedFiles = ({ probes, dark }) => {
|
|
|
21608
21972
|
const css = Object.fromEntries(ranges.filter(([, rules]) => Object.keys(rules).length > 0).map(([mode, rules]) => [mode, rulesOf(rules)]));
|
|
21609
21973
|
const listFile = listFiles.get(node.path);
|
|
21610
21974
|
const id = elementId(node.id ?? (listFile ? `${listFile}-item` : node.heading), node.tag === "div" ? "block" : node.tag);
|
|
21611
|
-
if (!t$
|
|
21975
|
+
if (!t$26(id)) throw new Error(`importedFiles: "${id}" is not a valid element id.`);
|
|
21612
21976
|
const props = {
|
|
21613
21977
|
id,
|
|
21614
21978
|
subType: SUB_TYPES.has(node.tag) ? node.tag : void 0,
|
|
@@ -21732,83 +22096,165 @@ var importedFiles = ({ probes, dark }) => {
|
|
|
21732
22096
|
};
|
|
21733
22097
|
};
|
|
21734
22098
|
//#endregion
|
|
21735
|
-
//#region src/spaces/blank/
|
|
22099
|
+
//#region src/spaces/blank/content.ts?raw
|
|
22100
|
+
var content_default = "import type { Tone } from './theme.ts';\n\n/**\n * What the page says, as data: the docs it points to, the three ways to change it and the guides to read on. Each band\n * is one of these lists mapped through one function of `index.ts` — add an entry and a card appears, styled like the\n * rest.\n */\n\n/** Where the documentation lives. Every link on the page starts here, so moving the docs is one line. */\nexport const DOCS = 'https://plitzi.com/docs';\n\nexport type Path = { id: string; title: string; body: string; path: string; icon: string; tone: Tone };\n\n/**\n * The three ways to change this page — the builder, code, an agent — as data: the band is this list, mapped. They\n * are the same space either way, so any one of them can be put down and another picked up.\n */\nexport const PATHS: (Path & { command?: string })[] = [\n {\n id: 'path-builder',\n title: 'In the builder',\n body: 'Select anything on this page and change it: drag elements in, style them, wire them to data, and publish.',\n path: 'elements',\n icon: 'fas fa-pen-ruler',\n tone: 'violet'\n },\n {\n id: 'path-code',\n title: 'In code',\n body: 'The same space as TypeScript, in a project of your own — served by your server, or pushed back here.',\n path: 'cli',\n icon: 'fas fa-code',\n tone: 'cyan',\n command: 'npx @plitzi/cli create my-site'\n },\n {\n id: 'path-agent',\n title: 'With an agent',\n body: 'Connect Claude or any MCP client. It reads and edits this space under the same rules as you do.',\n path: 'agents',\n icon: 'fas fa-robot',\n tone: 'blue'\n }\n];\n\n/** Where to read on, as data: the grid below is this list, mapped. Each one is a page of the docs. */\nexport const GUIDES: Path[] = [\n {\n id: 'concepts',\n title: 'Core concepts',\n body: 'Spaces, pages, elements, and who owns what.',\n path: 'concepts',\n icon: 'fas fa-shapes',\n tone: 'violet'\n },\n {\n id: 'authoring',\n title: 'A space in code',\n body: 'One declaration in, two documents out.',\n path: 'authoring',\n icon: 'fas fa-code',\n tone: 'cyan'\n },\n {\n id: 'styling',\n title: 'Styling and themes',\n body: 'Classes, states, breakpoints, light and dark.',\n path: 'styling',\n icon: 'fas fa-palette',\n tone: 'rose'\n },\n {\n id: 'data',\n title: 'Data and bindings',\n body: 'Fetch from an API, show it anywhere.',\n path: 'data',\n icon: 'fas fa-database',\n tone: 'emerald'\n },\n {\n id: 'interactions',\n title: 'Interactions and flows',\n body: 'Clicks and forms wired to steps, no code.',\n path: 'interactions',\n icon: 'fas fa-bolt',\n tone: 'amber'\n },\n {\n id: 'quickstart',\n title: 'Quickstart',\n body: 'From a new space to a published site.',\n path: 'quickstart',\n icon: 'fas fa-flag-checkered',\n tone: 'blue'\n }\n];\n";
|
|
22101
|
+
//#endregion
|
|
22102
|
+
//#region src/spaces/blank/content.ts
|
|
21736
22103
|
/**
|
|
21737
|
-
*
|
|
21738
|
-
*
|
|
21739
|
-
*
|
|
21740
|
-
* back-references between them — is derived from what is written here, so authoring it twice writes byte-identical
|
|
21741
|
-
* documents and there is no generated file to keep in step.
|
|
21742
|
-
*
|
|
21743
|
-
* It starts as the space Plitzi gives a new account, and it is yours: rename things, change the palette, delete the
|
|
21744
|
-
* guides. The paths and the guides are each one function mapped over one list, which is not a saving of keystrokes —
|
|
21745
|
-
* change `guideCard` and all six follow, add an entry to `GUIDES` and a seventh appears, styled like the rest.
|
|
21746
|
-
*
|
|
21747
|
-
* Name anything a test, a binding or an agent should be able to point at (`id: 'hero-title'`). An element with no
|
|
21748
|
-
* name gets a positional one, which moves the moment something is inserted above it.
|
|
22104
|
+
* What the page says, as data: the docs it points to, the three ways to change it and the guides to read on. Each band
|
|
22105
|
+
* is one of these lists mapped through one function of `index.ts` — add an entry and a card appears, styled like the
|
|
22106
|
+
* rest.
|
|
21749
22107
|
*/
|
|
21750
22108
|
/** Where the documentation lives. Every link on the page starts here, so moving the docs is one line. */
|
|
21751
22109
|
var DOCS = "https://plitzi.com/docs";
|
|
21752
|
-
/** The same outline on everything that can be focused from the keyboard. */
|
|
21753
|
-
var focusRing = {
|
|
21754
|
-
outline: "2px solid var(--primary)",
|
|
21755
|
-
"outline-offset": "3px"
|
|
21756
|
-
};
|
|
21757
|
-
var shell$1 = styles("shell", { css: {
|
|
21758
|
-
desktop: {
|
|
21759
|
-
display: "flex",
|
|
21760
|
-
"flex-direction": "column",
|
|
21761
|
-
width: "100%",
|
|
21762
|
-
"max-width": "1120px",
|
|
21763
|
-
"margin-left": "auto",
|
|
21764
|
-
"margin-right": "auto",
|
|
21765
|
-
"padding-left": "32px",
|
|
21766
|
-
"padding-right": "32px",
|
|
21767
|
-
position: "relative",
|
|
21768
|
-
"z-index": "1"
|
|
21769
|
-
},
|
|
21770
|
-
tablet: {
|
|
21771
|
-
"padding-left": "24px",
|
|
21772
|
-
"padding-right": "24px"
|
|
21773
|
-
},
|
|
21774
|
-
mobile: {
|
|
21775
|
-
"padding-left": "20px",
|
|
21776
|
-
"padding-right": "20px"
|
|
21777
|
-
}
|
|
21778
|
-
} });
|
|
21779
22110
|
/**
|
|
21780
|
-
* The
|
|
21781
|
-
*
|
|
21782
|
-
* Gradients rather than an image: it scales to any screen, costs no request, and follows the theme — the line colour
|
|
21783
|
-
* and the fade are variables, so it is faint on light and faint on dark without a second asset. The fade is the first
|
|
21784
|
-
* layer, drawn over the lines, so the grid ends softly instead of at an edge.
|
|
22111
|
+
* The three ways to change this page — the builder, code, an agent — as data: the band is this list, mapped. They
|
|
22112
|
+
* are the same space either way, so any one of them can be put down and another picked up.
|
|
21785
22113
|
*/
|
|
21786
|
-
var
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
|
|
22114
|
+
var PATHS = [
|
|
22115
|
+
{
|
|
22116
|
+
id: "path-builder",
|
|
22117
|
+
title: "In the builder",
|
|
22118
|
+
body: "Select anything on this page and change it: drag elements in, style them, wire them to data, and publish.",
|
|
22119
|
+
path: "elements",
|
|
22120
|
+
icon: "fas fa-pen-ruler",
|
|
22121
|
+
tone: "violet"
|
|
22122
|
+
},
|
|
22123
|
+
{
|
|
22124
|
+
id: "path-code",
|
|
22125
|
+
title: "In code",
|
|
22126
|
+
body: "The same space as TypeScript, in a project of your own — served by your server, or pushed back here.",
|
|
22127
|
+
path: "cli",
|
|
22128
|
+
icon: "fas fa-code",
|
|
22129
|
+
tone: "cyan",
|
|
22130
|
+
command: "npx @plitzi/cli create my-site"
|
|
22131
|
+
},
|
|
22132
|
+
{
|
|
22133
|
+
id: "path-agent",
|
|
22134
|
+
title: "With an agent",
|
|
22135
|
+
body: "Connect Claude or any MCP client. It reads and edits this space under the same rules as you do.",
|
|
22136
|
+
path: "agents",
|
|
22137
|
+
icon: "fas fa-robot",
|
|
22138
|
+
tone: "blue"
|
|
22139
|
+
}
|
|
22140
|
+
];
|
|
22141
|
+
/** Where to read on, as data: the grid below is this list, mapped. Each one is a page of the docs. */
|
|
22142
|
+
var GUIDES = [
|
|
22143
|
+
{
|
|
22144
|
+
id: "concepts",
|
|
22145
|
+
title: "Core concepts",
|
|
22146
|
+
body: "Spaces, pages, elements, and who owns what.",
|
|
22147
|
+
path: "concepts",
|
|
22148
|
+
icon: "fas fa-shapes",
|
|
22149
|
+
tone: "violet"
|
|
22150
|
+
},
|
|
22151
|
+
{
|
|
22152
|
+
id: "authoring",
|
|
22153
|
+
title: "A space in code",
|
|
22154
|
+
body: "One declaration in, two documents out.",
|
|
22155
|
+
path: "authoring",
|
|
22156
|
+
icon: "fas fa-code",
|
|
22157
|
+
tone: "cyan"
|
|
22158
|
+
},
|
|
22159
|
+
{
|
|
22160
|
+
id: "styling",
|
|
22161
|
+
title: "Styling and themes",
|
|
22162
|
+
body: "Classes, states, breakpoints, light and dark.",
|
|
22163
|
+
path: "styling",
|
|
22164
|
+
icon: "fas fa-palette",
|
|
22165
|
+
tone: "rose"
|
|
22166
|
+
},
|
|
22167
|
+
{
|
|
22168
|
+
id: "data",
|
|
22169
|
+
title: "Data and bindings",
|
|
22170
|
+
body: "Fetch from an API, show it anywhere.",
|
|
22171
|
+
path: "data",
|
|
22172
|
+
icon: "fas fa-database",
|
|
22173
|
+
tone: "emerald"
|
|
22174
|
+
},
|
|
22175
|
+
{
|
|
22176
|
+
id: "interactions",
|
|
22177
|
+
title: "Interactions and flows",
|
|
22178
|
+
body: "Clicks and forms wired to steps, no code.",
|
|
22179
|
+
path: "interactions",
|
|
22180
|
+
icon: "fas fa-bolt",
|
|
22181
|
+
tone: "amber"
|
|
22182
|
+
},
|
|
22183
|
+
{
|
|
22184
|
+
id: "quickstart",
|
|
22185
|
+
title: "Quickstart",
|
|
22186
|
+
body: "From a new space to a published site.",
|
|
22187
|
+
path: "quickstart",
|
|
22188
|
+
icon: "fas fa-flag-checkered",
|
|
22189
|
+
tone: "blue"
|
|
22190
|
+
}
|
|
22191
|
+
];
|
|
22192
|
+
//#endregion
|
|
22193
|
+
//#region src/spaces/blank/theme.ts
|
|
22194
|
+
/**
|
|
22195
|
+
* The classes the page wears, declared once and named by the elements that wear them — so re-theming a card re-themes
|
|
22196
|
+
* every card. Every colour in them is a `var(--…)` of the palette in `tokens.ts`.
|
|
22197
|
+
*/
|
|
22198
|
+
/** The same outline on everything that can be focused from the keyboard. */
|
|
22199
|
+
var focusRing = {
|
|
22200
|
+
outline: "2px solid var(--primary)",
|
|
22201
|
+
"outline-offset": "3px"
|
|
22202
|
+
};
|
|
22203
|
+
var shell$1 = styles("shell", { css: {
|
|
22204
|
+
desktop: {
|
|
22205
|
+
display: "flex",
|
|
22206
|
+
"flex-direction": "column",
|
|
22207
|
+
width: "100%",
|
|
22208
|
+
"max-width": "1120px",
|
|
22209
|
+
"margin-left": "auto",
|
|
22210
|
+
"margin-right": "auto",
|
|
22211
|
+
"padding-left": "32px",
|
|
22212
|
+
"padding-right": "32px",
|
|
22213
|
+
position: "relative",
|
|
22214
|
+
"z-index": "1"
|
|
22215
|
+
},
|
|
22216
|
+
tablet: {
|
|
22217
|
+
"padding-left": "24px",
|
|
22218
|
+
"padding-right": "24px"
|
|
22219
|
+
},
|
|
22220
|
+
mobile: {
|
|
22221
|
+
"padding-left": "20px",
|
|
22222
|
+
"padding-right": "20px"
|
|
22223
|
+
}
|
|
22224
|
+
} });
|
|
22225
|
+
/**
|
|
22226
|
+
* The grid behind the top of the page, fading into the background as it goes down.
|
|
22227
|
+
*
|
|
22228
|
+
* Gradients rather than an image: it scales to any screen, costs no request, and follows the theme — the line colour
|
|
22229
|
+
* and the fade are variables, so it is faint on light and faint on dark without a second asset. The fade is the first
|
|
22230
|
+
* layer, drawn over the lines, so the grid ends softly instead of at an edge.
|
|
22231
|
+
*/
|
|
22232
|
+
var backdrop = styles("backdrop", { css: {
|
|
22233
|
+
desktop: {
|
|
22234
|
+
position: "absolute",
|
|
22235
|
+
top: "0px",
|
|
22236
|
+
left: "0px",
|
|
22237
|
+
right: "0px",
|
|
22238
|
+
height: "760px",
|
|
22239
|
+
"pointer-events": "none",
|
|
22240
|
+
"background-image": "linear-gradient(180deg, transparent 0%, var(--background) 100%), linear-gradient(0deg, var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px)",
|
|
22241
|
+
"background-size": "100% 100%, 48px 48px, 48px 48px",
|
|
22242
|
+
"background-position": "0% 0%, 50% 0%, 50% 0%",
|
|
22243
|
+
"background-repeat": "no-repeat, repeat, repeat"
|
|
22244
|
+
},
|
|
22245
|
+
mobile: { height: "560px" }
|
|
22246
|
+
} });
|
|
22247
|
+
var navLink = styles("nav-link", {
|
|
22248
|
+
css: {
|
|
22249
|
+
display: "flex",
|
|
22250
|
+
"align-items": "center",
|
|
22251
|
+
gap: "8px",
|
|
22252
|
+
color: "var(--muted)",
|
|
22253
|
+
"font-size": "14px",
|
|
22254
|
+
"font-weight": "500",
|
|
22255
|
+
"text-decoration": "none",
|
|
22256
|
+
"border-radius": "8px",
|
|
22257
|
+
padding: "6px 10px"
|
|
21812
22258
|
},
|
|
21813
22259
|
states: {
|
|
21814
22260
|
hover: { color: "var(--foreground)" },
|
|
@@ -22102,88 +22548,191 @@ var footerRow = styles("footer-row", { css: {
|
|
|
22102
22548
|
gap: "8px"
|
|
22103
22549
|
}
|
|
22104
22550
|
} });
|
|
22551
|
+
//#endregion
|
|
22552
|
+
//#region src/spaces/blank/tokens.ts
|
|
22105
22553
|
/**
|
|
22106
|
-
*
|
|
22107
|
-
*
|
|
22554
|
+
* Every colour the page uses, per scheme.
|
|
22555
|
+
*
|
|
22556
|
+
* `default` is what a browser with no preference gets. No class names a colour directly — they are all `var(--…)` — so
|
|
22557
|
+
* switching the palette here re-themes the whole page, in both schemes, without touching a rule.
|
|
22108
22558
|
*/
|
|
22109
|
-
var
|
|
22110
|
-
{
|
|
22111
|
-
|
|
22112
|
-
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
|
|
22131
|
-
|
|
22132
|
-
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
|
|
22136
|
-
|
|
22137
|
-
|
|
22138
|
-
|
|
22139
|
-
|
|
22140
|
-
|
|
22141
|
-
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22146
|
-
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
|
|
22150
|
-
|
|
22151
|
-
|
|
22152
|
-
|
|
22153
|
-
|
|
22154
|
-
|
|
22155
|
-
|
|
22156
|
-
|
|
22157
|
-
|
|
22158
|
-
|
|
22159
|
-
|
|
22160
|
-
|
|
22161
|
-
|
|
22162
|
-
|
|
22163
|
-
|
|
22164
|
-
|
|
22165
|
-
|
|
22166
|
-
|
|
22167
|
-
|
|
22168
|
-
|
|
22169
|
-
|
|
22170
|
-
|
|
22171
|
-
|
|
22172
|
-
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
|
|
22176
|
-
|
|
22559
|
+
var variables = {
|
|
22560
|
+
color: {
|
|
22561
|
+
background: {
|
|
22562
|
+
light: "#fbfbfd",
|
|
22563
|
+
dark: "#09090b",
|
|
22564
|
+
default: "#fbfbfd"
|
|
22565
|
+
},
|
|
22566
|
+
foreground: {
|
|
22567
|
+
light: "#17171c",
|
|
22568
|
+
dark: "#fafafa",
|
|
22569
|
+
default: "#17171c"
|
|
22570
|
+
},
|
|
22571
|
+
muted: {
|
|
22572
|
+
light: "#5f5f6e",
|
|
22573
|
+
dark: "#a1a1aa",
|
|
22574
|
+
default: "#5f5f6e"
|
|
22575
|
+
},
|
|
22576
|
+
card: {
|
|
22577
|
+
light: "#ffffff",
|
|
22578
|
+
dark: "#111115",
|
|
22579
|
+
default: "#ffffff"
|
|
22580
|
+
},
|
|
22581
|
+
"code-bg": {
|
|
22582
|
+
light: "#f4f4f8",
|
|
22583
|
+
dark: "#18181d",
|
|
22584
|
+
default: "#f4f4f8"
|
|
22585
|
+
},
|
|
22586
|
+
border: {
|
|
22587
|
+
light: "#e6e6ee",
|
|
22588
|
+
dark: "#27272d",
|
|
22589
|
+
default: "#e6e6ee"
|
|
22590
|
+
},
|
|
22591
|
+
primary: {
|
|
22592
|
+
light: "#5b3df5",
|
|
22593
|
+
dark: "#7c66ff",
|
|
22594
|
+
default: "#5b3df5"
|
|
22595
|
+
},
|
|
22596
|
+
"primary-hover": {
|
|
22597
|
+
light: "#4a2de0",
|
|
22598
|
+
dark: "#9180ff",
|
|
22599
|
+
default: "#4a2de0"
|
|
22600
|
+
},
|
|
22601
|
+
"primary-foreground": {
|
|
22602
|
+
light: "#ffffff",
|
|
22603
|
+
dark: "#ffffff",
|
|
22604
|
+
default: "#ffffff"
|
|
22605
|
+
},
|
|
22606
|
+
glow: {
|
|
22607
|
+
light: "rgba(91, 61, 245, 0.16)",
|
|
22608
|
+
dark: "rgba(124, 102, 255, 0.24)",
|
|
22609
|
+
default: "rgba(91, 61, 245, 0.16)"
|
|
22610
|
+
},
|
|
22611
|
+
grid: {
|
|
22612
|
+
light: "#0000000d",
|
|
22613
|
+
dark: "#ffffff0d",
|
|
22614
|
+
default: "#0000000d"
|
|
22615
|
+
},
|
|
22616
|
+
"tint-violet": {
|
|
22617
|
+
light: "#5b3df5",
|
|
22618
|
+
dark: "#b7a6ff",
|
|
22619
|
+
default: "#5b3df5"
|
|
22620
|
+
},
|
|
22621
|
+
"tint-violet-bg": {
|
|
22622
|
+
light: "#efecfe",
|
|
22623
|
+
dark: "#1c1836",
|
|
22624
|
+
default: "#efecfe"
|
|
22625
|
+
},
|
|
22626
|
+
"tint-cyan": {
|
|
22627
|
+
light: "#0e7490",
|
|
22628
|
+
dark: "#67d8ef",
|
|
22629
|
+
default: "#0e7490"
|
|
22630
|
+
},
|
|
22631
|
+
"tint-cyan-bg": {
|
|
22632
|
+
light: "#e0f5fa",
|
|
22633
|
+
dark: "#0c2a33",
|
|
22634
|
+
default: "#e0f5fa"
|
|
22635
|
+
},
|
|
22636
|
+
"tint-amber": {
|
|
22637
|
+
light: "#a45b00",
|
|
22638
|
+
dark: "#f5c169",
|
|
22639
|
+
default: "#a45b00"
|
|
22640
|
+
},
|
|
22641
|
+
"tint-amber-bg": {
|
|
22642
|
+
light: "#fcf0dc",
|
|
22643
|
+
dark: "#2e2314",
|
|
22644
|
+
default: "#fcf0dc"
|
|
22645
|
+
},
|
|
22646
|
+
"tint-rose": {
|
|
22647
|
+
light: "#c2255c",
|
|
22648
|
+
dark: "#f994bc",
|
|
22649
|
+
default: "#c2255c"
|
|
22650
|
+
},
|
|
22651
|
+
"tint-rose-bg": {
|
|
22652
|
+
light: "#fce8f0",
|
|
22653
|
+
dark: "#331623",
|
|
22654
|
+
default: "#fce8f0"
|
|
22655
|
+
},
|
|
22656
|
+
"tint-emerald": {
|
|
22657
|
+
light: "#0f7b55",
|
|
22658
|
+
dark: "#64d6a6",
|
|
22659
|
+
default: "#0f7b55"
|
|
22660
|
+
},
|
|
22661
|
+
"tint-emerald-bg": {
|
|
22662
|
+
light: "#e0f6ee",
|
|
22663
|
+
dark: "#0e2a21",
|
|
22664
|
+
default: "#e0f6ee"
|
|
22665
|
+
},
|
|
22666
|
+
"tint-blue": {
|
|
22667
|
+
light: "#2159c4",
|
|
22668
|
+
dark: "#8ab0f7",
|
|
22669
|
+
default: "#2159c4"
|
|
22670
|
+
},
|
|
22671
|
+
"tint-blue-bg": {
|
|
22672
|
+
light: "#e6edfc",
|
|
22673
|
+
dark: "#13203c",
|
|
22674
|
+
default: "#e6edfc"
|
|
22675
|
+
}
|
|
22177
22676
|
},
|
|
22178
|
-
{
|
|
22179
|
-
|
|
22180
|
-
|
|
22181
|
-
|
|
22182
|
-
|
|
22183
|
-
|
|
22184
|
-
|
|
22185
|
-
|
|
22186
|
-
|
|
22677
|
+
shadow: {
|
|
22678
|
+
"shadow-sm": {
|
|
22679
|
+
light: "0 1px 2px rgba(12, 12, 20, 0.05)",
|
|
22680
|
+
dark: "0 1px 2px rgba(0, 0, 0, 0.5)",
|
|
22681
|
+
default: "0 1px 2px rgba(12, 12, 20, 0.05)"
|
|
22682
|
+
},
|
|
22683
|
+
"shadow-md": {
|
|
22684
|
+
light: "0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)",
|
|
22685
|
+
dark: "0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 24px -8px rgba(124, 102, 255, 0.55)",
|
|
22686
|
+
default: "0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)"
|
|
22687
|
+
},
|
|
22688
|
+
"shadow-lg": {
|
|
22689
|
+
light: "0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)",
|
|
22690
|
+
dark: "0 2px 4px rgba(0, 0, 0, 0.6), 0 28px 56px -22px rgba(0, 0, 0, 0.85)",
|
|
22691
|
+
default: "0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)"
|
|
22692
|
+
}
|
|
22693
|
+
},
|
|
22694
|
+
custom: {
|
|
22695
|
+
"font-sans": "Geist, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif",
|
|
22696
|
+
"font-mono": "\"Geist Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
|
|
22697
|
+
}
|
|
22698
|
+
};
|
|
22699
|
+
/** Loaded by the page itself: a face the space names here is the only one it ever fetches. */
|
|
22700
|
+
var fonts = [{
|
|
22701
|
+
family: "Geist",
|
|
22702
|
+
fallback: "ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif",
|
|
22703
|
+
weights: [
|
|
22704
|
+
400,
|
|
22705
|
+
500,
|
|
22706
|
+
600,
|
|
22707
|
+
700
|
|
22708
|
+
],
|
|
22709
|
+
styles: ["normal"],
|
|
22710
|
+
display: "swap",
|
|
22711
|
+
preload: true,
|
|
22712
|
+
source: "google"
|
|
22713
|
+
}, {
|
|
22714
|
+
family: "Geist Mono",
|
|
22715
|
+
fallback: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
22716
|
+
weights: [400],
|
|
22717
|
+
styles: ["normal"],
|
|
22718
|
+
display: "swap",
|
|
22719
|
+
source: "google"
|
|
22720
|
+
}];
|
|
22721
|
+
//#endregion
|
|
22722
|
+
//#region src/spaces/blank/spec.ts
|
|
22723
|
+
/**
|
|
22724
|
+
* The space, declared: this file is the page, and it assembles the rest — the palette in `tokens.ts`, the classes in
|
|
22725
|
+
* `theme.ts`, what the page says in `content.ts`. Everything else — element ids, style selector names, the
|
|
22726
|
+
* back-references between them — is derived from what is written in them, so authoring it twice writes byte-identical
|
|
22727
|
+
* documents and there is no generated file to keep in step.
|
|
22728
|
+
*
|
|
22729
|
+
* It starts as the space Plitzi gives a new account, and it is yours: rename things, change the palette, delete the
|
|
22730
|
+
* guides. The paths and the guides are each one function mapped over one list, which is not a saving of keystrokes —
|
|
22731
|
+
* change `guideCard` and all six follow, add an entry to `GUIDES` and a seventh appears, styled like the rest.
|
|
22732
|
+
*
|
|
22733
|
+
* Name anything a test, a binding or an agent should be able to point at (`id: 'hero-title'`). An element with no
|
|
22734
|
+
* name gets a positional one, which moves the moment something is inserted above it.
|
|
22735
|
+
*/
|
|
22187
22736
|
var pathCard = (entry, index) => link({
|
|
22188
22737
|
id: entry.id,
|
|
22189
22738
|
href: `${DOCS}/${entry.path}`,
|
|
@@ -22421,174 +22970,8 @@ var space = {
|
|
|
22421
22970
|
default: "system",
|
|
22422
22971
|
schemes: ["light", "dark"]
|
|
22423
22972
|
},
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
*
|
|
22427
|
-
* `default` is what a browser with no preference gets. Nothing above names a colour directly — they are all
|
|
22428
|
-
* `var(--…)` — so switching the palette here re-themes the whole page, in both schemes, without touching a rule.
|
|
22429
|
-
*/
|
|
22430
|
-
variables: {
|
|
22431
|
-
color: {
|
|
22432
|
-
background: {
|
|
22433
|
-
light: "#fbfbfd",
|
|
22434
|
-
dark: "#09090b",
|
|
22435
|
-
default: "#fbfbfd"
|
|
22436
|
-
},
|
|
22437
|
-
foreground: {
|
|
22438
|
-
light: "#17171c",
|
|
22439
|
-
dark: "#fafafa",
|
|
22440
|
-
default: "#17171c"
|
|
22441
|
-
},
|
|
22442
|
-
muted: {
|
|
22443
|
-
light: "#5f5f6e",
|
|
22444
|
-
dark: "#a1a1aa",
|
|
22445
|
-
default: "#5f5f6e"
|
|
22446
|
-
},
|
|
22447
|
-
card: {
|
|
22448
|
-
light: "#ffffff",
|
|
22449
|
-
dark: "#111115",
|
|
22450
|
-
default: "#ffffff"
|
|
22451
|
-
},
|
|
22452
|
-
"code-bg": {
|
|
22453
|
-
light: "#f4f4f8",
|
|
22454
|
-
dark: "#18181d",
|
|
22455
|
-
default: "#f4f4f8"
|
|
22456
|
-
},
|
|
22457
|
-
border: {
|
|
22458
|
-
light: "#e6e6ee",
|
|
22459
|
-
dark: "#27272d",
|
|
22460
|
-
default: "#e6e6ee"
|
|
22461
|
-
},
|
|
22462
|
-
primary: {
|
|
22463
|
-
light: "#5b3df5",
|
|
22464
|
-
dark: "#7c66ff",
|
|
22465
|
-
default: "#5b3df5"
|
|
22466
|
-
},
|
|
22467
|
-
"primary-hover": {
|
|
22468
|
-
light: "#4a2de0",
|
|
22469
|
-
dark: "#9180ff",
|
|
22470
|
-
default: "#4a2de0"
|
|
22471
|
-
},
|
|
22472
|
-
"primary-foreground": {
|
|
22473
|
-
light: "#ffffff",
|
|
22474
|
-
dark: "#ffffff",
|
|
22475
|
-
default: "#ffffff"
|
|
22476
|
-
},
|
|
22477
|
-
glow: {
|
|
22478
|
-
light: "rgba(91, 61, 245, 0.16)",
|
|
22479
|
-
dark: "rgba(124, 102, 255, 0.24)",
|
|
22480
|
-
default: "rgba(91, 61, 245, 0.16)"
|
|
22481
|
-
},
|
|
22482
|
-
grid: {
|
|
22483
|
-
light: "#0000000d",
|
|
22484
|
-
dark: "#ffffff0d",
|
|
22485
|
-
default: "#0000000d"
|
|
22486
|
-
},
|
|
22487
|
-
"tint-violet": {
|
|
22488
|
-
light: "#5b3df5",
|
|
22489
|
-
dark: "#b7a6ff",
|
|
22490
|
-
default: "#5b3df5"
|
|
22491
|
-
},
|
|
22492
|
-
"tint-violet-bg": {
|
|
22493
|
-
light: "#efecfe",
|
|
22494
|
-
dark: "#1c1836",
|
|
22495
|
-
default: "#efecfe"
|
|
22496
|
-
},
|
|
22497
|
-
"tint-cyan": {
|
|
22498
|
-
light: "#0e7490",
|
|
22499
|
-
dark: "#67d8ef",
|
|
22500
|
-
default: "#0e7490"
|
|
22501
|
-
},
|
|
22502
|
-
"tint-cyan-bg": {
|
|
22503
|
-
light: "#e0f5fa",
|
|
22504
|
-
dark: "#0c2a33",
|
|
22505
|
-
default: "#e0f5fa"
|
|
22506
|
-
},
|
|
22507
|
-
"tint-amber": {
|
|
22508
|
-
light: "#a45b00",
|
|
22509
|
-
dark: "#f5c169",
|
|
22510
|
-
default: "#a45b00"
|
|
22511
|
-
},
|
|
22512
|
-
"tint-amber-bg": {
|
|
22513
|
-
light: "#fcf0dc",
|
|
22514
|
-
dark: "#2e2314",
|
|
22515
|
-
default: "#fcf0dc"
|
|
22516
|
-
},
|
|
22517
|
-
"tint-rose": {
|
|
22518
|
-
light: "#c2255c",
|
|
22519
|
-
dark: "#f994bc",
|
|
22520
|
-
default: "#c2255c"
|
|
22521
|
-
},
|
|
22522
|
-
"tint-rose-bg": {
|
|
22523
|
-
light: "#fce8f0",
|
|
22524
|
-
dark: "#331623",
|
|
22525
|
-
default: "#fce8f0"
|
|
22526
|
-
},
|
|
22527
|
-
"tint-emerald": {
|
|
22528
|
-
light: "#0f7b55",
|
|
22529
|
-
dark: "#64d6a6",
|
|
22530
|
-
default: "#0f7b55"
|
|
22531
|
-
},
|
|
22532
|
-
"tint-emerald-bg": {
|
|
22533
|
-
light: "#e0f6ee",
|
|
22534
|
-
dark: "#0e2a21",
|
|
22535
|
-
default: "#e0f6ee"
|
|
22536
|
-
},
|
|
22537
|
-
"tint-blue": {
|
|
22538
|
-
light: "#2159c4",
|
|
22539
|
-
dark: "#8ab0f7",
|
|
22540
|
-
default: "#2159c4"
|
|
22541
|
-
},
|
|
22542
|
-
"tint-blue-bg": {
|
|
22543
|
-
light: "#e6edfc",
|
|
22544
|
-
dark: "#13203c",
|
|
22545
|
-
default: "#e6edfc"
|
|
22546
|
-
}
|
|
22547
|
-
},
|
|
22548
|
-
shadow: {
|
|
22549
|
-
"shadow-sm": {
|
|
22550
|
-
light: "0 1px 2px rgba(12, 12, 20, 0.05)",
|
|
22551
|
-
dark: "0 1px 2px rgba(0, 0, 0, 0.5)",
|
|
22552
|
-
default: "0 1px 2px rgba(12, 12, 20, 0.05)"
|
|
22553
|
-
},
|
|
22554
|
-
"shadow-md": {
|
|
22555
|
-
light: "0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)",
|
|
22556
|
-
dark: "0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 24px -8px rgba(124, 102, 255, 0.55)",
|
|
22557
|
-
default: "0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)"
|
|
22558
|
-
},
|
|
22559
|
-
"shadow-lg": {
|
|
22560
|
-
light: "0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)",
|
|
22561
|
-
dark: "0 2px 4px rgba(0, 0, 0, 0.6), 0 28px 56px -22px rgba(0, 0, 0, 0.85)",
|
|
22562
|
-
default: "0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)"
|
|
22563
|
-
}
|
|
22564
|
-
},
|
|
22565
|
-
custom: {
|
|
22566
|
-
"font-sans": "Geist, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif",
|
|
22567
|
-
"font-mono": "\"Geist Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
|
|
22568
|
-
}
|
|
22569
|
-
},
|
|
22570
|
-
/** Loaded by the page itself: a face the space names here is the only one it ever fetches. */
|
|
22571
|
-
fonts: [{
|
|
22572
|
-
family: "Geist",
|
|
22573
|
-
fallback: "ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif",
|
|
22574
|
-
weights: [
|
|
22575
|
-
400,
|
|
22576
|
-
500,
|
|
22577
|
-
600,
|
|
22578
|
-
700
|
|
22579
|
-
],
|
|
22580
|
-
styles: ["normal"],
|
|
22581
|
-
display: "swap",
|
|
22582
|
-
preload: true,
|
|
22583
|
-
source: "google"
|
|
22584
|
-
}, {
|
|
22585
|
-
family: "Geist Mono",
|
|
22586
|
-
fallback: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
22587
|
-
weights: [400],
|
|
22588
|
-
styles: ["normal"],
|
|
22589
|
-
display: "swap",
|
|
22590
|
-
source: "google"
|
|
22591
|
-
}],
|
|
22973
|
+
variables,
|
|
22974
|
+
fonts,
|
|
22592
22975
|
/**
|
|
22593
22976
|
* What text is, before any class touches it.
|
|
22594
22977
|
*
|
|
@@ -22693,7 +23076,42 @@ var space = {
|
|
|
22693
23076
|
};
|
|
22694
23077
|
//#endregion
|
|
22695
23078
|
//#region src/spaces/blank/spec.ts?raw
|
|
22696
|
-
var spec_default$1 = "import { container, fontAwesome, heading, image, link, paragraph, text, themeToggle } from '../../elements';\nimport { styles } from '../../style';\n\nimport type { ElementSpec, SpaceSpec } from '../../schema';\n\n/**\n * The space, declared.\n *\n * This is the whole site: a tree, some CSS and a palette. Everything else — element ids, style selector names, the\n * back-references between them — is derived from what is written here, so authoring it twice writes byte-identical\n * documents and there is no generated file to keep in step.\n *\n * It starts as the space Plitzi gives a new account, and it is yours: rename things, change the palette, delete the\n * guides. The paths and the guides are each one function mapped over one list, which is not a saving of keystrokes —\n * change `guideCard` and all six follow, add an entry to `GUIDES` and a seventh appears, styled like the rest.\n *\n * Name anything a test, a binding or an agent should be able to point at (`id: 'hero-title'`). An element with no\n * name gets a positional one, which moves the moment something is inserted above it.\n */\n\n/** Where the documentation lives. Every link on the page starts here, so moving the docs is one line. */\nconst DOCS = 'https://plitzi.com/docs';\n\n// ── Classes ────────────────────────────────────────────────────────────────────────────────────────────────────\n// Declared once and named by the elements that wear them, so re-theming a card re-themes every card.\n\n/** The same outline on everything that can be focused from the keyboard. */\nconst focusRing = { outline: '2px solid var(--primary)', 'outline-offset': '3px' };\n\n// A band wears `shell` for its sides and a class of its own for its top and bottom, so both write their sides apart: a\n// `padding` shorthand in either would reset the other's. A class that owns its whole box writes the shorthand.\nconst shell = styles('shell', {\n css: {\n desktop: {\n display: 'flex',\n 'flex-direction': 'column',\n width: '100%',\n 'max-width': '1120px',\n 'margin-left': 'auto',\n 'margin-right': 'auto',\n 'padding-left': '32px',\n 'padding-right': '32px',\n position: 'relative',\n 'z-index': '1'\n },\n tablet: { 'padding-left': '24px', 'padding-right': '24px' },\n mobile: { 'padding-left': '20px', 'padding-right': '20px' }\n }\n});\n\n/**\n * The grid behind the top of the page, fading into the background as it goes down.\n *\n * Gradients rather than an image: it scales to any screen, costs no request, and follows the theme — the line colour\n * and the fade are variables, so it is faint on light and faint on dark without a second asset. The fade is the first\n * layer, drawn over the lines, so the grid ends softly instead of at an edge.\n */\nconst backdrop = styles('backdrop', {\n css: {\n desktop: {\n position: 'absolute',\n top: '0px',\n left: '0px',\n right: '0px',\n height: '760px',\n 'pointer-events': 'none',\n 'background-image':\n 'linear-gradient(180deg, transparent 0%, var(--background) 100%), linear-gradient(0deg, var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px)',\n 'background-size': '100% 100%, 48px 48px, 48px 48px',\n 'background-position': '0% 0%, 50% 0%, 50% 0%',\n 'background-repeat': 'no-repeat, repeat, repeat'\n },\n mobile: { height: '560px' }\n }\n});\n\nconst navLink = styles('nav-link', {\n css: {\n display: 'flex',\n 'align-items': 'center',\n gap: '8px',\n color: 'var(--muted)',\n 'font-size': '14px',\n 'font-weight': '500',\n 'text-decoration': 'none',\n 'border-radius': '8px',\n padding: '6px 10px'\n },\n states: { hover: { color: 'var(--foreground)' }, 'focus-visible': focusRing }\n});\n\n/** The mark beside the name, at the size the bar wants. */\nconst brandMark = styles('brand-mark', { width: '24px', height: '24px' });\n\n/** The theme switch, dressed like the rest of the bar: a browser draws a bare button grey and square. */\nconst iconButton = styles('icon-button', {\n css: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n width: '36px',\n height: '36px',\n 'border-radius': '8px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n color: 'var(--muted)',\n 'font-size': '16px',\n cursor: 'pointer'\n },\n states: { hover: { color: 'var(--foreground)' }, 'focus-visible': focusRing }\n});\n\n/** A call to action. The base is the quiet one; `primary` is the one the eye should land on. */\nconst button = styles('button', {\n css: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n gap: '8px',\n height: '44px',\n padding: '0px 20px',\n 'border-radius': '10px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n color: 'var(--foreground)',\n 'font-size': '15px',\n 'font-weight': '600',\n 'text-decoration': 'none',\n 'transition-property': 'background-color, border-color, transform',\n 'transition-duration': '150ms',\n 'transition-timing-function': 'ease-out'\n },\n states: {\n hover: { 'border-color': 'var(--muted)' },\n 'focus-visible': focusRing\n },\n variants: {\n primary: {\n css: {\n 'background-color': 'var(--primary)',\n 'border-color': 'var(--primary)',\n color: 'var(--primary-foreground)',\n 'box-shadow': 'var(--shadow-md)'\n },\n states: { hover: { 'background-color': 'var(--primary-hover)', 'border-color': 'var(--primary-hover)' } }\n }\n }\n});\n\n/** A section's small label over its title: what the band is about, in the palette's primary. */\nconst kicker = styles('kicker', {\n color: 'var(--primary)',\n 'font-size': '13px',\n 'font-weight': '600',\n 'letter-spacing': '0.04em',\n 'text-transform': 'uppercase',\n margin: '0px'\n});\n\nconst sectionTitle = styles('section-title', {\n css: {\n desktop: {\n 'font-size': '32px',\n 'font-weight': '700',\n 'letter-spacing': '-0.02em',\n 'line-height': '1.15',\n margin: '0px'\n },\n mobile: { 'font-size': '26px' }\n }\n});\n\nconst sectionHead = styles('section-head', {\n display: 'flex',\n 'flex-direction': 'column',\n gap: '8px',\n 'margin-bottom': '8px'\n});\n\n/** Copy under a title or in a card: the palette's quiet colour, at a size made for reading. */\nconst bodyText = styles('body-text', {\n color: 'var(--muted)',\n 'font-size': '15px',\n 'line-height': '1.6',\n margin: '0px'\n});\n\n/** A card of either band: the whole card is the link, so the target is as large as what it describes. */\nconst card = styles('card', {\n css: {\n display: 'flex',\n 'flex-direction': 'column',\n gap: '12px',\n padding: '24px',\n 'border-radius': '16px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n 'box-shadow': 'var(--shadow-sm)',\n 'text-decoration': 'none',\n 'transition-property': 'transform, border-color, box-shadow',\n 'transition-duration': '200ms',\n 'transition-timing-function': 'ease-out'\n },\n states: {\n hover: { transform: 'translateY(-3px)', 'border-color': 'var(--primary)', 'box-shadow': 'var(--shadow-lg)' },\n 'focus-visible': focusRing\n }\n});\n\nconst cardHead = styles('card-head', { display: 'flex', 'align-items': 'center', gap: '10px' });\n\nconst cardTitle = styles('card-title', {\n color: 'var(--foreground)',\n 'font-size': '17px',\n 'font-weight': '600',\n margin: '0px'\n});\n\n/** The arrow slides while the card around it is hovered. */\nconst cardArrow = styles('card-arrow', {\n css: {\n color: 'var(--muted)',\n 'font-size': '13px',\n 'margin-left': 'auto',\n 'transition-property': 'transform, color',\n 'transition-duration': '200ms',\n 'transition-timing-function': 'ease-out'\n },\n ancestors: {\n [card.name]: { states: { hover: { transform: 'translateX(4px)', color: 'var(--primary)' } } }\n }\n});\n\n/** The square an icon sits in. Its colour is a tone, worn beside it: `class: [tile, tones.violet]`. */\nconst tile = styles('tile', {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n width: '40px',\n height: '40px',\n 'flex-shrink': '0',\n 'border-radius': '10px',\n 'font-size': '16px'\n});\n\n/** One class per tone, each a pair of palette variables — so a tone is dark-ready the moment it is declared. */\nconst tones = {\n violet: styles('tone-violet', { color: 'var(--tint-violet)', 'background-color': 'var(--tint-violet-bg)' }),\n cyan: styles('tone-cyan', { color: 'var(--tint-cyan)', 'background-color': 'var(--tint-cyan-bg)' }),\n amber: styles('tone-amber', { color: 'var(--tint-amber)', 'background-color': 'var(--tint-amber-bg)' }),\n emerald: styles('tone-emerald', { color: 'var(--tint-emerald)', 'background-color': 'var(--tint-emerald-bg)' }),\n rose: styles('tone-rose', { color: 'var(--tint-rose)', 'background-color': 'var(--tint-rose-bg)' }),\n blue: styles('tone-blue', { color: 'var(--tint-blue)', 'background-color': 'var(--tint-blue-bg)' })\n};\n\n/** A path's number, in a circle: the order the three are worth reading in, not an order they must be taken in. */\nconst step = styles('step', {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n width: '28px',\n height: '28px',\n 'flex-shrink': '0',\n 'border-radius': '999px',\n border: '1px solid var(--border)',\n color: 'var(--muted)',\n 'font-size': '13px',\n 'font-weight': '600'\n});\n\n/** What a path does, as it would be typed — the one place the page shows code. */\nconst command = styles('command', {\n display: 'flex',\n 'align-items': 'center',\n gap: '8px',\n 'margin-top': 'auto',\n padding: '10px 12px',\n 'border-radius': '10px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--code-bg)',\n color: 'var(--foreground)',\n 'font-family': 'var(--font-mono)',\n 'font-size': '13px',\n 'white-space': 'nowrap',\n overflow: 'hidden'\n});\n\n/** A guide is smaller than a path: one line under its title, its icon beside it rather than above. */\nconst guide = styles('guide', { 'flex-direction': 'row', 'align-items': 'flex-start', gap: '16px', padding: '20px' });\n\nconst guideCopy = styles('guide-copy', { display: 'flex', 'flex-direction': 'column', gap: '4px', 'min-width': '0px' });\n\n/** Each band of the page wears `shell` for its width, and one of these for what is its own. */\nconst topBarBand = styles('top-bar', {\n 'flex-direction': 'row',\n 'align-items': 'center',\n 'justify-content': 'space-between',\n 'padding-top': '20px',\n 'padding-bottom': '20px'\n});\n\nconst heroBand = styles('hero', {\n css: {\n desktop: { 'align-items': 'center', gap: '24px', 'padding-top': '88px', 'padding-bottom': '88px' },\n tablet: { 'padding-top': '64px', 'padding-bottom': '64px' },\n mobile: { 'padding-top': '40px', 'padding-bottom': '48px' }\n }\n});\n\n/** The two bands of cards: the paths first, the guides after, each under its own head. */\nconst cardsBand = styles('cards-band', { gap: '20px', 'padding-bottom': '80px' });\n\n/** Three columns that become two and then one, so a card is never narrower than its words. */\nconst cardGrid = styles('card-grid', {\n css: {\n desktop: { display: 'grid', 'grid-template-columns': 'repeat(3, minmax(0, 1fr))', gap: '16px' },\n tablet: { 'grid-template-columns': 'repeat(2, minmax(0, 1fr))' },\n mobile: { 'grid-template-columns': 'minmax(0, 1fr)' }\n }\n});\n\n/** The footer's line spans the content, not the band's padding: it belongs to what it closes. */\nconst footerBand = styles('footer', {\n css: {\n desktop: { 'margin-top': 'auto', 'padding-bottom': '32px' },\n mobile: { 'padding-bottom': '24px' }\n }\n});\n\nconst footerRow = styles('footer-row', {\n css: {\n desktop: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'space-between',\n gap: '16px',\n 'padding-top': '24px',\n 'border-top': '1px solid var(--border)'\n },\n mobile: { 'flex-direction': 'column', gap: '8px' }\n }\n});\n\n// ── Content ────────────────────────────────────────────────────────────────────────────────────────────────────\n\ntype Path = { id: string; title: string; body: string; path: string; icon: string; tone: keyof typeof tones };\n\n/**\n * The three ways to change this page — the builder, code, an agent — as data: the band is this list, mapped. They\n * are the same space either way, so any one of them can be put down and another picked up.\n */\nconst PATHS: (Path & { command?: string })[] = [\n {\n id: 'path-builder',\n title: 'In the builder',\n body: 'Select anything on this page and change it: drag elements in, style them, wire them to data, and publish.',\n path: 'elements',\n icon: 'fas fa-pen-ruler',\n tone: 'violet'\n },\n {\n id: 'path-code',\n title: 'In code',\n body: 'The same space as TypeScript, in a project of your own — served by your server, or pushed back here.',\n path: 'cli',\n icon: 'fas fa-code',\n tone: 'cyan',\n command: 'npx @plitzi/cli create my-site'\n },\n {\n id: 'path-agent',\n title: 'With an agent',\n body: 'Connect Claude or any MCP client. It reads and edits this space under the same rules as you do.',\n path: 'agents',\n icon: 'fas fa-robot',\n tone: 'blue'\n }\n];\n\n/** Where to read on, as data: the grid below is this list, mapped. Each one is a page of the docs. */\nconst GUIDES: Path[] = [\n {\n id: 'concepts',\n title: 'Core concepts',\n body: 'Spaces, pages, elements, and who owns what.',\n path: 'concepts',\n icon: 'fas fa-shapes',\n tone: 'violet'\n },\n {\n id: 'authoring',\n title: 'A space in code',\n body: 'One declaration in, two documents out.',\n path: 'authoring',\n icon: 'fas fa-code',\n tone: 'cyan'\n },\n {\n id: 'styling',\n title: 'Styling and themes',\n body: 'Classes, states, breakpoints, light and dark.',\n path: 'styling',\n icon: 'fas fa-palette',\n tone: 'rose'\n },\n {\n id: 'data',\n title: 'Data and bindings',\n body: 'Fetch from an API, show it anywhere.',\n path: 'data',\n icon: 'fas fa-database',\n tone: 'emerald'\n },\n {\n id: 'interactions',\n title: 'Interactions and flows',\n body: 'Clicks and forms wired to steps, no code.',\n path: 'interactions',\n icon: 'fas fa-bolt',\n tone: 'amber'\n },\n {\n id: 'quickstart',\n title: 'Quickstart',\n body: 'From a new space to a published site.',\n path: 'quickstart',\n icon: 'fas fa-flag-checkered',\n tone: 'blue'\n }\n];\n\nconst pathCard = (entry: (typeof PATHS)[number], index: number): ElementSpec =>\n link({\n id: entry.id,\n href: `${DOCS}/${entry.path}`,\n mode: 'external',\n target: 'blank',\n class: card,\n children: [\n container({\n class: cardHead,\n children: [\n container({ class: [tile, tones[entry.tone]], children: [fontAwesome({ icon: entry.icon })] }),\n // The number is for the eye: read out, \"1\" before \"In the builder\" says nothing the order does not.\n container({ class: step, decorative: true, children: [text({ content: String(index + 1) })] }),\n fontAwesome({ icon: 'fas fa-arrow-right', class: cardArrow })\n ]\n }),\n heading({ id: `${entry.id}-title`, content: entry.title, subType: 'h3', class: cardTitle }),\n paragraph({ content: entry.body, class: bodyText }),\n ...(entry.command\n ? [\n container({\n class: command,\n children: [\n container({ decorative: true, css: { color: 'var(--muted)' }, children: [text({ content: '$' })] }),\n text({ content: entry.command })\n ]\n })\n ]\n : [])\n ]\n });\n\nconst guideCard = (entry: Path): ElementSpec =>\n link({\n id: entry.id,\n href: `${DOCS}/${entry.path}`,\n mode: 'external',\n target: 'blank',\n class: [card, guide],\n children: [\n container({ class: [tile, tones[entry.tone]], children: [fontAwesome({ icon: entry.icon })] }),\n container({\n class: guideCopy,\n children: [\n heading({ id: `${entry.id}-title`, content: entry.title, subType: 'h3', class: cardTitle }),\n paragraph({ content: entry.body, class: bodyText })\n ]\n }),\n fontAwesome({ icon: 'fas fa-arrow-right', class: cardArrow })\n ]\n });\n\n/** A band's head: its kicker, its title, and a line saying what is in it. */\nconst sectionHeader = (id: string, kickerText: string, title: string, lede: string): ElementSpec =>\n container({\n class: sectionHead,\n children: [\n text({ content: kickerText, class: kicker }),\n heading({ id: `${id}-title`, content: title, subType: 'h2', class: sectionTitle }),\n paragraph({ content: lede, class: bodyText })\n ]\n });\n\n// ── The page ───────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst topBar = container({\n id: 'top-bar',\n subType: 'header',\n class: [shell, topBarBand],\n children: [\n link({\n id: 'brand',\n href: 'https://plitzi.com',\n mode: 'external',\n target: 'blank',\n class: navLink,\n children: [\n // The name beside it already says what the mark is: read out, it would say \"Plitzi\" twice.\n image({ src: 'https://cdn.plitzi.com/resources/img/favicon.svg', decorative: true, class: brandMark }),\n text({ content: 'Plitzi', css: { color: 'var(--foreground)', 'font-size': '16px', 'font-weight': '700' } })\n ]\n }),\n container({\n id: 'top-actions',\n subType: 'nav',\n label: 'Plitzi',\n css: { display: 'flex', 'align-items': 'center', gap: '8px' },\n children: [\n link({ id: 'top-docs', href: DOCS, mode: 'external', target: 'blank', class: navLink, content: 'Docs' }),\n themeToggle({ id: 'theme', class: iconButton })\n ]\n })\n ]\n});\n\nconst heroEyebrow = container({\n id: 'hero-eyebrow',\n css: {\n display: 'flex',\n 'align-items': 'center',\n gap: '8px',\n padding: '6px 12px',\n 'border-radius': '999px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n 'font-size': '13px',\n 'font-weight': '500'\n },\n children: [\n container({\n css: { width: '8px', height: '8px', 'border-radius': '999px', 'background-color': 'var(--tint-emerald)' }\n }),\n text({ content: 'Your new space', css: { color: 'var(--muted)' } })\n ]\n});\n\nconst heroTitle = heading({\n id: 'hero-title',\n content: 'Welcome to Plitzi',\n subType: 'h1',\n css: {\n desktop: {\n 'font-size': '64px',\n 'font-weight': '700',\n 'letter-spacing': '-0.03em',\n 'line-height': '1.05',\n 'text-align': 'center',\n margin: '0px'\n },\n tablet: { 'font-size': '48px' },\n mobile: { 'font-size': '38px' }\n }\n});\n\nconst heroLede = paragraph({\n id: 'hero-lede',\n content:\n 'This page is where your space starts, and it is already yours. Change any of it in the builder, in code, ' +\n 'or by asking an agent — below is how, and where to read more.',\n css: {\n desktop: {\n color: 'var(--muted)',\n 'font-size': '18px',\n 'line-height': '1.6',\n 'text-align': 'center',\n 'max-width': '600px',\n margin: '0px'\n },\n mobile: { 'font-size': '16px' }\n }\n});\n\nconst heroActions = container({\n id: 'hero-actions',\n css: {\n desktop: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n gap: '12px',\n 'margin-top': '8px'\n },\n mobile: { 'flex-direction': 'column', 'align-items': 'stretch', width: '100%' }\n },\n children: [\n link({\n id: 'cta-quickstart',\n href: `${DOCS}/quickstart`,\n mode: 'external',\n target: 'blank',\n class: button,\n variant: 'primary',\n content: 'Start the quickstart',\n icon: 'fas fa-arrow-right',\n iconPlacement: 'after'\n }),\n link({\n id: 'cta-docs',\n href: DOCS,\n mode: 'external',\n target: 'blank',\n class: button,\n content: 'Read the docs',\n icon: 'fas fa-book-open'\n })\n ]\n});\n\nexport const space: SpaceSpec = {\n name: 'New space',\n permanentUrl: 'new-space',\n mode: 'desktop-first',\n theme: { default: 'system', schemes: ['light', 'dark'] },\n /**\n * Every colour the page uses, per scheme.\n *\n * `default` is what a browser with no preference gets. Nothing above names a colour directly — they are all\n * `var(--…)` — so switching the palette here re-themes the whole page, in both schemes, without touching a rule.\n */\n variables: {\n color: {\n background: { light: '#fbfbfd', dark: '#09090b', default: '#fbfbfd' },\n foreground: { light: '#17171c', dark: '#fafafa', default: '#17171c' },\n muted: { light: '#5f5f6e', dark: '#a1a1aa', default: '#5f5f6e' },\n card: { light: '#ffffff', dark: '#111115', default: '#ffffff' },\n 'code-bg': { light: '#f4f4f8', dark: '#18181d', default: '#f4f4f8' },\n border: { light: '#e6e6ee', dark: '#27272d', default: '#e6e6ee' },\n primary: { light: '#5b3df5', dark: '#7c66ff', default: '#5b3df5' },\n 'primary-hover': { light: '#4a2de0', dark: '#9180ff', default: '#4a2de0' },\n 'primary-foreground': { light: '#ffffff', dark: '#ffffff', default: '#ffffff' },\n glow: { light: 'rgba(91, 61, 245, 0.16)', dark: 'rgba(124, 102, 255, 0.24)', default: 'rgba(91, 61, 245, 0.16)' },\n grid: { light: '#0000000d', dark: '#ffffff0d', default: '#0000000d' },\n 'tint-violet': { light: '#5b3df5', dark: '#b7a6ff', default: '#5b3df5' },\n 'tint-violet-bg': { light: '#efecfe', dark: '#1c1836', default: '#efecfe' },\n 'tint-cyan': { light: '#0e7490', dark: '#67d8ef', default: '#0e7490' },\n 'tint-cyan-bg': { light: '#e0f5fa', dark: '#0c2a33', default: '#e0f5fa' },\n 'tint-amber': { light: '#a45b00', dark: '#f5c169', default: '#a45b00' },\n 'tint-amber-bg': { light: '#fcf0dc', dark: '#2e2314', default: '#fcf0dc' },\n 'tint-rose': { light: '#c2255c', dark: '#f994bc', default: '#c2255c' },\n 'tint-rose-bg': { light: '#fce8f0', dark: '#331623', default: '#fce8f0' },\n 'tint-emerald': { light: '#0f7b55', dark: '#64d6a6', default: '#0f7b55' },\n 'tint-emerald-bg': { light: '#e0f6ee', dark: '#0e2a21', default: '#e0f6ee' },\n 'tint-blue': { light: '#2159c4', dark: '#8ab0f7', default: '#2159c4' },\n 'tint-blue-bg': { light: '#e6edfc', dark: '#13203c', default: '#e6edfc' }\n },\n shadow: {\n 'shadow-sm': {\n light: '0 1px 2px rgba(12, 12, 20, 0.05)',\n dark: '0 1px 2px rgba(0, 0, 0, 0.5)',\n default: '0 1px 2px rgba(12, 12, 20, 0.05)'\n },\n 'shadow-md': {\n light: '0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)',\n dark: '0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 24px -8px rgba(124, 102, 255, 0.55)',\n default: '0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)'\n },\n 'shadow-lg': {\n light: '0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)',\n dark: '0 2px 4px rgba(0, 0, 0, 0.6), 0 28px 56px -22px rgba(0, 0, 0, 0.85)',\n default: '0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)'\n }\n },\n custom: {\n 'font-sans':\n 'Geist, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n 'font-mono': '\"Geist Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'\n }\n },\n /** Loaded by the page itself: a face the space names here is the only one it ever fetches. */\n fonts: [\n {\n family: 'Geist',\n fallback: 'ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n weights: [400, 500, 600, 700],\n styles: ['normal'],\n display: 'swap',\n preload: true,\n source: 'google'\n },\n {\n family: 'Geist Mono',\n fallback: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',\n weights: [400],\n styles: ['normal'],\n display: 'swap',\n source: 'google'\n }\n ],\n /**\n * What text is, before any class touches it.\n *\n * Per element TYPE, so every heading and paragraph follows the palette without naming a colour — which is what\n * makes the dark scheme work: a hard-coded colour would win against the theme and leave black text on black.\n */\n elements: {\n page: { base: { 'font-family': 'var(--font-sans)' } },\n heading: { base: { color: 'var(--foreground)' } },\n text: { base: { color: 'inherit' } },\n paragraph: { base: { color: 'var(--foreground)' } },\n fontAwesome: { base: { color: 'inherit' } }\n },\n pages: [\n {\n id: 'home',\n name: 'Home',\n slug: '',\n isDefault: true,\n css: {\n 'flex-direction': 'column',\n position: 'relative',\n 'min-width': '100%',\n 'min-height': '100dvh',\n color: 'var(--foreground)',\n 'background-color': 'var(--background)',\n // A glow over the top of the page, in the palette's primary, so it follows the scheme like everything else.\n 'background-image': 'radial-gradient(60rem 32rem at 50% -8rem, var(--glow), transparent 70%)',\n 'background-repeat': 'no-repeat'\n },\n body: [\n container({ id: 'backdrop', class: backdrop, decorative: true }),\n topBar,\n container({\n id: 'main',\n subType: 'main',\n css: { display: 'flex', 'flex-direction': 'column' },\n children: [\n container({\n id: 'hero',\n class: [shell, heroBand],\n children: [heroEyebrow, heroTitle, heroLede, heroActions]\n }),\n container({\n id: 'paths',\n subType: 'section',\n label: 'Make it yours',\n class: [shell, cardsBand],\n children: [\n sectionHeader(\n 'paths',\n 'Make it yours',\n 'Three ways in, one space',\n 'Start with whichever suits you — the others see every change it makes.'\n ),\n container({ id: 'path-cards', class: cardGrid, children: PATHS.map(pathCard) })\n ]\n }),\n container({\n id: 'guides',\n subType: 'section',\n label: 'Guides',\n class: [shell, cardsBand],\n children: [\n sectionHeader(\n 'guides',\n 'Guides',\n 'Learn the building blocks',\n 'Each one is a page of the docs, short enough to read before you change the page it explains.'\n ),\n container({ id: 'cards', class: cardGrid, children: GUIDES.map(guideCard) })\n ]\n })\n ]\n }),\n container({\n id: 'footer',\n subType: 'footer',\n class: [shell, footerBand],\n children: [\n container({\n class: footerRow,\n children: [\n text({ content: 'Made with Plitzi', css: { color: 'var(--muted)', 'font-size': '13px' } }),\n link({\n id: 'footer-docs',\n href: DOCS,\n mode: 'external',\n target: 'blank',\n class: navLink,\n content: 'plitzi.com/docs'\n })\n ]\n })\n ]\n })\n ]\n }\n ]\n};\n";
|
|
23079
|
+
var spec_default$1 = "import { DOCS, GUIDES, PATHS } from './content.ts';\nimport {\n backdrop,\n bodyText,\n brandMark,\n button,\n card,\n cardArrow,\n cardGrid,\n cardHead,\n cardsBand,\n cardTitle,\n command,\n footerBand,\n footerRow,\n guide,\n guideCopy,\n heroBand,\n iconButton,\n kicker,\n navLink,\n sectionHead,\n sectionTitle,\n shell,\n step,\n tile,\n tones,\n topBarBand\n} from './theme.ts';\nimport { fonts, variables } from './tokens.ts';\nimport { container, fontAwesome, heading, image, link, paragraph, text, themeToggle } from '../../elements';\n\nimport type { Path } from './content.ts';\nimport type { ElementSpec, SpaceSpec } from '../../schema';\n\n/**\n * The space, declared: this file is the page, and it assembles the rest — the palette in `tokens.ts`, the classes in\n * `theme.ts`, what the page says in `content.ts`. Everything else — element ids, style selector names, the\n * back-references between them — is derived from what is written in them, so authoring it twice writes byte-identical\n * documents and there is no generated file to keep in step.\n *\n * It starts as the space Plitzi gives a new account, and it is yours: rename things, change the palette, delete the\n * guides. The paths and the guides are each one function mapped over one list, which is not a saving of keystrokes —\n * change `guideCard` and all six follow, add an entry to `GUIDES` and a seventh appears, styled like the rest.\n *\n * Name anything a test, a binding or an agent should be able to point at (`id: 'hero-title'`). An element with no\n * name gets a positional one, which moves the moment something is inserted above it.\n */\n\n// ── The cards ──────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst pathCard = (entry: (typeof PATHS)[number], index: number): ElementSpec =>\n link({\n id: entry.id,\n href: `${DOCS}/${entry.path}`,\n mode: 'external',\n target: 'blank',\n class: card,\n children: [\n container({\n class: cardHead,\n children: [\n container({ class: [tile, tones[entry.tone]], children: [fontAwesome({ icon: entry.icon })] }),\n // The number is for the eye: read out, \"1\" before \"In the builder\" says nothing the order does not.\n container({ class: step, decorative: true, children: [text({ content: String(index + 1) })] }),\n fontAwesome({ icon: 'fas fa-arrow-right', class: cardArrow })\n ]\n }),\n heading({ id: `${entry.id}-title`, content: entry.title, subType: 'h3', class: cardTitle }),\n paragraph({ content: entry.body, class: bodyText }),\n ...(entry.command\n ? [\n container({\n class: command,\n children: [\n container({ decorative: true, css: { color: 'var(--muted)' }, children: [text({ content: '$' })] }),\n text({ content: entry.command })\n ]\n })\n ]\n : [])\n ]\n });\n\nconst guideCard = (entry: Path): ElementSpec =>\n link({\n id: entry.id,\n href: `${DOCS}/${entry.path}`,\n mode: 'external',\n target: 'blank',\n class: [card, guide],\n children: [\n container({ class: [tile, tones[entry.tone]], children: [fontAwesome({ icon: entry.icon })] }),\n container({\n class: guideCopy,\n children: [\n heading({ id: `${entry.id}-title`, content: entry.title, subType: 'h3', class: cardTitle }),\n paragraph({ content: entry.body, class: bodyText })\n ]\n }),\n fontAwesome({ icon: 'fas fa-arrow-right', class: cardArrow })\n ]\n });\n\n/** A band's head: its kicker, its title, and a line saying what is in it. */\nconst sectionHeader = (id: string, kickerText: string, title: string, lede: string): ElementSpec =>\n container({\n class: sectionHead,\n children: [\n text({ content: kickerText, class: kicker }),\n heading({ id: `${id}-title`, content: title, subType: 'h2', class: sectionTitle }),\n paragraph({ content: lede, class: bodyText })\n ]\n });\n\n// ── The page ───────────────────────────────────────────────────────────────────────────────────────────────────\n\nconst topBar = container({\n id: 'top-bar',\n subType: 'header',\n class: [shell, topBarBand],\n children: [\n link({\n id: 'brand',\n href: 'https://plitzi.com',\n mode: 'external',\n target: 'blank',\n class: navLink,\n children: [\n // The name beside it already says what the mark is: read out, it would say \"Plitzi\" twice.\n image({ src: 'https://cdn.plitzi.com/resources/img/favicon.svg', decorative: true, class: brandMark }),\n text({ content: 'Plitzi', css: { color: 'var(--foreground)', 'font-size': '16px', 'font-weight': '700' } })\n ]\n }),\n container({\n id: 'top-actions',\n subType: 'nav',\n label: 'Plitzi',\n css: { display: 'flex', 'align-items': 'center', gap: '8px' },\n children: [\n link({ id: 'top-docs', href: DOCS, mode: 'external', target: 'blank', class: navLink, content: 'Docs' }),\n themeToggle({ id: 'theme', class: iconButton })\n ]\n })\n ]\n});\n\nconst heroEyebrow = container({\n id: 'hero-eyebrow',\n css: {\n display: 'flex',\n 'align-items': 'center',\n gap: '8px',\n padding: '6px 12px',\n 'border-radius': '999px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n 'font-size': '13px',\n 'font-weight': '500'\n },\n children: [\n container({\n css: { width: '8px', height: '8px', 'border-radius': '999px', 'background-color': 'var(--tint-emerald)' }\n }),\n text({ content: 'Your new space', css: { color: 'var(--muted)' } })\n ]\n});\n\nconst heroTitle = heading({\n id: 'hero-title',\n content: 'Welcome to Plitzi',\n subType: 'h1',\n css: {\n desktop: {\n 'font-size': '64px',\n 'font-weight': '700',\n 'letter-spacing': '-0.03em',\n 'line-height': '1.05',\n 'text-align': 'center',\n margin: '0px'\n },\n tablet: { 'font-size': '48px' },\n mobile: { 'font-size': '38px' }\n }\n});\n\nconst heroLede = paragraph({\n id: 'hero-lede',\n content:\n 'This page is where your space starts, and it is already yours. Change any of it in the builder, in code, ' +\n 'or by asking an agent — below is how, and where to read more.',\n css: {\n desktop: {\n color: 'var(--muted)',\n 'font-size': '18px',\n 'line-height': '1.6',\n 'text-align': 'center',\n 'max-width': '600px',\n margin: '0px'\n },\n mobile: { 'font-size': '16px' }\n }\n});\n\nconst heroActions = container({\n id: 'hero-actions',\n css: {\n desktop: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n gap: '12px',\n 'margin-top': '8px'\n },\n mobile: { 'flex-direction': 'column', 'align-items': 'stretch', width: '100%' }\n },\n children: [\n link({\n id: 'cta-quickstart',\n href: `${DOCS}/quickstart`,\n mode: 'external',\n target: 'blank',\n class: button,\n variant: 'primary',\n content: 'Start the quickstart',\n icon: 'fas fa-arrow-right',\n iconPlacement: 'after'\n }),\n link({\n id: 'cta-docs',\n href: DOCS,\n mode: 'external',\n target: 'blank',\n class: button,\n content: 'Read the docs',\n icon: 'fas fa-book-open'\n })\n ]\n});\n\nexport const space: SpaceSpec = {\n name: 'New space',\n permanentUrl: 'new-space',\n mode: 'desktop-first',\n theme: { default: 'system', schemes: ['light', 'dark'] },\n variables,\n fonts,\n /**\n * What text is, before any class touches it.\n *\n * Per element TYPE, so every heading and paragraph follows the palette without naming a colour — which is what\n * makes the dark scheme work: a hard-coded colour would win against the theme and leave black text on black.\n */\n elements: {\n page: { base: { 'font-family': 'var(--font-sans)' } },\n heading: { base: { color: 'var(--foreground)' } },\n text: { base: { color: 'inherit' } },\n paragraph: { base: { color: 'var(--foreground)' } },\n fontAwesome: { base: { color: 'inherit' } }\n },\n pages: [\n {\n id: 'home',\n name: 'Home',\n slug: '',\n isDefault: true,\n css: {\n 'flex-direction': 'column',\n position: 'relative',\n 'min-width': '100%',\n 'min-height': '100dvh',\n color: 'var(--foreground)',\n 'background-color': 'var(--background)',\n // A glow over the top of the page, in the palette's primary, so it follows the scheme like everything else.\n 'background-image': 'radial-gradient(60rem 32rem at 50% -8rem, var(--glow), transparent 70%)',\n 'background-repeat': 'no-repeat'\n },\n body: [\n container({ id: 'backdrop', class: backdrop, decorative: true }),\n topBar,\n container({\n id: 'main',\n subType: 'main',\n css: { display: 'flex', 'flex-direction': 'column' },\n children: [\n container({\n id: 'hero',\n class: [shell, heroBand],\n children: [heroEyebrow, heroTitle, heroLede, heroActions]\n }),\n container({\n id: 'paths',\n subType: 'section',\n label: 'Make it yours',\n class: [shell, cardsBand],\n children: [\n sectionHeader(\n 'paths',\n 'Make it yours',\n 'Three ways in, one space',\n 'Start with whichever suits you — the others see every change it makes.'\n ),\n container({ id: 'path-cards', class: cardGrid, children: PATHS.map(pathCard) })\n ]\n }),\n container({\n id: 'guides',\n subType: 'section',\n label: 'Guides',\n class: [shell, cardsBand],\n children: [\n sectionHeader(\n 'guides',\n 'Guides',\n 'Learn the building blocks',\n 'Each one is a page of the docs, short enough to read before you change the page it explains.'\n ),\n container({ id: 'cards', class: cardGrid, children: GUIDES.map(guideCard) })\n ]\n })\n ]\n }),\n container({\n id: 'footer',\n subType: 'footer',\n class: [shell, footerBand],\n children: [\n container({\n class: footerRow,\n children: [\n text({ content: 'Made with Plitzi', css: { color: 'var(--muted)', 'font-size': '13px' } }),\n link({\n id: 'footer-docs',\n href: DOCS,\n mode: 'external',\n target: 'blank',\n class: navLink,\n content: 'plitzi.com/docs'\n })\n ]\n })\n ]\n })\n ]\n }\n ]\n};\n";
|
|
23080
|
+
//#endregion
|
|
23081
|
+
//#region src/spaces/blank/theme.ts?raw
|
|
23082
|
+
var theme_default = "import { styles } from '../../style';\n\n/**\n * The classes the page wears, declared once and named by the elements that wear them — so re-theming a card re-themes\n * every card. Every colour in them is a `var(--…)` of the palette in `tokens.ts`.\n */\n\n/** The same outline on everything that can be focused from the keyboard. */\nconst focusRing = { outline: '2px solid var(--primary)', 'outline-offset': '3px' };\n\n// A band wears `shell` for its sides and a class of its own for its top and bottom, so both write their sides apart: a\n// `padding` shorthand in either would reset the other's. A class that owns its whole box writes the shorthand.\nexport const shell = styles('shell', {\n css: {\n desktop: {\n display: 'flex',\n 'flex-direction': 'column',\n width: '100%',\n 'max-width': '1120px',\n 'margin-left': 'auto',\n 'margin-right': 'auto',\n 'padding-left': '32px',\n 'padding-right': '32px',\n position: 'relative',\n 'z-index': '1'\n },\n tablet: { 'padding-left': '24px', 'padding-right': '24px' },\n mobile: { 'padding-left': '20px', 'padding-right': '20px' }\n }\n});\n\n/**\n * The grid behind the top of the page, fading into the background as it goes down.\n *\n * Gradients rather than an image: it scales to any screen, costs no request, and follows the theme — the line colour\n * and the fade are variables, so it is faint on light and faint on dark without a second asset. The fade is the first\n * layer, drawn over the lines, so the grid ends softly instead of at an edge.\n */\nexport const backdrop = styles('backdrop', {\n css: {\n desktop: {\n position: 'absolute',\n top: '0px',\n left: '0px',\n right: '0px',\n height: '760px',\n 'pointer-events': 'none',\n 'background-image':\n 'linear-gradient(180deg, transparent 0%, var(--background) 100%), linear-gradient(0deg, var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px)',\n 'background-size': '100% 100%, 48px 48px, 48px 48px',\n 'background-position': '0% 0%, 50% 0%, 50% 0%',\n 'background-repeat': 'no-repeat, repeat, repeat'\n },\n mobile: { height: '560px' }\n }\n});\n\nexport const navLink = styles('nav-link', {\n css: {\n display: 'flex',\n 'align-items': 'center',\n gap: '8px',\n color: 'var(--muted)',\n 'font-size': '14px',\n 'font-weight': '500',\n 'text-decoration': 'none',\n 'border-radius': '8px',\n padding: '6px 10px'\n },\n states: { hover: { color: 'var(--foreground)' }, 'focus-visible': focusRing }\n});\n\n/** The mark beside the name, at the size the bar wants. */\nexport const brandMark = styles('brand-mark', { width: '24px', height: '24px' });\n\n/** The theme switch, dressed like the rest of the bar: a browser draws a bare button grey and square. */\nexport const iconButton = styles('icon-button', {\n css: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n width: '36px',\n height: '36px',\n 'border-radius': '8px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n color: 'var(--muted)',\n 'font-size': '16px',\n cursor: 'pointer'\n },\n states: { hover: { color: 'var(--foreground)' }, 'focus-visible': focusRing }\n});\n\n/** A call to action. The base is the quiet one; `primary` is the one the eye should land on. */\nexport const button = styles('button', {\n css: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n gap: '8px',\n height: '44px',\n padding: '0px 20px',\n 'border-radius': '10px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n color: 'var(--foreground)',\n 'font-size': '15px',\n 'font-weight': '600',\n 'text-decoration': 'none',\n 'transition-property': 'background-color, border-color, transform',\n 'transition-duration': '150ms',\n 'transition-timing-function': 'ease-out'\n },\n states: {\n hover: { 'border-color': 'var(--muted)' },\n 'focus-visible': focusRing\n },\n variants: {\n primary: {\n css: {\n 'background-color': 'var(--primary)',\n 'border-color': 'var(--primary)',\n color: 'var(--primary-foreground)',\n 'box-shadow': 'var(--shadow-md)'\n },\n states: { hover: { 'background-color': 'var(--primary-hover)', 'border-color': 'var(--primary-hover)' } }\n }\n }\n});\n\n/** A section's small label over its title: what the band is about, in the palette's primary. */\nexport const kicker = styles('kicker', {\n color: 'var(--primary)',\n 'font-size': '13px',\n 'font-weight': '600',\n 'letter-spacing': '0.04em',\n 'text-transform': 'uppercase',\n margin: '0px'\n});\n\nexport const sectionTitle = styles('section-title', {\n css: {\n desktop: {\n 'font-size': '32px',\n 'font-weight': '700',\n 'letter-spacing': '-0.02em',\n 'line-height': '1.15',\n margin: '0px'\n },\n mobile: { 'font-size': '26px' }\n }\n});\n\nexport const sectionHead = styles('section-head', {\n display: 'flex',\n 'flex-direction': 'column',\n gap: '8px',\n 'margin-bottom': '8px'\n});\n\n/** Copy under a title or in a card: the palette's quiet colour, at a size made for reading. */\nexport const bodyText = styles('body-text', {\n color: 'var(--muted)',\n 'font-size': '15px',\n 'line-height': '1.6',\n margin: '0px'\n});\n\n/** A card of either band: the whole card is the link, so the target is as large as what it describes. */\nexport const card = styles('card', {\n css: {\n display: 'flex',\n 'flex-direction': 'column',\n gap: '12px',\n padding: '24px',\n 'border-radius': '16px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--card)',\n 'box-shadow': 'var(--shadow-sm)',\n 'text-decoration': 'none',\n 'transition-property': 'transform, border-color, box-shadow',\n 'transition-duration': '200ms',\n 'transition-timing-function': 'ease-out'\n },\n states: {\n hover: { transform: 'translateY(-3px)', 'border-color': 'var(--primary)', 'box-shadow': 'var(--shadow-lg)' },\n 'focus-visible': focusRing\n }\n});\n\nexport const cardHead = styles('card-head', { display: 'flex', 'align-items': 'center', gap: '10px' });\n\nexport const cardTitle = styles('card-title', {\n color: 'var(--foreground)',\n 'font-size': '17px',\n 'font-weight': '600',\n margin: '0px'\n});\n\n/** The arrow slides while the card around it is hovered. */\nexport const cardArrow = styles('card-arrow', {\n css: {\n color: 'var(--muted)',\n 'font-size': '13px',\n 'margin-left': 'auto',\n 'transition-property': 'transform, color',\n 'transition-duration': '200ms',\n 'transition-timing-function': 'ease-out'\n },\n ancestors: {\n [card.name]: { states: { hover: { transform: 'translateX(4px)', color: 'var(--primary)' } } }\n }\n});\n\n/** The square an icon sits in. Its colour is a tone, worn beside it: `class: [tile, tones.violet]`. */\nexport const tile = styles('tile', {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n width: '40px',\n height: '40px',\n 'flex-shrink': '0',\n 'border-radius': '10px',\n 'font-size': '16px'\n});\n\n/** One class per tone, each a pair of palette variables — so a tone is dark-ready the moment it is declared. */\nexport const tones = {\n violet: styles('tone-violet', { color: 'var(--tint-violet)', 'background-color': 'var(--tint-violet-bg)' }),\n cyan: styles('tone-cyan', { color: 'var(--tint-cyan)', 'background-color': 'var(--tint-cyan-bg)' }),\n amber: styles('tone-amber', { color: 'var(--tint-amber)', 'background-color': 'var(--tint-amber-bg)' }),\n emerald: styles('tone-emerald', { color: 'var(--tint-emerald)', 'background-color': 'var(--tint-emerald-bg)' }),\n rose: styles('tone-rose', { color: 'var(--tint-rose)', 'background-color': 'var(--tint-rose-bg)' }),\n blue: styles('tone-blue', { color: 'var(--tint-blue)', 'background-color': 'var(--tint-blue-bg)' })\n};\n\n/** A path's number, in a circle: the order the three are worth reading in, not an order they must be taken in. */\nexport const step = styles('step', {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'center',\n width: '28px',\n height: '28px',\n 'flex-shrink': '0',\n 'border-radius': '999px',\n border: '1px solid var(--border)',\n color: 'var(--muted)',\n 'font-size': '13px',\n 'font-weight': '600'\n});\n\n/** What a path does, as it would be typed — the one place the page shows code. */\nexport const command = styles('command', {\n display: 'flex',\n 'align-items': 'center',\n gap: '8px',\n 'margin-top': 'auto',\n padding: '10px 12px',\n 'border-radius': '10px',\n border: '1px solid var(--border)',\n 'background-color': 'var(--code-bg)',\n color: 'var(--foreground)',\n 'font-family': 'var(--font-mono)',\n 'font-size': '13px',\n 'white-space': 'nowrap',\n overflow: 'hidden'\n});\n\n/** A guide is smaller than a path: one line under its title, its icon beside it rather than above. */\nexport const guide = styles('guide', {\n 'flex-direction': 'row',\n 'align-items': 'flex-start',\n gap: '16px',\n padding: '20px'\n});\n\nexport const guideCopy = styles('guide-copy', {\n display: 'flex',\n 'flex-direction': 'column',\n gap: '4px',\n 'min-width': '0px'\n});\n\n/** Each band of the page wears `shell` for its width, and one of these for what is its own. */\nexport const topBarBand = styles('top-bar', {\n 'flex-direction': 'row',\n 'align-items': 'center',\n 'justify-content': 'space-between',\n 'padding-top': '20px',\n 'padding-bottom': '20px'\n});\n\nexport const heroBand = styles('hero', {\n css: {\n desktop: { 'align-items': 'center', gap: '24px', 'padding-top': '88px', 'padding-bottom': '88px' },\n tablet: { 'padding-top': '64px', 'padding-bottom': '64px' },\n mobile: { 'padding-top': '40px', 'padding-bottom': '48px' }\n }\n});\n\n/** The two bands of cards: the paths first, the guides after, each under its own head. */\nexport const cardsBand = styles('cards-band', { gap: '20px', 'padding-bottom': '80px' });\n\n/** Three columns that become two and then one, so a card is never narrower than its words. */\nexport const cardGrid = styles('card-grid', {\n css: {\n desktop: { display: 'grid', 'grid-template-columns': 'repeat(3, minmax(0, 1fr))', gap: '16px' },\n tablet: { 'grid-template-columns': 'repeat(2, minmax(0, 1fr))' },\n mobile: { 'grid-template-columns': 'minmax(0, 1fr)' }\n }\n});\n\n/** The footer's line spans the content, not the band's padding: it belongs to what it closes. */\nexport const footerBand = styles('footer', {\n css: {\n desktop: { 'margin-top': 'auto', 'padding-bottom': '32px' },\n mobile: { 'padding-bottom': '24px' }\n }\n});\n\nexport const footerRow = styles('footer-row', {\n css: {\n desktop: {\n display: 'flex',\n 'align-items': 'center',\n 'justify-content': 'space-between',\n gap: '16px',\n 'padding-top': '24px',\n 'border-top': '1px solid var(--border)'\n },\n mobile: { 'flex-direction': 'column', gap: '8px' }\n }\n});\n\n/** A tone by its name: what a card of `content.ts` says it is painted in. */\nexport type Tone = keyof typeof tones;\n";
|
|
23083
|
+
//#endregion
|
|
23084
|
+
//#region src/spaces/blank/tokens.ts?raw
|
|
23085
|
+
var tokens_default$1 = "import type { SpaceSpec } from '../../schema';\n\n/**\n * Every colour the page uses, per scheme.\n *\n * `default` is what a browser with no preference gets. No class names a colour directly — they are all `var(--…)` — so\n * switching the palette here re-themes the whole page, in both schemes, without touching a rule.\n */\nexport const variables: SpaceSpec['variables'] = {\n color: {\n background: { light: '#fbfbfd', dark: '#09090b', default: '#fbfbfd' },\n foreground: { light: '#17171c', dark: '#fafafa', default: '#17171c' },\n muted: { light: '#5f5f6e', dark: '#a1a1aa', default: '#5f5f6e' },\n card: { light: '#ffffff', dark: '#111115', default: '#ffffff' },\n 'code-bg': { light: '#f4f4f8', dark: '#18181d', default: '#f4f4f8' },\n border: { light: '#e6e6ee', dark: '#27272d', default: '#e6e6ee' },\n primary: { light: '#5b3df5', dark: '#7c66ff', default: '#5b3df5' },\n 'primary-hover': { light: '#4a2de0', dark: '#9180ff', default: '#4a2de0' },\n 'primary-foreground': { light: '#ffffff', dark: '#ffffff', default: '#ffffff' },\n glow: { light: 'rgba(91, 61, 245, 0.16)', dark: 'rgba(124, 102, 255, 0.24)', default: 'rgba(91, 61, 245, 0.16)' },\n grid: { light: '#0000000d', dark: '#ffffff0d', default: '#0000000d' },\n 'tint-violet': { light: '#5b3df5', dark: '#b7a6ff', default: '#5b3df5' },\n 'tint-violet-bg': { light: '#efecfe', dark: '#1c1836', default: '#efecfe' },\n 'tint-cyan': { light: '#0e7490', dark: '#67d8ef', default: '#0e7490' },\n 'tint-cyan-bg': { light: '#e0f5fa', dark: '#0c2a33', default: '#e0f5fa' },\n 'tint-amber': { light: '#a45b00', dark: '#f5c169', default: '#a45b00' },\n 'tint-amber-bg': { light: '#fcf0dc', dark: '#2e2314', default: '#fcf0dc' },\n 'tint-rose': { light: '#c2255c', dark: '#f994bc', default: '#c2255c' },\n 'tint-rose-bg': { light: '#fce8f0', dark: '#331623', default: '#fce8f0' },\n 'tint-emerald': { light: '#0f7b55', dark: '#64d6a6', default: '#0f7b55' },\n 'tint-emerald-bg': { light: '#e0f6ee', dark: '#0e2a21', default: '#e0f6ee' },\n 'tint-blue': { light: '#2159c4', dark: '#8ab0f7', default: '#2159c4' },\n 'tint-blue-bg': { light: '#e6edfc', dark: '#13203c', default: '#e6edfc' }\n },\n shadow: {\n 'shadow-sm': {\n light: '0 1px 2px rgba(12, 12, 20, 0.05)',\n dark: '0 1px 2px rgba(0, 0, 0, 0.5)',\n default: '0 1px 2px rgba(12, 12, 20, 0.05)'\n },\n 'shadow-md': {\n light: '0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)',\n dark: '0 1px 2px rgba(0, 0, 0, 0.6), 0 8px 24px -8px rgba(124, 102, 255, 0.55)',\n default: '0 1px 2px rgba(12, 12, 20, 0.06), 0 8px 20px -8px rgba(91, 61, 245, 0.45)'\n },\n 'shadow-lg': {\n light: '0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)',\n dark: '0 2px 4px rgba(0, 0, 0, 0.6), 0 28px 56px -22px rgba(0, 0, 0, 0.85)',\n default: '0 2px 4px rgba(12, 12, 20, 0.05), 0 24px 48px -20px rgba(12, 12, 20, 0.25)'\n }\n },\n custom: {\n 'font-sans':\n 'Geist, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n 'font-mono': '\"Geist Mono\", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'\n }\n};\n\n/** Loaded by the page itself: a face the space names here is the only one it ever fetches. */\nexport const fonts: SpaceSpec['fonts'] = [\n {\n family: 'Geist',\n fallback: 'ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif',\n weights: [400, 500, 600, 700],\n styles: ['normal'],\n display: 'swap',\n preload: true,\n source: 'google'\n },\n {\n family: 'Geist Mono',\n fallback: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',\n weights: [400],\n styles: ['normal'],\n display: 'swap',\n source: 'google'\n }\n];\n";
|
|
23086
|
+
//#endregion
|
|
23087
|
+
//#region src/spaces/empty/spec.ts
|
|
23088
|
+
/**
|
|
23089
|
+
* The space, declared — and nothing in it yet but what every space starts from: tokens for both themes, a layout the
|
|
23090
|
+
* pages render in, and one page.
|
|
23091
|
+
*
|
|
23092
|
+
* Add a page to `pages`, chrome every page shares (a header, a footer) to the layout around `site-main`, and a look
|
|
23093
|
+
* used twice as a class beside the ones below. Name anything a test, a binding or an agent should point at.
|
|
23094
|
+
*/
|
|
23095
|
+
/** The page around every page: the background, the type, and the column the pages render in. */
|
|
23096
|
+
var shell = styles("shell", {
|
|
23097
|
+
display: "flex",
|
|
23098
|
+
"flex-direction": "column",
|
|
23099
|
+
"min-height": "100vh",
|
|
23100
|
+
"background-color": "var(--background)",
|
|
23101
|
+
color: "var(--foreground)",
|
|
23102
|
+
"font-family": "system-ui, sans-serif"
|
|
23103
|
+
});
|
|
23104
|
+
var main = styles("main", {
|
|
23105
|
+
width: "100%",
|
|
23106
|
+
"max-width": "1120px",
|
|
23107
|
+
margin: "0px auto",
|
|
23108
|
+
padding: "48px 24px"
|
|
23109
|
+
});
|
|
23110
|
+
/** The line under a page's title: the palette's quiet colour. */
|
|
23111
|
+
var lede = styles("lede", {
|
|
23112
|
+
color: "var(--muted)",
|
|
23113
|
+
margin: "8px 0px 0px"
|
|
23114
|
+
});
|
|
22697
23115
|
var space$1 = {
|
|
22698
23116
|
name: "Empty space",
|
|
22699
23117
|
permanentUrl: "empty-space",
|
|
@@ -22716,39 +23134,17 @@ var space$1 = {
|
|
|
22716
23134
|
light: "#5f5f6e",
|
|
22717
23135
|
dark: "#a1a1aa",
|
|
22718
23136
|
default: "#5f5f6e"
|
|
22719
|
-
},
|
|
22720
|
-
border: {
|
|
22721
|
-
light: "#e6e6ee",
|
|
22722
|
-
dark: "#27272d",
|
|
22723
|
-
default: "#e6e6ee"
|
|
22724
|
-
},
|
|
22725
|
-
primary: {
|
|
22726
|
-
light: "#5b3df5",
|
|
22727
|
-
dark: "#7c66ff",
|
|
22728
|
-
default: "#5b3df5"
|
|
22729
23137
|
}
|
|
22730
23138
|
} },
|
|
22731
23139
|
layouts: [{
|
|
22732
23140
|
id: "site",
|
|
22733
23141
|
body: [container({
|
|
22734
23142
|
id: "site-shell",
|
|
22735
|
-
class:
|
|
22736
|
-
display: "flex",
|
|
22737
|
-
"flex-direction": "column",
|
|
22738
|
-
"min-height": "100vh",
|
|
22739
|
-
"background-color": "var(--background)",
|
|
22740
|
-
color: "var(--foreground)",
|
|
22741
|
-
"font-family": "system-ui, sans-serif"
|
|
22742
|
-
}),
|
|
23143
|
+
class: shell,
|
|
22743
23144
|
children: [container({
|
|
22744
23145
|
id: "site-main",
|
|
22745
23146
|
subType: "main",
|
|
22746
|
-
class:
|
|
22747
|
-
width: "100%",
|
|
22748
|
-
"max-width": "1120px",
|
|
22749
|
-
margin: "0px auto",
|
|
22750
|
-
padding: "48px 24px"
|
|
22751
|
-
})
|
|
23147
|
+
class: main
|
|
22752
23148
|
})]
|
|
22753
23149
|
})]
|
|
22754
23150
|
}],
|
|
@@ -22763,40 +23159,44 @@ var space$1 = {
|
|
|
22763
23159
|
body: [heading("Home", {
|
|
22764
23160
|
id: "home-title",
|
|
22765
23161
|
subType: "h1"
|
|
23162
|
+
}), paragraph({
|
|
23163
|
+
id: "home-lede",
|
|
23164
|
+
content: "What this site is about, in a line.",
|
|
23165
|
+
class: lede
|
|
22766
23166
|
})]
|
|
22767
23167
|
}]
|
|
22768
23168
|
};
|
|
22769
23169
|
//#endregion
|
|
22770
23170
|
//#region src/spaces/empty/spec.ts?raw
|
|
22771
|
-
var spec_default = "import { container, heading } from '../../elements';\nimport { styles } from '../../style';\n\nimport type { SpaceSpec } from '../../schema';\n\n/**\n * The space, declared — and nothing in it yet but what every space starts from: tokens for both themes, a layout the\n * pages render in, and one page.\n *\n * Add a page to `pages`, chrome every page shares (a header, a footer) to the layout around `site-main`, and a look\n * used twice as a class beside the
|
|
23171
|
+
var spec_default = "import { container, heading, paragraph } from '../../elements';\nimport { styles } from '../../style';\n\nimport type { SpaceSpec } from '../../schema';\n\n/**\n * The space, declared — and nothing in it yet but what every space starts from: tokens for both themes, a layout the\n * pages render in, and one page.\n *\n * Add a page to `pages`, chrome every page shares (a header, a footer) to the layout around `site-main`, and a look\n * used twice as a class beside the ones below. Name anything a test, a binding or an agent should point at.\n */\n\n/** The page around every page: the background, the type, and the column the pages render in. */\nconst shell = styles('shell', {\n display: 'flex',\n 'flex-direction': 'column',\n 'min-height': '100vh',\n 'background-color': 'var(--background)',\n color: 'var(--foreground)',\n 'font-family': 'system-ui, sans-serif'\n});\n\nconst main = styles('main', { width: '100%', 'max-width': '1120px', margin: '0px auto', padding: '48px 24px' });\n\n/** The line under a page's title: the palette's quiet colour. */\nconst lede = styles('lede', { color: 'var(--muted)', margin: '8px 0px 0px' });\n\nexport const space: SpaceSpec = {\n name: 'Empty space',\n permanentUrl: 'empty-space',\n theme: { default: 'system', schemes: ['light', 'dark'] },\n // Every colour, per scheme: elements say `var(--name)`, so the palette changes here and nowhere else. Add one when a\n // look needs it — a colour declared and read by nothing is one authoring points out (`unused-token`).\n variables: {\n color: {\n background: { light: '#fbfbfd', dark: '#09090b', default: '#fbfbfd' },\n foreground: { light: '#17171c', dark: '#fafafa', default: '#17171c' },\n muted: { light: '#5f5f6e', dark: '#a1a1aa', default: '#5f5f6e' }\n }\n },\n layouts: [\n {\n id: 'site',\n body: [\n container({\n id: 'site-shell',\n class: shell,\n children: [container({ id: 'site-main', subType: 'main', class: main })]\n })\n ]\n }\n ],\n pages: [\n {\n id: 'home',\n name: 'Home',\n slug: '',\n layout: { id: 'site', slot: 'site-main' },\n body: [\n heading('Home', { id: 'home-title', subType: 'h1' }),\n paragraph({ id: 'home-lede', content: 'What this site is about, in a line.', class: lede })\n ]\n }\n ]\n};\n";
|
|
22772
23172
|
//#endregion
|
|
22773
|
-
//#region templates/catalog/
|
|
23173
|
+
//#region templates/catalog/src/data/products.json?raw
|
|
22774
23174
|
var products_default = "{\n \"products\": [\n {\n \"slug\": \"desk-lamp\",\n \"title\": \"Desk lamp\",\n \"category\": \"lighting\",\n \"price\": 49,\n \"summary\": \"A warm, dimmable light for long evenings at the desk.\"\n },\n {\n \"slug\": \"floor-lamp\",\n \"title\": \"Floor lamp\",\n \"category\": \"lighting\",\n \"price\": 129,\n \"summary\": \"Tall, slim and bright enough for a whole corner.\"\n },\n {\n \"slug\": \"notebook\",\n \"title\": \"Dotted notebook\",\n \"category\": \"paper\",\n \"price\": 12,\n \"summary\": \"A5, 160 pages, lies flat when open.\",\n \"badge\": \"New\"\n },\n {\n \"slug\": \"planner\",\n \"title\": \"Weekly planner\",\n \"category\": \"paper\",\n \"price\": 18,\n \"summary\": \"A week on two pages, undated so it starts when you do.\"\n },\n {\n \"slug\": \"pen-set\",\n \"title\": \"Fineliner set\",\n \"category\": \"writing\",\n \"price\": 15,\n \"summary\": \"Six colours, 0.4 mm, quick to dry.\"\n },\n {\n \"slug\": \"fountain-pen\",\n \"title\": \"Fountain pen\",\n \"category\": \"writing\",\n \"price\": 64,\n \"summary\": \"A steel nib and a converter for any ink.\",\n \"badge\": \"Popular\"\n },\n {\n \"slug\": \"desk-mat\",\n \"title\": \"Felt desk mat\",\n \"category\": \"desk\",\n \"price\": 39,\n \"summary\": \"Wool felt, 90 × 40 cm, quiet under a keyboard.\"\n },\n {\n \"slug\": \"monitor-stand\",\n \"title\": \"Monitor stand\",\n \"category\": \"desk\",\n \"price\": 79,\n \"summary\": \"Oak, with room underneath for a keyboard.\"\n }\n ]\n}\n";
|
|
22775
23175
|
//#endregion
|
|
22776
|
-
//#region templates/catalog/src/
|
|
23176
|
+
//#region templates/catalog/src/space/components/productCard.ts?raw
|
|
22777
23177
|
var productCard_default = "/**\n * A product as a card, placed once per product: one component, so a change to the card is a change to every card. It\n * reads the product through its `item` prop and links to the product's own page. Its root is the list's item, an\n * `<li>`, laid out as a grid of one so the link fills it — the card is as tall as the row it sits in.\n */\nimport { heading, link, listItem, styles, text } from '@plitzi/sdk-authoring';\n\nimport { t } from '../tokens.ts';\n\nimport type { ComponentSpec } from '@plitzi/sdk-authoring';\n\nconst card = styles('product-card', {\n css: {\n display: 'flex',\n flexDirection: 'column',\n gap: 8,\n height: '100%',\n padding: '20px',\n borderRadius: '14px',\n border: `1px solid ${t.border}`,\n backgroundColor: t.surface,\n color: t.foreground,\n textDecoration: 'none',\n transition: 'border-color 150ms ease'\n },\n states: { hover: { borderColor: t.primary } }\n});\n\nconst badge = styles('product-badge', {\n alignSelf: 'flex-start',\n padding: '2px 10px',\n borderRadius: '999px',\n backgroundColor: t.primary,\n color: t['on-primary'],\n fontSize: '12px',\n fontWeight: 600\n});\n\nconst summary = styles('product-summary', { margin: '0px', color: t.muted, fontSize: '14px', flexGrow: 1 });\n\nconst price = styles('product-price', { fontWeight: 700 });\n\nexport const productCard: ComponentSpec = {\n id: 'product-card',\n props: { item: { type: 'json', description: 'The product: slug, title, summary, price and, maybe, a badge' } },\n root: listItem({\n id: 'card-item',\n css: { display: 'grid' },\n children: [\n link({\n id: 'card',\n href: '/products/{{ props.item.slug|url_encode }}',\n class: card,\n children: [\n text({ id: 'card-badge', class: badge, from: 'props.item.badge', visible: 'props.item.badge' }),\n heading({\n id: 'card-title',\n subType: 'h3',\n from: 'props.item.title',\n css: { margin: '0px', fontSize: '18px' }\n }),\n text({ id: 'card-summary', class: summary, from: 'props.item.summary' }),\n text({ id: 'card-price', class: price, from: 'props.item.price', as: 'price' })\n ]\n })\n ]\n })\n};\n";
|
|
22778
23178
|
//#endregion
|
|
22779
|
-
//#region templates/catalog/src/
|
|
22780
|
-
var data_default = "/**\n * The data the pages read: one JSON file the project
|
|
23179
|
+
//#region templates/catalog/src/space/data.ts?raw
|
|
23180
|
+
var data_default = "/**\n * The data the pages read: one JSON file of the project's own (`src/data/products.json`). Its contents type every\n * path a page writes — `products.data.products` — so a misspelt field is a type error, not an empty card. Swapping the\n * file for a real endpoint later changes `PRODUCTS`, and nothing else.\n */\nimport { source } from '@plitzi/sdk-authoring';\n\nimport sample from '../data/products.json' with { type: 'json' };\n\n/**\n * How a page asks for the products: on the server, which reads `src/data/` and never serves it — the page arrives\n * with them in it.\n */\nexport const PRODUCTS = { query: '/data/products.json', runtime: 'server' } as const;\n\n/** The categories the catalog filters by, in the order its select offers them. */\nexport const CATEGORIES = [\n { value: 'lighting', label: 'Lighting' },\n { value: 'paper', label: 'Paper' },\n { value: 'writing', label: 'Writing' },\n { value: 'desk', label: 'Desk' }\n] as const;\n\n/** The products file as the source of the provider named `id` — one per page, as ids are one namespace. */\nexport const productsSource = (id: string) => source(id, sample);\n";
|
|
23181
|
+
//#endregion
|
|
23182
|
+
//#region templates/catalog/src/space/index.ts?raw
|
|
23183
|
+
var space_default = "/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */\n/**\n * The space, assembled: a file per part, so each stays short enough to read whole — the tokens, the layout every page\n * shares, the product card, and one file per page. Add a page under `pages/` and list it here.\n *\n * The products are `src/data/products.json`, the project's own: a provider on each page reads it on the server.\n */\nimport { productCard } from './components/productCard.ts';\nimport { layout } from './layout.ts';\nimport { catalog } from './pages/catalog.ts';\nimport { home } from './pages/home.ts';\nimport { product } from './pages/product.ts';\nimport { variables } from './tokens.ts';\n\nimport type { SpaceSpec } from '@plitzi/sdk-authoring';\n\nexport const space: SpaceSpec = {\n name: 'Catalog',\n permanentUrl: 'catalog',\n theme: { default: 'system', schemes: ['light', 'dark'] },\n variables,\n // How a price is shown, said once: `text({ from: …, as: 'price' })` anywhere.\n formats: { price: \"{{ source|currency('USD', 'en', { trimZeros: true }) }}\" },\n layouts: [layout],\n components: [productCard],\n pages: [home, catalog, product]\n};\n";
|
|
22781
23184
|
//#endregion
|
|
22782
|
-
//#region templates/catalog/src/
|
|
23185
|
+
//#region templates/catalog/src/space/layout.ts?raw
|
|
22783
23186
|
var layout_default = "/**\n * The chrome every page shares — a header with the menu, and a footer — written once. Pages name the layout and the\n * slot their body goes in (`site-main`); the current menu entry comes from `activeOn`, not from each page.\n */\nimport { activeOn, container, link, styles, text } from '@plitzi/sdk-authoring';\n\nimport { t } from './tokens.ts';\n\nimport type { LayoutSpec } from '@plitzi/sdk-authoring';\n\nconst shell = styles('shell', {\n display: 'flex',\n flexDirection: 'column',\n minHeight: '100vh',\n backgroundColor: t.background,\n color: t.foreground,\n fontFamily: 'system-ui, sans-serif'\n});\n\nconst header = styles('site-header', {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n padding: '16px 24px',\n borderBottom: `1px solid ${t.border}`\n});\n\nconst brand = styles('brand', { fontWeight: 700, color: t.foreground, textDecoration: 'none' });\n\nconst nav = styles('nav', { display: 'flex', gap: 20 });\n\nconst navLink = styles('nav-link', {\n css: { color: t.muted, textDecoration: 'none' },\n variants: { active: { color: t.foreground, fontWeight: 600 } }\n});\n\nconst main = styles('main', {\n flexGrow: 1,\n width: '100%',\n maxWidth: '1120px',\n margin: '0px auto',\n padding: '40px 24px'\n});\n\nconst footer = styles('site-footer', { padding: '24px', color: t.muted, fontSize: '14px', textAlign: 'center' });\n\n/** The menu: one entry per section, and the pages that belong to it. */\nconst MENU = [\n { href: '/', label: 'Home', pages: ['home'] },\n { href: '/products', label: 'Products', pages: ['catalog', 'product'] }\n] as const;\n\nexport const layout: LayoutSpec = {\n id: 'site',\n body: [\n container({\n id: 'site-shell',\n class: shell,\n children: [\n container({\n id: 'site-header',\n subType: 'header',\n class: header,\n children: [\n link({ id: 'site-brand', href: '/', class: brand, content: 'Desk & Co.' }),\n container({\n id: 'site-nav',\n subType: 'nav',\n class: nav,\n children: MENU.map(entry =>\n link({\n href: entry.href,\n class: navLink,\n bind: [activeOn(navLink, [...entry.pages])],\n content: entry.label\n })\n )\n })\n ]\n }),\n container({ id: 'site-main', subType: 'main', class: main }),\n container({\n id: 'site-footer',\n subType: 'footer',\n class: footer,\n children: [text('Demo content: the products and their prices are made up.')]\n })\n ]\n })\n ]\n};\n";
|
|
22784
23187
|
//#endregion
|
|
22785
|
-
//#region templates/catalog/src/
|
|
22786
|
-
var catalog_default = "/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */\n/**\n * Every product, filtered by category: the select writes the choice to `state`, and the list shows only the rows\n * that match — with a count and an empty state read off the same predicate.\n */\nimport {\n apiContainer,\n container,\n formControl,\n heading,\n list,\n named,\n on,\n setState,\n styles,\n text\n} from '@plitzi/sdk-authoring';\n\nimport { CATEGORIES,
|
|
23188
|
+
//#region templates/catalog/src/space/pages/catalog.ts?raw
|
|
23189
|
+
var catalog_default = "/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */\n/**\n * Every product, filtered by category: the select writes the choice to `state`, and the list shows only the rows\n * that match — with a count and an empty state read off the same predicate.\n */\nimport {\n apiContainer,\n container,\n formControl,\n heading,\n list,\n named,\n on,\n setState,\n styles,\n text\n} from '@plitzi/sdk-authoring';\n\nimport { CATEGORIES, PRODUCTS, productsSource } from '../data.ts';\nimport { t } from '../tokens.ts';\n\nimport type { PageSpec } from '@plitzi/sdk-authoring';\n\n/** The product grid, shared with the home page: a list is a `<ul>`, so the bullets and the indent go. */\nexport const grid = styles('product-grid', {\n desktop: {\n display: 'grid',\n gridTemplateColumns: 'repeat(3, minmax(0, 1fr))',\n gap: 20,\n margin: '0px',\n padding: '0px',\n listStyleType: 'none'\n },\n tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' },\n mobile: { gridTemplateColumns: 'minmax(0, 1fr)' }\n});\n\nconst toolbar = styles('catalog-toolbar', {\n display: 'flex',\n alignItems: 'end',\n justifyContent: 'space-between',\n gap: 16,\n marginBottom: '24px'\n});\n\nconst muted = styles('muted', { color: t.muted });\n\n// One predicate, read three times: the rows, their count, and whether there are none.\nconst shown = \"source|filter(p => (state.category ?? 'all') == 'all' or p.category == state.category)\";\n\nconst products = productsSource('catalog-products');\n\nexport const catalog: PageSpec = {\n id: 'catalog',\n name: 'Products',\n slug: 'products',\n layout: { id: 'site', slot: 'site-main' },\n body: [\n heading('Products', { id: 'catalog-title', subType: 'h1' }),\n apiContainer({\n id: products.id,\n ...PRODUCTS,\n cache: true,\n children: [\n container({\n id: 'catalog-toolbar',\n class: toolbar,\n children: [\n // A control outside a form keeps its own value and fires `onChange` with `{ value, name }`.\n formControl({\n id: 'catalog-category',\n name: 'category',\n label: 'Category',\n subType: 'select',\n options: [\n { label: 'Everything', value: 'all' },\n ...CATEGORIES.map(({ value, label }) => ({ value, label }))\n ],\n defaultValue: 'all',\n // A filter always has an answer: the select is not a question that must be filled in.\n required: false,\n flows: [\n [\n named('picked', on('onChange')),\n setState({ key: 'category', type: 'text', value: '{{ picked.value }}' })\n ]\n ]\n }),\n text({ id: 'catalog-count', class: muted, from: products.data.products, as: `{{ ${shown}|length }} shown` })\n ]\n }),\n list({\n id: 'catalog-list',\n class: grid,\n from: products.data.products,\n as: `{{ ${shown} }}`,\n row: 'product-card'\n }),\n text('Nothing in that category yet.', {\n id: 'catalog-empty',\n class: muted,\n visible: { source: products.data.products, template: `{{ source is defined and ${shown}|length == 0 }}` }\n })\n ]\n })\n ]\n};\n";
|
|
22787
23190
|
//#endregion
|
|
22788
|
-
//#region templates/catalog/src/
|
|
22789
|
-
var home_default = "/** The home page: what the shop is, and the first products of the file as a way in. */\nimport { apiContainer, container, heading, link, list, styles, text } from '@plitzi/sdk-authoring';\n\nimport { grid } from './catalog.ts';\nimport {
|
|
23191
|
+
//#region templates/catalog/src/space/pages/home.ts?raw
|
|
23192
|
+
var home_default = "/** The home page: what the shop is, and the first products of the file as a way in. */\nimport { apiContainer, container, heading, link, list, styles, text } from '@plitzi/sdk-authoring';\n\nimport { grid } from './catalog.ts';\nimport { PRODUCTS, productsSource } from '../data.ts';\nimport { t } from '../tokens.ts';\n\nimport type { PageSpec } from '@plitzi/sdk-authoring';\n\nconst hero = styles('hero', { display: 'flex', flexDirection: 'column', gap: 16, padding: '48px 0px' });\n\nconst lede = styles('lede', { margin: '0px', maxWidth: '560px', color: t.muted, fontSize: '18px' });\n\nconst cta = styles('cta', {\n css: {\n alignSelf: 'flex-start',\n padding: '10px 18px',\n borderRadius: '10px',\n backgroundColor: t.primary,\n color: t['on-primary'],\n fontWeight: 600,\n textDecoration: 'none'\n },\n states: { hover: { opacity: 0.9 } }\n});\n\nconst featured = productsSource('home-products');\n\nexport const home: PageSpec = {\n id: 'home',\n name: 'Home',\n slug: '',\n layout: { id: 'site', slot: 'site-main' },\n body: [\n container({\n id: 'home-hero',\n subType: 'section',\n class: hero,\n children: [\n heading('Good things for a good desk', { id: 'home-title', subType: 'h1', css: { margin: '0px' } }),\n text('Lamps, paper and pens we would use ourselves.', { id: 'home-lede', class: lede }),\n link({ id: 'home-cta', href: '/products', class: cta, content: 'See every product' })\n ]\n }),\n apiContainer({\n id: featured.id,\n ...PRODUCTS,\n cache: true,\n children: [\n heading('Featured', { id: 'home-featured-title', subType: 'h2' }),\n list({\n id: 'home-featured',\n class: grid,\n from: featured.data.products,\n as: '{{ source|slice(0, 3) }}',\n row: 'product-card'\n })\n ]\n })\n ]\n};\n";
|
|
22790
23193
|
//#endregion
|
|
22791
|
-
//#region templates/catalog/src/
|
|
22792
|
-
var product_default = "/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */\n/**\n * A page per product, at `/products/<slug>`: the same file, narrowed to the product the address names — and a message,\n * not an empty page, when no product has that name.\n */\nimport { apiContainer, container, heading, link, list, listItem, styles, text } from '@plitzi/sdk-authoring';\n\nimport {
|
|
23194
|
+
//#region templates/catalog/src/space/pages/product.ts?raw
|
|
23195
|
+
var product_default = "/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */\n/**\n * A page per product, at `/products/<slug>`: the same file, narrowed to the product the address names — and a message,\n * not an empty page, when no product has that name.\n */\nimport { apiContainer, container, heading, link, list, listItem, styles, text } from '@plitzi/sdk-authoring';\n\nimport { PRODUCTS, productsSource } from '../data.ts';\nimport { t } from '../tokens.ts';\n\nimport type { PageSpec } from '@plitzi/sdk-authoring';\n\nconst detail = styles('product-detail', { display: 'flex', flexDirection: 'column', gap: 12, maxWidth: '640px' });\n\nconst back = styles('back-link', { color: t.muted, textDecoration: 'none' });\n\nconst products = productsSource('product-data');\n\nexport const product: PageSpec = {\n id: 'product',\n name: 'Product',\n slug: 'products/:slug',\n layout: { id: 'site', slot: 'site-main' },\n body: [\n link({ id: 'product-back', href: '/products', class: back, content: '← All products' }),\n apiContainer({\n id: products.id,\n ...PRODUCTS,\n cache: true,\n children: [\n list({\n id: 'product-one',\n // A list is a `<ul>`: one product reads as a page, not as an indented item.\n css: { margin: '0px', padding: '0px', listStyleType: 'none' },\n from: products.data.products,\n as: '{{ source|filter(p => p.slug == navigation.routeParams.slug) }}',\n // Shown once the file answers with the product; the message below is the other side of the question.\n visible: {\n source: products.data.products,\n template: \"{{ source|find('slug', navigation.routeParams.slug) }}\"\n },\n row: r =>\n listItem({\n id: 'product-item',\n children: [\n container({\n id: 'product-detail',\n subType: 'article',\n class: detail,\n children: [\n heading({ id: 'product-title', subType: 'h1', from: `${r.item}.title` }),\n text({ id: 'product-summary', from: `${r.item}.summary` }),\n text({\n id: 'product-price',\n from: `${r.item}.price`,\n as: 'price',\n css: { fontSize: '24px', fontWeight: 700 }\n })\n ]\n })\n ]\n })\n }),\n text('No product by that name.', {\n id: 'product-missing',\n visible: {\n source: products.data.products,\n template: \"{{ source is defined and not (source|find('slug', navigation.routeParams.slug)) }}\"\n }\n })\n ]\n })\n ]\n};\n";
|
|
22793
23196
|
//#endregion
|
|
22794
|
-
//#region templates/catalog/src/
|
|
23197
|
+
//#region templates/catalog/src/space/tokens.ts?raw
|
|
22795
23198
|
var tokens_default = "/**\n * Every colour the site uses, with a value for each theme. Elements say `t.<name>` — `var(--name)` — so the palette\n * changes here and nowhere else, and a name that is not here is a type error.\n */\nimport { tokens } from '@plitzi/sdk-authoring';\n\nimport type { SpaceSpec } from '@plitzi/sdk-authoring';\n\nexport const variables = {\n color: {\n background: { light: '#fbfbfd', dark: '#0b0b0f', default: '#fbfbfd' },\n surface: { light: '#ffffff', dark: '#15151b', default: '#ffffff' },\n foreground: { light: '#17171c', dark: '#f4f4f5', default: '#17171c' },\n muted: { light: '#5f5f6e', dark: '#a1a1aa', default: '#5f5f6e' },\n border: { light: '#e6e6ee', dark: '#2a2a32', default: '#e6e6ee' },\n primary: { light: '#4f46e5', dark: '#818cf8', default: '#4f46e5' },\n 'on-primary': { light: '#ffffff', dark: '#0b0b0f', default: '#ffffff' }\n }\n} satisfies SpaceSpec['variables'];\n\nexport const t = tokens(variables);\n";
|
|
22796
23199
|
//#endregion
|
|
22797
|
-
//#region templates/catalog/src/space.ts?raw
|
|
22798
|
-
var space_default = "/* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */\n/**\n * The space, assembled: a file per part, so each stays short enough to read whole — the tokens, the layout every page\n * shares, the product card, and one file per page. Add a page under `site/pages` and list it here.\n *\n * The products are `public/data/products.json`, served by this project; a provider on each page reads it like any API.\n */\nimport { productCard } from './site/components/productCard.ts';\nimport { layout } from './site/layout.ts';\nimport { catalog } from './site/pages/catalog.ts';\nimport { home } from './site/pages/home.ts';\nimport { product } from './site/pages/product.ts';\nimport { variables } from './site/tokens.ts';\n\nimport type { SpaceSpec } from '@plitzi/sdk-authoring';\n\nexport const space: SpaceSpec = {\n name: 'Catalog',\n permanentUrl: 'catalog',\n theme: { default: 'system', schemes: ['light', 'dark'] },\n variables,\n // How a price is shown, said once: `text({ from: …, as: 'price' })` anywhere.\n formats: { price: \"{{ source|currency('USD', 'en', { trimZeros: true }) }}\" },\n layouts: [layout],\n components: [productCard],\n pages: [home, catalog, product]\n};\n";
|
|
22799
|
-
//#endregion
|
|
22800
23200
|
//#region src/spaces/index.ts
|
|
22801
23201
|
/**
|
|
22802
23202
|
* The space a new space starts as — one page with a hero and six guides into the docs, not an empty document.
|
|
@@ -22807,7 +23207,7 @@ var space_default = "/* eslint-disable quotes -- templates quote their own strin
|
|
|
22807
23207
|
* copy — and a copy of a fixture is a fixture that is wrong six months later with nothing to say so.
|
|
22808
23208
|
*
|
|
22809
23209
|
* A declaration rather than an exported document, so whoever receives it can change it. `blankSpace()` is the
|
|
22810
|
-
* documents a renderer wants; `
|
|
23210
|
+
* documents a renderer wants; `blankTemplateFiles()` are its files, for a project that will edit them.
|
|
22811
23211
|
*/
|
|
22812
23212
|
/** The two documents, authored fresh — so one caller writing its own name in cannot mark the next one's copy. */
|
|
22813
23213
|
var blankSpace = () => authorSpace$1(space);
|
|
@@ -22827,11 +23227,20 @@ var toSource = (value) => {
|
|
|
22827
23227
|
if (typeof value === "object" && value !== null) return `{ ${Object.entries(value).map(([key, entry]) => `${/^[A-Za-z_$][\w$]*$/.test(key) ? key : toSource(key)}: ${toSource(entry)}`).join(", ")} }`;
|
|
22828
23228
|
return typeof value === "number" || typeof value === "boolean" ? String(value) : "null";
|
|
22829
23229
|
};
|
|
22830
|
-
|
|
22831
|
-
|
|
23230
|
+
/**
|
|
23231
|
+
* The welcome space as a project's files, by path: the page and the space in `index.ts`, the palette in `tokens.ts`,
|
|
23232
|
+
* the classes in `theme.ts`, what the page says in `content.ts` — a file per part, as a space is written once it is
|
|
23233
|
+
* more than a screen. The plugin a project hosts and the name it carries go in `index.ts`, which holds both.
|
|
23234
|
+
*/
|
|
23235
|
+
var blankTemplateFiles = ({ name, dir = "src/space", plugin } = {}) => {
|
|
22832
23236
|
const plugins = plugin === void 0 ? [] : Array.isArray(plugin) ? plugin : [plugin];
|
|
22833
|
-
const
|
|
22834
|
-
return
|
|
23237
|
+
const entry = toPortableSource(plugins.length > 0 ? withPluginHost(spec_default$1, plugins) : spec_default$1);
|
|
23238
|
+
return {
|
|
23239
|
+
[`${dir}/index.ts`]: name === void 0 ? entry : renameSpace(entry, name),
|
|
23240
|
+
[`${dir}/tokens.ts`]: toPortableSource(tokens_default$1),
|
|
23241
|
+
[`${dir}/theme.ts`]: toPortableSource(theme_default),
|
|
23242
|
+
[`${dir}/content.ts`]: toPortableSource(content_default)
|
|
23243
|
+
};
|
|
22835
23244
|
};
|
|
22836
23245
|
/**
|
|
22837
23246
|
* The space `plitzi create --template blank` starts from, as a file: tokens, a layout and one empty page — for a
|
|
@@ -22860,7 +23269,9 @@ var hostSource = (plugin, pad) => {
|
|
|
22860
23269
|
` id: '${plugin.data.id}',`,
|
|
22861
23270
|
` query: '${plugin.data.query}',`,
|
|
22862
23271
|
" cache: true,",
|
|
22863
|
-
|
|
23272
|
+
" children: [",
|
|
23273
|
+
` ${host(`${pad} `)}`,
|
|
23274
|
+
" ]",
|
|
22864
23275
|
"})"
|
|
22865
23276
|
].join(`\n${pad}`) : host(pad);
|
|
22866
23277
|
};
|
|
@@ -22876,29 +23287,43 @@ var hostSource = (plugin, pad) => {
|
|
|
22876
23287
|
* transform that silently does nothing hands back a plausible file with the interesting half missing.
|
|
22877
23288
|
*/
|
|
22878
23289
|
var withPluginHost = (source, plugins) => {
|
|
22879
|
-
if (!source.includes(PLUGIN_ANCHOR)) throw new Error("
|
|
23290
|
+
if (!source.includes(PLUGIN_ANCHOR)) throw new Error("blankTemplateFiles: cannot host a plugin — the hero's children are not where they were. Update PLUGIN_ANCHOR in src/spaces/index.ts to match the declaration.");
|
|
22880
23291
|
const asElement = plugins.every((plugin) => plugin.as === "element");
|
|
22881
23292
|
const fed = plugins.flatMap((plugin) => plugin.data ? [plugin.data.query] : []);
|
|
22882
|
-
const
|
|
22883
|
-
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
23293
|
+
const indent = /^\s*/.exec(source.split("\n").find((line) => line.includes(PLUGIN_ANCHOR)) ?? "")?.[0] ?? "";
|
|
23294
|
+
const pad = `${indent} `;
|
|
23295
|
+
const comment = [
|
|
23296
|
+
`${plugins.length === 1 ? "A component" : "Components"} of YOUR OWN, rendered by the space.`,
|
|
23297
|
+
"",
|
|
23298
|
+
...asElement ? [
|
|
23299
|
+
"An element of a plugin's own type — what the builder adds when somebody drops the plugin on a page, and",
|
|
23300
|
+
"how a space that loads it from its manifest hosts it. Every attribute arrives in the component as a prop",
|
|
23301
|
+
"of the same name — written here, or bound to a source."
|
|
23302
|
+
] : [
|
|
23303
|
+
"`renderType` is the name it is registered under in `src/main.ts`; every other attribute arrives in",
|
|
23304
|
+
"the component as a prop of the same name — written here, or bound to a source. See",
|
|
23305
|
+
"`plitzi/README.md`."
|
|
23306
|
+
],
|
|
23307
|
+
...fed.length > 0 ? [
|
|
23308
|
+
"",
|
|
23309
|
+
`Its numbers come from \`public${fed.join("`, `public")}\`, read by the provider around it like any API: data a`,
|
|
23310
|
+
"project with no backend serves itself, rather than figures written into the page."
|
|
23311
|
+
] : []
|
|
23312
|
+
];
|
|
23313
|
+
const element = [
|
|
23314
|
+
"children: [",
|
|
23315
|
+
...[
|
|
23316
|
+
"heroEyebrow,",
|
|
23317
|
+
"heroTitle,",
|
|
23318
|
+
"heroLede,",
|
|
23319
|
+
"heroActions,"
|
|
23320
|
+
].map((line) => `${pad}${line}`),
|
|
23321
|
+
`${pad}/**`,
|
|
23322
|
+
...comment.map((line) => line ? `${pad} * ${line}` : `${pad} *`),
|
|
23323
|
+
`${pad} */`,
|
|
23324
|
+
`${pad}${plugins.map((plugin) => hostSource(plugin, pad)).join(`,\n${pad}`)}`,
|
|
23325
|
+
`${indent}]`
|
|
23326
|
+
].join("\n");
|
|
22902
23327
|
return `import { ${[
|
|
22903
23328
|
...fed.length > 0 ? ["apiContainer"] : [],
|
|
22904
23329
|
...plugins.some((plugin) => plugin.as !== "element") ? ["custom"] : [],
|
|
@@ -22908,7 +23333,7 @@ var withPluginHost = (source, plugins) => {
|
|
|
22908
23333
|
/** Replaces one declared literal, and refuses to hand back a copy where it silently did not appear. */
|
|
22909
23334
|
var replaceLiteral = (source, field, from, to) => {
|
|
22910
23335
|
const declaration = `${field}: '${from}'`;
|
|
22911
|
-
if (!source.includes(declaration)) throw new Error(`
|
|
23336
|
+
if (!source.includes(declaration)) throw new Error(`Cannot rename the copy — "${declaration}" is not in the template's source. The declaration changed shape; update src/spaces/index.ts to match it.`);
|
|
22912
23337
|
return source.replace(declaration, `${field}: ${stringLiteral(to)}`);
|
|
22913
23338
|
};
|
|
22914
23339
|
/**
|
|
@@ -22923,6 +23348,8 @@ var renameSpace = (source, name, spec = space) => {
|
|
|
22923
23348
|
};
|
|
22924
23349
|
/** Matches an import of this package's own modules — the only kind the copy has to be freed of. */
|
|
22925
23350
|
var RELATIVE_IMPORT = /^import (type )?\{([^}]*)\} from '\.\.[^']*';$/;
|
|
23351
|
+
/** An import of a file beside this one, which travels with it: `./theme.ts`. */
|
|
23352
|
+
var SIBLING_IMPORT = /from '\.\/[^']*';$/;
|
|
22926
23353
|
/**
|
|
22927
23354
|
* The leading import block, one statement at a time.
|
|
22928
23355
|
*
|
|
@@ -22938,9 +23365,12 @@ var leadingImports = (lines) => {
|
|
|
22938
23365
|
for (const [index, line] of lines.entries()) {
|
|
22939
23366
|
if (pending.length === 0 && line.trim() === "") continue;
|
|
22940
23367
|
if (pending.length === 0 && !line.startsWith("import ")) break;
|
|
22941
|
-
pending.push(line
|
|
23368
|
+
pending.push(line);
|
|
22942
23369
|
if (line.trimEnd().endsWith(";")) {
|
|
22943
|
-
statements.push(
|
|
23370
|
+
statements.push({
|
|
23371
|
+
text: pending.map((each) => each.trim()).join(" "),
|
|
23372
|
+
written: pending.join("\n")
|
|
23373
|
+
});
|
|
22944
23374
|
pending = [];
|
|
22945
23375
|
end = index + 1;
|
|
22946
23376
|
}
|
|
@@ -22970,11 +23400,14 @@ var toPortableSource = (source) => {
|
|
|
22970
23400
|
const values = /* @__PURE__ */ new Set();
|
|
22971
23401
|
const types = /* @__PURE__ */ new Set();
|
|
22972
23402
|
const kept = [];
|
|
22973
|
-
|
|
23403
|
+
const siblings = [];
|
|
23404
|
+
const siblingTypes = [];
|
|
23405
|
+
for (const { text: statement, written } of statements) {
|
|
22974
23406
|
const match = RELATIVE_IMPORT.exec(statement);
|
|
22975
23407
|
if (!match) {
|
|
22976
|
-
if (statement.includes("from '..")) throw new Error(`toPortableSource: cannot rewrite "${statement}". Only named imports of this package's own modules can be pointed at @plitzi/sdk-authoring; the
|
|
22977
|
-
|
|
23408
|
+
if (statement.includes("from '..")) throw new Error(`toPortableSource: cannot rewrite "${statement}". Only named imports of this package's own modules can be pointed at @plitzi/sdk-authoring; the template's declaration must use one.`);
|
|
23409
|
+
if (SIBLING_IMPORT.test(statement)) (statement.startsWith("import type ") ? siblingTypes : siblings).push(written);
|
|
23410
|
+
else kept.push(written);
|
|
22978
23411
|
continue;
|
|
22979
23412
|
}
|
|
22980
23413
|
const [, isType, names] = match;
|
|
@@ -22983,16 +23416,17 @@ var toPortableSource = (source) => {
|
|
|
22983
23416
|
const portable = [[
|
|
22984
23417
|
...kept,
|
|
22985
23418
|
importOf(values, ""),
|
|
22986
|
-
|
|
23419
|
+
siblings.join("\n"),
|
|
23420
|
+
[importOf(types, "type "), ...siblingTypes].filter(Boolean).join("\n")
|
|
22987
23421
|
].filter(Boolean).join("\n\n"), ...lines.slice(end)].join("\n");
|
|
22988
23422
|
/**
|
|
22989
|
-
* Nothing
|
|
23423
|
+
* Nothing climbs out of the folder, including from below the import block.
|
|
22990
23424
|
*
|
|
22991
23425
|
* A dynamic `import('../x')` or a re-export further down would resolve to nothing in the project the copy is
|
|
22992
23426
|
* written into, and would do it at run time. Cheaper to refuse here than to ship a scaffold that fails on
|
|
22993
|
-
* somebody else's machine.
|
|
23427
|
+
* somebody else's machine. A sibling (`./theme.ts`) is one of the files copied with it, and stays.
|
|
22994
23428
|
*/
|
|
22995
|
-
if (/from '
|
|
23429
|
+
if (/from '\.(?:\.[/']|')/.test(portable)) throw new Error("toPortableSource: the copy still refers to a path relative to this package. A file copied into somebody else's project can only import from package names, or from the files copied beside it.");
|
|
22996
23430
|
return portable;
|
|
22997
23431
|
};
|
|
22998
23432
|
/** The name and address the catalog template is written under — what a copy under another name replaces. */
|
|
@@ -23001,26 +23435,91 @@ var CATALOG_TEMPLATE_IDENTITY = {
|
|
|
23001
23435
|
permanentUrl: "catalog"
|
|
23002
23436
|
};
|
|
23003
23437
|
/**
|
|
23004
|
-
*
|
|
23005
|
-
*
|
|
23006
|
-
* one screen is written. The files are the template's own (`templates/catalog`), the ones its test authors; they
|
|
23007
|
-
* import `@plitzi/sdk-authoring` by name already, so the copy is the file.
|
|
23438
|
+
* What a project with no server makes of the template's data: the file in `public/`, where the browser fetches it —
|
|
23439
|
+
* and so public, as everything there is — and the providers asking for it from the browser.
|
|
23008
23440
|
*/
|
|
23009
|
-
var
|
|
23441
|
+
var inBrowser = {
|
|
23442
|
+
data: (source) => source.replace("'../data/products.json'", "'../../public/data/products.json'").replace(/\/\*\*\n \* How a page asks for the products[\s\S]*?\*\/\nexport const PRODUCTS = \{ query: '\/data\/products\.json', runtime: 'server' \} as const;/, "/**\n * How a page asks for the products: the browser fetches `public/data/products.json`, public as all of `public/` is.\n */\nexport const PRODUCTS = { query: '/data/products.json' } as const;").replace("one JSON file of the project's own (`src/data/products.json`)", "one JSON file the project serves (`public/data/products.json`)"),
|
|
23443
|
+
space: (source) => source.replace("The products are `src/data/products.json`, the project's own: a provider on each page reads it on the server.", "The products are `public/data/products.json`, served by this project; a provider on each page fetches it.")
|
|
23444
|
+
};
|
|
23445
|
+
/**
|
|
23446
|
+
* The catalog template as a project's files, by path: a shop with a layout, a product card, a home, a filtered
|
|
23447
|
+
* catalog and a page per product — a file per part, as a space bigger than one screen is written. Its data is the
|
|
23448
|
+
* project's own, `src/data/products.json`, read on the server; a project with no server (`mode: 'client'`) has it in
|
|
23449
|
+
* `public/data/`, fetched by the browser. The files are the template's own (`templates/catalog`), the ones its test
|
|
23450
|
+
* authors; they import `@plitzi/sdk-authoring` by name already, so the copy is the file.
|
|
23451
|
+
*/
|
|
23452
|
+
var catalogTemplateFiles = ({ name, mode = "server" } = {}) => {
|
|
23453
|
+
const client = mode === "client";
|
|
23454
|
+
const space = name === void 0 ? space_default : renameSpace(space_default, name, CATALOG_TEMPLATE_IDENTITY);
|
|
23010
23455
|
const files = {
|
|
23011
|
-
"src/space.ts":
|
|
23012
|
-
"src/
|
|
23013
|
-
"src/
|
|
23014
|
-
"src/
|
|
23015
|
-
"src/
|
|
23016
|
-
"src/
|
|
23017
|
-
"src/
|
|
23018
|
-
"src/
|
|
23019
|
-
"public/data/products.json": products_default
|
|
23456
|
+
"src/space/index.ts": client ? inBrowser.space(space) : space,
|
|
23457
|
+
"src/space/tokens.ts": tokens_default,
|
|
23458
|
+
"src/space/data.ts": client ? inBrowser.data(data_default) : data_default,
|
|
23459
|
+
"src/space/layout.ts": layout_default,
|
|
23460
|
+
"src/space/components/productCard.ts": productCard_default,
|
|
23461
|
+
"src/space/pages/home.ts": home_default,
|
|
23462
|
+
"src/space/pages/catalog.ts": catalog_default,
|
|
23463
|
+
"src/space/pages/product.ts": product_default,
|
|
23464
|
+
[client ? "public/data/products.json" : "src/data/products.json"]: products_default
|
|
23020
23465
|
};
|
|
23021
23466
|
return Object.fromEntries(Object.entries(files).map(([path, source]) => [path, source.replace(/^\/\* eslint-disable quotes[^\n]*\*\/\n/, "")]));
|
|
23022
23467
|
};
|
|
23023
23468
|
//#endregion
|
|
23469
|
+
//#region src/testing/answerAction.ts
|
|
23470
|
+
var callOf = (request) => {
|
|
23471
|
+
if (request.method() !== "POST") return;
|
|
23472
|
+
try {
|
|
23473
|
+
const body = JSON.parse(request.postData() ?? "");
|
|
23474
|
+
if (typeof body !== "object" || body === null || !("actionId" in body) || typeof body.actionId !== "string") return;
|
|
23475
|
+
const input = "input" in body && typeof body.input === "object" && body.input !== null ? body.input : {};
|
|
23476
|
+
return {
|
|
23477
|
+
actionId: body.actionId,
|
|
23478
|
+
input
|
|
23479
|
+
};
|
|
23480
|
+
} catch {
|
|
23481
|
+
return;
|
|
23482
|
+
}
|
|
23483
|
+
};
|
|
23484
|
+
/**
|
|
23485
|
+
* Answers one server action in the browser, so a test never runs it: the page's `runServerAction` gets `output` as if
|
|
23486
|
+
* the server had completed the run, and the server — its `kv`, its files, what the developer saved — is not touched.
|
|
23487
|
+
*
|
|
23488
|
+
* For the test that would otherwise write the state it reads: one that opens windows changes the wall the developer
|
|
23489
|
+
* kept, and a wall somebody kept covers the controls the next test clicks. Every other call goes through.
|
|
23490
|
+
*
|
|
23491
|
+
* ```ts
|
|
23492
|
+
* await answerAction(page, 'world-workspace', { windows: [] });
|
|
23493
|
+
* await answerAction(page, 'search', input => ({ results: fixtureFor(input.query) }));
|
|
23494
|
+
* await openPage(page, '/');
|
|
23495
|
+
* ```
|
|
23496
|
+
*
|
|
23497
|
+
* Answers a `stream` step too, with the one `done` frame a run that streamed nothing ends with.
|
|
23498
|
+
*/
|
|
23499
|
+
var answerAction = async (page, actionId, answer, { path = "/_action" } = {}) => {
|
|
23500
|
+
await page.route(`**${path}`, async (route) => {
|
|
23501
|
+
const request = route.request();
|
|
23502
|
+
const call = callOf(request);
|
|
23503
|
+
if (call?.actionId !== actionId) {
|
|
23504
|
+
await route.fallback();
|
|
23505
|
+
return;
|
|
23506
|
+
}
|
|
23507
|
+
const result = {
|
|
23508
|
+
runId: `test-${actionId}`,
|
|
23509
|
+
status: "completed",
|
|
23510
|
+
output: typeof answer === "function" ? answer(call.input) : answer
|
|
23511
|
+
};
|
|
23512
|
+
const { accept = "" } = request.headers();
|
|
23513
|
+
await route.fulfill(accept.includes("text/event-stream") ? {
|
|
23514
|
+
contentType: "text/event-stream",
|
|
23515
|
+
body: `event: done\ndata: ${JSON.stringify(result)}\n\n`
|
|
23516
|
+
} : {
|
|
23517
|
+
contentType: "application/json",
|
|
23518
|
+
body: JSON.stringify(result)
|
|
23519
|
+
});
|
|
23520
|
+
});
|
|
23521
|
+
};
|
|
23522
|
+
//#endregion
|
|
23024
23523
|
//#region src/testing/dataIssues.ts
|
|
23025
23524
|
var PROVIDER = "apiContainer_";
|
|
23026
23525
|
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -23033,7 +23532,7 @@ var failureOf = (answer) => {
|
|
|
23033
23532
|
var pageElements = (schema, pageId) => {
|
|
23034
23533
|
const page = Object.hasOwn(schema.flat, pageId) ? schema.flat[pageId] : void 0;
|
|
23035
23534
|
const text = (value) => typeof value === "string" ? value : "";
|
|
23036
|
-
const shells = page ? t$
|
|
23535
|
+
const shells = page ? t$10((id) => Object.hasOwn(schema.flat, id) ? schema.flat[id] : void 0, text(page.attributes.layout), text(page.attributes.layoutContainer)).map((link) => link.layout) : [];
|
|
23037
23536
|
const roots = /* @__PURE__ */ new Set([pageId, ...shells]);
|
|
23038
23537
|
return Object.values(schema.flat).filter((element) => roots.has(element.definition.rootId));
|
|
23039
23538
|
};
|
|
@@ -23196,9 +23695,10 @@ function probePage(input) {
|
|
|
23196
23695
|
});
|
|
23197
23696
|
};
|
|
23198
23697
|
/** Why an element has no box, named by the node that takes it away — which is rarely the element itself. */
|
|
23199
|
-
const whyHidden = (node) => {
|
|
23698
|
+
const whyHidden = (node, list) => {
|
|
23200
23699
|
const hider = hiderOf(node);
|
|
23201
23700
|
if (hider) return `${hider.how} on ${hider.at === node ? "itself" : nameOf(hider.at)}`;
|
|
23701
|
+
if (list && node.childElementCount === 0) return "it is a list with no rows — its items are empty, or have not arrived. Show an empty state in its place, or make it `visible` only while it has rows";
|
|
23202
23702
|
if (getComputedStyle(node).display === "contents") return "it has no box of its own (display:contents) and nothing inside it shows";
|
|
23203
23703
|
const box = node.getBoundingClientRect();
|
|
23204
23704
|
return `it has no size (${Math.round(box.width)}×${Math.round(box.height)})`;
|
|
@@ -23211,7 +23711,7 @@ function probePage(input) {
|
|
|
23211
23711
|
const missing = [];
|
|
23212
23712
|
const hidden = [];
|
|
23213
23713
|
const byWidth = [];
|
|
23214
|
-
for (const { id, selector } of input.expected) {
|
|
23714
|
+
for (const { id, selector, list } of input.expected) {
|
|
23215
23715
|
const nodes = [...document.querySelectorAll(selector)];
|
|
23216
23716
|
if (nodes.length === 0) missing.push(id);
|
|
23217
23717
|
else if (!nodes.some(isVisible)) {
|
|
@@ -23219,7 +23719,7 @@ function probePage(input) {
|
|
|
23219
23719
|
if (hider && laidOutByWidth(hider.at)) byWidth.push(id);
|
|
23220
23720
|
else hidden.push({
|
|
23221
23721
|
id,
|
|
23222
|
-
reason: whyHidden(nodes[0])
|
|
23722
|
+
reason: whyHidden(nodes[0], list === true)
|
|
23223
23723
|
});
|
|
23224
23724
|
}
|
|
23225
23725
|
}
|
|
@@ -23432,7 +23932,8 @@ var inspect = async (driver, page, expected, options) => {
|
|
|
23432
23932
|
const input = {
|
|
23433
23933
|
expected: expected.map((handle) => ({
|
|
23434
23934
|
id: handle.id,
|
|
23435
|
-
selector: handle.selector
|
|
23935
|
+
selector: handle.selector,
|
|
23936
|
+
...handle.type === "list" ? { list: true } : {}
|
|
23436
23937
|
})),
|
|
23437
23938
|
images: !skip.has("images"),
|
|
23438
23939
|
overflow: !skip.has("overflow"),
|
|
@@ -23987,6 +24488,51 @@ var inspectRenders = async (page, act, options = {}) => {
|
|
|
23987
24488
|
return summariseRenders(await page.evaluate(commitsIn, mark), options.max);
|
|
23988
24489
|
};
|
|
23989
24490
|
//#endregion
|
|
24491
|
+
//#region src/testing/settle.ts
|
|
24492
|
+
/**
|
|
24493
|
+
* A request that is open for as long as the page is: a realtime channel's stream, a socket, a server action answering
|
|
24494
|
+
* as it goes. Waiting for it to end is waiting forever.
|
|
24495
|
+
*/
|
|
24496
|
+
var staysOpen = (request) => {
|
|
24497
|
+
const { accept = "" } = request.headers();
|
|
24498
|
+
return ["eventsource", "websocket"].includes(request.resourceType()) || accept.includes("text/event-stream");
|
|
24499
|
+
};
|
|
24500
|
+
/**
|
|
24501
|
+
* Opens a page and waits until it has settled: loaded, and nothing asked for in `quietMs` — the server data, the
|
|
24502
|
+
* images, the plugins it fetches after the HTML.
|
|
24503
|
+
*
|
|
24504
|
+
* What Playwright's `networkidle` would be if it knew a page with a live channel: `networkidle` counts the channel's
|
|
24505
|
+
* stream, which never ends, so on any page with a `channel` it never came — and every check of that page answered
|
|
24506
|
+
* that nothing was there. Answers what `goto` did: the response, or `null` when nothing answered.
|
|
24507
|
+
*/
|
|
24508
|
+
var openPage = async (page, url, { quietMs = 500, timeout = 15e3 } = {}) => {
|
|
24509
|
+
const open = /* @__PURE__ */ new Set();
|
|
24510
|
+
let lastChange = Date.now();
|
|
24511
|
+
const started = (request) => {
|
|
24512
|
+
if (!staysOpen(request)) {
|
|
24513
|
+
open.add(request);
|
|
24514
|
+
lastChange = Date.now();
|
|
24515
|
+
}
|
|
24516
|
+
};
|
|
24517
|
+
const ended = (request) => {
|
|
24518
|
+
if (open.delete(request)) lastChange = Date.now();
|
|
24519
|
+
};
|
|
24520
|
+
page.on("request", started);
|
|
24521
|
+
page.on("requestfinished", ended);
|
|
24522
|
+
page.on("requestfailed", ended);
|
|
24523
|
+
try {
|
|
24524
|
+
const answered = await page.goto(url, { waitUntil: "load" }).catch(() => null);
|
|
24525
|
+
if (!answered) return null;
|
|
24526
|
+
const deadline = Date.now() + timeout;
|
|
24527
|
+
while (Date.now() < deadline && (open.size > 0 || Date.now() - lastChange < quietMs)) await page.waitForTimeout(50);
|
|
24528
|
+
return answered;
|
|
24529
|
+
} finally {
|
|
24530
|
+
page.off("request", started);
|
|
24531
|
+
page.off("requestfinished", ended);
|
|
24532
|
+
page.off("requestfailed", ended);
|
|
24533
|
+
}
|
|
24534
|
+
};
|
|
24535
|
+
//#endregion
|
|
23990
24536
|
//#region src/testing/shortcut.ts
|
|
23991
24537
|
/** The drivers' names for the keys `parseKeys` writes in lower case; a single character is itself. */
|
|
23992
24538
|
var KEY_NAMES = {
|
|
@@ -24017,7 +24563,7 @@ var MODIFIER_NAMES = {
|
|
|
24017
24563
|
var isMacIn = () => /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
|
|
24018
24564
|
/** A shortcut as `onKey` writes it, as the key a driver presses. Refuses anything `onKey` would. */
|
|
24019
24565
|
var shortcutKey = (shortcut, isMac) => {
|
|
24020
|
-
const { combos, problems } = s$
|
|
24566
|
+
const { combos, problems } = s$11(shortcut, isMac);
|
|
24021
24567
|
if (problems.length > 0 || combos.length !== 1) throw new Error(problems.length > 0 ? `Not a shortcut: ${problems.join("; ")}` : `"${shortcut}" is ${combos.length} shortcuts: press one at a time`);
|
|
24022
24568
|
const [combo] = combos;
|
|
24023
24569
|
const plus = combo.endsWith("+");
|
|
@@ -24254,4 +24800,4 @@ var validateSnippet = (snippet, options = {}) => validateSnippet$1(snippet, {
|
|
|
24254
24800
|
...options
|
|
24255
24801
|
});
|
|
24256
24802
|
//#endregion
|
|
24257
|
-
export { AUTHORING_CODES, AuthoringError, BREAKPOINTS, BUILDER_NAMES, a as BUILTIN_ELEMENT_CALLBACKS, BUILTIN_GLOBAL_CALLBACKS, BUILTIN_TRANSFORMERS, BUILTIN_UTILITIES, CATALOG_TEMPLATE_IDENTITY, COMPONENT_SOURCES, ELEMENT_FIELDS, EXPLAIN_KINDS, FIXABLE_CODES, GLOBAL_SOURCES, t as MOTION_ENTERS, r as MOTION_LOOPS, n as MOTION_TRIGGERS, i as NOTIFICATIONS_FIELDS, PAGE_TEXT_LIMIT, SCHEMA_SETTINGS, i$1 as SCROLL_CALLBACKS, SET_STATE_TYPES, SPACE_FIELDS, STYLE_STATES, SpaceRefusedError, actionSpecFromEntry, actionToSource, activeOn, activeWhen, addNotification, alignPictures, announceOn, apiContainer, appendState, applyBuiltinCallback, s as applyElementCallback, applyUtility, assertSnippetValid, assertSpaceValid, authLogin, authLogout, authRefreshDetails, authorBinding, authorFlow, authorFlows, authorSnippet, authorSpace, authoringCodeEntry, authoringCodesTable, bindTemplate, blankSpace,
|
|
24803
|
+
export { AUTHORING_CODES, AuthoringError, BREAKPOINTS, BUILDER_NAMES, a as BUILTIN_ELEMENT_CALLBACKS, BUILTIN_GLOBAL_CALLBACKS, BUILTIN_TRANSFORMERS, BUILTIN_UTILITIES, CATALOG_TEMPLATE_IDENTITY, COMPONENT_SOURCES, ELEMENT_FIELDS, EXPLAIN_KINDS, FIXABLE_CODES, GLOBAL_SOURCES, t as MOTION_ENTERS, r as MOTION_LOOPS, n as MOTION_TRIGGERS, i as NOTIFICATIONS_FIELDS, PAGE_TEXT_LIMIT, SCHEMA_SETTINGS, i$1 as SCROLL_CALLBACKS, SET_STATE_TYPES, SPACE_FIELDS, STYLE_STATES, SpaceRefusedError, actionSource, actionSpecFromEntry, actionToSource, activeOn, activeWhen, addNotification, alignPictures, announceOn, answerAction, apiContainer, appendState, applyBuiltinCallback, s as applyElementCallback, applyUtility, assertSnippetValid, assertSpaceValid, authLogin, authLogout, authRefreshDetails, authorBinding, authorFlow, authorFlows, authorSnippet, authorSpace, authoringCodeEntry, authoringCodesTable, bindTemplate, blankSpace, space as blankSpaceSpec, blankTemplateFiles, blockHtml, blockJsx, buildHandles, button, cancelApi, cancelServerAction, carousel, carouselGoTo, carouselNext, carouselPause, carouselPlay, carouselPrevious, carouselTrack, catalogTemplateFiles, channel, className, classNames, classRefs, clearState, closeDialog, closeModal, column, compactSvg, comparePictures, compareSpaces, compareTexts, component, container, createTw, css, cssNumberValue, cssProperties, cssPropertyName, cssShorthands, custom, cycleState, darkScheme, dataIssues, declaredCallback, declaredTrigger, defaultAttributes, defaultLabel, defineAction, defineElement, delay, dialogContainer, diffPictures, digest, dropdown, dropdownPopup, element, elementAncestorTypes, elementAttributeNames, elementAttributeValues, elementCallbacks, elementCatalog, t$1 as elementDeclaration, elementDefaultAttributes, elementLeafTypes, elementPartTypes, elementSlots, elementSourceTypes, elementTriggers, elementTypeNames, elementsFromManifest, embed, emptySpaceSource, space$1 as emptySpaceSpec, expandShorthand, expandShorthandPatch, explain, explainKindOf, explainList, explanationText, failedFlowText, fixSpace, flagGateOf, flagSpecOf, flowStepIds, fontAwesome, form, formControl, o as getElementCallback, getGlobalCallback, getTransformer, getUtility, grid, groupBindings, hasVisibilityBinding, heading, t$2 as hiddenParams, hiddenWhen, hostAction, image, importProbe, importSlug, importedFiles, inferredLinkMode, inspectDocument, inspectPage, inspectRenders, instanceSelectorFor, o$1 as invalidParams, invalidateQueries, isClassModifier, isCssProperty, isCustomProperty, isRuleSetSpec, isStyleDeclaration, isSuggestionCode, link, lintSpace, list, listItem, loadImages, locate, markdown, n$1 as missingRequiredParams, modalContainer, modifierClassName, moveState, named, navigate, nodeHtml, notificationsCss, on, onClick, onFlowEnd, onFlowError, onFlowProgress, onInterval, onKey, onLoad, onPageLoad, onPointerDown, onScreen, onScroll, onSubmit, openDialog, openModal, openPage, pageFamily, pageRegions, pageTexts, pagination, paragraph, pathForSlug, planFixes, pressShortcut, profilePictures, publishOn, readDevTools, readDevToolsInPage, s$1 as reconcileParams, reference, refusalOf, reloadApi, removeState, resetForm, resolveSource, richText, row, runServerAction, sameBlocks, scope, scrollBy, scrollIntoView, scrollTo, selectorFor, setFieldValue, setState, shortcutKey, shorthandLonghands, singlePageSpace, slugify, source, e as spaceCallbacks, specFromSpace, specToSource, splitClassList, h as splitNotificationsCss, stepState, styles, suggestCssProperty, suggestSpace, suggestTransformer, summariseRenders, svg, tabContainer, tabContainerBody, tabContainerHeader, tabContainerItem, text, themeToggle, toBindingSpecs, toBlocks, i$2 as toBuilderParams, a$1 as toInteractionCallback, o$2 as toInteractionCallbacks, toPortableSource, toResponsive, toggleElement, toggleInState, toggleState, tokens, transformerCatalog, tw, twig, twigTemplate, typeCallbackDefinitions, typeTriggerDefinitions, unrollPage, unusedDeclarations, updateElement, validateSnippet, validateSpace, e$1 as valuesOf, variantFrom, video, visibleWhen, webHook, when, whenFailed, whenSucceeded, whileRunning, withElement, withNamedIds, withNotificationsCss, withPluginCatalogs, withVisibility };
|