@newtonedev/editor 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.
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,MAAM,CAAC,EACrB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,GACnB,EAAE,WAAW,2CAwGb"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,MAAM,CAAC,EACrB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,GACnB,EAAE,WAAW,2CA8Gb"}
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicRangeSection.d.ts","sourceRoot":"","sources":["../../../src/components/sections/DynamicRangeSection.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAuQnE,UAAU,wBAAwB;IAChC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACzD;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,GACT,EAAE,wBAAwB,2CA0H1B"}
1
+ {"version":3,"file":"DynamicRangeSection.d.ts","sourceRoot":"","sources":["../../../src/components/sections/DynamicRangeSection.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAydnE,UAAU,wBAAwB;IAChC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACzD;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,GACT,EAAE,wBAAwB,2CA6H1B"}
@@ -1,6 +1,6 @@
1
1
  import type { ColorMode } from "@newtonedev/components";
2
2
  import type { ConfiguratorState } from "@newtonedev/configurator";
3
- import type { Preset, SaveStatus, ThemeName, PreviewView, SidebarSelection, EditorPersistence } from "../types";
3
+ import type { Preset, SaveStatus, PreviewView, SidebarSelection, EditorPersistence } from "../types";
4
4
  interface UseEditorStateOptions {
5
5
  readonly initialState: ConfiguratorState;
6
6
  readonly initialIsPublished: boolean;
@@ -24,10 +24,8 @@ export declare function useEditorState({ initialState, initialIsPublished, initi
24
24
  readonly saveDraft: (state: ConfiguratorState) => Promise<void>;
25
25
  readonly previewView: PreviewView;
26
26
  readonly colorMode: ColorMode;
27
- readonly activeTheme: ThemeName;
28
27
  readonly handlePreviewNavigate: (view: PreviewView) => void;
29
28
  readonly handleSelectVariant: (variantId: string) => void;
30
- readonly handleThemeChange: (theme: ThemeName) => void;
31
29
  readonly handleColorModeChange: (mode: ColorMode) => void;
32
30
  readonly sidebarSelection: SidebarSelection;
33
31
  readonly selectedComponentId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"useEditorState.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAC3C;AAED,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,kBAAkB,GACnB,EAAE,qBAAqB;;;;;;;;;gCA0LN,iBAAiB;;;;2CA/DxB,WAAW;8CAmBN,MAAM;wCA+EV,SAAS;2CAQV,SAAS;;;;;4CA3DgC,MAAM,SAAS,OAAO;;;;;;;;;;;;;;;EA6KzE"}
1
+ {"version":3,"file":"useEditorState.d.ts","sourceRoot":"","sources":["../../src/hooks/useEditorState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,WAAW,CAAC;CAC3C;AAED,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,kBAAkB,GACnB,EAAE,qBAAqB;;;;;;;;;gCAuLN,iBAAiB;;;2CA/DxB,WAAW;8CAmBN,MAAM;2CA6EX,SAAS;;;;;4CAjDgC,MAAM,SAAS,OAAO;;;;;;;;;;;;;;;EAiKzE"}
package/dist/index.cjs CHANGED
@@ -216,9 +216,6 @@ function useEditorState({
216
216
  const [colorMode, setColorMode] = react.useState(
217
217
  initialState.preview.mode
218
218
  );
219
- const [activeTheme, setActiveTheme] = react.useState(
220
- initialState.preview.theme || "neutral"
221
- );
222
219
  const [previewView, setPreviewView] = react.useState(
223
220
  initialPreviewView ?? { kind: "overview" }
224
221
  );
@@ -380,13 +377,6 @@ function useEditorState({
380
377
  setIsPublished(false);
381
378
  scheduleSave();
382
379
  }, [configuratorState, scheduleSave]);
383
- const handleThemeChange = react.useCallback(
384
- (theme) => {
385
- setActiveTheme(theme);
386
- dispatch({ type: "SET_PREVIEW_THEME", theme });
387
- },
388
- [dispatch]
389
- );
390
380
  const handleColorModeChange = react.useCallback(
391
381
  (mode) => {
392
382
  setColorMode(mode);
@@ -448,10 +438,8 @@ function useEditorState({
448
438
  // Preview
449
439
  previewView,
450
440
  colorMode,
451
- activeTheme,
452
441
  handlePreviewNavigate,
453
442
  handleSelectVariant,
454
- handleThemeChange,
455
443
  handleColorModeChange,
456
444
  // Sidebar
457
445
  sidebarSelection,
@@ -491,7 +479,7 @@ function EditorShell({
491
479
  {
492
480
  style: {
493
481
  display: "flex",
494
- height: "100vh",
482
+ height: "100%",
495
483
  overflow: "hidden",
496
484
  backgroundColor: newtone.srgbToHex(tokens.background.srgb)
497
485
  },
@@ -503,7 +491,7 @@ function EditorShell({
503
491
  flex: 1,
504
492
  display: "flex",
505
493
  flexDirection: "column",
506
- height: "100vh",
494
+ height: "100%",
507
495
  overflow: "hidden",
508
496
  minWidth: 0
509
497
  },
@@ -566,7 +554,7 @@ function ColorsSection({
566
554
  const palette = state.palettes[activePaletteIndex];
567
555
  const hueRange = configurator.SEMANTIC_HUE_RANGES[activePaletteIndex];
568
556
  const isNeutral = activePaletteIndex === 0;
569
- const activeColor = newtone.srgbToHex(tokens.interactive.srgb);
557
+ const activeColor = newtone.srgbToHex(tokens.accent.fill.srgb);
570
558
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
571
559
  const effectiveKeyColor = colorMode === "dark" ? palette.keyColorDark : palette.keyColor;
572
560
  const setKeyColorAction = colorMode === "dark" ? "SET_PALETTE_KEY_COLOR_DARK" : "SET_PALETTE_KEY_COLOR";
@@ -798,7 +786,7 @@ function ColorsSection({
798
786
  style: {
799
787
  fontSize: 12,
800
788
  fontWeight: 500,
801
- color: newtone.srgbToHex(tokens.error.srgb)
789
+ color: newtone.srgbToHex(tokens.error.fill.srgb)
802
790
  },
803
791
  children: hexError
804
792
  }
@@ -957,7 +945,7 @@ function DualRangeSlider({
957
945
  const tokens = components.useTokens();
958
946
  const trackRef = react.useRef(null);
959
947
  const [activeThumb, setActiveThumb] = react.useState(null);
960
- const interactiveColor = newtone.srgbToHex(tokens.interactive.srgb);
948
+ const interactiveColor = newtone.srgbToHex(tokens.accent.fill.srgb);
961
949
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
962
950
  const wDisplay = internalToDisplay(whitesValue);
963
951
  const bDisplay = internalToDisplay(blacksValue);
@@ -1128,6 +1116,154 @@ function RangeInput({ display, onCommit, toInternal }) {
1128
1116
  }
1129
1117
  );
1130
1118
  }
1119
+ var GRAPH_HEIGHT = 80;
1120
+ var GRAPH_COLS = 256;
1121
+ var GRAPH_ROWS = 64;
1122
+ function strengthToFactor(strength) {
1123
+ switch (strength) {
1124
+ case "none":
1125
+ return 0;
1126
+ case "low":
1127
+ return newtone.HUE_GRADING_STRENGTH_LOW;
1128
+ case "medium":
1129
+ return newtone.HUE_GRADING_STRENGTH_MEDIUM;
1130
+ case "hard":
1131
+ return newtone.HUE_GRADING_STRENGTH_HARD;
1132
+ }
1133
+ }
1134
+ function blendHues(lightHue, darkHue, wLight, wDark) {
1135
+ const totalW = wLight + wDark;
1136
+ if (totalW === 0) return 0;
1137
+ const delta = ((darkHue - lightHue + 180) % 360 + 360) % 360 - 180;
1138
+ const t = wDark / totalW;
1139
+ const result = lightHue + delta * t;
1140
+ return (result % 360 + 360) % 360;
1141
+ }
1142
+ function computeGraphData(state) {
1143
+ const { dynamicRange, globalHueGrading } = state;
1144
+ const lightActive = globalHueGrading.light.strength !== "none";
1145
+ const darkActive = globalHueGrading.dark.strength !== "none";
1146
+ const lightOklchHue = configurator.traditionalHueToOklch(globalHueGrading.light.hue);
1147
+ const darkOklchHue = configurator.traditionalHueToOklch(globalHueGrading.dark.hue);
1148
+ const lightFactor = strengthToFactor(globalHueGrading.light.strength);
1149
+ const darkFactor = strengthToFactor(globalHueGrading.dark.strength);
1150
+ const buffer = new Uint8ClampedArray(GRAPH_COLS * GRAPH_ROWS * 4);
1151
+ for (let col = 0; col < GRAPH_COLS; col++) {
1152
+ const nv = 1 - col / (GRAPH_COLS - 1);
1153
+ const L = newtone.resolveLightness(dynamicRange, nv);
1154
+ const wLight = lightActive ? Math.pow(nv, newtone.HUE_GRADING_EASING_POWER) : 0;
1155
+ const wDark = darkActive ? Math.pow(1 - nv, newtone.HUE_GRADING_EASING_POWER) : 0;
1156
+ const totalW = wLight + wDark;
1157
+ let topHue;
1158
+ let topChroma;
1159
+ if (totalW === 0) {
1160
+ topHue = 0;
1161
+ topChroma = 0;
1162
+ } else {
1163
+ if (!lightActive) {
1164
+ topHue = darkOklchHue;
1165
+ } else if (!darkActive) {
1166
+ topHue = lightOklchHue;
1167
+ } else {
1168
+ topHue = blendHues(lightOklchHue, darkOklchHue, wLight, wDark);
1169
+ }
1170
+ topChroma = newtone.findMaxChromaInGamut(L, topHue) * Math.min(totalW, 1);
1171
+ }
1172
+ for (let row = 0; row < GRAPH_ROWS; row++) {
1173
+ const gradingIntensity = row / (GRAPH_ROWS - 1);
1174
+ const C = topChroma * gradingIntensity;
1175
+ const srgb = newtone.clampSrgb(newtone.oklchToSrgb({ L, C, h: topHue }));
1176
+ const canvasY = GRAPH_ROWS - 1 - row;
1177
+ const idx = (canvasY * GRAPH_COLS + col) * 4;
1178
+ buffer[idx] = Math.round(srgb.r * 255);
1179
+ buffer[idx + 1] = Math.round(srgb.g * 255);
1180
+ buffer[idx + 2] = Math.round(srgb.b * 255);
1181
+ buffer[idx + 3] = 255;
1182
+ }
1183
+ }
1184
+ const curvePoints = [];
1185
+ for (let i = 0; i < 26; i++) {
1186
+ const nv = 1 - i / 25;
1187
+ const x = i / 25 * (GRAPH_COLS - 1);
1188
+ const lightContrib = Math.pow(nv, newtone.HUE_GRADING_EASING_POWER) * (lightFactor / newtone.HUE_GRADING_STRENGTH_HARD);
1189
+ const darkContrib = Math.pow(1 - nv, newtone.HUE_GRADING_EASING_POWER) * (darkFactor / newtone.HUE_GRADING_STRENGTH_HARD);
1190
+ const y = clamp(lightContrib + darkContrib, 0, 1);
1191
+ curvePoints.push({ x, y });
1192
+ }
1193
+ return { buffer, curvePoints };
1194
+ }
1195
+ function DynamicRangeGraph({ state }) {
1196
+ const tokens = components.useTokens();
1197
+ const canvasRef = react.useRef(null);
1198
+ const graphData = react.useMemo(
1199
+ () => computeGraphData(state),
1200
+ [
1201
+ state.dynamicRange.lightest,
1202
+ state.dynamicRange.darkest,
1203
+ state.globalHueGrading.light.strength,
1204
+ state.globalHueGrading.light.hue,
1205
+ state.globalHueGrading.dark.strength,
1206
+ state.globalHueGrading.dark.hue
1207
+ ]
1208
+ );
1209
+ react.useEffect(() => {
1210
+ const canvas = canvasRef.current;
1211
+ if (!canvas) return;
1212
+ canvas.width = GRAPH_COLS;
1213
+ canvas.height = GRAPH_ROWS;
1214
+ const ctx = canvas.getContext("2d");
1215
+ if (!ctx) return;
1216
+ const imageData = ctx.createImageData(GRAPH_COLS, GRAPH_ROWS);
1217
+ imageData.data.set(graphData.buffer);
1218
+ ctx.putImageData(imageData, 0, 0);
1219
+ const curveColor = newtone.srgbToHex(tokens.accent.fill.srgb);
1220
+ const { curvePoints } = graphData;
1221
+ if (curvePoints.length < 2) return;
1222
+ const mapped = curvePoints.map((p) => ({
1223
+ cx: p.x,
1224
+ cy: (1 - p.y) * (GRAPH_ROWS - 1)
1225
+ }));
1226
+ ctx.beginPath();
1227
+ ctx.strokeStyle = curveColor;
1228
+ ctx.lineWidth = 1.5;
1229
+ ctx.lineJoin = "round";
1230
+ ctx.lineCap = "round";
1231
+ ctx.moveTo(mapped[0].cx, mapped[0].cy);
1232
+ for (let i = 0; i < mapped.length - 1; i++) {
1233
+ const p0 = mapped[Math.max(0, i - 1)];
1234
+ const p1 = mapped[i];
1235
+ const p2 = mapped[i + 1];
1236
+ const p3 = mapped[Math.min(mapped.length - 1, i + 2)];
1237
+ const cp1x = p1.cx + (p2.cx - p0.cx) / 6;
1238
+ const cp1y = p1.cy + (p2.cy - p0.cy) / 6;
1239
+ const cp2x = p2.cx - (p3.cx - p1.cx) / 6;
1240
+ const cp2y = p2.cy - (p3.cy - p1.cy) / 6;
1241
+ ctx.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, p2.cx, p2.cy);
1242
+ }
1243
+ ctx.stroke();
1244
+ ctx.fillStyle = curveColor;
1245
+ for (const p of mapped) {
1246
+ ctx.beginPath();
1247
+ ctx.arc(p.cx, p.cy, 2, 0, Math.PI * 2);
1248
+ ctx.fill();
1249
+ }
1250
+ }, [graphData, tokens]);
1251
+ const borderColor = newtone.srgbToHex(tokens.border.srgb);
1252
+ return /* @__PURE__ */ jsxRuntime.jsx(
1253
+ "canvas",
1254
+ {
1255
+ ref: canvasRef,
1256
+ style: {
1257
+ width: "100%",
1258
+ height: GRAPH_HEIGHT,
1259
+ borderRadius: 6,
1260
+ border: `1px solid ${borderColor}`,
1261
+ display: "block",
1262
+ overflow: "hidden"
1263
+ }
1264
+ }
1265
+ );
1266
+ }
1131
1267
  function DynamicRangeSection({
1132
1268
  state,
1133
1269
  dispatch
@@ -1144,6 +1280,7 @@ function DynamicRangeSection({
1144
1280
  const wDisplay = internalToDisplay(state.dynamicRange.lightest);
1145
1281
  const bDisplay = internalToDisplay(state.dynamicRange.darkest);
1146
1282
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 12 }, children: [
1283
+ /* @__PURE__ */ jsxRuntime.jsx(DynamicRangeGraph, { state }),
1147
1284
  /* @__PURE__ */ jsxRuntime.jsxs(
1148
1285
  "div",
1149
1286
  {
@@ -1350,7 +1487,7 @@ function FontPicker({
1350
1487
  const bgColor = newtone.srgbToHex(tokens.backgroundElevated.srgb);
1351
1488
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
1352
1489
  const hoverColor = newtone.srgbToHex(tokens.backgroundSunken.srgb);
1353
- const interactiveColor = newtone.srgbToHex(tokens.interactive.srgb);
1490
+ const interactiveColor = newtone.srgbToHex(tokens.accent.fill.srgb);
1354
1491
  react.useEffect(() => {
1355
1492
  if (!isOpen) return;
1356
1493
  function handleMouseDown(e) {
@@ -1793,9 +1930,9 @@ function PresetSelector({
1793
1930
  const bgColor = newtone.srgbToHex(tokens.background.srgb);
1794
1931
  const textPrimary = newtone.srgbToHex(tokens.textPrimary.srgb);
1795
1932
  const textSecondary = newtone.srgbToHex(tokens.textSecondary.srgb);
1796
- const interactiveColor = newtone.srgbToHex(tokens.interactive.srgb);
1797
- const warningColor = newtone.srgbToHex(tokens.warning.srgb);
1798
- const errorColor = newtone.srgbToHex(tokens.error.srgb);
1933
+ const interactiveColor = newtone.srgbToHex(tokens.accent.fill.srgb);
1934
+ const warningColor = newtone.srgbToHex(tokens.warning.fill.srgb);
1935
+ const errorColor = newtone.srgbToHex(tokens.error.fill.srgb);
1799
1936
  const hoverBg = `${borderColor}18`;
1800
1937
  const activeBg = `${interactiveColor}14`;
1801
1938
  react.useEffect(() => {
@@ -2504,10 +2641,10 @@ function EditorHeader({
2504
2641
  const tokens = components.useTokens();
2505
2642
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
2506
2643
  const statusColor = {
2507
- saved: newtone.srgbToHex(tokens.success.srgb),
2508
- saving: newtone.srgbToHex(tokens.warning.srgb),
2644
+ saved: newtone.srgbToHex(tokens.success.fill.srgb),
2645
+ saving: newtone.srgbToHex(tokens.warning.fill.srgb),
2509
2646
  unsaved: newtone.srgbToHex(tokens.textSecondary.srgb),
2510
- error: newtone.srgbToHex(tokens.error.srgb)
2647
+ error: newtone.srgbToHex(tokens.error.fill.srgb)
2511
2648
  };
2512
2649
  return /* @__PURE__ */ jsxRuntime.jsxs(
2513
2650
  "div",
@@ -2535,7 +2672,7 @@ function EditorHeader({
2535
2672
  children: STATUS_LABEL[saveStatus]
2536
2673
  }
2537
2674
  ),
2538
- saveStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx(components.Button, { variant: "ghost", size: "sm", icon: "refresh", onPress: onRetry, children: "Retry" }),
2675
+ saveStatus === "error" && /* @__PURE__ */ jsxRuntime.jsx(components.Button, { variant: "tertiary", semantic: "neutral", size: "sm", icon: "refresh", onPress: onRetry, children: "Retry" }),
2539
2676
  /* @__PURE__ */ jsxRuntime.jsx(
2540
2677
  components.Button,
2541
2678
  {
@@ -2553,59 +2690,6 @@ function EditorHeader({
2553
2690
  }
2554
2691
  );
2555
2692
  }
2556
- var THEME_CHIPS = [
2557
- { id: "neutral", label: "Neutral" },
2558
- { id: "primary", label: "Primary" },
2559
- { id: "secondary", label: "Secondary" },
2560
- { id: "strong", label: "Strong" }
2561
- ];
2562
- function ThemeBar({ activeTheme, onThemeChange }) {
2563
- const tokens = components.useTokens();
2564
- const [hoveredChipId, setHoveredChipId] = react.useState(null);
2565
- const borderColor = newtone.srgbToHex(tokens.border.srgb);
2566
- const interactiveColor = newtone.srgbToHex(tokens.interactive.srgb);
2567
- return /* @__PURE__ */ jsxRuntime.jsx(
2568
- "div",
2569
- {
2570
- style: {
2571
- display: "flex",
2572
- alignItems: "center",
2573
- padding: "8px 24px",
2574
- borderBottom: `1px solid ${borderColor}`,
2575
- backgroundColor: newtone.srgbToHex(tokens.background.srgb),
2576
- flexShrink: 0
2577
- },
2578
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 8 }, role: "group", "aria-label": "Theme", children: THEME_CHIPS.map((chip) => {
2579
- const isActive = chip.id === activeTheme;
2580
- const isHovered = hoveredChipId === chip.id;
2581
- return /* @__PURE__ */ jsxRuntime.jsx(
2582
- "button",
2583
- {
2584
- onClick: () => onThemeChange(chip.id),
2585
- onMouseEnter: () => setHoveredChipId(chip.id),
2586
- onMouseLeave: () => setHoveredChipId(null),
2587
- "aria-pressed": isActive,
2588
- style: {
2589
- padding: "4px 12px",
2590
- borderRadius: 16,
2591
- border: `1px solid ${newtone.srgbToHex(
2592
- isActive ? tokens.interactive.srgb : tokens.border.srgb
2593
- )}`,
2594
- backgroundColor: isActive ? interactiveColor : isHovered ? `${interactiveColor}10` : "transparent",
2595
- color: isActive ? "#fff" : newtone.srgbToHex(tokens.textPrimary.srgb),
2596
- fontSize: 12,
2597
- fontWeight: 500,
2598
- cursor: "pointer",
2599
- transition: "background-color 150ms ease"
2600
- },
2601
- children: chip.label
2602
- },
2603
- chip.id
2604
- );
2605
- }) })
2606
- }
2607
- );
2608
- }
2609
2693
  var TOC_WIDTH = 220;
2610
2694
  function TableOfContents({
2611
2695
  activeView,
@@ -2615,7 +2699,7 @@ function TableOfContents({
2615
2699
  const tokens = components.useTokens();
2616
2700
  const [hoveredId, setHoveredId] = react.useState(null);
2617
2701
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
2618
- const activeColor = newtone.srgbToHex(tokens.interactive.srgb);
2702
+ const activeColor = newtone.srgbToHex(tokens.accent.fill.srgb);
2619
2703
  const textPrimary = newtone.srgbToHex(tokens.textPrimary.srgb);
2620
2704
  const textSecondary = newtone.srgbToHex(tokens.textSecondary.srgb);
2621
2705
  const hoverBg = `${borderColor}20`;
@@ -2770,6 +2854,16 @@ function CardPreview(props) {
2770
2854
  )
2771
2855
  ] });
2772
2856
  }
2857
+ function FramePreview(props) {
2858
+ return /* @__PURE__ */ jsxRuntime.jsx(components.Frame, { ...props, style: { minWidth: 200, minHeight: 60 }, children: /* @__PURE__ */ jsxRuntime.jsx(components.Text, { size: "sm", children: "Frame content" }) });
2859
+ }
2860
+ function WrapperPreview(props) {
2861
+ return /* @__PURE__ */ jsxRuntime.jsxs(components.Wrapper, { ...props, style: { minWidth: 200 }, children: [
2862
+ /* @__PURE__ */ jsxRuntime.jsx(components.Text, { size: "sm", children: "Item 1" }),
2863
+ /* @__PURE__ */ jsxRuntime.jsx(components.Text, { size: "sm", children: "Item 2" }),
2864
+ /* @__PURE__ */ jsxRuntime.jsx(components.Text, { size: "sm", children: "Item 3" })
2865
+ ] });
2866
+ }
2773
2867
  function ComponentRenderer({ componentId, props }) {
2774
2868
  const noop = react.useCallback(() => {
2775
2869
  }, []);
@@ -2780,9 +2874,11 @@ function ComponentRenderer({ componentId, props }) {
2780
2874
  components.Button,
2781
2875
  {
2782
2876
  variant: props.variant,
2877
+ semantic: props.semantic,
2783
2878
  size: props.size,
2784
2879
  icon,
2785
2880
  iconPosition: props.iconPosition,
2881
+ disabled: props.disabled,
2786
2882
  onPress: noop,
2787
2883
  children: "Button"
2788
2884
  }
@@ -2800,6 +2896,30 @@ function ComponentRenderer({ componentId, props }) {
2800
2896
  return /* @__PURE__ */ jsxRuntime.jsx(StatefulHueSlider, { ...props });
2801
2897
  case "card":
2802
2898
  return /* @__PURE__ */ jsxRuntime.jsx(CardPreview, { ...props });
2899
+ case "text":
2900
+ return /* @__PURE__ */ jsxRuntime.jsx(
2901
+ components.Text,
2902
+ {
2903
+ size: props.size,
2904
+ weight: props.weight,
2905
+ color: props.color,
2906
+ font: props.font,
2907
+ children: "The quick brown fox"
2908
+ }
2909
+ );
2910
+ case "icon":
2911
+ return /* @__PURE__ */ jsxRuntime.jsx(
2912
+ components.Icon,
2913
+ {
2914
+ name: props.name ?? "home",
2915
+ size: props.size,
2916
+ fill: props.fill
2917
+ }
2918
+ );
2919
+ case "frame":
2920
+ return /* @__PURE__ */ jsxRuntime.jsx(FramePreview, { ...props });
2921
+ case "wrapper":
2922
+ return /* @__PURE__ */ jsxRuntime.jsx(WrapperPreview, { ...props });
2803
2923
  default:
2804
2924
  return null;
2805
2925
  }
@@ -2923,7 +3043,7 @@ function ComponentCard({
2923
3043
  padding: 20,
2924
3044
  borderRadius: 12,
2925
3045
  border: `1px solid ${newtone.srgbToHex(
2926
- isHovered ? tokens.interactive.srgb : tokens.border.srgb
3046
+ isHovered ? tokens.accent.fill.srgb : tokens.border.srgb
2927
3047
  )}`,
2928
3048
  backgroundColor: newtone.srgbToHex(tokens.backgroundElevated.srgb),
2929
3049
  cursor: "pointer",
@@ -3033,7 +3153,7 @@ function CategoryView({
3033
3153
  padding: 24,
3034
3154
  borderRadius: 12,
3035
3155
  border: `1px solid ${newtone.srgbToHex(
3036
- isHovered ? tokens.interactive.srgb : tokens.border.srgb
3156
+ isHovered ? tokens.accent.fill.srgb : tokens.border.srgb
3037
3157
  )}`,
3038
3158
  backgroundColor: newtone.srgbToHex(tokens.backgroundElevated.srgb),
3039
3159
  cursor: "pointer",
@@ -3122,7 +3242,7 @@ function ComponentDetailView({
3122
3242
  const component = components.getComponent(componentId);
3123
3243
  const [hoveredId, setHoveredId] = react.useState(null);
3124
3244
  if (!component) return null;
3125
- const interactiveColor = newtone.srgbToHex(tokens.interactive.srgb);
3245
+ const interactiveColor = newtone.srgbToHex(tokens.accent.fill.srgb);
3126
3246
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: 32 }, children: [
3127
3247
  /* @__PURE__ */ jsxRuntime.jsx(
3128
3248
  "h2",
@@ -3282,7 +3402,7 @@ function CopyButton({ text }) {
3282
3402
  setCopied(true);
3283
3403
  setTimeout(() => setCopied(false), 2e3);
3284
3404
  }, [text]);
3285
- return /* @__PURE__ */ jsxRuntime.jsx(components.Button, { variant: "ghost", size: "sm", icon: copied ? "check" : "content_copy", onPress: handleCopy, children: copied ? "Copied!" : "Copy" });
3405
+ return /* @__PURE__ */ jsxRuntime.jsx(components.Button, { variant: "tertiary", semantic: "neutral", size: "sm", icon: copied ? "check" : "content_copy", onPress: handleCopy, children: copied ? "Copied!" : "Copy" });
3286
3406
  }
3287
3407
  function CodeBlock({
3288
3408
  code
@@ -3412,7 +3532,7 @@ function RightSidebar({
3412
3532
  padding: 0,
3413
3533
  fontSize: 14,
3414
3534
  fontWeight: 500,
3415
- color: newtone.srgbToHex(tokens.interactive.srgb),
3535
+ color: newtone.srgbToHex(tokens.accent.fill.srgb),
3416
3536
  whiteSpace: "nowrap"
3417
3537
  },
3418
3538
  children: component.name
@@ -3650,7 +3770,7 @@ function PropControl({
3650
3770
  width: 36,
3651
3771
  height: 20,
3652
3772
  borderRadius: 10,
3653
- backgroundColor: value ? newtone.srgbToHex(tokens.interactive.srgb) : newtone.srgbToHex(tokens.border.srgb),
3773
+ backgroundColor: value ? newtone.srgbToHex(tokens.accent.fill.srgb) : newtone.srgbToHex(tokens.border.srgb),
3654
3774
  position: "relative",
3655
3775
  transition: "background-color 150ms ease",
3656
3776
  flexShrink: 0
@@ -3711,6 +3831,10 @@ function Editor({
3711
3831
  onNavigate,
3712
3832
  initialPreviewView
3713
3833
  });
3834
+ const previewConfig = react.useMemo(
3835
+ () => chromeThemeConfig.tokenOverrides ? { ...editor.themeConfig, tokenOverrides: chromeThemeConfig.tokenOverrides } : editor.themeConfig,
3836
+ [editor.themeConfig, chromeThemeConfig.tokenOverrides]
3837
+ );
3714
3838
  return /* @__PURE__ */ jsxRuntime.jsx(components.NewtoneProvider, { config: chromeThemeConfig, children: /* @__PURE__ */ jsxRuntime.jsx(
3715
3839
  EditorShell,
3716
3840
  {
@@ -3773,33 +3897,23 @@ function Editor({
3773
3897
  overflow: "hidden",
3774
3898
  minWidth: 0
3775
3899
  },
3776
- children: /* @__PURE__ */ jsxRuntime.jsxs(
3900
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3777
3901
  components.NewtoneProvider,
3778
3902
  {
3779
- config: editor.themeConfig,
3903
+ config: previewConfig,
3780
3904
  initialMode: editor.colorMode,
3781
- initialTheme: editor.activeTheme,
3782
- children: [
3783
- /* @__PURE__ */ jsxRuntime.jsx(
3784
- ThemeBar,
3785
- {
3786
- activeTheme: editor.activeTheme,
3787
- onThemeChange: editor.handleThemeChange
3788
- }
3789
- ),
3790
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, overflowY: "auto", minWidth: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3791
- PreviewWindow,
3792
- {
3793
- view: editor.previewView,
3794
- selectedVariantId: editor.selectedVariantId,
3795
- propOverrides: editor.propOverrides,
3796
- onNavigate: editor.handlePreviewNavigate,
3797
- onSelectVariant: editor.handleSelectVariant
3798
- }
3799
- ) })
3800
- ]
3905
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, overflowY: "auto", minWidth: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
3906
+ PreviewWindow,
3907
+ {
3908
+ view: editor.previewView,
3909
+ selectedVariantId: editor.selectedVariantId,
3910
+ propOverrides: editor.propOverrides,
3911
+ onNavigate: editor.handlePreviewNavigate,
3912
+ onSelectVariant: editor.handleSelectVariant
3913
+ }
3914
+ ) })
3801
3915
  },
3802
- `${editor.colorMode}-${editor.activeTheme}`
3916
+ editor.colorMode
3803
3917
  )
3804
3918
  }
3805
3919
  )
@@ -3840,7 +3954,6 @@ exports.PreviewWindow = PreviewWindow;
3840
3954
  exports.RightSidebar = RightSidebar;
3841
3955
  exports.Sidebar = Sidebar;
3842
3956
  exports.TableOfContents = TableOfContents;
3843
- exports.ThemeBar = ThemeBar;
3844
3957
  exports.findPreset = findPreset;
3845
3958
  exports.presetHasUnpublishedChanges = presetHasUnpublishedChanges;
3846
3959
  exports.updatePresetInArray = updatePresetInArray;