@slotted/theme 0.1.0-beta.0 → 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.
@@ -3,6 +3,8 @@ export type { Luminance, Oklch } from './color';
3
3
  export { LAYER_NAMES, LAYER_ORDER_STATEMENT } from './layer-order';
4
4
  export { applyBounds, boundCss, boundValue, fitBound } from './bound';
5
5
  export type { Bound } from './bound';
6
+ export { fitGamut, gamutChroma, limitedChroma } from './gamut';
7
+ export type { ChromaLimit } from './gamut';
6
8
  export { derivationCss, evaluateRecipe, SCHEMES, SEED_NAMES } from './recipe';
7
9
  export type { AliasDerivation, Derivation, MixDerivation, Recipe, Scheme, SeedDerivation, SeedName, } from './recipe';
8
10
  export { checkScheme, CONTRAST_REQUIREMENT, seedGrid } from './recipe-checks';
@@ -1,10 +1,16 @@
1
1
  import { type Bound } from './bound';
2
2
  import type { Oklch } from './color';
3
+ import { type ChromaLimit } from './gamut';
3
4
  import { SEED_NAMES, type SeedName } from './seeds';
4
5
  export { SEED_NAMES, type SeedName };
5
6
  export declare const SCHEMES: readonly ["light", "dark", "high-contrast"];
6
7
  export type Scheme = (typeof SCHEMES)[number];
7
- /** A colour taken from a seed: fixed or offset lightness, scaled chroma, shifted hue. */
8
+ /**
9
+ * A colour taken from a seed: fixed or offset lightness, scaled or limited
10
+ * chroma, shifted hue. A limited chroma takes the seed's hue alone — a ladder
11
+ * turned from it stays as vivid whatever the seed's own chroma — and asks for
12
+ * `max` where sRGB holds it at the derivation's fixed lightness.
13
+ */
8
14
  export interface SeedDerivation {
9
15
  readonly seed: SeedName;
10
16
  readonly l: number | {
@@ -15,7 +21,7 @@ export interface SeedDerivation {
15
21
  readonly c: {
16
22
  readonly scale: number;
17
23
  readonly max: number;
18
- };
24
+ } | ChromaLimit;
19
25
  readonly h?: number;
20
26
  readonly bounds?: readonly Bound[];
21
27
  }
@@ -3,7 +3,7 @@
3
3
  * module is the entry `@slotted/theme/seeds`, which writes a reader's seeds
4
4
  * without loading the contract, the validator or the renderer.
5
5
  */
6
- export declare const SEED_NAMES: readonly ["accent", "neutral", "success", "warning", "danger"];
6
+ export declare const SEED_NAMES: readonly ["accent", "neutral", "success", "info", "warning", "danger"];
7
7
  export type SeedName = (typeof SEED_NAMES)[number];
8
8
  /** The `style` object that gives an element its own seeds, for React `style` and Angular `[style]`. */
9
9
  export declare function seedStyle(seeds: Readonly<Partial<Record<SeedName, string>>>): Record<string, string>;
@@ -0,0 +1,21 @@
1
+ import type { TokenDefinition } from './contract-types';
2
+ /**
3
+ * What each token of the contract is for. A group covers its tokens by a
4
+ * pattern of `{dimension}` slots or by a list of names. The published token
5
+ * page is generated from the groups, and `groupErrors` holds them complete:
6
+ * every token in exactly one group, every meaning stated.
7
+ */
8
+ export interface TokenGroup {
9
+ readonly id: string;
10
+ readonly purpose: string;
11
+ /** `application`: an element of the application's own reads it. `family`: only its family does. */
12
+ readonly reader: 'application' | 'family';
13
+ readonly pattern?: string;
14
+ /** Per slot: the meaning of each value, or `open` for values with no meaning of their own. */
15
+ readonly dimensions?: Readonly<Record<string, Readonly<Record<string, string>> | 'open'>>;
16
+ readonly tokens?: Readonly<Record<string, string>>;
17
+ }
18
+ export declare function groupCovers(group: TokenGroup, name: string): boolean;
19
+ /** The value a token takes in each slot of its group's pattern. */
20
+ export declare function dimensionValues(group: TokenGroup, name: string): Record<string, string>;
21
+ export declare function groupErrors(tokens: readonly TokenDefinition[], groups: readonly TokenGroup[]): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slotted/theme",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.10",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",