@nxds/core 0.12.0 → 0.14.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.
@@ -1,5 +1,5 @@
1
- import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-tv7B_RKy.cjs';
2
- export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-tv7B_RKy.cjs';
1
+ import { N as NxdsColorAppearance, a as NxdsUiScale, b as NxdsTextSize, c as NxdsAppearancePrefs, d as NxdsPresetField } from './surface-ladder-DQ9Yfwie.cjs';
2
+ export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, e as ShadeAnchor } from './surface-ladder-DQ9Yfwie.cjs';
3
3
  import { M as Mode } from './palette-BKTIQ0WC.cjs';
4
4
 
5
5
  /** An authored DTCG `$value`: a scalar, a reference string, or a composite. */
@@ -11,8 +11,18 @@ type TokenValue = string | number | boolean | null | readonly TokenValue[] | {
11
11
  type DeepReadonly<T> = T extends object ? {
12
12
  readonly [Key in keyof T]: DeepReadonly<T[Key]>;
13
13
  } : T;
14
+ /**
15
+ * The appearance fields the catalogue derives values from: runtime colours
16
+ * from the brand colour, surface tone and contrasts, sizes from the UI scale,
17
+ * type sizes from the text size too, and the code size from `codeFontSize`.
18
+ */
19
+ type CatalogueAppearance = NxdsColorAppearance & {
20
+ readonly uiScale: NxdsUiScale;
21
+ readonly textSize: NxdsTextSize;
22
+ readonly prefs: Pick<NxdsAppearancePrefs, 'codeFontSize'>;
23
+ };
14
24
  /** Token families the catalogue covers. */
15
- type CatalogueFamily = 'borderwidth' | 'breakpoint' | 'color' | 'motion' | 'radius' | 'shadow' | 'spacing' | 'typography' | 'z-index';
25
+ type CatalogueFamily = 'borderwidth' | 'breakpoint' | 'color' | 'icon' | 'motion' | 'radius' | 'shadow' | 'spacing' | 'typography' | 'ui-scale' | 'width' | 'z-index';
16
26
  /**
17
27
  * Canonical identity: an identifier in the `--nx-*` custom property scheme.
18
28
  * Most tokens declare it in the generated CSS. Typography styles and
@@ -61,10 +71,15 @@ interface CatalogueVariant {
61
71
  * file.
62
72
  */
63
73
  readonly preset: string | null;
64
- /** The authored leaf, or `null` for a colour the engine derives. */
74
+ /**
75
+ * The authored leaf, or `null` for a colour the engine derives and for the
76
+ * UI scale factor and page widths.
77
+ */
65
78
  readonly source: CatalogueSource | null;
66
- /** The full appearance config a derived colour was computed from. */
67
- readonly appearance: DeepReadonly<NxdsAppearanceState> | null;
79
+ /** The appearance fields a derived colour was computed from, and its mode. */
80
+ readonly appearance: DeepReadonly<NxdsColorAppearance & {
81
+ readonly mode: Mode;
82
+ }> | null;
68
83
  readonly authoredValue: TokenValue | null;
69
84
  /**
70
85
  * What the generated CSS declares: one custom property for a scalar or a
@@ -76,12 +91,16 @@ interface CatalogueVariant {
76
91
  readonly references: readonly CatalogueReference[];
77
92
  }
78
93
  /**
79
- * The appearance setting that writes a token at runtime: a preset field that
80
- * picks one of its moded values, or a preference the provider computes it from.
94
+ * An appearance setting that writes a token at runtime: a preset field that
95
+ * picks one of its moded values, the UI scale or text size that scales its
96
+ * value, or a preference the provider computes it from.
81
97
  */
82
98
  type CatalogueControl = {
83
99
  readonly kind: 'preset';
84
100
  readonly field: NxdsPresetField;
101
+ } | {
102
+ readonly kind: 'scale';
103
+ readonly field: 'uiScale' | 'textSize';
85
104
  } | {
86
105
  readonly kind: 'pref';
87
106
  readonly field: keyof NxdsAppearancePrefs;
@@ -91,25 +110,30 @@ interface CatalogueToken {
91
110
  readonly family: CatalogueFamily;
92
111
  /**
93
112
  * The registry category for a derived colour, the first path key for a
94
- * nested leaf (`green`, `size`, `container`), or the family for a flat file.
113
+ * nested leaf (`green`, `size`, `container`), or the family for a flat file
114
+ * and for a token no file authors.
95
115
  */
96
116
  readonly group: string;
97
117
  /** The DTCG `$type`. */
98
118
  readonly type: string;
99
119
  readonly description: string | null;
100
120
  readonly aliases: readonly CatalogueAlias[];
101
- /** The appearance setting that writes it, or `null` when nothing does. */
102
- readonly control: CatalogueControl | null;
121
+ /** The appearance settings that write it. Empty when nothing does. */
122
+ readonly controls: readonly CatalogueControl[];
103
123
  readonly variants: readonly CatalogueVariant[];
104
124
  }
105
125
 
106
126
  /**
107
127
  * Every nxds token, identified by its `--nx-*` name: primitives, runtime
108
- * colours, spacing, z-index, breakpoints, and typography and shadow styles.
128
+ * colours, spacing, z-index, breakpoints, typography and shadow styles, and
129
+ * the UI scale factor and page widths.
109
130
  * Shadow layer primitives only compose the shadow styles.
110
- * Runtime colours are computed from `DEFAULT_NXDS_APPEARANCE` in explicit
111
- * light and dark modes; each variant records the appearance it used.
131
+ * Runtime colours are computed from `appearance` in explicit light and dark
132
+ * modes; each variant records the colour fields and mode it used. Sizes
133
+ * follow its UI scale, type sizes its text size too, and the code size its
134
+ * code font size. Every preset's variants are listed, and the appearance only
135
+ * says which one is in use.
112
136
  */
113
- declare function createTokenCatalogue(): readonly CatalogueToken[];
137
+ declare function createTokenCatalogue(appearance?: CatalogueAppearance): readonly CatalogueToken[];
114
138
 
115
- export { type CatalogueAlias, type CatalogueControl, type CatalogueDeclaration, type CatalogueFamily, type CatalogueReference, type CatalogueSource, type CatalogueToken, type CatalogueTokenName, type CatalogueVariant, type TokenValue, createTokenCatalogue };
139
+ export { type CatalogueAlias, type CatalogueAppearance, type CatalogueControl, type CatalogueDeclaration, type CatalogueFamily, type CatalogueReference, type CatalogueSource, type CatalogueToken, type CatalogueTokenName, type CatalogueVariant, type TokenValue, createTokenCatalogue };
@@ -1,5 +1,5 @@
1
- import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-CAjRqzCx.js';
2
- export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-CAjRqzCx.js';
1
+ import { N as NxdsColorAppearance, a as NxdsUiScale, b as NxdsTextSize, c as NxdsAppearancePrefs, d as NxdsPresetField } from './surface-ladder-B8LyPHC_.js';
2
+ export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, e as ShadeAnchor } from './surface-ladder-B8LyPHC_.js';
3
3
  import { M as Mode } from './palette-BKTIQ0WC.js';
4
4
 
5
5
  /** An authored DTCG `$value`: a scalar, a reference string, or a composite. */
@@ -11,8 +11,18 @@ type TokenValue = string | number | boolean | null | readonly TokenValue[] | {
11
11
  type DeepReadonly<T> = T extends object ? {
12
12
  readonly [Key in keyof T]: DeepReadonly<T[Key]>;
13
13
  } : T;
14
+ /**
15
+ * The appearance fields the catalogue derives values from: runtime colours
16
+ * from the brand colour, surface tone and contrasts, sizes from the UI scale,
17
+ * type sizes from the text size too, and the code size from `codeFontSize`.
18
+ */
19
+ type CatalogueAppearance = NxdsColorAppearance & {
20
+ readonly uiScale: NxdsUiScale;
21
+ readonly textSize: NxdsTextSize;
22
+ readonly prefs: Pick<NxdsAppearancePrefs, 'codeFontSize'>;
23
+ };
14
24
  /** Token families the catalogue covers. */
15
- type CatalogueFamily = 'borderwidth' | 'breakpoint' | 'color' | 'motion' | 'radius' | 'shadow' | 'spacing' | 'typography' | 'z-index';
25
+ type CatalogueFamily = 'borderwidth' | 'breakpoint' | 'color' | 'icon' | 'motion' | 'radius' | 'shadow' | 'spacing' | 'typography' | 'ui-scale' | 'width' | 'z-index';
16
26
  /**
17
27
  * Canonical identity: an identifier in the `--nx-*` custom property scheme.
18
28
  * Most tokens declare it in the generated CSS. Typography styles and
@@ -61,10 +71,15 @@ interface CatalogueVariant {
61
71
  * file.
62
72
  */
63
73
  readonly preset: string | null;
64
- /** The authored leaf, or `null` for a colour the engine derives. */
74
+ /**
75
+ * The authored leaf, or `null` for a colour the engine derives and for the
76
+ * UI scale factor and page widths.
77
+ */
65
78
  readonly source: CatalogueSource | null;
66
- /** The full appearance config a derived colour was computed from. */
67
- readonly appearance: DeepReadonly<NxdsAppearanceState> | null;
79
+ /** The appearance fields a derived colour was computed from, and its mode. */
80
+ readonly appearance: DeepReadonly<NxdsColorAppearance & {
81
+ readonly mode: Mode;
82
+ }> | null;
68
83
  readonly authoredValue: TokenValue | null;
69
84
  /**
70
85
  * What the generated CSS declares: one custom property for a scalar or a
@@ -76,12 +91,16 @@ interface CatalogueVariant {
76
91
  readonly references: readonly CatalogueReference[];
77
92
  }
78
93
  /**
79
- * The appearance setting that writes a token at runtime: a preset field that
80
- * picks one of its moded values, or a preference the provider computes it from.
94
+ * An appearance setting that writes a token at runtime: a preset field that
95
+ * picks one of its moded values, the UI scale or text size that scales its
96
+ * value, or a preference the provider computes it from.
81
97
  */
82
98
  type CatalogueControl = {
83
99
  readonly kind: 'preset';
84
100
  readonly field: NxdsPresetField;
101
+ } | {
102
+ readonly kind: 'scale';
103
+ readonly field: 'uiScale' | 'textSize';
85
104
  } | {
86
105
  readonly kind: 'pref';
87
106
  readonly field: keyof NxdsAppearancePrefs;
@@ -91,25 +110,30 @@ interface CatalogueToken {
91
110
  readonly family: CatalogueFamily;
92
111
  /**
93
112
  * The registry category for a derived colour, the first path key for a
94
- * nested leaf (`green`, `size`, `container`), or the family for a flat file.
113
+ * nested leaf (`green`, `size`, `container`), or the family for a flat file
114
+ * and for a token no file authors.
95
115
  */
96
116
  readonly group: string;
97
117
  /** The DTCG `$type`. */
98
118
  readonly type: string;
99
119
  readonly description: string | null;
100
120
  readonly aliases: readonly CatalogueAlias[];
101
- /** The appearance setting that writes it, or `null` when nothing does. */
102
- readonly control: CatalogueControl | null;
121
+ /** The appearance settings that write it. Empty when nothing does. */
122
+ readonly controls: readonly CatalogueControl[];
103
123
  readonly variants: readonly CatalogueVariant[];
104
124
  }
105
125
 
106
126
  /**
107
127
  * Every nxds token, identified by its `--nx-*` name: primitives, runtime
108
- * colours, spacing, z-index, breakpoints, and typography and shadow styles.
128
+ * colours, spacing, z-index, breakpoints, typography and shadow styles, and
129
+ * the UI scale factor and page widths.
109
130
  * Shadow layer primitives only compose the shadow styles.
110
- * Runtime colours are computed from `DEFAULT_NXDS_APPEARANCE` in explicit
111
- * light and dark modes; each variant records the appearance it used.
131
+ * Runtime colours are computed from `appearance` in explicit light and dark
132
+ * modes; each variant records the colour fields and mode it used. Sizes
133
+ * follow its UI scale, type sizes its text size too, and the code size its
134
+ * code font size. Every preset's variants are listed, and the appearance only
135
+ * says which one is in use.
112
136
  */
113
- declare function createTokenCatalogue(): readonly CatalogueToken[];
137
+ declare function createTokenCatalogue(appearance?: CatalogueAppearance): readonly CatalogueToken[];
114
138
 
115
- export { type CatalogueAlias, type CatalogueControl, type CatalogueDeclaration, type CatalogueFamily, type CatalogueReference, type CatalogueSource, type CatalogueToken, type CatalogueTokenName, type CatalogueVariant, type TokenValue, createTokenCatalogue };
139
+ export { type CatalogueAlias, type CatalogueAppearance, type CatalogueControl, type CatalogueDeclaration, type CatalogueFamily, type CatalogueReference, type CatalogueSource, type CatalogueToken, type CatalogueTokenName, type CatalogueVariant, type TokenValue, createTokenCatalogue };