@plitzi/sdk-authoring 0.39.4 → 0.39.7
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 +18 -0
- package/dist/index-src.js +747 -323
- package/dist/index.d.ts +66 -9
- package/dist/index.js +2 -2
- package/dist/node.d.ts +24 -1
- package/dist/node.js +1 -1
- package/dist/plugin.d.ts +1 -1
- package/package.json +9 -9
- package/skills/plitzi-authoring/reference/authoring-errors.md +8 -4
- package/skills/plitzi-authoring/reference/efficiency.md +2 -1
- package/skills/plitzi-authoring/reference/layouts.md +2 -1
package/dist/index-src.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e$63, r as r$
|
|
1
|
+
import { n as e$63, r as r$57 } from "./index-declare.js";
|
|
2
2
|
// \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -34,30 +34,30 @@ var n$71 = (n, r) => ({
|
|
|
34
34
|
...r.canBind === void 0 ? {} : { canBind: r.canBind },
|
|
35
35
|
...r.elementType === void 0 ? {} : { elementType: r.elementType }
|
|
36
36
|
});
|
|
37
|
-
var r$
|
|
38
|
-
var i$
|
|
39
|
-
let t = r$
|
|
40
|
-
return t || (t = Object.fromEntries(Object.entries(e).map(([e, t]) => [e, n$71(e, t)])), r$
|
|
37
|
+
var r$56 = /* @__PURE__ */ new WeakMap();
|
|
38
|
+
var i$48 = (e) => {
|
|
39
|
+
let t = r$56.get(e);
|
|
40
|
+
return t || (t = Object.fromEntries(Object.entries(e).map(([e, t]) => [e, n$71(e, t)])), r$56.set(e, t)), t;
|
|
41
41
|
};
|
|
42
|
-
var a$
|
|
42
|
+
var a$34 = (e, t, n, r = {}) => ({
|
|
43
43
|
action: e,
|
|
44
44
|
title: t.title,
|
|
45
45
|
type: t.type ?? "globalCallback",
|
|
46
46
|
callback: n,
|
|
47
47
|
preview: t.preview ?? {},
|
|
48
|
-
params: i$
|
|
48
|
+
params: i$48(t.params),
|
|
49
49
|
...r
|
|
50
50
|
});
|
|
51
|
-
var o$36 = (e, t, n = {}) => Object.fromEntries(Object.keys(e).map((r) => [r, a$
|
|
51
|
+
var o$36 = (e, t, n = {}) => Object.fromEntries(Object.keys(e).map((r) => [r, a$34(r, e[r], t[r], n[r] ?? {})]));
|
|
52
52
|
// ../sdk-shared/dist/helpers/twigWrapper/tokens/tokenPatterns.mjs
|
|
53
53
|
var e$61 = "[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*";
|
|
54
54
|
var t$87 = `(?:${e$61}|\\d+)`;
|
|
55
55
|
var n$70 = `\\[\\s*(?:\\d+|'[^']*'|"[^"]*"|${e$61}(?:\\.${t$87})*)\\s*\\]`;
|
|
56
|
-
var r$
|
|
57
|
-
var i$
|
|
58
|
-
var a$
|
|
59
|
-
var o$35 = new RegExp(a$
|
|
60
|
-
var s$33 = RegExp(`^${a$
|
|
56
|
+
var r$55 = `${`${e$61}(?:${n$70})*(?:\\??\\.${t$87}(?:${n$70})*)*`}(?:\\s*\\?\\?\\s*[^|{}]+?)?(?:\\s*\\|\\s*[a-zA-Z_]+(?:\\([^)]*\\))?)*`;
|
|
57
|
+
var i$47 = `\\{\\{\\s*${r$55}\\s*\\}\\}`;
|
|
58
|
+
var a$33 = `(?:${`\\{\\{\\{\\s*${r$55}\\s*\\}\\}\\}`}|${i$47})`;
|
|
59
|
+
var o$35 = new RegExp(a$33, "g");
|
|
60
|
+
var s$33 = RegExp(`^${a$33}$`);
|
|
61
61
|
// ../sdk-shared/dist/helpers/twigWrapper/tokens/hasValidToken.mjs
|
|
62
62
|
var n$69 = (n, r = !1) => {
|
|
63
63
|
if (typeof n != "string") return !1;
|
|
@@ -80,17 +80,17 @@ var n$68 = (e, t, n) => {
|
|
|
80
80
|
for (let [i, a] of Object.entries(n)) a.when && e[i] !== void 0 && !a.when(t) && r.push(i);
|
|
81
81
|
return r;
|
|
82
82
|
};
|
|
83
|
-
var r$
|
|
83
|
+
var r$54 = (e, t, n) => {
|
|
84
84
|
let r = [];
|
|
85
85
|
for (let [i, a] of Object.entries(n)) a.required && e[i] === void 0 && (!a.when || a.when(t)) && r.push(i);
|
|
86
86
|
return r;
|
|
87
87
|
};
|
|
88
|
-
var i$
|
|
89
|
-
var a$
|
|
88
|
+
var i$46 = (e) => e.trim() !== "" && Number.isFinite(Number(e));
|
|
89
|
+
var a$32 = (t) => typeof t == "string" && n$69(t);
|
|
90
90
|
var o$34 = (e, t) => {
|
|
91
91
|
switch (t.type) {
|
|
92
92
|
case "boolean": return typeof e == "boolean";
|
|
93
|
-
case "number": return typeof e == "number" || typeof e == "string" && i$
|
|
93
|
+
case "number": return typeof e == "number" || typeof e == "string" && i$46(e);
|
|
94
94
|
case "select": return typeof e == "string" && (!t.options || t.options.includes(e));
|
|
95
95
|
case "scalar": return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
|
|
96
96
|
case "json": return typeof e == "string" || typeof e == "number" || typeof e == "boolean" || typeof e == "object" && !!e;
|
|
@@ -104,7 +104,7 @@ var s$32 = (e, t, n) => {
|
|
|
104
104
|
let r = [];
|
|
105
105
|
for (let [i, s] of Object.entries(n)) {
|
|
106
106
|
let n = e[i];
|
|
107
|
-
n === void 0 || a$
|
|
107
|
+
n === void 0 || a$32(n) || s.when && !s.when(t) || o$34(n, s) || r.push({
|
|
108
108
|
key: i,
|
|
109
109
|
expected: s.type,
|
|
110
110
|
got: n === null ? "null" : typeof n,
|
|
@@ -113,7 +113,7 @@ var s$32 = (e, t, n) => {
|
|
|
113
113
|
}
|
|
114
114
|
return r;
|
|
115
115
|
};
|
|
116
|
-
var c$
|
|
116
|
+
var c$33 = (e, t, n) => {
|
|
117
117
|
let r = {};
|
|
118
118
|
for (let [i, a] of Object.entries(e)) (!n || i in t) && (r[i] = a);
|
|
119
119
|
for (let [e, n] of Object.entries(t)) n.default === void 0 || r[e] !== void 0 || n.when && !n.when(r) || (r[e] = n.default);
|
|
@@ -128,15 +128,15 @@ var t$85 = [
|
|
|
128
128
|
"nearest"
|
|
129
129
|
];
|
|
130
130
|
var s$31 = "onScroll";
|
|
131
|
-
var c$
|
|
131
|
+
var c$32 = "onView";
|
|
132
132
|
// ../sdk-shared/dist/authoring/elementCallbacks.mjs
|
|
133
|
-
var r$
|
|
133
|
+
var r$53 = {
|
|
134
134
|
type: "select",
|
|
135
135
|
description: "How it moves: \"smooth\" glides there, \"auto\" jumps.",
|
|
136
136
|
default: "smooth",
|
|
137
137
|
options: [...e$60]
|
|
138
138
|
};
|
|
139
|
-
var i$
|
|
139
|
+
var i$45 = {
|
|
140
140
|
scrollBy: {
|
|
141
141
|
title: "Scroll By",
|
|
142
142
|
type: "callback",
|
|
@@ -152,7 +152,7 @@ var i$44 = {
|
|
|
152
152
|
description: "How far down, the same way; negative goes up.",
|
|
153
153
|
default: ""
|
|
154
154
|
},
|
|
155
|
-
behavior: r$
|
|
155
|
+
behavior: r$53
|
|
156
156
|
}
|
|
157
157
|
},
|
|
158
158
|
scrollTo: {
|
|
@@ -170,7 +170,7 @@ var i$44 = {
|
|
|
170
170
|
description: "Where down, the same way. Empty stays.",
|
|
171
171
|
default: ""
|
|
172
172
|
},
|
|
173
|
-
behavior: r$
|
|
173
|
+
behavior: r$53
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
176
|
scrollIntoView: {
|
|
@@ -190,11 +190,11 @@ var i$44 = {
|
|
|
190
190
|
default: "nearest",
|
|
191
191
|
options: [...t$85]
|
|
192
192
|
},
|
|
193
|
-
behavior: r$
|
|
193
|
+
behavior: r$53
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
-
var a$
|
|
197
|
+
var a$31 = { focus: {
|
|
198
198
|
title: "Focus",
|
|
199
199
|
type: "callback",
|
|
200
200
|
strictParams: !0,
|
|
@@ -257,15 +257,15 @@ var o$33 = {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
},
|
|
260
|
-
...i$
|
|
261
|
-
...a$
|
|
260
|
+
...i$45,
|
|
261
|
+
...a$31
|
|
262
262
|
};
|
|
263
263
|
var s$30 = (e) => Object.hasOwn(o$33, e) ? o$33[e] : void 0;
|
|
264
|
-
var c$
|
|
264
|
+
var c$31 = (t, n) => {
|
|
265
265
|
let r = s$30(t);
|
|
266
266
|
return r ? {
|
|
267
267
|
known: !0,
|
|
268
|
-
params: c$
|
|
268
|
+
params: c$33(n, r.params, r.strictParams)
|
|
269
269
|
} : {
|
|
270
270
|
known: !1,
|
|
271
271
|
params: n
|
|
@@ -303,13 +303,13 @@ var n$67 = (n) => {
|
|
|
303
303
|
ignored: Object.entries(c).filter(([e, t]) => !t && n[e] !== void 0).map(([e]) => e)
|
|
304
304
|
};
|
|
305
305
|
};
|
|
306
|
-
var r$
|
|
306
|
+
var r$52 = {
|
|
307
307
|
placement: "top-right",
|
|
308
308
|
appearance: "success",
|
|
309
309
|
autoDismiss: !0,
|
|
310
310
|
autoDismissTimeout: 5e3
|
|
311
311
|
};
|
|
312
|
-
var i$
|
|
312
|
+
var i$44 = { addNotification: {
|
|
313
313
|
source: "space",
|
|
314
314
|
title: "Add Notification",
|
|
315
315
|
strictParams: !0,
|
|
@@ -322,25 +322,25 @@ var i$43 = { addNotification: {
|
|
|
322
322
|
placement: {
|
|
323
323
|
type: "select",
|
|
324
324
|
description: "Where the toast appears on screen.",
|
|
325
|
-
default: r$
|
|
325
|
+
default: r$52.placement,
|
|
326
326
|
options: [...e$59]
|
|
327
327
|
},
|
|
328
328
|
appearance: {
|
|
329
329
|
type: "select",
|
|
330
330
|
description: "Visual style of the notification: success, danger, warning or info.",
|
|
331
|
-
default: r$
|
|
331
|
+
default: r$52.appearance,
|
|
332
332
|
options: [...t$84]
|
|
333
333
|
},
|
|
334
334
|
autoDismiss: {
|
|
335
335
|
type: "boolean",
|
|
336
336
|
description: "Whether the notification dismisses itself after a timeout.",
|
|
337
|
-
default: r$
|
|
337
|
+
default: r$52.autoDismiss,
|
|
338
338
|
canBind: !1
|
|
339
339
|
},
|
|
340
340
|
autoDismissTimeout: {
|
|
341
341
|
type: "number",
|
|
342
342
|
description: "Milliseconds before auto-dismiss. Only applies when autoDismiss is true.",
|
|
343
|
-
default: r$
|
|
343
|
+
default: r$52.autoDismissTimeout,
|
|
344
344
|
when: (e) => e.autoDismiss === !0
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -879,7 +879,7 @@ var elementAttributeNames = {
|
|
|
879
879
|
tabContainer: [],
|
|
880
880
|
tabContainerBody: [],
|
|
881
881
|
tabContainerHeader: [],
|
|
882
|
-
tabContainerItem: [],
|
|
882
|
+
tabContainerItem: ["hash"],
|
|
883
883
|
text: [
|
|
884
884
|
"content",
|
|
885
885
|
"decorative",
|
|
@@ -901,7 +901,7 @@ var elementAttributeNames = {
|
|
|
901
901
|
]
|
|
902
902
|
};
|
|
903
903
|
// ../sdk-elements/dist/elements/advanced/BlockHtml/declaration.mjs
|
|
904
|
-
var t$83 = r$
|
|
904
|
+
var t$83 = r$57()({
|
|
905
905
|
type: "blockHtml",
|
|
906
906
|
content: {
|
|
907
907
|
attributes: { content: "" },
|
|
@@ -917,11 +917,11 @@ var t$83 = r$56()({
|
|
|
917
917
|
}
|
|
918
918
|
});
|
|
919
919
|
// ../sdk-elements/dist/elements/advanced/BlockJsx/declaration.mjs
|
|
920
|
-
var t$82 = r$
|
|
920
|
+
var t$82 = r$57()({
|
|
921
921
|
type: "blockJsx",
|
|
922
922
|
content: {
|
|
923
923
|
attributes: {
|
|
924
|
-
content: "import { useCallback } from \"react\";\nimport { JsxManager } from \"@plitzi/plitzi-sdk\";\n\nconst BlockJsx = ({ internalProps, content, content2 }) => {\n
|
|
924
|
+
content: "import { useCallback } from \"react\";\nimport { JsxManager } from \"@plitzi/plitzi-sdk\";\n\nconst BlockJsx = ({ internalProps, content, content2 }) => {\n const handleClick = useCallback(() => {\n alert(\"Hello World\");\n }, []);\n\n return (\n <div style={{ display: \"flex\", gap: \"4px\" }}>\n <JsxManager\n as=\"Heading\"\n internalProps={internalProps}\n content={`${content} ${content2}`}\n />\n <button onClick={handleClick} style={{ border: \"1px gray solid\", cursor: \"pointer\" }}>\n Click Me\n </button>\n </div>\n );\n};\n\nexport default BlockJsx;",
|
|
925
925
|
props: "{\"content\": \"Hello\", \"content2\": \"World\"}",
|
|
926
926
|
contentCache: "aW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnOwppbXBvcnQgeyB1c2VDYWxsYmFjayB9IGZyb20gInJlYWN0IjsKaW1wb3J0IHsgSnN4TWFuYWdlciB9IGZyb20gIkBwbGl0emkvcGxpdHppLXNkayI7CnZhciBCbG9ja0pzeCA9IGZ1bmN0aW9uIEJsb2NrSnN4KF9yZWYpIHsKICB2YXIgaW50ZXJuYWxQcm9wcyA9IF9yZWYuaW50ZXJuYWxQcm9wcywKICAgIGNvbnRlbnQgPSBfcmVmLmNvbnRlbnQsCiAgICBjb250ZW50MiA9IF9yZWYuY29udGVudDI7CiAgdmFyIGhhbmRsZUNsaWNrID0gdXNlQ2FsbGJhY2soZnVuY3Rpb24gKCkgewogICAgYWxlcnQoIkhlbGxvIFdvcmxkIik7CiAgfSwgW10pOwogIHJldHVybiAvKiNfX1BVUkVfXyovUmVhY3QuY3JlYXRlRWxlbWVudCgiZGl2IiwgewogICAgc3R5bGU6IHsKICAgICAgZGlzcGxheTogImZsZXgiLAogICAgICBnYXA6ICI0cHgiCiAgICB9CiAgfSwgLyojX19QVVJFX18qL1JlYWN0LmNyZWF0ZUVsZW1lbnQoSnN4TWFuYWdlciwgewogICAgYXM6ICJIZWFkaW5nIiwKICAgIGludGVybmFsUHJvcHM6IGludGVybmFsUHJvcHMsCiAgICBjb250ZW50OiAiIi5jb25jYXQoY29udGVudCwgIiAiKS5jb25jYXQoY29udGVudDIpCiAgfSksIC8qI19fUFVSRV9fKi9SZWFjdC5jcmVhdGVFbGVtZW50KCJidXR0b24iLCB7CiAgICBvbkNsaWNrOiBoYW5kbGVDbGljaywKICAgIHN0eWxlOiB7CiAgICAgIGJvcmRlcjogIjFweCBncmF5IHNvbGlkIiwKICAgICAgY3Vyc29yOiAncG9pbnRlcicKICAgIH0KICB9LCAiQ2xpY2sgTWUiKSk7Cn07CmV4cG9ydCBkZWZhdWx0IEJsb2NrSnN4Ow==",
|
|
927
927
|
allowEmptyRender: !1
|
|
@@ -938,7 +938,7 @@ var t$82 = r$56()({
|
|
|
938
938
|
}
|
|
939
939
|
});
|
|
940
940
|
// ../sdk-elements/dist/elements/advanced/Custom/declaration.mjs
|
|
941
|
-
var t$81 = r$
|
|
941
|
+
var t$81 = r$57()({
|
|
942
942
|
type: "custom",
|
|
943
943
|
content: {
|
|
944
944
|
attributes: {
|
|
@@ -967,7 +967,7 @@ var t$81 = r$56()({
|
|
|
967
967
|
}
|
|
968
968
|
});
|
|
969
969
|
// ../sdk-elements/dist/elements/advanced/NodeHtml/declaration.mjs
|
|
970
|
-
var t$80 = r$
|
|
970
|
+
var t$80 = r$57()({
|
|
971
971
|
type: "nodeHtml",
|
|
972
972
|
content: {
|
|
973
973
|
attributes: { subType: "div" },
|
|
@@ -991,7 +991,7 @@ var t$80 = r$56()({
|
|
|
991
991
|
}
|
|
992
992
|
});
|
|
993
993
|
// ../sdk-elements/dist/elements/advanced/PlitziSdk/declaration.mjs
|
|
994
|
-
var t$79 = r$
|
|
994
|
+
var t$79 = r$57()({
|
|
995
995
|
type: "plitziSdk",
|
|
996
996
|
content: {
|
|
997
997
|
attributes: {
|
|
@@ -1010,7 +1010,7 @@ var t$79 = r$56()({
|
|
|
1010
1010
|
}
|
|
1011
1011
|
});
|
|
1012
1012
|
// ../sdk-elements/dist/elements/advanced/Reference/declaration.mjs
|
|
1013
|
-
var t$78 = r$
|
|
1013
|
+
var t$78 = r$57()({
|
|
1014
1014
|
type: "reference",
|
|
1015
1015
|
content: {
|
|
1016
1016
|
attributes: {
|
|
@@ -1047,7 +1047,7 @@ var n$66 = {
|
|
|
1047
1047
|
"border-bottom-left-radius": "4px",
|
|
1048
1048
|
"border-bottom-right-radius": "4px"
|
|
1049
1049
|
};
|
|
1050
|
-
var r$
|
|
1050
|
+
var r$51 = r$57()({
|
|
1051
1051
|
type: "button",
|
|
1052
1052
|
contentAttributes: ["content"],
|
|
1053
1053
|
attributeValues: {
|
|
@@ -1102,7 +1102,7 @@ var r$50 = r$56()({
|
|
|
1102
1102
|
}
|
|
1103
1103
|
});
|
|
1104
1104
|
// ../sdk-elements/dist/elements/basic/Dropdown/declaration.mjs
|
|
1105
|
-
var n$65 = r$
|
|
1105
|
+
var n$65 = r$57()({
|
|
1106
1106
|
type: "dropdown",
|
|
1107
1107
|
attributeValues: {
|
|
1108
1108
|
popupPlacement: e$63()([
|
|
@@ -1182,7 +1182,7 @@ var n$65 = r$56()({
|
|
|
1182
1182
|
initialItems: ["dropdownPopup"]
|
|
1183
1183
|
});
|
|
1184
1184
|
// ../sdk-elements/dist/elements/basic/Dropdown/DropdownPopup/declaration.mjs
|
|
1185
|
-
var t$77 = r$
|
|
1185
|
+
var t$77 = r$57()({
|
|
1186
1186
|
type: "dropdownPopup",
|
|
1187
1187
|
ancestorType: "dropdown",
|
|
1188
1188
|
content: {
|
|
@@ -1228,7 +1228,7 @@ var t$77 = r$56()({
|
|
|
1228
1228
|
initialItems: []
|
|
1229
1229
|
});
|
|
1230
1230
|
// ../sdk-elements/dist/elements/basic/Heading/declaration.mjs
|
|
1231
|
-
var n$64 = r$
|
|
1231
|
+
var n$64 = r$57()({
|
|
1232
1232
|
type: "heading",
|
|
1233
1233
|
contentAttributes: ["content"],
|
|
1234
1234
|
attributeValues: { subType: e$63()([
|
|
@@ -1331,7 +1331,7 @@ var n$64 = r$56()({
|
|
|
1331
1331
|
}
|
|
1332
1332
|
});
|
|
1333
1333
|
// ../sdk-elements/dist/elements/basic/Link/declaration.mjs
|
|
1334
|
-
var n$63 = r$
|
|
1334
|
+
var n$63 = r$57()({
|
|
1335
1335
|
type: "link",
|
|
1336
1336
|
contentAttributes: [
|
|
1337
1337
|
"content",
|
|
@@ -1387,7 +1387,7 @@ var n$63 = r$56()({
|
|
|
1387
1387
|
}
|
|
1388
1388
|
});
|
|
1389
1389
|
// ../sdk-elements/dist/elements/basic/Markdown/declaration.mjs
|
|
1390
|
-
var t$76 = r$
|
|
1390
|
+
var t$76 = r$57()({
|
|
1391
1391
|
type: "markdown",
|
|
1392
1392
|
contentAttributes: ["content"],
|
|
1393
1393
|
content: {
|
|
@@ -1438,7 +1438,7 @@ var t$76 = r$56()({
|
|
|
1438
1438
|
}
|
|
1439
1439
|
});
|
|
1440
1440
|
// ../sdk-elements/dist/elements/basic/Paragraph/declaration.mjs
|
|
1441
|
-
var t$75 = r$
|
|
1441
|
+
var t$75 = r$57()({
|
|
1442
1442
|
type: "paragraph",
|
|
1443
1443
|
contentAttributes: ["content"],
|
|
1444
1444
|
content: {
|
|
@@ -1459,7 +1459,7 @@ var t$75 = r$56()({
|
|
|
1459
1459
|
}
|
|
1460
1460
|
});
|
|
1461
1461
|
// ../sdk-elements/dist/elements/basic/RichText/declaration.mjs
|
|
1462
|
-
var n$62 = r$
|
|
1462
|
+
var n$62 = r$57()({
|
|
1463
1463
|
type: "richText",
|
|
1464
1464
|
contentAttributes: ["content"],
|
|
1465
1465
|
attributeValues: { format: e$63()([
|
|
@@ -1518,7 +1518,7 @@ var n$62 = r$56()({
|
|
|
1518
1518
|
}
|
|
1519
1519
|
});
|
|
1520
1520
|
// ../sdk-elements/dist/elements/basic/Text/declaration.mjs
|
|
1521
|
-
var t$74 = r$
|
|
1521
|
+
var t$74 = r$57()({
|
|
1522
1522
|
type: "text",
|
|
1523
1523
|
contentAttributes: ["content"],
|
|
1524
1524
|
content: {
|
|
@@ -1557,7 +1557,7 @@ var n$61 = {
|
|
|
1557
1557
|
"letter-spacing": "inherit",
|
|
1558
1558
|
cursor: "pointer"
|
|
1559
1559
|
};
|
|
1560
|
-
var r$
|
|
1560
|
+
var r$50 = r$57()({
|
|
1561
1561
|
type: "themeToggle",
|
|
1562
1562
|
contentAttributes: [
|
|
1563
1563
|
"lightLabel",
|
|
@@ -1608,7 +1608,7 @@ var r$49 = r$56()({
|
|
|
1608
1608
|
}
|
|
1609
1609
|
});
|
|
1610
1610
|
// ../sdk-elements/dist/elements/form/Form/declaration.mjs
|
|
1611
|
-
var n$60 = r$
|
|
1611
|
+
var n$60 = r$57()({
|
|
1612
1612
|
type: "form",
|
|
1613
1613
|
attributeValues: { method: e$63()(["get", "post"]) },
|
|
1614
1614
|
sourceType: "apiContainer",
|
|
@@ -1742,7 +1742,7 @@ var e$57 = [
|
|
|
1742
1742
|
"file"
|
|
1743
1743
|
];
|
|
1744
1744
|
// ../sdk-elements/dist/elements/form/FormControl/declaration.mjs
|
|
1745
|
-
var r$
|
|
1745
|
+
var r$49 = {
|
|
1746
1746
|
width: "100%",
|
|
1747
1747
|
display: "flex",
|
|
1748
1748
|
"align-items": "center",
|
|
@@ -1771,11 +1771,11 @@ var r$48 = {
|
|
|
1771
1771
|
outline: "none",
|
|
1772
1772
|
position: "relative"
|
|
1773
1773
|
};
|
|
1774
|
-
var i$
|
|
1775
|
-
...r$
|
|
1774
|
+
var i$43 = {
|
|
1775
|
+
...r$49,
|
|
1776
1776
|
"line-height": "20px"
|
|
1777
1777
|
};
|
|
1778
|
-
var a$
|
|
1778
|
+
var a$30 = {
|
|
1779
1779
|
display: "flex",
|
|
1780
1780
|
cursor: "pointer",
|
|
1781
1781
|
"font-weight": "600",
|
|
@@ -1785,7 +1785,7 @@ var a$31 = {
|
|
|
1785
1785
|
"user-select": "none"
|
|
1786
1786
|
};
|
|
1787
1787
|
var o$32 = {
|
|
1788
|
-
...a$
|
|
1788
|
+
...a$30,
|
|
1789
1789
|
"margin-bottom": "4px"
|
|
1790
1790
|
};
|
|
1791
1791
|
var s$29 = {
|
|
@@ -1793,11 +1793,11 @@ var s$29 = {
|
|
|
1793
1793
|
color: "red",
|
|
1794
1794
|
"margin-top": "4px"
|
|
1795
1795
|
};
|
|
1796
|
-
var c$
|
|
1796
|
+
var c$30 = {
|
|
1797
1797
|
color: "red",
|
|
1798
1798
|
"margin-left": "4px"
|
|
1799
1799
|
};
|
|
1800
|
-
var l$
|
|
1800
|
+
var l$24 = {
|
|
1801
1801
|
"border-top-style": "none",
|
|
1802
1802
|
"border-right-style": "none",
|
|
1803
1803
|
"border-bottom-style": "none",
|
|
@@ -1811,7 +1811,7 @@ var u$27 = {
|
|
|
1811
1811
|
"padding-bottom": "0px",
|
|
1812
1812
|
"padding-left": "0px",
|
|
1813
1813
|
display: "block",
|
|
1814
|
-
...l$
|
|
1814
|
+
...l$24,
|
|
1815
1815
|
"background-color": "transparent",
|
|
1816
1816
|
color: "inherit",
|
|
1817
1817
|
"line-height": "inherit",
|
|
@@ -1824,7 +1824,7 @@ var d$23 = {
|
|
|
1824
1824
|
width: "100%",
|
|
1825
1825
|
"padding-right": "calc(1.15em + 8px)",
|
|
1826
1826
|
display: "block",
|
|
1827
|
-
...l$
|
|
1827
|
+
...l$24,
|
|
1828
1828
|
"background-color": "transparent",
|
|
1829
1829
|
color: "inherit",
|
|
1830
1830
|
"line-height": "inherit",
|
|
@@ -1845,7 +1845,7 @@ var f$20 = {
|
|
|
1845
1845
|
display: "flex",
|
|
1846
1846
|
"justify-content": "center",
|
|
1847
1847
|
"align-items": "center",
|
|
1848
|
-
...l$
|
|
1848
|
+
...l$24,
|
|
1849
1849
|
"background-color": "transparent",
|
|
1850
1850
|
color: "inherit",
|
|
1851
1851
|
"line-height": "inherit",
|
|
@@ -1855,7 +1855,7 @@ var f$20 = {
|
|
|
1855
1855
|
cursor: "pointer"
|
|
1856
1856
|
};
|
|
1857
1857
|
var p$14 = {
|
|
1858
|
-
...r$
|
|
1858
|
+
...r$49,
|
|
1859
1859
|
cursor: "pointer"
|
|
1860
1860
|
};
|
|
1861
1861
|
var m$13 = {
|
|
@@ -1897,12 +1897,12 @@ var h$7 = (e, t, { field: n, icon: r } = {}) => ({
|
|
|
1897
1897
|
...n ? { field: { default: n } } : {},
|
|
1898
1898
|
...r ? { icon: { default: r } } : {},
|
|
1899
1899
|
label: { default: o$32 },
|
|
1900
|
-
requiredMark: { default: c$
|
|
1900
|
+
requiredMark: { default: c$30 },
|
|
1901
1901
|
error: { default: s$29 }
|
|
1902
1902
|
}
|
|
1903
1903
|
});
|
|
1904
1904
|
var g$7 = { field: u$27 };
|
|
1905
|
-
var _$7 = r$
|
|
1905
|
+
var _$7 = r$57()({
|
|
1906
1906
|
type: "formControl",
|
|
1907
1907
|
contentAttributes: [
|
|
1908
1908
|
"label",
|
|
@@ -1984,22 +1984,22 @@ var _$7 = r$56()({
|
|
|
1984
1984
|
style: { base: { default: {} } },
|
|
1985
1985
|
subTypes: {
|
|
1986
1986
|
hidden: h$7("Form Control Hidden", {}),
|
|
1987
|
-
text: h$7("Form Control Text", i$
|
|
1988
|
-
number: h$7("Form Control Number", i$
|
|
1989
|
-
email: h$7("Form Control Email", i$
|
|
1990
|
-
password: h$7("Form Control Password", i$
|
|
1987
|
+
text: h$7("Form Control Text", i$43, g$7),
|
|
1988
|
+
number: h$7("Form Control Number", i$43, g$7),
|
|
1989
|
+
email: h$7("Form Control Email", i$43, g$7),
|
|
1990
|
+
password: h$7("Form Control Password", i$43, {
|
|
1991
1991
|
...g$7,
|
|
1992
1992
|
icon: f$20
|
|
1993
1993
|
}),
|
|
1994
|
-
search: h$7("Form Control Search", i$
|
|
1995
|
-
url: h$7("Form Control URL", i$
|
|
1996
|
-
tel: h$7("Form Control Phone", i$
|
|
1997
|
-
date: h$7("Form Control Date", i$
|
|
1998
|
-
time: h$7("Form Control Time", i$
|
|
1999
|
-
color: h$7("Form Control Color", i$
|
|
2000
|
-
file: h$7("Form Control File", i$
|
|
1994
|
+
search: h$7("Form Control Search", i$43, g$7),
|
|
1995
|
+
url: h$7("Form Control URL", i$43, g$7),
|
|
1996
|
+
tel: h$7("Form Control Phone", i$43, g$7),
|
|
1997
|
+
date: h$7("Form Control Date", i$43, g$7),
|
|
1998
|
+
time: h$7("Form Control Time", i$43, g$7),
|
|
1999
|
+
color: h$7("Form Control Color", i$43, g$7),
|
|
2000
|
+
file: h$7("Form Control File", i$43, g$7),
|
|
2001
2001
|
textarea: h$7("Form Control Textarea", {
|
|
2002
|
-
...i$
|
|
2002
|
+
...i$43,
|
|
2003
2003
|
color: "inherit",
|
|
2004
2004
|
"font-family": "inherit",
|
|
2005
2005
|
resize: "vertical"
|
|
@@ -2016,8 +2016,8 @@ var _$7 = r$56()({
|
|
|
2016
2016
|
"margin-left": "0px",
|
|
2017
2017
|
"margin-right": "4px"
|
|
2018
2018
|
} },
|
|
2019
|
-
label: { default: a$
|
|
2020
|
-
requiredMark: { default: c$
|
|
2019
|
+
label: { default: a$30 },
|
|
2020
|
+
requiredMark: { default: c$30 },
|
|
2021
2021
|
error: { default: s$29 }
|
|
2022
2022
|
}
|
|
2023
2023
|
},
|
|
@@ -2028,10 +2028,10 @@ var _$7 = r$56()({
|
|
|
2028
2028
|
base: { default: {} },
|
|
2029
2029
|
input: { default: m$13 },
|
|
2030
2030
|
label: { default: {
|
|
2031
|
-
...a$
|
|
2031
|
+
...a$30,
|
|
2032
2032
|
"align-items": "center"
|
|
2033
2033
|
} },
|
|
2034
|
-
requiredMark: { default: c$
|
|
2034
|
+
requiredMark: { default: c$30 },
|
|
2035
2035
|
error: { default: s$29 }
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
@@ -2040,7 +2040,7 @@ var _$7 = r$56()({
|
|
|
2040
2040
|
}
|
|
2041
2041
|
});
|
|
2042
2042
|
// ../sdk-elements/dist/elements/internal/LayoutContainer/declaration.mjs
|
|
2043
|
-
var n$59 = r$
|
|
2043
|
+
var n$59 = r$57()({
|
|
2044
2044
|
type: "layoutContainer",
|
|
2045
2045
|
attributeValues: { subType: e$63()([
|
|
2046
2046
|
"div",
|
|
@@ -2073,7 +2073,7 @@ var n$59 = r$56()({
|
|
|
2073
2073
|
}
|
|
2074
2074
|
});
|
|
2075
2075
|
// ../sdk-elements/dist/elements/internal/Loading/declaration.mjs
|
|
2076
|
-
var t$73 = r$
|
|
2076
|
+
var t$73 = r$57()({
|
|
2077
2077
|
type: "loading",
|
|
2078
2078
|
content: {
|
|
2079
2079
|
attributes: {},
|
|
@@ -2090,7 +2090,7 @@ var t$73 = r$56()({
|
|
|
2090
2090
|
}
|
|
2091
2091
|
});
|
|
2092
2092
|
// ../sdk-elements/dist/elements/internal/NotFound/declaration.mjs
|
|
2093
|
-
var t$72 = r$
|
|
2093
|
+
var t$72 = r$57()({
|
|
2094
2094
|
type: "notFound",
|
|
2095
2095
|
content: {
|
|
2096
2096
|
attributes: {},
|
|
@@ -2114,7 +2114,7 @@ var t$72 = r$56()({
|
|
|
2114
2114
|
var e$56 = /^[a-z][a-z0-9-]*$/;
|
|
2115
2115
|
var t$71 = (t) => typeof t == "string" && e$56.test(t);
|
|
2116
2116
|
var n$58 = (e) => e.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^[^a-z]+|-+$/g, "") || "section";
|
|
2117
|
-
var r$
|
|
2117
|
+
var r$48 = (e, t) => {
|
|
2118
2118
|
let r = n$58(e), i = r;
|
|
2119
2119
|
for (let e = 2; t.has(i); e += 1) i = `${r}-${String(e)}`;
|
|
2120
2120
|
return t.add(i), i;
|
|
@@ -2376,7 +2376,7 @@ t$70.DISPLAY, t$70.FLEX_WRAP, t$70.FLEX_DIRECTION, t$70.ALIGN_ITEMS, t$70.JUSTIF
|
|
|
2376
2376
|
// ../sdk-shared/dist/schema/schemaConstants.mjs
|
|
2377
2377
|
var t$69 = /var\(\s*--([a-zA-Z0-9_-]+)\s*\)|\{\{\s*([a-zA-Z0-9_-]+)\s*\}\}/;
|
|
2378
2378
|
var n$56 = "props";
|
|
2379
|
-
var r$
|
|
2379
|
+
var r$46 = {
|
|
2380
2380
|
schema: {
|
|
2381
2381
|
definition: {
|
|
2382
2382
|
name: "",
|
|
@@ -2422,7 +2422,7 @@ var e$53 = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
|
2422
2422
|
// ../sdk-shared/dist/schema/pageAccess.mjs
|
|
2423
2423
|
var t$67 = "notFound";
|
|
2424
2424
|
var n$54 = (e) => e?.unauthorizedBehaviour === t$67;
|
|
2425
|
-
var r$
|
|
2425
|
+
var r$45 = (e) => {
|
|
2426
2426
|
let t = e?.access;
|
|
2427
2427
|
if (typeof t != "object" || !t || !("permissions" in t)) return;
|
|
2428
2428
|
let { permissions: n } = t;
|
|
@@ -2430,16 +2430,25 @@ var r$44 = (e) => {
|
|
|
2430
2430
|
let r = n.filter((e) => typeof e == "string" && e !== "");
|
|
2431
2431
|
return r.length > 0 ? { permissions: r } : void 0;
|
|
2432
2432
|
};
|
|
2433
|
-
var
|
|
2434
|
-
var
|
|
2435
|
-
let t = e?.[
|
|
2433
|
+
var o$31 = "withheld";
|
|
2434
|
+
var s$28 = (e) => {
|
|
2435
|
+
let t = e?.[o$31];
|
|
2436
2436
|
return t === "unauthenticated" || t === "forbidden" ? t : void 0;
|
|
2437
2437
|
};
|
|
2438
|
-
var
|
|
2438
|
+
var c$29 = (e) => {
|
|
2439
2439
|
let t = e.settings?.withheldPage;
|
|
2440
2440
|
if (t === void 0 || !e.pages?.includes(t)) return;
|
|
2441
2441
|
let n = e.flat[t];
|
|
2442
|
-
return n && !r$
|
|
2442
|
+
return n && !r$45(n.attributes) ? t : void 0;
|
|
2443
|
+
};
|
|
2444
|
+
// ../sdk-shared/dist/schema/documentParts.mjs
|
|
2445
|
+
var r$44 = (e, t) => {
|
|
2446
|
+
let n = e?.attributes[t];
|
|
2447
|
+
return typeof n == "string" ? n : "";
|
|
2448
|
+
};
|
|
2449
|
+
var i$41 = (t, n) => {
|
|
2450
|
+
let i = t[n];
|
|
2451
|
+
return i ? t$68((e) => t[e], r$44(i, "layout"), r$44(i, "layoutContainer")).map((e) => e.layout) : [];
|
|
2443
2452
|
};
|
|
2444
2453
|
// ../sdk-shared/dist/helpers/twigWrapper/processTwig/helpers.mjs
|
|
2445
2454
|
var e$52 = (e, t) => e[t];
|
|
@@ -3031,7 +3040,7 @@ var c$27 = {
|
|
|
3031
3040
|
return n ? Number(n[0]) : 0;
|
|
3032
3041
|
}
|
|
3033
3042
|
};
|
|
3034
|
-
var l$
|
|
3043
|
+
var l$23 = {
|
|
3035
3044
|
replace: (e, n) => {
|
|
3036
3045
|
if (typeof e != "string" || n.length === 0) return e;
|
|
3037
3046
|
let [r] = n;
|
|
@@ -3070,7 +3079,7 @@ var S$1 = {
|
|
|
3070
3079
|
...o$27,
|
|
3071
3080
|
...s$26,
|
|
3072
3081
|
...c$27,
|
|
3073
|
-
...l$
|
|
3082
|
+
...l$23,
|
|
3074
3083
|
...u$26,
|
|
3075
3084
|
...r$39,
|
|
3076
3085
|
...o$29,
|
|
@@ -3397,29 +3406,35 @@ var n$46 = (n) => t$59(n) || n >= e$46.Zero && n <= e$46.Nine;
|
|
|
3397
3406
|
var r$36 = (t) => n$46(t) || t === e$46.Minus;
|
|
3398
3407
|
var i$34 = (t) => t >= e$46.Zero && t <= e$46.Nine;
|
|
3399
3408
|
var a$23 = (t) => t === e$46.Space || t === e$46.Tab || t === e$46.Newline || t === e$46.CarriageReturn;
|
|
3400
|
-
var o$26 =
|
|
3409
|
+
var o$26 = /* @__PURE__ */ new Set([
|
|
3410
|
+
"true",
|
|
3411
|
+
"false",
|
|
3412
|
+
"null",
|
|
3413
|
+
"none"
|
|
3414
|
+
]);
|
|
3415
|
+
var s$25 = (e) => {
|
|
3401
3416
|
let r = e.length;
|
|
3402
|
-
if (r === 0 || !t$59(e.charCodeAt(0))) return !1;
|
|
3417
|
+
if (r === 0 || !t$59(e.charCodeAt(0)) || o$26.has(e)) return !1;
|
|
3403
3418
|
for (let t = 1; t < r; t++) if (!n$46(e.charCodeAt(t))) return !1;
|
|
3404
3419
|
return !0;
|
|
3405
3420
|
};
|
|
3406
|
-
var
|
|
3421
|
+
var c$26 = (r) => {
|
|
3407
3422
|
let a = r.length;
|
|
3408
|
-
if (a === 0 || !t$59(r.charCodeAt(0))) return !1;
|
|
3409
|
-
let
|
|
3410
|
-
for (let
|
|
3411
|
-
let a = r.charCodeAt(
|
|
3423
|
+
if (a === 0 || !t$59(r.charCodeAt(0)) || o$26.has(r)) return !1;
|
|
3424
|
+
let s = !1, c = !1;
|
|
3425
|
+
for (let o = 1; o < a; o++) {
|
|
3426
|
+
let a = r.charCodeAt(o);
|
|
3412
3427
|
if (a === e$46.Dot) {
|
|
3413
|
-
if (
|
|
3414
|
-
|
|
3415
|
-
} else if (
|
|
3416
|
-
if (
|
|
3417
|
-
|
|
3418
|
-
} else if (
|
|
3428
|
+
if (s) return !1;
|
|
3429
|
+
s = !0, c = !1;
|
|
3430
|
+
} else if (s) {
|
|
3431
|
+
if (c = i$34(a), !c && !t$59(a)) return !1;
|
|
3432
|
+
s = !1;
|
|
3433
|
+
} else if (c ? !i$34(a) : !n$46(a)) return !1;
|
|
3419
3434
|
}
|
|
3420
|
-
return !
|
|
3435
|
+
return !s;
|
|
3421
3436
|
};
|
|
3422
|
-
var
|
|
3437
|
+
var l$22 = (e) => s$25(e);
|
|
3423
3438
|
// ../sdk-shared/dist/helpers/twigWrapper/Lexer/Lexer.mjs
|
|
3424
3439
|
var e$45 = (e) => {
|
|
3425
3440
|
let t = [], n = 0;
|
|
@@ -4099,7 +4114,7 @@ var f$18 = class {
|
|
|
4099
4114
|
source: ""
|
|
4100
4115
|
};
|
|
4101
4116
|
let r = t.content.trim(), i = this.keepEmptyTokens ? e$44(t.content, t.raw) : "";
|
|
4102
|
-
if (
|
|
4117
|
+
if (s$25(r)) return {
|
|
4103
4118
|
type: "variable",
|
|
4104
4119
|
raw: t.raw,
|
|
4105
4120
|
expression: {
|
|
@@ -4174,8 +4189,8 @@ var f$18 = class {
|
|
|
4174
4189
|
start: r$35(f[0], this.issues),
|
|
4175
4190
|
end: r$35(f[1], this.issues)
|
|
4176
4191
|
} : r$35(u, this.issues), m = l.indexOf(","), h = m === -1 ? null : l.slice(0, m).trim(), g = m === -1 ? l : l.slice(m + 1).trim();
|
|
4177
|
-
if (!
|
|
4178
|
-
if (h !== null && !
|
|
4192
|
+
if (!l$22(g)) return this.error = `Invalid {% for %} variable name: "${g}"`, d$21();
|
|
4193
|
+
if (h !== null && !l$22(h)) return this.error = `Invalid {% for %} key variable name: "${h}"`, d$21();
|
|
4179
4194
|
let _ = this.parseBody(), v = null;
|
|
4180
4195
|
if (this.peek()) {
|
|
4181
4196
|
let e = this.peek();
|
|
@@ -4256,7 +4271,7 @@ var c$24 = (t) => {
|
|
|
4256
4271
|
n = !0;
|
|
4257
4272
|
break;
|
|
4258
4273
|
}
|
|
4259
|
-
if (a.type === "variable" && !
|
|
4274
|
+
if (a.type === "variable" && !c$26(a.content.trim())) {
|
|
4260
4275
|
r = !1;
|
|
4261
4276
|
break;
|
|
4262
4277
|
}
|
|
@@ -4861,7 +4876,7 @@ var d$17 = (e, t) => !e || (t[e.name] ?? !1) === e.is;
|
|
|
4861
4876
|
// ../sdk-shared/dist/schema/serverElements.mjs
|
|
4862
4877
|
var s$21 = /* @__PURE__ */ new WeakMap();
|
|
4863
4878
|
var c$22 = (t, i) => {
|
|
4864
|
-
let a = [], o = /* @__PURE__ */ new Set(), s = t.flat[i], c = (e) => typeof e == "string" ? e : "", l = s ? t$68((e) => t.flat[e], c(s.attributes.layout), c(s.attributes.layoutContainer)).map((e) => e.layout) : [], u =
|
|
4879
|
+
let a = [], o = /* @__PURE__ */ new Set(), s = t.flat[i], c = (e) => typeof e == "string" ? e : "", l = s ? t$68((e) => t.flat[e], c(s.attributes.layout), c(s.attributes.layoutContainer)).map((e) => e.layout) : [], u = s$28(s?.attributes) ? c$29(t) : void 0, d = [
|
|
4865
4880
|
i,
|
|
4866
4881
|
...l,
|
|
4867
4882
|
...u === void 0 ? [] : [u]
|
|
@@ -9219,7 +9234,7 @@ var i$25 = (i) => {
|
|
|
9219
9234
|
o.push({
|
|
9220
9235
|
level: l[1].length,
|
|
9221
9236
|
text: t,
|
|
9222
|
-
anchor: r$
|
|
9237
|
+
anchor: r$48(t, a)
|
|
9223
9238
|
});
|
|
9224
9239
|
}
|
|
9225
9240
|
}
|
|
@@ -9228,7 +9243,7 @@ var i$25 = (i) => {
|
|
|
9228
9243
|
// ../sdk-elements/dist/elements/internal/Page/declaration.mjs
|
|
9229
9244
|
var n$34 = ["locked", "noBounce"];
|
|
9230
9245
|
var r$25 = (e) => n$34.some((t) => t === e);
|
|
9231
|
-
var i$24 = r$
|
|
9246
|
+
var i$24 = r$57()({
|
|
9232
9247
|
type: "page",
|
|
9233
9248
|
contentAttributes: ["seoPageTitle", "seoPageDescription"],
|
|
9234
9249
|
serverTemplates: [
|
|
@@ -9299,7 +9314,7 @@ var n$33 = {
|
|
|
9299
9314
|
"font-size": "12px",
|
|
9300
9315
|
"font-family": "inherit"
|
|
9301
9316
|
};
|
|
9302
|
-
var r$24 = r$
|
|
9317
|
+
var r$24 = r$57()({
|
|
9303
9318
|
type: "chart",
|
|
9304
9319
|
contentAttributes: ["label", "emptyText"],
|
|
9305
9320
|
attributeValues: {
|
|
@@ -9403,7 +9418,7 @@ var r$24 = r$56()({
|
|
|
9403
9418
|
}
|
|
9404
9419
|
});
|
|
9405
9420
|
// ../sdk-elements/dist/elements/media/Embed/declaration.mjs
|
|
9406
|
-
var t$42 = r$
|
|
9421
|
+
var t$42 = r$57()({
|
|
9407
9422
|
type: "embed",
|
|
9408
9423
|
contentAttributes: ["src", "title"],
|
|
9409
9424
|
content: {
|
|
@@ -9432,7 +9447,7 @@ var t$42 = r$56()({
|
|
|
9432
9447
|
}
|
|
9433
9448
|
});
|
|
9434
9449
|
// ../sdk-elements/dist/elements/media/FontAwesome/declaration.mjs
|
|
9435
|
-
var t$41 = r$
|
|
9450
|
+
var t$41 = r$57()({
|
|
9436
9451
|
type: "fontAwesome",
|
|
9437
9452
|
content: {
|
|
9438
9453
|
attributes: {
|
|
@@ -9455,7 +9470,7 @@ var t$41 = r$56()({
|
|
|
9455
9470
|
}
|
|
9456
9471
|
});
|
|
9457
9472
|
// ../sdk-elements/dist/elements/media/Image/declaration.mjs
|
|
9458
|
-
var n$32 = r$
|
|
9473
|
+
var n$32 = r$57()({
|
|
9459
9474
|
type: "image",
|
|
9460
9475
|
contentAttributes: ["src", "alt"],
|
|
9461
9476
|
attributeValues: {
|
|
@@ -9495,7 +9510,7 @@ var n$32 = r$56()({
|
|
|
9495
9510
|
}
|
|
9496
9511
|
});
|
|
9497
9512
|
// ../sdk-elements/dist/elements/media/Svg/declaration.mjs
|
|
9498
|
-
var t$40 = r$
|
|
9513
|
+
var t$40 = r$57()({
|
|
9499
9514
|
type: "svg",
|
|
9500
9515
|
contentAttributes: ["label"],
|
|
9501
9516
|
content: {
|
|
@@ -9522,7 +9537,7 @@ var t$40 = r$56()({
|
|
|
9522
9537
|
}
|
|
9523
9538
|
});
|
|
9524
9539
|
// ../sdk-elements/dist/elements/media/Video/declaration.mjs
|
|
9525
|
-
var t$39 = r$
|
|
9540
|
+
var t$39 = r$57()({
|
|
9526
9541
|
type: "video",
|
|
9527
9542
|
contentAttributes: ["src"],
|
|
9528
9543
|
content: {
|
|
@@ -9549,7 +9564,7 @@ var t$39 = r$56()({
|
|
|
9549
9564
|
}
|
|
9550
9565
|
});
|
|
9551
9566
|
// ../sdk-elements/dist/elements/provider/ApiContainer/declaration.mjs
|
|
9552
|
-
var n$31 = r$
|
|
9567
|
+
var n$31 = r$57()({
|
|
9553
9568
|
type: "apiContainer",
|
|
9554
9569
|
attributeValues: {
|
|
9555
9570
|
subType: e$63()([
|
|
@@ -9713,7 +9728,7 @@ var n$31 = r$56()({
|
|
|
9713
9728
|
}
|
|
9714
9729
|
});
|
|
9715
9730
|
// ../sdk-elements/dist/elements/provider/Channel/declaration.mjs
|
|
9716
|
-
var n$30 = r$
|
|
9731
|
+
var n$30 = r$57()({
|
|
9717
9732
|
type: "channel",
|
|
9718
9733
|
attributeValues: { subType: e$63()([
|
|
9719
9734
|
"",
|
|
@@ -9829,7 +9844,7 @@ var n$30 = r$56()({
|
|
|
9829
9844
|
}
|
|
9830
9845
|
});
|
|
9831
9846
|
// ../sdk-elements/dist/elements/structure/Carousel/CarouselTrack/declaration.mjs
|
|
9832
|
-
var t$38 = r$
|
|
9847
|
+
var t$38 = r$57()({
|
|
9833
9848
|
type: "carouselTrack",
|
|
9834
9849
|
ancestorType: "carousel",
|
|
9835
9850
|
content: {
|
|
@@ -9863,7 +9878,7 @@ var t$37 = {
|
|
|
9863
9878
|
value: "page"
|
|
9864
9879
|
}]
|
|
9865
9880
|
};
|
|
9866
|
-
var n$29 = r$
|
|
9881
|
+
var n$29 = r$57()({
|
|
9867
9882
|
type: "carousel",
|
|
9868
9883
|
contentAttributes: ["label"],
|
|
9869
9884
|
sourceType: "carousel",
|
|
@@ -9965,7 +9980,7 @@ var n$28 = [
|
|
|
9965
9980
|
"aside",
|
|
9966
9981
|
"figure"
|
|
9967
9982
|
];
|
|
9968
|
-
var r$23 = r$
|
|
9983
|
+
var r$23 = r$57()({
|
|
9969
9984
|
type: "container",
|
|
9970
9985
|
attributeValues: {
|
|
9971
9986
|
subType: e$63()([
|
|
@@ -10060,7 +10075,7 @@ var n$27 = {
|
|
|
10060
10075
|
outline: "none",
|
|
10061
10076
|
cursor: "pointer"
|
|
10062
10077
|
};
|
|
10063
|
-
var r$22 = r$
|
|
10078
|
+
var r$22 = r$57()({
|
|
10064
10079
|
type: "dialogContainer",
|
|
10065
10080
|
contentAttributes: [
|
|
10066
10081
|
"headerLabel",
|
|
@@ -10232,7 +10247,7 @@ var r$22 = r$56()({
|
|
|
10232
10247
|
initialItems: ["container"]
|
|
10233
10248
|
});
|
|
10234
10249
|
// ../sdk-elements/dist/elements/structure/FocusGroup/declaration.mjs
|
|
10235
|
-
var n$26 = r$
|
|
10250
|
+
var n$26 = r$57()({
|
|
10236
10251
|
type: "focusGroup",
|
|
10237
10252
|
attributeValues: { subType: e$63()([
|
|
10238
10253
|
"div",
|
|
@@ -10257,7 +10272,7 @@ var n$26 = r$56()({
|
|
|
10257
10272
|
}
|
|
10258
10273
|
});
|
|
10259
10274
|
// ../sdk-elements/dist/elements/structure/List/declaration.mjs
|
|
10260
|
-
var n$25 = r$
|
|
10275
|
+
var n$25 = r$57()({
|
|
10261
10276
|
type: "list",
|
|
10262
10277
|
attributeValues: {
|
|
10263
10278
|
subType: e$63()(["ul", "ol"]),
|
|
@@ -10319,7 +10334,7 @@ var n$25 = r$56()({
|
|
|
10319
10334
|
]
|
|
10320
10335
|
});
|
|
10321
10336
|
// ../sdk-elements/dist/elements/structure/List/ListItem/declaration.mjs
|
|
10322
|
-
var t$35 = r$
|
|
10337
|
+
var t$35 = r$57()({
|
|
10323
10338
|
type: "listItem",
|
|
10324
10339
|
content: {
|
|
10325
10340
|
attributes: {},
|
|
@@ -10337,7 +10352,7 @@ var t$35 = r$56()({
|
|
|
10337
10352
|
}
|
|
10338
10353
|
});
|
|
10339
10354
|
// ../sdk-elements/dist/elements/structure/ModalContainer/declaration.mjs
|
|
10340
|
-
var t$34 = r$
|
|
10355
|
+
var t$34 = r$57()({
|
|
10341
10356
|
type: "modalContainer",
|
|
10342
10357
|
contentAttributes: ["title"],
|
|
10343
10358
|
sourceType: "modalContainer",
|
|
@@ -10498,7 +10513,7 @@ var t$34 = r$56()({
|
|
|
10498
10513
|
initialItems: ["container"]
|
|
10499
10514
|
});
|
|
10500
10515
|
// ../sdk-elements/dist/elements/structure/Pagination/declaration.mjs
|
|
10501
|
-
var n$24 = r$
|
|
10516
|
+
var n$24 = r$57()({
|
|
10502
10517
|
type: "pagination",
|
|
10503
10518
|
contentAttributes: [
|
|
10504
10519
|
"previousLabel",
|
|
@@ -10554,7 +10569,7 @@ var n$24 = r$56()({
|
|
|
10554
10569
|
}
|
|
10555
10570
|
});
|
|
10556
10571
|
// ../sdk-elements/dist/elements/structure/TabContainer/declaration.mjs
|
|
10557
|
-
var t$33 = r$
|
|
10572
|
+
var t$33 = r$57()({
|
|
10558
10573
|
type: "tabContainer",
|
|
10559
10574
|
content: {
|
|
10560
10575
|
attributes: {},
|
|
@@ -10576,7 +10591,7 @@ var t$33 = r$56()({
|
|
|
10576
10591
|
initialItems: ["tabContainerHeader", "tabContainerBody"]
|
|
10577
10592
|
});
|
|
10578
10593
|
// ../sdk-elements/dist/elements/structure/TabContainer/TabContainerBody/declaration.mjs
|
|
10579
|
-
var t$32 = r$
|
|
10594
|
+
var t$32 = r$57()({
|
|
10580
10595
|
type: "tabContainerBody",
|
|
10581
10596
|
ancestorType: "tabContainer",
|
|
10582
10597
|
content: {
|
|
@@ -10609,7 +10624,7 @@ var t$32 = r$56()({
|
|
|
10609
10624
|
]
|
|
10610
10625
|
});
|
|
10611
10626
|
// ../sdk-elements/dist/elements/structure/TabContainer/TabContainerHeader/declaration.mjs
|
|
10612
|
-
var t$31 = r$
|
|
10627
|
+
var t$31 = r$57()({
|
|
10613
10628
|
type: "tabContainerHeader",
|
|
10614
10629
|
ancestorType: "tabContainer",
|
|
10615
10630
|
content: {
|
|
@@ -10642,7 +10657,7 @@ var t$31 = r$56()({
|
|
|
10642
10657
|
]
|
|
10643
10658
|
});
|
|
10644
10659
|
// ../sdk-elements/dist/elements/structure/TabContainer/TabContainerItem/declaration.mjs
|
|
10645
|
-
var t$30 = r$
|
|
10660
|
+
var t$30 = r$57()({
|
|
10646
10661
|
type: "tabContainerItem",
|
|
10647
10662
|
marks: {
|
|
10648
10663
|
"role=\"tab\"": "in the header, with `aria-controls` its panel; in the body it is `role=\"tabpanel\"`, `hidden` while not on show",
|
|
@@ -10651,7 +10666,7 @@ var t$30 = r$56()({
|
|
|
10651
10666
|
tabindex: "roving: 0 on the open tab, -1 on the rest — the arrow keys move between them"
|
|
10652
10667
|
},
|
|
10653
10668
|
content: {
|
|
10654
|
-
attributes: {},
|
|
10669
|
+
attributes: { hash: "" },
|
|
10655
10670
|
definition: {
|
|
10656
10671
|
label: "Tab Container Item",
|
|
10657
10672
|
description: "One selectable tab (trigger + panel) inside a tabContainer.",
|
|
@@ -10891,7 +10906,7 @@ var Y = {
|
|
|
10891
10906
|
ApiContainer: n$31,
|
|
10892
10907
|
BlockHtml: t$83,
|
|
10893
10908
|
BlockJsx: t$82,
|
|
10894
|
-
Button: r$
|
|
10909
|
+
Button: r$51,
|
|
10895
10910
|
Carousel: n$29,
|
|
10896
10911
|
CarouselTrack: t$38,
|
|
10897
10912
|
Channel: n$30,
|
|
@@ -10929,7 +10944,7 @@ var Y = {
|
|
|
10929
10944
|
TabContainerHeader: t$31,
|
|
10930
10945
|
TabContainerItem: t$30,
|
|
10931
10946
|
Text: t$74,
|
|
10932
|
-
ThemeToggle: r$
|
|
10947
|
+
ThemeToggle: r$50,
|
|
10933
10948
|
Video: t$39
|
|
10934
10949
|
};
|
|
10935
10950
|
var X = Object.fromEntries(Object.values(Y).flatMap((e) => "serverTemplates" in e ? [[e.type, e.serverTemplates]] : []));
|
|
@@ -11422,7 +11437,7 @@ var CSS_CODES = {
|
|
|
11422
11437
|
},
|
|
11423
11438
|
"tablet-rule-skips-mobile": {
|
|
11424
11439
|
kind: "warned",
|
|
11425
|
-
means: "a tablet rule phones never get — mobile inherits desktop, not tablet",
|
|
11440
|
+
means: "a tablet rule phones never get — mobile inherits desktop, not tablet (a grid’s columns are left alone where the phone is not a grid)",
|
|
11426
11441
|
fix: "write it under `compact` (tablet and mobile together)"
|
|
11427
11442
|
},
|
|
11428
11443
|
"tw-unknown-class": {
|
|
@@ -11482,7 +11497,8 @@ var ELEMENT_CODES = {
|
|
|
11482
11497
|
"plugin-attribute-reserved": {
|
|
11483
11498
|
kind: "warned",
|
|
11484
11499
|
means: "a plugin attribute named as one of the element’s own fields — a factory never hands it to the plugin",
|
|
11485
|
-
fix: "rename it in the plugin, as the warning names it (`variant` → `kind`, `from` → `start`)"
|
|
11500
|
+
fix: "rename it in the plugin, as the warning names it (`variant` → `kind`, `from` → `start`)",
|
|
11501
|
+
authoringOnly: "the plugin's own declaration, which authoring is handed and a space's documents do not hold"
|
|
11486
11502
|
},
|
|
11487
11503
|
"unknown-variant": {
|
|
11488
11504
|
kind: "warned",
|
|
@@ -11901,6 +11917,11 @@ var PAGE_CODES = {
|
|
|
11901
11917
|
means: "the page of every address no other answers (`slug: '*'`) marked the home",
|
|
11902
11918
|
fix: "`isDefault` on the page at `''`, or left out: the page at `''` is the home"
|
|
11903
11919
|
},
|
|
11920
|
+
"not-found-twice": {
|
|
11921
|
+
kind: "refused",
|
|
11922
|
+
means: "two pages answering every address nothing else does (`slug: '*'`) in the same place — the space, or one folder: the router would pick one, and an address land on whichever it picked",
|
|
11923
|
+
fix: "one per place: the other given a slug of its own, or moved to the folder whose addresses it answers (a folder's answers its own, the space's the rest)"
|
|
11924
|
+
},
|
|
11904
11925
|
"page-route-reserved": {
|
|
11905
11926
|
kind: "refused",
|
|
11906
11927
|
means: "a page under `/fn`, where the space's functions answer",
|
|
@@ -12240,6 +12261,21 @@ var SUGGESTION_CODES$1 = {
|
|
|
12240
12261
|
means: "one page whose part of the document passes 250 KB — every visitor downloads it before the page is theirs — with the shapes written again most inside it, by what they weigh",
|
|
12241
12262
|
fix: "the rows of data as one `list` of a component, read from the data (`list({ items, row })`), and a block written per state as one element whose state picks its content: the document then holds one copy — or, for an app's page heavy for how many elements it has, `quiet: ['heavy-page']` on the page, with why"
|
|
12242
12263
|
},
|
|
12264
|
+
"desktop-only": {
|
|
12265
|
+
kind: "suggested",
|
|
12266
|
+
means: "a page, layout or component styled for the desktop alone where a phone (390 px) breaks — a width past 480 px with no `max-width` holding it; a grid whose fixed columns and gaps are wider than a phone, or three or more columns sharing its width a page’s parts apart (a gap of 16 px or more) and left narrower than 120 px each; type past 64 px — that no `mobile` rule of the classes on it sets again (a style’s `mobile` is laid over its `desktop` alone, so a `tablet` rule does not reach a phone). What a `mobile` rule hides is left out, as is a grid it lays out otherwise (`display: flex`), a width inside a box that clips or scrolls it sideways (`overflow-x: auto` round a table), a layout fluid on its own — wrapping flex, `%`, `min()`, `clamp()`, `repeat(auto-fit, minmax(…))` —, a row whose one column grows (`48px 1fr auto`), a dense widget’s many thin columns, and a space written mobile first",
|
|
12267
|
+
fix: "the phone's value in the class's `mobile` rules (`styles('card', { css: { desktop: { … }, mobile: { gridTemplateColumns: '1fr' } } })`), or a value fluid on its own — `width: 'min(960px, 100%)'`, `font-size: 'clamp(32px, 6vw, 72px)'`, `grid-template-columns: 'repeat(auto-fit, minmax(240px, 1fr))'` — or, for a surface only a desktop opens, `quiet: ['desktop-only']` on it, with why"
|
|
12268
|
+
},
|
|
12269
|
+
"heavy-layout": {
|
|
12270
|
+
kind: "suggested",
|
|
12271
|
+
means: "one layout whose own part of the document passes 250 KB — every page drawn in it is downloaded with it, the first a visitor opens at least — with how many pages carry it and what 10,000 first visits move for it",
|
|
12272
|
+
fix: "what only some of its pages show moved into those pages, or into a component they place; rows of data as one `list` of a component (`list({ items, row })`) — or, for a shell heavy on purpose, `quiet: ['heavy-layout']` on the layout, with why"
|
|
12273
|
+
},
|
|
12274
|
+
"many-elements": {
|
|
12275
|
+
kind: "suggested",
|
|
12276
|
+
means: "a page that builds more than 1,500 elements as it opens — its own, its layouts’ and its components’ once per instance, not those that start hidden with `loadStrategy` `lazy` or `visible` — with what a visit downloads for them: a phone builds, styles and lays out each before the page answers (Lighthouse flags a page past about 1,400)",
|
|
12277
|
+
fix: "`loadStrategy: 'lazy'` on what starts hidden until something shows it (`visible: false`) — a tab, a panel, a dialog — so it is built the first time it is shown (one a condition shows may be on screen at once, and is not named); rows of data as one `list`; a part few visitors reach as a page of its own — or, for an app's page rich on purpose, `quiet: ['many-elements']` on the page, with why"
|
|
12278
|
+
},
|
|
12243
12279
|
"repeated-expression": {
|
|
12244
12280
|
kind: "suggested",
|
|
12245
12281
|
means: "the same long expression — its numbers and words aside — written into many bindings, steps or attributes: a sum or a choice worked out again in every copy, and carried by the document once per copy",
|
|
@@ -12308,7 +12344,8 @@ var SUGGESTION_CODES$1 = {
|
|
|
12308
12344
|
"not-found-page": {
|
|
12309
12345
|
kind: "suggested",
|
|
12310
12346
|
means: "a space with no page of its own for an address no other page answers — a plain one was added, in the home page’s layout, sent with status 404",
|
|
12311
|
-
fix: "a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }`"
|
|
12347
|
+
fix: "a page whose slug is `'*'`: `{ id: 'not-found', name: 'Not found', slug: '*', layout: …, body: [...] }`",
|
|
12348
|
+
authoringOnly: "that the page was added: written, it is a page like any other"
|
|
12312
12349
|
},
|
|
12313
12350
|
"unused-plugin": {
|
|
12314
12351
|
kind: "suggested",
|
|
@@ -12323,7 +12360,8 @@ var SUGGESTION_CODES$1 = {
|
|
|
12323
12360
|
"class-overrides-class": {
|
|
12324
12361
|
kind: "suggested",
|
|
12325
12362
|
means: "one class's shorthand erasing the longhand another class on the same element writes out — `padding` over `padding-top` — or the same property set over the class listed after it — `gap` over `gap` — because the stylesheet writes it later: classes in the order they are first met, a breakpoint's rules after the base, never the order of a class list",
|
|
12326
|
-
fix: "the longhands the shorthand means instead of it (`padding-left`, `padding-right`), so it leaves the other class's alone; the same property, left to one of the two or written on the element itself — or `quiet: ['class-overrides-class']` when the winner is meant to win"
|
|
12363
|
+
fix: "the longhands the shorthand means instead of it (`padding-left`, `padding-right`), so it leaves the other class's alone; the same property, left to one of the two or written on the element itself — or `quiet: ['class-overrides-class']` when the winner is meant to win",
|
|
12364
|
+
authoringOnly: "the shorthand a rule was written with — the stylesheet holds the longhands it stands for"
|
|
12327
12365
|
}
|
|
12328
12366
|
};
|
|
12329
12367
|
// src/schema/codes/tests.ts
|
|
@@ -12383,6 +12421,12 @@ var isSuggestionCode = (code) => typeof code === "string" && isAuthoringCode(cod
|
|
|
12383
12421
|
*/
|
|
12384
12422
|
var authoringCodeEntry = (code) => isAuthoringCode(code) ? AUTHORING_CODES[code] : void 0;
|
|
12385
12423
|
/**
|
|
12424
|
+
* The codes only `authorSpace` can say, each with why (`authoringOnly`): every other code is said of the documents
|
|
12425
|
+
* alone — by `validateSpace` and `suggestSpace` — so the builder and the MCP, which read nothing else, say what
|
|
12426
|
+
* authoring says. A test holds every seed to it.
|
|
12427
|
+
*/
|
|
12428
|
+
var AUTHORING_ONLY_CODES = new Set(Object.entries(AUTHORING_CODES).flatMap(([code, entry]) => entry.authoringOnly === void 0 ? [] : [code]));
|
|
12429
|
+
/**
|
|
12386
12430
|
* A declaration `authorSpace` will not write, with the code its row in `authoring-errors.md` is filed under.
|
|
12387
12431
|
*
|
|
12388
12432
|
* `reason` is the sentence alone; `message` leads with the code, so an error that escapes on its own still says where
|
|
@@ -16063,14 +16107,14 @@ var paramIssue = (params, spec, where) => {
|
|
|
16063
16107
|
const unknown = Object.keys(provided).find((key) => !names.includes(key));
|
|
16064
16108
|
if (unknown !== void 0) return `${where} has the param "${unknown}", which it does not take${didYouMean(unknown, names) || "."} It takes ${names.length > 0 ? names.join(", ") : "none"}.`;
|
|
16065
16109
|
}
|
|
16066
|
-
const effective = c$
|
|
16110
|
+
const effective = c$33(provided, declared, false);
|
|
16067
16111
|
const invalid = s$32(provided, effective, declared).at(0);
|
|
16068
16112
|
if (invalid) {
|
|
16069
16113
|
const value = provided[invalid.key];
|
|
16070
16114
|
const suggestion = typeof value === "string" && invalid.options ? didYouMean(value, invalid.options) : "";
|
|
16071
16115
|
return invalid.options ? `${where}: "${invalid.key}" is ${JSON.stringify(value)}${suggestion || "."} It is one of ${invalid.options.map((option) => `'${option}'`).join(", ")}.` : `${where}: "${invalid.key}" is ${JSON.stringify(value)} (${invalid.got}), and it takes a ${invalid.expected}.`;
|
|
16072
16116
|
}
|
|
16073
|
-
const missing = r$
|
|
16117
|
+
const missing = r$54(provided, effective, declared).at(0);
|
|
16074
16118
|
return missing === void 0 ? void 0 : `${where} needs "${missing}": ${declared[missing].description}`;
|
|
16075
16119
|
};
|
|
16076
16120
|
// ../sdk-shared/dist/navigation/matchPath.mjs
|
|
@@ -16182,7 +16226,7 @@ var p$1 = (e = {}, n = [], r, a = "", o = !0) => Object.keys(e).reduce((s, c) =>
|
|
|
16182
16226
|
isRaw: `/${c}` === n,
|
|
16183
16227
|
unauthorizedBehaviour: p,
|
|
16184
16228
|
unauthorizedPageRedirect: m,
|
|
16185
|
-
hasAccess: f$2(l, r, o) && !(
|
|
16229
|
+
hasAccess: f$2(l, r, o) && !(s$28(e[c].attributes) === "unauthenticated" && p === "redirect" && m),
|
|
16186
16230
|
...g ? { notFound: !0 } : {}
|
|
16187
16231
|
}));
|
|
16188
16232
|
return [...s, ..._];
|
|
@@ -16258,16 +16302,19 @@ var m$1 = (t, n, r) => {
|
|
|
16258
16302
|
};
|
|
16259
16303
|
var g$1 = (e) => !e || typeof e != "string" ? [] : (e.match(/:[a-zA-Z0-9-_:*]+/gim) || []).map((e) => e.replace(":", ""));
|
|
16260
16304
|
var _$1 = (e) => g$1(o$4(e));
|
|
16261
|
-
|
|
16262
|
-
/**
|
|
16263
|
-
|
|
16264
|
-
|
|
16265
|
-
|
|
16266
|
-
*/
|
|
16267
|
-
|
|
16268
|
-
|
|
16305
|
+
var HOSTED = `custom:`;
|
|
16306
|
+
/** The name a component hosted by a `custom` element is declared under: `custom:<renderType>`. */
|
|
16307
|
+
var hostedType = (renderType) => `${HOSTED}${renderType}`;
|
|
16308
|
+
/** The component a `custom:<renderType>` name hosts; undefined for a plugin's own type. */
|
|
16309
|
+
var hostedComponentOf = (type) => type.startsWith(HOSTED) ? type.slice(HOSTED.length) : void 0;
|
|
16310
|
+
/** The name an element's plugin is declared under: its own type, or `custom:<renderType>` for one a `custom` hosts. */
|
|
16311
|
+
var pluginKeyOf = (element) => {
|
|
16312
|
+
const { type } = element.definition;
|
|
16313
|
+
const renderType = element.attributes.renderType;
|
|
16314
|
+
return type === "custom" && typeof renderType === "string" ? hostedType(renderType) : type;
|
|
16315
|
+
};
|
|
16269
16316
|
/** An attribute read as text: a document stores what an editor wrote, which is not always the string a type says. */
|
|
16270
|
-
var textOf$
|
|
16317
|
+
var textOf$3 = (value, fallback = "") => typeof value === "string" ? value : fallback;
|
|
16271
16318
|
/** Every string inside a value, however deep — a step's params nest objects and lists of them. */
|
|
16272
16319
|
var stringsIn = (value) => {
|
|
16273
16320
|
if (typeof value === "string") return [value];
|
|
@@ -16353,8 +16400,8 @@ var LintContext = class {
|
|
|
16353
16400
|
catalogType(element) {
|
|
16354
16401
|
const { type } = element.definition;
|
|
16355
16402
|
if (type !== "custom") return type;
|
|
16356
|
-
const renderType = textOf$
|
|
16357
|
-
const hosted =
|
|
16403
|
+
const renderType = textOf$3(element.attributes.renderType);
|
|
16404
|
+
const hosted = hostedType(renderType);
|
|
16358
16405
|
return renderType && this.catalogs.pluginTypes?.includes(hosted) ? hosted : void 0;
|
|
16359
16406
|
}
|
|
16360
16407
|
/** The attributes a type reads, or null where that is open: a plugin, or a `custom` whose component decides. */
|
|
@@ -16381,11 +16428,11 @@ var LintContext = class {
|
|
|
16381
16428
|
describe(id) {
|
|
16382
16429
|
const element = this.element(id);
|
|
16383
16430
|
if (!element) return `"${id}"`;
|
|
16384
|
-
if (this.pageIds.has(id)) return `Page "${textOf$
|
|
16431
|
+
if (this.pageIds.has(id)) return `Page "${textOf$3(element.attributes.name, id)}"`;
|
|
16385
16432
|
if (this.layoutIds.has(id)) return `Layout "${id}"`;
|
|
16386
16433
|
const rootId = element.definition.rootId;
|
|
16387
16434
|
const root = this.element(rootId);
|
|
16388
|
-
const place = this.component ? ` in component "${this.component.id}"` : this.pageIds.has(rootId) ? ` on page "${textOf$
|
|
16435
|
+
const place = this.component ? ` in component "${this.component.id}"` : this.pageIds.has(rootId) ? ` on page "${textOf$3(root?.attributes.name, rootId)}"` : this.layoutIds.has(rootId) ? ` in layout "${rootId}"` : "";
|
|
16389
16436
|
return `Element "${element.definition.type}" (${id})${place}`;
|
|
16390
16437
|
}
|
|
16391
16438
|
/** The elements `id` is nested in, as the document stores them — what "inside a form" means. */
|
|
@@ -16402,7 +16449,7 @@ var LintContext = class {
|
|
|
16402
16449
|
/** The route params an element's page declares; a layout renders on every page, so it sees all of them. */
|
|
16403
16450
|
routeParams(id) {
|
|
16404
16451
|
const rootId = this.element(id)?.definition.rootId ?? id;
|
|
16405
|
-
const slugOf = (pageId) => textOf$
|
|
16452
|
+
const slugOf = (pageId) => textOf$3(this.element(pageId)?.attributes.slug);
|
|
16406
16453
|
if (this.pageIds.has(rootId)) return _$1(slugOf(rootId));
|
|
16407
16454
|
return [...new Set([...this.pageIds].flatMap((pageId) => _$1(slugOf(pageId))))];
|
|
16408
16455
|
}
|
|
@@ -16437,6 +16484,12 @@ var attributesOf$1 = (declaration) => {
|
|
|
16437
16484
|
return names.size ? [...names] : null;
|
|
16438
16485
|
};
|
|
16439
16486
|
/**
|
|
16487
|
+
* The element types a set of plugins adds, as the linter reads them: each one's own type, and the `custom` element that
|
|
16488
|
+
* hosts it (`custom:<type>`). What authoring hands the linter for the plugins it is given, and what any reader of a
|
|
16489
|
+
* space's stored documents hands it for the plugins installed there — the builder's — so both read the same.
|
|
16490
|
+
*/
|
|
16491
|
+
var pluginTypesOf = (types) => types.flatMap((type) => [type, hostedType(type)]);
|
|
16492
|
+
/**
|
|
16440
16493
|
* The catalogs `authorSpace` holds a space to, with each declared plugin in them as if it were built in.
|
|
16441
16494
|
*
|
|
16442
16495
|
* Every catalog a built-in element is checked against is derived from its declaration; a plugin's declaration has
|
|
@@ -16452,9 +16505,8 @@ var withPluginCatalogs = (options) => {
|
|
|
16452
16505
|
* `defineElement`) and `custom:<type>` (a component of the project's own, hosted by `custom({ renderType })`). The
|
|
16453
16506
|
* hosted form is the `custom` element's own vocabulary plus the component's.
|
|
16454
16507
|
*/
|
|
16455
|
-
const hostedKey = (declaration) => `${CUSTOM_TYPE}:${declaration.type}`;
|
|
16456
16508
|
const byType = (own, hosted = own) => Object.fromEntries(plugins.flatMap((declaration) => {
|
|
16457
|
-
return [[declaration.type, own(declaration)], [
|
|
16509
|
+
return [[declaration.type, own(declaration)], [hostedType(declaration.type), hosted(declaration)]].filter((entry) => entry[1] !== void 0);
|
|
16458
16510
|
}));
|
|
16459
16511
|
const customTriggers = rest.vocabulary?.triggers?.["custom"] ?? Object.keys(e$32);
|
|
16460
16512
|
const customCallbacks = rest.vocabulary?.callbacks?.["custom"] ?? Object.keys(o$33);
|
|
@@ -16473,7 +16525,7 @@ var withPluginCatalogs = (options) => {
|
|
|
16473
16525
|
return {
|
|
16474
16526
|
...rest,
|
|
16475
16527
|
...vocabulary ? { vocabulary } : {},
|
|
16476
|
-
pluginTypes: [...rest.pluginTypes ?? [], ...plugins.
|
|
16528
|
+
pluginTypes: [...rest.pluginTypes ?? [], ...pluginTypesOf(plugins.map((declaration) => declaration.type))],
|
|
16477
16529
|
sourceTypes: {
|
|
16478
16530
|
...rest.sourceTypes,
|
|
16479
16531
|
...byType((declaration) => declaration.sourceType)
|
|
@@ -16500,8 +16552,8 @@ var withPluginCatalogs = (options) => {
|
|
|
16500
16552
|
return reserved.length > 0 ? reserved : void 0;
|
|
16501
16553
|
})
|
|
16502
16554
|
},
|
|
16503
|
-
drawsNothingTypes: [...rest.drawsNothingTypes ?? [], ...plugins.filter((declaration) => declaration.drawsNothing === true).
|
|
16504
|
-
choosesChildrenTypes: [...rest.choosesChildrenTypes ?? [], ...plugins.filter((declaration) => declaration.choosesChildren === true).
|
|
16555
|
+
drawsNothingTypes: [...rest.drawsNothingTypes ?? [], ...pluginTypesOf(plugins.filter((declaration) => declaration.drawsNothing === true).map((declaration) => declaration.type))],
|
|
16556
|
+
choosesChildrenTypes: [...rest.choosesChildrenTypes ?? [], ...pluginTypesOf(plugins.filter((declaration) => declaration.choosesChildren === true).map((declaration) => declaration.type))],
|
|
16505
16557
|
leafTypes: [...rest.leafTypes ?? [], ...plugins.filter((declaration) => declaration.content?.definition && !Array.isArray(declaration.content.definition.items)).map((declaration) => declaration.type)]
|
|
16506
16558
|
};
|
|
16507
16559
|
};
|
|
@@ -16648,7 +16700,7 @@ var onScroll = () => on(s$31);
|
|
|
16648
16700
|
* more: `[named('end', onView(400)), when({ field: 'end.inView', operator: '==', value: true }), loadMore('posts')]`.
|
|
16649
16701
|
* `margin` fires it that many pixels before the element shows, so the next page is there when it is reached.
|
|
16650
16702
|
*/
|
|
16651
|
-
var onView = (margin = 0) => on(c$
|
|
16703
|
+
var onView = (margin = 0) => on(c$32, margin === 0 ? {} : { margin });
|
|
16652
16704
|
var onPageLoad = () => on("onPageLoad");
|
|
16653
16705
|
/**
|
|
16654
16706
|
* The end of a server action this element started — the trigger a `detached` run needs, because that step returns
|
|
@@ -17491,7 +17543,7 @@ var n$4 = {
|
|
|
17491
17543
|
* of them is an authoring question nobody at runtime asks.
|
|
17492
17544
|
*/
|
|
17493
17545
|
var BUILTIN_GLOBAL_CALLBACKS = {
|
|
17494
|
-
...i$
|
|
17546
|
+
...i$44,
|
|
17495
17547
|
...e$3,
|
|
17496
17548
|
...e$6,
|
|
17497
17549
|
...e$5,
|
|
@@ -17511,7 +17563,7 @@ var applyBuiltinCallback = (action, params) => {
|
|
|
17511
17563
|
const builtin = BUILTIN_GLOBAL_CALLBACKS[action];
|
|
17512
17564
|
return {
|
|
17513
17565
|
source: builtin.source,
|
|
17514
|
-
params: c$
|
|
17566
|
+
params: c$33(params, builtin.params, builtin.strictParams)
|
|
17515
17567
|
};
|
|
17516
17568
|
};
|
|
17517
17569
|
// src/schema/flows.ts
|
|
@@ -17999,7 +18051,7 @@ var applyUtility = (action, params) => {
|
|
|
17999
18051
|
};
|
|
18000
18052
|
return {
|
|
18001
18053
|
known: true,
|
|
18002
|
-
params: c$
|
|
18054
|
+
params: c$33(params, utility.params, utility.strictParams)
|
|
18003
18055
|
};
|
|
18004
18056
|
};
|
|
18005
18057
|
var NOT_FOUND_ID = "plitzi-not-found";
|
|
@@ -18299,7 +18351,7 @@ var cell = (text) => text.replaceAll("|", "\\|");
|
|
|
18299
18351
|
* them: the skill's `authoring-errors.md` and the website's both render it, so neither can miss a code.
|
|
18300
18352
|
*/
|
|
18301
18353
|
var authoringCodesTable = (kind) => {
|
|
18302
|
-
const rows = Object.entries(AUTHORING_CODES).filter(([, entry]) => entry.kind === kind).sort(([a], [b]) => a.localeCompare(b)).map(([code, entry]) => `| \`${code}\` | ${cell(entry.means)} | ${cell(entry.fix)} |`);
|
|
18354
|
+
const rows = Object.entries(AUTHORING_CODES).map(([code, entry]) => [code, entry]).filter(([, entry]) => entry.kind === kind).sort(([a], [b]) => a.localeCompare(b)).map(([code, entry]) => `| \`${code}\` | ${cell(entry.means)}${entry.authoringOnly ? ` — said by \`author\` alone, which reads ${cell(entry.authoringOnly)}` : ""} | ${cell(entry.fix)} |`);
|
|
18303
18355
|
return [
|
|
18304
18356
|
kind === "suggested" ? "| Code | Written the long way | The short way |" : "| Code | What was wrong | Write instead |",
|
|
18305
18357
|
"| --- | --- | --- |",
|
|
@@ -18511,7 +18563,7 @@ var says = (ctx, element, name) => {
|
|
|
18511
18563
|
if (boundAttributes$1(element).has(name)) return true;
|
|
18512
18564
|
const value = attributeValue(ctx, element, name);
|
|
18513
18565
|
if (typeof value === "number") return true;
|
|
18514
|
-
return textOf$
|
|
18566
|
+
return textOf$3(value).trim() !== "";
|
|
18515
18567
|
};
|
|
18516
18568
|
var isDecorative = (element) => element.attributes.decorative === true;
|
|
18517
18569
|
/** Inside a container marked `decorative`: an illustration assistive technology is told to skip, whatever it holds. */
|
|
@@ -18553,7 +18605,7 @@ var FIXES = {
|
|
|
18553
18605
|
var warnUnnamedControl = (ctx, element, where) => {
|
|
18554
18606
|
const { type } = element.definition;
|
|
18555
18607
|
if (type === "formControl") {
|
|
18556
|
-
const subType = textOf$
|
|
18608
|
+
const subType = textOf$3(attributeValue(ctx, element, "subType"), "text");
|
|
18557
18609
|
const named = says(ctx, element, "label") || PLACEHOLDER_NAMED.has(subType) && says(ctx, element, "placeholder");
|
|
18558
18610
|
if (subType === "hidden" || named) return;
|
|
18559
18611
|
ctx.warn("control-without-name", `${where} is a "${subType}" field with nothing naming it, so a screen reader or a browser agent finds an unnamed box and cannot tell what it is for. Give it a \`label\` — with \`hideLabel: true\` when the design already says what it is (a swatch, a search box with a magnifier), which keeps the name and hides the words.`, element.id);
|
|
@@ -18589,7 +18641,7 @@ var warnClickOnStaticElement = (ctx, element, where) => {
|
|
|
18589
18641
|
};
|
|
18590
18642
|
var warnIgnoredRegionName = (ctx, element, where) => {
|
|
18591
18643
|
if (element.definition.type !== "container" || !says(ctx, element, "label")) return;
|
|
18592
|
-
const subType = textOf$
|
|
18644
|
+
const subType = textOf$3(attributeValue(ctx, element, "subType"), "div");
|
|
18593
18645
|
if (n$28.some((tag) => tag === subType)) return;
|
|
18594
18646
|
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$28.map((tag) => `'${tag}'`).join(", ")}.`, element.id);
|
|
18595
18647
|
};
|
|
@@ -18641,8 +18693,8 @@ var DATA_READ = /(?<![\w.])apiContainer_([A-Za-z0-9_-]+)\.data(?![\w-])/g;
|
|
|
18641
18693
|
*/
|
|
18642
18694
|
var checkRead = (ctx, providerId, path, where, id) => {
|
|
18643
18695
|
const provider = ctx.element(providerId);
|
|
18644
|
-
const action = textOf$
|
|
18645
|
-
if (!provider || provider.definition.type !== "apiContainer" || !action || textOf$
|
|
18696
|
+
const action = textOf$3(provider?.attributes.action);
|
|
18697
|
+
if (!provider || provider.definition.type !== "apiContainer" || !action || textOf$3(provider.attributes.connector)) return;
|
|
18646
18698
|
const rest = path.slice(`${PROVIDER$2}${providerId}.data`.length);
|
|
18647
18699
|
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 });
|
|
18648
18700
|
};
|
|
@@ -18680,13 +18732,12 @@ var attributeText$1 = (element, key) => {
|
|
|
18680
18732
|
* element's own `anchor`, and the `id` of every heading a Markdown element renders. One in a list's rows is not the
|
|
18681
18733
|
* page's: each row's is its own (`rowAnchors`).
|
|
18682
18734
|
*/
|
|
18683
|
-
var anchorsOfPage = (ctx, pageId, rowAnchors) => {
|
|
18735
|
+
var anchorsOfPage = (ctx, byRoot, pageId, rowAnchors) => {
|
|
18684
18736
|
const page = ctx.element(pageId);
|
|
18685
18737
|
const chain = page ? t$68((id) => ctx.element(id), attributeText$1(page, "layout"), attributeText$1(page, "layoutContainer")) : [];
|
|
18686
18738
|
const roots = /* @__PURE__ */ new Set([pageId, ...chain.map((link) => link.layout)]);
|
|
18687
18739
|
const anchors = /* @__PURE__ */ new Map();
|
|
18688
|
-
|
|
18689
|
-
if (!roots.has(element.definition.rootId)) return;
|
|
18740
|
+
[...roots].flatMap((root) => byRoot.get(root) ?? []).forEach((element) => {
|
|
18690
18741
|
if (element.definition.anchor && inRows(ctx, element.id)) {
|
|
18691
18742
|
rowAnchors?.add(element.definition.anchor);
|
|
18692
18743
|
return;
|
|
@@ -18757,13 +18808,20 @@ var lintAnchors = (ctx) => {
|
|
|
18757
18808
|
});
|
|
18758
18809
|
lintControls(ctx);
|
|
18759
18810
|
if (ctx.component) return;
|
|
18811
|
+
const byRoot = /* @__PURE__ */ new Map();
|
|
18812
|
+
Object.values(ctx.flat).forEach((element) => {
|
|
18813
|
+
const root = element.definition.rootId;
|
|
18814
|
+
const elements = byRoot.get(root) ?? [];
|
|
18815
|
+
elements.push(element);
|
|
18816
|
+
byRoot.set(root, elements);
|
|
18817
|
+
});
|
|
18760
18818
|
const byPage = /* @__PURE__ */ new Map();
|
|
18761
18819
|
const anchorsByPage = (pageId) => {
|
|
18762
18820
|
const known = byPage.get(pageId);
|
|
18763
18821
|
if (known) return known;
|
|
18764
18822
|
const rows = /* @__PURE__ */ new Set();
|
|
18765
18823
|
const found = {
|
|
18766
|
-
anchors: anchorsOfPage(ctx, pageId, rows),
|
|
18824
|
+
anchors: anchorsOfPage(ctx, byRoot, pageId, rows),
|
|
18767
18825
|
rows
|
|
18768
18826
|
};
|
|
18769
18827
|
byPage.set(pageId, found);
|
|
@@ -18973,8 +19031,8 @@ var PROVIDER$1 = "apiContainer_";
|
|
|
18973
19031
|
*/
|
|
18974
19032
|
var lintServerDataReads = (ctx) => {
|
|
18975
19033
|
for (const element of Object.values(ctx.flat)) {
|
|
18976
|
-
const query = textOf$
|
|
18977
|
-
const fed = ["connector", "action"].some((key) => textOf$
|
|
19034
|
+
const query = textOf$3(element.attributes.query);
|
|
19035
|
+
const fed = ["connector", "action"].some((key) => textOf$3(element.attributes[key]) !== "");
|
|
18978
19036
|
if (!query.startsWith("/data/") || fed || element.definition.runtime === "server") continue;
|
|
18979
19037
|
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);
|
|
18980
19038
|
}
|
|
@@ -18993,8 +19051,8 @@ var lintDataPaths = (ctx) => {
|
|
|
18993
19051
|
const answer = (providerId) => {
|
|
18994
19052
|
if (answers.has(providerId)) return answers.get(providerId);
|
|
18995
19053
|
const provider = ctx.flat[providerId];
|
|
18996
|
-
const query = textOf$
|
|
18997
|
-
const fed = ["connector", "action"].some((key) => textOf$
|
|
19054
|
+
const query = textOf$3(provider?.attributes.query);
|
|
19055
|
+
const fed = ["connector", "action"].some((key) => textOf$3(provider?.attributes[key]) !== "");
|
|
18998
19056
|
const sample = provider && query && !fed && !query.includes("{{") ? answerOf(query) : void 0;
|
|
18999
19057
|
const published = sample === void 0 ? void 0 : {
|
|
19000
19058
|
status: 200,
|
|
@@ -19013,7 +19071,7 @@ var lintDataPaths = (ctx) => {
|
|
|
19013
19071
|
const reach = followPath(published, path);
|
|
19014
19072
|
const rows = element.definition.type === "list" && binding.to === "items";
|
|
19015
19073
|
if (!reach.found && isWrongPath(reach, path.length, rows)) {
|
|
19016
|
-
const query = textOf$
|
|
19074
|
+
const query = textOf$3(ctx.element(root.slice(13))?.attributes.query);
|
|
19017
19075
|
ctx.warn("path-not-in-data", `${ctx.describe(element.id)} reads \`${binding.source}\` for its ${binding.to}, and ${query} has no such path — ${stoppedAt(root, reach)}.`, element.id, { source: binding.source });
|
|
19018
19076
|
}
|
|
19019
19077
|
}
|
|
@@ -22058,7 +22116,7 @@ var warnFormControls = (ctx) => {
|
|
|
22058
22116
|
const named = /* @__PURE__ */ new Map();
|
|
22059
22117
|
for (const control of controlsOf(ctx, form.id)) {
|
|
22060
22118
|
if (bindingsOf$2(control).some(({ binding }) => binding.to === "name")) continue;
|
|
22061
|
-
const name = textOf$
|
|
22119
|
+
const name = textOf$3(control.attributes.name).trim();
|
|
22062
22120
|
const where = ctx.describe(control.id);
|
|
22063
22121
|
if (name === "") {
|
|
22064
22122
|
ctx.warn("form-control-unnamed", `${where} is in the form "${form.id}" with no \`name\`, so what it holds never reaches the form's values. Give it one — \`formControl({ name: 'email', … })\` — and read it as \`values.email\`.`, control.id);
|
|
@@ -22083,7 +22141,7 @@ var warnFormControls = (ctx) => {
|
|
|
22083
22141
|
*/
|
|
22084
22142
|
var checkRequiredMessage = (ctx, element, where) => {
|
|
22085
22143
|
const { required, requiredMessage } = element.attributes;
|
|
22086
|
-
const message = textOf$
|
|
22144
|
+
const message = textOf$3(requiredMessage).trim();
|
|
22087
22145
|
const requires = required === true || required === "true" || typeof required === "string" && required.includes("{{");
|
|
22088
22146
|
const bound = bindingsOf$2(element).some(({ binding }) => binding.to === "required");
|
|
22089
22147
|
if (element.definition.type !== "formControl" || message === "" || requires || bound) return;
|
|
@@ -22154,7 +22212,7 @@ var pagePath = (ctx, pageId) => {
|
|
|
22154
22212
|
const page = ctx.element(pageId);
|
|
22155
22213
|
if (!page) return;
|
|
22156
22214
|
const { slug, folder } = page.attributes;
|
|
22157
|
-
return `/${[typeof folder === "string" && folder ? folderPath(ctx, folder) : "", textOf$
|
|
22215
|
+
return `/${[typeof folder === "string" && folder ? folderPath(ctx, folder) : "", textOf$3(slug)].filter(Boolean).join("/")}`;
|
|
22158
22216
|
};
|
|
22159
22217
|
/**
|
|
22160
22218
|
* A path in page mode that no page answers — a page not written yet, or a typo — is followed in-app to the 404 page.
|
|
@@ -22454,7 +22512,7 @@ var FOCUS_STATES = ["focus", "focus-visible"];
|
|
|
22454
22512
|
*/
|
|
22455
22513
|
var checkFocusOnFieldBox = (ctx, element, where) => {
|
|
22456
22514
|
if (element.definition.type !== "formControl") return;
|
|
22457
|
-
const subType = textOf$
|
|
22515
|
+
const subType = textOf$3(element.attributes.subType, textOf$3(ctx.defaultsFor(element).subType, "text"));
|
|
22458
22516
|
if (!BOXED_FIELDS.has(subType)) return;
|
|
22459
22517
|
for (const className of classesOf$2(element.definition.styleSelectors.input)) for (const items of Object.values(ctx.style.platform)) {
|
|
22460
22518
|
const item = Object.hasOwn(items, className) ? items[className] : void 0;
|
|
@@ -22542,6 +22600,46 @@ var checkIconFont = (ctx, element, where) => {
|
|
|
22542
22600
|
const set = setOnBase(ctx, element, ["font-family"]);
|
|
22543
22601
|
if (set) ctx.warn("icon-font-replaced", `${where} is a fontAwesome icon whose class "${set.className}" sets \`font-family\` (${set.mode}) — the icon's glyphs are Font Awesome's font, and another draws a fallback character in their place. Set the font on the text around it; on the icon, its size and colour.`, element.id);
|
|
22544
22602
|
};
|
|
22603
|
+
// src/schema/lint/variants.ts
|
|
22604
|
+
/**
|
|
22605
|
+
* A variant set on an element that no style declares, so nothing applies — the element looks the same with it or
|
|
22606
|
+
* without: its own (`initialState.styleVariant`, `variant` in a spec), or one an `activeWhen` binding sets. Read off
|
|
22607
|
+
* the documents, so the builder says it of an element as authoring does.
|
|
22608
|
+
*/
|
|
22609
|
+
/** Every variant a style declares at any width and on any of its parts: a class, or an element type's defaults. */
|
|
22610
|
+
var declaredVariants = (ctx, owner) => Object.values(ctx.style.platform).flatMap((items) => Object.hasOwn(items, owner) ? Object.values(items[owner].attributes).flatMap((block) => Object.keys(block.variants ?? {})) : []);
|
|
22611
|
+
/** The element's own variants, by the style that owns each: `{ card: { base: 'primary' } }`. */
|
|
22612
|
+
var ownVariants = (element) => Object.entries(element.definition.initialState?.styleVariant ?? {}).flatMap(([owner, parts]) => Object.values(parts ?? {}).flatMap((value) => (Array.isArray(value) ? value : [value]).flatMap((name) => typeof name === "string" ? [[owner, name]] : [])));
|
|
22613
|
+
/**
|
|
22614
|
+
* The variant an `activeWhen` sets — `{{ (…) ? 'active' : 'idle' }}` names its one — on the class its key names
|
|
22615
|
+
* (`card.base`). A template that builds the name (`'c' ~ source`) or compares words names none to hold the class to.
|
|
22616
|
+
*/
|
|
22617
|
+
var variantsSet = (element) => Object.values(element.definition.bindings ?? {}).flat().flatMap((binding) => {
|
|
22618
|
+
const key = binding.transformers?.find((each) => each.action === "styleVariant")?.params.key;
|
|
22619
|
+
const template = binding.transformers?.find((each) => each.action === "twigTemplate")?.params.template;
|
|
22620
|
+
if (typeof key !== "string" || typeof template !== "string") return [];
|
|
22621
|
+
const names = [...template.matchAll(/\?\s*'([\w-]+)'\s*:\s*'idle'\s*\}\}\s*$/g)].map((match) => match[1]);
|
|
22622
|
+
return names.length > 0 ? [{
|
|
22623
|
+
cls: key.slice(0, key.lastIndexOf(".")),
|
|
22624
|
+
names
|
|
22625
|
+
}] : [];
|
|
22626
|
+
});
|
|
22627
|
+
/** Why the variant may have been meant for something else: a plugin's own `variant`, or a hosted component's prop. */
|
|
22628
|
+
var hintOf = (ctx, element) => (ctx.catalogs.reservedPluginAttributes?.[pluginKeyOf(element)] ?? []).includes("variant") ? " If it was meant for the plugin’s own `variant`, that attribute is never set: rename it in the plugin." : element.definition.type === "custom" ? " On a `custom` element `variant` is its style variant, never a prop of the component it hosts: hand the component a prop of another name (`tone`)." : "";
|
|
22629
|
+
var lintVariants = (ctx) => {
|
|
22630
|
+
for (const element of Object.values(ctx.flat)) {
|
|
22631
|
+
const where = ctx.describe(element.id);
|
|
22632
|
+
for (const [owner, name] of ownVariants(element)) {
|
|
22633
|
+
if (name === "" || declaredVariants(ctx, owner).includes(name)) continue;
|
|
22634
|
+
ctx.warn("unknown-variant", `${where} is written with \`variant: '${name}'\`, which no class of it and no style of its type declares, so nothing applies.${hintOf(ctx, element)} Declare it — \`styles(name, { variants: { ${name}: { … } } })\` — or name one that is.`, element.id);
|
|
22635
|
+
}
|
|
22636
|
+
for (const { cls, names } of variantsSet(element)) {
|
|
22637
|
+
const declared = declaredVariants(ctx, cls);
|
|
22638
|
+
if (!Object.values(ctx.style.platform).some((items) => Object.hasOwn(items, cls)) || names.some((name) => declared.includes(name))) continue;
|
|
22639
|
+
ctx.warn("unknown-variant", `${where} sets class ${cls}'s variant ${names.map((name) => `'${name}'`).join(" or ")} by \`activeWhen\`, which ${cls} does not declare — ${declared.length > 0 ? `its variants: ${[...new Set(declared)].join(", ")}` : "it has none"} — so nothing applies. Name one it declares — \`activeWhen(${cls}, …, { variant: '${declared[0] ?? "active"}' })\` — or declare it.`, element.id);
|
|
22640
|
+
}
|
|
22641
|
+
}
|
|
22642
|
+
};
|
|
22545
22643
|
// src/schema/lint/elements.ts
|
|
22546
22644
|
/** What an author is missing after "write that element instead", by the element: how its parts are written. */
|
|
22547
22645
|
var OWNER_HINT = { list: " — its rows written out, as children (`listItem({ children: [ … ] })` each), or drawn from data with `items`." };
|
|
@@ -22586,7 +22684,7 @@ var checkAttributes = (ctx, element, where) => {
|
|
|
22586
22684
|
for (const [name, value] of Object.entries(element.attributes)) {
|
|
22587
22685
|
if (names && !names.includes(name)) {
|
|
22588
22686
|
const hint = /^on[A-Z]/.test(name) ? ` What happens on an event is a flow: \`flows: [[${name}(), setState({ … })]]\`.` : name === "decorative" && names.includes("label") ? ` Without a \`label\` a "${type}" is already decorative — hidden from screen readers: leave \`decorative\` out.` : "";
|
|
22589
|
-
ctx.error("unknown-attribute", `${where} sets "${name}", which a "${type}" never reads${didYouMean(name, names) || "."}${hint || ` It reads ${names.join(", ")}.`}`, element.id);
|
|
22687
|
+
ctx.error("unknown-attribute", `${where} sets "${name}", which a "${type}" never reads${didYouMean(name, names) || "."}${hint || (names.length > 0 ? ` It reads ${names.join(", ")}.` : " It reads no attribute: remove it.")}`, element.id);
|
|
22590
22688
|
continue;
|
|
22591
22689
|
}
|
|
22592
22690
|
if (value === void 0 || value === null || typeof value === "string" && n$69(value)) continue;
|
|
@@ -22658,6 +22756,7 @@ var checkSvgMarkup = (ctx, element, where) => {
|
|
|
22658
22756
|
ctx.error("svg-not-svg", `${where} is an \`svg\` whose \`content\` is not one \`<svg>…</svg>\` (${JSON.stringify(shorten(content))}), so it draws nothing. Give it the SVG markup alone; HTML around it belongs in a \`blockHtml\`.`, element.id);
|
|
22659
22757
|
};
|
|
22660
22758
|
var lintElements = (ctx) => {
|
|
22759
|
+
lintVariants(ctx);
|
|
22661
22760
|
const catalog = ctx.catalogs.attributeNames;
|
|
22662
22761
|
const unknownTypes = /* @__PURE__ */ new Set();
|
|
22663
22762
|
for (const element of Object.values(ctx.flat)) {
|
|
@@ -22771,22 +22870,22 @@ var flowsOf$1 = (element) => {
|
|
|
22771
22870
|
*/
|
|
22772
22871
|
var checkElementIds = (ctx, params, spec, at, hostId) => {
|
|
22773
22872
|
const declared = spec ?? {};
|
|
22774
|
-
const effective = c$
|
|
22873
|
+
const effective = c$33(params, declared, false);
|
|
22775
22874
|
for (const [key, param] of Object.entries(declared)) {
|
|
22776
22875
|
const ids = params[key];
|
|
22777
22876
|
if (param.type !== "elementIds" || !Array.isArray(ids) || param.when && !param.when(effective)) continue;
|
|
22778
22877
|
const { elementType } = param;
|
|
22779
|
-
const candidates = Object.values({
|
|
22780
|
-
...ctx.schema.flat,
|
|
22781
|
-
...ctx.flat
|
|
22782
|
-
}).filter((element) => !elementType || element.definition.type === elementType).map((element) => element.id);
|
|
22783
22878
|
const kind = elementType ? `an ${elementType}` : "an element";
|
|
22784
|
-
const listed = candidates.length > 0 ? `: ${candidates.slice(0, 8).join(", ")}${candidates.length > 8 ? ", …" : ""}` : ", and the space has none";
|
|
22785
22879
|
for (const id of ids) {
|
|
22786
22880
|
if (typeof id !== "string" || e$30(id)) continue;
|
|
22787
22881
|
const element = ctx.element(id) ?? (Object.hasOwn(ctx.schema.flat, id) ? ctx.schema.flat[id] : void 0);
|
|
22788
22882
|
const type = element?.definition.type;
|
|
22789
22883
|
if (element && (!elementType || type === elementType)) continue;
|
|
22884
|
+
const candidates = Object.values({
|
|
22885
|
+
...ctx.schema.flat,
|
|
22886
|
+
...ctx.flat
|
|
22887
|
+
}).filter((each) => !elementType || each.definition.type === elementType).map((each) => each.id);
|
|
22888
|
+
const listed = candidates.length > 0 ? `: ${candidates.slice(0, 8).join(", ")}${candidates.length > 8 ? ", …" : ""}` : ", and the space has none";
|
|
22790
22889
|
const found = element ? `a "${type ?? ""}" — only ${kind} is refreshed by its id, so it refreshes nothing` : "an id no element of the space has";
|
|
22791
22890
|
ctx.error("element-ids-target", `${at}: "${key}" names "${id}", ${found}${didYouMean(id, candidates) || "."} It takes the id of ${kind}${listed}.`, hostId);
|
|
22792
22891
|
}
|
|
@@ -22913,7 +23012,7 @@ var checkCallbackKey = (ctx, node, where, hostId) => {
|
|
|
22913
23012
|
if (!keys.includes(key)) ctx.error("callback-key-unknown", `${at} the state "${key}" on "${target}", which a "${type}" does not have${didYouMean(key, keys) || "."} Its state is ${keys.join(", ")}.`, hostId);
|
|
22914
23013
|
return;
|
|
22915
23014
|
}
|
|
22916
|
-
if (key !== "className" && !names.includes(key)) ctx.error("callback-key-unknown", `${at} "${key}" on "${target}", which a "${type}" never reads — the step runs and nothing changes${didYouMean(key, names) || "."} It reads ${names.join(", ")}
|
|
23015
|
+
if (key !== "className" && !names.includes(key)) ctx.error("callback-key-unknown", `${at} "${key}" on "${target}", which a "${type}" never reads — the step runs and nothing changes${didYouMean(key, names) || "."}${names.length > 0 ? ` It reads ${names.join(", ")}.` : " It reads none."}`, hostId);
|
|
22917
23016
|
};
|
|
22918
23017
|
/**
|
|
22919
23018
|
* The callbacks every element answers to take params the runtime reads as declared; a type's own callbacks describe
|
|
@@ -23159,6 +23258,28 @@ var lintFlows = (ctx) => {
|
|
|
23159
23258
|
}
|
|
23160
23259
|
warnOverlaysNeverOpened(ctx);
|
|
23161
23260
|
};
|
|
23261
|
+
// src/schema/lint/keptState.ts
|
|
23262
|
+
/**
|
|
23263
|
+
* What a space says to keep of its state that does nothing, said: a list of keys under `settings.transientState`,
|
|
23264
|
+
* `keptState`, `paintedState` or `browserState` while `settings.keepState` is off — nothing is kept in the first place.
|
|
23265
|
+
* Read off the settings, so the builder says it as authoring does.
|
|
23266
|
+
*/
|
|
23267
|
+
var lintKeptState = (ctx) => {
|
|
23268
|
+
const settings = ctx.schema.settings;
|
|
23269
|
+
if (settings.keepState === true) return;
|
|
23270
|
+
const listed = (key) => {
|
|
23271
|
+
const keys = settings[key];
|
|
23272
|
+
return Array.isArray(keys) && keys.length > 0 ? keys : void 0;
|
|
23273
|
+
};
|
|
23274
|
+
const transient = listed("transientState");
|
|
23275
|
+
if (transient) ctx.warn("transient-state-without-keep-state", "`settings.transientState` names keys never to keep, but `settings.keepState` is not on — nothing is kept in the first place, so it does nothing. Turn `keepState` on, or remove `transientState`.", void 0, { keys: transient });
|
|
23276
|
+
const kept = listed("keptState");
|
|
23277
|
+
if (kept) ctx.warn("kept-state-without-keep-state", "`settings.keptState` names the keys to keep, but `settings.keepState` is not on — nothing is kept, so it does nothing. Turn `keepState` on, or remove `keptState`.", void 0, { keys: kept });
|
|
23278
|
+
const painted = listed("paintedState");
|
|
23279
|
+
if (painted) ctx.warn("painted-state-without-keep-state", "`settings.paintedState` names kept keys for the server to draw with, but `settings.keepState` is not on — nothing is kept, so there is nothing to draw with. Turn `keepState` on, or remove `paintedState`.", void 0, { keys: painted });
|
|
23280
|
+
const browser = listed("browserState");
|
|
23281
|
+
if (browser) ctx.warn("browser-state-without-keep-state", "`settings.browserState` names kept keys the browser keeps whoever signs in, but `settings.keepState` is not on — nothing is kept, so it does nothing. Turn `keepState` on, or remove `browserState`.", void 0, { keys: browser });
|
|
23282
|
+
};
|
|
23162
23283
|
// src/schema/lint/links.ts
|
|
23163
23284
|
var attributeText = (element, key) => {
|
|
23164
23285
|
const value = element.attributes[key];
|
|
@@ -23334,7 +23455,30 @@ var lintFontWeights = (ctx) => {
|
|
|
23334
23455
|
}
|
|
23335
23456
|
}
|
|
23336
23457
|
};
|
|
23458
|
+
/**
|
|
23459
|
+
* A tablet rule a phone never sees.
|
|
23460
|
+
*
|
|
23461
|
+
* The breakpoints are RANGES, not a cascade: `tablet` is 48–64rem, `mobile` is up to 48rem, and each inherits only
|
|
23462
|
+
* from `desktop`. So a layout that collapses to a column at tablet and says nothing for mobile comes back as desktop
|
|
23463
|
+
* columns on a phone — the narrowest screen gets the widest layout, and every check passes. A warning and not a
|
|
23464
|
+
* refusal, because a rule meant for tablets alone is legal, just rarely what anybody meant. Read off the stylesheet, so
|
|
23465
|
+
* authoring and the builder say it of the same classes.
|
|
23466
|
+
*/
|
|
23467
|
+
/** The properties only a grid reads: what a grid's tracks and its placement of items are. */
|
|
23468
|
+
var GRID_ONLY = /^grid-(template|auto)-/;
|
|
23469
|
+
var lintTabletOnly = (ctx) => {
|
|
23470
|
+
const { tablet, mobile } = ctx.style.platform;
|
|
23471
|
+
Object.entries(tablet).forEach(([name, item]) => {
|
|
23472
|
+
const rules = Object.hasOwn(item.attributes, "base") ? item.attributes.base.default ?? {} : {};
|
|
23473
|
+
const phone = Object.hasOwn(mobile, name) && Object.hasOwn(mobile[name].attributes, "base") ? mobile[name].attributes.base.default ?? {} : {};
|
|
23474
|
+
if (phone.display === "none") return;
|
|
23475
|
+
const notAGrid = typeof phone.display === "string" && !phone.display.endsWith("grid");
|
|
23476
|
+
const skipped = Object.keys(rules).filter((property) => !Object.hasOwn(phone, property) && !(notAGrid && GRID_ONLY.test(property)));
|
|
23477
|
+
if (skipped.length > 0) ctx.warn("tablet-rule-skips-mobile", `Class "${name}" sets ${skipped.join(", ")} for tablet but not for mobile. Tablet (48–64rem) and mobile (up to 48rem) are separate ranges and mobile inherits desktop, not tablet — so phones get the desktop value back. For both, write it once under \`compact\` (tablet and mobile together); repeat it under \`mobile\` otherwise.`, void 0, { properties: skipped });
|
|
23478
|
+
});
|
|
23479
|
+
};
|
|
23337
23480
|
var lintStyle = (ctx) => {
|
|
23481
|
+
lintTabletOnly(ctx);
|
|
23338
23482
|
lintColours(ctx);
|
|
23339
23483
|
lintVariables(ctx);
|
|
23340
23484
|
lintAnimations(ctx);
|
|
@@ -24437,7 +24581,7 @@ var journeyStartWarnings = (document, tests = document.tests?.e2e ?? []) => test
|
|
|
24437
24581
|
const { action, pageId } = pageAt(document, test.page, { signedIn: true });
|
|
24438
24582
|
const attributes = pageId === void 0 || action !== "normal" || !Object.hasOwn(document.flat, pageId) ? void 0 : document.flat[pageId].attributes;
|
|
24439
24583
|
if (!attributes) return [];
|
|
24440
|
-
const access = r$
|
|
24584
|
+
const access = r$45(attributes);
|
|
24441
24585
|
if (test.as === void 0) return attributes.accessLevel === "authenticated" || access ? [`journey "${test.id}": it starts on ${test.page} as a guest, and that page is for signed-in visitors — a guest is sent to sign in there: play it as one of the test accounts, or start on a page a guest opens (keep it if the door is what it checks)`] : [];
|
|
24442
24586
|
const account = document.tests?.accounts?.find((each) => each.id === test.as);
|
|
24443
24587
|
const given = account ? i(document.settings.visitorRoles, account.roles ?? []).permissions : [];
|
|
@@ -24825,6 +24969,7 @@ var lintSpace$1 = ({ schema, style }, catalogs = {}) => {
|
|
|
24825
24969
|
const ctx = new LintContext(schema, style, catalogs);
|
|
24826
24970
|
lintPages(ctx);
|
|
24827
24971
|
lintComputed(ctx);
|
|
24972
|
+
lintKeptState(ctx);
|
|
24828
24973
|
lintFlags(ctx);
|
|
24829
24974
|
lintElements(ctx);
|
|
24830
24975
|
lintTypeSlots(ctx);
|
|
@@ -25725,7 +25870,11 @@ var plural = (count, one, many) => count === 1 ? one : many;
|
|
|
25725
25870
|
var classesOf$1 = (style) => {
|
|
25726
25871
|
const items = Object.values(style.platform).flatMap((byName) => Object.values(byName));
|
|
25727
25872
|
const namedBy = /* @__PURE__ */ new Map();
|
|
25728
|
-
for (const item of items) for (const word of wordsOf$1(JSON.stringify(item.attributes)))
|
|
25873
|
+
for (const item of items) for (const word of wordsOf$1(JSON.stringify(item.attributes))) {
|
|
25874
|
+
const named = namedBy.get(word) ?? /* @__PURE__ */ new Set();
|
|
25875
|
+
named.add(item.name);
|
|
25876
|
+
namedBy.set(word, named);
|
|
25877
|
+
}
|
|
25729
25878
|
return {
|
|
25730
25879
|
names: new Set(items.filter((item) => item.type === "class").map((item) => item.name)),
|
|
25731
25880
|
namedBy
|
|
@@ -25893,7 +26042,7 @@ var suggestElementColours = (style) => {
|
|
|
25893
26042
|
}];
|
|
25894
26043
|
};
|
|
25895
26044
|
// src/schema/advice/drawn.ts
|
|
25896
|
-
var textOf$
|
|
26045
|
+
var textOf$2 = (value) => typeof value === "string" ? value : "";
|
|
25897
26046
|
/**
|
|
25898
26047
|
* A page's elements in the order a visitor meets them: its shells' — the outermost first — with the page inside the
|
|
25899
26048
|
* container each one takes it in, after what that container holds of its own, as the page is drawn. The shells are
|
|
@@ -25905,7 +26054,7 @@ var textOf$1 = (value) => typeof value === "string" ? value : "";
|
|
|
25905
26054
|
var walkDrawn = (flat, pageId, initial, visit) => {
|
|
25906
26055
|
const page = flat[pageId];
|
|
25907
26056
|
if (!page) return;
|
|
25908
|
-
const shells = t$68((id) => flat[id], textOf$
|
|
26057
|
+
const shells = t$68((id) => flat[id], textOf$2(page.attributes.layout), textOf$2(page.attributes.layoutContainer));
|
|
25909
26058
|
const inside = /* @__PURE__ */ new Map();
|
|
25910
26059
|
shells.forEach((link, index) => inside.set(link.slot, index === 0 ? pageId : shells[index - 1].layout));
|
|
25911
26060
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -25930,13 +26079,13 @@ var HEADING_TAGS = /* @__PURE__ */ new Set([
|
|
|
25930
26079
|
"h5",
|
|
25931
26080
|
"h6"
|
|
25932
26081
|
]);
|
|
25933
|
-
var textOf = (value) => typeof value === "string" ? value : "";
|
|
26082
|
+
var textOf$1 = (value) => typeof value === "string" ? value : "";
|
|
25934
26083
|
var boundAttributes = (element) => new Set(Object.values(element.definition.bindings ?? {}).flatMap((list) => list.map((binding) => binding.to)));
|
|
25935
26084
|
/** The level a `heading` (an `h1` unless it says) or a container drawn as one renders. */
|
|
25936
26085
|
var headingLevel = (element) => {
|
|
25937
26086
|
const { type } = element.definition;
|
|
25938
26087
|
if (type !== "heading" && type !== "container") return;
|
|
25939
|
-
const tag = textOf(element.attributes.subType) || (type === "heading" ? "h1" : "div");
|
|
26088
|
+
const tag = textOf$1(element.attributes.subType) || (type === "heading" ? "h1" : "div");
|
|
25940
26089
|
return HEADING_TAGS.has(tag) ? Number(tag.slice(1)) : void 0;
|
|
25941
26090
|
};
|
|
25942
26091
|
/** What starts hidden: `visible: false`, shown later by a binding or a flow — and so is everything inside it. */
|
|
@@ -26226,7 +26375,7 @@ var suggestRepeats = (schema, style, families = []) => {
|
|
|
26226
26375
|
if (siblings && new Set(fresh.map((id) => signatures.get(id)?.wiring)).size > 1) continue;
|
|
26227
26376
|
const type = flat[fresh[0]].definition.type;
|
|
26228
26377
|
const ownSources = !siblings && new Set(fresh.map((id) => signatures.get(id)?.wiring)).size > 1 ? " Each copy reads a source of its own: hand it in as a bound `json` prop — `component(id, { bind: [{ to: 'items', source: '<what it reads>' }] })` — read inside as `props.items`." : "";
|
|
26229
|
-
const counted = ` Counted from ${String(MIN_SHAPE_COPIES)} copies of ${String(MIN_SHAPE)} elements or more (2 of ${String(MIN_PAIR)} or more); a helper called once a copy still writes each into the document. Alike on purpose: \`quiet: ['repeated-shape']\` on them, with a comment saying why.`;
|
|
26378
|
+
const counted = ` Counted from ${String(MIN_SHAPE_COPIES)} copies of ${String(MIN_SHAPE)} elements or more (2 of ${String(MIN_PAIR)} or more); a helper called once a copy still writes each into the document. Alike on purpose: \`quiet: ['repeated-shape']\` on them — or once, on the row copies side by side sit in — with a comment saying why.`;
|
|
26230
26379
|
suggestions.push({
|
|
26231
26380
|
code: "repeated-shape",
|
|
26232
26381
|
elementIds: fresh,
|
|
@@ -26246,6 +26395,12 @@ var suggestRepeats = (schema, style, families = []) => {
|
|
|
26246
26395
|
/** Past this, a page's elements weigh more than the rest of a typical page's download. */
|
|
26247
26396
|
var HEAVY_PAGE_BYTES = 25e4;
|
|
26248
26397
|
var kilobytes$1 = (bytes) => `${String(Math.round(bytes / 1e3))} KB`;
|
|
26398
|
+
/** What 10,000 visits that each download `bytes` move, before compression: the scale a reader weighs a page at. */
|
|
26399
|
+
var atVolume = (bytes) => {
|
|
26400
|
+
const total = bytes * 1e4;
|
|
26401
|
+
return total >= 1e9 ? `${(total / 1e9).toFixed(1)} GB` : `${String(Math.round(total / 1e6))} MB`;
|
|
26402
|
+
};
|
|
26403
|
+
var count = (value) => value.toLocaleString("en-US");
|
|
26249
26404
|
var subtreeOf = (flat, root) => {
|
|
26250
26405
|
const ids = [];
|
|
26251
26406
|
const stack = [root];
|
|
@@ -26288,12 +26443,105 @@ var suggestHeavyPages = (schema, style) => {
|
|
|
26288
26443
|
const named = weighed.map((shape) => `"${shape.copies[0]}" ×${String(shape.copies.length)} (${kilobytes$1(shape.bytes)})`);
|
|
26289
26444
|
return [{
|
|
26290
26445
|
code: "heavy-page",
|
|
26291
|
-
message: `Page "${page}" is ${kilobytes$1(bytes)} of document, past ${kilobytes$1(HEAVY_PAGE_BYTES)}: every visitor downloads it before the page is theirs.` + (named.length > 0 ? ` Written again most: ${named.join(", ")}.` : " No shape repeats in it: its parts are each written once."),
|
|
26446
|
+
message: `Page "${page}" is ${kilobytes$1(bytes)} of document, past ${kilobytes$1(HEAVY_PAGE_BYTES)}: every visitor downloads it before the page is theirs — ${atVolume(bytes)} for every 10,000 visits, before compression.` + (named.length > 0 ? ` Written again most: ${named.join(", ")}.` : " No shape repeats in it: its parts are each written once."),
|
|
26292
26447
|
elementIds: [page, ...weighed.map((shape) => shape.copies[0])],
|
|
26293
26448
|
saves: weighed.reduce((sum, shape) => sum + (shape.copies.length - 1) * (signatures.get(shape.copies[0])?.size ?? 0), 0)
|
|
26294
26449
|
}];
|
|
26295
26450
|
});
|
|
26296
26451
|
};
|
|
26452
|
+
/**
|
|
26453
|
+
* A layout whose own part of the document is heavy: every page drawn in it downloads it — the first a visitor opens, at
|
|
26454
|
+
* least — whatever the page itself weighs.
|
|
26455
|
+
*/
|
|
26456
|
+
var suggestHeavyLayouts = (schema) => {
|
|
26457
|
+
const { flat } = schema;
|
|
26458
|
+
const users = /* @__PURE__ */ new Map();
|
|
26459
|
+
schema.pages.forEach((page) => i$41(flat, page).forEach((layout) => users.set(layout, (users.get(layout) ?? 0) + 1)));
|
|
26460
|
+
return [...users.entries()].flatMap(([layout, pages]) => {
|
|
26461
|
+
const bytes = subtreeOf(flat, layout).reduce((sum, id) => sum + JSON.stringify(flat[id]).length, 0);
|
|
26462
|
+
if (bytes <= 25e4) return [];
|
|
26463
|
+
return [{
|
|
26464
|
+
code: "heavy-layout",
|
|
26465
|
+
message: `Layout "${layout}" is ${kilobytes$1(bytes)} of document, past ${kilobytes$1(HEAVY_PAGE_BYTES)}: each of its ${count(pages)} ${pages === 1 ? "page" : "pages"} is downloaded with it — ${atVolume(bytes)} for every 10,000 first visits, before compression. What only some of its pages show belongs in those pages (or a component they place), not in the shell all of them carry.`,
|
|
26466
|
+
elementIds: [layout],
|
|
26467
|
+
saves: 0
|
|
26468
|
+
}];
|
|
26469
|
+
});
|
|
26470
|
+
};
|
|
26471
|
+
/**
|
|
26472
|
+
* Past this many elements built as a page opens — its own, its layouts', its components' — a phone spends longer
|
|
26473
|
+
* building and laying out the page than downloading it: Lighthouse flags a page past about 1,400. Generous on purpose:
|
|
26474
|
+
* a rich page is a choice, and this only names the ones far past what a visitor's device handles well.
|
|
26475
|
+
*/
|
|
26476
|
+
var MANY_ELEMENTS = 1500;
|
|
26477
|
+
var textOf = (value) => typeof value === "string" ? value : "";
|
|
26478
|
+
/** Starts hidden and is built only when shown (`loadStrategy` `lazy` or `visible`): nothing of it is built as the page opens. */
|
|
26479
|
+
var deferred = (element) => element.definition.initialState?.visibility === false && (element.definition.loadStrategy === "lazy" || element.definition.loadStrategy === "visible");
|
|
26480
|
+
/** Shown or hidden by a condition (`visible: { source, template }`, a visibility binding): it may be on screen at once. */
|
|
26481
|
+
var conditional = (element) => (element.definition.bindings?.initialState ?? []).some((binding) => binding.to === "visibility");
|
|
26482
|
+
/**
|
|
26483
|
+
* Hidden until something shows it — `visible: false`, no condition: a panel or a dialog a click opens — and built as the
|
|
26484
|
+
* page opens all the same (`eager`, the default). One hidden by a condition is not named: the condition may hold on the
|
|
26485
|
+
* first paint (a board's workspace, shown once its board is read on the server), and deferring it saves nothing.
|
|
26486
|
+
*/
|
|
26487
|
+
var hiddenEager = (element) => element.definition.initialState?.visibility === false && !conditional(element) && !deferred(element) && (element.definition.items ?? []).length > 0;
|
|
26488
|
+
/**
|
|
26489
|
+
* The elements a root builds as a page opens: each one under it, a component's every element once per instance placed,
|
|
26490
|
+
* an element a `reference` copies with what is under it — but nothing under one that starts hidden and waits to be
|
|
26491
|
+
* shown to be built. A `list` is counted once: how many rows it draws is the data's, not the document's.
|
|
26492
|
+
*/
|
|
26493
|
+
var builtUnder = (schema, flat, root, seen = /* @__PURE__ */ new Set()) => {
|
|
26494
|
+
const built = {
|
|
26495
|
+
total: 0,
|
|
26496
|
+
hiddenEager: []
|
|
26497
|
+
};
|
|
26498
|
+
const walk = (id, within, path) => {
|
|
26499
|
+
const element = within[id];
|
|
26500
|
+
if (!element) return 0;
|
|
26501
|
+
if (deferred(element)) return 1;
|
|
26502
|
+
let total = 1;
|
|
26503
|
+
const referenceId = textOf(element.attributes.referenceId);
|
|
26504
|
+
if (element.definition.type === "reference" && referenceId && !path.has(referenceId)) {
|
|
26505
|
+
const component = element.attributes.referenceType === "component" ? schema.components[referenceId] : void 0;
|
|
26506
|
+
const deeper = /* @__PURE__ */ new Set([...path, referenceId]);
|
|
26507
|
+
total += component ? walk(component.rootId, component.flat, deeper) : walk(referenceId, flat, deeper);
|
|
26508
|
+
}
|
|
26509
|
+
const children = (element.definition.items ?? []).reduce((sum, item) => sum + walk(item, within, path), 0);
|
|
26510
|
+
total += children;
|
|
26511
|
+
if (within === flat && hiddenEager(element) && children > 0) built.hiddenEager.push({
|
|
26512
|
+
id,
|
|
26513
|
+
elements: children
|
|
26514
|
+
});
|
|
26515
|
+
return total;
|
|
26516
|
+
};
|
|
26517
|
+
built.total = walk(root, flat, seen);
|
|
26518
|
+
return built;
|
|
26519
|
+
};
|
|
26520
|
+
/**
|
|
26521
|
+
* A page that builds more elements as it opens than a phone handles well: how many, where they are, what a visit
|
|
26522
|
+
* downloads for them — and, for those that start hidden and are built all the same, the one change that defers them.
|
|
26523
|
+
*/
|
|
26524
|
+
var suggestManyElements = (schema) => {
|
|
26525
|
+
const { flat } = schema;
|
|
26526
|
+
return schema.pages.flatMap((page) => {
|
|
26527
|
+
const own = builtUnder(schema, flat, page);
|
|
26528
|
+
const layouts = i$41(flat, page).map((layout) => ({
|
|
26529
|
+
layout,
|
|
26530
|
+
built: builtUnder(schema, flat, layout)
|
|
26531
|
+
}));
|
|
26532
|
+
const total = own.total + layouts.reduce((sum, each) => sum + each.built.total, 0);
|
|
26533
|
+
if (total <= 1500) return [];
|
|
26534
|
+
const bytes = [page, ...layouts.map((each) => each.layout)].reduce((sum, root) => sum + subtreeOf(flat, root).reduce((all, id) => all + JSON.stringify(flat[id]).length, 0), 0);
|
|
26535
|
+
const hidden = [...own.hiddenEager, ...layouts.flatMap((each) => each.built.hiddenEager)].sort((a, b) => b.elements - a.elements).slice(0, 3);
|
|
26536
|
+
const shells = layouts.filter((each) => each.built.total > 0).map((each) => `${count(each.built.total)} of layout "${each.layout}"`);
|
|
26537
|
+
return [{
|
|
26538
|
+
code: "many-elements",
|
|
26539
|
+
message: `Page "${page}" builds ${count(total)} elements as it opens${shells.length > 0 ? ` (${count(own.total)} of its own, ${shells.join(", ")})` : ""}, past ${count(MANY_ELEMENTS)}: a phone builds, styles and lays out every one before the page answers, and a list adds its rows on top. A visit downloads ${kilobytes$1(bytes)} of document for them — ${atVolume(bytes)} for every 10,000 visits, before compression.` + (hidden.length > 0 ? ` Built though they start hidden: ${hidden.map((each) => `"${each.id}" (${count(each.elements)})`).join(", ")} — \`loadStrategy: 'lazy'\` builds each the first time it is shown.` : ""),
|
|
26540
|
+
elementIds: [page, ...hidden.map((each) => each.id)],
|
|
26541
|
+
saves: 0
|
|
26542
|
+
}];
|
|
26543
|
+
});
|
|
26544
|
+
};
|
|
26297
26545
|
// src/schema/advice/landmarks.ts
|
|
26298
26546
|
/** Drawn as `main`: a container, a provider — whatever element takes its tag from `subType`. */
|
|
26299
26547
|
var isMain = (element) => element.attributes.subType === "main";
|
|
@@ -26437,11 +26685,11 @@ var ruleSetsOf = (layer, within = "") => [
|
|
|
26437
26685
|
];
|
|
26438
26686
|
/** The animations the style schema starts — its classes, ids and element styles, at every breakpoint. */
|
|
26439
26687
|
/** Every element of the pages and the components, each with the classes it wears in any of its slots. */
|
|
26440
|
-
var elementsOf = (schema) => [schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat));
|
|
26688
|
+
var elementsOf$1 = (schema) => [schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat));
|
|
26441
26689
|
/** Who wears a style item: a class, the elements naming it in a slot; an element's own (`id`), that element. */
|
|
26442
26690
|
var wearersOf = (schema) => {
|
|
26443
26691
|
const byClass = /* @__PURE__ */ new Map();
|
|
26444
|
-
for (const element of elementsOf(schema)) for (const selector of Object.values(element.definition.styleSelectors)) for (const name of selector.split(/\s+/).filter(Boolean)) byClass.set(name, [...byClass.get(name) ?? [], element.id]);
|
|
26692
|
+
for (const element of elementsOf$1(schema)) for (const selector of Object.values(element.definition.styleSelectors)) for (const name of selector.split(/\s+/).filter(Boolean)) byClass.set(name, [...byClass.get(name) ?? [], element.id]);
|
|
26445
26693
|
return (item) => item.type === "class" ? byClass.get(item.name) ?? [] : item.type === "id" ? [item.name] : void 0;
|
|
26446
26694
|
};
|
|
26447
26695
|
var styleUsesIn = (style, keyframes, schema) => {
|
|
@@ -26480,7 +26728,7 @@ var suggestMotion = (schema, style) => {
|
|
|
26480
26728
|
const keyframes = keyframesIn(segments, /* @__PURE__ */ new Map());
|
|
26481
26729
|
if (keyframes.size === 0) return [];
|
|
26482
26730
|
const { uses: written, hydratedGate } = cssUsesIn(segments, keyframes);
|
|
26483
|
-
const quiet = new Set(elementsOf(schema).filter((element) => element.definition.quiet?.includes("heavy-animation") === true).map((element) => element.id));
|
|
26731
|
+
const quiet = new Set(elementsOf$1(schema).filter((element) => element.definition.quiet?.includes("heavy-animation") === true).map((element) => element.id));
|
|
26484
26732
|
const uses = [...written, ...styleUsesIn(style, keyframes, schema)].flatMap((use) => {
|
|
26485
26733
|
if (use.wearers === void 0 || use.wearers.length === 0) return [use];
|
|
26486
26734
|
const loud = use.wearers.filter((id) => !quiet.has(id));
|
|
@@ -26522,11 +26770,11 @@ var suggestMotion = (schema, style) => {
|
|
|
26522
26770
|
* registered by name with no declaration.
|
|
26523
26771
|
*/
|
|
26524
26772
|
var suggestPluginHosts = (schema, pluginTypes) => {
|
|
26525
|
-
const declared = new Set(pluginTypes.filter((type) => type
|
|
26773
|
+
const declared = new Set(pluginTypes.filter((type) => hostedComponentOf(type) !== void 0));
|
|
26526
26774
|
if (declared.size === 0) return [];
|
|
26527
26775
|
return [schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat)).flatMap((element) => {
|
|
26528
|
-
const type = textOf$
|
|
26529
|
-
if (element.definition.type !== "custom" || !declared.has(
|
|
26776
|
+
const type = textOf$3(element.attributes.renderType);
|
|
26777
|
+
if (element.definition.type !== "custom" || !declared.has(hostedType(type))) return [];
|
|
26530
26778
|
return [{
|
|
26531
26779
|
code: "plugin-custom-host",
|
|
26532
26780
|
message: `"${element.id}" places the plugin "${type}" by name, with \`custom({ renderType: '${type}' })\`: place it from its declaration — \`const ${type} = defineElement(declaration)\`, then \`${type}({ id: '${element.id}', … })\` — typed by what it declares, as the builder adds it.`,
|
|
@@ -26540,9 +26788,9 @@ var suggestPluginHosts = (schema, pluginTypes) => {
|
|
|
26540
26788
|
* border light lost its only placement to another task, and author, lint, doctor and every check said nothing.
|
|
26541
26789
|
*/
|
|
26542
26790
|
var suggestUnusedPlugins = (schema, pluginTypes) => {
|
|
26543
|
-
const declared = pluginTypes.flatMap((type) =>
|
|
26791
|
+
const declared = pluginTypes.flatMap((type) => hostedComponentOf(type) ?? []);
|
|
26544
26792
|
if (declared.length === 0) return [];
|
|
26545
|
-
const placed = new Set([schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat)).map((element) => element.definition.type === "custom" ? textOf$
|
|
26793
|
+
const placed = new Set([schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat)).map((element) => element.definition.type === "custom" ? textOf$3(element.attributes.renderType) : element.definition.type));
|
|
26546
26794
|
const unused = declared.filter((type) => !placed.has(type)).sort();
|
|
26547
26795
|
return unused.length === 0 ? [] : [{
|
|
26548
26796
|
code: "unused-plugin",
|
|
@@ -26604,6 +26852,228 @@ var suggestRepeatedExpressions = (schema) => {
|
|
|
26604
26852
|
saves: 0
|
|
26605
26853
|
}));
|
|
26606
26854
|
};
|
|
26855
|
+
// src/schema/advice/responsive.ts
|
|
26856
|
+
/**
|
|
26857
|
+
* A page styled for the desktop alone where a phone breaks: a width wider than the phone, a grid of three or more
|
|
26858
|
+
* columns of fixed tracks, a type size a phone's line holds two words of — written at the desktop, and set again by no
|
|
26859
|
+
* `mobile` rule of the classes that carry it (a style's `mobile` is laid over its `desktop` alone, so a `tablet` rule
|
|
26860
|
+
* does not reach a phone).
|
|
26861
|
+
*
|
|
26862
|
+
* Not "no media query": a layout that is fluid on its own — wrapping flex, widths in `%`, `min()` and `clamp()`,
|
|
26863
|
+
* `repeat(auto-fit, minmax(…))` — is responsive without one, and is never named. Only a space written desktop first
|
|
26864
|
+
* (the default): written mobile first, its base is the phone's.
|
|
26865
|
+
*/
|
|
26866
|
+
/** A phone's width, the one the platform's checks draw a page at. */
|
|
26867
|
+
var PHONE_PX = 390;
|
|
26868
|
+
/** What a phone leaves a page's content: its width less a gutter each side. */
|
|
26869
|
+
var PHONE_CONTENT_PX = 358;
|
|
26870
|
+
/** Past this a width overflows a phone, or a tablet held upright, whatever the padding around it. */
|
|
26871
|
+
var WIDE_PX = 480;
|
|
26872
|
+
/** Past this a heading on a phone holds a word or two a line, and a long one breaks a word; a price of 56 px fits. */
|
|
26873
|
+
var LARGE_TYPE_PX = 64;
|
|
26874
|
+
/** A column a phone squeezes below this holds a card's words a few letters a line. */
|
|
26875
|
+
var NARROW_COLUMN_PX = 120;
|
|
26876
|
+
/** From this gap a grid lays out a page's parts — cards, footer columns — not a dense widget (a chart, a tray). */
|
|
26877
|
+
var LAYOUT_GAP_PX = 16;
|
|
26878
|
+
var ROOT_PX = 16;
|
|
26879
|
+
/** A plain length in px — `960px`, `60rem` — or `undefined` for anything fluid or computed. */
|
|
26880
|
+
var pixels$1 = (value) => {
|
|
26881
|
+
if (typeof value === "number") return value;
|
|
26882
|
+
const match = /^\s*(-?\d+(?:\.\d+)?)(px|rem|em)\s*$/.exec(value ?? "");
|
|
26883
|
+
if (!match) return;
|
|
26884
|
+
const size = Number(match[1]);
|
|
26885
|
+
return match[2] === "px" ? size : size * ROOT_PX;
|
|
26886
|
+
};
|
|
26887
|
+
/** The top-level parts of a value, split at the spaces outside any parentheses: `minmax(0, 1fr)` is one. */
|
|
26888
|
+
var topLevel = (text) => {
|
|
26889
|
+
const parts = [];
|
|
26890
|
+
let depth = 0;
|
|
26891
|
+
let current = "";
|
|
26892
|
+
for (const char of text) {
|
|
26893
|
+
depth += char === "(" ? 1 : char === ")" ? -1 : 0;
|
|
26894
|
+
if (/\s/.test(char) && depth === 0) {
|
|
26895
|
+
if (current !== "") parts.push(current);
|
|
26896
|
+
current = "";
|
|
26897
|
+
} else current += char;
|
|
26898
|
+
}
|
|
26899
|
+
return current === "" ? parts : [...parts, current];
|
|
26900
|
+
};
|
|
26901
|
+
/** A grid's tracks with `repeat(n, …)` written out; `undefined` for one that fits its tracks to the width (`auto-fit`). */
|
|
26902
|
+
var tracksOf = (value) => {
|
|
26903
|
+
const text = String(value ?? "").trim();
|
|
26904
|
+
if (text === "" || /auto-fit|auto-fill/.test(text)) return;
|
|
26905
|
+
return topLevel(text).flatMap((part) => {
|
|
26906
|
+
const repeated = /^repeat\(\s*(\d+)\s*,(.*)\)$/.exec(part);
|
|
26907
|
+
return repeated ? Array.from({ length: Number(repeated[1]) }, () => topLevel(repeated[2])).flat() : [part];
|
|
26908
|
+
});
|
|
26909
|
+
};
|
|
26910
|
+
/** One track: what it takes at least (`px`, a `minmax` floor), and the share of what is left it grows by (`fr`). */
|
|
26911
|
+
var trackOf = (track) => {
|
|
26912
|
+
const minmax = /^minmax\(\s*([^,]+),\s*(.+)\)$/.exec(track);
|
|
26913
|
+
const floor = pixels$1(minmax ? minmax[1] : track) ?? 0;
|
|
26914
|
+
const grows = /^(\d+(?:\.\d+)?)fr$/.exec((minmax ? minmax[2] : track).trim());
|
|
26915
|
+
return {
|
|
26916
|
+
floor,
|
|
26917
|
+
share: grows ? Number(grows[1]) : 0
|
|
26918
|
+
};
|
|
26919
|
+
};
|
|
26920
|
+
/**
|
|
26921
|
+
* What a grid does to a phone, in words, or nothing: its floors and gaps wider than a phone's content — or three or
|
|
26922
|
+
* more columns sharing the width, laid out a page's parts apart (`LAYOUT_GAP_PX`), each left narrower than a card reads
|
|
26923
|
+
* at. A row whose one growing column takes what fixed ones leave (`48px 1fr auto`) fits, and a dense widget's many thin
|
|
26924
|
+
* columns (a chart's bars, an emoji tray) are what it means to draw.
|
|
26925
|
+
*/
|
|
26926
|
+
var gridRisk = (rules) => {
|
|
26927
|
+
const read = (property) => rules[property];
|
|
26928
|
+
const tracks = tracksOf(read("grid-template-columns"));
|
|
26929
|
+
if (!tracks || tracks.length < 2) return;
|
|
26930
|
+
const gap = pixels$1(read("column-gap")) ?? pixels$1(topLevel(String(read("gap") ?? ""))[1] ?? read("gap")) ?? 0;
|
|
26931
|
+
const gaps = gap * (tracks.length - 1);
|
|
26932
|
+
const parsed = tracks.map(trackOf);
|
|
26933
|
+
const floors = parsed.reduce((sum, track) => sum + track.floor, 0);
|
|
26934
|
+
if (floors + gaps > PHONE_CONTENT_PX) return `${String(tracks.length)} columns at least ${String(Math.round(floors + gaps))}px wide`;
|
|
26935
|
+
const sharing = parsed.filter((track) => track.share > 0);
|
|
26936
|
+
const shares = sharing.reduce((sum, track) => sum + track.share, 0);
|
|
26937
|
+
if (sharing.length < 3 || gap < LAYOUT_GAP_PX || shares === 0) return;
|
|
26938
|
+
const narrowest = Math.min(...sharing.map((track) => track.floor + (PHONE_CONTENT_PX - floors - gaps) / shares * track.share));
|
|
26939
|
+
return narrowest < NARROW_COLUMN_PX ? `${String(tracks.length)} columns, about ${String(Math.max(0, Math.round(narrowest)))}px each on a phone` : void 0;
|
|
26940
|
+
};
|
|
26941
|
+
/** What of one class's desktop rules breaks on a phone, in words: `width 960px`, `4 columns`. */
|
|
26942
|
+
var risksOf = (rules) => {
|
|
26943
|
+
const risks = [];
|
|
26944
|
+
const read = (property) => rules[property];
|
|
26945
|
+
const capped = /%|vw/.test(String(read("max-width") ?? "")) || (pixels$1(read("max-width")) ?? Infinity) <= PHONE_PX;
|
|
26946
|
+
for (const property of ["width", "min-width"]) {
|
|
26947
|
+
const size = pixels$1(read(property));
|
|
26948
|
+
if (size !== void 0 && size >= WIDE_PX && (property === "min-width" || !capped)) risks.push({
|
|
26949
|
+
property,
|
|
26950
|
+
value: read(property) ?? "",
|
|
26951
|
+
says: `${property} ${String(read(property))}`
|
|
26952
|
+
});
|
|
26953
|
+
}
|
|
26954
|
+
const grid = gridRisk(rules);
|
|
26955
|
+
if (grid !== void 0) risks.push({
|
|
26956
|
+
property: "grid-template-columns",
|
|
26957
|
+
value: read("grid-template-columns") ?? "",
|
|
26958
|
+
says: grid
|
|
26959
|
+
});
|
|
26960
|
+
const type = pixels$1(read("font-size"));
|
|
26961
|
+
if (type !== void 0 && type >= LARGE_TYPE_PX) risks.push({
|
|
26962
|
+
property: "font-size",
|
|
26963
|
+
value: read("font-size") ?? "",
|
|
26964
|
+
says: `font-size ${String(read("font-size"))}`
|
|
26965
|
+
});
|
|
26966
|
+
return risks;
|
|
26967
|
+
};
|
|
26968
|
+
/** The classes each part of an element wears: every name of its `styleSelectors`. */
|
|
26969
|
+
var wornBy = (element) => Object.values(element.definition.styleSelectors).map((names) => names.split(/\s+/).filter(Boolean));
|
|
26970
|
+
/** The risks that are a box's width — what a parent that clips or scrolls sideways keeps off the page. */
|
|
26971
|
+
var WIDTHS$1 = [
|
|
26972
|
+
"width",
|
|
26973
|
+
"min-width",
|
|
26974
|
+
"grid-template-columns"
|
|
26975
|
+
];
|
|
26976
|
+
/** A class's own rules at one width — none when the class says nothing there, which a width's map leaves out. */
|
|
26977
|
+
var rulesAt = (rules, className) => Object.hasOwn(rules, className) && Object.hasOwn(rules[className].attributes, "base") ? rules[className].attributes.base.default : void 0;
|
|
26978
|
+
/** What breaks on a phone under one root, by the class that says it: once per class, with the elements wearing it. */
|
|
26979
|
+
var findingsUnder = (flat, root, style) => {
|
|
26980
|
+
const desktop = style.platform.desktop;
|
|
26981
|
+
const mobile = style.platform.mobile;
|
|
26982
|
+
const byClass = /* @__PURE__ */ new Map();
|
|
26983
|
+
const fittedOnPhone = (element) => wornBy(element).some((classes) => classes.some((name) => {
|
|
26984
|
+
const rules = rulesAt(mobile, name);
|
|
26985
|
+
const scale = /scale\(\s*(\d*\.?\d+)/.exec(String(rules?.transform ?? ""));
|
|
26986
|
+
return rules?.display === "none" || scale !== null && Number(scale[1]) < 1;
|
|
26987
|
+
}));
|
|
26988
|
+
const holdsSideways = (element) => wornBy(element).some((classes) => classes.some((name) => [rulesAt(desktop, name), rulesAt(mobile, name)].some((rules) => {
|
|
26989
|
+
const read = (property) => rules && Object.hasOwn(rules, property) ? String(rules[property]) : void 0;
|
|
26990
|
+
const sideways = read("overflow-x") ?? topLevel(read("overflow") ?? "")[0];
|
|
26991
|
+
return [
|
|
26992
|
+
"hidden",
|
|
26993
|
+
"clip",
|
|
26994
|
+
"auto",
|
|
26995
|
+
"scroll"
|
|
26996
|
+
].includes(sideways);
|
|
26997
|
+
})));
|
|
26998
|
+
const drawn = [];
|
|
26999
|
+
const stack = [{
|
|
27000
|
+
id: root,
|
|
27001
|
+
held: false
|
|
27002
|
+
}];
|
|
27003
|
+
while (stack.length > 0) {
|
|
27004
|
+
const next = stack.pop();
|
|
27005
|
+
const element = next === void 0 ? void 0 : flat[next.id];
|
|
27006
|
+
if (!next || !element || fittedOnPhone(element)) continue;
|
|
27007
|
+
drawn.push({
|
|
27008
|
+
element,
|
|
27009
|
+
held: next.held
|
|
27010
|
+
});
|
|
27011
|
+
const held = next.held || holdsSideways(element);
|
|
27012
|
+
stack.push(...[...element.definition.items ?? []].reverse().map((id) => ({
|
|
27013
|
+
id,
|
|
27014
|
+
held
|
|
27015
|
+
})));
|
|
27016
|
+
}
|
|
27017
|
+
for (const { element, held } of drawn) for (const classes of wornBy(element)) {
|
|
27018
|
+
const fixed = new Set(classes.flatMap((name) => Object.keys(rulesAt(mobile, name) ?? {})));
|
|
27019
|
+
if (classes.some((name) => !String(rulesAt(mobile, name)?.display ?? "grid").endsWith("grid"))) fixed.add("grid-template-columns");
|
|
27020
|
+
for (const className of classes) {
|
|
27021
|
+
const rules = rulesAt(desktop, className);
|
|
27022
|
+
if (!rules) continue;
|
|
27023
|
+
const open = risksOf(rules).filter((risk) => !fixed.has(risk.property) && !(held && WIDTHS$1.includes(risk.property)));
|
|
27024
|
+
if (open.length === 0) continue;
|
|
27025
|
+
const finding = byClass.get(className) ?? {
|
|
27026
|
+
className,
|
|
27027
|
+
says: open.map((risk) => risk.says).join(", "),
|
|
27028
|
+
elements: []
|
|
27029
|
+
};
|
|
27030
|
+
finding.elements.push(element.id);
|
|
27031
|
+
byClass.set(className, finding);
|
|
27032
|
+
}
|
|
27033
|
+
}
|
|
27034
|
+
return [...byClass.values()];
|
|
27035
|
+
};
|
|
27036
|
+
/** Most findings named in one suggestion: the rest are the same advice. */
|
|
27037
|
+
var NAMED = 4;
|
|
27038
|
+
/**
|
|
27039
|
+
* The pages, layouts and components styled for the desktop alone in what breaks on a phone — one suggestion each, naming
|
|
27040
|
+
* the classes and what of each to set again for a phone.
|
|
27041
|
+
*/
|
|
27042
|
+
var suggestResponsive = (schema, style) => {
|
|
27043
|
+
if (style.mode === "mobile-first") return [];
|
|
27044
|
+
return [
|
|
27045
|
+
...schema.pages.map((id) => ({
|
|
27046
|
+
kind: "Page",
|
|
27047
|
+
id,
|
|
27048
|
+
flat: schema.flat,
|
|
27049
|
+
root: id
|
|
27050
|
+
})),
|
|
27051
|
+
...[...new Set(schema.pages.flatMap((page) => i$41(schema.flat, page)))].map((id) => ({
|
|
27052
|
+
kind: "Layout",
|
|
27053
|
+
id,
|
|
27054
|
+
flat: schema.flat,
|
|
27055
|
+
root: id
|
|
27056
|
+
})),
|
|
27057
|
+
...Object.values(schema.components).map((component) => ({
|
|
27058
|
+
kind: "Component",
|
|
27059
|
+
id: component.id,
|
|
27060
|
+
flat: component.flat,
|
|
27061
|
+
root: component.rootId
|
|
27062
|
+
}))
|
|
27063
|
+
].flatMap(({ kind, id, flat, root }) => {
|
|
27064
|
+
const findings = findingsUnder(flat, root, style);
|
|
27065
|
+
if (findings.length === 0) return [];
|
|
27066
|
+
const named = findings.slice(0, NAMED).map((finding) => `class "${finding.className}" ${finding.says} (${finding.elements.length === 1 ? `"${finding.elements[0]}"` : `${String(finding.elements.length)} elements`})`);
|
|
27067
|
+
const more = findings.length > NAMED ? `, and ${String(findings.length - NAMED)} more` : "";
|
|
27068
|
+
return [{
|
|
27069
|
+
code: "desktop-only",
|
|
27070
|
+
message: `${kind} "${id}" is styled for the desktop alone where a phone (${String(PHONE_PX)} px) breaks: ${named.join("; ")}${more}. No \`mobile\` rule sets them again, so a phone draws the desktop’s — a \`tablet\` rule does not reach it.`,
|
|
27071
|
+
elementIds: [root, ...findings.slice(0, NAMED).map((finding) => finding.elements[0])],
|
|
27072
|
+
saves: 0,
|
|
27073
|
+
subjects: findings.map((finding) => finding.className)
|
|
27074
|
+
}];
|
|
27075
|
+
});
|
|
27076
|
+
};
|
|
26607
27077
|
// src/schema/advice/classOverrides.ts
|
|
26608
27078
|
/** Which breakpoints' rules apply at each width, in the order the stylesheet writes them (`generateCache`). */
|
|
26609
27079
|
var CASCADE = {
|
|
@@ -26750,12 +27220,14 @@ var suggestClassOverrides = (lists, mode) => {
|
|
|
26750
27220
|
}));
|
|
26751
27221
|
};
|
|
26752
27222
|
// src/schema/advice/index.ts
|
|
27223
|
+
/** Every element of the pages' tree and of each component's. */
|
|
27224
|
+
var elementsOf = (schema) => [schema.flat, ...Object.values(schema.components).map((component) => component.flat)].flatMap((flat) => Object.values(flat));
|
|
26753
27225
|
/**
|
|
26754
27226
|
* What each element quiets (`definition.quiet`): a suggestion about an element written that way on purpose is left
|
|
26755
27227
|
* out — here, so authoring, the builder's list and the MCP leave out the same ones. The pages' tree and every
|
|
26756
27228
|
* component's.
|
|
26757
27229
|
*/
|
|
26758
|
-
var quietCodes = (schema) => new Map(
|
|
27230
|
+
var quietCodes = (schema) => new Map(elementsOf(schema).flatMap((element) => element.definition.quiet ? [[element.id, element.definition.quiet]] : []));
|
|
26759
27231
|
/**
|
|
26760
27232
|
* A shorter way to the same page: what a space's documents could say with fewer elements or less CSS — or, for its
|
|
26761
27233
|
* animations, a lighter one, and for its headings, an outline a screen reader reads whole.
|
|
@@ -26781,12 +27253,25 @@ var suggestSpace = ({ schema, style }, { stylesheets = [], families = [], plugin
|
|
|
26781
27253
|
...suggestHeadingOrder(schema),
|
|
26782
27254
|
...suggestMain(schema),
|
|
26783
27255
|
...suggestHeavyPages(schema, style),
|
|
27256
|
+
...suggestHeavyLayouts(schema),
|
|
27257
|
+
...suggestManyElements(schema),
|
|
27258
|
+
...suggestResponsive(schema, style),
|
|
26784
27259
|
...suggestRepeatedExpressions(schema)
|
|
26785
27260
|
]).sort((a, b) => b.saves - a.saves);
|
|
26786
|
-
/**
|
|
27261
|
+
/**
|
|
27262
|
+
* The suggestions no element they are about quiets — for those read beside the documents, too (authoring's own). Nor
|
|
27263
|
+
* the one element all of them sit in: copies side by side are said alike on purpose once, on the row that holds them
|
|
27264
|
+
* (`quiet` on a plan picker's options, not on each plan's card).
|
|
27265
|
+
*/
|
|
26787
27266
|
var withoutQuieted = (schema, suggestions) => {
|
|
26788
27267
|
const quiets = quietCodes(schema);
|
|
26789
|
-
|
|
27268
|
+
const parents = new Map(elementsOf(schema).map((element) => [element.id, element.definition.parentId]));
|
|
27269
|
+
const holder = (ids) => {
|
|
27270
|
+
const held = new Set(ids.map((id) => parents.get(id)));
|
|
27271
|
+
const [parent] = held;
|
|
27272
|
+
return held.size === 1 && parent !== void 0 ? [parent] : [];
|
|
27273
|
+
};
|
|
27274
|
+
return suggestions.filter((suggestion) => ![...suggestion.elementIds, ...holder(suggestion.elementIds)].some((id) => quiets.get(id)?.includes(suggestion.code) === true));
|
|
26790
27275
|
};
|
|
26791
27276
|
// src/schema/keyframes.ts
|
|
26792
27277
|
var frameOf = (name, selector, rules) => {
|
|
@@ -27030,29 +27515,18 @@ var stateKeyList = (author, setting, example, does) => {
|
|
|
27030
27515
|
});
|
|
27031
27516
|
};
|
|
27032
27517
|
/**
|
|
27033
|
-
* The keys a space never keeps.
|
|
27034
|
-
*
|
|
27518
|
+
* The keys a space never keeps, held to be names. That it does nothing without `keepState` is the linter's to say
|
|
27519
|
+
* (`lintKeptState`), so the builder says it too.
|
|
27035
27520
|
*/
|
|
27036
27521
|
var assertTransientState = (author) => {
|
|
27037
|
-
|
|
27038
|
-
if (transient.length > 0 && author.spec.settings?.keepState !== true) author.styleWarnings.push({
|
|
27039
|
-
code: "transient-state-without-keep-state",
|
|
27040
|
-
message: "`settings.transientState` names keys never to keep, but `settings.keepState` is not on — nothing is kept in the first place, so it does nothing. Turn `keepState` on, or remove `transientState`.",
|
|
27041
|
-
details: { keys: transient }
|
|
27042
|
-
});
|
|
27522
|
+
stateKeyList(author, "transientState", ["demoStep", "panelOpen"], "never to keep");
|
|
27043
27523
|
};
|
|
27044
27524
|
/**
|
|
27045
27525
|
* The only keys a space keeps. Refused beside `transientState`: one names what is kept, the other what is not, and a
|
|
27046
|
-
* key in neither would be kept by one and not by the other.
|
|
27526
|
+
* key in neither would be kept by one and not by the other. Without `keepState`, the linter says it (`lintKeptState`).
|
|
27047
27527
|
*/
|
|
27048
27528
|
var assertKeptState = (author) => {
|
|
27049
|
-
|
|
27050
|
-
if (kept.length > 0 && (author.spec.settings?.transientState ?? []).length > 0) throw new AuthoringError("state-kept-and-transient", "`settings.keptState` names the only keys kept, and `settings.transientState` the keys left out — say one of the two: `keptState` when few are kept, `transientState` when few are not.");
|
|
27051
|
-
if (kept.length > 0 && author.spec.settings?.keepState !== true) author.styleWarnings.push({
|
|
27052
|
-
code: "kept-state-without-keep-state",
|
|
27053
|
-
message: "`settings.keptState` names the keys to keep, but `settings.keepState` is not on — nothing is kept, so it does nothing. Turn `keepState` on, or remove `keptState`.",
|
|
27054
|
-
details: { keys: kept }
|
|
27055
|
-
});
|
|
27529
|
+
if (stateKeyList(author, "keptState", ["dismissedNotice"], "to keep, and only those").length > 0 && (author.spec.settings?.transientState ?? []).length > 0) throw new AuthoringError("state-kept-and-transient", "`settings.keptState` names the only keys kept, and `settings.transientState` the keys left out — say one of the two: `keptState` when few are kept, `transientState` when few are not.");
|
|
27056
27530
|
};
|
|
27057
27531
|
/**
|
|
27058
27532
|
* The kept keys the first paint depends on, which the server renders with (see `paintedState.ts` in sdk-shared).
|
|
@@ -27069,11 +27543,6 @@ var assertPaintedState = (author) => {
|
|
|
27069
27543
|
const kept = author.spec.settings?.keptState ?? [];
|
|
27070
27544
|
const unkept = kept.length > 0 ? painted.filter((key) => !kept.includes(key)) : [];
|
|
27071
27545
|
if (unkept.length > 0) throw new AuthoringError("state-painted-not-kept", `\`settings.paintedState\` names ${unkept.map((key) => `"${key}"`).join(", ")}, which \`settings.keptState\` does not keep — a painted key is kept, so the server can draw with it. Add ${unkept.length === 1 ? "it" : "them"} to \`keptState\`, or leave ${unkept.length === 1 ? "it" : "them"} out of \`paintedState\`.`);
|
|
27072
|
-
if (painted.length > 0 && author.spec.settings?.keepState !== true) author.styleWarnings.push({
|
|
27073
|
-
code: "painted-state-without-keep-state",
|
|
27074
|
-
message: "`settings.paintedState` names kept keys for the server to draw with, but `settings.keepState` is not on — nothing is kept, so there is nothing to draw with. Turn `keepState` on, or remove `paintedState`.",
|
|
27075
|
-
details: { keys: painted }
|
|
27076
|
-
});
|
|
27077
27546
|
};
|
|
27078
27547
|
/**
|
|
27079
27548
|
* The kept keys that are the browser's rather than whoever is signed in (see `browserKeys` in sdk-shared): kept in an
|
|
@@ -27091,11 +27560,6 @@ var assertBrowserState = (author) => {
|
|
|
27091
27560
|
const them = unkept.length === 1 ? "it" : "them";
|
|
27092
27561
|
throw new AuthoringError("state-browser-not-kept", `\`settings.browserState\` names ${unkept.map((key) => `"${key}"`).join(", ")}, which the space does not keep (\`transientState\` leaves ${them} out, or \`keptState\` does not name ${them}) — a key of the browser's is a kept one that no change of account takes away. Keep ${them}, or leave ${them} out of \`browserState\`.`);
|
|
27093
27562
|
}
|
|
27094
|
-
if (browser.length > 0 && author.spec.settings?.keepState !== true) author.styleWarnings.push({
|
|
27095
|
-
code: "browser-state-without-keep-state",
|
|
27096
|
-
message: "`settings.browserState` names kept keys the browser keeps whoever signs in, but `settings.keepState` is not on — nothing is kept, so it does nothing. Turn `keepState` on, or remove `browserState`.",
|
|
27097
|
-
details: { keys: browser }
|
|
27098
|
-
});
|
|
27099
27563
|
};
|
|
27100
27564
|
/**
|
|
27101
27565
|
* The visitors' roles and what each gives (`checkVisitorRoles`). Refused rather than repaired — a role written wrong
|
|
@@ -27232,28 +27696,7 @@ var parseFonts = (author, fonts) => {
|
|
|
27232
27696
|
}
|
|
27233
27697
|
});
|
|
27234
27698
|
};
|
|
27235
|
-
|
|
27236
|
-
* A tablet rule a phone never sees.
|
|
27237
|
-
*
|
|
27238
|
-
* The breakpoints are RANGES, not a cascade: `tablet` is 48–64rem, `mobile` is up to 48rem, and each inherits
|
|
27239
|
-
* only from `desktop`. So a layout that collapses to a column at tablet and says nothing for mobile comes back as
|
|
27240
|
-
* desktop columns on a phone — the narrowest screen gets the widest layout, and every check passes. A warning and
|
|
27241
|
-
* not a refusal, because a rule meant for tablets alone is legal, just rarely what anybody meant.
|
|
27242
|
-
*/
|
|
27243
|
-
var warnTabletOnly = (author, blocks, where) => {
|
|
27244
|
-
const tablet = blocks.tablet?.default ?? {};
|
|
27245
|
-
const mobile = blocks.mobile?.default ?? {};
|
|
27246
|
-
if (mobile.display === "none") return;
|
|
27247
|
-
const skipped = Object.keys(tablet).filter((property) => !Object.hasOwn(mobile, property));
|
|
27248
|
-
if (skipped.length === 0) return;
|
|
27249
|
-
author.styleWarnings.push({
|
|
27250
|
-
code: "tablet-rule-skips-mobile",
|
|
27251
|
-
message: `${where} sets ${skipped.join(", ")} for tablet but not for mobile. Tablet (48–64rem) and mobile (up to 48rem) are separate ranges and mobile inherits desktop, not tablet — so phones get the desktop value back. For both, write it once under \`compact\` (tablet and mobile together); repeat it under \`mobile\` otherwise.`,
|
|
27252
|
-
details: { properties: skipped }
|
|
27253
|
-
});
|
|
27254
|
-
};
|
|
27255
|
-
var writeSelector = (author, name, blocks, where) => {
|
|
27256
|
-
warnTabletOnly(author, blocks, where);
|
|
27699
|
+
var writeSelector = (author, name, blocks) => {
|
|
27257
27700
|
for (const breakpoint of BREAKPOINTS$1) {
|
|
27258
27701
|
const block = blocks[breakpoint];
|
|
27259
27702
|
if (!block) continue;
|
|
@@ -27305,7 +27748,7 @@ var baseSelectorFor = (author, path, id, spec, place = path) => {
|
|
|
27305
27748
|
writeSelector(author, spec.selector, toBlocks({
|
|
27306
27749
|
css: spec.css,
|
|
27307
27750
|
states: spec.states
|
|
27308
|
-
})
|
|
27751
|
+
}));
|
|
27309
27752
|
return spec.selector;
|
|
27310
27753
|
}
|
|
27311
27754
|
let selector = `${spec.type}-${digest(`plitzi:selector:${author.spec.permanentUrl}:${path}`, 4)}`;
|
|
@@ -27314,7 +27757,7 @@ var baseSelectorFor = (author, path, id, spec, place = path) => {
|
|
|
27314
27757
|
writeSelector(author, selector, toBlocks({
|
|
27315
27758
|
css: spec.css,
|
|
27316
27759
|
states: spec.states
|
|
27317
|
-
})
|
|
27760
|
+
}));
|
|
27318
27761
|
return selector;
|
|
27319
27762
|
};
|
|
27320
27763
|
/**
|
|
@@ -27333,7 +27776,7 @@ var modifierFor = (author, id, spec, modifiers, place) => {
|
|
|
27333
27776
|
const name = modifierClassName(id);
|
|
27334
27777
|
assertOwnSelector(author, name, where);
|
|
27335
27778
|
const blocks = toBlocks(modifiers[0]);
|
|
27336
|
-
writeSelector(author, name, blocks
|
|
27779
|
+
writeSelector(author, name, blocks);
|
|
27337
27780
|
author.ownRules.set(name, {
|
|
27338
27781
|
blocks,
|
|
27339
27782
|
written: () => {
|
|
@@ -27361,11 +27804,6 @@ var slotSelectors = (author, spec, place) => {
|
|
|
27361
27804
|
return [slot, names.join(" ")];
|
|
27362
27805
|
}));
|
|
27363
27806
|
};
|
|
27364
|
-
/** Whether `variant` is declared by the element's type style or by one of its classes — where `variantOwner` looks. */
|
|
27365
|
-
var variantDeclared = (author, spec, variant) => {
|
|
27366
|
-
if (author.spec.elements?.[spec.type]?.variants?.[variant] !== void 0) return true;
|
|
27367
|
-
return spec.class !== void 0 && classNames(splitClassList(spec.class).refs).some((name) => Object.values(author.classRules.get(name) ?? {}).some((block) => block.variants?.[variant] !== void 0));
|
|
27368
|
-
};
|
|
27369
27807
|
// src/schema/space/elements.ts
|
|
27370
27808
|
/** `<type>-<n>` for an element nobody named. Positional and deterministic, so a re-run writes the same document;
|
|
27371
27809
|
* it steps over anything the author named so a derived name can never take one. */
|
|
@@ -27451,12 +27889,6 @@ var markConditionalByChildren = (author, schema) => {
|
|
|
27451
27889
|
}
|
|
27452
27890
|
}
|
|
27453
27891
|
};
|
|
27454
|
-
/** The name an element's plugin is declared under: its own type, or `custom:<renderType>` for one a `custom` hosts. */
|
|
27455
|
-
var pluginKeyOf = (element) => {
|
|
27456
|
-
const { type } = element.definition;
|
|
27457
|
-
const renderType = element.attributes.renderType;
|
|
27458
|
-
return type === "custom" && typeof renderType === "string" ? `${CUSTOM_TYPE}:${renderType}` : type;
|
|
27459
|
-
};
|
|
27460
27892
|
/** Whether the element's plugin declares it draws nothing. */
|
|
27461
27893
|
var drawsNothing = (author, element) => {
|
|
27462
27894
|
return author.options.drawsNothingTypes?.includes(pluginKeyOf(element)) ?? false;
|
|
@@ -27467,26 +27899,6 @@ var isBoxless = (author, element) => a$3(element) || drawsNothing(author, elemen
|
|
|
27467
27899
|
var choosesChildren = (author, element) => {
|
|
27468
27900
|
return author.options.choosesChildrenTypes?.includes(pluginKeyOf(element)) ?? false;
|
|
27469
27901
|
};
|
|
27470
|
-
/**
|
|
27471
|
-
* An `activeWhen` that sets a variant its class does not declare: nothing ever applies, and it was said nowhere
|
|
27472
|
-
* (motion-bump's variant is `hit`, and its `activeWhen` — `active` — never worked). `idle` is the class as it is.
|
|
27473
|
-
*/
|
|
27474
|
-
var warnVariantsSet = (author, element, spec, where) => {
|
|
27475
|
-
for (const binding of Array.isArray(spec.bind) ? spec.bind : []) {
|
|
27476
|
-
const key = (binding.transformers?.find((each) => each.action === "styleVariant"))?.params.key;
|
|
27477
|
-
const template = binding.transformers?.find((each) => each.action === "twigTemplate")?.params.template;
|
|
27478
|
-
if (typeof key !== "string" || typeof template !== "string") continue;
|
|
27479
|
-
const cls = key.slice(0, key.lastIndexOf("."));
|
|
27480
|
-
const names = [...template.matchAll(/\?\s*'([\w-]+)'\s*:\s*'idle'\s*\}\}\s*$/g)].map((match) => match[1]);
|
|
27481
|
-
const declared = Object.values(author.classRules.get(cls) ?? {}).flatMap((block) => Object.keys(block.variants ?? {}));
|
|
27482
|
-
if (names.length === 0 || !author.classRules.has(cls) || names.some((name) => declared.includes(name))) continue;
|
|
27483
|
-
author.styleWarnings.push({
|
|
27484
|
-
code: "unknown-variant",
|
|
27485
|
-
message: `${where} sets class ${cls}'s variant ${names.map((name) => `'${name}'`).join(" or ")} by \`activeWhen\`, which ${cls} does not declare — ${declared.length > 0 ? `its variants: ${declared.join(", ")}` : "it has none"} — so nothing applies. Name one it declares — \`activeWhen(${cls}, …, { variant: '${declared[0] ?? "active"}' })\` — or declare it.`,
|
|
27486
|
-
elementId: element.id
|
|
27487
|
-
});
|
|
27488
|
-
}
|
|
27489
|
-
};
|
|
27490
27902
|
/** A name for a plugin's attribute that is not one of the element's own, by the one it was: what the warning suggests. */
|
|
27491
27903
|
var RENAMED = {
|
|
27492
27904
|
variant: "kind",
|
|
@@ -27503,29 +27915,21 @@ var RENAMED = {
|
|
|
27503
27915
|
meta: "info"
|
|
27504
27916
|
};
|
|
27505
27917
|
/**
|
|
27506
|
-
* What
|
|
27507
|
-
*
|
|
27508
|
-
*
|
|
27918
|
+
* What a plugin declares that its element never gets, said once per plugin: an attribute under one of the element's own
|
|
27919
|
+
* names, which a factory reads as that and never hands to the plugin. About the plugin's code, not the space, so it is
|
|
27920
|
+
* authoring's alone; a variant no style declares is the document linter's (`lintVariants`), the builder's too.
|
|
27509
27921
|
*/
|
|
27510
|
-
var
|
|
27922
|
+
var warnReservedAttributes = (author, element, where) => {
|
|
27511
27923
|
const key = pluginKeyOf(element);
|
|
27512
27924
|
const reserved = author.options.reservedPluginAttributes?.[key] ?? [];
|
|
27513
27925
|
if (reserved.length > 0 && !author.reservedWarned.has(key)) {
|
|
27514
27926
|
author.reservedWarned.add(key);
|
|
27515
|
-
author.
|
|
27927
|
+
author.specWarnings.push({
|
|
27516
27928
|
code: "plugin-attribute-reserved",
|
|
27517
27929
|
message: `${where} is a "${key}", whose plugin declares ${reserved.map((name) => `\`${name}\``).join(", ")} — ${reserved.length === 1 ? "a name" : "names"} authoring reads as the element's own (\`variant\` is its style variant, \`class\` its classes, \`from\` where its rows come from), so the plugin is never handed ${reserved.length === 1 ? "it" : "them"}. Rename ${reserved.length === 1 ? "it" : "them"} in the plugin: ${reserved.map((name) => `\`${name}\` → \`${RENAMED[name] ?? `${name}Value`}\``).join(", ")}.`,
|
|
27518
27930
|
elementId: element.id
|
|
27519
27931
|
});
|
|
27520
27932
|
}
|
|
27521
|
-
warnVariantsSet(author, element, spec, where);
|
|
27522
|
-
if (spec.variant === void 0 || variantDeclared(author, spec, spec.variant)) return;
|
|
27523
|
-
const plugin = reserved.includes("variant") ? " If it was meant for the plugin’s own `variant`, that attribute is never set: rename it in the plugin." : element.definition.type === "custom" ? " On a `custom` element `variant` is its style variant, never a prop of the component it hosts: hand the component a prop of another name (`tone`)." : "";
|
|
27524
|
-
author.styleWarnings.push({
|
|
27525
|
-
code: "unknown-variant",
|
|
27526
|
-
message: `${where} is written with \`variant: '${spec.variant}'\`, which no class of it and no style of its type declares, so nothing applies.${plugin} Declare it — \`styles(name, { variants: { ${spec.variant}: { … } } })\` — or name one that is.`,
|
|
27527
|
-
elementId: element.id
|
|
27528
|
-
});
|
|
27529
27933
|
};
|
|
27530
27934
|
var recordHandle = (author, handle) => {
|
|
27531
27935
|
if (Object.hasOwn(author.handles, handle.pageId)) {
|
|
@@ -27683,7 +28087,7 @@ var writeElement = (author, spec, path, place, rootId, parentId, above, tree) =>
|
|
|
27683
28087
|
}
|
|
27684
28088
|
};
|
|
27685
28089
|
insert(author, element, parentId, isRoot ? "custom" : "inside", place, tree);
|
|
27686
|
-
|
|
28090
|
+
warnReservedAttributes(author, element, where);
|
|
27687
28091
|
recordHandle(author, {
|
|
27688
28092
|
id,
|
|
27689
28093
|
type: spec.type,
|
|
@@ -27951,7 +28355,7 @@ var withheldPageId = (author) => {
|
|
|
27951
28355
|
if (target === void 0) return;
|
|
27952
28356
|
const { page, names } = pageNamed(author, target);
|
|
27953
28357
|
if (!page) throw new AuthoringError("withheld-page-invalid", `settings.withheldPage is "${target}", which is no page of this space${didYouMean(target, names)}. Write a page's id or slug.`);
|
|
27954
|
-
if (r$
|
|
28358
|
+
if (r$45(author.flatMap.flat[page.id].attributes)) throw new AuthoringError("withheld-page-invalid", `settings.withheldPage is "${target}", a page with an access of its own: it would be withheld from the visitor it is drawn for. Name a page every visitor may see.`);
|
|
27955
28359
|
return page.id;
|
|
27956
28360
|
};
|
|
27957
28361
|
var routeFor = (author, page) => {
|
|
@@ -27974,6 +28378,20 @@ var homeIndexOf = (pages) => {
|
|
|
27974
28378
|
const root = pages.findIndex((page) => page.slug === "");
|
|
27975
28379
|
return root !== -1 ? root : pages.findIndex((page) => page.slug !== "*");
|
|
27976
28380
|
};
|
|
28381
|
+
/**
|
|
28382
|
+
* One page for the addresses nothing answers in each scope — the space's, and each folder's: two with `slug: '*'` in the
|
|
28383
|
+
* same place would leave the router to pick one of them, and an address to land on whichever it picked. A folder's
|
|
28384
|
+
* answers its own addresses, the space's the rest.
|
|
28385
|
+
*/
|
|
28386
|
+
var assertOneNotFoundPerScope = (pages) => {
|
|
28387
|
+
const byScope = /* @__PURE__ */ new Map();
|
|
28388
|
+
pages.filter((page) => page.slug === "*").forEach((page) => byScope.set(page.folder ?? "", [...byScope.get(page.folder ?? "") ?? [], page.name]));
|
|
28389
|
+
const twice = [...byScope.entries()].find(([, names]) => names.length > 1);
|
|
28390
|
+
if (twice) {
|
|
28391
|
+
const [folder, names] = twice;
|
|
28392
|
+
throw new AuthoringError("not-found-twice", `Pages ${names.map((name) => `"${name}"`).join(" and ")} each answer every address nothing else does ${folder ? `in the folder "${folder}"` : "in the space"} (slug '*'): keep one — give the other a slug of its own, or move it to the folder whose addresses it answers`);
|
|
28393
|
+
}
|
|
28394
|
+
};
|
|
27977
28395
|
var addPage = (author, page, index, home) => {
|
|
27978
28396
|
if (page.slug === "*" && page.isDefault === true) throw new AuthoringError("page-catch-all-default", `Page "${page.name}" answers every address no other page does (slug '*'), and cannot be the home too: say isDefault on the page at '' (or leave it out — the page at '' is the home)`);
|
|
27979
28397
|
const path = pathFor(author, page, index);
|
|
@@ -28172,8 +28590,11 @@ var SpaceAuthor = class {
|
|
|
28172
28590
|
};
|
|
28173
28591
|
/** Each component's tree, by component id. */
|
|
28174
28592
|
componentTrees = /* @__PURE__ */ new Map();
|
|
28175
|
-
/**
|
|
28176
|
-
|
|
28593
|
+
/**
|
|
28594
|
+
* What only the spec can be warned of, never the documents — a plugin's own code (`warnReservedAttributes`). Every
|
|
28595
|
+
* other warning is the linter's, so the builder says it too.
|
|
28596
|
+
*/
|
|
28597
|
+
specWarnings = [];
|
|
28177
28598
|
/** What could not be written as declared, kept so the run reports all of it (see `addElement`). */
|
|
28178
28599
|
refusals = [];
|
|
28179
28600
|
/** Elements left out of the documents for a refusal — while any is, the documents are not whole enough to lint. */
|
|
@@ -28217,7 +28638,7 @@ var SpaceAuthor = class {
|
|
|
28217
28638
|
schema,
|
|
28218
28639
|
style,
|
|
28219
28640
|
handles: buildHandles(this.handles, this.layoutHandles),
|
|
28220
|
-
warnings: [...this.
|
|
28641
|
+
warnings: [...this.specWarnings, ...warnings],
|
|
28221
28642
|
suggestions
|
|
28222
28643
|
};
|
|
28223
28644
|
}
|
|
@@ -28291,7 +28712,7 @@ var SpaceAuthor = class {
|
|
|
28291
28712
|
});
|
|
28292
28713
|
for (const [name, responsive] of this.classRules) {
|
|
28293
28714
|
const blocks = BREAKPOINTS$1.some((breakpoint) => responsive[breakpoint]) ? responsive : { desktop: {} };
|
|
28294
|
-
writeSelector(this, name, blocks
|
|
28715
|
+
writeSelector(this, name, blocks);
|
|
28295
28716
|
}
|
|
28296
28717
|
assertAncestorClasses(this);
|
|
28297
28718
|
assertComputedOnce(this);
|
|
@@ -28306,6 +28727,9 @@ var SpaceAuthor = class {
|
|
|
28306
28727
|
const pageFolders = buildPageFolders(this);
|
|
28307
28728
|
const declared = collecting(this, () => components.map((component) => addComponent(this, component)));
|
|
28308
28729
|
collecting(this, () => layouts.forEach((layout) => addLayout(this, layout)));
|
|
28730
|
+
collecting(this, () => {
|
|
28731
|
+
assertOneNotFoundPerScope(this.spec.pages);
|
|
28732
|
+
});
|
|
28309
28733
|
const home = homeIndexOf(this.spec.pages);
|
|
28310
28734
|
const pages = collecting(this, () => this.spec.pages.map((page, index) => addPage(this, page, index, home)));
|
|
28311
28735
|
const families = /* @__PURE__ */ new Map();
|
|
@@ -28730,7 +29154,7 @@ var validateSnippet$1 = (snippet, options = {}) => {
|
|
|
28730
29154
|
}));
|
|
28731
29155
|
const { errors: spaceErrors, warnings } = validateSpace$1({
|
|
28732
29156
|
schema: {
|
|
28733
|
-
...r$
|
|
29157
|
+
...r$46.schema,
|
|
28734
29158
|
...schema
|
|
28735
29159
|
},
|
|
28736
29160
|
style
|
|
@@ -30841,7 +31265,7 @@ var readPage = (reader, page, index) => {
|
|
|
30841
31265
|
const folder = folderOf(reader, attributes.folder, where);
|
|
30842
31266
|
const layout = layoutRefOf(reader, attributes, where);
|
|
30843
31267
|
const accessLevel = attributes.accessLevel === "public" || attributes.accessLevel === "authenticated" ? attributes.accessLevel : void 0;
|
|
30844
|
-
const access = r$
|
|
31268
|
+
const access = r$45(attributes);
|
|
30845
31269
|
const redirect = attributes.unauthorizedBehaviour === "redirect" && typeof attributes.unauthorizedPageRedirect === "string" ? attributes.unauthorizedPageRedirect : void 0;
|
|
30846
31270
|
const seoTitle = typeof attributes.seoPageTitle === "string" ? attributes.seoPageTitle : "";
|
|
30847
31271
|
const seoDescription = typeof attributes.seoPageDescription === "string" ? attributes.seoPageDescription : "";
|
|
@@ -37255,4 +37679,4 @@ var validateSnippet = (snippet, options = {}) => validateSnippet$1(snippet, {
|
|
|
37255
37679
|
...ELEMENT_CATALOGS,
|
|
37256
37680
|
...options
|
|
37257
37681
|
});
|
|
37258
|
-
export { readDevToolsInPage as $,
|
|
37682
|
+
export { readDevToolsInPage as $, dropdown as $a, onDialogAccept as $i, css as $n, closest as $o, SET_STATE_TYPES as $r, journeyStartWarnings as $t, pressShortcut as A, resetForm as Aa, whenSucceeded as Ai, pressFailure as An, defaultLabel as Ao, o$1 as Ar, i$44 as As, actionToSource as At, alignPictures as B, d$6 as Ba, carouselPlay as Bi, grid as Bn, boundAttribute as Bo, instanceSelectorFor as Br, n$68 as Bs, suggestClassOverrides as Bt, unquoted as C, onSubmit as Ca, webHook as Ci, HYDRATION_MS as Cn, tabContainerItem as Co, b as Cr, r$25 as Cs, searchWords as Ct, readSpaceTests as D, openModal as Da, named$4 as Di, hoverElement as Dn, component as Do, g as Dr, e$53 as Ds, specFromSpace as Dt, e2eStepProblems as E, openDialog as Ea, flowStepIds as Ei, fieldsOf as En, video as Eo, f as Er, t$44 as Es, specToSource as Et, compareTexts as F, toggleElement as Fa, announceOn as Fi, STATE_PATH_PARAMS as Fn, GLOBAL_SOURCES as Fo, v as Fr, c$31 as Fs, transformerCatalog as Ft, loadImages as G, button$1 as Ga, declaredTrigger as Gi, isClassModifier as Gn, scopedHint as Go, flagSpecOf as Gr, i$48 as Gs, familyOf as Gt, diffPictures as H, apiContainer as Ha, closeDialog as Hi, className as Hn, hasVisibilityBinding as Ho, pathForSlug as Hr, s$32 as Hs, PAGE_SPEC_FIELDS as Ht, pageTexts as I, updateElement as Ia, cancelApi as Ii, tokens as In, activeOn as Io, y as Ir, i$45 as Is, assertSnippetValid as It, inspectPage as J, channel as Ja, onApiError as Ji, modifierClassName as Jn, visibleWhen as Jo, taskAction as Jr, withNotificationsCss as Jt, unrollPage as K, carousel as Ka, focus as Ki, isClassRef as Kn, toBindingSpecs as Ko, authoringCodesTable as Kr, o$36 as Ks, pageFamily as Kt, PAGE_DECORATION_LIMIT as L, elementsFromManifest as La, carouselGoTo as Li, createTw as Ln, activeWhen as Lo, digest as Lr, o$33 as Ls, assertSpaceValid as Lt, inspectRenders as M, scrollIntoView as Ma, BUILTIN_GLOBAL_CALLBACKS as Mi, settle as Mn, element as Mo, s$2 as Mr, r$52 as Ms, BUILTIN_TRANSFORMERS as Mt, summariseRenders as N, scrollTo as Na, applyBuiltinCallback as Ni, targetId as Nn, inferredLinkMode as No, t$1 as Nr, t$84 as Ns, getTransformer as Nt, singlePageSpace as O, publishOn as Oa, when as Oi, locateField as On, declaresAttribute as Oo, l$1 as Or, elementAttributeNames as Os, compareSpaces as Ot, PAGE_TEXT_LIMIT as P, setFieldValue as Pa, getGlobalCallback as Pi, targetOf$1 as Pn, COMPONENT_SOURCES as Po, u as Pr, a$31 as Ps, suggestTransformer as Pt, readDevTools as Q, dialogContainer as Qa, onClick as Qi, STYLE_STATES as Qn, twig as Qo, getUtility as Qr, e2eTestProblems as Qt, compareDecorations as R, pluginTypesOf as Ra, carouselNext as Ri, tw as Rn, authorBinding as Ro, slugify as Rr, s$30 as Rs, suggestSpace as Rt, stepLines as S, onScroll as Sa, twigTemplate as Si, FIELD as Sn, tabContainerHeader as So, _ as Sr, n$34 as Ss, searchScore as St, unit as T, onView as Ta, authorFlows as Ti, endlesslyMovedInPage as Tn, themeToggle as To, d as Tr, r$27 as Ts, SPACE_FIELDS as Tt, pageRegions as U, blockHtml as Ua, closeModal as Ui, classNames as Un, hiddenWhen as Uo, selectorFor as Ur, t$86 as Us, SpaceRefusedError as Ut, comparePictures as V, i$14 as Va, carouselPrevious as Vi, row as Vn, groupBindings as Vo, locate as Vr, r$54 as Vs, unusedDeclarations as Vt, profilePictures as W, blockJsx as Wa, declaredCallback as Wi, classRefs as Wn, resolveSource as Wo, flagGateOf as Wr, a$34 as Ws, refusalOf as Wt, onScreenIfChosen as X, container as Xa, onBlur as Xi, styles as Xn, actionSource as Xo, BUILTIN_UTILITIES as Xr, FIXABLE_CODES as Xt, onScreen as Y, chart as Ya, onApiSuccess as Yi, splitClassList as Yn, withVisibility as Yo, c$4 as Yr, navOf as Yt, failedFlowText as Z, custom$1 as Za, onChange as Zi, BREAKPOINTS$1 as Zn, source as Zo, applyUtility as Zr, unitTestProblems as Zt, e2eStepText as _, onMouseEnter as _a, runServerActionOrNotify as _i, dragElement as _n, reference as _o, suggestCssProperty as _r, elementTriggers as _s, explain as _t, locateClasses as a, onFlowProgress as aa, authRefreshDetails as ai, playE2eStep as an, formControl as ao, expandShorthand as ar, isSuggestionCode as as, catalogTemplateFiles as at, parseE2eStep as b, onPageLoad as ba, toggleInState as bi, shownCopy as bn, tabContainer as bo, N as br, typeTriggerDefinitions as bs, explainSearch as bt, validateSnippet as c, onInterval as ca, copyToClipboard as ci, unitReportText as cn, link as co, shorthandLonghands as cr, elementCallbacks as cs, space as ct, e2eResultText as d, onKey as da, hostAction as di, EDGES as dn, markdown as do, cssNumberValue as dr, elementLeafTypes as ds, importSlug as dt, onDialogClose as ea, addNotification as ei, testAccountWarnings as en, dropdownPopup as eo, isRuleSetSpec as er, scope as es, dataIssues as et, journeyAccount as f, onLeave as fa, invalidateQueries as fi, parseRelation as fn, modalContainer as fo, cssProperties as fr, elementMarks as fs, importedFiles as ft, durationMs as g, onModalOpen as ga, runServerAction as gi, answered as gn, plitziSdk as go, replacedCssProperty as gr, elementSourceTypes as gs, GLOBAL_CALLBACK_BUILDERS as gt, MAX_WAIT_FOR_MS as h, onModalClose as ha, removeState as hi, sidePx as hn, paragraph as ho, isCustomProperty as hr, elementSlots as hs, EXPLAIN_KINDS as ht, lintSpace as i, onFlowError as ia, authLogoutEverywhere as ii, isExpectation as in, form as io, cssShorthands as ir, authoringCodeEntry as is, blankTemplateFiles as it, shortcutKey as j, scrollBy as ja, whileRunning as ji, pressOnce as jn, defineElement as jo, p as jr, n$67 as js, withNamedIds as jt, withElement as k, reloadApi as ka, whenFailed as ki, locateTarget as kn, defaultAttributes as ko, m as kr, e$59 as ks, actionSpecFromEntry as kt, validateSpace as l, onInvalid as la, cycleState as li, resolveElement as ln, list$1 as lo, ambiguousShorthands as lr, elementCatalog as ls, space$1 as lt, E2E_STEP_USAGE as m, onMessage as ma, navigate as mi, relationHolds as mn, pagination as mo, isCssProperty as mr, elementPublishes as ms, BUILDER_NAMES as mt, authorSpace as n, onDialogReject as na, authLogin as ni, pageAt as nn, focusGroup as no, toBlocks as nr, AUTHORING_ONLY_CODES as ns, CATALOG_TEMPLATE_IDENTITY as nt, locateElements as o, onFocus as oa, cancelServerAction as oi, runUnitTest as on, heading as oo, expandShorthandPatch as or, elementAncestorTypes as os, emptyTemplateFiles as ot, runE2eTest as p, onLoad as pa, moveState as pi, relationElements as pn, nodeHtml as po, cssPropertyName as pr, elementPartTypes as ps, importProbe as pt, inspectDocument as q, carouselTrack as qa, on as qi, isStyleDeclaration as qn, variantFrom as qo, defineAction as qr, notificationsCss as qt, fixSpace as r, onFlowEnd as ra, authLogout as ri, bridge as rn, fontAwesome as ro, toResponsive as rr, AuthoringError as rs, blankSpace as rt, planFixes as s, onHover as sa, clearState as si, runUnitTests as sn, image as so, expandShorthandTraced as sr, elementAttributeValues as ss, toPortableSource as st, authorSnippet as t, onDialogOpen as ta, appendState as ti, audienceAt as tn, embed as to, sameBlocks as tr, AUTHORING_CODES as ts, answerAction as tt, compactSvg as u, onJoin as ua, delay as ui, openPage as un, listItem as uo, fontUnread as ur, elementDefaultAttributes as us, darkScheme as ut, isE2eStepWord as v, onMouseLeave as va, setState as vi, giveValue as vn, richText as vo, C as vr, elementTypeNames as vs, explainKindOf as vt, e2e as w, onThemeChange as wa, authorFlow as wi, awaitHydration as wn, text$1 as wo, c$2 as wr, n$36 as ws, ELEMENT_FIELDS as wt, parseE2eSteps as x, onPointerDown as xa, toggleState as xi, valueFieldIn as xn, tabContainerBody as xo, P as xr, Y as xs, explanationText as xt, leadingTarget as y, onPageChange as ya, stepState as yi, hiddenAtWidth as yn, svg as yo, M as yr, typeCallbackDefinitions as ys, explainList as yt, pageDecorations as z, withPluginCatalogs as za, carouselPause as zi, column as zn, bindTemplate as zo, buildHandles as zr, c$33 as zs, withoutQuieted as zt };
|