@nxds/core 0.9.0 → 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.
|
@@ -3346,24 +3346,117 @@ function borderColorAliasName(tokenName) {
|
|
|
3346
3346
|
}
|
|
3347
3347
|
|
|
3348
3348
|
// src/catalogue/descriptions.ts
|
|
3349
|
-
var
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
)
|
|
3361
|
-
|
|
3349
|
+
var FAMILY_ROLES = {
|
|
3350
|
+
primary: "the main action on a surface",
|
|
3351
|
+
secondary: "a supporting action beside a primary one",
|
|
3352
|
+
success: "a completed or healthy state",
|
|
3353
|
+
warning: "a state that needs attention soon",
|
|
3354
|
+
error: "a failed, invalid or destructive state",
|
|
3355
|
+
information: "neutral guidance or a status update"
|
|
3356
|
+
};
|
|
3357
|
+
var FAMILY_TEMPLATES = {
|
|
3358
|
+
background: (family, role) => `Solid fill for buttons, badges and other strong emphasis in this family. Pair with ${family}-foreground. Marks ${role}.`,
|
|
3359
|
+
"background-hover": (family) => `${family}-background while the pointer is over the control.`,
|
|
3360
|
+
"background-active": (family) => `${family}-background while the control is pressed.`,
|
|
3361
|
+
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.`,
|
|
3362
|
+
disabled: () => "Fill of a disabled control in this family. Pair with disabled-foreground.",
|
|
3363
|
+
subtle: (family, role) => `Tinted fill for light badges, alerts and selected rows on background or container. Pair with ${family}-subtle-foreground. Marks ${role}.`,
|
|
3364
|
+
"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.`,
|
|
3365
|
+
"subtle-hover": (family) => `${family}-subtle while the pointer is over the control.`,
|
|
3366
|
+
"subtle-active": (family) => `${family}-subtle while the control is pressed.`,
|
|
3367
|
+
border: () => "Border of an outlined control or alert in this family, on background or container.",
|
|
3368
|
+
"border-active": (family) => `${family}-border while the control is pressed or selected.`
|
|
3369
|
+
};
|
|
3370
|
+
function familyRole(name) {
|
|
3371
|
+
for (const family of COLOR_FAMILIES) {
|
|
3372
|
+
if (name === `border-${family}-active`) return [family, "border-active"];
|
|
3373
|
+
if (name.startsWith(`${family}-`)) {
|
|
3374
|
+
return [family, name.slice(family.length + 1)];
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
return void 0;
|
|
3378
|
+
}
|
|
3379
|
+
var NEUTRAL_DESCRIPTIONS = {
|
|
3380
|
+
background: "Page background, the base surface everything sits on. Pair with foreground.",
|
|
3381
|
+
"background-hover": "Row or ghost-control hover on background. Pair with foreground.",
|
|
3382
|
+
"background-active": "Row or ghost-control press and selection on background. Pair with foreground.",
|
|
3383
|
+
muted: "Quiet fill for wells, code, skeletons and inactive tracks on background. Pair with muted-foreground.",
|
|
3362
3384
|
"muted-extralight": "Quietest muted surface \u2014 sits between background and muted for barely-there fills (empty states, subtle panels).",
|
|
3385
|
+
container: "Card and panel surface on background. Pair with container-foreground.",
|
|
3386
|
+
"container-hover": "Row or control hover inside a container.",
|
|
3387
|
+
"container-active": "Row or control press and selection inside a container.",
|
|
3388
|
+
popover: "Surface of menus, popovers, tooltips and dialogs. Pair with popover-foreground.",
|
|
3389
|
+
"popover-hover": "Highlighted menu row inside a popover.",
|
|
3390
|
+
"popover-active": "Pressed or checked menu row inside a popover.",
|
|
3391
|
+
"control-background": "Rail of neutral controls: switch tracks, slider tracks, segmented tabs. Also the hover fill on a neutral control rail.",
|
|
3392
|
+
"control-background-hover": "control-background while the pointer is over it.",
|
|
3393
|
+
"control-thumb": "Thumb of switches and sliders, on control-background.",
|
|
3394
|
+
"nav-background": "Sidebar and navigation surface. Pair with nav-foreground.",
|
|
3395
|
+
"nav-item-hover": "Navigation item hover on nav-background.",
|
|
3396
|
+
"nav-item-active": "Current navigation item on nav-background.",
|
|
3397
|
+
"nav-border": "Border between the sidebar and the page, and inside it.",
|
|
3398
|
+
disabled: "Fill of a disabled neutral control or input. Pair with disabled-foreground.",
|
|
3399
|
+
"border-focus": "Border of a focused input, on background or container.",
|
|
3400
|
+
foreground: "Body text and icons on background, muted and the hover fills.",
|
|
3401
|
+
"container-foreground": "Text and icons on container.",
|
|
3402
|
+
"popover-foreground": "Text and icons on popover and its row fills.",
|
|
3403
|
+
"nav-foreground": "Navigation text and icons on nav-background.",
|
|
3363
3404
|
"muted-foreground": "It's a gray that softens contrast so primary content stands forward.",
|
|
3405
|
+
"nav-muted-foreground": "Secondary navigation text, such as group labels, on nav-background.",
|
|
3364
3406
|
"muted-foreground-subtle": "Tertiary text tier below muted-foreground - helper text, captions, divider labels.",
|
|
3365
|
-
|
|
3407
|
+
"disabled-foreground": "Text and icons of a disabled control, on disabled and the family disabled fills.",
|
|
3408
|
+
"border-default": "Default border of inputs, cards, tables and separators, on background or container.",
|
|
3409
|
+
"border-disabled": "Border of a disabled control.",
|
|
3410
|
+
"border-hairline": "Faint divider between rows and grouped items.",
|
|
3411
|
+
"chart-categorical-1": "First chart series, on container or background. Series colours stay in order.",
|
|
3412
|
+
"chart-categorical-2": "Second chart series, on container or background.",
|
|
3413
|
+
"chart-categorical-3": "Third chart series, on container or background.",
|
|
3414
|
+
"chart-categorical-4": "Fourth chart series, on container or background.",
|
|
3415
|
+
"chart-categorical-5": "Fifth chart series, on container or background.",
|
|
3416
|
+
"focus-default": "Focus ring of every interactive control, on any surface.",
|
|
3417
|
+
"focus-error": "Focus ring of an invalid control.",
|
|
3418
|
+
"background-hover-alpha": "Translucent hover fill for controls that sit on an image or an unknown surface.",
|
|
3419
|
+
"border-default-alpha": "Translucent border for controls that sit on an image or an unknown surface.",
|
|
3420
|
+
overlay: "Scrim behind dialogs, sheets and drawers.",
|
|
3421
|
+
"popover-alpha": "Translucent popover surface for frosted overlays.",
|
|
3422
|
+
"popover-backdrop": "Backdrop behind a frosted popover."
|
|
3366
3423
|
};
|
|
3424
|
+
var REGISTRY_NAMES = SEMANTIC_TOKEN_REGISTRY.map(
|
|
3425
|
+
(token2) => token2.name
|
|
3426
|
+
);
|
|
3427
|
+
function familyDescriptions() {
|
|
3428
|
+
const used = /* @__PURE__ */ new Set();
|
|
3429
|
+
const entries = REGISTRY_NAMES.flatMap((name) => {
|
|
3430
|
+
const match = familyRole(name);
|
|
3431
|
+
if (!match) return [];
|
|
3432
|
+
const [family, role] = match;
|
|
3433
|
+
const template = FAMILY_TEMPLATES[role];
|
|
3434
|
+
if (!template) return [];
|
|
3435
|
+
used.add(role);
|
|
3436
|
+
return [[name, template(family, FAMILY_ROLES[family])]];
|
|
3437
|
+
});
|
|
3438
|
+
const unused = Object.keys(FAMILY_TEMPLATES).filter(
|
|
3439
|
+
(role) => !used.has(role)
|
|
3440
|
+
);
|
|
3441
|
+
if (unused.length > 0) {
|
|
3442
|
+
throw new Error(
|
|
3443
|
+
`FAMILY_TEMPLATES describes ${unused.join(", ")}, which no registry colour has.`
|
|
3444
|
+
);
|
|
3445
|
+
}
|
|
3446
|
+
return entries;
|
|
3447
|
+
}
|
|
3448
|
+
function neutralDescriptions() {
|
|
3449
|
+
const unknown = Object.keys(NEUTRAL_DESCRIPTIONS).filter(
|
|
3450
|
+
(name) => !REGISTRY_NAMES.includes(name)
|
|
3451
|
+
);
|
|
3452
|
+
if (unknown.length > 0) {
|
|
3453
|
+
throw new Error(
|
|
3454
|
+
`NEUTRAL_DESCRIPTIONS describes ${unknown.join(", ")}, which the registry doesn't have.`
|
|
3455
|
+
);
|
|
3456
|
+
}
|
|
3457
|
+
return Object.entries(NEUTRAL_DESCRIPTIONS);
|
|
3458
|
+
}
|
|
3459
|
+
var RUNTIME_COLOR_DESCRIPTIONS = Object.fromEntries([...neutralDescriptions(), ...familyDescriptions()]);
|
|
3367
3460
|
|
|
3368
3461
|
// tokens/primitives/borderwidth/borderwidth-fine.json
|
|
3369
3462
|
var borderwidth_fine_default = {
|