@nxds/core 0.10.0 → 0.11.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.
@@ -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) => [
@@ -2782,6 +2803,14 @@ function deriveChart(mode) {
2782
2803
  ])
2783
2804
  );
2784
2805
  }
2806
+ function deriveSyntax(mode) {
2807
+ return Object.fromEntries(
2808
+ Object.entries(SYNTAX_PALETTE_REFERENCES).map(([role, reference]) => [
2809
+ `--nx-color-syntax-${role}`,
2810
+ getPaletteShade(reference.palette, reference[mode])
2811
+ ])
2812
+ );
2813
+ }
2785
2814
  function deriveAlpha(surfaceTone, mode, profile) {
2786
2815
  const tone = SURFACE_TONE[surfaceTone];
2787
2816
  const dark = mode === "dark";
@@ -2897,6 +2926,7 @@ function deriveThemeMode(input, mode) {
2897
2926
  ...deriveSecondary(mode),
2898
2927
  ...deriveStatus(mode),
2899
2928
  ...deriveChart(mode),
2929
+ ...deriveSyntax(mode),
2900
2930
  ...deriveAlpha(surfaceTone, mode, profile),
2901
2931
  "--nx-color-focus-error": getPaletteShade(
2902
2932
  STATUS_PALETTE_FAMILIES.error,
@@ -3028,6 +3058,13 @@ var CHART_TOKEN_NAMES = [
3028
3058
  "chart-categorical-4",
3029
3059
  "chart-categorical-5"
3030
3060
  ];
3061
+ var SYNTAX_TOKEN_NAMES = [
3062
+ "syntax-keyword",
3063
+ "syntax-string",
3064
+ "syntax-function",
3065
+ "syntax-type",
3066
+ "syntax-constant"
3067
+ ];
3031
3068
  var FOCUS_TOKEN_NAMES = ["focus-default", "focus-error"];
3032
3069
  var ALPHA_TOKEN_NAMES = [
3033
3070
  "background-hover-alpha",
@@ -3046,6 +3083,7 @@ var SEMANTIC_TOKEN_REGISTRY = [
3046
3083
  ...metas("brand", BRAND_TOKEN_NAMES),
3047
3084
  ...metas("status", STATUS_TOKEN_NAMES),
3048
3085
  ...metas("chart", CHART_TOKEN_NAMES),
3086
+ ...metas("syntax", SYNTAX_TOKEN_NAMES),
3049
3087
  ...metas("focus", FOCUS_TOKEN_NAMES),
3050
3088
  ...metas("alpha", ALPHA_TOKEN_NAMES)
3051
3089
  ];
@@ -3416,6 +3454,11 @@ var NEUTRAL_DESCRIPTIONS = {
3416
3454
  "chart-categorical-3": "Third chart series, on container or background.",
3417
3455
  "chart-categorical-4": "Fourth chart series, on container or background.",
3418
3456
  "chart-categorical-5": "Fifth chart series, on container or background.",
3457
+ "syntax-keyword": "Keywords in code, such as const and return, on CodeBlock surfaces.",
3458
+ "syntax-string": "Strings in code, on CodeBlock surfaces.",
3459
+ "syntax-function": "Function and attribute names in code, on CodeBlock surfaces.",
3460
+ "syntax-type": "Type, class and tag names in code, on CodeBlock surfaces.",
3461
+ "syntax-constant": "Numbers and constants in code, on CodeBlock surfaces.",
3419
3462
  "focus-default": "Focus ring of every interactive control, on any surface.",
3420
3463
  "focus-error": "Focus ring of an invalid control.",
3421
3464
  "background-hover-alpha": "Translucent hover fill for controls that sit on an image or an unknown surface.",