nxds-cli 0.7.0 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +71 -23
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -10,6 +10,17 @@ function formatThemeFlags(flags) {
10
10
  return flags.map(({ flag, value }) => `--${flag} ${shellValue(value)}`).join(" ");
11
11
  }
12
12
 
13
+ // ../core/src/token-source/ui-scale.ts
14
+ var UI_SCALES = {
15
+ small: { spacing: 0.9, text: 12 / 14, icon: 14 / 16 },
16
+ default: { spacing: 1, text: 1, icon: 1 },
17
+ large: { spacing: 1.1, text: 16 / 14, icon: 18 / 16 },
18
+ larger: { spacing: 1.25, text: 18 / 14, icon: 20 / 16 }
19
+ };
20
+ var NON_DEFAULT_UI_SCALES = Object.keys(UI_SCALES).filter((scale) => scale !== "default");
21
+ var TEXT_SIZES = [12, 13, 14, 15, 16];
22
+ var MIN_TEXT_PX = 8;
23
+
13
24
  // ../../node_modules/culori/src/rgb/parseNumber.js
14
25
  var parseNumber = (color, len) => {
15
26
  if (typeof color !== "number") return;
@@ -3839,9 +3850,6 @@ for (const pair of APCA_PAIRS) {
3839
3850
  group.pairs.push(pair);
3840
3851
  }
3841
3852
 
3842
- // ../core/src/lib/typography-scale.ts
3843
- var TYPOGRAPHY_BASE_PX = 14;
3844
-
3845
3853
  // ../core/src/lib/appearance-model.ts
3846
3854
  var DEFAULT_BRAND_COLOR = "#0a0a0a";
3847
3855
  var BASE_TONE_OPTIONS = [
@@ -3851,6 +3859,13 @@ var BASE_TONE_OPTIONS = [
3851
3859
  { value: "slate", label: "Slate", color: "#717376" },
3852
3860
  { value: "gray", label: "Gray", color: "#707274" }
3853
3861
  ];
3862
+ var UI_SCALE_OPTIONS = [
3863
+ { value: "small", label: "Small" },
3864
+ { value: "default", label: "Default" },
3865
+ { value: "large", label: "Large" },
3866
+ { value: "larger", label: "Larger" }
3867
+ ];
3868
+ var TEXT_SIZE_OPTIONS = TEXT_SIZES.map((value) => ({ value, label: `${value}px` }));
3854
3869
  var DENSITY_OPTIONS = [
3855
3870
  { value: "tight", label: "Tight" },
3856
3871
  { value: "compact", label: "Compact" },
@@ -3884,6 +3899,8 @@ var DEFAULT_NXDS_APPEARANCE = {
3884
3899
  surfaceTone: "zinc",
3885
3900
  lightContrast: 50,
3886
3901
  darkContrast: 50,
3902
+ uiScale: "default",
3903
+ textSize: 14,
3887
3904
  density: "default",
3888
3905
  corners: "subtle",
3889
3906
  elevation: "quiet",
@@ -3892,18 +3909,21 @@ var DEFAULT_NXDS_APPEARANCE = {
3892
3909
  uiFont: '-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
3893
3910
  headingFont: null,
3894
3911
  codeFont: 'ui-monospace, "SF Mono", Menlo, monospace',
3895
- uiFontSize: TYPOGRAPHY_BASE_PX,
3896
3912
  codeFontSize: 12,
3897
3913
  reduceMotion: false,
3898
3914
  pointerCursors: false,
3899
3915
  fontSmoothing: false
3900
3916
  }
3901
3917
  };
3902
- var FONT_SIZE_PX_MIN = 8;
3918
+ var FONT_SIZE_PX_MIN = MIN_TEXT_PX;
3903
3919
  var FONT_SIZE_PX_MAX = 32;
3904
3920
  var SURFACE_TONES = new Set(
3905
3921
  BASE_TONE_OPTIONS.map((option) => option.value)
3906
3922
  );
3923
+ var SCALES = new Set(
3924
+ UI_SCALE_OPTIONS.map((option) => option.value)
3925
+ );
3926
+ var TEXT_SIZE_VALUES = new Set(TEXT_SIZES);
3907
3927
  var DENSITIES = new Set(
3908
3928
  DENSITY_OPTIONS.map((option) => option.value)
3909
3929
  );
@@ -4056,20 +4076,6 @@ function contrastField(flag, key, description) {
4056
4076
  })
4057
4077
  };
4058
4078
  }
4059
- function fontSizeField(flag, key, description) {
4060
- return {
4061
- kind: "integer",
4062
- flag,
4063
- key: `prefs.${key}`,
4064
- description,
4065
- min: FONT_SIZE_PX_MIN,
4066
- max: FONT_SIZE_PX_MAX,
4067
- read: (theme) => String(theme.appearance.prefs[key]),
4068
- write: (theme, value) => withPrefs(theme, {
4069
- [key]: integer(flag, value, FONT_SIZE_PX_MIN, FONT_SIZE_PX_MAX)
4070
- })
4071
- };
4072
- }
4073
4079
  function fontField(flag, key, description, categories, fallback) {
4074
4080
  const fonts = FONT_OPTIONS.filter(
4075
4081
  (font) => categories.includes(font.category)
@@ -4100,6 +4106,9 @@ function fontField(flag, key, description, categories, fallback) {
4100
4106
  }
4101
4107
  };
4102
4108
  }
4109
+ var TEXT_SIZES2 = TEXT_SIZE_OPTIONS.map((option) => option.value);
4110
+ var TEXT_SIZE_MIN = Math.min(...TEXT_SIZES2);
4111
+ var TEXT_SIZE_MAX = Math.max(...TEXT_SIZES2);
4103
4112
  var DEFAULT_PREFS = DEFAULT_NXDS_APPEARANCE.prefs;
4104
4113
  var TEXT_FONTS = ["sans", "serif"];
4105
4114
  var NXDS_THEME_FIELDS = [
@@ -4120,6 +4129,30 @@ var NXDS_THEME_FIELDS = [
4120
4129
  "neutral tone of backgrounds and borders",
4121
4130
  BASE_TONE_OPTIONS.map((option) => option.value)
4122
4131
  ),
4132
+ enumField(
4133
+ "ui-scale",
4134
+ "uiScale",
4135
+ "size of text, icons and spacing together",
4136
+ UI_SCALE_OPTIONS.map((option) => option.value)
4137
+ ),
4138
+ {
4139
+ kind: "integer",
4140
+ flag: "text-size",
4141
+ key: "textSize",
4142
+ description: `label text size in px at the default UI scale, ${TEXT_SIZE_MIN} to ${TEXT_SIZE_MAX}`,
4143
+ min: TEXT_SIZE_MIN,
4144
+ max: TEXT_SIZE_MAX,
4145
+ read: (theme) => String(theme.appearance.textSize),
4146
+ write: (theme, value) => withAppearance(theme, {
4147
+ // Every whole number from the minimum to the maximum is a text size.
4148
+ textSize: integer(
4149
+ "text-size",
4150
+ value,
4151
+ TEXT_SIZE_MIN,
4152
+ TEXT_SIZE_MAX
4153
+ )
4154
+ })
4155
+ },
4123
4156
  enumField(
4124
4157
  "density",
4125
4158
  "density",
@@ -4170,8 +4203,23 @@ var NXDS_THEME_FIELDS = [
4170
4203
  value: "system",
4171
4204
  family: DEFAULT_PREFS.codeFont
4172
4205
  }),
4173
- fontSizeField("font-size", "uiFontSize", "UI text size in px"),
4174
- fontSizeField("code-font-size", "codeFontSize", "code text size in px"),
4206
+ {
4207
+ kind: "integer",
4208
+ flag: "code-font-size",
4209
+ key: "prefs.codeFontSize",
4210
+ description: "code text size in px",
4211
+ min: FONT_SIZE_PX_MIN,
4212
+ max: FONT_SIZE_PX_MAX,
4213
+ read: (theme) => String(theme.appearance.prefs.codeFontSize),
4214
+ write: (theme, value) => withPrefs(theme, {
4215
+ codeFontSize: integer(
4216
+ "code-font-size",
4217
+ value,
4218
+ FONT_SIZE_PX_MIN,
4219
+ FONT_SIZE_PX_MAX
4220
+ )
4221
+ })
4222
+ },
4175
4223
  {
4176
4224
  kind: "choice",
4177
4225
  flag: "icons",
@@ -4556,7 +4604,7 @@ async function fetchRelease(registry, version) {
4556
4604
  if (isNewerSchema(value)) {
4557
4605
  const release = version === "latest" ? "The latest nxds release" : `nxds ${version}`;
4558
4606
  throw new CliError(
4559
- `${release} needs a newer nxds-cli than ${"0.7.0"}. Run \`${CLI_COMMAND}\` to get the newest one.`
4607
+ `${release} needs a newer nxds-cli than ${"0.8.0"}. Run \`${CLI_COMMAND}\` to get the newest one.`
4560
4608
  );
4561
4609
  }
4562
4610
  const invalid2 = (problems) => new CliError(
@@ -7138,7 +7186,7 @@ function program(done, write) {
7138
7186
  // Errors are printed once, by `main`, as text or JSON.
7139
7187
  outputError: () => {
7140
7188
  }
7141
- }).exitOverride().name(CLI_COMMAND).description("Add nxds to your app.").version("0.7.0", "-v, --version", "print the version").helpOption("-h, --help", "show help").helpCommand("help [command]", "show help for a command").option("--json", "print machine-readable JSON").option("--cwd <path>", "run in another folder").addOption(
7189
+ }).exitOverride().name(CLI_COMMAND).description("Add nxds to your app.").version("0.8.0", "-v, --version", "print the version").helpOption("-h, --help", "show help").helpCommand("help [command]", "show help for a command").option("--json", "print machine-readable JSON").option("--cwd <path>", "run in another folder").addOption(
7142
7190
  new Option(
7143
7191
  "--registry <url|path>",
7144
7192
  "where to get nxds releases (default: https://nxds.dev/r)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nxds-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Install nxds components, blocks and setup into your app.",
6
6
  "keywords": [
@@ -45,9 +45,9 @@
45
45
  "@types/semver": "^7.8.0",
46
46
  "tsup": "^8.5.1",
47
47
  "typescript": "^5.9.3",
48
- "@nxds/catalog": "0.0.2",
49
- "@nxds/claude-design": "0.14.0",
50
- "@nxds/core": "0.13.0"
48
+ "@nxds/catalog": "0.0.3",
49
+ "@nxds/claude-design": "0.17.0",
50
+ "@nxds/core": "0.14.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "tsup",