@servicetitan/hammer-token 3.0.0 → 3.0.1
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 +6 -0
- package/build/web/core/css-utils/a2-border.css +0 -30
- package/build/web/core/css-utils/a2-color.css +0 -228
- package/build/web/core/css-utils/a2-font.css +1 -27
- package/build/web/core/css-utils/a2-spacing.css +1 -244
- package/build/web/core/css-utils/a2-utils.css +0 -505
- package/build/web/core/css-utils/border.css +0 -30
- package/build/web/core/css-utils/color.css +0 -228
- package/build/web/core/css-utils/font.css +1 -27
- package/build/web/core/css-utils/spacing.css +1 -244
- package/build/web/core/css-utils/utils.css +0 -505
- package/package.json +1 -1
- package/src/theme/core/component/field-message.tokens.json +3 -12
- package/src/utils/__tests__/sd-formats.test.js +10 -18
- package/src/utils/sd-formats.js +4 -21
|
@@ -85,7 +85,7 @@ describe("registerFormats", () => {
|
|
|
85
85
|
// ---------------------------------------------------------------------------
|
|
86
86
|
|
|
87
87
|
describe("buildCssUtilsOutput structure (via Fonts format)", () => {
|
|
88
|
-
it("output
|
|
88
|
+
it("output does not include cascade @layer wrappers", () => {
|
|
89
89
|
const format = sd._formats["custom/CSSUtils/Fonts"];
|
|
90
90
|
const dict = makeDictionary([
|
|
91
91
|
makeToken({
|
|
@@ -94,15 +94,7 @@ describe("buildCssUtilsOutput structure (via Fonts format)", () => {
|
|
|
94
94
|
}),
|
|
95
95
|
]);
|
|
96
96
|
const output = format({ dictionary: dict });
|
|
97
|
-
expect(output).toContain("@layer");
|
|
98
|
-
expect(output).toContain("starter");
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it("output contains @layer application block", () => {
|
|
102
|
-
const format = sd._formats["custom/CSSUtils/Fonts"];
|
|
103
|
-
const dict = makeDictionary([]);
|
|
104
|
-
const output = format({ dictionary: dict });
|
|
105
|
-
expect(output).toContain("@layer application");
|
|
97
|
+
expect(output).not.toContain("@layer");
|
|
106
98
|
});
|
|
107
99
|
|
|
108
100
|
it("does NOT include @supports block when no dark-aware classes", () => {
|
|
@@ -405,10 +397,10 @@ describe("custom/scss-variables — $description comments", () => {
|
|
|
405
397
|
describe("custom/CSSUtils/Colors", () => {
|
|
406
398
|
const format = () => sd._formats["custom/CSSUtils/Colors"];
|
|
407
399
|
|
|
408
|
-
it("output
|
|
400
|
+
it("output does not include cascade @layer wrappers", () => {
|
|
409
401
|
const dict = makeDictionary([]);
|
|
410
402
|
const output = format()({ dictionary: dict });
|
|
411
|
-
expect(output).toContain("@layer");
|
|
403
|
+
expect(output).not.toContain("@layer");
|
|
412
404
|
});
|
|
413
405
|
|
|
414
406
|
it("generates .bg-* class for background-color tokens", () => {
|
|
@@ -448,10 +440,10 @@ describe("custom/CSSUtils/Colors", () => {
|
|
|
448
440
|
describe("custom/CSSUtils/Borders", () => {
|
|
449
441
|
const format = () => sd._formats["custom/CSSUtils/Borders"];
|
|
450
442
|
|
|
451
|
-
it("output
|
|
443
|
+
it("output does not include cascade @layer wrappers", () => {
|
|
452
444
|
const dict = makeDictionary([]);
|
|
453
445
|
const output = format()({ dictionary: dict });
|
|
454
|
-
expect(output).toContain("@layer");
|
|
446
|
+
expect(output).not.toContain("@layer");
|
|
455
447
|
});
|
|
456
448
|
|
|
457
449
|
it("generates border-radius class", () => {
|
|
@@ -493,10 +485,10 @@ describe("custom/CSSUtils/Borders", () => {
|
|
|
493
485
|
describe("custom/CSSUtils/Spacing", () => {
|
|
494
486
|
const format = () => sd._formats["custom/CSSUtils/Spacing"];
|
|
495
487
|
|
|
496
|
-
it("output
|
|
488
|
+
it("output does not include cascade @layer wrappers", () => {
|
|
497
489
|
const dict = makeDictionary([]);
|
|
498
490
|
const output = format()({ dictionary: dict });
|
|
499
|
-
expect(output).toContain("@layer");
|
|
491
|
+
expect(output).not.toContain("@layer");
|
|
500
492
|
});
|
|
501
493
|
|
|
502
494
|
it("generates spacing classes for size tokens", () => {
|
|
@@ -535,10 +527,10 @@ describe("custom/CSSUtils/Spacing", () => {
|
|
|
535
527
|
describe("custom/CSSUtils/All", () => {
|
|
536
528
|
const format = () => sd._formats["custom/CSSUtils/All"];
|
|
537
529
|
|
|
538
|
-
it("output
|
|
530
|
+
it("output does not include cascade @layer wrappers", () => {
|
|
539
531
|
const dict = makeDictionary([]);
|
|
540
532
|
const output = format()({ dictionary: dict });
|
|
541
|
-
expect(output).toContain("@layer");
|
|
533
|
+
expect(output).not.toContain("@layer");
|
|
542
534
|
});
|
|
543
535
|
|
|
544
536
|
it("includes .sr-only utility class", () => {
|
package/src/utils/sd-formats.js
CHANGED
|
@@ -25,33 +25,17 @@ const {
|
|
|
25
25
|
} = require("./token-helpers");
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* Builds the CSS utils output string with
|
|
29
|
-
* Creates a structured CSS output with fallback classes and dark-aware variants.
|
|
28
|
+
* Builds the CSS utils output string with optional `@supports` blocks for dark-aware utilities.
|
|
30
29
|
* @param {string} fallback - The fallback CSS classes (light mode only)
|
|
31
30
|
* @param {string} [darkAwareClasses=''] - The dark-aware CSS classes with light-dark()
|
|
32
|
-
* @returns {string}
|
|
31
|
+
* @returns {string} Flat CSS output (no cascade layers — Anvil 3.0 dropped layered component CSS).
|
|
33
32
|
*/
|
|
34
|
-
const buildCssUtilsOutput = (
|
|
35
|
-
fallback,
|
|
36
|
-
darkAwareClasses = "",
|
|
37
|
-
indent = " ",
|
|
38
|
-
) => {
|
|
39
|
-
const i = indent;
|
|
40
|
-
const i2 = i + " ";
|
|
33
|
+
const buildCssUtilsOutput = (fallback, darkAwareClasses = "") => {
|
|
41
34
|
const supportsBlock = darkAwareClasses
|
|
42
35
|
? `\n@supports (color: light-dark(#fff, #000)) {\n ${darkAwareClasses.replaceAll("\n", "\n ")}\n}`
|
|
43
36
|
: "";
|
|
44
|
-
const supportsBlockNested = darkAwareClasses
|
|
45
|
-
? `\n${i}@supports (color: light-dark(#fff, #000)) {\n${i2}${darkAwareClasses.replaceAll("\n", `\n${i2}`)}\n${i}}`
|
|
46
|
-
: "";
|
|
47
|
-
|
|
48
|
-
return `@layer starter, reset, base, state, application;
|
|
49
|
-
|
|
50
|
-
${fallback}${supportsBlock}
|
|
51
37
|
|
|
52
|
-
|
|
53
|
-
${i}${fallback.replaceAll("\n", `\n${i}`)}${supportsBlockNested}
|
|
54
|
-
}`;
|
|
38
|
+
return `${fallback}${supportsBlock}`;
|
|
55
39
|
};
|
|
56
40
|
|
|
57
41
|
/**
|
|
@@ -177,7 +161,6 @@ const registerCssUtilsFormats = (
|
|
|
177
161
|
return buildCssUtilsOutput(
|
|
178
162
|
`${withSr}\n${colorFallbackTokens}\n`,
|
|
179
163
|
colorTokens,
|
|
180
|
-
" ",
|
|
181
164
|
);
|
|
182
165
|
},
|
|
183
166
|
});
|