@newtonedev/editor 0.1.9 → 0.1.11

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/Editor.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { EditorProps } from "./types";
2
- export declare function Editor({ initialState, initialIsPublished, initialPresets, initialActivePresetId, initialPublishedPresetId, defaultState, chromeThemeConfig, persistence, headerSlots, onNavigate, initialPreviewView, manifestUrl, fontCatalog, }: EditorProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Editor({ initialState, initialIsPublished, initialPresets, initialActivePresetId, initialPublishedPresetId, defaultState, chromeThemeConfig, persistence, headerSlots, navFooter, onNavigate, initialPreviewView, manifestUrl, fontCatalog, }: EditorProps): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=Editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AAaA,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,EAClB,WAAW,EACX,WAAW,GACZ,EAAE,WAAW,2CAuJb"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AAaA,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,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,WAAW,GACZ,EAAE,WAAW,2CAwJb"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import type { SaveStatus } from "../types";
2
+ import type { SaveStatus, Preset } from "../types";
3
3
  interface EditorHeaderProps {
4
4
  readonly saveStatus: SaveStatus;
5
5
  readonly isPublished: boolean;
@@ -10,7 +10,15 @@ interface EditorHeaderProps {
10
10
  readonly left?: ReactNode;
11
11
  readonly right?: ReactNode;
12
12
  };
13
+ readonly presets: readonly Preset[];
14
+ readonly activePresetId: string;
15
+ readonly publishedPresetId: string | null;
16
+ readonly onSwitchPreset: (presetId: string) => void;
17
+ readonly onCreatePreset: (name: string) => Promise<string>;
18
+ readonly onRenamePreset: (presetId: string, name: string) => void;
19
+ readonly onDeletePreset: (presetId: string) => Promise<void>;
20
+ readonly onDuplicatePreset: (presetId: string, name: string) => Promise<string>;
13
21
  }
14
- export declare function EditorHeader({ saveStatus, isPublished, publishing, onPublish, onRetry, headerSlots, }: EditorHeaderProps): import("react/jsx-runtime").JSX.Element;
22
+ export declare function EditorHeader({ saveStatus, isPublished, publishing, onPublish, onRetry, headerSlots, presets, activePresetId, publishedPresetId, onSwitchPreset, onCreatePreset, onRenamePreset, onDeletePreset, onDuplicatePreset, }: EditorHeaderProps): import("react/jsx-runtime").JSX.Element;
15
23
  export {};
16
24
  //# sourceMappingURL=EditorHeader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditorHeader.d.ts","sourceRoot":"","sources":["../../src/components/EditorHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,iBAAiB;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI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M,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,QAAQ,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjF;AASD,wBAAgB,YAAY,CAAC,EAC3B,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,WAAW,EACX,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,EAAE,iBAAiB,2CAgEnB"}
@@ -1,7 +1,9 @@
1
+ import type { ReactNode } from "react";
1
2
  interface PrimaryNavProps {
2
3
  readonly activeSectionId: string | null;
3
4
  readonly onSelectSection: (sectionId: string) => void;
5
+ readonly footer?: ReactNode;
4
6
  }
5
- export declare function PrimaryNav({ activeSectionId, onSelectSection }: PrimaryNavProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function PrimaryNav({ activeSectionId, onSelectSection, footer }: PrimaryNavProps): import("react/jsx-runtime").JSX.Element;
6
8
  export {};
7
9
  //# sourceMappingURL=PrimaryNav.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrimaryNav.d.ts","sourceRoot":"","sources":["../../src/components/PrimaryNav.tsx"],"names":[],"mappings":"AAIA,UAAU,eAAe;IACvB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAID,wBAAgB,UAAU,CAAC,EAAE,eAAe,EAAE,eAAe,EAAE,EAAE,eAAe,2CAgE/E"}
1
+ {"version":3,"file":"PrimaryNav.d.ts","sourceRoot":"","sources":["../../src/components/PrimaryNav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,UAAU,eAAe;IACvB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B;AAID,wBAAgB,UAAU,CAAC,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,eAAe,2CAqEvF"}
@@ -1,16 +1,7 @@
1
- import type { Preset } from "../types";
2
1
  interface SidebarProps {
3
2
  readonly isDirty: boolean;
4
3
  readonly onRevert: () => void;
5
- readonly presets: readonly Preset[];
6
- readonly activePresetId: string;
7
- readonly publishedPresetId: string | null;
8
- readonly onSwitchPreset: (presetId: string) => void;
9
- readonly onCreatePreset: (name: string) => Promise<string>;
10
- readonly onRenamePreset: (presetId: string, name: string) => void;
11
- readonly onDeletePreset: (presetId: string) => Promise<void>;
12
- readonly onDuplicatePreset: (presetId: string, name: string) => Promise<string>;
13
4
  }
14
- export declare function Sidebar({ isDirty, onRevert, presets, activePresetId, publishedPresetId, onSwitchPreset, onCreatePreset, onRenamePreset, onDeletePreset, onDuplicatePreset, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function Sidebar({ isDirty, onRevert, }: SidebarProps): import("react/jsx-runtime").JSX.Element;
15
6
  export {};
16
7
  //# sourceMappingURL=Sidebar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../src/components/Sidebar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIvC,UAAU,YAAY;IACpB,QAAQ,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":["../../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;AAIlB,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;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,WAAW,GACZ,EAAE,qBAAqB;;;;;;;;;gCAsON,iBAAiB;;;;2CA3GxB,WAAW;8CAsBN,MAAM;8CA8BN,MAAM;2CAwFX,SAAS;;;;;4CA3DL,MAAM,SAAS,OAAO;;;;;;;;;;;;;;;EAkMpC"}
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;AAIlB,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;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,WAAW,GACZ,EAAE,qBAAqB;;;;;;;;;gCAwON,iBAAiB;;;;2CA3GxB,WAAW;8CAsBN,MAAM;8CA8BN,MAAM;2CAwFX,SAAS;;;;;4CA3DL,MAAM,SAAS,OAAO;;;;;;;;;;;;;;;EAkMpC"}
package/dist/index.cjs CHANGED
@@ -266,11 +266,12 @@ function useEditorState({
266
266
  const [colorMode, setColorMode] = react.useState(
267
267
  initialState.preview.mode
268
268
  );
269
+ const defaultCategoryId = components.CATEGORIES[0]?.id ?? "colors";
269
270
  const [previewView, setPreviewView] = react.useState(
270
- initialPreviewView ?? { kind: "overview" }
271
+ initialPreviewView ?? { kind: "category", categoryId: defaultCategoryId }
271
272
  );
272
273
  const [activeSectionId, setActiveSectionId] = react.useState(
273
- components.CATEGORIES[0]?.id ?? "colors"
274
+ (initialPreviewView?.kind === "category" ? initialPreviewView.categoryId : void 0) ?? defaultCategoryId
274
275
  );
275
276
  const [sidebarSelection, setSidebarSelection] = react.useState(null);
276
277
  const [propOverrides, setPropOverrides] = react.useState(
@@ -370,11 +371,10 @@ function useEditorState({
370
371
  (sectionId) => {
371
372
  setActiveSectionId(sectionId);
372
373
  const sectionComponents = components.getComponentsByCategory(sectionId);
374
+ onNavigate?.({ kind: "category", categoryId: sectionId });
373
375
  if (sectionComponents.length === 1) {
374
376
  const comp = sectionComponents[0];
375
- const view = { kind: "component", componentId: comp.id };
376
- setPreviewView(view);
377
- onNavigate?.(view);
377
+ setPreviewView({ kind: "component", componentId: comp.id });
378
378
  const firstVariantId = comp.variants[0]?.id;
379
379
  setSidebarSelection(
380
380
  firstVariantId ? { scope: "variant", componentId: comp.id, variantId: firstVariantId } : { scope: "component", componentId: comp.id }
@@ -383,7 +383,6 @@ function useEditorState({
383
383
  } else {
384
384
  const view = { kind: "category", categoryId: sectionId };
385
385
  setPreviewView(view);
386
- onNavigate?.(view);
387
386
  setSidebarSelection(null);
388
387
  setPropOverrides({});
389
388
  }
@@ -639,6 +638,94 @@ function EditorShell({
639
638
  }
640
639
  );
641
640
  }
641
+ var SIDEBAR_WIDTH2 = 360;
642
+ function Sidebar({
643
+ isDirty,
644
+ onRevert
645
+ }) {
646
+ const tokens = components.useTokens();
647
+ const borderColor = newtone.srgbToHex(tokens.border.srgb);
648
+ const bgColor = newtone.srgbToHex(tokens.background.srgb);
649
+ return /* @__PURE__ */ jsxRuntime.jsxs(
650
+ "div",
651
+ {
652
+ style: {
653
+ width: SIDEBAR_WIDTH2,
654
+ flexShrink: 0,
655
+ display: "flex",
656
+ flexDirection: "column",
657
+ height: "100vh",
658
+ borderLeft: `1px solid ${borderColor}`,
659
+ backgroundColor: bgColor
660
+ },
661
+ children: [
662
+ /* @__PURE__ */ jsxRuntime.jsx(
663
+ "div",
664
+ {
665
+ style: {
666
+ flexShrink: 0,
667
+ padding: "16px 20px",
668
+ borderBottom: `1px solid ${borderColor}`,
669
+ display: "flex",
670
+ alignItems: "center"
671
+ },
672
+ children: /* @__PURE__ */ jsxRuntime.jsx(
673
+ "span",
674
+ {
675
+ style: {
676
+ fontSize: 16,
677
+ fontWeight: 700,
678
+ color: newtone.srgbToHex(tokens.textPrimary.srgb)
679
+ },
680
+ children: "newtone"
681
+ }
682
+ )
683
+ }
684
+ ),
685
+ /* @__PURE__ */ jsxRuntime.jsx(
686
+ "div",
687
+ {
688
+ style: {
689
+ flex: 1,
690
+ overflowY: "auto",
691
+ overflowX: "hidden"
692
+ }
693
+ }
694
+ ),
695
+ /* @__PURE__ */ jsxRuntime.jsx(
696
+ "div",
697
+ {
698
+ style: {
699
+ flexShrink: 0,
700
+ padding: "12px 20px",
701
+ borderTop: `1px solid ${borderColor}`
702
+ },
703
+ children: /* @__PURE__ */ jsxRuntime.jsx(
704
+ "button",
705
+ {
706
+ disabled: !isDirty,
707
+ onClick: onRevert,
708
+ "aria-label": "Revert all changes to the last saved version",
709
+ style: {
710
+ width: "100%",
711
+ padding: "8px 16px",
712
+ borderRadius: 6,
713
+ border: `1px solid ${borderColor}`,
714
+ backgroundColor: "transparent",
715
+ color: isDirty ? newtone.srgbToHex(tokens.textPrimary.srgb) : newtone.srgbToHex(tokens.textSecondary.srgb),
716
+ fontSize: 13,
717
+ cursor: isDirty ? "pointer" : "not-allowed",
718
+ opacity: isDirty ? 1 : 0.5
719
+ },
720
+ children: "Revert Changes"
721
+ }
722
+ )
723
+ }
724
+ )
725
+ ]
726
+ }
727
+ );
728
+ }
642
729
  function PresetSelector({
643
730
  presets,
644
731
  activePresetId,
@@ -1042,118 +1129,6 @@ function PresetSelector({
1042
1129
  )
1043
1130
  ] });
1044
1131
  }
1045
- var SIDEBAR_WIDTH2 = 360;
1046
- function Sidebar({
1047
- isDirty,
1048
- onRevert,
1049
- presets,
1050
- activePresetId,
1051
- publishedPresetId,
1052
- onSwitchPreset,
1053
- onCreatePreset,
1054
- onRenamePreset,
1055
- onDeletePreset,
1056
- onDuplicatePreset
1057
- }) {
1058
- const tokens = components.useTokens();
1059
- const borderColor = newtone.srgbToHex(tokens.border.srgb);
1060
- const bgColor = newtone.srgbToHex(tokens.background.srgb);
1061
- return /* @__PURE__ */ jsxRuntime.jsxs(
1062
- "div",
1063
- {
1064
- style: {
1065
- width: SIDEBAR_WIDTH2,
1066
- flexShrink: 0,
1067
- display: "flex",
1068
- flexDirection: "column",
1069
- height: "100vh",
1070
- borderLeft: `1px solid ${borderColor}`,
1071
- backgroundColor: bgColor
1072
- },
1073
- children: [
1074
- /* @__PURE__ */ jsxRuntime.jsxs(
1075
- "div",
1076
- {
1077
- style: {
1078
- flexShrink: 0,
1079
- padding: "16px 20px",
1080
- borderBottom: `1px solid ${borderColor}`,
1081
- display: "flex",
1082
- alignItems: "center",
1083
- justifyContent: "space-between"
1084
- },
1085
- children: [
1086
- /* @__PURE__ */ jsxRuntime.jsx(
1087
- "span",
1088
- {
1089
- style: {
1090
- fontSize: 16,
1091
- fontWeight: 700,
1092
- color: newtone.srgbToHex(tokens.textPrimary.srgb)
1093
- },
1094
- children: "newtone"
1095
- }
1096
- ),
1097
- /* @__PURE__ */ jsxRuntime.jsx(
1098
- PresetSelector,
1099
- {
1100
- presets,
1101
- activePresetId,
1102
- publishedPresetId,
1103
- onSwitchPreset,
1104
- onCreatePreset,
1105
- onRenamePreset,
1106
- onDeletePreset,
1107
- onDuplicatePreset
1108
- }
1109
- )
1110
- ]
1111
- }
1112
- ),
1113
- /* @__PURE__ */ jsxRuntime.jsx(
1114
- "div",
1115
- {
1116
- style: {
1117
- flex: 1,
1118
- overflowY: "auto",
1119
- overflowX: "hidden"
1120
- }
1121
- }
1122
- ),
1123
- /* @__PURE__ */ jsxRuntime.jsx(
1124
- "div",
1125
- {
1126
- style: {
1127
- flexShrink: 0,
1128
- padding: "12px 20px",
1129
- borderTop: `1px solid ${borderColor}`
1130
- },
1131
- children: /* @__PURE__ */ jsxRuntime.jsx(
1132
- "button",
1133
- {
1134
- disabled: !isDirty,
1135
- onClick: onRevert,
1136
- "aria-label": "Revert all changes to the last saved version",
1137
- style: {
1138
- width: "100%",
1139
- padding: "8px 16px",
1140
- borderRadius: 6,
1141
- border: `1px solid ${borderColor}`,
1142
- backgroundColor: "transparent",
1143
- color: isDirty ? newtone.srgbToHex(tokens.textPrimary.srgb) : newtone.srgbToHex(tokens.textSecondary.srgb),
1144
- fontSize: 13,
1145
- cursor: isDirty ? "pointer" : "not-allowed",
1146
- opacity: isDirty ? 1 : 0.5
1147
- },
1148
- children: "Revert Changes"
1149
- }
1150
- )
1151
- }
1152
- )
1153
- ]
1154
- }
1155
- );
1156
- }
1157
1132
  var STATUS_LABEL = {
1158
1133
  saved: "Saved",
1159
1134
  saving: "Saving...",
@@ -1166,7 +1141,15 @@ function EditorHeader({
1166
1141
  publishing,
1167
1142
  onPublish,
1168
1143
  onRetry,
1169
- headerSlots
1144
+ headerSlots,
1145
+ presets,
1146
+ activePresetId,
1147
+ publishedPresetId,
1148
+ onSwitchPreset,
1149
+ onCreatePreset,
1150
+ onRenamePreset,
1151
+ onDeletePreset,
1152
+ onDuplicatePreset
1170
1153
  }) {
1171
1154
  const tokens = components.useTokens();
1172
1155
  const borderColor = newtone.srgbToHex(tokens.border.srgb);
@@ -1189,7 +1172,22 @@ function EditorHeader({
1189
1172
  flexShrink: 0
1190
1173
  },
1191
1174
  children: [
1192
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", alignItems: "center", gap: 16 }, children: headerSlots?.left }),
1175
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 16 }, children: [
1176
+ headerSlots?.left,
1177
+ /* @__PURE__ */ jsxRuntime.jsx(
1178
+ PresetSelector,
1179
+ {
1180
+ presets,
1181
+ activePresetId,
1182
+ publishedPresetId,
1183
+ onSwitchPreset,
1184
+ onCreatePreset,
1185
+ onRenamePreset,
1186
+ onDeletePreset,
1187
+ onDuplicatePreset
1188
+ }
1189
+ )
1190
+ ] }),
1193
1191
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
1194
1192
  /* @__PURE__ */ jsxRuntime.jsx(
1195
1193
  "span",
@@ -1221,7 +1219,7 @@ function EditorHeader({
1221
1219
  );
1222
1220
  }
1223
1221
  var NAV_WIDTH = 60;
1224
- function PrimaryNav({ activeSectionId, onSelectSection }) {
1222
+ function PrimaryNav({ activeSectionId, onSelectSection, footer }) {
1225
1223
  const tokens = components.useTokens();
1226
1224
  const [hoveredId, setHoveredId] = react.useState(null);
1227
1225
  const bg = newtone.srgbToHex(tokens.background.srgb);
@@ -1229,7 +1227,7 @@ function PrimaryNav({ activeSectionId, onSelectSection }) {
1229
1227
  const activeBg = newtone.srgbToHex(tokens.backgroundInteractive.srgb);
1230
1228
  const iconColor = newtone.srgbToHex(tokens.textSecondary.srgb);
1231
1229
  const activeIconColor = newtone.srgbToHex(tokens.textPrimary.srgb);
1232
- return /* @__PURE__ */ jsxRuntime.jsx(
1230
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1233
1231
  "nav",
1234
1232
  {
1235
1233
  "aria-label": "Section navigation",
@@ -1244,41 +1242,44 @@ function PrimaryNav({ activeSectionId, onSelectSection }) {
1244
1242
  backgroundColor: bg,
1245
1243
  borderRight: `1px solid ${borderColor}`
1246
1244
  },
1247
- children: components.CATEGORIES.map((category) => {
1248
- const isActive = activeSectionId === category.id;
1249
- const isHovered = hoveredId === category.id;
1250
- return /* @__PURE__ */ jsxRuntime.jsx(
1251
- "button",
1252
- {
1253
- onClick: () => onSelectSection(category.id),
1254
- onMouseEnter: () => setHoveredId(category.id),
1255
- onMouseLeave: () => setHoveredId(null),
1256
- title: category.name,
1257
- "aria-current": isActive ? "page" : void 0,
1258
- style: {
1259
- display: "flex",
1260
- alignItems: "center",
1261
- justifyContent: "center",
1262
- width: 44,
1263
- height: 44,
1264
- borderRadius: 12,
1265
- border: "none",
1266
- backgroundColor: isActive ? activeBg : isHovered ? `${borderColor}20` : "transparent",
1267
- cursor: "pointer",
1268
- transition: "background-color 150ms"
1245
+ children: [
1246
+ components.CATEGORIES.map((category) => {
1247
+ const isActive = activeSectionId === category.id;
1248
+ const isHovered = hoveredId === category.id;
1249
+ return /* @__PURE__ */ jsxRuntime.jsx(
1250
+ "button",
1251
+ {
1252
+ onClick: () => onSelectSection(category.id),
1253
+ onMouseEnter: () => setHoveredId(category.id),
1254
+ onMouseLeave: () => setHoveredId(null),
1255
+ title: category.name,
1256
+ "aria-current": isActive ? "page" : void 0,
1257
+ style: {
1258
+ display: "flex",
1259
+ alignItems: "center",
1260
+ justifyContent: "center",
1261
+ width: 44,
1262
+ height: 44,
1263
+ borderRadius: 12,
1264
+ border: "none",
1265
+ backgroundColor: isActive ? activeBg : isHovered ? `${borderColor}20` : "transparent",
1266
+ cursor: "pointer",
1267
+ transition: "background-color 150ms"
1268
+ },
1269
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1270
+ components.Icon,
1271
+ {
1272
+ name: category.icon ?? "circle",
1273
+ size: 24,
1274
+ color: isActive ? activeIconColor : iconColor
1275
+ }
1276
+ )
1269
1277
  },
1270
- children: /* @__PURE__ */ jsxRuntime.jsx(
1271
- components.Icon,
1272
- {
1273
- name: category.icon ?? "circle",
1274
- size: 24,
1275
- color: isActive ? activeIconColor : iconColor
1276
- }
1277
- )
1278
- },
1279
- category.id
1280
- );
1281
- })
1278
+ category.id
1279
+ );
1280
+ }),
1281
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginTop: "auto", paddingBottom: 12 }, children: footer })
1282
+ ]
1282
1283
  }
1283
1284
  );
1284
1285
  }
@@ -2588,7 +2589,7 @@ function OthersSection({ state, dispatch }) {
2588
2589
  ] })
2589
2590
  ] });
2590
2591
  }
2591
- var PANEL_WIDTH = 280;
2592
+ var PANEL_WIDTH = 360;
2592
2593
  function ConfiguratorPanel({
2593
2594
  activeSectionId,
2594
2595
  state,
@@ -2635,7 +2636,7 @@ function ConfiguratorPanel({
2635
2636
  }
2636
2637
  );
2637
2638
  }
2638
- var TOC_WIDTH = 220;
2639
+ var TOC_WIDTH = 360;
2639
2640
  function TableOfContents({
2640
2641
  activeSectionId,
2641
2642
  activeView,
@@ -3570,7 +3571,7 @@ function ComponentDetailView({
3570
3571
  scopeFontMap
3571
3572
  }) {
3572
3573
  const tokens = components.useTokens();
3573
- const { config } = components.useNewtoneTheme();
3574
+ const { config, mode } = components.useNewtoneTheme();
3574
3575
  const component = components.getComponent(componentId);
3575
3576
  const [hoveredId, setHoveredId] = react.useState(null);
3576
3577
  const [previewBreakpoint, setPreviewBreakpoint] = react.useState("lg");
@@ -3713,7 +3714,7 @@ function ComponentDetailView({
3713
3714
  );
3714
3715
  }) })
3715
3716
  ] }),
3716
- component.previewLayout === "list" ? /* @__PURE__ */ jsxRuntime.jsx(components.NewtoneProvider, { config: scaledConfig, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: component.variants.map((variant) => {
3717
+ component.previewLayout === "list" ? /* @__PURE__ */ jsxRuntime.jsx(components.NewtoneProvider, { config: scaledConfig, initialMode: mode, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: component.variants.map((variant) => {
3717
3718
  const isSelected = selectedVariantId === variant.id;
3718
3719
  const isHovered = hoveredId === variant.id;
3719
3720
  const borderColor = isSelected ? interactiveColor : isHovered ? `${interactiveColor}66` : newtone.srgbToHex(tokens.border.srgb);
@@ -3806,7 +3807,7 @@ function ComponentDetailView({
3806
3807
  },
3807
3808
  variant.id
3808
3809
  );
3809
- }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(
3810
+ }) }) }, mode) : /* @__PURE__ */ jsxRuntime.jsx(
3810
3811
  "div",
3811
3812
  {
3812
3813
  style: {
@@ -4446,6 +4447,7 @@ function Editor({
4446
4447
  chromeThemeConfig,
4447
4448
  persistence,
4448
4449
  headerSlots,
4450
+ navFooter,
4449
4451
  onNavigate,
4450
4452
  initialPreviewView,
4451
4453
  manifestUrl,
@@ -4491,15 +4493,7 @@ function Editor({
4491
4493
  Sidebar,
4492
4494
  {
4493
4495
  isDirty: editor.isDirty,
4494
- onRevert: editor.handleRevert,
4495
- presets: editor.presets,
4496
- activePresetId: editor.activePresetId,
4497
- publishedPresetId: editor.publishedPresetId,
4498
- onSwitchPreset: editor.switchPreset,
4499
- onCreatePreset: editor.createPreset,
4500
- onRenamePreset: editor.renamePreset,
4501
- onDeletePreset: editor.deletePreset,
4502
- onDuplicatePreset: editor.duplicatePreset
4496
+ onRevert: editor.handleRevert
4503
4497
  }
4504
4498
  ),
4505
4499
  navbar: /* @__PURE__ */ jsxRuntime.jsx(
@@ -4510,7 +4504,15 @@ function Editor({
4510
4504
  publishing: editor.publishing,
4511
4505
  onPublish: editor.handlePublish,
4512
4506
  onRetry: () => editor.saveDraft(editor.latestStateRef.current),
4513
- headerSlots
4507
+ headerSlots,
4508
+ presets: editor.presets,
4509
+ activePresetId: editor.activePresetId,
4510
+ publishedPresetId: editor.publishedPresetId,
4511
+ onSwitchPreset: editor.switchPreset,
4512
+ onCreatePreset: editor.createPreset,
4513
+ onRenamePreset: editor.renamePreset,
4514
+ onDeletePreset: editor.deletePreset,
4515
+ onDuplicatePreset: editor.duplicatePreset
4514
4516
  }
4515
4517
  ),
4516
4518
  content: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -4527,7 +4529,8 @@ function Editor({
4527
4529
  PrimaryNav,
4528
4530
  {
4529
4531
  activeSectionId: editor.activeSectionId,
4530
- onSelectSection: editor.handleSectionChange
4532
+ onSelectSection: editor.handleSectionChange,
4533
+ footer: navFooter
4531
4534
  }
4532
4535
  ),
4533
4536
  editor.activeSectionId === "components" ? /* @__PURE__ */ jsxRuntime.jsx(