@nxds/core 0.11.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.
@@ -1,5 +1,5 @@
1
- import { N as NxdsPresetField, a as NxdsAppearancePrefs, b as NxdsAppearanceState } from './surface-ladder-C8HTwT7z.cjs';
2
- export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-C8HTwT7z.cjs';
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-B950TU4_.js';
2
- export { D as DARK_SURFACE_LADDER, L as LIGHT_SURFACE_LADDER, S as SURFACE_TOKENS, c as ShadeAnchor } from './surface-ladder-B950TU4_.js';
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. */
@@ -937,8 +937,10 @@ function rampFromSeed(seedHex, options = {}) {
937
937
  }
938
938
 
939
939
  // src/lib/contrast.ts
940
+ var CONTRAST_MIN = 0;
941
+ var CONTRAST_MAX = 100;
940
942
  function normalizeContrast(value, fallback = 50) {
941
- return typeof value === "number" && Number.isFinite(value) ? Math.round(Math.max(0, Math.min(100, value))) : fallback;
943
+ return typeof value === "number" && Number.isFinite(value) ? Math.round(Math.max(CONTRAST_MIN, Math.min(CONTRAST_MAX, value))) : fallback;
942
944
  }
943
945
  function contrastTarget(tier, contrast) {
944
946
  return TIER_THRESHOLDS[tier] + 15 * contrast / 100;
@@ -1111,6 +1113,7 @@ var DEFAULT_NXDS_APPEARANCE = {
1111
1113
  stroke: "normal",
1112
1114
  prefs: {
1113
1115
  uiFont: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
1116
+ headingFont: null,
1114
1117
  codeFont: 'ui-monospace, "SF Mono", Menlo, monospace',
1115
1118
  uiFontSize: 14,
1116
1119
  codeFontSize: 12,
@@ -3254,7 +3257,7 @@ function formatTypographyDeclarations(tokenPath, value, primitiveMap) {
3254
3257
  const css = fieldValue === "auto" ? "normal" : resolveValue(fieldValue, primitiveMap);
3255
3258
  declarations.push({ property, value: css });
3256
3259
  }
3257
- if (tokenPath[0] === "heading") {
3260
+ if (tokenPath[0] === "display" || tokenPath[0] === "heading") {
3258
3261
  declarations.push({ property: "text-wrap", value: "balance" });
3259
3262
  }
3260
3263
  if (tokenPath[0] === "body") {
@@ -10833,6 +10836,41 @@ var shadows_default = {
10833
10836
 
10834
10837
  // tokens/styles/typography.json
10835
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
+ },
10836
10874
  heading: {
10837
10875
  large: {
10838
10876
  $type: "typography",
@@ -11053,6 +11091,7 @@ function typographyControl(path) {
11053
11091
  }
11054
11092
  if (group !== "family") return null;
11055
11093
  if (key === "font-sans") return { kind: "pref", field: "uiFont" };
11094
+ if (key === "font-heading") return { kind: "pref", field: "headingFont" };
11056
11095
  if (key === "font-mono") return { kind: "pref", field: "codeFont" };
11057
11096
  return null;
11058
11097
  }