@newtonedev/configurator 0.1.1 → 0.1.3

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 +1 @@
1
- {"version":3,"file":"toThemeConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/toThemeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,wBAAwB,CAAC;AAgE7E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CAuF1E"}
1
+ {"version":3,"file":"toThemeConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/toThemeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,wBAAwB,CAAC;AAoE7E;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CA8F1E"}
package/dist/index.cjs CHANGED
@@ -78,8 +78,8 @@ var DEFAULT_CONFIGURATOR_STATE = {
78
78
  theme: "neutral"
79
79
  },
80
80
  spacing: {
81
- density: 0.5
82
- // 1.0x multiplier = preserves current hardcoded values
81
+ preset: "md"
82
+ // Medium (8px base): default/balanced spacing
83
83
  },
84
84
  roundness: {
85
85
  intensity: 0.5
@@ -275,11 +275,11 @@ function configuratorReducer(state, action) {
275
275
  }
276
276
  };
277
277
  // Spacing actions
278
- case "SET_SPACING_DENSITY":
278
+ case "SET_SPACING_PRESET":
279
279
  return {
280
280
  ...state,
281
281
  spacing: {
282
- density: clamp(action.density, 0, 1)
282
+ preset: action.preset
283
283
  }
284
284
  };
285
285
  // Roundness actions
@@ -446,9 +446,18 @@ function traditionalHueToOklch(hue) {
446
446
  }
447
447
 
448
448
  // src/bridge/toThemeConfig.ts
449
- function densityToMultiplier(density) {
450
- return 0.5 + density * 1.5;
451
- }
449
+ var SPACING_PRESET_TO_BASE = {
450
+ xs: 6,
451
+ // Extra Small: compact/dense UI
452
+ sm: 7,
453
+ // Small: tighter spacing
454
+ md: 8,
455
+ // Medium: default/balanced
456
+ lg: 9,
457
+ // Large: more spacious
458
+ xl: 10
459
+ // Extra Large: maximum spacing
460
+ };
452
461
  function roundnessToMultiplier(intensity) {
453
462
  return intensity * 2;
454
463
  }
@@ -514,7 +523,7 @@ function toThemeConfig(state) {
514
523
  darkest: state.dynamicRange.darkest,
515
524
  ...hueGrading ? { hueGrading } : {}
516
525
  };
517
- const spacingMultiplier = densityToMultiplier(state.spacing?.density ?? 0.5);
526
+ const spacingBase = SPACING_PRESET_TO_BASE[state.spacing?.preset ?? "md"];
518
527
  const radiusMultiplier = roundnessToMultiplier(state.roundness?.intensity ?? 0.5);
519
528
  return {
520
529
  colorSystem: { dynamicRange, palettes },
@@ -528,12 +537,21 @@ function toThemeConfig(state) {
528
537
  offsets: [-0.02, 0, 0.04]
529
538
  },
530
539
  spacing: {
531
- xs: Math.round(4 * spacingMultiplier),
532
- sm: Math.round(8 * spacingMultiplier),
533
- md: Math.round(12 * spacingMultiplier),
534
- lg: Math.round(16 * spacingMultiplier),
535
- xl: Math.round(24 * spacingMultiplier),
536
- xxl: Math.round(32 * spacingMultiplier)
540
+ "00": Math.round(spacingBase * 0),
541
+ // Always 0
542
+ "02": Math.round(spacingBase * 0.25),
543
+ "04": Math.round(spacingBase * 0.5),
544
+ "06": Math.round(spacingBase * 0.75),
545
+ "08": Math.round(spacingBase * 1),
546
+ // Equals base
547
+ "10": Math.round(spacingBase * 1.25),
548
+ "12": Math.round(spacingBase * 1.5),
549
+ "16": Math.round(spacingBase * 2),
550
+ "20": Math.round(spacingBase * 2.5),
551
+ "24": Math.round(spacingBase * 3),
552
+ "32": Math.round(spacingBase * 4),
553
+ "40": Math.round(spacingBase * 5),
554
+ "48": Math.round(spacingBase * 6)
537
555
  },
538
556
  radius: {
539
557
  none: 0,
@@ -1028,7 +1046,7 @@ function PreviewCard({
1028
1046
  onValueChange: (t) => dispatch({ type: "SET_PREVIEW_THEME", theme: t }),
1029
1047
  label: "Theme"
1030
1048
  }
1031
- )), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: previewStyles.wrapper }, /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: previewStyles.row }, /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "primary", size: "sm" }, "Primary"), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "secondary", size: "sm" }, "Secondary"), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "ghost", size: "sm" }, "Ghost"), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "outline", size: "sm" }, "Outline")), /* @__PURE__ */ React__default.default.createElement(components.TextInput, { label: "Sample Input", value: "Hello, Newtone", onChangeText: () => {
1049
+ )), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: previewStyles.wrapper }, /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: previewStyles.row }, /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "primary", semantic: "accent", size: "sm" }, "Primary"), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "primary", semantic: "neutral", size: "sm" }, "Secondary"), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "tertiary", semantic: "neutral", size: "sm" }, "Ghost"), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "secondary", semantic: "neutral", size: "sm" }, "Outline")), /* @__PURE__ */ React__default.default.createElement(components.TextInput, { label: "Sample Input", value: "Hello, Newtone", onChangeText: () => {
1032
1050
  } }), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: previewStyles.row }, /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: [previewStyles.statusDot, { backgroundColor: newtone.srgbToHex(tokens.success.srgb) }] }), /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [previewStyles.statusText, { color: newtone.srgbToHex(tokens.textPrimary.srgb) }] }, "Success"), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: [previewStyles.statusDot, { backgroundColor: newtone.srgbToHex(tokens.warning.srgb) }] }), /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [previewStyles.statusText, { color: newtone.srgbToHex(tokens.textPrimary.srgb) }] }, "Warning"), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: [previewStyles.statusDot, { backgroundColor: newtone.srgbToHex(tokens.error.srgb) }] }), /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [previewStyles.statusText, { color: newtone.srgbToHex(tokens.textPrimary.srgb) }] }, "Error"))));
1033
1051
  }
1034
1052
  function PreviewPanel({ state, dispatch, themeConfig }) {
@@ -1156,7 +1174,8 @@ function ExportPanel({ state }) {
1156
1174
  return /* @__PURE__ */ React__default.default.createElement(components.Card, { elevation: 1, style: styles4.container }, /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [styles4.title, { color: newtone.srgbToHex(tokens.textPrimary.srgb) }] }, "Export"), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: styles4.tabs }, /* @__PURE__ */ React__default.default.createElement(
1157
1175
  components.Button,
1158
1176
  {
1159
- variant: format === "css" ? "primary" : "ghost",
1177
+ variant: format === "css" ? "primary" : "tertiary",
1178
+ semantic: format === "css" ? "accent" : "neutral",
1160
1179
  size: "sm",
1161
1180
  onPress: () => setFormat("css")
1162
1181
  },
@@ -1164,12 +1183,13 @@ function ExportPanel({ state }) {
1164
1183
  ), /* @__PURE__ */ React__default.default.createElement(
1165
1184
  components.Button,
1166
1185
  {
1167
- variant: format === "json" ? "primary" : "ghost",
1186
+ variant: format === "json" ? "primary" : "tertiary",
1187
+ semantic: format === "json" ? "accent" : "neutral",
1168
1188
  size: "sm",
1169
1189
  onPress: () => setFormat("json")
1170
1190
  },
1171
1191
  "JSON"
1172
- ), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "outline", size: "sm", onPress: handleCopy }, copied ? "Copied!" : "Copy")), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: [styles4.codeBlock, { backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb) }] }, /* @__PURE__ */ React__default.default.createElement(
1192
+ ), /* @__PURE__ */ React__default.default.createElement(components.Button, { variant: "secondary", semantic: "neutral", size: "sm", onPress: handleCopy }, copied ? "Copied!" : "Copy")), /* @__PURE__ */ React__default.default.createElement(reactNative.View, { style: [styles4.codeBlock, { backgroundColor: newtone.srgbToHex(tokens.backgroundSunken.srgb) }] }, /* @__PURE__ */ React__default.default.createElement(
1173
1193
  reactNative.Text,
1174
1194
  {
1175
1195
  style: [styles4.code, { color: newtone.srgbToHex(tokens.textPrimary.srgb) }],
@@ -1219,21 +1239,25 @@ var ICON_WEIGHT_OPTIONS = [
1219
1239
  ];
1220
1240
  function DesignPanel({ state, dispatch }) {
1221
1241
  const tokens = components.useTokens(1);
1222
- const density = state.spacing?.density ?? 0.5;
1242
+ const spacingPreset = state.spacing?.preset ?? "md";
1223
1243
  const intensity = state.roundness?.intensity ?? 0.5;
1224
1244
  const baseSize = state.typography?.scale.baseSize ?? 16;
1225
1245
  const ratio = state.typography?.scale.ratio ?? 1.25;
1226
1246
  const variant = state.icons?.variant ?? "rounded";
1227
1247
  const weight = state.icons?.weight ?? 400;
1228
1248
  return /* @__PURE__ */ React__default.default.createElement(components.Card, { elevation: 1, style: styles5.container }, /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [styles5.title, { color: newtone.srgbToHex(tokens.textPrimary.srgb) }] }, "Design System"), /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [styles5.subtitle, { color: newtone.srgbToHex(tokens.textSecondary.srgb) }] }, "Spacing"), /* @__PURE__ */ React__default.default.createElement(
1229
- components.Slider,
1249
+ components.Select,
1230
1250
  {
1231
- value: Math.round(density * 100),
1232
- onValueChange: (v) => dispatch({ type: "SET_SPACING_DENSITY", density: v / 100 }),
1233
- min: 0,
1234
- max: 100,
1235
- label: "Density",
1236
- showValue: true
1251
+ value: spacingPreset,
1252
+ onValueChange: (preset) => dispatch({ type: "SET_SPACING_PRESET", preset }),
1253
+ options: [
1254
+ { value: "xs", label: "Extra Small" },
1255
+ { value: "sm", label: "Small" },
1256
+ { value: "md", label: "Medium" },
1257
+ { value: "lg", label: "Large" },
1258
+ { value: "xl", label: "Extra Large" }
1259
+ ],
1260
+ label: "Preset"
1237
1261
  }
1238
1262
  ), /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [styles5.subtitle, { color: newtone.srgbToHex(tokens.textSecondary.srgb) }] }, "Roundness"), /* @__PURE__ */ React__default.default.createElement(
1239
1263
  components.Slider,