@newtonedev/editor 0.1.12 → 0.2.0

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.
Files changed (116) hide show
  1. package/dist/Editor.d.ts.map +1 -1
  2. package/dist/components/CodeBlock.d.ts.map +1 -1
  3. package/dist/components/ConfiguratorPanel.d.ts +6 -3
  4. package/dist/components/ConfiguratorPanel.d.ts.map +1 -1
  5. package/dist/components/EditorHeader.d.ts +3 -2
  6. package/dist/components/EditorHeader.d.ts.map +1 -1
  7. package/dist/components/EditorShell.d.ts.map +1 -1
  8. package/dist/components/PresetSelector.d.ts +3 -2
  9. package/dist/components/PresetSelector.d.ts.map +1 -1
  10. package/dist/components/PreviewWindow.d.ts.map +1 -1
  11. package/dist/components/RightSidebar.d.ts.map +1 -1
  12. package/dist/components/Sidebar.d.ts +8 -1
  13. package/dist/components/Sidebar.d.ts.map +1 -1
  14. package/dist/components/TableOfContents.d.ts.map +1 -1
  15. package/dist/components/sections/ColorsSection.d.ts +6 -3
  16. package/dist/components/sections/ColorsSection.d.ts.map +1 -1
  17. package/dist/components/sections/DynamicRangeSection.d.ts +2 -2
  18. package/dist/components/sections/DynamicRangeSection.d.ts.map +1 -1
  19. package/dist/components/sections/FontsSection.d.ts +2 -2
  20. package/dist/components/sections/FontsSection.d.ts.map +1 -1
  21. package/dist/components/sections/IconsSection.d.ts +2 -2
  22. package/dist/components/sections/IconsSection.d.ts.map +1 -1
  23. package/dist/components/sections/OthersSection.d.ts +2 -2
  24. package/dist/components/sections/OthersSection.d.ts.map +1 -1
  25. package/dist/components/sections/ScalePlots.d.ts +11 -0
  26. package/dist/components/sections/ScalePlots.d.ts.map +1 -0
  27. package/dist/components/sections/index.d.ts +1 -0
  28. package/dist/components/sections/index.d.ts.map +1 -1
  29. package/dist/configurator/bridge/toCSS.d.ts +7 -0
  30. package/dist/configurator/bridge/toCSS.d.ts.map +1 -0
  31. package/dist/configurator/bridge/toJSON.d.ts +15 -0
  32. package/dist/configurator/bridge/toJSON.d.ts.map +1 -0
  33. package/dist/configurator/bridge/toThemeConfig.d.ts +8 -0
  34. package/dist/configurator/bridge/toThemeConfig.d.ts.map +1 -0
  35. package/dist/configurator/constants.d.ts +13 -0
  36. package/dist/configurator/constants.d.ts.map +1 -0
  37. package/dist/configurator/hex-conversion.d.ts +21 -0
  38. package/dist/configurator/hex-conversion.d.ts.map +1 -0
  39. package/dist/configurator/hooks/useConfigurator.d.ts +11 -0
  40. package/dist/configurator/hooks/useConfigurator.d.ts.map +1 -0
  41. package/dist/configurator/hooks/usePreviewColors.d.ts +8 -0
  42. package/dist/configurator/hooks/usePreviewColors.d.ts.map +1 -0
  43. package/dist/configurator/hooks/useWcagValidation.d.ts +20 -0
  44. package/dist/configurator/hooks/useWcagValidation.d.ts.map +1 -0
  45. package/dist/configurator/hue-conversion.d.ts +10 -0
  46. package/dist/configurator/hue-conversion.d.ts.map +1 -0
  47. package/dist/configurator/state/actions.d.ts +107 -0
  48. package/dist/configurator/state/actions.d.ts.map +1 -0
  49. package/dist/configurator/state/defaults.d.ts +7 -0
  50. package/dist/configurator/state/defaults.d.ts.map +1 -0
  51. package/dist/configurator/state/reducer.d.ts +19 -0
  52. package/dist/configurator/state/reducer.d.ts.map +1 -0
  53. package/dist/configurator/types.d.ts +60 -0
  54. package/dist/configurator/types.d.ts.map +1 -0
  55. package/dist/hooks/useEditorState.d.ts +8 -6
  56. package/dist/hooks/useEditorState.d.ts.map +1 -1
  57. package/dist/hooks/usePresets.d.ts +7 -6
  58. package/dist/hooks/usePresets.d.ts.map +1 -1
  59. package/dist/index.cjs +30372 -808
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.ts +17 -0
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +30351 -799
  64. package/dist/index.js.map +1 -1
  65. package/dist/preview/CategoryView.d.ts.map +1 -1
  66. package/dist/preview/ComponentDetailView.d.ts.map +1 -1
  67. package/dist/preview/ComponentRenderer.d.ts.map +1 -1
  68. package/dist/preview/IconBrowserView.d.ts.map +1 -1
  69. package/dist/preview/OverviewView.d.ts.map +1 -1
  70. package/dist/preview/PaletteScaleView.d.ts +11 -0
  71. package/dist/preview/PaletteScaleView.d.ts.map +1 -0
  72. package/dist/types.d.ts +4 -3
  73. package/dist/types.d.ts.map +1 -1
  74. package/package.json +7 -4
  75. package/src/Editor.tsx +43 -19
  76. package/src/components/CodeBlock.tsx +7 -11
  77. package/src/components/ConfiguratorPanel.tsx +25 -18
  78. package/src/components/EditorHeader.tsx +29 -39
  79. package/src/components/EditorShell.tsx +17 -29
  80. package/src/components/FontPicker.tsx +7 -7
  81. package/src/components/PresetSelector.tsx +211 -129
  82. package/src/components/PreviewWindow.tsx +5 -12
  83. package/src/components/PrimaryNav.tsx +6 -6
  84. package/src/components/RightSidebar.tsx +24 -25
  85. package/src/components/Sidebar.tsx +54 -60
  86. package/src/components/TableOfContents.tsx +4 -5
  87. package/src/components/sections/ColorsSection.tsx +109 -121
  88. package/src/components/sections/DynamicRangeSection.tsx +61 -75
  89. package/src/components/sections/FontsSection.tsx +17 -28
  90. package/src/components/sections/IconsSection.tsx +2 -2
  91. package/src/components/sections/OthersSection.tsx +4 -5
  92. package/src/components/sections/ScalePlots.tsx +221 -0
  93. package/src/components/sections/index.ts +1 -0
  94. package/src/configurator/bridge/toCSS.ts +44 -0
  95. package/src/configurator/bridge/toJSON.ts +24 -0
  96. package/src/configurator/bridge/toThemeConfig.ts +114 -0
  97. package/src/configurator/constants.ts +13 -0
  98. package/src/configurator/hex-conversion.ts +67 -0
  99. package/src/configurator/hooks/useConfigurator.ts +33 -0
  100. package/src/configurator/hooks/usePreviewColors.ts +47 -0
  101. package/src/configurator/hooks/useWcagValidation.ts +133 -0
  102. package/src/configurator/hue-conversion.ts +25 -0
  103. package/src/configurator/state/actions.ts +43 -0
  104. package/src/configurator/state/defaults.ts +107 -0
  105. package/src/configurator/state/reducer.ts +399 -0
  106. package/src/configurator/types.ts +65 -0
  107. package/src/hooks/useEditorState.ts +25 -11
  108. package/src/hooks/usePresets.ts +54 -33
  109. package/src/index.ts +33 -0
  110. package/src/preview/CategoryView.tsx +8 -11
  111. package/src/preview/ComponentDetailView.tsx +24 -54
  112. package/src/preview/ComponentRenderer.tsx +2 -4
  113. package/src/preview/IconBrowserView.tsx +9 -10
  114. package/src/preview/OverviewView.tsx +9 -12
  115. package/src/preview/PaletteScaleView.tsx +122 -0
  116. package/src/types.ts +4 -3
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryView.d.ts","sourceRoot":"","sources":["../../src/preview/CategoryView.tsx"],"names":[],"mappings":"AAMA,UAAU,iBAAiB;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,qBAAqB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,qBAAqB,GACtB,EAAE,iBAAiB,kDAuHnB"}
1
+ {"version":3,"file":"CategoryView.d.ts","sourceRoot":"","sources":["../../src/preview/CategoryView.tsx"],"names":[],"mappings":"AAKA,UAAU,iBAAiB;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,qBAAqB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,qBAAqB,GACtB,EAAE,iBAAiB,kDAqHnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentDetailView.d.ts","sourceRoot":"","sources":["../../src/preview/ComponentDetailView.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAuC,MAAM,mBAAmB,CAAC;AAIvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAahD,UAAU,wBAAwB;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAA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Aa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD;AA+PD,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,YAAY,GACb,EAAE,wBAAwB,kDA+S1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentRenderer.d.ts","sourceRoot":"","sources":["../../src/preview/ComponentRenderer.tsx"],"names":[],"mappings":"AAiBA,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2ED,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,sBAAsB,kDA+D5F"}
1
+ {"version":3,"file":"ComponentRenderer.d.ts","sourceRoot":"","sources":["../../src/preview/ComponentRenderer.tsx"],"names":[],"mappings":"AAgBA,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AA2ED,wBAAgB,iBAAiB,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,sBAAsB,kDA8D5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconBrowserView.d.ts","sourceRoot":"","sources":["../../src/preview/IconBrowserView.tsx"],"names":[],"mappings":"AAIA,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,wBAAgB,eAAe,CAAC,EAC9B,gBAAgB,EAChB,YAAY,GACb,EAAE,oBAAoB,2CA8KtB"}
1
+ {"version":3,"file":"IconBrowserView.d.ts","sourceRoot":"","sources":["../../src/preview/IconBrowserView.tsx"],"names":[],"mappings":"AAGA,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED,wBAAgB,eAAe,CAAC,EAC9B,gBAAgB,EAChB,YAAY,GACb,EAAE,oBAAoB,2CA8KtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"OverviewView.d.ts","sourceRoot":"","sources":["../../src/preview/OverviewView.tsx"],"names":[],"mappings":"AAMA,UAAU,iBAAiB;IACzB,QAAQ,CAAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,QAAQ,CAAC,qBAAqB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,YAAY,CAAC,EAC3B,oBAAoB,EACpB,qBAAqB,GACtB,EAAE,iBAAiB,2CAwFnB"}
1
+ {"version":3,"file":"OverviewView.d.ts","sourceRoot":"","sources":["../../src/preview/OverviewView.tsx"],"names":[],"mappings":"AAKA,UAAU,iBAAiB;IACzB,QAAQ,CAAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,QAAQ,CAAC,qBAAqB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/D;AAED,wBAAgB,YAAY,CAAC,EAC3B,oBAAoB,EACpB,qBAAqB,GACtB,EAAE,iBAAiB,2CAwFnB"}
@@ -0,0 +1,11 @@
1
+ import type { ColorResult } from "newtone";
2
+ import type { ConfiguratorState } from "../configurator/types";
3
+ interface PaletteScaleViewProps {
4
+ readonly state: ConfiguratorState;
5
+ readonly previewColors: readonly (readonly ColorResult[])[];
6
+ readonly useP3: boolean;
7
+ readonly onUseP3Change: (useP3: boolean) => void;
8
+ }
9
+ export declare function PaletteScaleView({ state, previewColors, useP3, onUseP3Change }: PaletteScaleViewProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=PaletteScaleView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaletteScaleView.d.ts","sourceRoot":"","sources":["../../src/preview/PaletteScaleView.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,WAAW,EAAE,CAAC,EAAE,CAAC;IAC5D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAWD,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,qBAAqB,2CAkGrG"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ConfiguratorState } from "@newtonedev/configurator";
1
+ import type { ConfiguratorState } from "./configurator/types";
2
2
  import type { NewtoneThemeConfig } from "@newtonedev/components";
3
3
  import type { FontRuntimeMetrics, GoogleFontEntry } from "@newtonedev/fonts";
4
4
  import type { ReactNode } from "react";
@@ -44,11 +44,12 @@ export interface EditorPersistence {
44
44
  }) => Promise<{
45
45
  error?: unknown;
46
46
  }>;
47
- /** Publish the active preset. */
47
+ /** Publish all presets as variants. */
48
48
  readonly onPublish: (params: {
49
49
  readonly state: ConfiguratorState;
50
50
  readonly presets: readonly Preset[];
51
51
  readonly activePresetId: string;
52
+ readonly defaultVariantId: string;
52
53
  readonly calibrations?: Record<string, number>;
53
54
  readonly fontMetrics?: Record<string, FontRuntimeMetrics>;
54
55
  }) => Promise<{
@@ -58,7 +59,7 @@ export interface EditorPersistence {
58
59
  readonly persistPresets: (params: {
59
60
  readonly presets: readonly Preset[];
60
61
  readonly activePresetId: string;
61
- readonly publishedPresetId: string | null;
62
+ readonly defaultVariantId: string | null;
62
63
  }) => Promise<void>;
63
64
  }
64
65
  export interface EditorHeaderSlots {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,uEAAuE;AACvE,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC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WAAW,CAAC,EAAE,iBAAiB,CAAC;IACzC,kEAAkE;IAClE,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC;IAC1C,mEAAmE;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CACnD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newtonedev/editor",
3
- "version": "0.1.12",
4
- "description": "Shared color system editor for Newtone applications",
3
+ "version": "0.2.0",
4
+ "description": "Color system editor for Newtone applications",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -37,12 +37,15 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "newtone": "^0.1.0",
40
- "@newtonedev/components": "^0.1.3",
41
- "@newtonedev/configurator": "^0.1.2",
40
+ "newtone-api": "^0.0.3",
41
+ "@newtonedev/colors": "^1.1.4",
42
+ "@newtonedev/components": "^0.1.18",
43
+ "@newtonedev/fonts": "^0.1.0",
42
44
  "react-native-web": "^0.19.10"
43
45
  },
44
46
  "devDependencies": {
45
47
  "@types/react": "^18.2.0",
48
+ "@types/react-dom": "^18.2.0",
46
49
  "react": "^18.2.0",
47
50
  "react-dom": "^18.2.0",
48
51
  "tsup": "^8.0.0",
package/src/Editor.tsx CHANGED
@@ -1,5 +1,5 @@
1
- import { useMemo, useCallback } from "react";
2
- import { NewtoneProvider } from "@newtonedev/components";
1
+ import { useMemo, useCallback, useState } from "react";
2
+ import { NewtoneProvider, useNewtoneTheme } from "@newtonedev/components";
3
3
  import type { NewtoneThemeConfig } from "@newtonedev/components";
4
4
  import type { TextRole } from "@newtonedev/fonts";
5
5
  import { useEditorState } from "./hooks/useEditorState";
@@ -10,6 +10,7 @@ import { PrimaryNav } from "./components/PrimaryNav";
10
10
  import { ConfiguratorPanel } from "./components/ConfiguratorPanel";
11
11
  import { TableOfContents } from "./components/TableOfContents";
12
12
  import { PreviewWindow } from "./components/PreviewWindow";
13
+ import { PaletteScaleView } from "./preview/PaletteScaleView";
13
14
  import { RightSidebar } from "./components/RightSidebar";
14
15
  import type { EditorProps } from "./types";
15
16
 
@@ -29,6 +30,10 @@ export function Editor({
29
30
  manifestUrl,
30
31
  fontCatalog,
31
32
  }: EditorProps) {
33
+ const [activePaletteIndex, setActivePaletteIndex] = useState(0);
34
+ const { gamut } = useNewtoneTheme();
35
+ const [useP3, setUseP3] = useState(gamut === 'p3');
36
+
32
37
  const editor = useEditorState({
33
38
  initialState,
34
39
  initialIsPublished,
@@ -40,6 +45,7 @@ export function Editor({
40
45
  onNavigate,
41
46
  initialPreviewView,
42
47
  manifestUrl,
48
+ useP3,
43
49
  });
44
50
 
45
51
  // Per-role weight state and handler
@@ -68,10 +74,10 @@ export function Editor({
68
74
  // state, but should apply to the preview so components render accurately.
69
75
  const previewConfig: NewtoneThemeConfig = useMemo(
70
76
  () =>
71
- chromeThemeConfig.tokenOverrides
72
- ? { ...editor.themeConfig, tokenOverrides: chromeThemeConfig.tokenOverrides }
77
+ (chromeThemeConfig as any).tokenOverrides
78
+ ? { ...editor.themeConfig, tokenOverrides: (chromeThemeConfig as any).tokenOverrides } as NewtoneThemeConfig
73
79
  : editor.themeConfig,
74
- [editor.themeConfig, chromeThemeConfig.tokenOverrides],
80
+ [editor.themeConfig, (chromeThemeConfig as any).tokenOverrides],
75
81
  );
76
82
 
77
83
  return (
@@ -81,6 +87,11 @@ export function Editor({
81
87
  <Sidebar
82
88
  isDirty={editor.isDirty}
83
89
  onRevert={editor.handleRevert}
90
+ state={editor.configuratorState}
91
+ previewColors={editor.previewColors}
92
+ activePaletteIndex={activePaletteIndex}
93
+ activeSectionId={editor.activeSectionId}
94
+ useP3={useP3}
84
95
  />
85
96
  }
86
97
  navbar={
@@ -93,12 +104,13 @@ export function Editor({
93
104
  headerSlots={headerSlots}
94
105
  presets={editor.presets}
95
106
  activePresetId={editor.activePresetId}
96
- publishedPresetId={editor.publishedPresetId}
107
+ defaultVariantId={editor.defaultVariantId}
97
108
  onSwitchPreset={editor.switchPreset}
98
109
  onCreatePreset={editor.createPreset}
99
110
  onRenamePreset={editor.renamePreset}
100
111
  onDeletePreset={editor.deletePreset}
101
112
  onDuplicatePreset={editor.duplicatePreset}
113
+ onSetDefaultVariant={editor.setDefaultVariant}
102
114
  />
103
115
  }
104
116
  content={
@@ -131,6 +143,9 @@ export function Editor({
131
143
  colorMode={editor.colorMode}
132
144
  onColorModeChange={editor.handleColorModeChange}
133
145
  fontCatalog={fontCatalog}
146
+ activePaletteIndex={activePaletteIndex}
147
+ onActivePaletteChange={setActivePaletteIndex}
148
+ useP3={useP3}
134
149
  />
135
150
  )}
136
151
  <div
@@ -147,19 +162,28 @@ export function Editor({
147
162
  initialMode={editor.colorMode}
148
163
  key={editor.colorMode}
149
164
  >
150
- <div style={{ flex: 1, overflowY: "auto", minWidth: 0 }}>
151
- <PreviewWindow
152
- view={editor.previewView}
153
- selectedVariantId={editor.selectedVariantId}
154
- onNavigate={editor.handlePreviewNavigate}
155
- onSelectVariant={editor.handleSelectVariant}
156
- propOverrides={editor.propOverrides}
157
- onPropOverride={editor.handlePropOverride}
158
- roleWeights={roleWeights}
159
- onRoleWeightChange={handleRoleWeightChange}
160
- fontCatalog={fontCatalog}
161
- scopeFontMap={scopeFontMap}
162
- />
165
+ <div style={{ flex: 1, overflow: "hidden", minWidth: 0, display: "flex", flexDirection: "column" }}>
166
+ {editor.activeSectionId === "colors" ? (
167
+ <PaletteScaleView
168
+ state={editor.configuratorState}
169
+ previewColors={editor.previewColors}
170
+ useP3={useP3}
171
+ onUseP3Change={setUseP3}
172
+ />
173
+ ) : (
174
+ <PreviewWindow
175
+ view={editor.previewView}
176
+ selectedVariantId={editor.selectedVariantId}
177
+ onNavigate={editor.handlePreviewNavigate}
178
+ onSelectVariant={editor.handleSelectVariant}
179
+ propOverrides={editor.propOverrides}
180
+ onPropOverride={editor.handlePropOverride}
181
+ roleWeights={roleWeights}
182
+ onRoleWeightChange={handleRoleWeightChange}
183
+ fontCatalog={fontCatalog}
184
+ scopeFontMap={scopeFontMap}
185
+ />
186
+ )}
163
187
  </div>
164
188
  </NewtoneProvider>
165
189
  </div>
@@ -1,6 +1,6 @@
1
1
  import { useState, useCallback } from "react";
2
2
  import { useTokens, Icon } from "@newtonedev/components";
3
- import { srgbToHex } from "newtone";
3
+
4
4
 
5
5
  export function CopyButton({ text }: { readonly text: string }) {
6
6
  const tokens = useTokens();
@@ -24,18 +24,14 @@ export function CopyButton({ text }: { readonly text: string }) {
24
24
  display: "flex",
25
25
  alignItems: "center",
26
26
  justifyContent: "center",
27
- color: srgbToHex(
28
- copied ? tokens.accent.fill.srgb : tokens.textTertiary.srgb,
29
- ),
27
+ color: copied ? tokens.colors.secondary.emphasis.fontPrimary : tokens.colors.primary.main.fontDisabled,
30
28
  transition: "color 150ms ease",
31
29
  }}
32
30
  >
33
31
  <Icon
34
32
  name={copied ? "check" : "content_copy"}
35
33
  size={16}
36
- color={srgbToHex(
37
- copied ? tokens.accent.fill.srgb : tokens.textTertiary.srgb,
38
- )}
34
+ color={copied ? tokens.colors.secondary.emphasis.fontPrimary : tokens.colors.primary.main.fontDisabled}
39
35
  />
40
36
  </button>
41
37
  );
@@ -51,8 +47,8 @@ export function CodeBlock({
51
47
  return (
52
48
  <div
53
49
  style={{
54
- backgroundColor: srgbToHex(tokens.backgroundSunken.srgb),
55
- border: `1px solid ${srgbToHex(tokens.border.srgb)}`,
50
+ backgroundColor: tokens.colors.primary.main.divider,
51
+ border: `1px solid ${tokens.colors.primary.main.fontDisabled}`,
56
52
  borderRadius: 8,
57
53
  overflow: "hidden",
58
54
  }}
@@ -62,7 +58,7 @@ export function CodeBlock({
62
58
  display: "flex",
63
59
  justifyContent: "flex-end",
64
60
  padding: "4px 8px",
65
- borderBottom: `1px solid ${srgbToHex(tokens.border.srgb)}`,
61
+ borderBottom: `1px solid ${tokens.colors.primary.main.fontDisabled}`,
66
62
  }}
67
63
  >
68
64
  <CopyButton text={code} />
@@ -75,7 +71,7 @@ export function CodeBlock({
75
71
  fontSize: 13,
76
72
  lineHeight: 1.5,
77
73
  fontFamily: "'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace",
78
- color: srgbToHex(tokens.textPrimary.srgb),
74
+ color: tokens.colors.primary.main.fontPrimary,
79
75
  margin: 0,
80
76
  }}
81
77
  >
@@ -1,9 +1,8 @@
1
- import { useTokens } from "@newtonedev/components";
1
+ import { Frame, Wrapper } from "@newtonedev/components";
2
2
  import type { ColorMode } from "@newtonedev/components";
3
- import { srgbToHex } from "newtone";
4
3
  import type { ColorResult } from "newtone";
5
- import type { ConfiguratorState } from "@newtonedev/configurator";
6
- import type { ConfiguratorAction } from "@newtonedev/configurator";
4
+ import type { ConfiguratorState } from "../configurator/types";
5
+ import type { ConfiguratorAction } from "../configurator/state/actions";
7
6
  import type { GoogleFontEntry } from "@newtonedev/fonts";
8
7
  import {
9
8
  ColorsSection,
@@ -21,6 +20,9 @@ interface ConfiguratorPanelProps {
21
20
  readonly colorMode: ColorMode;
22
21
  readonly onColorModeChange: (mode: ColorMode) => void;
23
22
  readonly fontCatalog?: readonly GoogleFontEntry[];
23
+ readonly activePaletteIndex: number;
24
+ readonly onActivePaletteChange: (index: number) => void;
25
+ readonly useP3: boolean;
24
26
  }
25
27
 
26
28
  const PANEL_WIDTH = 360;
@@ -33,23 +35,25 @@ export function ConfiguratorPanel({
33
35
  colorMode,
34
36
  onColorModeChange,
35
37
  fontCatalog,
38
+ activePaletteIndex,
39
+ onActivePaletteChange,
40
+ useP3,
36
41
  }: ConfiguratorPanelProps) {
37
- const tokens = useTokens();
38
- const borderColor = srgbToHex(tokens.border.srgb);
39
-
40
42
  return (
41
- <div
43
+ <Frame
44
+ bordered
45
+ padding="20"
46
+ direction="vertical"
47
+ gap="24"
48
+ width={PANEL_WIDTH}
49
+ overflow="hidden"
42
50
  style={{
43
- width: PANEL_WIDTH,
44
51
  flexShrink: 0,
45
- overflowY: "auto",
46
- borderRight: `1px solid ${borderColor}`,
47
- padding: 20,
48
- backgroundColor: srgbToHex(tokens.background.srgb),
49
- display: "flex",
50
- flexDirection: "column",
51
- gap: 24,
52
- }}
52
+ overflow: "auto",
53
+ borderTopWidth: 0,
54
+ borderBottomWidth: 0,
55
+ borderLeftWidth: 0,
56
+ } as any}
53
57
  >
54
58
  {activeSectionId === "colors" && (
55
59
  <>
@@ -60,6 +64,9 @@ export function ConfiguratorPanel({
60
64
  previewColors={previewColors}
61
65
  colorMode={colorMode}
62
66
  onColorModeChange={onColorModeChange}
67
+ activePaletteIndex={activePaletteIndex}
68
+ onActivePaletteChange={onActivePaletteChange}
69
+ useP3={useP3}
63
70
  />
64
71
  </>
65
72
  )}
@@ -72,6 +79,6 @@ export function ConfiguratorPanel({
72
79
  {activeSectionId === "layout" && (
73
80
  <OthersSection state={state} dispatch={dispatch} />
74
81
  )}
75
- </div>
82
+ </Frame>
76
83
  );
77
84
  }
@@ -1,6 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { useTokens, Button } from "@newtonedev/components";
3
- import { srgbToHex } from "newtone";
2
+ import { Frame, Text, Wrapper, Button } from "@newtonedev/components";
4
3
  import type { SaveStatus, Preset } from "../types";
5
4
  import { PresetSelector } from "./PresetSelector";
6
5
 
@@ -16,12 +15,13 @@ interface EditorHeaderProps {
16
15
  };
17
16
  readonly presets: readonly Preset[];
18
17
  readonly activePresetId: string;
19
- readonly publishedPresetId: string | null;
18
+ readonly defaultVariantId: string | null;
20
19
  readonly onSwitchPreset: (presetId: string) => void;
21
20
  readonly onCreatePreset: (name: string) => Promise<string>;
22
21
  readonly onRenamePreset: (presetId: string, name: string) => void;
23
22
  readonly onDeletePreset: (presetId: string) => Promise<void>;
24
23
  readonly onDuplicatePreset: (presetId: string, name: string) => Promise<string>;
24
+ readonly onSetDefaultVariant: (presetId: string) => void;
25
25
  }
26
26
 
27
27
  const STATUS_LABEL: Record<SaveStatus, string> = {
@@ -31,6 +31,13 @@ const STATUS_LABEL: Record<SaveStatus, string> = {
31
31
  error: "Save failed",
32
32
  };
33
33
 
34
+ const STATUS_COLOR_MAP: Record<SaveStatus, "accent" | "tertiary" | "secondary" | "primary"> = {
35
+ saved: "accent",
36
+ saving: "tertiary",
37
+ unsaved: "secondary",
38
+ error: "primary",
39
+ };
40
+
34
41
  export function EditorHeader({
35
42
  saveStatus,
36
43
  isPublished,
@@ -40,60 +47,43 @@ export function EditorHeader({
40
47
  headerSlots,
41
48
  presets,
42
49
  activePresetId,
43
- publishedPresetId,
50
+ defaultVariantId,
44
51
  onSwitchPreset,
45
52
  onCreatePreset,
46
53
  onRenamePreset,
47
54
  onDeletePreset,
48
55
  onDuplicatePreset,
56
+ onSetDefaultVariant,
49
57
  }: EditorHeaderProps) {
50
- const tokens = useTokens();
51
- const borderColor = srgbToHex(tokens.border.srgb);
52
-
53
- const statusColor: Record<SaveStatus, string> = {
54
- saved: srgbToHex(tokens.success.fill.srgb),
55
- saving: srgbToHex(tokens.warning.fill.srgb),
56
- unsaved: srgbToHex(tokens.textSecondary.srgb),
57
- error: srgbToHex(tokens.error.fill.srgb),
58
- };
59
-
60
58
  return (
61
- <div
62
- style={{
63
- display: "flex",
64
- alignItems: "center",
65
- justifyContent: "space-between",
66
- padding: "12px 24px",
67
- borderBottom: `1px solid ${borderColor}`,
68
- backgroundColor: srgbToHex(tokens.background.srgb),
69
- flexShrink: 0,
70
- }}
59
+ <Frame
60
+ bordered
61
+ padding={{ x: "24", y: "12" }}
62
+ direction="horizontal"
63
+ align="center"
64
+ justify="between"
65
+ style={{ flexShrink: 0, borderLeftWidth: 0, borderRightWidth: 0, borderTopWidth: 0 }}
71
66
  >
72
- <div style={{ display: "flex", alignItems: "center", gap: 16 }}>
67
+ <Wrapper direction="horizontal" align="center" gap="16">
73
68
  {headerSlots?.left}
74
69
  <PresetSelector
75
70
  presets={presets}
76
71
  activePresetId={activePresetId}
77
- publishedPresetId={publishedPresetId}
72
+ defaultVariantId={defaultVariantId}
78
73
  onSwitchPreset={onSwitchPreset}
79
74
  onCreatePreset={onCreatePreset}
80
75
  onRenamePreset={onRenamePreset}
81
76
  onDeletePreset={onDeletePreset}
82
77
  onDuplicatePreset={onDuplicatePreset}
78
+ onSetDefaultVariant={onSetDefaultVariant}
83
79
  />
84
- </div>
85
- <div style={{ display: "flex", alignItems: "center", gap: 12 }}>
86
- <span
87
- style={{
88
- fontSize: 12,
89
- color: statusColor[saveStatus],
90
- fontWeight: 500,
91
- }}
92
- >
80
+ </Wrapper>
81
+ <Wrapper direction="horizontal" align="center" gap="12">
82
+ <Text role="caption" color={STATUS_COLOR_MAP[saveStatus]}>
93
83
  {STATUS_LABEL[saveStatus]}
94
- </span>
84
+ </Text>
95
85
  {saveStatus === "error" && (
96
- <Button variant="tertiary" semantic="neutral" size="sm" icon="refresh" onPress={onRetry}>
86
+ <Button variant="ghost" size="sm" icon="refresh" onPress={onRetry}>
97
87
  Retry
98
88
  </Button>
99
89
  )}
@@ -107,7 +97,7 @@ export function EditorHeader({
107
97
  {publishing ? "Publishing..." : isPublished ? "Published" : "Publish"}
108
98
  </Button>
109
99
  {headerSlots?.right}
110
- </div>
111
- </div>
100
+ </Wrapper>
101
+ </Frame>
112
102
  );
113
103
  }
@@ -1,6 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { useTokens } from "@newtonedev/components";
3
- import { srgbToHex } from "newtone";
2
+ import { Frame, Wrapper } from "@newtonedev/components";
4
3
 
5
4
  const SIDEBAR_WIDTH = 360;
6
5
 
@@ -17,39 +16,28 @@ export function EditorShell({
17
16
  content,
18
17
  rightPanel,
19
18
  }: EditorShellProps) {
20
- const tokens = useTokens();
21
-
22
19
  return (
23
- <div
24
- style={{
25
- display: "flex",
26
- height: "100%",
27
- overflow: "hidden",
28
- backgroundColor: srgbToHex(tokens.background.srgb),
29
- }}
20
+ <Frame
21
+ direction="horizontal"
22
+ width="fill"
23
+ height="fill"
24
+ style={{ overflow: "hidden" }}
30
25
  >
31
- <div
32
- style={{
33
- flex: 1,
34
- display: "flex",
35
- flexDirection: "column",
36
- height: "100%",
37
- overflow: "hidden",
38
- minWidth: 0,
39
- }}
26
+ <Wrapper
27
+ direction="vertical"
28
+ height="fill"
29
+ style={{ flex: 1, minWidth: 0, overflow: "hidden" }}
40
30
  >
41
31
  {navbar}
42
32
 
43
- <div
44
- style={{
45
- display: "flex",
46
- flex: 1,
47
- overflow: "hidden",
48
- }}
33
+ <Wrapper
34
+ direction="horizontal"
35
+ width="fill"
36
+ style={{ flex: 1, overflow: "hidden" }}
49
37
  >
50
38
  {content}
51
- </div>
52
- </div>
39
+ </Wrapper>
40
+ </Wrapper>
53
41
 
54
42
  <div
55
43
  style={{
@@ -62,6 +50,6 @@ export function EditorShell({
62
50
  {sidebar}
63
51
  {rightPanel}
64
52
  </div>
65
- </div>
53
+ </Frame>
66
54
  );
67
55
  }
@@ -3,7 +3,7 @@ import { useTokens } from "@newtonedev/components";
3
3
  import type { FontConfig } from "@newtonedev/components";
4
4
  import { SYSTEM_FONTS } from "@newtonedev/fonts";
5
5
  import type { GoogleFontEntry, SystemFontEntry } from "@newtonedev/fonts";
6
- import { srgbToHex } from "newtone";
6
+
7
7
 
8
8
  type FontSlot = "default" | "display" | "mono" | "currency";
9
9
 
@@ -76,12 +76,12 @@ export function FontPicker({
76
76
  const containerRef = useRef<HTMLDivElement>(null);
77
77
  const searchInputRef = useRef<HTMLInputElement>(null);
78
78
 
79
- const labelColor = srgbToHex(tokens.textSecondary.srgb);
80
- const textColor = srgbToHex(tokens.textPrimary.srgb);
81
- const bgColor = srgbToHex(tokens.backgroundElevated.srgb);
82
- const borderColor = srgbToHex(tokens.border.srgb);
83
- const hoverColor = srgbToHex(tokens.backgroundSunken.srgb);
84
- const interactiveColor = srgbToHex(tokens.accent.fill.srgb);
79
+ const labelColor = tokens.colors.primary.main.fontTertiary;
80
+ const textColor = tokens.colors.primary.main.fontPrimary;
81
+ const bgColor = tokens.colors.primary.main.divider;
82
+ const borderColor = tokens.colors.primary.main.fontDisabled;
83
+ const hoverColor = tokens.colors.primary.main.divider;
84
+ const interactiveColor = tokens.colors.secondary.emphasis.fontPrimary;
85
85
 
86
86
  useEffect(() => {
87
87
  if (!isOpen) return;