@nxds/core 0.9.1 → 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.
@@ -33,6 +33,7 @@ __export(src_exports, {
33
33
  NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS: () => NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS,
34
34
  NXDS_APPEARANCE_DATA_ATTRS: () => NXDS_APPEARANCE_DATA_ATTRS,
35
35
  PALETTE_KEYS: () => PALETTE_KEYS,
36
+ RUNTIME_LAYER_ORDER: () => RUNTIME_LAYER_ORDER,
36
37
  SEMANTIC_TOKEN_REGISTRY: () => SEMANTIC_TOKEN_REGISTRY,
37
38
  SNAPSHOT_VERSION: () => SNAPSHOT_VERSION,
38
39
  STROKE_OPTIONS: () => STROKE_OPTIONS,
@@ -2302,6 +2303,13 @@ var CHART_PALETTE_REFERENCES = [
2302
2303
  { palette: "rose", light: "600", dark: "200" },
2303
2304
  { palette: "indigo", light: "600", dark: "200" }
2304
2305
  ];
2306
+ var SYNTAX_PALETTE_REFERENCES = {
2307
+ keyword: CHART_PALETTE_REFERENCES[3],
2308
+ string: CHART_PALETTE_REFERENCES[1],
2309
+ function: CHART_PALETTE_REFERENCES[4],
2310
+ type: CHART_PALETTE_REFERENCES[0],
2311
+ constant: CHART_PALETTE_REFERENCES[2]
2312
+ };
2305
2313
 
2306
2314
  // src/lib/apca-pairs.ts
2307
2315
  var COLOR_FAMILIES = [
@@ -2316,6 +2324,8 @@ var CATEGORICAL_INDICES = CHART_PALETTE_REFERENCES.map(
2316
2324
  (_, index) => index + 1
2317
2325
  );
2318
2326
  var CHART_STAGGER_LC = 4.5;
2327
+ var DIFF_SURFACES = ["success-subtle", "error-subtle"];
2328
+ var CODE_SURFACES = ["container", "container-hover", ...DIFF_SURFACES];
2319
2329
  var FOCUS_SURFACES = [
2320
2330
  "background",
2321
2331
  "container",
@@ -2375,11 +2385,23 @@ var APCA_PAIRS = [
2375
2385
  ink(`${family}-subtle-foreground`, `${family}-subtle-active`, "ui")
2376
2386
  ]),
2377
2387
  ...CATEGORICAL_INDICES.flatMap(
2378
- (index) => ["container", "background"].map((bg) => ({
2388
+ (index) => ["container", "container-hover", "background"].map((bg) => ({
2379
2389
  ...ink(`chart-categorical-${index}`, bg, "ui"),
2380
2390
  offset: (index - 1) * CHART_STAGGER_LC
2381
2391
  }))
2382
2392
  ),
2393
+ ...CODE_SURFACES.flatMap(
2394
+ (bg) => Object.keys(SYNTAX_PALETTE_REFERENCES).map(
2395
+ (role) => ink(`syntax-${role}`, bg, "ui")
2396
+ )
2397
+ ),
2398
+ // codeBlockTheme also colours code with the text tokens, which already read
2399
+ // on container and container-hover.
2400
+ ...DIFF_SURFACES.flatMap((bg) => [
2401
+ text("foreground", bg, "ui"),
2402
+ text("muted-foreground", bg, "ui"),
2403
+ text("muted-foreground-subtle", bg, "incidental")
2404
+ ]),
2383
2405
  // Focus is the primary accent (components.md § Focus States), so it shares
2384
2406
  // one solved color with primary-subtle-foreground.
2385
2407
  ...FOCUS_SURFACES.flatMap((surface) => [
@@ -2567,8 +2589,9 @@ function constrainColors(map, mode, contrast) {
2567
2589
  }
2568
2590
 
2569
2591
  // src/lib/runtime-layer.ts
2592
+ var RUNTIME_LAYER_ORDER = "@layer properties, theme, base, components, utilities, nx-runtime;";
2570
2593
  function inRuntimeLayer(css) {
2571
- return `@layer properties, theme, base, components, utilities, nx-runtime;
2594
+ return `${RUNTIME_LAYER_ORDER}
2572
2595
  @layer nx-runtime {
2573
2596
  ${css}
2574
2597
  }
@@ -4179,10 +4202,33 @@ var color_default2 = {
4179
4202
  }
4180
4203
  };
4181
4204
 
4205
+ // src/lib/token-scales.generated.ts
4206
+ var PRIMITIVE_PALETTE_NAMES = [
4207
+ "green",
4208
+ "emerald",
4209
+ "teal",
4210
+ "cyan",
4211
+ "sky",
4212
+ "indigo",
4213
+ "violet",
4214
+ "purple",
4215
+ "fuchsia",
4216
+ "pink",
4217
+ "slate",
4218
+ "rose",
4219
+ "lime",
4220
+ "yellow",
4221
+ "blue",
4222
+ "gray",
4223
+ "zinc",
4224
+ "neutral",
4225
+ "stone",
4226
+ "red",
4227
+ "orange",
4228
+ "amber"
4229
+ ];
4230
+
4182
4231
  // src/lib/primitive-palette.ts
4183
- var PRIMITIVE_PALETTE_NAMES = Object.keys(color_default2).filter(
4184
- (name) => name !== "white" && name !== "black"
4185
- );
4186
4232
  var rampCache = /* @__PURE__ */ new Map();
4187
4233
  function getPaletteRamp(palette) {
4188
4234
  if (!PRIMITIVE_PALETTE_NAMES.includes(palette)) {
@@ -4436,6 +4482,14 @@ function deriveChart(mode) {
4436
4482
  ])
4437
4483
  );
4438
4484
  }
4485
+ function deriveSyntax(mode) {
4486
+ return Object.fromEntries(
4487
+ Object.entries(SYNTAX_PALETTE_REFERENCES).map(([role, reference]) => [
4488
+ `--nx-color-syntax-${role}`,
4489
+ getPaletteShade(reference.palette, reference[mode])
4490
+ ])
4491
+ );
4492
+ }
4439
4493
  function deriveAlpha(surfaceTone, mode, profile) {
4440
4494
  const tone = SURFACE_TONE[surfaceTone];
4441
4495
  const dark = mode === "dark";
@@ -4551,6 +4605,7 @@ function deriveThemeMode(input, mode) {
4551
4605
  ...deriveSecondary(mode),
4552
4606
  ...deriveStatus(mode),
4553
4607
  ...deriveChart(mode),
4608
+ ...deriveSyntax(mode),
4554
4609
  ...deriveAlpha(surfaceTone, mode, profile),
4555
4610
  "--nx-color-focus-error": getPaletteShade(
4556
4611
  STATUS_PALETTE_FAMILIES.error,
@@ -4983,6 +5038,13 @@ var CHART_TOKEN_NAMES = [
4983
5038
  "chart-categorical-4",
4984
5039
  "chart-categorical-5"
4985
5040
  ];
5041
+ var SYNTAX_TOKEN_NAMES = [
5042
+ "syntax-keyword",
5043
+ "syntax-string",
5044
+ "syntax-function",
5045
+ "syntax-type",
5046
+ "syntax-constant"
5047
+ ];
4986
5048
  var FOCUS_TOKEN_NAMES = ["focus-default", "focus-error"];
4987
5049
  var ALPHA_TOKEN_NAMES = [
4988
5050
  "background-hover-alpha",
@@ -5001,6 +5063,7 @@ var SEMANTIC_TOKEN_REGISTRY = [
5001
5063
  ...metas("brand", BRAND_TOKEN_NAMES),
5002
5064
  ...metas("status", STATUS_TOKEN_NAMES),
5003
5065
  ...metas("chart", CHART_TOKEN_NAMES),
5066
+ ...metas("syntax", SYNTAX_TOKEN_NAMES),
5004
5067
  ...metas("focus", FOCUS_TOKEN_NAMES),
5005
5068
  ...metas("alpha", ALPHA_TOKEN_NAMES)
5006
5069
  ];
@@ -5019,6 +5082,7 @@ var SEMANTIC_TOKEN_REGISTRY = [
5019
5082
  NXDS_APPEARANCE_COOKIE_MAX_AGE_SECONDS,
5020
5083
  NXDS_APPEARANCE_DATA_ATTRS,
5021
5084
  PALETTE_KEYS,
5085
+ RUNTIME_LAYER_ORDER,
5022
5086
  SEMANTIC_TOKEN_REGISTRY,
5023
5087
  SNAPSHOT_VERSION,
5024
5088
  STROKE_OPTIONS,