@conloca/cms-spa 0.1.9 → 0.1.10

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,2 +1,26 @@
1
- import { i as useDataSchemas, n as getDataSchemas, r as setDataSchemas, t as DataSchemas } from "./data-schemas-UmAbPP4d.mjs";
2
- export { DataSchemas, getDataSchemas, setDataSchemas, useDataSchemas };
1
+ import { z } from "zod";
2
+
3
+ //#region src/data-schemas.d.ts
4
+ /**
5
+ * Type for a collection of data schemas.
6
+ * Each key is a collection name, value is the Zod schema for that collection's data.
7
+ */
8
+ type DataSchemas = Record<string, z.ZodObject<z.ZodRawShape>>;
9
+ /**
10
+ * Set the data schemas for all collections.
11
+ * Called by the virtual module that loads user's schema definitions.
12
+ * Notifies all subscribers of the change (enables HMR).
13
+ */
14
+ declare function setDataSchemas(schemas: DataSchemas): void;
15
+ /**
16
+ * Get the current data schemas synchronously.
17
+ */
18
+ declare function getDataSchemas(): DataSchemas;
19
+ /**
20
+ * React hook to subscribe to data schema changes.
21
+ * Returns the current schemas and updates when they change (HMR support).
22
+ */
23
+ declare function useDataSchemas(): DataSchemas;
24
+ //#endregion
25
+ export { DataSchemas, getDataSchemas, setDataSchemas, useDataSchemas };
26
+ //# sourceMappingURL=data-schemas.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-schemas.d.mts","names":[],"sources":["../src/data-schemas.ts"],"mappings":";;;;;AAOA;;KAAY,WAAA,GAAc,MAAA,SAAe,CAAA,CAAE,SAAA,CAAU,CAAA,CAAE,WAAA;;;;;;iBA+BvC,cAAA,CAAe,OAAA,EAAS,WAAA;;;;iBASxB,cAAA,CAAA,GAAkB,WAAA;;;AATlC;;iBAiBgB,cAAA,CAAA,GAAkB,WAAA"}
@@ -1,3 +1,52 @@
1
- import { n as setDataSchemas, r as useDataSchemas, t as getDataSchemas } from "./data-schemas-BfLnirHs.mjs";
1
+ import { useEffect, useState } from "react";
2
2
 
3
- export { getDataSchemas, setDataSchemas, useDataSchemas };
3
+ //#region src/data-schemas.ts
4
+ const getSharedState = () => {
5
+ if (typeof window !== "undefined") {
6
+ if (!window.__DATA_SCHEMAS_STATE__) window.__DATA_SCHEMAS_STATE__ = {
7
+ schemas: {},
8
+ subscribers: /* @__PURE__ */ new Set()
9
+ };
10
+ return window.__DATA_SCHEMAS_STATE__;
11
+ }
12
+ return {
13
+ schemas: {},
14
+ subscribers: /* @__PURE__ */ new Set()
15
+ };
16
+ };
17
+ /**
18
+ * Set the data schemas for all collections.
19
+ * Called by the virtual module that loads user's schema definitions.
20
+ * Notifies all subscribers of the change (enables HMR).
21
+ */
22
+ function setDataSchemas(schemas) {
23
+ const state = getSharedState();
24
+ state.schemas = schemas;
25
+ state.subscribers.forEach((fn) => fn(schemas));
26
+ }
27
+ /**
28
+ * Get the current data schemas synchronously.
29
+ */
30
+ function getDataSchemas() {
31
+ return getSharedState().schemas;
32
+ }
33
+ /**
34
+ * React hook to subscribe to data schema changes.
35
+ * Returns the current schemas and updates when they change (HMR support).
36
+ */
37
+ function useDataSchemas() {
38
+ const [schemas, setSchemas] = useState(() => getSharedState().schemas);
39
+ useEffect(() => {
40
+ const state = getSharedState();
41
+ if (state.schemas !== schemas) setSchemas(state.schemas);
42
+ state.subscribers.add(setSchemas);
43
+ return () => {
44
+ state.subscribers.delete(setSchemas);
45
+ };
46
+ }, []);
47
+ return schemas;
48
+ }
49
+
50
+ //#endregion
51
+ export { getDataSchemas, setDataSchemas, useDataSchemas };
52
+ //# sourceMappingURL=data-schemas.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-schemas.mjs","names":[],"sources":["../src/data-schemas.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport type { z } from 'zod';\n\n/**\n * Type for a collection of data schemas.\n * Each key is a collection name, value is the Zod schema for that collection's data.\n */\nexport type DataSchemas = Record<string, z.ZodObject<z.ZodRawShape>>;\n\n/**\n * Shared state for data schemas across module instances.\n * Uses window to ensure virtual modules and bundled code share the same state.\n */\n\ninterface SharedDataState {\n schemas: DataSchemas;\n subscribers: Set<(schemas: DataSchemas) => void>;\n}\n\nconst getSharedState = (): SharedDataState => {\n if (typeof window !== 'undefined') {\n if (!(window as any).__DATA_SCHEMAS_STATE__) {\n (window as any).__DATA_SCHEMAS_STATE__ = {\n schemas: {},\n subscribers: new Set(),\n };\n }\n return (window as any).__DATA_SCHEMAS_STATE__;\n }\n // SSR fallback\n return { schemas: {}, subscribers: new Set() };\n};\n\n/**\n * Set the data schemas for all collections.\n * Called by the virtual module that loads user's schema definitions.\n * Notifies all subscribers of the change (enables HMR).\n */\nexport function setDataSchemas(schemas: DataSchemas): void {\n const state = getSharedState();\n state.schemas = schemas;\n state.subscribers.forEach((fn) => fn(schemas));\n}\n\n/**\n * Get the current data schemas synchronously.\n */\nexport function getDataSchemas(): DataSchemas {\n return getSharedState().schemas;\n}\n\n/**\n * React hook to subscribe to data schema changes.\n * Returns the current schemas and updates when they change (HMR support).\n */\nexport function useDataSchemas(): DataSchemas {\n const [schemas, setSchemas] = useState(() => getSharedState().schemas);\n\n useEffect(() => {\n const state = getSharedState();\n\n // Update immediately in case schemas changed between render and effect\n if (state.schemas !== schemas) {\n setSchemas(state.schemas);\n }\n\n state.subscribers.add(setSchemas);\n return () => {\n state.subscribers.delete(setSchemas);\n };\n }, []);\n\n return schemas;\n}\n"],"mappings":";;;AAmBA,MAAM,uBAAwC;AAC5C,KAAI,OAAO,WAAW,aAAa;AACjC,MAAI,CAAE,OAAe,uBACnB,CAAC,OAAe,yBAAyB;GACvC,SAAS,EAAE;GACX,6BAAa,IAAI,KAAK;GACvB;AAEH,SAAQ,OAAe;;AAGzB,QAAO;EAAE,SAAS,EAAE;EAAE,6BAAa,IAAI,KAAK;EAAE;;;;;;;AAQhD,SAAgB,eAAe,SAA4B;CACzD,MAAM,QAAQ,gBAAgB;AAC9B,OAAM,UAAU;AAChB,OAAM,YAAY,SAAS,OAAO,GAAG,QAAQ,CAAC;;;;;AAMhD,SAAgB,iBAA8B;AAC5C,QAAO,gBAAgB,CAAC;;;;;;AAO1B,SAAgB,iBAA8B;CAC5C,MAAM,CAAC,SAAS,cAAc,eAAe,gBAAgB,CAAC,QAAQ;AAEtE,iBAAgB;EACd,MAAM,QAAQ,gBAAgB;AAG9B,MAAI,MAAM,YAAY,QACpB,YAAW,MAAM,QAAQ;AAG3B,QAAM,YAAY,IAAI,WAAW;AACjC,eAAa;AACX,SAAM,YAAY,OAAO,WAAW;;IAErC,EAAE,CAAC;AAEN,QAAO"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as setDataSchemas, t as DataSchemas } from "./data-schemas-UmAbPP4d.mjs";
1
+ import { DataSchemas, setDataSchemas } from "./data-schemas.mjs";
2
2
  import "@mdxeditor/editor";
3
3
  import React from "react";
4
4
  import "@mdxeditor/editor/style.css";
@@ -7,7 +7,6 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
7
7
  import { QueryClientConfig, QueryClientConfig as QueryClientConfig$1 } from "@tanstack/react-query";
8
8
 
9
9
  //#region src/components/editor/CMSMDXEditor.d.ts
10
-
11
10
  interface CMSMDXEditorModalProps {
12
11
  isOpen: boolean;
13
12
  onClose: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/components/editor/CMSMDXEditor.tsx","../src/components/media/FolderTreeSidebar.tsx","../src/components/media/MediaToolbar.tsx","../src/components/media/MediaLibrary.tsx","../src/components/media/UploadModal.tsx","../src/components/puck/MDXContent.tsx","../src/ui-config.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;ACMU,UDiPO,sBAAA,CCjPe;EAkDhB,MAAA,EAAA,OAAA;EAAoB,OAAA,EAAA,GAAA,GAAA,IAAA;EAAe,QAAA,CAAA,EAAA,MAAA;EAAgB,cAAA,EAAA,MAAA;EAAoB,MAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,GAAA,IAAA,GDoMjD,OCpMiD,CAAA,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;;UCzIhC,cAAA;;;;;;UAOA,QAAA;;EN8OA,UAAA,CAAA,EAAA,MAAA;EAcJ,WAAA,CAAA,EAAA,MAsGZ;;uBM7VsB;;ELRb,WAAA,CAAA,EAAA,MAAA;EAkDM;EAAoB,WAAA,CAAA,EAAA,MAAA;EAAe;EAAgB,SAAA,CAAA,EKpCrD,MLoCqD,CAAA,MAAA,EKpCtC,cLoCsC,CAAA;;AAA0C,iBKhB7F,WAAA,CLgB6F,OAAA,EKhBxE,OLgBwE,CKhBhE,QLgBgE,CAAA,CAAA,EAAA,IAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/components/editor/CMSMDXEditor.tsx","../src/components/media/FolderTreeSidebar.tsx","../src/components/media/MediaToolbar.tsx","../src/components/media/MediaLibrary.tsx","../src/components/media/UploadModal.tsx","../src/components/puck/MDXContent.tsx","../src/ui-config.ts"],"mappings":";;;;;;;;;UAuPiB,sBAAA;EACf,MAAA;EACA,OAAA;EACA,QAAA;EACA,cAAA;EACA,MAAA,GAAS,OAAA,oBAA2B,OAAA;EACpC,WAAA,GAAc,KAAA,CAAM,SAAA;EACpB,aAAA;AAAA;;;;AAOF;cAAa,iBAAA,EAAmB,KAAA,CAAM,EAAA,CAAG,sBAAA;;;UC/P/B,sBAAA;EACR,aAAA;EACA,cAAA,GAAiB,IAAA;;EAEjB,gBAAA;AAAA;AAAA,iBA8Cc,iBAAA,CAAA;EAAoB,aAAA;EAAe,cAAA;EAAgB;AAAA,GAAoB,sBAAA,GAAsB,kBAAA,CAAA,GAAA,CAAA,OAAA;;;KCtDjG,cAAA;AAAA,KACA,UAAA;;;UCIF,iBAAA;;EAER,MAAA;;EAEA,cAAA,IAAkB,IAAA;;EAElB,WAAA;EH0Oe;EGxOf,IAAA;;EAEA,cAAA;EHuOA;EGrOA,cAAA,GAAiB,GAAA;EHuOjB;EGrOA,cAAA,IAAkB,QAAA;EHuOlB;EGrOA,YAAA,IAAgB,KAAA,EAAO,UAAA;EHqOa;E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MDXContent } from "./puck-C-2dQ-Od.mjs";
2
- import { n as setDataSchemas } from "./data-schemas-BfLnirHs.mjs";
1
+ import { a as MediaLibrary, c as FolderTreeSidebar, h as configureUI, i as UploadModal, n as CMSMDXEditorModal, t as MDXContent } from "./puck-DyXDFCcg.mjs";
2
+ import { setDataSchemas } from "./data-schemas.mjs";
3
3
 
4
4
  export { CMSMDXEditorModal, FolderTreeSidebar, MDXContent, MediaLibrary, UploadModal, configureUI, setDataSchemas };
package/dist/main.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { _ as useDialogState, a as MediaLibrary, c as cn$1, d as useMoveAssets, f as useUpdateAssetMetadata, g as useErrorModal, h as getUIConfig, i as UploadModal, l as useAssetUsage, n as CMSMDXEditorModal, o as MediaToolbar, p as useSiteBaseUrl, r as ImagePicker, s as FolderTreeSidebar, t as MDXContent, u as useFolderTree$1, v as useClickOutside, y as useDeleteAsset } from "./puck-C-2dQ-Od.mjs";
2
- import { r as useDataSchemas } from "./data-schemas-BfLnirHs.mjs";
3
- import { r as usePageSchemas } from "./page-schemas-CyCRM6JQ.mjs";
4
- import { r as usePuckConfig } from "./puck-config-DEUM5skt.mjs";
1
+ import { _ as useErrorModal, a as MediaLibrary, b as useDeleteAsset, c as FolderTreeSidebar, d as useFolderTree$1, f as useMoveAssets, g as getUIConfig, i as UploadModal, l as cn$1, m as useSiteBaseUrl, n as CMSMDXEditorModal, o as MediaToolbar, p as useUpdateAssetMetadata, r as ImagePicker, s as buildAssetServeUrl, t as MDXContent, u as useAssetUsage, v as useDialogState, y as useClickOutside } from "./puck-DyXDFCcg.mjs";
2
+ import { useDataSchemas } from "./data-schemas.mjs";
3
+ import { usePageSchemas } from "./page-schemas.mjs";
4
+ import { usePuckConfig } from "./puck-config.mjs";
5
5
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { AlertCircle, AlertTriangle, ArrowDownToLine, ArrowRight, Check, ChevronDown, Clock, Code, Code2, Database, Edit, Edit2, ExternalLink, Eye, FileEdit, FileJson, FileText, Folder, FolderInput, FolderOpen, GitBranch, Image, ImageIcon, LayoutDashboard, Loader2, Monitor, MoreVertical, Package, Plus, Save, Settings, Smartphone, Tablet, Trash2, Upload, User, X } from "lucide-react";
7
7
  import { ContentAPIClient, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
@@ -12,7 +12,7 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
12
12
  import { createRoot } from "react-dom/client";
13
13
  import { BrowserRouter, Link, NavLink, Outlet, Route, Routes, useNavigate, useParams } from "react-router-dom";
14
14
  import * as Select from "@radix-ui/react-select";
15
- import { Puck, resolveAllData, useGetPuck } from "@measured/puck";
15
+ import { Puck, resolveAllData, useGetPuck } from "@puckeditor/core";
16
16
  import * as Dialog from "@radix-ui/react-dialog";
17
17
  import { z } from "zod";
18
18
  import { blockEditableSchema, dataEditableSchema, formatFileSize } from "@conloca/content-api";
@@ -422,9 +422,9 @@ function BlockEditor() {
422
422
  currentContentRef.current = newContent;
423
423
  } else if (result.reason === "stale_write") throw new Error("Content was modified by another user. Please reload and try again.");
424
424
  else throw new Error(`Save failed: ${result.reason}`);
425
- } catch (error$1) {
426
- console.error("Failed to save block:", error$1);
427
- throw error$1;
425
+ } catch (error) {
426
+ console.error("Failed to save block:", error);
427
+ throw error;
428
428
  }
429
429
  };
430
430
  const handleLocaleChange = async (newLocale) => {
@@ -448,8 +448,8 @@ function BlockEditor() {
448
448
  }
449
449
  setCurrentLocale(newLocale);
450
450
  setPendingLocaleSwitch(null);
451
- } catch (error$1) {
452
- console.error("Failed to switch locale:", error$1);
451
+ } catch (error) {
452
+ console.error("Failed to switch locale:", error);
453
453
  }
454
454
  };
455
455
  const handleUnsavedDialogSave = async () => {
@@ -458,8 +458,8 @@ function BlockEditor() {
458
458
  await handleSave(currentContentRef.current);
459
459
  setShowUnsavedDialog(false);
460
460
  await switchLocale(pendingLocaleSwitch);
461
- } catch (error$1) {
462
- console.error("Failed to save before locale switch:", error$1);
461
+ } catch (error) {
462
+ console.error("Failed to save before locale switch:", error);
463
463
  }
464
464
  };
465
465
  const handleUnsavedDialogDiscard = async () => {
@@ -538,14 +538,14 @@ function getZodFieldInfo(field) {
538
538
  let isNullable = false;
539
539
  let description;
540
540
  while (current._def) {
541
- const typeName$1 = getZodTypeName(current._def);
542
- if (typeName$1 === "ZodOptional" || typeName$1 === "optional") {
541
+ const typeName = getZodTypeName(current._def);
542
+ if (typeName === "ZodOptional" || typeName === "optional") {
543
543
  isOptional = true;
544
544
  current = current._def.innerType;
545
- } else if (typeName$1 === "ZodNullable" || typeName$1 === "nullable") {
545
+ } else if (typeName === "ZodNullable" || typeName === "nullable") {
546
546
  isNullable = true;
547
547
  current = current._def.innerType;
548
- } else if (typeName$1 === "ZodDefault" || typeName$1 === "default") current = current._def.innerType;
548
+ } else if (typeName === "ZodDefault" || typeName === "default") current = current._def.innerType;
549
549
  else break;
550
550
  }
551
551
  description = current._def.description;
@@ -918,7 +918,6 @@ function SchemaField({ name, fieldInfo, value, onChange }) {
918
918
  children: description
919
919
  })
920
920
  ] });
921
- case "string":
922
921
  default:
923
922
  if (name.toLowerCase().includes("image") && !name.toLowerCase().includes("description")) return /* @__PURE__ */ jsxs("div", { children: [
924
923
  /* @__PURE__ */ jsxs("label", {
@@ -1771,7 +1770,7 @@ const drawerItemOverride = ({ children, name }) => /* @__PURE__ */ jsx(DrawerIte
1771
1770
  name,
1772
1771
  children
1773
1772
  });
1774
- function PageEditor({ pageId, entry, config: config$1, metadata, availableLocales, onSave, onBack, onOpenMetadata, onLocaleChange, onReload, onPublish }) {
1773
+ function PageEditor({ pageId, entry, config, metadata, availableLocales, onSave, onBack, onOpenMetadata, onLocaleChange, onReload, onPublish }) {
1775
1774
  const [data, setData] = useState(entry.localized.content.puckData);
1776
1775
  const [saveState, setSaveState] = useState("idle");
1777
1776
  const [isDirty, setIsDirty] = useState(false);
@@ -1862,7 +1861,7 @@ function PageEditor({ pageId, entry, config: config$1, metadata, availableLocale
1862
1861
  children: [/* @__PURE__ */ jsx("div", {
1863
1862
  className: "flex-1 overflow-auto min-h-0",
1864
1863
  children: /* @__PURE__ */ jsx(Puck, {
1865
- config: config$1,
1864
+ config,
1866
1865
  data,
1867
1866
  metadata,
1868
1867
  onChange: handleDataChange,
@@ -1898,10 +1897,10 @@ function PageEditor({ pageId, entry, config: config$1, metadata, availableLocale
1898
1897
  * When loading, we need to merge defaultProps so field UI shows correct values.
1899
1898
  * Without this, select/radio fields show wrong defaults (first option instead of actual default).
1900
1899
  */
1901
- function mergeDefaultProps(data, config$1) {
1902
- if (!data?.content || !config$1?.components) return data;
1900
+ function mergeDefaultProps(data, config) {
1901
+ if (!data?.content || !config?.components) return data;
1903
1902
  const mergeComponentProps = (item) => {
1904
- const componentConfig = config$1.components[item.type];
1903
+ const componentConfig = config.components[item.type];
1905
1904
  if (!componentConfig?.defaultProps) return item;
1906
1905
  return {
1907
1906
  ...item,
@@ -2061,12 +2060,12 @@ function PageEditorWrapper({ puckConfig }) {
2061
2060
  setCurrentEtag(result.etag);
2062
2061
  }
2063
2062
  return result;
2064
- } catch (error$1) {
2065
- console.error("Failed to save page:", error$1);
2063
+ } catch (error) {
2064
+ console.error("Failed to save page:", error);
2066
2065
  return {
2067
2066
  success: false,
2068
2067
  reason: "write_error",
2069
- error: error$1
2068
+ error
2070
2069
  };
2071
2070
  }
2072
2071
  },
@@ -2127,8 +2126,8 @@ function PageEditorWrapper({ puckConfig }) {
2127
2126
  console.log("Metadata saved successfully");
2128
2127
  setCurrentEtag(result.etag);
2129
2128
  }
2130
- } catch (error$1) {
2131
- console.error("Failed to save metadata:", error$1);
2129
+ } catch (error) {
2130
+ console.error("Failed to save metadata:", error);
2132
2131
  }
2133
2132
  }
2134
2133
  })] });
@@ -2517,9 +2516,9 @@ function BlockList() {
2517
2516
  if (errorMessage.includes("modified")) showStaleWriteError(result.error);
2518
2517
  else showError(errorMessage, result.error);
2519
2518
  }
2520
- } catch (error$1) {
2519
+ } catch (error) {
2521
2520
  closeDeleteDialog();
2522
- showError("Failed to delete block. Please try again.", error$1);
2521
+ showError("Failed to delete block. Please try again.", error);
2523
2522
  }
2524
2523
  };
2525
2524
  const handleRenameBlock = (blockId) => {
@@ -2551,9 +2550,9 @@ function BlockList() {
2551
2550
  else if (errorMessage.includes("already taken")) showError("A block with this name already exists. Please choose a different name.", result.error);
2552
2551
  else showError(errorMessage, result.error);
2553
2552
  }
2554
- } catch (error$1) {
2553
+ } catch (error) {
2555
2554
  closeRenameDialog();
2556
- showError("Failed to rename block. Please try again.", error$1);
2555
+ showError("Failed to rename block. Please try again.", error);
2557
2556
  }
2558
2557
  };
2559
2558
  const handleEditProperties = (blockId) => {
@@ -2588,9 +2587,9 @@ function BlockList() {
2588
2587
  if (errorMessage.includes("modified") || result.reason === "stale_write") showStaleWriteError(result.error);
2589
2588
  else showError(errorMessage, result.error);
2590
2589
  }
2591
- } catch (error$1) {
2590
+ } catch (error) {
2592
2591
  closePropertiesDialog();
2593
- showError("Failed to save properties. Please try again.", error$1);
2592
+ showError("Failed to save properties. Please try again.", error);
2594
2593
  }
2595
2594
  };
2596
2595
  return /* @__PURE__ */ jsxs("div", {
@@ -2903,9 +2902,9 @@ function DataEntryCard({ id, title, description, collection, name, locales, onEd
2903
2902
  const [isMenuOpen, setIsMenuOpen] = useState(false);
2904
2903
  const menuRef = useRef(null);
2905
2904
  useClickOutside(menuRef, useCallback(() => setIsMenuOpen(false), []), isMenuOpen);
2906
- const config$1 = getUIConfig();
2905
+ const config = getUIConfig();
2907
2906
  const firstLocale = locales[0] || "en";
2908
- const editorLink = config$1.projectRoot && name ? getEditorLink(config$1.projectRoot, collection, name, firstLocale) : null;
2907
+ const editorLink = config.projectRoot && name ? getEditorLink(config.projectRoot, collection, name, firstLocale) : null;
2909
2908
  return /* @__PURE__ */ jsxs("div", {
2910
2909
  className: "bg-white border border-grey-09 rounded p-4 hover:border-azure-04 transition-colors",
2911
2910
  children: [
@@ -3198,8 +3197,8 @@ function DataEditor({ id, collection, initialLocale, existingLocales, name, sche
3198
3197
  setCurrentLocale(newLocale);
3199
3198
  }
3200
3199
  setPendingLocaleSwitch(null);
3201
- } catch (error$1) {
3202
- console.error("Failed to switch locale:", error$1);
3200
+ } catch (error) {
3201
+ console.error("Failed to switch locale:", error);
3203
3202
  }
3204
3203
  };
3205
3204
  const handleUnsavedDialogSave = async () => {
@@ -3208,8 +3207,8 @@ function DataEditor({ id, collection, initialLocale, existingLocales, name, sche
3208
3207
  await handleSave();
3209
3208
  setShowUnsavedDialog(false);
3210
3209
  await switchLocale(pendingLocaleSwitch);
3211
- } catch (error$1) {
3212
- console.error("Failed to save before locale switch:", error$1);
3210
+ } catch (error) {
3211
+ console.error("Failed to save before locale switch:", error);
3213
3212
  }
3214
3213
  };
3215
3214
  const handleUnsavedDialogDiscard = async () => {
@@ -3333,8 +3332,8 @@ function getSchemasEditorLink(projectRoot, schemasPath) {
3333
3332
  function DataList({ dataSchemas }) {
3334
3333
  const [selectedCollection, setSelectedCollection] = useState("all");
3335
3334
  const [createDialog, openCreateDialog, closeCreateDialog] = useDialogState({});
3336
- const config$1 = getUIConfig();
3337
- const schemasEditorLink = config$1.projectRoot && config$1.schemasPath ? getSchemasEditorLink(config$1.projectRoot, config$1.schemasPath) : null;
3335
+ const config = getUIConfig();
3336
+ const schemasEditorLink = config.projectRoot && config.schemasPath ? getSchemasEditorLink(config.projectRoot, config.schemasPath) : null;
3338
3337
  const [deleteDialog, openDeleteDialog, closeDeleteDialog] = useDialogState({
3339
3338
  entryId: "",
3340
3339
  entryTitle: "",
@@ -4113,7 +4112,7 @@ function AssetDetailSidebar({ asset, onClose, onAssetUpdated, onAssetDeleted, as
4113
4112
  /* @__PURE__ */ jsx("div", {
4114
4113
  className: "aspect-square bg-grey-11 flex items-center justify-center overflow-hidden border-b border-grey-09",
4115
4114
  children: /* @__PURE__ */ jsx("img", {
4116
- src: `${assetsBasePath}/${asset.filename}`,
4115
+ src: buildAssetServeUrl(assetsBasePath, asset.folder, asset.filename),
4117
4116
  alt: asset.alt || asset.originalName,
4118
4117
  className: "max-w-full max-h-full object-contain"
4119
4118
  })
@@ -4594,20 +4593,20 @@ function PageList({ selectedSite, selectedLocale: initialLocale } = {}) {
4594
4593
  type: componentName,
4595
4594
  props: { id: `${componentName}-${Date.now()}-${Math.random().toString(36).slice(2, 7)}` }
4596
4595
  }];
4597
- const handleCreatePage = async (data$1) => {
4596
+ const handleCreatePage = async (data) => {
4598
4597
  try {
4599
- const templateConfig = getUIConfig().templates?.[data$1.template];
4600
- let finalPath = data$1.path;
4601
- if (templateConfig?.pathPrefix && !data$1.path.startsWith(templateConfig.pathPrefix)) finalPath = `${templateConfig.pathPrefix.endsWith("/") ? templateConfig.pathPrefix.slice(0, -1) : templateConfig.pathPrefix}${data$1.path.startsWith("/") ? data$1.path : "/" + data$1.path}`;
4598
+ const templateConfig = getUIConfig().templates?.[data.template];
4599
+ let finalPath = data.path;
4600
+ if (templateConfig?.pathPrefix && !data.path.startsWith(templateConfig.pathPrefix)) finalPath = `${templateConfig.pathPrefix.endsWith("/") ? templateConfig.pathPrefix.slice(0, -1) : templateConfig.pathPrefix}${data.path.startsWith("/") ? data.path : "/" + data.path}`;
4602
4601
  const templateContent = templateConfig?.component ? createTemplateContent(templateConfig.component) : [];
4603
4602
  const result = await createContent.mutateAsync({
4604
4603
  kind: "page",
4605
4604
  site: currentSite,
4606
4605
  collection: "pages",
4607
4606
  type: "puck",
4608
- meta: { title: data$1.title },
4609
- locales: { [data$1.locale]: {
4610
- meta: { title: data$1.title },
4607
+ meta: { title: data.title },
4608
+ locales: { [data.locale]: {
4609
+ meta: { title: data.title },
4611
4610
  pathname: finalPath,
4612
4611
  content: { puckData: {
4613
4612
  root: {},
@@ -4618,9 +4617,9 @@ function PageList({ selectedSite, selectedLocale: initialLocale } = {}) {
4618
4617
  });
4619
4618
  if (result.success && result.id) navigate(`/pages/${result.id}`);
4620
4619
  else throw new Error(`Failed to create page: ${result.reason}`);
4621
- } catch (error$1) {
4622
- console.error("Failed to create page:", error$1);
4623
- showError("Failed to create page. Please try again.", error$1);
4620
+ } catch (error) {
4621
+ console.error("Failed to create page:", error);
4622
+ showError("Failed to create page. Please try again.", error);
4624
4623
  }
4625
4624
  };
4626
4625
  const handleEditPage = (pageId, locale) => {
@@ -4674,8 +4673,8 @@ function PageList({ selectedSite, selectedLocale: initialLocale } = {}) {
4674
4673
  });
4675
4674
  showError(errorMessage, result.error);
4676
4675
  }
4677
- } catch (error$1) {
4678
- console.error("Failed to delete page:", error$1);
4676
+ } catch (error) {
4677
+ console.error("Failed to delete page:", error);
4679
4678
  setDeleteDialog({
4680
4679
  isOpen: false,
4681
4680
  pageId: "",
@@ -4684,7 +4683,7 @@ function PageList({ selectedSite, selectedLocale: initialLocale } = {}) {
4684
4683
  etag: "",
4685
4684
  hasMultipleLocales: false
4686
4685
  });
4687
- showError("Failed to delete page. Please try again.", error$1);
4686
+ showError("Failed to delete page. Please try again.", error);
4688
4687
  }
4689
4688
  };
4690
4689
  return /* @__PURE__ */ jsxs("div", {