@zazz-ui/core 0.6.2 → 0.6.3
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/AUTHORING.md +4 -2
- package/CHANGELOG.md +25 -0
- package/README.md +3 -3
- package/dist/csp-D72qtdXZ.js +1 -0
- package/dist/sri.json +13 -10
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/package.json +1 -1
- package/src/base/_utilities-color.css +3 -0
- package/src/base/_utilities-spacing.css +35 -0
- package/src/base/csp.d.ts +19 -0
- package/src/base/csp.d.ts.map +1 -0
- package/src/base/csp.js +131 -0
- package/src/base/csp.ts +137 -0
- package/src/base/declarations.d.ts +36 -0
- package/src/base/declarations.d.ts.map +1 -0
- package/src/base/declarations.js +70 -0
- package/src/base/declarations.ts +97 -0
- package/src/base/style-format.d.ts +3 -22
- package/src/base/style-format.d.ts.map +1 -1
- package/src/base/style-format.js +4 -62
- package/src/base/style-format.ts +4 -71
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +35 -17
- package/src/base/utilities.ts +42 -20
- package/src/head.d.ts +6 -0
- package/src/head.d.ts.map +1 -1
- package/src/head.js +21 -14
- package/src/head.ts +38 -11
- package/src/index.js +22 -0
- package/src/index.ts +19 -0
- package/src/manifest.d.ts +21 -1
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +10 -1
- package/src/manifest.ts +25 -1
- package/src/primitives/debug/audit-core.d.ts +1 -1
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +35 -5
- package/src/primitives/debug/audit-core.ts +42 -4
- package/src/primitives/prose/prose.html +3 -3
- package/src/primitives/table/table-size-sm.html +12 -12
- package/src/primitives/utilities/aspect-ratio.html +1 -0
- package/src/primitives/utilities/margin-auto.html +1 -1
- package/src/primitives/utilities/overflow.html +5 -6
- package/src/primitives/utilities/position.html +1 -1
- package/src/primitives/utilities/width.html +2 -1
package/src/base/utilities.ts
CHANGED
|
@@ -286,6 +286,22 @@ export const SIZING_KEYWORDS = ["auto", "fit-content", "min-content", "max-conte
|
|
|
286
286
|
export const MARGIN_KEYWORDS = ["auto"] as const;
|
|
287
287
|
/** A layout places its children; a tier-only column utility there keeps the band below the tier. */
|
|
288
288
|
const LAYOUT_CHILDREN = ["ui-layout > *", '[data-ui~="layout"] > *'] as const;
|
|
289
|
+
/**
|
|
290
|
+
* Elements the reset or the prose scope pads (a prose list's indent, a quote's
|
|
291
|
+
* inset, inline code, form controls): a tier-only padding utility there would
|
|
292
|
+
* zero that padding below the tier, so they keep the base requirement.
|
|
293
|
+
*/
|
|
294
|
+
const BASE_PADDED = [
|
|
295
|
+
'[data-ui~="prose"] :is(ul, ol, dd, blockquote, cite)',
|
|
296
|
+
"code",
|
|
297
|
+
"button",
|
|
298
|
+
"input",
|
|
299
|
+
"select",
|
|
300
|
+
"textarea",
|
|
301
|
+
"optgroup",
|
|
302
|
+
] as const;
|
|
303
|
+
/** Elements the reset paints: a tier-only `--bg` there would clear the paint below the tier. */
|
|
304
|
+
const BASE_PAINTED = ["code", "hr"] as const;
|
|
289
305
|
|
|
290
306
|
/**
|
|
291
307
|
* Track-list keywords `--grid-cols` / `--grid-rows` take besides a count. `none`
|
|
@@ -459,26 +475,29 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
459
475
|
family: "grid",
|
|
460
476
|
emit: "grid-fit",
|
|
461
477
|
},
|
|
462
|
-
// spacing: dual mode; gap
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
name:
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
478
|
+
// spacing: dual mode; padding and gap are on the no-base allowlist (the reset
|
|
479
|
+
// zeroes padding, so `--px--md: 8` alone pads from md), except where the base pads
|
|
480
|
+
...(
|
|
481
|
+
[
|
|
482
|
+
["p", "padding"],
|
|
483
|
+
["px", "padding-inline"],
|
|
484
|
+
["py", "padding-block"],
|
|
485
|
+
["pt", "padding-block-start"],
|
|
486
|
+
["pb", "padding-block-end"],
|
|
487
|
+
["pl", "padding-inline-start"],
|
|
488
|
+
["pr", "padding-inline-end"],
|
|
489
|
+
] as const
|
|
490
|
+
).map(
|
|
491
|
+
([name, property]): Utility => ({
|
|
492
|
+
name,
|
|
493
|
+
pseudo: true,
|
|
494
|
+
properties: [property],
|
|
495
|
+
mode: "dual",
|
|
496
|
+
family: "spacing",
|
|
497
|
+
noBase: "0",
|
|
498
|
+
noBaseExclude: BASE_PADDED,
|
|
499
|
+
}),
|
|
500
|
+
),
|
|
482
501
|
{ name: "gap", properties: ["gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
483
502
|
{ name: "gap-x", properties: ["column-gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
484
503
|
{ name: "gap-y", properties: ["row-gap"], mode: "dual", family: "spacing", noBase: "0" },
|
|
@@ -665,6 +684,7 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
665
684
|
{ name: "whitespace", properties: ["white-space"], mode: "keyword", family: "typography" },
|
|
666
685
|
// color: states; bg-alpha feeds the bg emission
|
|
667
686
|
{ name: "text", properties: ["color"], mode: "raw", family: "color", pseudo: true },
|
|
687
|
+
// on the no-base allowlist: a plain element is transparent, so `--bg--hover` alone paints on hover
|
|
668
688
|
{
|
|
669
689
|
name: "bg",
|
|
670
690
|
properties: ["background-color"],
|
|
@@ -672,6 +692,8 @@ export const UTILITIES: readonly Utility[] = [
|
|
|
672
692
|
family: "color",
|
|
673
693
|
emit: "bg",
|
|
674
694
|
pseudo: true,
|
|
695
|
+
noBase: "transparent",
|
|
696
|
+
noBaseExclude: BASE_PAINTED,
|
|
675
697
|
},
|
|
676
698
|
{ name: "bg-alpha", properties: [], mode: "raw", family: "color", emit: "none" },
|
|
677
699
|
// gradients: the type utility carries the prelude (direction, shape, position,
|
package/src/head.d.ts
CHANGED
|
@@ -84,6 +84,12 @@ export interface HeadOptions {
|
|
|
84
84
|
fontDisplay?: "swap" | "optional" | false;
|
|
85
85
|
/** Include the inline theme-persistence script (last in head). Default `true`. */
|
|
86
86
|
theme?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* A CSP nonce for the two inline scripts (the import map and the theme
|
|
89
|
+
* script), so a strict `script-src 'nonce-…'` allows them. The page's own
|
|
90
|
+
* value, generated per response; never a constant.
|
|
91
|
+
*/
|
|
92
|
+
nonce?: string;
|
|
87
93
|
/**
|
|
88
94
|
* Local granular grain: the primitives this page uses, loaded file by file
|
|
89
95
|
* from `base` (base layers, the closure's stylesheets in cascade order, one
|
package/src/head.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["head.ts"],"names":[],"mappings":"AA6BA,wDAAwD;AACxD,UAAU,aAAa;IACrB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"head.d.ts","sourceRoot":"","sources":["head.ts"],"names":[],"mappings":"AA6BA,wDAAwD;AACxD,UAAU,aAAa;IACrB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD;;;;;;GAMG;AACH,iBAAS,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAE1C;AAED;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,SAAS,aAAa,EA+B7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CAAC,OAAO,GAAE,WAAgB,GAAG,MAAM,CAI5D;AAED,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAgBjE;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,WAAW,GACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAa1D;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,CAG1F"}
|
package/src/head.js
CHANGED
|
@@ -51,6 +51,9 @@ const CORE_RUNTIME_JS = [
|
|
|
51
51
|
"base/zazz-element.js",
|
|
52
52
|
// dynamically imported by index.js where container scroll-state queries are unsupported
|
|
53
53
|
"base/scroll-state.js",
|
|
54
|
+
// dynamically imported by index.js where the page's CSP blocks inline style attributes
|
|
55
|
+
"base/csp.js",
|
|
56
|
+
"base/declarations.js",
|
|
54
57
|
];
|
|
55
58
|
/**
|
|
56
59
|
* @description Builds the pinned jsDelivr URL for a dependency.
|
|
@@ -146,7 +149,7 @@ function fontsBlock(display) {
|
|
|
146
149
|
* @returns The import-map script tag.
|
|
147
150
|
* @private
|
|
148
151
|
*/
|
|
149
|
-
function importMapBlock(extraIntegrity = {}) {
|
|
152
|
+
function importMapBlock(extraIntegrity = {}, nonce) {
|
|
150
153
|
const imports = {};
|
|
151
154
|
const integrity = { ...extraIntegrity };
|
|
152
155
|
for (const dep of ESM_DEPENDENCIES) {
|
|
@@ -156,7 +159,7 @@ function importMapBlock(extraIntegrity = {}) {
|
|
|
156
159
|
}
|
|
157
160
|
const json = JSON.stringify({ imports, integrity }, null, 2);
|
|
158
161
|
return `<!-- Import map: bare specifiers in Zazz scripts resolve to pinned, SRI-checked files -->
|
|
159
|
-
<script type="importmap">
|
|
162
|
+
<script type="importmap"${nonceAttr(nonce)}>
|
|
160
163
|
${json}
|
|
161
164
|
</script>`;
|
|
162
165
|
}
|
|
@@ -173,14 +176,18 @@ function polyfillsBlock() {
|
|
|
173
176
|
return `<!-- Polyfill: Interest Invokers (interestfor) — native in Chromium only -->
|
|
174
177
|
<script type="module" src="${cdnUrl(interest)}" integrity="${interest.integrity}" crossorigin="anonymous"></script>`;
|
|
175
178
|
}
|
|
179
|
+
/** ` nonce="…"` for an inline script under a strict `script-src`, or nothing. */
|
|
180
|
+
function nonceAttr(nonce) {
|
|
181
|
+
return nonce ? ` nonce="${nonce.replace(/"/g, """)}"` : "";
|
|
182
|
+
}
|
|
176
183
|
/**
|
|
177
184
|
* The theme-persistence script. Runs inline (no `defer`) while the parser is
|
|
178
185
|
* still in `<head>`, so the `theme-*` switch lands on `<html>` before first paint. The
|
|
179
186
|
* try/catch covers contexts where storage access throws (sandboxed iframes,
|
|
180
187
|
* blocked site data).
|
|
181
188
|
*/
|
|
182
|
-
const
|
|
183
|
-
<script>
|
|
189
|
+
const themeScript = (nonce) => `<!-- Theme: apply the persisted (or preferred) scheme before first paint -->
|
|
190
|
+
<script${nonceAttr(nonce)}>
|
|
184
191
|
(() => {
|
|
185
192
|
try {
|
|
186
193
|
// A stored choice pins the scheme with the theme-dark / theme-light
|
|
@@ -209,7 +216,7 @@ const THEME_SCRIPT = `<!-- Theme: apply the persisted (or preferred) scheme befo
|
|
|
209
216
|
* buildHead({ base: "/zazz/src", scripts: false, fontDisplay: "optional" });
|
|
210
217
|
*/
|
|
211
218
|
export function buildHead(options = {}) {
|
|
212
|
-
const { base = "./zazz", cdn, scripts = true, fontDisplay = "swap", theme = true } = options;
|
|
219
|
+
const { base = "./zazz", cdn, scripts = true, fontDisplay = "swap", theme = true, nonce, } = options;
|
|
213
220
|
const parts = [
|
|
214
221
|
`<meta charset="utf-8">`,
|
|
215
222
|
`<meta name="viewport" content="width=device-width, initial-scale=1">`,
|
|
@@ -219,10 +226,10 @@ export function buildHead(options = {}) {
|
|
|
219
226
|
if (fontDisplay !== false)
|
|
220
227
|
parts.push(fontsBlock(fontDisplay));
|
|
221
228
|
if (cdn) {
|
|
222
|
-
parts.push(...cdnBlocks(cdn, scripts));
|
|
229
|
+
parts.push(...cdnBlocks(cdn, scripts, nonce));
|
|
223
230
|
}
|
|
224
231
|
else if (options.primitives) {
|
|
225
|
-
parts.push(...granularBlocks(options.primitives, (path) => `${base}/${path}`, () => "", scripts));
|
|
232
|
+
parts.push(...granularBlocks(options.primitives, (path) => `${base}/${path}`, () => "", scripts, {}, nonce));
|
|
226
233
|
}
|
|
227
234
|
else {
|
|
228
235
|
parts.push(`<!-- Zazz styles: one bundle (index.css @imports every layer in cascade order) -->`, `<link rel="stylesheet" href="${base}/index.css">`);
|
|
@@ -230,11 +237,11 @@ export function buildHead(options = {}) {
|
|
|
230
237
|
parts.push(
|
|
231
238
|
// The import map must precede EVERY module load — including the
|
|
232
239
|
// modulepreload hint — or the browser rejects it and bare specifiers fail.
|
|
233
|
-
importMapBlock(), `<link rel="modulepreload" href="${base}/index.js">`, polyfillsBlock(), `<!-- Zazz behavior: one ES module imports every component script in dependency order -->`, `<script type="module" src="${base}/index.js"></script>`);
|
|
240
|
+
importMapBlock({}, nonce), `<link rel="modulepreload" href="${base}/index.js">`, polyfillsBlock(), `<!-- Zazz behavior: one ES module imports every component script in dependency order -->`, `<script type="module" src="${base}/index.js"></script>`);
|
|
234
241
|
}
|
|
235
242
|
}
|
|
236
243
|
if (theme)
|
|
237
|
-
parts.push(
|
|
244
|
+
parts.push(themeScript(nonce));
|
|
238
245
|
return parts.join("\n");
|
|
239
246
|
}
|
|
240
247
|
// --- CDN mode ---
|
|
@@ -250,7 +257,7 @@ export function buildHead(options = {}) {
|
|
|
250
257
|
* @returns The head fragments between the fonts block and the theme script.
|
|
251
258
|
* @private
|
|
252
259
|
*/
|
|
253
|
-
function cdnBlocks(cdn, scripts) {
|
|
260
|
+
function cdnBlocks(cdn, scripts, nonce) {
|
|
254
261
|
const { version, primitives, sri } = cdn;
|
|
255
262
|
if (!EXACT_VERSION.test(version)) {
|
|
256
263
|
throw new Error(`CDN URLs must pin an exact version (got "${version}"); ` +
|
|
@@ -265,7 +272,7 @@ function cdnBlocks(cdn, scripts) {
|
|
|
265
272
|
if (!primitives) {
|
|
266
273
|
parts.push(`<!-- Zazz styles: the whole kit, one request -->`, `<link rel="stylesheet" href="${url("dist/zazz.css")}"${attrs("dist/zazz.css")}>`);
|
|
267
274
|
if (scripts) {
|
|
268
|
-
parts.push(importMapBlock(), `<link rel="modulepreload" href="${url("dist/zazz.js")}"${attrs("dist/zazz.js")}>`, polyfillsBlock(), `<!-- Zazz behavior: the whole kit, one module -->`, `<script type="module" src="${url("dist/zazz.js")}"${attrs("dist/zazz.js")}></script>`);
|
|
275
|
+
parts.push(importMapBlock({}, nonce), `<link rel="modulepreload" href="${url("dist/zazz.js")}"${attrs("dist/zazz.js")}>`, polyfillsBlock(), `<!-- Zazz behavior: the whole kit, one module -->`, `<script type="module" src="${url("dist/zazz.js")}"${attrs("dist/zazz.js")}></script>`);
|
|
269
276
|
}
|
|
270
277
|
return parts;
|
|
271
278
|
}
|
|
@@ -279,7 +286,7 @@ function cdnBlocks(cdn, scripts) {
|
|
|
279
286
|
transitive[url(`src/${path}`)] = hash;
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
|
-
return granularBlocks(primitives, (path) => url(`src/${path}`), (path) => attrs(`src/${path}`), scripts, transitive);
|
|
289
|
+
return granularBlocks(primitives, (path) => url(`src/${path}`), (path) => attrs(`src/${path}`), scripts, transitive, nonce);
|
|
283
290
|
}
|
|
284
291
|
/**
|
|
285
292
|
* @description The granular grain, local or CDN: base layers in cascade order,
|
|
@@ -293,7 +300,7 @@ function cdnBlocks(cdn, scripts) {
|
|
|
293
300
|
* @returns The head fragments between the fonts block and the theme script.
|
|
294
301
|
* @private
|
|
295
302
|
*/
|
|
296
|
-
function granularBlocks(primitives, url, attrs, scripts, transitive = {}) {
|
|
303
|
+
function granularBlocks(primitives, url, attrs, scripts, transitive = {}, nonce) {
|
|
297
304
|
const parts = [];
|
|
298
305
|
const closure = resolveClosure(primitives);
|
|
299
306
|
const css = [
|
|
@@ -317,7 +324,7 @@ function granularBlocks(primitives, url, attrs, scripts, transitive = {}) {
|
|
|
317
324
|
}),
|
|
318
325
|
]),
|
|
319
326
|
];
|
|
320
|
-
parts.push(importMapBlock(transitive), polyfillsBlock(), `<!-- Zazz behavior: side-effect modules by tag; the rest via module imports -->`, ...scriptFiles.map((path) => `<script type="module" src="${url(path)}"${attrs(path)}></script>`));
|
|
327
|
+
parts.push(importMapBlock(transitive, nonce), polyfillsBlock(), `<!-- Zazz behavior: side-effect modules by tag; the rest via module imports -->`, ...scriptFiles.map((path) => `<script type="module" src="${url(path)}"${attrs(path)}></script>`));
|
|
321
328
|
}
|
|
322
329
|
return parts;
|
|
323
330
|
}
|
package/src/head.ts
CHANGED
|
@@ -75,6 +75,9 @@ const CORE_RUNTIME_JS = [
|
|
|
75
75
|
"base/zazz-element.js",
|
|
76
76
|
// dynamically imported by index.js where container scroll-state queries are unsupported
|
|
77
77
|
"base/scroll-state.js",
|
|
78
|
+
// dynamically imported by index.js where the page's CSP blocks inline style attributes
|
|
79
|
+
"base/csp.js",
|
|
80
|
+
"base/declarations.js",
|
|
78
81
|
];
|
|
79
82
|
|
|
80
83
|
/**
|
|
@@ -176,7 +179,7 @@ function fontsBlock(display: "swap" | "optional"): string {
|
|
|
176
179
|
* @returns The import-map script tag.
|
|
177
180
|
* @private
|
|
178
181
|
*/
|
|
179
|
-
function importMapBlock(extraIntegrity: Record<string, string> = {}): string {
|
|
182
|
+
function importMapBlock(extraIntegrity: Record<string, string> = {}, nonce?: string): string {
|
|
180
183
|
const imports: Record<string, string> = {};
|
|
181
184
|
const integrity: Record<string, string> = { ...extraIntegrity };
|
|
182
185
|
for (const dep of ESM_DEPENDENCIES) {
|
|
@@ -186,7 +189,7 @@ function importMapBlock(extraIntegrity: Record<string, string> = {}): string {
|
|
|
186
189
|
}
|
|
187
190
|
const json = JSON.stringify({ imports, integrity }, null, 2);
|
|
188
191
|
return `<!-- Import map: bare specifiers in Zazz scripts resolve to pinned, SRI-checked files -->
|
|
189
|
-
<script type="importmap">
|
|
192
|
+
<script type="importmap"${nonceAttr(nonce)}>
|
|
190
193
|
${json}
|
|
191
194
|
</script>`;
|
|
192
195
|
}
|
|
@@ -205,14 +208,21 @@ function polyfillsBlock(): string {
|
|
|
205
208
|
<script type="module" src="${cdnUrl(interest)}" integrity="${interest.integrity}" crossorigin="anonymous"></script>`;
|
|
206
209
|
}
|
|
207
210
|
|
|
211
|
+
/** ` nonce="…"` for an inline script under a strict `script-src`, or nothing. */
|
|
212
|
+
function nonceAttr(nonce?: string): string {
|
|
213
|
+
return nonce ? ` nonce="${nonce.replace(/"/g, """)}"` : "";
|
|
214
|
+
}
|
|
215
|
+
|
|
208
216
|
/**
|
|
209
217
|
* The theme-persistence script. Runs inline (no `defer`) while the parser is
|
|
210
218
|
* still in `<head>`, so the `theme-*` switch lands on `<html>` before first paint. The
|
|
211
219
|
* try/catch covers contexts where storage access throws (sandboxed iframes,
|
|
212
220
|
* blocked site data).
|
|
213
221
|
*/
|
|
214
|
-
const
|
|
215
|
-
|
|
222
|
+
const themeScript = (
|
|
223
|
+
nonce?: string,
|
|
224
|
+
) => `<!-- Theme: apply the persisted (or preferred) scheme before first paint -->
|
|
225
|
+
<script${nonceAttr(nonce)}>
|
|
216
226
|
(() => {
|
|
217
227
|
try {
|
|
218
228
|
// A stored choice pins the scheme with the theme-dark / theme-light
|
|
@@ -272,6 +282,12 @@ export interface HeadOptions {
|
|
|
272
282
|
fontDisplay?: "swap" | "optional" | false;
|
|
273
283
|
/** Include the inline theme-persistence script (last in head). Default `true`. */
|
|
274
284
|
theme?: boolean;
|
|
285
|
+
/**
|
|
286
|
+
* A CSP nonce for the two inline scripts (the import map and the theme
|
|
287
|
+
* script), so a strict `script-src 'nonce-…'` allows them. The page's own
|
|
288
|
+
* value, generated per response; never a constant.
|
|
289
|
+
*/
|
|
290
|
+
nonce?: string;
|
|
275
291
|
/**
|
|
276
292
|
* Local granular grain: the primitives this page uses, loaded file by file
|
|
277
293
|
* from `base` (base layers, the closure's stylesheets in cascade order, one
|
|
@@ -295,7 +311,14 @@ export interface HeadOptions {
|
|
|
295
311
|
* buildHead({ base: "/zazz/src", scripts: false, fontDisplay: "optional" });
|
|
296
312
|
*/
|
|
297
313
|
export function buildHead(options: HeadOptions = {}): string {
|
|
298
|
-
const {
|
|
314
|
+
const {
|
|
315
|
+
base = "./zazz",
|
|
316
|
+
cdn,
|
|
317
|
+
scripts = true,
|
|
318
|
+
fontDisplay = "swap",
|
|
319
|
+
theme = true,
|
|
320
|
+
nonce,
|
|
321
|
+
} = options;
|
|
299
322
|
|
|
300
323
|
const parts: string[] = [
|
|
301
324
|
`<meta charset="utf-8">`,
|
|
@@ -307,7 +330,7 @@ export function buildHead(options: HeadOptions = {}): string {
|
|
|
307
330
|
if (fontDisplay !== false) parts.push(fontsBlock(fontDisplay));
|
|
308
331
|
|
|
309
332
|
if (cdn) {
|
|
310
|
-
parts.push(...cdnBlocks(cdn, scripts));
|
|
333
|
+
parts.push(...cdnBlocks(cdn, scripts, nonce));
|
|
311
334
|
} else if (options.primitives) {
|
|
312
335
|
parts.push(
|
|
313
336
|
...granularBlocks(
|
|
@@ -315,6 +338,8 @@ export function buildHead(options: HeadOptions = {}): string {
|
|
|
315
338
|
(path) => `${base}/${path}`,
|
|
316
339
|
() => "",
|
|
317
340
|
scripts,
|
|
341
|
+
{},
|
|
342
|
+
nonce,
|
|
318
343
|
),
|
|
319
344
|
);
|
|
320
345
|
} else {
|
|
@@ -327,7 +352,7 @@ export function buildHead(options: HeadOptions = {}): string {
|
|
|
327
352
|
parts.push(
|
|
328
353
|
// The import map must precede EVERY module load — including the
|
|
329
354
|
// modulepreload hint — or the browser rejects it and bare specifiers fail.
|
|
330
|
-
importMapBlock(),
|
|
355
|
+
importMapBlock({}, nonce),
|
|
331
356
|
`<link rel="modulepreload" href="${base}/index.js">`,
|
|
332
357
|
polyfillsBlock(),
|
|
333
358
|
`<!-- Zazz behavior: one ES module imports every component script in dependency order -->`,
|
|
@@ -336,7 +361,7 @@ export function buildHead(options: HeadOptions = {}): string {
|
|
|
336
361
|
}
|
|
337
362
|
}
|
|
338
363
|
|
|
339
|
-
if (theme) parts.push(
|
|
364
|
+
if (theme) parts.push(themeScript(nonce));
|
|
340
365
|
|
|
341
366
|
return parts.join("\n");
|
|
342
367
|
}
|
|
@@ -355,7 +380,7 @@ export function buildHead(options: HeadOptions = {}): string {
|
|
|
355
380
|
* @returns The head fragments between the fonts block and the theme script.
|
|
356
381
|
* @private
|
|
357
382
|
*/
|
|
358
|
-
function cdnBlocks(cdn: CdnHeadOptions, scripts: boolean): string[] {
|
|
383
|
+
function cdnBlocks(cdn: CdnHeadOptions, scripts: boolean, nonce?: string): string[] {
|
|
359
384
|
const { version, primitives, sri } = cdn;
|
|
360
385
|
if (!EXACT_VERSION.test(version)) {
|
|
361
386
|
throw new Error(
|
|
@@ -377,7 +402,7 @@ function cdnBlocks(cdn: CdnHeadOptions, scripts: boolean): string[] {
|
|
|
377
402
|
);
|
|
378
403
|
if (scripts) {
|
|
379
404
|
parts.push(
|
|
380
|
-
importMapBlock(),
|
|
405
|
+
importMapBlock({}, nonce),
|
|
381
406
|
`<link rel="modulepreload" href="${url("dist/zazz.js")}"${attrs("dist/zazz.js")}>`,
|
|
382
407
|
polyfillsBlock(),
|
|
383
408
|
`<!-- Zazz behavior: the whole kit, one module -->`,
|
|
@@ -402,6 +427,7 @@ function cdnBlocks(cdn: CdnHeadOptions, scripts: boolean): string[] {
|
|
|
402
427
|
(path) => attrs(`src/${path}`),
|
|
403
428
|
scripts,
|
|
404
429
|
transitive,
|
|
430
|
+
nonce,
|
|
405
431
|
);
|
|
406
432
|
}
|
|
407
433
|
|
|
@@ -423,6 +449,7 @@ function granularBlocks(
|
|
|
423
449
|
attrs: (path: string) => string,
|
|
424
450
|
scripts: boolean,
|
|
425
451
|
transitive: Record<string, string> = {},
|
|
452
|
+
nonce?: string,
|
|
426
453
|
): string[] {
|
|
427
454
|
const parts: string[] = [];
|
|
428
455
|
const closure = resolveClosure(primitives);
|
|
@@ -453,7 +480,7 @@ function granularBlocks(
|
|
|
453
480
|
]),
|
|
454
481
|
];
|
|
455
482
|
parts.push(
|
|
456
|
-
importMapBlock(transitive),
|
|
483
|
+
importMapBlock(transitive, nonce),
|
|
457
484
|
polyfillsBlock(),
|
|
458
485
|
`<!-- Zazz behavior: side-effect modules by tag; the rest via module imports -->`,
|
|
459
486
|
...scriptFiles.map(
|
package/src/index.js
CHANGED
|
@@ -38,3 +38,25 @@ import "./base/navigation.js";
|
|
|
38
38
|
if (typeof CSS !== "undefined" && !CSS.supports("container-type", "scroll-state")) {
|
|
39
39
|
void import("./base/scroll-state.js");
|
|
40
40
|
}
|
|
41
|
+
// A Content Security Policy that blocks inline style attributes leaves the
|
|
42
|
+
// attribute text in the DOM with an empty declaration block, and with it every
|
|
43
|
+
// utility unapplied; load the CSSOM fallback. A page that allows them
|
|
44
|
+
// (`style-src-attr 'unsafe-inline'`) never fetches it.
|
|
45
|
+
function blockedInlineStyles() {
|
|
46
|
+
for (const el of document.querySelectorAll("[style]")) {
|
|
47
|
+
const text = el.getAttribute("style");
|
|
48
|
+
if (text?.includes(":") && el.style.length === 0)
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (typeof document !== "undefined") {
|
|
54
|
+
const check = () => {
|
|
55
|
+
if (blockedInlineStyles())
|
|
56
|
+
void import("./base/csp.js");
|
|
57
|
+
};
|
|
58
|
+
if (document.readyState === "loading")
|
|
59
|
+
document.addEventListener("DOMContentLoaded", check);
|
|
60
|
+
else
|
|
61
|
+
check();
|
|
62
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -40,3 +40,22 @@ import "./base/navigation.ts";
|
|
|
40
40
|
if (typeof CSS !== "undefined" && !CSS.supports("container-type", "scroll-state")) {
|
|
41
41
|
void import("./base/scroll-state.ts");
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
// A Content Security Policy that blocks inline style attributes leaves the
|
|
45
|
+
// attribute text in the DOM with an empty declaration block, and with it every
|
|
46
|
+
// utility unapplied; load the CSSOM fallback. A page that allows them
|
|
47
|
+
// (`style-src-attr 'unsafe-inline'`) never fetches it.
|
|
48
|
+
function blockedInlineStyles(): boolean {
|
|
49
|
+
for (const el of document.querySelectorAll("[style]")) {
|
|
50
|
+
const text = el.getAttribute("style");
|
|
51
|
+
if (text?.includes(":") && (el as HTMLElement).style.length === 0) return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (typeof document !== "undefined") {
|
|
56
|
+
const check = () => {
|
|
57
|
+
if (blockedInlineStyles()) void import("./base/csp.ts");
|
|
58
|
+
};
|
|
59
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", check);
|
|
60
|
+
else check();
|
|
61
|
+
}
|
package/src/manifest.d.ts
CHANGED
|
@@ -87,9 +87,29 @@ export interface RuntimePolyfill {
|
|
|
87
87
|
/**
|
|
88
88
|
* Polyfills `index.ts` imports dynamically behind a `CSS.supports` test, so a
|
|
89
89
|
* browser with the feature never fetches them. Vendored with the core runtime;
|
|
90
|
-
* an entry script loads each one the way `index.ts` does.
|
|
90
|
+
* an entry script loads each one the way `index.ts` does. Every entry has a
|
|
91
|
+
* `supports` pair: the published CLI drops the whole list when one does not.
|
|
91
92
|
*/
|
|
92
93
|
export declare const CORE_POLYFILLS: RuntimePolyfill[];
|
|
94
|
+
/** A runtime fallback, loaded only where a document check (not a CSS feature) says the page needs it. */
|
|
95
|
+
export interface RuntimeFallback {
|
|
96
|
+
/** The script, `src/`-relative. */
|
|
97
|
+
file: string;
|
|
98
|
+
/** Scripts it imports, `src/`-relative, vendored with it. */
|
|
99
|
+
requires: string[];
|
|
100
|
+
/**
|
|
101
|
+
* The check an entry script runs before importing it. `blocked-inline-styles`:
|
|
102
|
+
* some element's `style` attribute holds a declaration while its declaration
|
|
103
|
+
* block is empty, the shape of an attribute a Content Security Policy blocked.
|
|
104
|
+
*/
|
|
105
|
+
gate: "blocked-inline-styles";
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Fallbacks `index.ts` imports dynamically behind a document check, so a page
|
|
109
|
+
* that does not need one never fetches it. Vendored with the core runtime by a
|
|
110
|
+
* CLI that knows the gate; an older CLI ignores the list.
|
|
111
|
+
*/
|
|
112
|
+
export declare const CORE_FALLBACKS: RuntimeFallback[];
|
|
93
113
|
/** Every tag form in the kit; the generator excludes them from no-base emissions. */
|
|
94
114
|
export declare const TAG_FORMS: string[];
|
|
95
115
|
export declare const CSS_CASCADE_ORDER: string[];
|
package/src/manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["manifest.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAIlC,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,qDAAqD;IACrD,EAAE,EAAE,MAAM,EAAE,CAAC;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0EAA0E;IAC1E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,uDAAuD;IACvD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,uGAAuG;IACvG,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAgBD;;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rF,eAAO,MAAM,SAAS,EAAE,MAAM,EAErB,CAAC;AAEV,eAAO,MAAM,iBAAiB,EAAE,MAAM,EA0CrC,CAAC;AAIF;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAoBxD;AAID,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,UAAU,GACV,SAAS,GACT,iBAAiB,GACjB,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,GACb,KAAK,GACL,UAAU,GACV,MAAM,GACN,SAAS,CAAC;AAEd;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC,CAmC/E,CAAC"}
|
package/src/manifest.js
CHANGED
|
@@ -618,11 +618,20 @@ export const CORE_RUNTIME = [
|
|
|
618
618
|
/**
|
|
619
619
|
* Polyfills `index.ts` imports dynamically behind a `CSS.supports` test, so a
|
|
620
620
|
* browser with the feature never fetches them. Vendored with the core runtime;
|
|
621
|
-
* an entry script loads each one the way `index.ts` does.
|
|
621
|
+
* an entry script loads each one the way `index.ts` does. Every entry has a
|
|
622
|
+
* `supports` pair: the published CLI drops the whole list when one does not.
|
|
622
623
|
*/
|
|
623
624
|
export const CORE_POLYFILLS = [
|
|
624
625
|
{ file: "base/scroll-state.js", supports: ["container-type", "scroll-state"] },
|
|
625
626
|
];
|
|
627
|
+
/**
|
|
628
|
+
* Fallbacks `index.ts` imports dynamically behind a document check, so a page
|
|
629
|
+
* that does not need one never fetches it. Vendored with the core runtime by a
|
|
630
|
+
* CLI that knows the gate; an older CLI ignores the list.
|
|
631
|
+
*/
|
|
632
|
+
export const CORE_FALLBACKS = [
|
|
633
|
+
{ file: "base/csp.js", requires: ["base/declarations.js"], gate: "blocked-inline-styles" },
|
|
634
|
+
];
|
|
626
635
|
/** Every tag form in the kit; the generator excludes them from no-base emissions. */
|
|
627
636
|
export const TAG_FORMS = Object.values(PRIMITIVES)
|
|
628
637
|
.flatMap((entry) => entry.tags ?? [])
|
package/src/manifest.ts
CHANGED
|
@@ -667,12 +667,36 @@ export interface RuntimePolyfill {
|
|
|
667
667
|
/**
|
|
668
668
|
* Polyfills `index.ts` imports dynamically behind a `CSS.supports` test, so a
|
|
669
669
|
* browser with the feature never fetches them. Vendored with the core runtime;
|
|
670
|
-
* an entry script loads each one the way `index.ts` does.
|
|
670
|
+
* an entry script loads each one the way `index.ts` does. Every entry has a
|
|
671
|
+
* `supports` pair: the published CLI drops the whole list when one does not.
|
|
671
672
|
*/
|
|
672
673
|
export const CORE_POLYFILLS: RuntimePolyfill[] = [
|
|
673
674
|
{ file: "base/scroll-state.js", supports: ["container-type", "scroll-state"] },
|
|
674
675
|
];
|
|
675
676
|
|
|
677
|
+
/** A runtime fallback, loaded only where a document check (not a CSS feature) says the page needs it. */
|
|
678
|
+
export interface RuntimeFallback {
|
|
679
|
+
/** The script, `src/`-relative. */
|
|
680
|
+
file: string;
|
|
681
|
+
/** Scripts it imports, `src/`-relative, vendored with it. */
|
|
682
|
+
requires: string[];
|
|
683
|
+
/**
|
|
684
|
+
* The check an entry script runs before importing it. `blocked-inline-styles`:
|
|
685
|
+
* some element's `style` attribute holds a declaration while its declaration
|
|
686
|
+
* block is empty, the shape of an attribute a Content Security Policy blocked.
|
|
687
|
+
*/
|
|
688
|
+
gate: "blocked-inline-styles";
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Fallbacks `index.ts` imports dynamically behind a document check, so a page
|
|
693
|
+
* that does not need one never fetches it. Vendored with the core runtime by a
|
|
694
|
+
* CLI that knows the gate; an older CLI ignores the list.
|
|
695
|
+
*/
|
|
696
|
+
export const CORE_FALLBACKS: RuntimeFallback[] = [
|
|
697
|
+
{ file: "base/csp.js", requires: ["base/declarations.js"], gate: "blocked-inline-styles" },
|
|
698
|
+
];
|
|
699
|
+
|
|
676
700
|
/** Every tag form in the kit; the generator excludes them from no-base emissions. */
|
|
677
701
|
export const TAG_FORMS: string[] = Object.values(PRIMITIVES)
|
|
678
702
|
.flatMap((entry) => entry.tags ?? [])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** A stable name per finding, so a linter can switch each one off. */
|
|
2
|
-
export type RuleId = "unknown-utility" | "pseudo-form" | "group-needs-state" | "border-value" | "not-integer" | "tier-unsupported" | "tier-without-base" | "dual-value" | "keyword-number" | "raw-shadows-utility" | "flattens-state" | "gradient-incomplete" | "font-weight-name" | "scroll-state" | "whitespace-before-colon" | "attribute-outside-identity" | "field-id-or-name" | "persist";
|
|
2
|
+
export type RuleId = "unknown-utility" | "pseudo-form" | "group-needs-state" | "border-value" | "not-integer" | "tier-unsupported" | "tier-without-base" | "dual-value" | "keyword-number" | "raw-shadows-utility" | "flattens-state" | "gradient-incomplete" | "font-weight-name" | "scroll-state" | "whitespace-before-colon" | "whitespace-after-colon" | "attribute-outside-identity" | "field-id-or-name" | "persist";
|
|
3
3
|
export declare const RULE_IDS: readonly RuleId[];
|
|
4
4
|
/** `[start, end)` offsets into the `style` attribute's value. */
|
|
5
5
|
export type Span = [number, number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-core.d.ts","sourceRoot":"","sources":["audit-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"audit-core.d.ts","sourceRoot":"","sources":["audit-core.ts"],"names":[],"mappings":"AA0BA,sEAAsE;AACtE,MAAM,MAAM,MAAM,GACd,iBAAiB,GACjB,aAAa,GACb,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,kBAAkB,GAClB,mBAAmB,GACnB,YAAY,GACZ,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,kBAAkB,GAClB,cAAc,GACd,yBAAyB,GACzB,wBAAwB,GACxB,4BAA4B,GAC5B,kBAAkB,GAClB,SAAS,CAAC;AAEd,e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