@nxds/core 0.10.0 → 0.12.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.
- package/dist/runtime/catalogue.cjs +85 -3
- package/dist/runtime/catalogue.cjs.map +1 -1
- package/dist/runtime/catalogue.d.cts +2 -2
- package/dist/runtime/catalogue.d.ts +2 -2
- package/dist/runtime/catalogue.js +85 -3
- package/dist/runtime/catalogue.js.map +1 -1
- package/dist/runtime/index.cjs +396 -5
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.d.cts +195 -5
- package/dist/runtime/index.d.ts +195 -5
- package/dist/runtime/index.js +385 -5
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/{surface-ladder-B950TU4_.d.ts → surface-ladder-CAjRqzCx.d.ts} +6 -1
- package/dist/runtime/{surface-ladder-C8HTwT7z.d.cts → surface-ladder-tv7B_RKy.d.cts} +6 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-
|
|
2
|
-
export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-
|
|
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';
|
|
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. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-
|
|
2
|
-
export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-
|
|
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';
|
|
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. */
|
|
@@ -408,6 +408,13 @@ var CHART_PALETTE_REFERENCES = [
|
|
|
408
408
|
{ palette: "rose", light: "600", dark: "200" },
|
|
409
409
|
{ palette: "indigo", light: "600", dark: "200" }
|
|
410
410
|
];
|
|
411
|
+
var SYNTAX_PALETTE_REFERENCES = {
|
|
412
|
+
keyword: CHART_PALETTE_REFERENCES[3],
|
|
413
|
+
string: CHART_PALETTE_REFERENCES[1],
|
|
414
|
+
function: CHART_PALETTE_REFERENCES[4],
|
|
415
|
+
type: CHART_PALETTE_REFERENCES[0],
|
|
416
|
+
constant: CHART_PALETTE_REFERENCES[2]
|
|
417
|
+
};
|
|
411
418
|
|
|
412
419
|
// src/lib/apca-pairs.ts
|
|
413
420
|
var COLOR_FAMILIES = [
|
|
@@ -422,6 +429,8 @@ var CATEGORICAL_INDICES = CHART_PALETTE_REFERENCES.map(
|
|
|
422
429
|
(_, index) => index + 1
|
|
423
430
|
);
|
|
424
431
|
var CHART_STAGGER_LC = 4.5;
|
|
432
|
+
var DIFF_SURFACES = ["success-subtle", "error-subtle"];
|
|
433
|
+
var CODE_SURFACES = ["container", "container-hover", ...DIFF_SURFACES];
|
|
425
434
|
var FOCUS_SURFACES = [
|
|
426
435
|
"background",
|
|
427
436
|
"container",
|
|
@@ -481,11 +490,23 @@ var APCA_PAIRS = [
|
|
|
481
490
|
ink(`${family}-subtle-foreground`, `${family}-subtle-active`, "ui")
|
|
482
491
|
]),
|
|
483
492
|
...CATEGORICAL_INDICES.flatMap(
|
|
484
|
-
(index) => ["container", "background"].map((bg) => ({
|
|
493
|
+
(index) => ["container", "container-hover", "background"].map((bg) => ({
|
|
485
494
|
...ink(`chart-categorical-${index}`, bg, "ui"),
|
|
486
495
|
offset: (index - 1) * CHART_STAGGER_LC
|
|
487
496
|
}))
|
|
488
497
|
),
|
|
498
|
+
...CODE_SURFACES.flatMap(
|
|
499
|
+
(bg) => Object.keys(SYNTAX_PALETTE_REFERENCES).map(
|
|
500
|
+
(role) => ink(`syntax-${role}`, bg, "ui")
|
|
501
|
+
)
|
|
502
|
+
),
|
|
503
|
+
// codeBlockTheme also colours code with the text tokens, which already read
|
|
504
|
+
// on container and container-hover.
|
|
505
|
+
...DIFF_SURFACES.flatMap((bg) => [
|
|
506
|
+
text("foreground", bg, "ui"),
|
|
507
|
+
text("muted-foreground", bg, "ui"),
|
|
508
|
+
text("muted-foreground-subtle", bg, "incidental")
|
|
509
|
+
]),
|
|
489
510
|
// Focus is the primary accent (components.md § Focus States), so it shares
|
|
490
511
|
// one solved color with primary-subtle-foreground.
|
|
491
512
|
...FOCUS_SURFACES.flatMap((surface) => [
|
|
@@ -916,8 +937,10 @@ function rampFromSeed(seedHex, options = {}) {
|
|
|
916
937
|
}
|
|
917
938
|
|
|
918
939
|
// src/lib/contrast.ts
|
|
940
|
+
var CONTRAST_MIN = 0;
|
|
941
|
+
var CONTRAST_MAX = 100;
|
|
919
942
|
function normalizeContrast(value, fallback = 50) {
|
|
920
|
-
return typeof value === "number" && Number.isFinite(value) ? Math.round(Math.max(
|
|
943
|
+
return typeof value === "number" && Number.isFinite(value) ? Math.round(Math.max(CONTRAST_MIN, Math.min(CONTRAST_MAX, value))) : fallback;
|
|
921
944
|
}
|
|
922
945
|
function contrastTarget(tier, contrast) {
|
|
923
946
|
return TIER_THRESHOLDS[tier] + 15 * contrast / 100;
|
|
@@ -1090,6 +1113,7 @@ var DEFAULT_NXDS_APPEARANCE = {
|
|
|
1090
1113
|
stroke: "normal",
|
|
1091
1114
|
prefs: {
|
|
1092
1115
|
uiFont: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
|
|
1116
|
+
headingFont: null,
|
|
1093
1117
|
codeFont: 'ui-monospace, "SF Mono", Menlo, monospace',
|
|
1094
1118
|
uiFontSize: 14,
|
|
1095
1119
|
codeFontSize: 12,
|
|
@@ -2782,6 +2806,14 @@ function deriveChart(mode) {
|
|
|
2782
2806
|
])
|
|
2783
2807
|
);
|
|
2784
2808
|
}
|
|
2809
|
+
function deriveSyntax(mode) {
|
|
2810
|
+
return Object.fromEntries(
|
|
2811
|
+
Object.entries(SYNTAX_PALETTE_REFERENCES).map(([role, reference]) => [
|
|
2812
|
+
`--nx-color-syntax-${role}`,
|
|
2813
|
+
getPaletteShade(reference.palette, reference[mode])
|
|
2814
|
+
])
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2785
2817
|
function deriveAlpha(surfaceTone, mode, profile) {
|
|
2786
2818
|
const tone = SURFACE_TONE[surfaceTone];
|
|
2787
2819
|
const dark = mode === "dark";
|
|
@@ -2897,6 +2929,7 @@ function deriveThemeMode(input, mode) {
|
|
|
2897
2929
|
...deriveSecondary(mode),
|
|
2898
2930
|
...deriveStatus(mode),
|
|
2899
2931
|
...deriveChart(mode),
|
|
2932
|
+
...deriveSyntax(mode),
|
|
2900
2933
|
...deriveAlpha(surfaceTone, mode, profile),
|
|
2901
2934
|
"--nx-color-focus-error": getPaletteShade(
|
|
2902
2935
|
STATUS_PALETTE_FAMILIES.error,
|
|
@@ -3028,6 +3061,13 @@ var CHART_TOKEN_NAMES = [
|
|
|
3028
3061
|
"chart-categorical-4",
|
|
3029
3062
|
"chart-categorical-5"
|
|
3030
3063
|
];
|
|
3064
|
+
var SYNTAX_TOKEN_NAMES = [
|
|
3065
|
+
"syntax-keyword",
|
|
3066
|
+
"syntax-string",
|
|
3067
|
+
"syntax-function",
|
|
3068
|
+
"syntax-type",
|
|
3069
|
+
"syntax-constant"
|
|
3070
|
+
];
|
|
3031
3071
|
var FOCUS_TOKEN_NAMES = ["focus-default", "focus-error"];
|
|
3032
3072
|
var ALPHA_TOKEN_NAMES = [
|
|
3033
3073
|
"background-hover-alpha",
|
|
@@ -3046,6 +3086,7 @@ var SEMANTIC_TOKEN_REGISTRY = [
|
|
|
3046
3086
|
...metas("brand", BRAND_TOKEN_NAMES),
|
|
3047
3087
|
...metas("status", STATUS_TOKEN_NAMES),
|
|
3048
3088
|
...metas("chart", CHART_TOKEN_NAMES),
|
|
3089
|
+
...metas("syntax", SYNTAX_TOKEN_NAMES),
|
|
3049
3090
|
...metas("focus", FOCUS_TOKEN_NAMES),
|
|
3050
3091
|
...metas("alpha", ALPHA_TOKEN_NAMES)
|
|
3051
3092
|
];
|
|
@@ -3216,7 +3257,7 @@ function formatTypographyDeclarations(tokenPath, value, primitiveMap) {
|
|
|
3216
3257
|
const css = fieldValue === "auto" ? "normal" : resolveValue(fieldValue, primitiveMap);
|
|
3217
3258
|
declarations.push({ property, value: css });
|
|
3218
3259
|
}
|
|
3219
|
-
if (tokenPath[0] === "heading") {
|
|
3260
|
+
if (tokenPath[0] === "display" || tokenPath[0] === "heading") {
|
|
3220
3261
|
declarations.push({ property: "text-wrap", value: "balance" });
|
|
3221
3262
|
}
|
|
3222
3263
|
if (tokenPath[0] === "body") {
|
|
@@ -3416,6 +3457,11 @@ var NEUTRAL_DESCRIPTIONS = {
|
|
|
3416
3457
|
"chart-categorical-3": "Third chart series, on container or background.",
|
|
3417
3458
|
"chart-categorical-4": "Fourth chart series, on container or background.",
|
|
3418
3459
|
"chart-categorical-5": "Fifth chart series, on container or background.",
|
|
3460
|
+
"syntax-keyword": "Keywords in code, such as const and return, on CodeBlock surfaces.",
|
|
3461
|
+
"syntax-string": "Strings in code, on CodeBlock surfaces.",
|
|
3462
|
+
"syntax-function": "Function and attribute names in code, on CodeBlock surfaces.",
|
|
3463
|
+
"syntax-type": "Type, class and tag names in code, on CodeBlock surfaces.",
|
|
3464
|
+
"syntax-constant": "Numbers and constants in code, on CodeBlock surfaces.",
|
|
3419
3465
|
"focus-default": "Focus ring of every interactive control, on any surface.",
|
|
3420
3466
|
"focus-error": "Focus ring of an invalid control.",
|
|
3421
3467
|
"background-hover-alpha": "Translucent hover fill for controls that sit on an image or an unknown surface.",
|
|
@@ -10790,6 +10836,41 @@ var shadows_default = {
|
|
|
10790
10836
|
|
|
10791
10837
|
// tokens/styles/typography.json
|
|
10792
10838
|
var typography_default = {
|
|
10839
|
+
display: {
|
|
10840
|
+
large: {
|
|
10841
|
+
$type: "typography",
|
|
10842
|
+
$value: {
|
|
10843
|
+
fontFamily: "{family.font-heading}",
|
|
10844
|
+
fontSize: "{size.5xl}",
|
|
10845
|
+
fontWeight: "{weight.semibold}",
|
|
10846
|
+
lineHeight: "{line-height.5xl}",
|
|
10847
|
+
letterSpacing: "{letterspacing.tighter}"
|
|
10848
|
+
},
|
|
10849
|
+
$description: "Largest display title \u2014 hero and landing-page section titles"
|
|
10850
|
+
},
|
|
10851
|
+
medium: {
|
|
10852
|
+
$type: "typography",
|
|
10853
|
+
$value: {
|
|
10854
|
+
fontFamily: "{family.font-heading}",
|
|
10855
|
+
fontSize: "{size.4xl}",
|
|
10856
|
+
fontWeight: "{weight.semibold}",
|
|
10857
|
+
lineHeight: "{line-height.4xl}",
|
|
10858
|
+
letterSpacing: "{letterspacing.tighter}"
|
|
10859
|
+
},
|
|
10860
|
+
$description: "Display title one step below display-large, for page sections"
|
|
10861
|
+
},
|
|
10862
|
+
small: {
|
|
10863
|
+
$type: "typography",
|
|
10864
|
+
$value: {
|
|
10865
|
+
fontFamily: "{family.font-heading}",
|
|
10866
|
+
fontSize: "{size.3xl}",
|
|
10867
|
+
fontWeight: "{weight.semibold}",
|
|
10868
|
+
lineHeight: "{line-height.3xl}",
|
|
10869
|
+
letterSpacing: "{letterspacing.tighter}"
|
|
10870
|
+
},
|
|
10871
|
+
$description: "Smallest display title \u2014 page-section titles in narrow layouts"
|
|
10872
|
+
}
|
|
10873
|
+
},
|
|
10793
10874
|
heading: {
|
|
10794
10875
|
large: {
|
|
10795
10876
|
$type: "typography",
|
|
@@ -11010,6 +11091,7 @@ function typographyControl(path) {
|
|
|
11010
11091
|
}
|
|
11011
11092
|
if (group !== "family") return null;
|
|
11012
11093
|
if (key === "font-sans") return { kind: "pref", field: "uiFont" };
|
|
11094
|
+
if (key === "font-heading") return { kind: "pref", field: "headingFont" };
|
|
11013
11095
|
if (key === "font-mono") return { kind: "pref", field: "codeFont" };
|
|
11014
11096
|
return null;
|
|
11015
11097
|
}
|