@conloca/cms-spa 0.1.13 → 0.1.14
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/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/main.mjs +65 -25
- package/dist/main.mjs.map +1 -1
- package/dist/{puck-DjVdP1zb.mjs → puck-CvjeYQRH.mjs} +193 -176
- package/dist/puck-CvjeYQRH.mjs.map +1 -0
- package/dist/spa/main.css +50 -0
- package/package.json +5 -5
- package/dist/puck-DjVdP1zb.mjs.map +0 -1
package/dist/index.d.mts.map
CHANGED
|
@@ -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"],"mappings":";;;;;;;;;
|
|
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":";;;;;;;;;UAgQiB,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;;;UCxQ/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,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BAAA;ENmPrB;EMjPA,WAAA;ENmPA;EMjPA,WAAA;ENmPA;EMjPA,SAAA,GAAY,MAAA,SAAe,cAAA;AAAA;AAAA,iBAoBb,WAAA,CAAY,OAAA,EAAS,OAAA,CAAQ,QAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as configureUI, a as MediaLibrary, c as FolderTreeSidebar, i as UploadModal, n as CMSMDXEditorModal, t as MDXContent } from "./puck-CvjeYQRH.mjs";
|
|
2
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,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as MediaLibrary, b as useDialogState, c as FolderTreeSidebar, d as useBulkDeleteAssets, f as useDeleteAsset, g as useSiteBaseUrl, h as useUpdateAssetMetadata, i as UploadModal, l as cn$1, m as useMoveAssets, n as CMSMDXEditorModal, o as MediaToolbar, p as useFolderTree$1, r as ImagePicker, s as buildAssetServeUrl, t as MDXContent, u as useAssetUsage, v as getUIConfig, x as useClickOutside, y as useErrorModal } from "./puck-CvjeYQRH.mjs";
|
|
2
2
|
import { useDataSchemas } from "./data-schemas.mjs";
|
|
3
3
|
import { usePageSchemas } from "./page-schemas.mjs";
|
|
4
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
|
-
import { ContentAPIClient, blockEditableSchema, dataEditableSchema, formatFileSize, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
|
|
7
|
+
import { ContentAPIClient, blockEditableSchema, dataEditableSchema, formatFileSize, getContentAPIClient, localesOf, setContentAPIClient, useBlocks, useCommitChanges, useCreateContent, useCurrentUser, useData, useDataCollections, useDataContext, useDeleteContent, useFolderTree, useGitStatus, useLocalizedContent, usePullChanges, usePushChanges, useSitePages, useSitesConfig, useUpdateLocalized } from "@conloca/content-api-client";
|
|
8
8
|
import cn from "clsx";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { QueryClient, QueryClientProvider
|
|
10
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
11
11
|
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";
|
|
@@ -1433,6 +1433,9 @@ function createMDXConflictMarkers(localMdx, serverMdx) {
|
|
|
1433
1433
|
//#region src/components/dialogs/ConflictDialog.tsx
|
|
1434
1434
|
function ConflictDialog({ conflict, onReload, onForceSave, onCancel, showDiff = false }) {
|
|
1435
1435
|
const [showReloadConfirm, setShowReloadConfirm] = useState(false);
|
|
1436
|
+
useEffect(() => {
|
|
1437
|
+
setShowReloadConfirm(false);
|
|
1438
|
+
}, [conflict]);
|
|
1436
1439
|
if (conflict.success || conflict.reason !== "stale_write") return null;
|
|
1437
1440
|
const { conflictDetails } = conflict;
|
|
1438
1441
|
const hasMetaChanges = conflictDetails?.metaChanged ?? false;
|
|
@@ -1940,13 +1943,7 @@ function PageEditorWrapper({ puckConfig }) {
|
|
|
1940
1943
|
const updateContent = useUpdateLocalized();
|
|
1941
1944
|
const { data: content, isLoading: isLoadingContent, error } = useLocalizedContent(id || "", "en");
|
|
1942
1945
|
const { data: blocksData } = useBlocks();
|
|
1943
|
-
const
|
|
1944
|
-
const { data: dataContextResponse, isLoading: isLoadingDataContext } = useQuery({
|
|
1945
|
-
queryKey: ["data-context", id],
|
|
1946
|
-
queryFn: () => fetch(`${apiBaseUrl}/data-context?pageId=${id}`).then((r) => r.ok ? r.json() : null).catch(() => null),
|
|
1947
|
-
enabled: !!id,
|
|
1948
|
-
retry: false
|
|
1949
|
-
});
|
|
1946
|
+
const { data: dataContextResponse, isLoading: isLoadingDataContext } = useDataContext(id);
|
|
1950
1947
|
const [currentEtag, setCurrentEtag] = useState("");
|
|
1951
1948
|
const [metadataDialogOpen, setMetadataDialogOpen] = useState(false);
|
|
1952
1949
|
const [resolvedPuckData, setResolvedPuckData] = useState(null);
|
|
@@ -3925,6 +3922,9 @@ function FolderOption({ node, depth, selectedFolder, currentFolder, onSelect })
|
|
|
3925
3922
|
}
|
|
3926
3923
|
function MoveFolderDialog({ isOpen, assetCount, currentFolder, onMove, onCancel, isMoving = false }) {
|
|
3927
3924
|
const [selectedFolder, setSelectedFolder] = useState(null);
|
|
3925
|
+
useEffect(() => {
|
|
3926
|
+
if (isOpen) setSelectedFolder(null);
|
|
3927
|
+
}, [isOpen]);
|
|
3928
3928
|
const { data, isLoading } = useFolderTree$1();
|
|
3929
3929
|
const rawTree = data?.tree ?? [];
|
|
3930
3930
|
const tree = rawTree.length === 1 && rawTree[0].path === "/" ? rawTree[0].children : rawTree;
|
|
@@ -4328,8 +4328,9 @@ function MediaPage() {
|
|
|
4328
4328
|
const [showMoveDialog, setShowMoveDialog] = useState(false);
|
|
4329
4329
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
|
4330
4330
|
const [showUploadModal, setShowUploadModal] = useState(false);
|
|
4331
|
+
const [bulkDeleteResult, setBulkDeleteResult] = useState(null);
|
|
4331
4332
|
const moveAssets = useMoveAssets();
|
|
4332
|
-
const
|
|
4333
|
+
const bulkDelete = useBulkDeleteAssets();
|
|
4333
4334
|
const handleToggleSelect = (filename) => {
|
|
4334
4335
|
setSelectedAssets((prev) => {
|
|
4335
4336
|
const next = new Set(prev);
|
|
@@ -4352,15 +4353,14 @@ function MediaPage() {
|
|
|
4352
4353
|
};
|
|
4353
4354
|
const handleBulkDelete = async () => {
|
|
4354
4355
|
const filenames = Array.from(selectedAssets);
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
successCount
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
}
|
|
4356
|
+
setBulkDeleteResult(null);
|
|
4357
|
+
const result = await bulkDelete.mutateAsync(filenames);
|
|
4358
|
+
setBulkDeleteResult({
|
|
4359
|
+
success: result.successCount,
|
|
4360
|
+
failed: result.failCount
|
|
4361
|
+
});
|
|
4362
|
+
if (result.successCount > 0) setSelectedAssets(/* @__PURE__ */ new Set());
|
|
4363
|
+
setShowDeleteConfirm(false);
|
|
4364
4364
|
};
|
|
4365
4365
|
const handleBulkMove = (targetFolder) => {
|
|
4366
4366
|
const filenames = Array.from(selectedAssets);
|
|
@@ -4380,6 +4380,11 @@ function MediaPage() {
|
|
|
4380
4380
|
const handleCloseDetail = () => {
|
|
4381
4381
|
setSelectedAsset(null);
|
|
4382
4382
|
};
|
|
4383
|
+
useEffect(() => {
|
|
4384
|
+
if (!bulkDeleteResult) return;
|
|
4385
|
+
const timer = setTimeout(() => setBulkDeleteResult(null), 5e3);
|
|
4386
|
+
return () => clearTimeout(timer);
|
|
4387
|
+
}, [bulkDeleteResult]);
|
|
4383
4388
|
return /* @__PURE__ */ jsxs("div", {
|
|
4384
4389
|
className: "flex h-full",
|
|
4385
4390
|
children: [
|
|
@@ -4411,6 +4416,19 @@ function MediaPage() {
|
|
|
4411
4416
|
onUploadClick: () => setShowUploadModal(true)
|
|
4412
4417
|
})]
|
|
4413
4418
|
}),
|
|
4419
|
+
bulkDeleteResult && /* @__PURE__ */ jsxs("div", {
|
|
4420
|
+
className: cn("mx-6 mt-2 px-4 py-2 rounded text-sm flex items-center justify-between", bulkDeleteResult.failed > 0 ? "bg-amber-50 text-amber-800 border border-amber-200" : "bg-green-50 text-green-800 border border-green-200"),
|
|
4421
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [
|
|
4422
|
+
bulkDeleteResult.success,
|
|
4423
|
+
" deleted",
|
|
4424
|
+
bulkDeleteResult.failed > 0 ? `, ${bulkDeleteResult.failed} failed` : ""
|
|
4425
|
+
] }), /* @__PURE__ */ jsx("button", {
|
|
4426
|
+
type: "button",
|
|
4427
|
+
onClick: () => setBulkDeleteResult(null),
|
|
4428
|
+
className: "ml-4 text-current opacity-60 hover:opacity-100",
|
|
4429
|
+
children: "Dismiss"
|
|
4430
|
+
})]
|
|
4431
|
+
}),
|
|
4414
4432
|
/* @__PURE__ */ jsx("div", {
|
|
4415
4433
|
className: "flex-1 overflow-auto px-6 pt-4 pb-6",
|
|
4416
4434
|
children: /* @__PURE__ */ jsx(MediaLibrary, {
|
|
@@ -4452,7 +4470,7 @@ function MediaPage() {
|
|
|
4452
4470
|
message: `Are you sure you want to delete ${selectedAssets.size} selected asset${selectedAssets.size !== 1 ? "s" : ""}?`,
|
|
4453
4471
|
onConfirm: handleBulkDelete,
|
|
4454
4472
|
onCancel: () => setShowDeleteConfirm(false),
|
|
4455
|
-
isDeleting:
|
|
4473
|
+
isDeleting: bulkDelete.isPending
|
|
4456
4474
|
}),
|
|
4457
4475
|
/* @__PURE__ */ jsx(UploadModal, {
|
|
4458
4476
|
isOpen: showUploadModal,
|
|
@@ -4498,9 +4516,14 @@ function PageList({ selectedSite, selectedLocale: initialLocale } = {}) {
|
|
|
4498
4516
|
hasMultipleLocales: false
|
|
4499
4517
|
});
|
|
4500
4518
|
const { showError, errorModalProps } = useErrorModal();
|
|
4519
|
+
const { buildUrl } = useSiteBaseUrl();
|
|
4501
4520
|
const navigate = useNavigate();
|
|
4502
4521
|
const createContent = useCreateContent();
|
|
4503
4522
|
const deleteContent = useDeleteContent();
|
|
4523
|
+
const getPreviewUrl = (pagePath) => {
|
|
4524
|
+
const previewUrl = buildUrl(pagePath);
|
|
4525
|
+
return `${previewUrl}${previewUrl.includes("?") ? "&" : "?"}_t=${Date.now()}`;
|
|
4526
|
+
};
|
|
4504
4527
|
const currentSite = selectedSite || "default";
|
|
4505
4528
|
const { data, isLoading, error } = useSitePages(currentSite, selectedLocale === "all" ? void 0 : selectedLocale);
|
|
4506
4529
|
const pages = useMemo(() => {
|
|
@@ -4786,16 +4809,33 @@ function PageList({ selectedSite, selectedLocale: initialLocale } = {}) {
|
|
|
4786
4809
|
className: "p-4",
|
|
4787
4810
|
children: /* @__PURE__ */ jsxs("div", {
|
|
4788
4811
|
className: "flex items-center gap-2",
|
|
4789
|
-
children: [/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 text-grey-04" }), /* @__PURE__ */ jsx("
|
|
4790
|
-
|
|
4812
|
+
children: [/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4 text-grey-04" }), /* @__PURE__ */ jsx("a", {
|
|
4813
|
+
href: buildUrl(page.path),
|
|
4814
|
+
target: "_blank",
|
|
4815
|
+
rel: "noopener noreferrer",
|
|
4816
|
+
className: "font-medium text-azure-04 hover:text-azure-03 hover:underline transition-colors",
|
|
4791
4817
|
"data-testid": `page-title-${page.id}`,
|
|
4818
|
+
onClick: (e) => {
|
|
4819
|
+
e.preventDefault();
|
|
4820
|
+
window.open(getPreviewUrl(page.path), "_blank");
|
|
4821
|
+
},
|
|
4792
4822
|
children: page.title
|
|
4793
4823
|
})]
|
|
4794
4824
|
})
|
|
4795
4825
|
}),
|
|
4796
4826
|
/* @__PURE__ */ jsx("td", {
|
|
4797
|
-
className: "p-4
|
|
4798
|
-
children:
|
|
4827
|
+
className: "p-4",
|
|
4828
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
4829
|
+
href: buildUrl(page.path),
|
|
4830
|
+
target: "_blank",
|
|
4831
|
+
rel: "noopener noreferrer",
|
|
4832
|
+
className: "text-grey-04 hover:text-azure-03 hover:underline transition-colors",
|
|
4833
|
+
onClick: (e) => {
|
|
4834
|
+
e.preventDefault();
|
|
4835
|
+
window.open(getPreviewUrl(page.path), "_blank");
|
|
4836
|
+
},
|
|
4837
|
+
children: page.path
|
|
4838
|
+
})
|
|
4799
4839
|
}),
|
|
4800
4840
|
/* @__PURE__ */ jsx("td", {
|
|
4801
4841
|
className: "p-4",
|