@newtonedev/configurator 0.1.3 → 0.1.5
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/toCSS.d.ts.map +1 -1
- package/dist/bridge/toThemeConfig.d.ts.map +1 -1
- package/dist/index.cjs +79 -178
- 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 +79 -178
- package/dist/index.js.map +1 -1
- package/dist/panels/DesignPanel.d.ts.map +1 -1
- package/dist/panels/PreviewPanel.d.ts +1 -3
- package/dist/panels/PreviewPanel.d.ts.map +1 -1
- package/dist/state/actions.d.ts +11 -17
- package/dist/state/actions.d.ts.map +1 -1
- package/dist/state/defaults.d.ts.map +1 -1
- package/dist/state/reducer.d.ts.map +1 -1
- package/dist/types.d.ts +10 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/Configurator.tsx +1 -1
- package/src/bridge/toCSS.ts +6 -8
- package/src/bridge/toThemeConfig.ts +20 -56
- package/src/index.ts +1 -1
- package/src/panels/DesignPanel.tsx +0 -31
- package/src/panels/PalettePanel.tsx +2 -2
- package/src/panels/PreviewPanel.tsx +9 -40
- package/src/state/actions.ts +6 -8
- package/src/state/defaults.ts +28 -13
- package/src/state/reducer.ts +15 -54
- package/src/types.ts +13 -17
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import React, { useReducer, useMemo, useCallback, useRef, useState, useEffect }
|
|
|
2
2
|
import { StyleSheet, View, Pressable, Text } from 'react-native';
|
|
3
3
|
import { computeTokens, useTokens, useNewtoneTheme, Toggle, Card, Slider, Select, HueSlider, NewtoneProvider, ColorScaleSlider, TextInput, Button } from '@newtonedev/components';
|
|
4
4
|
import { srgbToOklch, generatePreview, getColor, getColorByContrast, lightnessToNormalizedValue, getWcagContrastRatio, hexToSrgb, findMaxChromaInGamut, srgbToHex } from 'newtone';
|
|
5
|
+
import { applyTypeScaleOffset, DEFAULT_ROLE_SCALES, ROLE_DEFAULT_WEIGHTS, DEFAULT_LINE_HEIGHTS, DEFAULT_FONT_SIZES, computeBreakpointRoleScales, migrateToFontSlot, DEFAULT_FONT_SLOTS } from '@newtonedev/fonts';
|
|
5
6
|
|
|
6
7
|
// src/Configurator.tsx
|
|
7
8
|
|
|
@@ -68,8 +69,7 @@ var DEFAULT_CONFIGURATOR_STATE = {
|
|
|
68
69
|
dark: { strength: "none", hue: 220 }
|
|
69
70
|
},
|
|
70
71
|
preview: {
|
|
71
|
-
mode: "light"
|
|
72
|
-
theme: "neutral"
|
|
72
|
+
mode: "light"
|
|
73
73
|
},
|
|
74
74
|
spacing: {
|
|
75
75
|
preset: "md"
|
|
@@ -81,23 +81,39 @@ var DEFAULT_CONFIGURATOR_STATE = {
|
|
|
81
81
|
},
|
|
82
82
|
typography: {
|
|
83
83
|
fonts: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
main: {
|
|
85
|
+
config: {
|
|
86
|
+
type: "system",
|
|
87
|
+
family: "system-ui",
|
|
88
|
+
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
89
|
+
},
|
|
90
|
+
weights: { regular: 400, medium: 500, bold: 700 }
|
|
88
91
|
},
|
|
89
92
|
display: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
config: {
|
|
94
|
+
type: "system",
|
|
95
|
+
family: "system-ui",
|
|
96
|
+
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
97
|
+
},
|
|
98
|
+
weights: { regular: 400, medium: 500, bold: 700 }
|
|
99
|
+
},
|
|
100
|
+
mono: {
|
|
101
|
+
config: {
|
|
102
|
+
type: "system",
|
|
103
|
+
family: "ui-monospace",
|
|
104
|
+
fallback: "SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
105
|
+
},
|
|
106
|
+
weights: { regular: 400, medium: 500, bold: 700 }
|
|
93
107
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
currency: {
|
|
109
|
+
config: {
|
|
110
|
+
type: "system",
|
|
111
|
+
family: "system-ui",
|
|
112
|
+
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
113
|
+
},
|
|
114
|
+
weights: { regular: 400, medium: 500, bold: 700 }
|
|
98
115
|
}
|
|
99
|
-
}
|
|
100
|
-
scale: { baseSize: 16, ratio: 1.25 }
|
|
116
|
+
}
|
|
101
117
|
},
|
|
102
118
|
icons: {
|
|
103
119
|
variant: "rounded",
|
|
@@ -285,71 +301,40 @@ function configuratorReducer(state, action) {
|
|
|
285
301
|
}
|
|
286
302
|
};
|
|
287
303
|
// Typography actions
|
|
288
|
-
case "
|
|
289
|
-
const defaultTypography = DEFAULT_CONFIGURATOR_STATE.typography;
|
|
290
|
-
return {
|
|
291
|
-
...state,
|
|
292
|
-
typography: {
|
|
293
|
-
fonts: state.typography?.fonts ?? defaultTypography.fonts,
|
|
294
|
-
scale: {
|
|
295
|
-
baseSize: clamp(action.baseSize, 12, 24),
|
|
296
|
-
ratio: state.typography?.scale.ratio ?? defaultTypography.scale.ratio
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
case "SET_TYPOGRAPHY_RATIO": {
|
|
304
|
+
case "SET_FONT": {
|
|
302
305
|
const defaultTypography = DEFAULT_CONFIGURATOR_STATE.typography;
|
|
306
|
+
const currentFonts = state.typography?.fonts ?? defaultTypography.fonts;
|
|
303
307
|
return {
|
|
304
308
|
...state,
|
|
305
309
|
typography: {
|
|
306
|
-
fonts:
|
|
307
|
-
scale: {
|
|
308
|
-
baseSize: state.typography?.scale.baseSize ?? defaultTypography.scale.baseSize,
|
|
309
|
-
ratio: clamp(action.ratio, 1.1, 1.5)
|
|
310
|
-
}
|
|
310
|
+
fonts: { ...currentFonts, [action.scope]: action.font }
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
case "
|
|
314
|
+
case "SET_TYPE_SCALE_OFFSET": {
|
|
315
315
|
const defaultTypography = DEFAULT_CONFIGURATOR_STATE.typography;
|
|
316
|
+
const currentFonts = state.typography?.fonts ?? defaultTypography.fonts;
|
|
316
317
|
return {
|
|
317
318
|
...state,
|
|
318
319
|
typography: {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
default: state.typography?.fonts.default ?? defaultTypography.fonts.default
|
|
323
|
-
},
|
|
324
|
-
scale: state.typography?.scale ?? defaultTypography.scale
|
|
320
|
+
...state.typography,
|
|
321
|
+
fonts: currentFonts,
|
|
322
|
+
typeScaleOffset: clamp(action.offset, 0, 1)
|
|
325
323
|
}
|
|
326
324
|
};
|
|
327
325
|
}
|
|
328
|
-
case "
|
|
326
|
+
case "SET_ROLE_WEIGHT": {
|
|
329
327
|
const defaultTypography = DEFAULT_CONFIGURATOR_STATE.typography;
|
|
328
|
+
const currentFonts = state.typography?.fonts ?? defaultTypography.fonts;
|
|
330
329
|
return {
|
|
331
330
|
...state,
|
|
332
331
|
typography: {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
case "SET_FONT_DEFAULT": {
|
|
343
|
-
const defaultTypography = DEFAULT_CONFIGURATOR_STATE.typography;
|
|
344
|
-
return {
|
|
345
|
-
...state,
|
|
346
|
-
typography: {
|
|
347
|
-
fonts: {
|
|
348
|
-
mono: state.typography?.fonts.mono ?? defaultTypography.fonts.mono,
|
|
349
|
-
display: state.typography?.fonts.display ?? defaultTypography.fonts.display,
|
|
350
|
-
default: action.font
|
|
351
|
-
},
|
|
352
|
-
scale: state.typography?.scale ?? defaultTypography.scale
|
|
332
|
+
...state.typography,
|
|
333
|
+
fonts: currentFonts,
|
|
334
|
+
roleWeights: {
|
|
335
|
+
...state.typography?.roleWeights,
|
|
336
|
+
[action.role]: clamp(action.weight, 100, 900)
|
|
337
|
+
}
|
|
353
338
|
}
|
|
354
339
|
};
|
|
355
340
|
}
|
|
@@ -393,11 +378,6 @@ function configuratorReducer(state, action) {
|
|
|
393
378
|
...state,
|
|
394
379
|
preview: { ...state.preview, mode: action.mode }
|
|
395
380
|
};
|
|
396
|
-
case "SET_PREVIEW_THEME":
|
|
397
|
-
return {
|
|
398
|
-
...state,
|
|
399
|
-
preview: { ...state.preview, theme: action.theme }
|
|
400
|
-
};
|
|
401
381
|
// Control actions
|
|
402
382
|
case "RESET":
|
|
403
383
|
return DEFAULT_CONFIGURATOR_STATE;
|
|
@@ -455,34 +435,6 @@ var SPACING_PRESET_TO_BASE = {
|
|
|
455
435
|
function roundnessToMultiplier(intensity) {
|
|
456
436
|
return intensity * 2;
|
|
457
437
|
}
|
|
458
|
-
function computeTypographyScale(baseSize, ratio) {
|
|
459
|
-
return {
|
|
460
|
-
xs: Math.round(baseSize / ratio ** 2),
|
|
461
|
-
sm: Math.round(baseSize / ratio),
|
|
462
|
-
base: baseSize,
|
|
463
|
-
md: Math.round(baseSize * ratio),
|
|
464
|
-
lg: Math.round(baseSize * ratio ** 2),
|
|
465
|
-
xl: Math.round(baseSize * ratio ** 3),
|
|
466
|
-
xxl: Math.round(baseSize * ratio ** 4)
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
var DEFAULT_FONTS = {
|
|
470
|
-
mono: {
|
|
471
|
-
type: "system",
|
|
472
|
-
family: "ui-monospace",
|
|
473
|
-
fallback: "SFMono-Regular, Menlo, Monaco, Consolas, monospace"
|
|
474
|
-
},
|
|
475
|
-
display: {
|
|
476
|
-
type: "system",
|
|
477
|
-
family: "system-ui",
|
|
478
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
479
|
-
},
|
|
480
|
-
default: {
|
|
481
|
-
type: "system",
|
|
482
|
-
family: "system-ui",
|
|
483
|
-
fallback: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
438
|
var DEFAULT_ICONS = {
|
|
487
439
|
variant: "rounded",
|
|
488
440
|
// Material Design 3 aesthetic
|
|
@@ -521,15 +473,6 @@ function toThemeConfig(state) {
|
|
|
521
473
|
const radiusMultiplier = roundnessToMultiplier(state.roundness?.intensity ?? 0.5);
|
|
522
474
|
return {
|
|
523
475
|
colorSystem: { dynamicRange, palettes },
|
|
524
|
-
themes: {
|
|
525
|
-
neutral: { paletteIndex: 0, lightModeNv: 0.95, darkModeNv: 0.1 },
|
|
526
|
-
primary: { paletteIndex: 1, lightModeNv: 0.95, darkModeNv: 0.1 },
|
|
527
|
-
secondary: { paletteIndex: 1, lightModeNv: 0.85, darkModeNv: 0.15 },
|
|
528
|
-
strong: { paletteIndex: 0, lightModeNv: 0.1, darkModeNv: 0.95 }
|
|
529
|
-
},
|
|
530
|
-
elevation: {
|
|
531
|
-
offsets: [-0.02, 0, 0.04]
|
|
532
|
-
},
|
|
533
476
|
spacing: {
|
|
534
477
|
"00": Math.round(spacingBase * 0),
|
|
535
478
|
// Always 0
|
|
@@ -555,15 +498,22 @@ function toThemeConfig(state) {
|
|
|
555
498
|
xl: Math.round(12 * radiusMultiplier),
|
|
556
499
|
pill: 999
|
|
557
500
|
},
|
|
558
|
-
typography: {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
501
|
+
typography: (() => {
|
|
502
|
+
const roles = state.typography?.typeScaleOffset != null ? applyTypeScaleOffset(DEFAULT_ROLE_SCALES, state.typography.typeScaleOffset) : DEFAULT_ROLE_SCALES;
|
|
503
|
+
return {
|
|
504
|
+
fonts: {
|
|
505
|
+
main: migrateToFontSlot(state.typography?.fonts.main ?? state.typography?.fonts?.default, DEFAULT_FONT_SLOTS.main),
|
|
506
|
+
display: migrateToFontSlot(state.typography?.fonts.display, DEFAULT_FONT_SLOTS.display),
|
|
507
|
+
mono: migrateToFontSlot(state.typography?.fonts.mono, DEFAULT_FONT_SLOTS.mono),
|
|
508
|
+
currency: migrateToFontSlot(state.typography?.fonts.currency, DEFAULT_FONT_SLOTS.currency)
|
|
509
|
+
},
|
|
510
|
+
fontSizes: DEFAULT_FONT_SIZES,
|
|
511
|
+
lineHeights: DEFAULT_LINE_HEIGHTS,
|
|
512
|
+
roles,
|
|
513
|
+
breakpointRoles: computeBreakpointRoleScales(roles),
|
|
514
|
+
roleWeights: { ...ROLE_DEFAULT_WEIGHTS, ...state.typography?.roleWeights }
|
|
515
|
+
};
|
|
516
|
+
})(),
|
|
567
517
|
icons: state.icons ?? DEFAULT_ICONS
|
|
568
518
|
};
|
|
569
519
|
}
|
|
@@ -823,7 +773,7 @@ function PalettePanel({ palette, index, dispatch, previewColors, state }) {
|
|
|
823
773
|
onSubmitEditing: handleHexSubmit,
|
|
824
774
|
placeholder: "#000000"
|
|
825
775
|
}
|
|
826
|
-
)), effectiveKeyColor !== void 0 && /* @__PURE__ */ React.createElement(Pressable, { onPress: handleClearKeyColor, style: styles.autoButton }, /* @__PURE__ */ React.createElement(Text, { style: [styles.autoText, { color: srgbToHex(tokens.
|
|
776
|
+
)), effectiveKeyColor !== void 0 && /* @__PURE__ */ React.createElement(Pressable, { onPress: handleClearKeyColor, style: styles.autoButton }, /* @__PURE__ */ React.createElement(Text, { style: [styles.autoText, { color: srgbToHex(tokens.accent.fill.srgb) }] }, "Auto"))), hexError !== "" && /* @__PURE__ */ React.createElement(Text, { style: [styles.errorText, { color: srgbToHex(tokens.error.fill.srgb) }] }, hexError)), isNeutral && previewColors && /* @__PURE__ */ React.createElement(View, { style: styles.inlineSwatches }, previewColors.map((color, i) => /* @__PURE__ */ React.createElement(
|
|
827
777
|
View,
|
|
828
778
|
{
|
|
829
779
|
key: i,
|
|
@@ -1021,38 +971,20 @@ var styles2 = StyleSheet.create({
|
|
|
1021
971
|
flex: 1
|
|
1022
972
|
}
|
|
1023
973
|
});
|
|
1024
|
-
|
|
1025
|
-
{ label: "Neutral", value: "neutral" },
|
|
1026
|
-
{ label: "Primary", value: "primary" },
|
|
1027
|
-
{ label: "Secondary", value: "secondary" },
|
|
1028
|
-
{ label: "Strong", value: "strong" }
|
|
1029
|
-
];
|
|
1030
|
-
function PreviewCard({
|
|
1031
|
-
state,
|
|
1032
|
-
dispatch
|
|
1033
|
-
}) {
|
|
974
|
+
function PreviewCard() {
|
|
1034
975
|
const tokens = useTokens(1);
|
|
1035
|
-
return /* @__PURE__ */ React.createElement(Card, { elevation: 1, style: styles3.container }, /* @__PURE__ */ React.createElement(Text, { style: [styles3.title, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Component Preview"), /* @__PURE__ */ React.createElement(View, { style:
|
|
1036
|
-
|
|
1037
|
-
{
|
|
1038
|
-
options: THEME_OPTIONS,
|
|
1039
|
-
value: state.preview.theme,
|
|
1040
|
-
onValueChange: (t) => dispatch({ type: "SET_PREVIEW_THEME", theme: t }),
|
|
1041
|
-
label: "Theme"
|
|
1042
|
-
}
|
|
1043
|
-
)), /* @__PURE__ */ React.createElement(View, { style: previewStyles.wrapper }, /* @__PURE__ */ React.createElement(View, { style: previewStyles.row }, /* @__PURE__ */ React.createElement(Button, { variant: "primary", semantic: "accent", size: "sm" }, "Primary"), /* @__PURE__ */ React.createElement(Button, { variant: "primary", semantic: "neutral", size: "sm" }, "Secondary"), /* @__PURE__ */ React.createElement(Button, { variant: "tertiary", semantic: "neutral", size: "sm" }, "Ghost"), /* @__PURE__ */ React.createElement(Button, { variant: "secondary", semantic: "neutral", size: "sm" }, "Outline")), /* @__PURE__ */ React.createElement(TextInput, { label: "Sample Input", value: "Hello, Newtone", onChangeText: () => {
|
|
1044
|
-
} }), /* @__PURE__ */ React.createElement(View, { style: previewStyles.row }, /* @__PURE__ */ React.createElement(View, { style: [previewStyles.statusDot, { backgroundColor: srgbToHex(tokens.success.srgb) }] }), /* @__PURE__ */ React.createElement(Text, { style: [previewStyles.statusText, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Success"), /* @__PURE__ */ React.createElement(View, { style: [previewStyles.statusDot, { backgroundColor: srgbToHex(tokens.warning.srgb) }] }), /* @__PURE__ */ React.createElement(Text, { style: [previewStyles.statusText, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Warning"), /* @__PURE__ */ React.createElement(View, { style: [previewStyles.statusDot, { backgroundColor: srgbToHex(tokens.error.srgb) }] }), /* @__PURE__ */ React.createElement(Text, { style: [previewStyles.statusText, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Error"))));
|
|
976
|
+
return /* @__PURE__ */ React.createElement(Card, { elevation: 1, style: styles3.container }, /* @__PURE__ */ React.createElement(Text, { style: [styles3.title, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Component Preview"), /* @__PURE__ */ React.createElement(View, { style: previewStyles.wrapper }, /* @__PURE__ */ React.createElement(View, { style: previewStyles.row }, /* @__PURE__ */ React.createElement(Button, { variant: "primary", semantic: "accent", size: "sm" }, "Primary"), /* @__PURE__ */ React.createElement(Button, { variant: "primary", semantic: "neutral", size: "sm" }, "Secondary"), /* @__PURE__ */ React.createElement(Button, { variant: "tertiary", semantic: "neutral", size: "sm" }, "Ghost"), /* @__PURE__ */ React.createElement(Button, { variant: "secondary", semantic: "neutral", size: "sm" }, "Outline")), /* @__PURE__ */ React.createElement(TextInput, { label: "Sample Input", value: "Hello, Newtone", onChangeText: () => {
|
|
977
|
+
} }), /* @__PURE__ */ React.createElement(View, { style: previewStyles.row }, /* @__PURE__ */ React.createElement(View, { style: [previewStyles.statusDot, { backgroundColor: srgbToHex(tokens.success.fill.srgb) }] }), /* @__PURE__ */ React.createElement(Text, { style: [previewStyles.statusText, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Success"), /* @__PURE__ */ React.createElement(View, { style: [previewStyles.statusDot, { backgroundColor: srgbToHex(tokens.warning.fill.srgb) }] }), /* @__PURE__ */ React.createElement(Text, { style: [previewStyles.statusText, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Warning"), /* @__PURE__ */ React.createElement(View, { style: [previewStyles.statusDot, { backgroundColor: srgbToHex(tokens.error.fill.srgb) }] }), /* @__PURE__ */ React.createElement(Text, { style: [previewStyles.statusText, { color: srgbToHex(tokens.textPrimary.srgb) }] }, "Error"))));
|
|
1045
978
|
}
|
|
1046
|
-
function PreviewPanel({ state,
|
|
979
|
+
function PreviewPanel({ state, themeConfig }) {
|
|
1047
980
|
return /* @__PURE__ */ React.createElement(
|
|
1048
981
|
NewtoneProvider,
|
|
1049
982
|
{
|
|
1050
|
-
key:
|
|
983
|
+
key: state.preview.mode,
|
|
1051
984
|
config: themeConfig,
|
|
1052
|
-
initialMode: state.preview.mode
|
|
1053
|
-
initialTheme: state.preview.theme
|
|
985
|
+
initialMode: state.preview.mode
|
|
1054
986
|
},
|
|
1055
|
-
/* @__PURE__ */ React.createElement(PreviewCard,
|
|
987
|
+
/* @__PURE__ */ React.createElement(PreviewCard, null)
|
|
1056
988
|
);
|
|
1057
989
|
}
|
|
1058
990
|
var styles3 = StyleSheet.create({
|
|
@@ -1062,11 +994,6 @@ var styles3 = StyleSheet.create({
|
|
|
1062
994
|
title: {
|
|
1063
995
|
fontSize: 16,
|
|
1064
996
|
fontWeight: "700"
|
|
1065
|
-
},
|
|
1066
|
-
controls: {
|
|
1067
|
-
flexDirection: "row",
|
|
1068
|
-
alignItems: "flex-end",
|
|
1069
|
-
gap: 16
|
|
1070
997
|
}
|
|
1071
998
|
});
|
|
1072
999
|
var previewStyles = StyleSheet.create({
|
|
@@ -1097,9 +1024,7 @@ function toCSS(state) {
|
|
|
1097
1024
|
const tokens = computeTokens(
|
|
1098
1025
|
config.colorSystem,
|
|
1099
1026
|
mode,
|
|
1100
|
-
config.themes.neutral,
|
|
1101
1027
|
1,
|
|
1102
|
-
config.elevation.offsets,
|
|
1103
1028
|
config.spacing,
|
|
1104
1029
|
config.radius,
|
|
1105
1030
|
config.typography,
|
|
@@ -1118,19 +1043,19 @@ function toCSS(state) {
|
|
|
1118
1043
|
`;
|
|
1119
1044
|
css += ` --newtone-text-secondary: ${srgbToHex(tokens.textSecondary.srgb)};
|
|
1120
1045
|
`;
|
|
1121
|
-
css += ` --newtone-
|
|
1046
|
+
css += ` --newtone-accent: ${srgbToHex(tokens.accent.fill.srgb)};
|
|
1122
1047
|
`;
|
|
1123
|
-
css += ` --newtone-
|
|
1048
|
+
css += ` --newtone-accent-hover: ${srgbToHex(tokens.accent.fillHover.srgb)};
|
|
1124
1049
|
`;
|
|
1125
|
-
css += ` --newtone-
|
|
1050
|
+
css += ` --newtone-accent-active: ${srgbToHex(tokens.accent.fillActive.srgb)};
|
|
1126
1051
|
`;
|
|
1127
1052
|
css += ` --newtone-border: ${srgbToHex(tokens.border.srgb)};
|
|
1128
1053
|
`;
|
|
1129
|
-
css += ` --newtone-success: ${srgbToHex(tokens.success.srgb)};
|
|
1054
|
+
css += ` --newtone-success: ${srgbToHex(tokens.success.fill.srgb)};
|
|
1130
1055
|
`;
|
|
1131
|
-
css += ` --newtone-warning: ${srgbToHex(tokens.warning.srgb)};
|
|
1056
|
+
css += ` --newtone-warning: ${srgbToHex(tokens.warning.fill.srgb)};
|
|
1132
1057
|
`;
|
|
1133
|
-
css += ` --newtone-error: ${srgbToHex(tokens.error.srgb)};
|
|
1058
|
+
css += ` --newtone-error: ${srgbToHex(tokens.error.fill.srgb)};
|
|
1134
1059
|
`;
|
|
1135
1060
|
css += `}
|
|
1136
1061
|
|
|
@@ -1235,8 +1160,6 @@ function DesignPanel({ state, dispatch }) {
|
|
|
1235
1160
|
const tokens = useTokens(1);
|
|
1236
1161
|
const spacingPreset = state.spacing?.preset ?? "md";
|
|
1237
1162
|
const intensity = state.roundness?.intensity ?? 0.5;
|
|
1238
|
-
const baseSize = state.typography?.scale.baseSize ?? 16;
|
|
1239
|
-
const ratio = state.typography?.scale.ratio ?? 1.25;
|
|
1240
1163
|
const variant = state.icons?.variant ?? "rounded";
|
|
1241
1164
|
const weight = state.icons?.weight ?? 400;
|
|
1242
1165
|
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(
|
|
@@ -1263,29 +1186,7 @@ function DesignPanel({ state, dispatch }) {
|
|
|
1263
1186
|
label: "Intensity",
|
|
1264
1187
|
showValue: true
|
|
1265
1188
|
}
|
|
1266
|
-
), /* @__PURE__ */ React.createElement(Text, { style: [styles5.subtitle, { color: srgbToHex(tokens.textSecondary.srgb) }] }, "
|
|
1267
|
-
Slider,
|
|
1268
|
-
{
|
|
1269
|
-
value: baseSize,
|
|
1270
|
-
onValueChange: (v) => dispatch({ type: "SET_TYPOGRAPHY_BASE_SIZE", baseSize: v }),
|
|
1271
|
-
min: 12,
|
|
1272
|
-
max: 24,
|
|
1273
|
-
step: 1,
|
|
1274
|
-
label: "Base Size",
|
|
1275
|
-
showValue: true
|
|
1276
|
-
}
|
|
1277
|
-
)), /* @__PURE__ */ React.createElement(View, { style: styles5.flex }, /* @__PURE__ */ React.createElement(
|
|
1278
|
-
Slider,
|
|
1279
|
-
{
|
|
1280
|
-
value: Math.round(ratio * 100),
|
|
1281
|
-
onValueChange: (v) => dispatch({ type: "SET_TYPOGRAPHY_RATIO", ratio: v / 100 }),
|
|
1282
|
-
min: 110,
|
|
1283
|
-
max: 150,
|
|
1284
|
-
step: 5,
|
|
1285
|
-
label: "Scale Ratio",
|
|
1286
|
-
showValue: true
|
|
1287
|
-
}
|
|
1288
|
-
))), /* @__PURE__ */ React.createElement(Text, { style: [styles5.subtitle, { color: srgbToHex(tokens.textSecondary.srgb) }] }, "Icons"), /* @__PURE__ */ React.createElement(View, { style: styles5.row }, /* @__PURE__ */ React.createElement(View, { style: styles5.flex }, /* @__PURE__ */ React.createElement(
|
|
1189
|
+
), /* @__PURE__ */ React.createElement(Text, { style: [styles5.subtitle, { color: srgbToHex(tokens.textSecondary.srgb) }] }, "Icons"), /* @__PURE__ */ React.createElement(View, { style: styles5.row }, /* @__PURE__ */ React.createElement(View, { style: styles5.flex }, /* @__PURE__ */ React.createElement(
|
|
1289
1190
|
Select,
|
|
1290
1191
|
{
|
|
1291
1192
|
options: ICON_VARIANT_OPTIONS,
|
|
@@ -1359,7 +1260,7 @@ function Configurator({
|
|
|
1359
1260
|
},
|
|
1360
1261
|
label: "Dark Mode"
|
|
1361
1262
|
}
|
|
1362
|
-
)), /* @__PURE__ */ React.createElement(View, { style: styles6.topRow }, /* @__PURE__ */ React.createElement(View, { style: styles6.topRowPanel }, /* @__PURE__ */ React.createElement(GlobalPanel, { state, dispatch })), showPreview && /* @__PURE__ */ React.createElement(View, { style: styles6.topRowPanel }, /* @__PURE__ */ React.createElement(PreviewPanel, { state,
|
|
1263
|
+
)), /* @__PURE__ */ React.createElement(View, { style: styles6.topRow }, /* @__PURE__ */ React.createElement(View, { style: styles6.topRowPanel }, /* @__PURE__ */ React.createElement(GlobalPanel, { state, dispatch })), showPreview && /* @__PURE__ */ React.createElement(View, { style: styles6.topRowPanel }, /* @__PURE__ */ React.createElement(PreviewPanel, { state, themeConfig }))), /* @__PURE__ */ React.createElement(View, { style: styles6.designRow }, /* @__PURE__ */ React.createElement(DesignPanel, { state, dispatch })), /* @__PURE__ */ React.createElement(View, { style: styles6.tabBar }, state.palettes.map((palette, index) => /* @__PURE__ */ React.createElement(
|
|
1363
1264
|
Pressable,
|
|
1364
1265
|
{
|
|
1365
1266
|
key: index,
|