@zazz-ui/core 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORING.md +2 -2
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/dist/sri.json +48 -46
- package/dist/zazz.css +1 -1
- package/editor/zazz.css-data.json +312 -24
- package/editor/zazz.language-data.json +9 -9
- package/editor/zazz.lint-data.json +2028 -0
- package/package.json +1 -1
- package/src/base/_defaults.css +367 -0
- package/src/base/_layers.css +6 -2
- package/src/base/_properties-2xl.css +8 -2
- package/src/base/_properties-active.css +12 -0
- package/src/base/_properties-checked.css +12 -0
- package/src/base/_properties-current.css +12 -0
- package/src/base/_properties-disabled.css +12 -0
- package/src/base/_properties-focus-visible.css +12 -0
- package/src/base/_properties-focus-within.css +12 -0
- package/src/base/_properties-hover.css +12 -0
- package/src/base/_properties-lg.css +8 -2
- package/src/base/_properties-md.css +8 -2
- package/src/base/_properties-open.css +12 -0
- package/src/base/_properties-sm.css +8 -2
- package/src/base/_properties-starting.css +6 -0
- package/src/base/_properties-stuck.css +6 -0
- package/src/base/_properties-xl.css +8 -2
- package/src/base/_properties.css +12 -3
- package/src/base/_utilities-box.css +0 -15
- package/src/base/_utilities-color.css +0 -3
- package/src/base/_utilities-effects.css +0 -15
- package/src/base/_utilities-flow.css +79 -68
- package/src/base/_utilities-grid.css +20 -32
- package/src/base/_utilities-sizing.css +0 -3
- package/src/base/_utilities-spacing.css +24 -34
- package/src/base/_utilities-tier-2xl.css +4 -1
- package/src/base/_utilities-tier-active.css +6 -0
- package/src/base/_utilities-tier-checked.css +6 -0
- package/src/base/_utilities-tier-current.css +6 -0
- package/src/base/_utilities-tier-disabled.css +6 -0
- package/src/base/_utilities-tier-focus-visible.css +6 -0
- package/src/base/_utilities-tier-focus-within.css +6 -0
- package/src/base/_utilities-tier-hover.css +6 -0
- package/src/base/_utilities-tier-lg.css +4 -1
- package/src/base/_utilities-tier-md.css +4 -1
- package/src/base/_utilities-tier-open.css +6 -0
- package/src/base/_utilities-tier-sm.css +4 -1
- package/src/base/_utilities-tier-starting.css +3 -0
- package/src/base/_utilities-tier-stuck.css +3 -0
- package/src/base/_utilities-tier-xl.css +4 -1
- package/src/base/_utilities-typography.css +0 -9
- package/src/base/kit-styling.d.ts +11 -0
- package/src/base/kit-styling.d.ts.map +1 -0
- package/src/base/kit-styling.js +467 -0
- package/src/base/kit-styling.ts +470 -0
- package/src/base/utilities.d.ts +14 -6
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +65 -31
- package/src/base/utilities.ts +69 -37
- package/src/index.css +1 -0
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +2 -1
- package/src/manifest.ts +2 -1
- package/src/primitives/debug/audit-core.d.ts +8 -0
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +24 -4
- package/src/primitives/debug/audit-core.ts +42 -3
- package/src/primitives/debug/debug.d.ts +0 -15
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +11 -2
- package/src/primitives/debug/debug.ts +12 -1
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview `<ui-debug>`: audits utilities in `style` attributes.
|
|
3
|
-
* @description Development only. On a listed domain the element walks every
|
|
4
|
-
* element once, and again on mutation, and warns about the mistakes the
|
|
5
|
-
* generated gates cannot report: an unknown utility, a wrong mode, a tier without
|
|
6
|
-
* a base, a modifier the family lacks, a base utility that flattens a state a
|
|
7
|
-
* primitive's hook covers, a raw property shadowing a utility, a
|
|
8
|
-
* whitespace form the gates cannot match, and a `data-<name>-*` attribute
|
|
9
|
-
* outside its identity. On an unlisted domain it removes itself and logs
|
|
10
|
-
* {@link DEBUG_WARNING} once. Identities and hooks are read from the page's
|
|
11
|
-
* stylesheets, so the audit needs no manifest. The checks live in
|
|
12
|
-
* `audit-core.ts`, which the html lint rules (`@zazz-ui/eslint-plugin`) share.
|
|
13
|
-
* @example
|
|
14
|
-
* <ui-debug data-debug-domains="localhost, staging.example.com"></ui-debug>
|
|
15
|
-
*/
|
|
16
1
|
import { ZazzElement } from "../../base/zazz-element.ts";
|
|
17
2
|
import { type RuleId } from "./audit-core.ts";
|
|
18
3
|
export interface Warning {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["debug.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAqB,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,OAAO,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,+GAA+G;IAC/G,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjC,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AA+CD,8EAA8E;AAC9E,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,EAAE,CAmB1E;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAyCtF;AAED,eAAO,MAAM,aAAa,8KACiJ,CAAC;AAI5K,cAAM,OAAQ,SAAQ,WAAW;IAC/B,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAgDzC;CACF;AAID,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
* @example
|
|
15
15
|
* <ui-debug data-debug-domains="localhost, staging.example.com"></ui-debug>
|
|
16
16
|
*/
|
|
17
|
+
import { KIT_SELECTORS, TIER_BLOCKS, TIER_READS } from "../../base/kit-styling.js";
|
|
17
18
|
import { ZazzElement, defineZazzElement } from "../../base/zazz-element.js";
|
|
18
|
-
import { auditNode, auditPersistence, carriesIdentity, } from "./audit-core.js";
|
|
19
|
+
import { auditNode, auditPersistence, carriesIdentity, expandStyling, } from "./audit-core.js";
|
|
19
20
|
/** A live element as the audit core reads it. */
|
|
20
21
|
function auditNodeOf(el) {
|
|
21
22
|
return {
|
|
@@ -29,8 +30,11 @@ function auditNodeOf(el) {
|
|
|
29
30
|
}
|
|
30
31
|
return false;
|
|
31
32
|
},
|
|
33
|
+
matches: (selector) => el.matches(selector),
|
|
32
34
|
};
|
|
33
35
|
}
|
|
36
|
+
const READS = expandStyling(KIT_SELECTORS, TIER_READS);
|
|
37
|
+
const BLOCKS = expandStyling(KIT_SELECTORS, TIER_BLOCKS);
|
|
34
38
|
/** Identity tokens and state-bearing hooks, read from the page's stylesheets. */
|
|
35
39
|
function fromStylesheets() {
|
|
36
40
|
const identities = new Set();
|
|
@@ -64,7 +68,12 @@ export function audit(root, options = {}) {
|
|
|
64
68
|
hooks: options.hooks ?? sheets.hooks,
|
|
65
69
|
identities: options.identities ?? sheets.identities,
|
|
66
70
|
};
|
|
67
|
-
const context = {
|
|
71
|
+
const context = {
|
|
72
|
+
...resolved,
|
|
73
|
+
reads: READS,
|
|
74
|
+
blocks: BLOCKS,
|
|
75
|
+
isColor: (value) => CSS.supports("color", value),
|
|
76
|
+
};
|
|
68
77
|
const found = [];
|
|
69
78
|
for (const el of [root, ...root.querySelectorAll("*")]) {
|
|
70
79
|
if (el.tagName === "UI-DEBUG")
|
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
* <ui-debug data-debug-domains="localhost, staging.example.com"></ui-debug>
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { KIT_SELECTORS, TIER_BLOCKS, TIER_READS } from "../../base/kit-styling.ts";
|
|
19
20
|
import { ZazzElement, defineZazzElement } from "../../base/zazz-element.ts";
|
|
20
21
|
import {
|
|
21
22
|
auditNode,
|
|
22
23
|
auditPersistence,
|
|
23
24
|
carriesIdentity,
|
|
25
|
+
expandStyling,
|
|
24
26
|
type AuditNode,
|
|
25
27
|
type RuleId,
|
|
26
28
|
} from "./audit-core.ts";
|
|
@@ -51,9 +53,13 @@ function auditNodeOf(el: Element): AuditNode {
|
|
|
51
53
|
}
|
|
52
54
|
return false;
|
|
53
55
|
},
|
|
56
|
+
matches: (selector) => el.matches(selector),
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
const READS = expandStyling(KIT_SELECTORS, TIER_READS);
|
|
61
|
+
const BLOCKS = expandStyling(KIT_SELECTORS, TIER_BLOCKS);
|
|
62
|
+
|
|
57
63
|
/** Identity tokens and state-bearing hooks, read from the page's stylesheets. */
|
|
58
64
|
function fromStylesheets(): { identities: string[]; hooks: Record<string, string[]> } {
|
|
59
65
|
const identities = new Set<string>();
|
|
@@ -86,7 +92,12 @@ export function audit(root: Element, options: AuditOptions = {}): Warning[] {
|
|
|
86
92
|
hooks: options.hooks ?? sheets!.hooks,
|
|
87
93
|
identities: options.identities ?? sheets!.identities,
|
|
88
94
|
};
|
|
89
|
-
const context = {
|
|
95
|
+
const context = {
|
|
96
|
+
...resolved,
|
|
97
|
+
reads: READS,
|
|
98
|
+
blocks: BLOCKS,
|
|
99
|
+
isColor: (value: string) => CSS.supports("color", value),
|
|
100
|
+
};
|
|
90
101
|
const found: Warning[] = [];
|
|
91
102
|
for (const el of [root, ...root.querySelectorAll("*")]) {
|
|
92
103
|
if (el.tagName === "UI-DEBUG") continue;
|