@slotted/theme 0.1.0-beta.10 → 0.1.0-beta.11
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.
|
@@ -30,7 +30,7 @@ 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. */
|
|
33
|
+
/** The OKLab lightness step a dark scheme's raised layer keeps above the page, unless `thresholds.layerStep` says. */
|
|
34
34
|
const LAYER_STEP = 0.04;
|
|
35
35
|
|
|
36
36
|
/** The collapsed duration is short enough to read as instant, and never zero. */
|
|
@@ -207,8 +207,9 @@ function structureCases(contract, theme, css) {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
function contrastCases(theme) {
|
|
210
|
+
function contrastCases(theme, thresholds) {
|
|
211
211
|
const label = theme.name;
|
|
212
|
+
const layerStep = thresholds.layerStep ?? LAYER_STEP;
|
|
212
213
|
|
|
213
214
|
/**
|
|
214
215
|
* One radius for every control, at every size. Button carried three of its
|
|
@@ -281,8 +282,8 @@ function contrastCases(theme) {
|
|
|
281
282
|
parseSeed(values['--slotted-surface-raised']).l -
|
|
282
283
|
parseSeed(values['--slotted-surface']).l;
|
|
283
284
|
assert.ok(
|
|
284
|
-
step >=
|
|
285
|
-
`${scheme} --slotted-surface-raised is ${step.toFixed(3)} above --slotted-surface, below ${
|
|
285
|
+
step >= layerStep,
|
|
286
|
+
`${scheme} --slotted-surface-raised is ${step.toFixed(3)} above --slotted-surface, below ${layerStep} (thresholds.layerStep)`,
|
|
286
287
|
);
|
|
287
288
|
});
|
|
288
289
|
}
|
|
@@ -464,9 +465,13 @@ function glyphCases(contract, theme) {
|
|
|
464
465
|
});
|
|
465
466
|
}
|
|
466
467
|
|
|
467
|
-
/**
|
|
468
|
-
|
|
468
|
+
/**
|
|
469
|
+
* Registers every case a theme has to pass. `theme` is `flattenTheme(theme)`;
|
|
470
|
+
* `css` is `renderTheme(theme)`. `thresholds.layerStep` is the OKLab lightness
|
|
471
|
+
* a dark scheme's raised layer keeps above the page, 0.04 unless given.
|
|
472
|
+
*/
|
|
473
|
+
export function themeConformance({ contract, theme, css, thresholds = {} }) {
|
|
469
474
|
structureCases(contract, theme, css);
|
|
470
|
-
contrastCases(theme);
|
|
475
|
+
contrastCases(theme, thresholds);
|
|
471
476
|
glyphCases(contract, theme);
|
|
472
477
|
}
|