@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
package/dist/state/actions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DesaturationStrength, HueGradingStrength } from 'newtone';
|
|
2
2
|
import type { ColorMode, ThemeName } from '@newtonedev/components';
|
|
3
|
-
import type { ConfiguratorState, FontConfig } from '../types';
|
|
3
|
+
import type { ConfiguratorState, FontConfig, SpacingPreset } from '../types';
|
|
4
4
|
export type ConfiguratorAction = {
|
|
5
5
|
readonly type: 'SET_PALETTE_HUE';
|
|
6
6
|
readonly index: number;
|
|
@@ -74,8 +74,8 @@ export type ConfiguratorAction = {
|
|
|
74
74
|
readonly type: 'SET_GLOBAL_GRADE_DARK_HUE';
|
|
75
75
|
readonly hue: number;
|
|
76
76
|
} | {
|
|
77
|
-
readonly type: '
|
|
78
|
-
readonly
|
|
77
|
+
readonly type: 'SET_SPACING_PRESET';
|
|
78
|
+
readonly preset: SpacingPreset;
|
|
79
79
|
} | {
|
|
80
80
|
readonly type: 'SET_ROUNDNESS_INTENSITY';
|
|
81
81
|
readonly intensity: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/state/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/state/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE7E,MAAM,MAAM,kBAAkB,GAE1B;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAClF;IAAE,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAChG;IAAE,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;CAAE,GAChH;IAAE,QAAQ,CAAC,IAAI,EAAE,6BAA6B,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE,GAC9G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e,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAC7D;IAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAEhE;IAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;CAAE,GACzF;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;CAAE,GAC9F;IAAE,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAErE;IAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAEjE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { DesaturationStrength, HueGradingStrength } from 'newtone';
|
|
2
2
|
import type { ColorMode, ThemeName } from '@newtonedev/components';
|
|
3
|
+
/** Spacing preset options */
|
|
4
|
+
export type SpacingPreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
5
|
/** Per-palette state in the configurator (human-readable, traditional hues) */
|
|
4
6
|
export interface PaletteState {
|
|
5
7
|
readonly name: string;
|
|
@@ -41,7 +43,7 @@ export interface ConfiguratorState {
|
|
|
41
43
|
readonly theme: ThemeName;
|
|
42
44
|
};
|
|
43
45
|
readonly spacing?: {
|
|
44
|
-
readonly
|
|
46
|
+
readonly preset: SpacingPreset;
|
|
45
47
|
};
|
|
46
48
|
readonly roundness?: {
|
|
47
49
|
readonly intensity: number;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnE,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,qBAAqB,EAAE,OAAO,GAAG,MAAM,CAAC;IACjD,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;IAC9C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wCAAwC;AACxC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CA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AAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC;IACF,QAAQ,CAAC,UAAU,CAAC,EAAE;QACpB,QAAQ,CAAC,KAAK,EAAE;YACd,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;YAC1B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;YAC7B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;SAC9B,CAAC;QACF,QAAQ,CAAC,KAAK,EAAE;YACd,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;SACxB,CAAC;KACH,CAAC;IACF,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;QACnD,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;QACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;KAC7B,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type { ConfiguratorState } from '../types';
|
|
1
|
+
import type { ConfiguratorState, SpacingPreset } from '../types';
|
|
2
2
|
import type { NewtoneThemeConfig, FontConfig } from '@newtonedev/components';
|
|
3
3
|
import type { PaletteConfig, DynamicRange, HueGrading, HueGradingEndpoint } from 'newtone';
|
|
4
4
|
import { traditionalHueToOklch } from '../hue-conversion';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Spacing preset to base pixel value mapping
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const SPACING_PRESET_TO_BASE: Record<SpacingPreset, number> = {
|
|
10
|
+
xs: 6, // Extra Small: compact/dense UI
|
|
11
|
+
sm: 7, // Small: tighter spacing
|
|
12
|
+
md: 8, // Medium: default/balanced
|
|
13
|
+
lg: 9, // Large: more spacious
|
|
14
|
+
xl: 10, // Extra Large: maximum spacing
|
|
15
|
+
};
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
18
|
* Convert roundness intensity [0, 1] to radius multiplier [0, 2.0]
|
|
@@ -110,8 +114,8 @@ export function toThemeConfig(state: ConfiguratorState): NewtoneThemeConfig {
|
|
|
110
114
|
...(hueGrading ? { hueGrading } : {}),
|
|
111
115
|
};
|
|
112
116
|
|
|
113
|
-
// Compute spacing
|
|
114
|
-
const
|
|
117
|
+
// Compute spacing base from preset (default 'md' = 8px base)
|
|
118
|
+
const spacingBase = SPACING_PRESET_TO_BASE[state.spacing?.preset ?? 'md'];
|
|
115
119
|
|
|
116
120
|
// Compute radius multiplier from roundness intensity slider (default 0.5 = 1.0x multiplier)
|
|
117
121
|
const radiusMultiplier = roundnessToMultiplier(state.roundness?.intensity ?? 0.5);
|
|
@@ -128,12 +132,19 @@ export function toThemeConfig(state: ConfiguratorState): NewtoneThemeConfig {
|
|
|
128
132
|
offsets: [-0.02, 0, 0.04] as const,
|
|
129
133
|
},
|
|
130
134
|
spacing: {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
'00': Math.round(spacingBase * 0), // Always 0
|
|
136
|
+
'02': Math.round(spacingBase * 0.25),
|
|
137
|
+
'04': Math.round(spacingBase * 0.5),
|
|
138
|
+
'06': Math.round(spacingBase * 0.75),
|
|
139
|
+
'08': Math.round(spacingBase * 1), // Equals base
|
|
140
|
+
'10': Math.round(spacingBase * 1.25),
|
|
141
|
+
'12': Math.round(spacingBase * 1.5),
|
|
142
|
+
'16': Math.round(spacingBase * 2),
|
|
143
|
+
'20': Math.round(spacingBase * 2.5),
|
|
144
|
+
'24': Math.round(spacingBase * 3),
|
|
145
|
+
'32': Math.round(spacingBase * 4),
|
|
146
|
+
'40': Math.round(spacingBase * 5),
|
|
147
|
+
'48': Math.round(spacingBase * 6),
|
|
137
148
|
},
|
|
138
149
|
radius: {
|
|
139
150
|
none: 0,
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { Configurator } from './Configurator';
|
|
|
3
3
|
export type { ConfiguratorProps } from './Configurator.types';
|
|
4
4
|
|
|
5
5
|
// State types
|
|
6
|
-
export type { ConfiguratorState, PaletteState, HueGradingEndpointState } from './types';
|
|
6
|
+
export type { ConfiguratorState, PaletteState, HueGradingEndpointState, SpacingPreset } from './types';
|
|
7
7
|
export type { ConfiguratorAction } from './state/actions';
|
|
8
8
|
|
|
9
9
|
// Bridge functions (for headless usage)
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View, Text, StyleSheet } from 'react-native';
|
|
3
3
|
import { Card, Slider, Select, useTokens } from '@newtonedev/components';
|
|
4
4
|
import { srgbToHex } from 'newtone';
|
|
5
|
-
import type { ConfiguratorState } from '../types';
|
|
5
|
+
import type { ConfiguratorState, SpacingPreset } from '../types';
|
|
6
6
|
import type { ConfiguratorAction } from '../state/actions';
|
|
7
7
|
|
|
8
8
|
const ICON_VARIANT_OPTIONS = [
|
|
@@ -29,7 +29,7 @@ interface DesignPanelProps {
|
|
|
29
29
|
export function DesignPanel({ state, dispatch }: DesignPanelProps) {
|
|
30
30
|
const tokens = useTokens(1);
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const spacingPreset = state.spacing?.preset ?? 'md';
|
|
33
33
|
const intensity = state.roundness?.intensity ?? 0.5;
|
|
34
34
|
const baseSize = state.typography?.scale.baseSize ?? 16;
|
|
35
35
|
const ratio = state.typography?.scale.ratio ?? 1.25;
|
|
@@ -45,13 +45,17 @@ export function DesignPanel({ state, dispatch }: DesignPanelProps) {
|
|
|
45
45
|
<Text style={[styles.subtitle, { color: srgbToHex(tokens.textSecondary.srgb) }]}>
|
|
46
46
|
Spacing
|
|
47
47
|
</Text>
|
|
48
|
-
<
|
|
49
|
-
value={
|
|
50
|
-
onValueChange={(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
<Select
|
|
49
|
+
value={spacingPreset}
|
|
50
|
+
onValueChange={(preset) => dispatch({ type: 'SET_SPACING_PRESET', preset: preset as SpacingPreset })}
|
|
51
|
+
options={[
|
|
52
|
+
{ value: 'xs', label: 'Extra Small' },
|
|
53
|
+
{ value: 'sm', label: 'Small' },
|
|
54
|
+
{ value: 'md', label: 'Medium' },
|
|
55
|
+
{ value: 'lg', label: 'Large' },
|
|
56
|
+
{ value: 'xl', label: 'Extra Large' },
|
|
57
|
+
]}
|
|
58
|
+
label="Preset"
|
|
55
59
|
/>
|
|
56
60
|
|
|
57
61
|
{/* Roundness Section */}
|
package/src/state/actions.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DesaturationStrength, HueGradingStrength } from 'newtone';
|
|
2
2
|
import type { ColorMode, ThemeName } from '@newtonedev/components';
|
|
3
|
-
import type { ConfiguratorState, FontConfig } from '../types';
|
|
3
|
+
import type { ConfiguratorState, FontConfig, SpacingPreset } from '../types';
|
|
4
4
|
|
|
5
5
|
export type ConfiguratorAction =
|
|
6
6
|
// Palette actions
|
|
@@ -26,7 +26,7 @@ export type ConfiguratorAction =
|
|
|
26
26
|
| { readonly type: 'SET_GLOBAL_GRADE_DARK_STRENGTH'; readonly strength: HueGradingStrength }
|
|
27
27
|
| { readonly type: 'SET_GLOBAL_GRADE_DARK_HUE'; readonly hue: number }
|
|
28
28
|
// Spacing actions
|
|
29
|
-
| { readonly type: '
|
|
29
|
+
| { readonly type: 'SET_SPACING_PRESET'; readonly preset: SpacingPreset }
|
|
30
30
|
// Roundness actions
|
|
31
31
|
| { readonly type: 'SET_ROUNDNESS_INTENSITY'; readonly intensity: number }
|
|
32
32
|
// Typography actions
|
package/src/state/defaults.ts
CHANGED
|
@@ -72,7 +72,7 @@ export const DEFAULT_CONFIGURATOR_STATE: ConfiguratorState = {
|
|
|
72
72
|
theme: 'neutral',
|
|
73
73
|
},
|
|
74
74
|
spacing: {
|
|
75
|
-
|
|
75
|
+
preset: 'md', // Medium (8px base): default/balanced spacing
|
|
76
76
|
},
|
|
77
77
|
roundness: {
|
|
78
78
|
intensity: 0.5, // 1.0x multiplier = preserves current hardcoded values
|
package/src/state/reducer.ts
CHANGED
|
@@ -190,11 +190,11 @@ export function configuratorReducer(
|
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
// Spacing actions
|
|
193
|
-
case '
|
|
193
|
+
case 'SET_SPACING_PRESET':
|
|
194
194
|
return {
|
|
195
195
|
...state,
|
|
196
196
|
spacing: {
|
|
197
|
-
|
|
197
|
+
preset: action.preset,
|
|
198
198
|
},
|
|
199
199
|
};
|
|
200
200
|
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { DesaturationStrength, HueGradingStrength } from 'newtone';
|
|
2
2
|
import type { ColorMode, ThemeName } from '@newtonedev/components';
|
|
3
3
|
|
|
4
|
+
/** Spacing preset options */
|
|
5
|
+
export type SpacingPreset = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
|
|
4
7
|
/** Per-palette state in the configurator (human-readable, traditional hues) */
|
|
5
8
|
export interface PaletteState {
|
|
6
9
|
readonly name: string;
|
|
@@ -45,7 +48,7 @@ export interface ConfiguratorState {
|
|
|
45
48
|
readonly theme: ThemeName;
|
|
46
49
|
};
|
|
47
50
|
readonly spacing?: {
|
|
48
|
-
readonly
|
|
51
|
+
readonly preset: SpacingPreset; // xs=6px, sm=7px, md=8px, lg=9px, xl=10px base
|
|
49
52
|
};
|
|
50
53
|
readonly roundness?: {
|
|
51
54
|
readonly intensity: number; // [0, 1] where 0=rectangle, 1=pill
|