@nxds/core 0.7.2 → 0.9.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.
@@ -1,6 +1,6 @@
1
- import { N as NexusPresetField, a as NexusAppearancePrefs, b as NexusAppearanceState } from './surface-ladder-C2sSp67b.cjs';
2
- export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-C2sSp67b.cjs';
3
- import { M as Mode } from './palette-DgJXuoTz.cjs';
1
+ import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-C8HTwT7z.cjs';
2
+ export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-C8HTwT7z.cjs';
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. */
6
6
  type TokenValue = string | number | boolean | null | readonly TokenValue[] | {
@@ -64,7 +64,7 @@ interface CatalogueVariant {
64
64
  /** The authored leaf, or `null` for a colour the engine derives. */
65
65
  readonly source: CatalogueSource | null;
66
66
  /** The full appearance config a derived colour was computed from. */
67
- readonly appearance: DeepReadonly<NexusAppearanceState> | null;
67
+ readonly appearance: DeepReadonly<NxdsAppearanceState> | null;
68
68
  readonly authoredValue: TokenValue | null;
69
69
  /**
70
70
  * What the generated CSS declares: one custom property for a scalar or a
@@ -81,10 +81,10 @@ interface CatalogueVariant {
81
81
  */
82
82
  type CatalogueControl = {
83
83
  readonly kind: 'preset';
84
- readonly field: NexusPresetField;
84
+ readonly field: NxdsPresetField;
85
85
  } | {
86
86
  readonly kind: 'pref';
87
- readonly field: keyof NexusAppearancePrefs;
87
+ readonly field: keyof NxdsAppearancePrefs;
88
88
  };
89
89
  interface CatalogueToken {
90
90
  readonly name: CatalogueTokenName;
@@ -104,9 +104,9 @@ interface CatalogueToken {
104
104
  }
105
105
 
106
106
  /**
107
- * Every Nexus token, identified by its `--nx-*` name: primitives, runtime
107
+ * Every nxds token, identified by its `--nx-*` name: primitives, runtime
108
108
  * colours, spacing, z-index, breakpoints, and typography and shadow styles.
109
- * Runtime colours are computed from `DEFAULT_NEXUS_APPEARANCE` in explicit
109
+ * Runtime colours are computed from `DEFAULT_NXDS_APPEARANCE` in explicit
110
110
  * light and dark modes; each variant records the appearance it used.
111
111
  */
112
112
  declare function createTokenCatalogue(): readonly CatalogueToken[];
@@ -1,6 +1,6 @@
1
- import { N as NexusPresetField, a as NexusAppearancePrefs, b as NexusAppearanceState } from './surface-ladder-yQyRTCRt.js';
2
- export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-yQyRTCRt.js';
3
- import { M as Mode } from './palette-DgJXuoTz.js';
1
+ import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-B950TU4_.js';
2
+ export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-B950TU4_.js';
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. */
6
6
  type TokenValue = string | number | boolean | null | readonly TokenValue[] | {
@@ -64,7 +64,7 @@ interface CatalogueVariant {
64
64
  /** The authored leaf, or `null` for a colour the engine derives. */
65
65
  readonly source: CatalogueSource | null;
66
66
  /** The full appearance config a derived colour was computed from. */
67
- readonly appearance: DeepReadonly<NexusAppearanceState> | null;
67
+ readonly appearance: DeepReadonly<NxdsAppearanceState> | null;
68
68
  readonly authoredValue: TokenValue | null;
69
69
  /**
70
70
  * What the generated CSS declares: one custom property for a scalar or a
@@ -81,10 +81,10 @@ interface CatalogueVariant {
81
81
  */
82
82
  type CatalogueControl = {
83
83
  readonly kind: 'preset';
84
- readonly field: NexusPresetField;
84
+ readonly field: NxdsPresetField;
85
85
  } | {
86
86
  readonly kind: 'pref';
87
- readonly field: keyof NexusAppearancePrefs;
87
+ readonly field: keyof NxdsAppearancePrefs;
88
88
  };
89
89
  interface CatalogueToken {
90
90
  readonly name: CatalogueTokenName;
@@ -104,9 +104,9 @@ interface CatalogueToken {
104
104
  }
105
105
 
106
106
  /**
107
- * Every Nexus token, identified by its `--nx-*` name: primitives, runtime
107
+ * Every nxds token, identified by its `--nx-*` name: primitives, runtime
108
108
  * colours, spacing, z-index, breakpoints, and typography and shadow styles.
109
- * Runtime colours are computed from `DEFAULT_NEXUS_APPEARANCE` in explicit
109
+ * Runtime colours are computed from `DEFAULT_NXDS_APPEARANCE` in explicit
110
110
  * light and dark modes; each variant records the appearance it used.
111
111
  */
112
112
  declare function createTokenCatalogue(): readonly CatalogueToken[];
@@ -1078,7 +1078,7 @@ var STROKE_OPTIONS = [
1078
1078
  { value: "normal", label: "Normal" },
1079
1079
  { value: "strong", label: "Strong" }
1080
1080
  ];
1081
- var DEFAULT_NEXUS_APPEARANCE = {
1081
+ var DEFAULT_NXDS_APPEARANCE = {
1082
1082
  mode: "light",
1083
1083
  brandColor: DEFAULT_BRAND_COLOR,
1084
1084
  surfaceTone: "zinc",
@@ -1113,7 +1113,7 @@ var ELEVATIONS = new Set(
1113
1113
  var STROKES = new Set(
1114
1114
  STROKE_OPTIONS.map((option) => option.value)
1115
1115
  );
1116
- function createNexusThemeContract(state) {
1116
+ function createNxdsThemeContract(state) {
1117
1117
  const tone = BASE_TONE_SEEDS[state.surfaceTone];
1118
1118
  return {
1119
1119
  surfaceTone: state.surfaceTone,
@@ -3317,24 +3317,117 @@ function borderColorAliasName(tokenName) {
3317
3317
  }
3318
3318
 
3319
3319
  // src/catalogue/descriptions.ts
3320
- var FOREGROUND_DESCRIPTIONS = Object.fromEntries(
3321
- COLOR_FAMILIES.flatMap((family) => [
3322
- [
3323
- `${family}-foreground`,
3324
- `Foreground on ${family}-background. The surface relationship defines this role, not text alone: text and icons share it, and contrasting control parts or indicators may use it on the same surface. Other pairings require contrast coverage.`
3325
- ],
3326
- [
3327
- `${family}-subtle-foreground`,
3328
- `Foreground on ${family}-subtle. The surface relationship defines this role, not text alone: text and icons share it, and contrasting indicators may use it on that surface. Use on neutral surfaces only with contrast coverage for the intended content tier.`
3329
- ]
3330
- ])
3331
- );
3332
- var RUNTIME_COLOR_DESCRIPTIONS = {
3320
+ var FAMILY_ROLES = {
3321
+ primary: "the main action on a surface",
3322
+ secondary: "a supporting action beside a primary one",
3323
+ success: "a completed or healthy state",
3324
+ warning: "a state that needs attention soon",
3325
+ error: "a failed, invalid or destructive state",
3326
+ information: "neutral guidance or a status update"
3327
+ };
3328
+ var FAMILY_TEMPLATES = {
3329
+ background: (family, role) => `Solid fill for buttons, badges and other strong emphasis in this family. Pair with ${family}-foreground. Marks ${role}.`,
3330
+ "background-hover": (family) => `${family}-background while the pointer is over the control.`,
3331
+ "background-active": (family) => `${family}-background while the control is pressed.`,
3332
+ foreground: (family) => `Foreground on ${family}-background. The surface relationship defines this role, not text alone: text and icons share it, and contrasting control parts or indicators may use it on the same surface. Other pairings require contrast coverage.`,
3333
+ disabled: () => "Fill of a disabled control in this family. Pair with disabled-foreground.",
3334
+ subtle: (family, role) => `Tinted fill for light badges, alerts and selected rows on background or container. Pair with ${family}-subtle-foreground. Marks ${role}.`,
3335
+ "subtle-foreground": (family) => `Foreground on ${family}-subtle. The surface relationship defines this role, not text alone: text and icons share it, and contrasting indicators may use it on that surface. Use on neutral surfaces only with contrast coverage for the intended content tier.`,
3336
+ "subtle-hover": (family) => `${family}-subtle while the pointer is over the control.`,
3337
+ "subtle-active": (family) => `${family}-subtle while the control is pressed.`,
3338
+ border: () => "Border of an outlined control or alert in this family, on background or container.",
3339
+ "border-active": (family) => `${family}-border while the control is pressed or selected.`
3340
+ };
3341
+ function familyRole(name) {
3342
+ for (const family of COLOR_FAMILIES) {
3343
+ if (name === `border-${family}-active`) return [family, "border-active"];
3344
+ if (name.startsWith(`${family}-`)) {
3345
+ return [family, name.slice(family.length + 1)];
3346
+ }
3347
+ }
3348
+ return void 0;
3349
+ }
3350
+ var NEUTRAL_DESCRIPTIONS = {
3351
+ background: "Page background, the base surface everything sits on. Pair with foreground.",
3352
+ "background-hover": "Row or ghost-control hover on background. Pair with foreground.",
3353
+ "background-active": "Row or ghost-control press and selection on background. Pair with foreground.",
3354
+ muted: "Quiet fill for wells, code, skeletons and inactive tracks on background. Pair with muted-foreground.",
3333
3355
  "muted-extralight": "Quietest muted surface \u2014 sits between background and muted for barely-there fills (empty states, subtle panels).",
3356
+ container: "Card and panel surface on background. Pair with container-foreground.",
3357
+ "container-hover": "Row or control hover inside a container.",
3358
+ "container-active": "Row or control press and selection inside a container.",
3359
+ popover: "Surface of menus, popovers, tooltips and dialogs. Pair with popover-foreground.",
3360
+ "popover-hover": "Highlighted menu row inside a popover.",
3361
+ "popover-active": "Pressed or checked menu row inside a popover.",
3362
+ "control-background": "Rail of neutral controls: switch tracks, slider tracks, segmented tabs. Also the hover fill on a neutral control rail.",
3363
+ "control-background-hover": "control-background while the pointer is over it.",
3364
+ "control-thumb": "Thumb of switches and sliders, on control-background.",
3365
+ "nav-background": "Sidebar and navigation surface. Pair with nav-foreground.",
3366
+ "nav-item-hover": "Navigation item hover on nav-background.",
3367
+ "nav-item-active": "Current navigation item on nav-background.",
3368
+ "nav-border": "Border between the sidebar and the page, and inside it.",
3369
+ disabled: "Fill of a disabled neutral control or input. Pair with disabled-foreground.",
3370
+ "border-focus": "Border of a focused input, on background or container.",
3371
+ foreground: "Body text and icons on background, muted and the hover fills.",
3372
+ "container-foreground": "Text and icons on container.",
3373
+ "popover-foreground": "Text and icons on popover and its row fills.",
3374
+ "nav-foreground": "Navigation text and icons on nav-background.",
3334
3375
  "muted-foreground": "It's a gray that softens contrast so primary content stands forward.",
3376
+ "nav-muted-foreground": "Secondary navigation text, such as group labels, on nav-background.",
3335
3377
  "muted-foreground-subtle": "Tertiary text tier below muted-foreground - helper text, captions, divider labels.",
3336
- ...FOREGROUND_DESCRIPTIONS
3378
+ "disabled-foreground": "Text and icons of a disabled control, on disabled and the family disabled fills.",
3379
+ "border-default": "Default border of inputs, cards, tables and separators, on background or container.",
3380
+ "border-disabled": "Border of a disabled control.",
3381
+ "border-hairline": "Faint divider between rows and grouped items.",
3382
+ "chart-categorical-1": "First chart series, on container or background. Series colours stay in order.",
3383
+ "chart-categorical-2": "Second chart series, on container or background.",
3384
+ "chart-categorical-3": "Third chart series, on container or background.",
3385
+ "chart-categorical-4": "Fourth chart series, on container or background.",
3386
+ "chart-categorical-5": "Fifth chart series, on container or background.",
3387
+ "focus-default": "Focus ring of every interactive control, on any surface.",
3388
+ "focus-error": "Focus ring of an invalid control.",
3389
+ "background-hover-alpha": "Translucent hover fill for controls that sit on an image or an unknown surface.",
3390
+ "border-default-alpha": "Translucent border for controls that sit on an image or an unknown surface.",
3391
+ overlay: "Scrim behind dialogs, sheets and drawers.",
3392
+ "popover-alpha": "Translucent popover surface for frosted overlays.",
3393
+ "popover-backdrop": "Backdrop behind a frosted popover."
3337
3394
  };
3395
+ var REGISTRY_NAMES = SEMANTIC_TOKEN_REGISTRY.map(
3396
+ (token2) => token2.name
3397
+ );
3398
+ function familyDescriptions() {
3399
+ const used = /* @__PURE__ */ new Set();
3400
+ const entries = REGISTRY_NAMES.flatMap((name) => {
3401
+ const match = familyRole(name);
3402
+ if (!match) return [];
3403
+ const [family, role] = match;
3404
+ const template = FAMILY_TEMPLATES[role];
3405
+ if (!template) return [];
3406
+ used.add(role);
3407
+ return [[name, template(family, FAMILY_ROLES[family])]];
3408
+ });
3409
+ const unused = Object.keys(FAMILY_TEMPLATES).filter(
3410
+ (role) => !used.has(role)
3411
+ );
3412
+ if (unused.length > 0) {
3413
+ throw new Error(
3414
+ `FAMILY_TEMPLATES describes ${unused.join(", ")}, which no registry colour has.`
3415
+ );
3416
+ }
3417
+ return entries;
3418
+ }
3419
+ function neutralDescriptions() {
3420
+ const unknown = Object.keys(NEUTRAL_DESCRIPTIONS).filter(
3421
+ (name) => !REGISTRY_NAMES.includes(name)
3422
+ );
3423
+ if (unknown.length > 0) {
3424
+ throw new Error(
3425
+ `NEUTRAL_DESCRIPTIONS describes ${unknown.join(", ")}, which the registry doesn't have.`
3426
+ );
3427
+ }
3428
+ return Object.entries(NEUTRAL_DESCRIPTIONS);
3429
+ }
3430
+ var RUNTIME_COLOR_DESCRIPTIONS = Object.fromEntries([...neutralDescriptions(), ...familyDescriptions()]);
3338
3431
 
3339
3432
  // tokens/primitives/borderwidth/borderwidth-fine.json
3340
3433
  var borderwidth_fine_default = {
@@ -8791,7 +8884,7 @@ var shadow_strong_light_default = {
8791
8884
 
8792
8885
  // tokens/semantic/breakpoints.json
8793
8886
  var breakpoints_default = {
8794
- $description: "Responsive breakpoints (rem). Values match Tailwind v4's own defaults exactly \u2014 Nexus declares them explicitly so they fall under the same reset-and-own discipline as every other namespace (color/spacing/radius/shadow) instead of being inherited implicitly. Tailwind v4 auto-discovers --breakpoint-* from @theme and uses them to generate the nx:sm:\u2026nx:2xl: responsive variants. Override at BUILD TIME by re-declaring a value in a consumer @theme block \u2014 NOT at runtime: @media cannot read var(), so Tailwind bakes the resolved value into the generated media queries at build time.",
8887
+ $description: "Responsive breakpoints (rem). Values match Tailwind v4's own defaults exactly \u2014 nxds declares them explicitly so they fall under the same reset-and-own discipline as every other namespace (color/spacing/radius/shadow) instead of being inherited implicitly. Tailwind v4 auto-discovers --breakpoint-* from @theme and uses them to generate the nx:sm:\u2026nx:2xl: responsive variants. Override at BUILD TIME by re-declaring a value in a consumer @theme block \u2014 NOT at runtime: @media cannot read var(), so Tailwind bakes the resolved value into the generated media queries at build time.",
8795
8888
  "breakpoint-sm": {
8796
8889
  $value: {
8797
8890
  value: 40,
@@ -11138,8 +11231,8 @@ function styleLeaves(family, file) {
11138
11231
  }
11139
11232
  function runtimeAppearance(mode) {
11140
11233
  return {
11141
- ...DEFAULT_NEXUS_APPEARANCE,
11142
- prefs: { ...DEFAULT_NEXUS_APPEARANCE.prefs },
11234
+ ...DEFAULT_NXDS_APPEARANCE,
11235
+ prefs: { ...DEFAULT_NXDS_APPEARANCE.prefs },
11143
11236
  mode
11144
11237
  };
11145
11238
  }
@@ -11157,7 +11250,7 @@ function runtimeColorTokens() {
11157
11250
  return {
11158
11251
  mode,
11159
11252
  appearance,
11160
- values: deriveThemeMode(createNexusThemeContract(appearance), mode)
11253
+ values: deriveThemeMode(createNxdsThemeContract(appearance), mode)
11161
11254
  };
11162
11255
  });
11163
11256
  return SEMANTIC_TOKEN_REGISTRY.map(({ name, category }) => {