@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.
@@ -437,6 +437,13 @@ var CHART_PALETTE_REFERENCES = [
437
437
  { palette: "rose", light: "600", dark: "200" },
438
438
  { palette: "indigo", light: "600", dark: "200" }
439
439
  ];
440
+ var SYNTAX_PALETTE_REFERENCES = {
441
+ keyword: CHART_PALETTE_REFERENCES[3],
442
+ string: CHART_PALETTE_REFERENCES[1],
443
+ function: CHART_PALETTE_REFERENCES[4],
444
+ type: CHART_PALETTE_REFERENCES[0],
445
+ constant: CHART_PALETTE_REFERENCES[2]
446
+ };
440
447
 
441
448
  // src/lib/apca-pairs.ts
442
449
  var COLOR_FAMILIES = [
@@ -451,6 +458,8 @@ var CATEGORICAL_INDICES = CHART_PALETTE_REFERENCES.map(
451
458
  (_, index) => index + 1
452
459
  );
453
460
  var CHART_STAGGER_LC = 4.5;
461
+ var DIFF_SURFACES = ["success-subtle", "error-subtle"];
462
+ var CODE_SURFACES = ["container", "container-hover", ...DIFF_SURFACES];
454
463
  var FOCUS_SURFACES = [
455
464
  "background",
456
465
  "container",
@@ -510,11 +519,23 @@ var APCA_PAIRS = [
510
519
  ink(`${family}-subtle-foreground`, `${family}-subtle-active`, "ui")
511
520
  ]),
512
521
  ...CATEGORICAL_INDICES.flatMap(
513
- (index) => ["container", "background"].map((bg) => ({
522
+ (index) => ["container", "container-hover", "background"].map((bg) => ({
514
523
  ...ink(`chart-categorical-${index}`, bg, "ui"),
515
524
  offset: (index - 1) * CHART_STAGGER_LC
516
525
  }))
517
526
  ),
527
+ ...CODE_SURFACES.flatMap(
528
+ (bg) => Object.keys(SYNTAX_PALETTE_REFERENCES).map(
529
+ (role) => ink(`syntax-${role}`, bg, "ui")
530
+ )
531
+ ),
532
+ // codeBlockTheme also colours code with the text tokens, which already read
533
+ // on container and container-hover.
534
+ ...DIFF_SURFACES.flatMap((bg) => [
535
+ text("foreground", bg, "ui"),
536
+ text("muted-foreground", bg, "ui"),
537
+ text("muted-foreground-subtle", bg, "incidental")
538
+ ]),
518
539
  // Focus is the primary accent (components.md § Focus States), so it shares
519
540
  // one solved color with primary-subtle-foreground.
520
541
  ...FOCUS_SURFACES.flatMap((surface) => [
@@ -2811,6 +2832,14 @@ function deriveChart(mode) {
2811
2832
  ])
2812
2833
  );
2813
2834
  }
2835
+ function deriveSyntax(mode) {
2836
+ return Object.fromEntries(
2837
+ Object.entries(SYNTAX_PALETTE_REFERENCES).map(([role, reference]) => [
2838
+ `--nx-color-syntax-${role}`,
2839
+ getPaletteShade(reference.palette, reference[mode])
2840
+ ])
2841
+ );
2842
+ }
2814
2843
  function deriveAlpha(surfaceTone, mode, profile) {
2815
2844
  const tone = SURFACE_TONE[surfaceTone];
2816
2845
  const dark = mode === "dark";
@@ -2926,6 +2955,7 @@ function deriveThemeMode(input, mode) {
2926
2955
  ...deriveSecondary(mode),
2927
2956
  ...deriveStatus(mode),
2928
2957
  ...deriveChart(mode),
2958
+ ...deriveSyntax(mode),
2929
2959
  ...deriveAlpha(surfaceTone, mode, profile),
2930
2960
  "--nx-color-focus-error": getPaletteShade(
2931
2961
  STATUS_PALETTE_FAMILIES.error,
@@ -3057,6 +3087,13 @@ var CHART_TOKEN_NAMES = [
3057
3087
  "chart-categorical-4",
3058
3088
  "chart-categorical-5"
3059
3089
  ];
3090
+ var SYNTAX_TOKEN_NAMES = [
3091
+ "syntax-keyword",
3092
+ "syntax-string",
3093
+ "syntax-function",
3094
+ "syntax-type",
3095
+ "syntax-constant"
3096
+ ];
3060
3097
  var FOCUS_TOKEN_NAMES = ["focus-default", "focus-error"];
3061
3098
  var ALPHA_TOKEN_NAMES = [
3062
3099
  "background-hover-alpha",
@@ -3075,6 +3112,7 @@ var SEMANTIC_TOKEN_REGISTRY = [
3075
3112
  ...metas("brand", BRAND_TOKEN_NAMES),
3076
3113
  ...metas("status", STATUS_TOKEN_NAMES),
3077
3114
  ...metas("chart", CHART_TOKEN_NAMES),
3115
+ ...metas("syntax", SYNTAX_TOKEN_NAMES),
3078
3116
  ...metas("focus", FOCUS_TOKEN_NAMES),
3079
3117
  ...metas("alpha", ALPHA_TOKEN_NAMES)
3080
3118
  ];
@@ -3445,6 +3483,11 @@ var NEUTRAL_DESCRIPTIONS = {
3445
3483
  "chart-categorical-3": "Third chart series, on container or background.",
3446
3484
  "chart-categorical-4": "Fourth chart series, on container or background.",
3447
3485
  "chart-categorical-5": "Fifth chart series, on container or background.",
3486
+ "syntax-keyword": "Keywords in code, such as const and return, on CodeBlock surfaces.",
3487
+ "syntax-string": "Strings in code, on CodeBlock surfaces.",
3488
+ "syntax-function": "Function and attribute names in code, on CodeBlock surfaces.",
3489
+ "syntax-type": "Type, class and tag names in code, on CodeBlock surfaces.",
3490
+ "syntax-constant": "Numbers and constants in code, on CodeBlock surfaces.",
3448
3491
  "focus-default": "Focus ring of every interactive control, on any surface.",
3449
3492
  "focus-error": "Focus ring of an invalid control.",
3450
3493
  "background-hover-alpha": "Translucent hover fill for controls that sit on an image or an unknown surface.",