@slotted/theme 0.1.0-beta.1 → 0.1.0-beta.10
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/conformance/theme-conformance.mjs +21 -1
- package/dist/index.js +2475 -651
- package/dist/{seeds-x76IGbQO.js → seeds-CaieGmB9.js} +1 -0
- package/dist/seeds.js +1 -1
- package/dist/types/contract-types.d.ts +2 -0
- package/dist/types/gamut.d.ts +37 -0
- package/dist/types/generated/contract.d.ts +4 -4
- package/dist/types/index.d.ts +2 -0
- package/dist/types/recipe.d.ts +8 -2
- package/dist/types/seeds.d.ts +1 -1
- package/dist/types/token-groups.d.ts +21 -0
- package/package.json +1 -1
- package/src/contract.json +716 -0
|
@@ -10,7 +10,7 @@ import { LAYER_ORDER_STATEMENT, parseSeed, resolveTokens } from '../dist/index.j
|
|
|
10
10
|
* that is the theme's identity, and it belongs to the theme's own tests.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
const VARIANTS = ['accent', 'secondary', 'success', 'warning', 'danger'];
|
|
13
|
+
const VARIANTS = ['accent', 'secondary', 'success', 'info', 'warning', 'danger'];
|
|
14
14
|
const SOLID_STATES = ['solid', 'solid-hover', 'solid-active'];
|
|
15
15
|
const SURFACES = ['--slotted-surface', '--slotted-surface-raised', '--slotted-surface-sunken'];
|
|
16
16
|
|
|
@@ -30,6 +30,8 @@ const NON_TEXT_RATIO = 3;
|
|
|
30
30
|
const CONTROL_EDGE_RATIO = 1.5;
|
|
31
31
|
/** The OKLab lightness step a neutral highlight keeps from the ground it is drawn on. */
|
|
32
32
|
const HIGHLIGHT_STEP = 0.02;
|
|
33
|
+
/** The OKLab lightness step a dark scheme's raised layer keeps above the page. */
|
|
34
|
+
const LAYER_STEP = 0.04;
|
|
33
35
|
|
|
34
36
|
/** The collapsed duration is short enough to read as instant, and never zero. */
|
|
35
37
|
const MAX_REDUCED_MOTION_MS = 1;
|
|
@@ -267,6 +269,24 @@ function contrastCases(theme) {
|
|
|
267
269
|
}
|
|
268
270
|
});
|
|
269
271
|
|
|
272
|
+
/**
|
|
273
|
+
* A card, a menu or a dialog is a layer over the page. In a light scheme
|
|
274
|
+
* its shadow separates it; in a dark scheme a shadow on a dark ground does
|
|
275
|
+
* not read, and the layer has to stand lighter than the page. At 0.017 in
|
|
276
|
+
* OKLab lightness a card read apart only by its border.
|
|
277
|
+
*/
|
|
278
|
+
if (scheme === 'dark') {
|
|
279
|
+
test(`${label} ${scheme} raises a layer visibly above the page`, () => {
|
|
280
|
+
const step =
|
|
281
|
+
parseSeed(values['--slotted-surface-raised']).l -
|
|
282
|
+
parseSeed(values['--slotted-surface']).l;
|
|
283
|
+
assert.ok(
|
|
284
|
+
step >= LAYER_STEP,
|
|
285
|
+
`${scheme} --slotted-surface-raised is ${step.toFixed(3)} above --slotted-surface, below ${LAYER_STEP}`,
|
|
286
|
+
);
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
270
290
|
test(`${label} ${scheme} inverts a surface without losing its text`, () => {
|
|
271
291
|
assert.ok(
|
|
272
292
|
contrast(values['--slotted-surface-inverse'], values['--slotted-text-inverse']) >= required,
|