@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.
@@ -966,8 +966,10 @@ function rampFromSeed(seedHex, options = {}) {
966
966
  }
967
967
 
968
968
  // src/lib/contrast.ts
969
+ var CONTRAST_MIN = 0;
970
+ var CONTRAST_MAX = 100;
969
971
  function normalizeContrast(value, fallback = 50) {
970
- return typeof value === "number" && Number.isFinite(value) ? Math.round(Math.max(0, Math.min(100, value))) : fallback;
972
+ return typeof value === "number" && Number.isFinite(value) ? Math.round(Math.max(CONTRAST_MIN, Math.min(CONTRAST_MAX, value))) : fallback;
971
973
  }
972
974
  function contrastTarget(tier, contrast) {
973
975
  return TIER_THRESHOLDS[tier] + 15 * contrast / 100;
@@ -1140,6 +1142,7 @@ var DEFAULT_NXDS_APPEARANCE = {
1140
1142
  stroke: "normal",
1141
1143
  prefs: {
1142
1144
  uiFont: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
1145
+ headingFont: null,
1143
1146
  codeFont: 'ui-monospace, "SF Mono", Menlo, monospace',
1144
1147
  uiFontSize: 14,
1145
1148
  codeFontSize: 12,
@@ -3283,7 +3286,7 @@ function formatTypographyDeclarations(tokenPath, value, primitiveMap) {
3283
3286
  const css = fieldValue === "auto" ? "normal" : resolveValue(fieldValue, primitiveMap);
3284
3287
  declarations.push({ property, value: css });
3285
3288
  }
3286
- if (tokenPath[0] === "heading") {
3289
+ if (tokenPath[0] === "display" || tokenPath[0] === "heading") {
3287
3290
  declarations.push({ property: "text-wrap", value: "balance" });
3288
3291
  }
3289
3292
  if (tokenPath[0] === "body") {
@@ -10862,6 +10865,41 @@ var shadows_default = {
10862
10865
 
10863
10866
  // tokens/styles/typography.json
10864
10867
  var typography_default = {
10868
+ display: {
10869
+ large: {
10870
+ $type: "typography",
10871
+ $value: {
10872
+ fontFamily: "{family.font-heading}",
10873
+ fontSize: "{size.5xl}",
10874
+ fontWeight: "{weight.semibold}",
10875
+ lineHeight: "{line-height.5xl}",
10876
+ letterSpacing: "{letterspacing.tighter}"
10877
+ },
10878
+ $description: "Largest display title \u2014 hero and landing-page section titles"
10879
+ },
10880
+ medium: {
10881
+ $type: "typography",
10882
+ $value: {
10883
+ fontFamily: "{family.font-heading}",
10884
+ fontSize: "{size.4xl}",
10885
+ fontWeight: "{weight.semibold}",
10886
+ lineHeight: "{line-height.4xl}",
10887
+ letterSpacing: "{letterspacing.tighter}"
10888
+ },
10889
+ $description: "Display title one step below display-large, for page sections"
10890
+ },
10891
+ small: {
10892
+ $type: "typography",
10893
+ $value: {
10894
+ fontFamily: "{family.font-heading}",
10895
+ fontSize: "{size.3xl}",
10896
+ fontWeight: "{weight.semibold}",
10897
+ lineHeight: "{line-height.3xl}",
10898
+ letterSpacing: "{letterspacing.tighter}"
10899
+ },
10900
+ $description: "Smallest display title \u2014 page-section titles in narrow layouts"
10901
+ }
10902
+ },
10865
10903
  heading: {
10866
10904
  large: {
10867
10905
  $type: "typography",
@@ -11082,6 +11120,7 @@ function typographyControl(path) {
11082
11120
  }
11083
11121
  if (group !== "family") return null;
11084
11122
  if (key === "font-sans") return { kind: "pref", field: "uiFont" };
11123
+ if (key === "font-heading") return { kind: "pref", field: "headingFont" };
11085
11124
  if (key === "font-mono") return { kind: "pref", field: "codeFont" };
11086
11125
  return null;
11087
11126
  }