@newtonedev/configurator 0.1.1 → 0.1.2

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,
@@ -1219,21 +1237,25 @@ var ICON_WEIGHT_OPTIONS = [
1219
1237
  ];
1220
1238
  function DesignPanel({ state, dispatch }) {
1221
1239
  const tokens = components.useTokens(1);
1222
- const density = state.spacing?.density ?? 0.5;
1240
+ const spacingPreset = state.spacing?.preset ?? "md";
1223
1241
  const intensity = state.roundness?.intensity ?? 0.5;
1224
1242
  const baseSize = state.typography?.scale.baseSize ?? 16;
1225
1243
  const ratio = state.typography?.scale.ratio ?? 1.25;
1226
1244
  const variant = state.icons?.variant ?? "rounded";
1227
1245
  const weight = state.icons?.weight ?? 400;
1228
1246
  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,
1247
+ components.Select,
1230
1248
  {
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
1249
+ value: spacingPreset,
1250
+ onValueChange: (preset) => dispatch({ type: "SET_SPACING_PRESET", preset }),
1251
+ options: [
1252
+ { value: "xs", label: "Extra Small" },
1253
+ { value: "sm", label: "Small" },
1254
+ { value: "md", label: "Medium" },
1255
+ { value: "lg", label: "Large" },
1256
+ { value: "xl", label: "Extra Large" }
1257
+ ],
1258
+ label: "Preset"
1237
1259
  }
1238
1260
  ), /* @__PURE__ */ React__default.default.createElement(reactNative.Text, { style: [styles5.subtitle, { color: newtone.srgbToHex(tokens.textSecondary.srgb) }] }, "Roundness"), /* @__PURE__ */ React__default.default.createElement(
1239
1261
  components.Slider,