@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":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvG,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -72,8 +72,8 @@ var DEFAULT_CONFIGURATOR_STATE = {
72
72
  theme: "neutral"
73
73
  },
74
74
  spacing: {
75
- density: 0.5
76
- // 1.0x multiplier = preserves current hardcoded values
75
+ preset: "md"
76
+ // Medium (8px base): default/balanced spacing
77
77
  },
78
78
  roundness: {
79
79
  intensity: 0.5
@@ -269,11 +269,11 @@ function configuratorReducer(state, action) {
269
269
  }
270
270
  };
271
271
  // Spacing actions
272
- case "SET_SPACING_DENSITY":
272
+ case "SET_SPACING_PRESET":
273
273
  return {
274
274
  ...state,
275
275
  spacing: {
276
- density: clamp(action.density, 0, 1)
276
+ preset: action.preset
277
277
  }
278
278
  };
279
279
  // Roundness actions
@@ -440,9 +440,18 @@ function traditionalHueToOklch(hue) {
440
440
  }
441
441
 
442
442
  // src/bridge/toThemeConfig.ts
443
- function densityToMultiplier(density) {
444
- return 0.5 + density * 1.5;
445
- }
443
+ var SPACING_PRESET_TO_BASE = {
444
+ xs: 6,
445
+ // Extra Small: compact/dense UI
446
+ sm: 7,
447
+ // Small: tighter spacing
448
+ md: 8,
449
+ // Medium: default/balanced
450
+ lg: 9,
451
+ // Large: more spacious
452
+ xl: 10
453
+ // Extra Large: maximum spacing
454
+ };
446
455
  function roundnessToMultiplier(intensity) {
447
456
  return intensity * 2;
448
457
  }
@@ -508,7 +517,7 @@ function toThemeConfig(state) {
508
517
  darkest: state.dynamicRange.darkest,
509
518
  ...hueGrading ? { hueGrading } : {}
510
519
  };
511
- const spacingMultiplier = densityToMultiplier(state.spacing?.density ?? 0.5);
520
+ const spacingBase = SPACING_PRESET_TO_BASE[state.spacing?.preset ?? "md"];
512
521
  const radiusMultiplier = roundnessToMultiplier(state.roundness?.intensity ?? 0.5);
513
522
  return {
514
523
  colorSystem: { dynamicRange, palettes },
@@ -522,12 +531,21 @@ function toThemeConfig(state) {
522
531
  offsets: [-0.02, 0, 0.04]
523
532
  },
524
533
  spacing: {
525
- xs: Math.round(4 * spacingMultiplier),
526
- sm: Math.round(8 * spacingMultiplier),
527
- md: Math.round(12 * spacingMultiplier),
528
- lg: Math.round(16 * spacingMultiplier),
529
- xl: Math.round(24 * spacingMultiplier),
530
- xxl: Math.round(32 * spacingMultiplier)
534
+ "00": Math.round(spacingBase * 0),
535
+ // Always 0
536
+ "02": Math.round(spacingBase * 0.25),
537
+ "04": Math.round(spacingBase * 0.5),
538
+ "06": Math.round(spacingBase * 0.75),
539
+ "08": Math.round(spacingBase * 1),
540
+ // Equals base
541
+ "10": Math.round(spacingBase * 1.25),
542
+ "12": Math.round(spacingBase * 1.5),
543
+ "16": Math.round(spacingBase * 2),
544
+ "20": Math.round(spacingBase * 2.5),
545
+ "24": Math.round(spacingBase * 3),
546
+ "32": Math.round(spacingBase * 4),
547
+ "40": Math.round(spacingBase * 5),
548
+ "48": Math.round(spacingBase * 6)
531
549
  },
532
550
  radius: {
533
551
  none: 0,
@@ -1213,21 +1231,25 @@ var ICON_WEIGHT_OPTIONS = [
1213
1231
  ];
1214
1232
  function DesignPanel({ state, dispatch }) {
1215
1233
  const tokens = useTokens(1);
1216
- const density = state.spacing?.density ?? 0.5;
1234
+ const spacingPreset = state.spacing?.preset ?? "md";
1217
1235
  const intensity = state.roundness?.intensity ?? 0.5;
1218
1236
  const baseSize = state.typography?.scale.baseSize ?? 16;
1219
1237
  const ratio = state.typography?.scale.ratio ?? 1.25;
1220
1238
  const variant = state.icons?.variant ?? "rounded";
1221
1239
  const weight = state.icons?.weight ?? 400;
1222
1240
  return /* @__PURE__ */ React.createElement(Card, { elevation: 1, style: styles5.container }, /* @__PURE__ */ React.createElement(Text, { style: [styles5.title, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Design System"), /* @__PURE__ */ React.createElement(Text, { style: [styles5.subtitle, { color: srgbToHex(tokens.textSecondary.srgb) }] }, "Spacing"), /* @__PURE__ */ React.createElement(
1223
- Slider,
1241
+ Select,
1224
1242
  {
1225
- value: Math.round(density * 100),
1226
- onValueChange: (v) => dispatch({ type: "SET_SPACING_DENSITY", density: v / 100 }),
1227
- min: 0,
1228
- max: 100,
1229
- label: "Density",
1230
- showValue: true
1243
+ value: spacingPreset,
1244
+ onValueChange: (preset) => dispatch({ type: "SET_SPACING_PRESET", preset }),
1245
+ options: [
1246
+ { value: "xs", label: "Extra Small" },
1247
+ { value: "sm", label: "Small" },
1248
+ { value: "md", label: "Medium" },
1249
+ { value: "lg", label: "Large" },
1250
+ { value: "xl", label: "Extra Large" }
1251
+ ],
1252
+ label: "Preset"
1231
1253
  }
1232
1254
  ), /* @__PURE__ */ React.createElement(Text, { style: [styles5.subtitle, { color: srgbToHex(tokens.textSecondary.srgb) }] }, "Roundness"), /* @__PURE__ */ React.createElement(
1233
1255
  Slider,