@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.
- package/dist/bridge/toThemeConfig.d.ts.map +1 -1
- package/dist/index.cjs +44 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -22
- package/dist/index.js.map +1 -1
- package/dist/panels/DesignPanel.d.ts.map +1 -1
- package/dist/state/actions.d.ts +3 -3
- package/dist/state/actions.d.ts.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/bridge/toThemeConfig.ts +24 -13
- package/src/index.ts +1 -1
- package/src/panels/DesignPanel.tsx +13 -9
- package/src/state/actions.ts +2 -2
- package/src/state/defaults.ts +1 -1
- package/src/state/reducer.ts +2 -2
- package/src/types.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toThemeConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/toThemeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,
|
|
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
|
-
|
|
82
|
-
//
|
|
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 "
|
|
278
|
+
case "SET_SPACING_PRESET":
|
|
279
279
|
return {
|
|
280
280
|
...state,
|
|
281
281
|
spacing: {
|
|
282
|
-
|
|
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
|
-
|
|
450
|
-
|
|
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
|
|
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
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
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
|
|
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.
|
|
1247
|
+
components.Select,
|
|
1230
1248
|
{
|
|
1231
|
-
value:
|
|
1232
|
-
onValueChange: (
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
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,
|