@nocode-factory/sanity-kit 2.52.0 → 2.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -4
- package/dist/{finalUrl-CaFXmYvm.js → finalUrl-IXF3zbT9.js} +7 -2
- package/dist/finalUrl-IXF3zbT9.js.map +1 -0
- package/dist/{fixCrossLanguageReferences-w3whO9xM.d.ts → fixCrossLanguageReferences-C1VsmGsJ.d.ts} +21 -2
- package/dist/{fixCrossLanguageReferences-BeXywAAU.js → fixCrossLanguageReferences-CDczoic9.js} +2 -2
- package/dist/{fixCrossLanguageReferences-BeXywAAU.js.map → fixCrossLanguageReferences-CDczoic9.js.map} +1 -1
- package/dist/index.d.ts +186 -8
- package/dist/index.js +1136 -121
- package/dist/index.js.map +1 -1
- package/dist/jsonld.js +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +2 -2
- package/package.json +1 -1
- package/src/config/resolve.ts +5 -0
- package/src/config/types.ts +21 -0
- package/src/hooks/useAssetDelete.ts +60 -0
- package/src/hooks/useBoardLayout.ts +25 -1
- package/src/hooks/useCollection.ts +51 -0
- package/src/index.ts +23 -1
- package/src/lib/assetRefs.ts +53 -0
- package/src/lib/collectionColumns.ts +114 -0
- package/src/lib/collectionQuery.ts +23 -0
- package/src/lib/collectionRows.ts +92 -0
- package/src/lib/collectionTable.ts +72 -0
- package/src/lib/collectionTypes.ts +49 -0
- package/src/lib/csv.ts +24 -0
- package/src/lib/download.ts +24 -0
- package/src/lib/i18nTemplates.ts +40 -0
- package/src/lib/pageOrder.ts +36 -0
- package/src/lib/pages.ts +11 -1
- package/src/lib/schemaColumns.ts +18 -5
- package/src/schema/boardLayout.ts +7 -0
- package/src/structure/collections.tsx +103 -0
- package/src/tools/assets/AssetCard.tsx +8 -10
- package/src/tools/assets/AssetDetail.tsx +97 -2
- package/src/tools/assets/AssetsTool.tsx +28 -11
- package/src/tools/collections/CollectionColumnPicker.tsx +122 -0
- package/src/tools/collections/CollectionTable.tsx +259 -0
- package/src/tools/collections/CollectionToolbar.tsx +68 -0
- package/src/tools/pages/PagesTool.tsx +15 -9
- package/src/tools/presentation/PagesNavigator.tsx +51 -6
- package/src/version.ts +1 -1
- package/dist/finalUrl-CaFXmYvm.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as DEFAULT_PAGE_BUILDER_FIELD, a as depth, c as segments, d as normalizePath, f as resolveConfig, g as DEFAULT_INTERNAL_FIELDS, h as DEFAULT_I18N, i as redirectMapOf, l as toPath, m as DEFAULT_COMPONENT_PREVIEW, o as pageTypeFor, p as DEFAULT_BOARD_TAGS, s as parentPath, t as finalPath, u as toUrl, v as DEFAULT_SLUG_FIELD, y as DEFAULT_TITLE_FIELD } from "./finalUrl-
|
|
1
|
+
import { _ as DEFAULT_PAGE_BUILDER_FIELD, a as depth, c as segments, d as normalizePath, f as resolveConfig, g as DEFAULT_INTERNAL_FIELDS, h as DEFAULT_I18N, i as redirectMapOf, l as toPath, m as DEFAULT_COMPONENT_PREVIEW, o as pageTypeFor, p as DEFAULT_BOARD_TAGS, s as parentPath, t as finalPath, u as toUrl, v as DEFAULT_SLUG_FIELD, y as DEFAULT_TITLE_FIELD } from "./finalUrl-IXF3zbT9.js";
|
|
2
2
|
import { a as collectTexts$1, c as valueAtKey, d as useKitContext, f as useOptionalKitConfig, i as guessDocumentTitle, l as KitProvider, o as replaceTexts, p as useOptionalKitContext, r as collectDocumentText, s as setAtKey, t as generateJsonLd, u as useKitConfig } from "./aiJsonLd-BFyxgYen.js";
|
|
3
|
-
import { a as componentDefaultsMainDocument, c as defineComponentDefaults, d as syncTranslationRedirects, f as translationRedirectId, i as DEFAULT_COMPONENT_DEFAULTS_TYPE, l as requiredUnlessDefault, n as withSameLanguageReferences, o as componentDefaultsMainDocuments, p as translationRedirectOptions, r as pageTypesFromSiteRoutes, s as defaultsFieldName, t as fixCrossLanguageReferences, u as requiredUnlessDefaultFor } from "./fixCrossLanguageReferences-
|
|
3
|
+
import { a as componentDefaultsMainDocument, c as defineComponentDefaults, d as syncTranslationRedirects, f as translationRedirectId, i as DEFAULT_COMPONENT_DEFAULTS_TYPE, l as requiredUnlessDefault, n as withSameLanguageReferences, o as componentDefaultsMainDocuments, p as translationRedirectOptions, r as pageTypesFromSiteRoutes, s as defaultsFieldName, t as fixCrossLanguageReferences, u as requiredUnlessDefaultFor } from "./fixCrossLanguageReferences-CDczoic9.js";
|
|
4
4
|
import { i as codeEditorInput, n as CodeEmbedInput, r as CodeEditorInput, t as defineCodeEmbedType } from "./codeEmbedType-1bEOTxBT.js";
|
|
5
5
|
import { createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
6
6
|
import { ToolLink, defineField, definePlugin, defineType, pathToString, set, unset, useClient, useCurrentUser, useFormValue, usePerspective, useSchema, useSetPerspective, useUser, useWorkspace } from "sanity";
|
|
@@ -50,9 +50,11 @@ import { Tooltip } from "@sanity/ui/tooltip";
|
|
|
50
50
|
import { EyeClosedIcon } from "@sanity/icons/EyeClosed";
|
|
51
51
|
import { usePresentationNavigate, usePresentationParams } from "sanity/presentation";
|
|
52
52
|
import { useToast } from "@sanity/ui/toast";
|
|
53
|
+
import { DragHandleIcon } from "@sanity/icons/DragHandle";
|
|
53
54
|
import { createPortal } from "react-dom";
|
|
54
55
|
import { TabletDeviceIcon } from "@sanity/icons/TabletDevice";
|
|
55
56
|
import { PanelRightIcon } from "@sanity/icons/PanelRight";
|
|
57
|
+
import { DownloadIcon } from "@sanity/icons/Download";
|
|
56
58
|
const isAbsoluteHttpUrl = (value) => {
|
|
57
59
|
try {
|
|
58
60
|
let url = new URL(value);
|
|
@@ -566,6 +568,12 @@ const TRANSLATION_TODO_TYPE = "ncfTranslationTodo", translationTodoId = (documen
|
|
|
566
568
|
type: "array",
|
|
567
569
|
of: [{ type: SECTION_NODE_TYPE }]
|
|
568
570
|
}),
|
|
571
|
+
defineField({
|
|
572
|
+
name: "pageOrder",
|
|
573
|
+
title: "Manual page order",
|
|
574
|
+
type: "array",
|
|
575
|
+
of: [{ type: "string" }]
|
|
576
|
+
}),
|
|
569
577
|
defineField({
|
|
570
578
|
name: "updatedBy",
|
|
571
579
|
title: "Modified by",
|
|
@@ -845,10 +853,10 @@ const fieldsFromStored = (stored) => {
|
|
|
845
853
|
* instance fournie par `BoardLayoutProvider`.
|
|
846
854
|
*/
|
|
847
855
|
function useBoardLayoutState() {
|
|
848
|
-
let client = useKitClient(), user = useCurrentUser(), [layout, setLayout] = useState([]), [sections, setSections] = useState([]), [columns, setColumns] = useState([]), [columnsSet, setColumnsSet] = useState(!1), [annotations, setAnnotations] = useState([]), [loading, setLoading] = useState(!0), [saveError, setSaveError] = useState(null);
|
|
856
|
+
let client = useKitClient(), user = useCurrentUser(), [layout, setLayout] = useState([]), [sections, setSections] = useState([]), [columns, setColumns] = useState([]), [columnsSet, setColumnsSet] = useState(!1), [annotations, setAnnotations] = useState([]), [pageOrder, setPageOrder] = useState([]), [loading, setLoading] = useState(!0), [saveError, setSaveError] = useState(null);
|
|
849
857
|
useEffect(() => {
|
|
850
858
|
let cancelled = !1;
|
|
851
|
-
return client.fetch("*[_id == $id][0]{nodes, sections, columns, columnsSet, annotations}", { id: BOARD_LAYOUT_ID }).then((doc) => {
|
|
859
|
+
return client.fetch("*[_id == $id][0]{nodes, sections, columns, columnsSet, annotations, pageOrder}", { id: BOARD_LAYOUT_ID }).then((doc) => {
|
|
852
860
|
cancelled || (setLayout(clean(doc?.nodes ?? [])), setSections((doc?.sections ?? []).map(({ blockName, x, y }) => ({
|
|
853
861
|
blockName,
|
|
854
862
|
x,
|
|
@@ -862,9 +870,9 @@ function useBoardLayoutState() {
|
|
|
862
870
|
label: ol,
|
|
863
871
|
...color ? { color } : {}
|
|
864
872
|
})) } : {}
|
|
865
|
-
}))), setColumnsSet(!!doc?.columnsSet), setAnnotations((doc?.annotations ?? []).map(({ _key, ...rest }) => ({ ...rest }))));
|
|
873
|
+
}))), setColumnsSet(!!doc?.columnsSet), setAnnotations((doc?.annotations ?? []).map(({ _key, ...rest }) => ({ ...rest }))), setPageOrder(Array.isArray(doc?.pageOrder) ? doc.pageOrder.filter((id) => typeof id == "string") : []));
|
|
866
874
|
}).catch(() => {
|
|
867
|
-
cancelled || (setLayout([]), setSections([]), setColumns([]), setColumnsSet(!1), setAnnotations([]));
|
|
875
|
+
cancelled || (setLayout([]), setSections([]), setColumns([]), setColumnsSet(!1), setAnnotations([]), setPageOrder([]));
|
|
868
876
|
}).finally(() => {
|
|
869
877
|
cancelled || setLoading(!1);
|
|
870
878
|
}), () => {
|
|
@@ -875,10 +883,10 @@ function useBoardLayoutState() {
|
|
|
875
883
|
useEffect(() => () => {
|
|
876
884
|
timer.current && clearTimeout(timer.current);
|
|
877
885
|
}, []);
|
|
878
|
-
let layoutRef = useRef([]), sectionsRef = useRef([]), columnsRef = useRef([]), columnsSetRef = useRef(!1), annotationsRef = useRef([]);
|
|
879
|
-
layoutRef.current = layout, sectionsRef.current = sections, columnsRef.current = columns, columnsSetRef.current = columnsSet, annotationsRef.current = annotations;
|
|
886
|
+
let layoutRef = useRef([]), sectionsRef = useRef([]), columnsRef = useRef([]), columnsSetRef = useRef(!1), annotationsRef = useRef([]), pageOrderRef = useRef([]);
|
|
887
|
+
layoutRef.current = layout, sectionsRef.current = sections, columnsRef.current = columns, columnsSetRef.current = columnsSet, annotationsRef.current = annotations, pageOrderRef.current = pageOrder;
|
|
880
888
|
let write = useCallback((next) => {
|
|
881
|
-
let nodes = next?.nodes ?? layoutRef.current, nextSections = next?.sections ?? sectionsRef.current, nextColumns = next?.columns ?? columnsRef.current, nextColumnsSet = next?.columnsSet ?? columnsSetRef.current, nextAnnotations = next?.annotations ?? annotationsRef.current;
|
|
889
|
+
let nodes = next?.nodes ?? layoutRef.current, nextSections = next?.sections ?? sectionsRef.current, nextColumns = next?.columns ?? columnsRef.current, nextColumnsSet = next?.columnsSet ?? columnsSetRef.current, nextAnnotations = next?.annotations ?? annotationsRef.current, nextPageOrder = next?.pageOrder ?? pageOrderRef.current;
|
|
882
890
|
client.createOrReplace({
|
|
883
891
|
_id: BOARD_LAYOUT_ID,
|
|
884
892
|
_type: BOARD_LAYOUT_TYPE,
|
|
@@ -909,6 +917,7 @@ function useBoardLayoutState() {
|
|
|
909
917
|
}))
|
|
910
918
|
})),
|
|
911
919
|
columnsSet: nextColumnsSet,
|
|
920
|
+
pageOrder: nextPageOrder,
|
|
912
921
|
annotations: nextAnnotations.map((annotation) => ({
|
|
913
922
|
_key: annotation.id,
|
|
914
923
|
_type: "ncfAnnotation",
|
|
@@ -963,6 +972,9 @@ function useBoardLayoutState() {
|
|
|
963
972
|
setAnnotations(value), timer.current && clearTimeout(timer.current), timer.current = setTimeout(() => write({ annotations: value }), 800);
|
|
964
973
|
}, [write]), resetSections = useCallback(() => {
|
|
965
974
|
timer.current && clearTimeout(timer.current), setSections([]), write({ sections: [] });
|
|
975
|
+
}, [write]), savePageOrder = useCallback((ids) => {
|
|
976
|
+
let value = [...ids];
|
|
977
|
+
setPageOrder(value), timer.current && clearTimeout(timer.current), timer.current = setTimeout(() => write({ pageOrder: value }), 800);
|
|
966
978
|
}, [write]), sectionsByName = useMemo(() => new Map(sections.map((entry) => [entry.blockName, entry])), [sections]);
|
|
967
979
|
return {
|
|
968
980
|
layout,
|
|
@@ -980,6 +992,8 @@ function useBoardLayoutState() {
|
|
|
980
992
|
saveColumns,
|
|
981
993
|
annotations,
|
|
982
994
|
saveAnnotations,
|
|
995
|
+
pageOrder,
|
|
996
|
+
savePageOrder,
|
|
983
997
|
reset,
|
|
984
998
|
resetSections
|
|
985
999
|
};
|
|
@@ -1407,7 +1421,7 @@ function explainGrantError(error) {
|
|
|
1407
1421
|
* quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
|
|
1408
1422
|
* le vérifie.
|
|
1409
1423
|
*/
|
|
1410
|
-
const KIT_VERSION = "2.
|
|
1424
|
+
const KIT_VERSION = "2.54.0";
|
|
1411
1425
|
/**
|
|
1412
1426
|
* Signale ce Studio au service du kit, une fois par montage.
|
|
1413
1427
|
*
|
|
@@ -1905,7 +1919,7 @@ function useKitUpdate() {
|
|
|
1905
1919
|
!controller.signal.aborted && body?.version && setLatest(body.version);
|
|
1906
1920
|
}).catch(() => {}), () => controller.abort();
|
|
1907
1921
|
}, []);
|
|
1908
|
-
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.
|
|
1922
|
+
let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.54.0") > 0);
|
|
1909
1923
|
return {
|
|
1910
1924
|
current: KIT_VERSION,
|
|
1911
1925
|
latest,
|
|
@@ -1925,7 +1939,7 @@ const TABULAR = { fontVariantNumeric: "tabular-nums" }, MONO = {
|
|
|
1925
1939
|
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
1926
1940
|
fontVariantNumeric: "tabular-nums",
|
|
1927
1941
|
letterSpacing: "-0.01em"
|
|
1928
|
-
}, CELL = { minWidth: 0 }, BORDER = "var(--card-border-color, rgba(127,127,127,0.22))", OPTION_COLORS = [
|
|
1942
|
+
}, CELL = { minWidth: 0 }, BORDER = "var(--card-border-color, rgba(127,127,127,0.22))", BORDER_SOFT = "var(--card-border-color, rgba(127,127,127,0.12))", OPTION_COLORS = [
|
|
1929
1943
|
"#f5a623",
|
|
1930
1944
|
"#43d675",
|
|
1931
1945
|
"#2276fc",
|
|
@@ -2463,6 +2477,39 @@ function buildContentsQuery(config, limit) {
|
|
|
2463
2477
|
].join("\n");
|
|
2464
2478
|
}
|
|
2465
2479
|
/**
|
|
2480
|
+
* Ordre manuel des pages, partagé par le navigateur de Presentation et l'onglet
|
|
2481
|
+
* Pages. Stocké comme une liste d'ids (board singleton `pageOrder`). Pur.
|
|
2482
|
+
*/
|
|
2483
|
+
/**
|
|
2484
|
+
* Ordonne des éléments par la liste d'ids `order` : ceux présents d'abord (dans
|
|
2485
|
+
* l'ordre de `order`), les autres ensuite dans leur ordre d'entrée (donc une
|
|
2486
|
+
* page nouvelle, absente de l'ordre manuel, apparaît à la fin).
|
|
2487
|
+
*/
|
|
2488
|
+
function orderByIds(items, order) {
|
|
2489
|
+
if (order.length === 0) return [...items];
|
|
2490
|
+
let rank = new Map(order.map((id, index) => [id, index]));
|
|
2491
|
+
return [...items].sort((a, b) => {
|
|
2492
|
+
let ra = rank.get(a.id), rb = rank.get(b.id);
|
|
2493
|
+
return ra === void 0 && rb === void 0 ? 0 : ra === void 0 ? 1 : rb === void 0 ? -1 : ra - rb;
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Déplace `dragged` juste avant `target` dans la séquence d'ids `ordered`
|
|
2498
|
+
* (l'ordre courant complet). `target` null = place en fin. Filtre-sûr : on
|
|
2499
|
+
* travaille sur les ids, pas sur une vue filtrée.
|
|
2500
|
+
*/
|
|
2501
|
+
function reorderBefore(ordered, dragged, target) {
|
|
2502
|
+
if (dragged === target) return [...ordered];
|
|
2503
|
+
let without = ordered.filter((id) => id !== dragged);
|
|
2504
|
+
if (target === null) return [...without, dragged];
|
|
2505
|
+
let index = without.indexOf(target);
|
|
2506
|
+
return index < 0 ? [...without, dragged] : [
|
|
2507
|
+
...without.slice(0, index),
|
|
2508
|
+
dragged,
|
|
2509
|
+
...without.slice(index)
|
|
2510
|
+
];
|
|
2511
|
+
}
|
|
2512
|
+
/**
|
|
2466
2513
|
* Met une valeur du document en forme pour une cellule.
|
|
2467
2514
|
*
|
|
2468
2515
|
* Ce qui ne tient pas sur une ligne — un objet, un tableau de sections — n'est
|
|
@@ -2515,14 +2562,18 @@ const STATUS_ORDER = {
|
|
|
2515
2562
|
case "blockCount": return a.blockCount - b.blockCount;
|
|
2516
2563
|
}
|
|
2517
2564
|
};
|
|
2518
|
-
function sortRows(rows, key, direction, options = {}) {
|
|
2565
|
+
function sortRows$1(rows, key, direction, options = {}) {
|
|
2566
|
+
if (key === "manual") {
|
|
2567
|
+
let sorted = orderByIds([...rows].sort((a, b) => a.title.localeCompare(b.title, void 0, { sensitivity: "base" })), options.pageOrder ?? []);
|
|
2568
|
+
return direction === "asc" ? sorted : sorted.reverse();
|
|
2569
|
+
}
|
|
2519
2570
|
let sorted = [...rows].sort((a, b) => compare(a, b, key, options));
|
|
2520
2571
|
return direction === "asc" ? sorted : sorted.reverse();
|
|
2521
2572
|
}
|
|
2522
|
-
const normalize = (value) => value.toLocaleLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
2523
|
-
function filterRows(rows, filters) {
|
|
2524
|
-
let search = filters.search?.trim() ? normalize(filters.search.trim()) : null;
|
|
2525
|
-
return rows.filter((row) => !(filters.types?.length && !filters.types.includes(row.type) || filters.statuses?.length && !filters.statuses.includes(row.status) || filters.locales?.length && row.locale && !filters.locales.includes(row.locale) || search && !`${normalize(row.title)} ${normalize(row.path ?? "")}`.includes(search)));
|
|
2573
|
+
const normalize$1 = (value) => value.toLocaleLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
2574
|
+
function filterRows$1(rows, filters) {
|
|
2575
|
+
let search = filters.search?.trim() ? normalize$1(filters.search.trim()) : null;
|
|
2576
|
+
return rows.filter((row) => !(filters.types?.length && !filters.types.includes(row.type) || filters.statuses?.length && !filters.statuses.includes(row.status) || filters.locales?.length && row.locale && !filters.locales.includes(row.locale) || search && !`${normalize$1(row.title)} ${normalize$1(row.path ?? "")}`.includes(search)));
|
|
2526
2577
|
}
|
|
2527
2578
|
/** Langues réellement présentes, pour ne proposer que des filtres utiles. */
|
|
2528
2579
|
function localesInRows(rows) {
|
|
@@ -2629,6 +2680,10 @@ const OPAQUE_TYPES = /* @__PURE__ */ new Set([
|
|
|
2629
2680
|
"globalDocumentReference",
|
|
2630
2681
|
"block",
|
|
2631
2682
|
"geopoint"
|
|
2683
|
+
]), REFERENCE_TYPES = /* @__PURE__ */ new Set([
|
|
2684
|
+
"reference",
|
|
2685
|
+
"crossDatasetReference",
|
|
2686
|
+
"globalDocumentReference"
|
|
2632
2687
|
]);
|
|
2633
2688
|
/** Remonte la chaîne d'héritage jusqu'à trouver la nature JSON du champ. */
|
|
2634
2689
|
function jsonTypeOf(type) {
|
|
@@ -2655,6 +2710,15 @@ function isOpaque(type) {
|
|
|
2655
2710
|
}
|
|
2656
2711
|
return !1;
|
|
2657
2712
|
}
|
|
2713
|
+
/** Vrai pour un champ référence (vers un autre document). */
|
|
2714
|
+
function isReference(type) {
|
|
2715
|
+
let current = type;
|
|
2716
|
+
for (let depth = 0; current && depth < 10; depth += 1) {
|
|
2717
|
+
if (current.name && REFERENCE_TYPES.has(current.name)) return !0;
|
|
2718
|
+
current = current.type;
|
|
2719
|
+
}
|
|
2720
|
+
return !1;
|
|
2721
|
+
}
|
|
2658
2722
|
const labelOf = (field) => field.type?.title?.trim() || humanise(field.name);
|
|
2659
2723
|
/** `metaDescription` → `Meta description`. */
|
|
2660
2724
|
function humanise(name) {
|
|
@@ -3278,7 +3342,7 @@ const VALUE_TYPE_NAMES = /* @__PURE__ */ new Set([
|
|
|
3278
3342
|
"datetime",
|
|
3279
3343
|
"number",
|
|
3280
3344
|
"boolean"
|
|
3281
|
-
]), SKIP_KEYS = /* @__PURE__ */ new Set(["language", "slug"]), isObj$
|
|
3345
|
+
]), SKIP_KEYS = /* @__PURE__ */ new Set(["language", "slug"]), isObj$2 = (v) => typeof v == "object" && !!v && !Array.isArray(v), same$2 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null), keyed$1 = (v) => Array.isArray(v) && v.length > 0 && v.every((i) => isObj$2(i) && typeof i._key == "string");
|
|
3282
3346
|
function typeNames(t) {
|
|
3283
3347
|
let out = [];
|
|
3284
3348
|
for (let c = t; c; c = c.type) c.name && out.push(c.name);
|
|
@@ -3298,7 +3362,7 @@ function kindOf(t, value) {
|
|
|
3298
3362
|
}
|
|
3299
3363
|
return t.jsonType === "object" ? "object" : t.jsonType === "string" ? t.options?.list?.length ? "value" : "text" : "value";
|
|
3300
3364
|
}
|
|
3301
|
-
return keyed$1(value) ? "list" : isObj$
|
|
3365
|
+
return keyed$1(value) ? "list" : isObj$2(value) ? "object" : "value";
|
|
3302
3366
|
}
|
|
3303
3367
|
function fieldType(t, name) {
|
|
3304
3368
|
for (let c = t; c; c = c.type) {
|
|
@@ -3315,8 +3379,8 @@ function itemType(t, item) {
|
|
|
3315
3379
|
function collectTexts(value, t, path, acc) {
|
|
3316
3380
|
let kind = kindOf(t, value);
|
|
3317
3381
|
if (kind === "text") value != null && value !== "" && acc.toTranslate.push(path);
|
|
3318
|
-
else if (kind === "object" && isObj$
|
|
3319
|
-
else if (kind === "list" && Array.isArray(value)) for (let item of value) isObj$
|
|
3382
|
+
else if (kind === "object" && isObj$2(value)) for (let [k, v] of Object.entries(value)) k.startsWith("_") || collectTexts(v, fieldType(t, k), `${path}.${k}`, acc);
|
|
3383
|
+
else if (kind === "list" && Array.isArray(value)) for (let item of value) isObj$2(item) && collectTexts(item, itemType(t, item), `${path}[${String(item._key)}]`, acc);
|
|
3320
3384
|
}
|
|
3321
3385
|
const ABSENT$1 = Symbol("absent");
|
|
3322
3386
|
function merge(target, before, after, t, path, acc) {
|
|
@@ -3325,8 +3389,8 @@ function merge(target, before, after, t, path, acc) {
|
|
|
3325
3389
|
if (kind === "text") return after == null || after === "" ? (target != null && target !== "" && acc.toTranslate.push(path), target === void 0 ? ABSENT$1 : target) : (acc.toTranslate.push(path), target == null || target === "" || same$2(target, before) ? after : target);
|
|
3326
3390
|
if (kind === "value") return acc.copied.push(path), after === void 0 ? ABSENT$1 : after;
|
|
3327
3391
|
if (kind === "object") {
|
|
3328
|
-
if (!isObj$
|
|
3329
|
-
let base = isObj$
|
|
3392
|
+
if (!isObj$2(after)) return acc.copied.push(path), after === void 0 ? ABSENT$1 : after;
|
|
3393
|
+
let base = isObj$2(target) ? { ...target } : { _type: after._type }, b = isObj$2(before) ? before : {};
|
|
3330
3394
|
for (let k of /* @__PURE__ */ new Set([...Object.keys(b), ...Object.keys(after)])) {
|
|
3331
3395
|
if (k.startsWith("_") || SKIP_KEYS.has(k)) continue;
|
|
3332
3396
|
let v = merge(base[k], b[k], after[k], fieldType(t, k), path ? `${path}.${k}` : k, acc);
|
|
@@ -3334,7 +3398,7 @@ function merge(target, before, after, t, path, acc) {
|
|
|
3334
3398
|
}
|
|
3335
3399
|
return base;
|
|
3336
3400
|
}
|
|
3337
|
-
let tgt = Array.isArray(target) ? target.filter(isObj$
|
|
3401
|
+
let tgt = Array.isArray(target) ? target.filter(isObj$2) : [], bef = Array.isArray(before) ? before.filter(isObj$2) : [], aft = Array.isArray(after) ? after.filter(isObj$2) : [], byKey = (list) => new Map(list.map((i) => [i._key, i])), tMap = byKey(tgt), bMap = byKey(bef), aMap = byKey(aft), result = [];
|
|
3338
3402
|
for (let item of aft) {
|
|
3339
3403
|
let key = item._key, it = itemType(t, item);
|
|
3340
3404
|
if (tMap.has(key)) {
|
|
@@ -3368,7 +3432,7 @@ function propagate(target, before, after, documentType) {
|
|
|
3368
3432
|
return {
|
|
3369
3433
|
document: {
|
|
3370
3434
|
...target ?? {},
|
|
3371
|
-
...isObj$
|
|
3435
|
+
...isObj$2(merged) ? merged : {}
|
|
3372
3436
|
},
|
|
3373
3437
|
...acc
|
|
3374
3438
|
};
|
|
@@ -4125,7 +4189,7 @@ const formatter = new Intl.DateTimeFormat("en-US", {
|
|
|
4125
4189
|
minute: "2-digit"
|
|
4126
4190
|
});
|
|
4127
4191
|
/** Date lisible, ou un tiret cadratin quand il n'y en a pas. */
|
|
4128
|
-
function formatDate(value) {
|
|
4192
|
+
function formatDate$1(value) {
|
|
4129
4193
|
if (!value) return "—";
|
|
4130
4194
|
let date = new Date(value);
|
|
4131
4195
|
return Number.isNaN(date.getTime()) ? "—" : formatter.format(date);
|
|
@@ -4813,7 +4877,7 @@ function PagesTable(props) {
|
|
|
4813
4877
|
].join(" "),
|
|
4814
4878
|
gap: "0.875rem",
|
|
4815
4879
|
alignItems: "center",
|
|
4816
|
-
borderBottom:
|
|
4880
|
+
borderBottom: `1px solid ${BORDER_SOFT}`
|
|
4817
4881
|
};
|
|
4818
4882
|
return /* @__PURE__ */ jsxs(Box, {
|
|
4819
4883
|
style: { overflowX: "auto" },
|
|
@@ -5013,7 +5077,7 @@ function PagesTable(props) {
|
|
|
5013
5077
|
size: 0,
|
|
5014
5078
|
muted: !0,
|
|
5015
5079
|
style: TABULAR,
|
|
5016
|
-
children: formatDate(entryRow.updatedAt)
|
|
5080
|
+
children: formatDate$1(entryRow.updatedAt)
|
|
5017
5081
|
})
|
|
5018
5082
|
}),
|
|
5019
5083
|
dataColumns.map((column) => {
|
|
@@ -5136,7 +5200,7 @@ function ColumnVisibility(props) {
|
|
|
5136
5200
|
})
|
|
5137
5201
|
});
|
|
5138
5202
|
}
|
|
5139
|
-
function Row$
|
|
5203
|
+
function Row$2(props) {
|
|
5140
5204
|
return /* @__PURE__ */ jsxs(Flex, {
|
|
5141
5205
|
align: "center",
|
|
5142
5206
|
gap: 2,
|
|
@@ -5181,7 +5245,7 @@ function DataColumnList(props) {
|
|
|
5181
5245
|
}, [dataColumns, filter]);
|
|
5182
5246
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
5183
5247
|
gap: 0,
|
|
5184
|
-
children: [HIDEABLE.map((column) => /* @__PURE__ */ jsx(Row$
|
|
5248
|
+
children: [HIDEABLE.map((column) => /* @__PURE__ */ jsx(Row$2, {
|
|
5185
5249
|
label: column.label,
|
|
5186
5250
|
checked: !hidden.has(column.key),
|
|
5187
5251
|
onClick: () => onToggle(column.key)
|
|
@@ -5218,7 +5282,7 @@ function DataColumnList(props) {
|
|
|
5218
5282
|
}
|
|
5219
5283
|
})
|
|
5220
5284
|
}),
|
|
5221
|
-
matches.map((column) => /* @__PURE__ */ jsx(Row$
|
|
5285
|
+
matches.map((column) => /* @__PURE__ */ jsx(Row$2, {
|
|
5222
5286
|
label: column.label,
|
|
5223
5287
|
checked: shownData.has(column.key),
|
|
5224
5288
|
onClick: () => onToggleData(column.key)
|
|
@@ -6376,23 +6440,27 @@ function BoardView(props) {
|
|
|
6376
6440
|
return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(Board, { ...props }) });
|
|
6377
6441
|
}
|
|
6378
6442
|
function PagesTool() {
|
|
6379
|
-
let config = useKitConfig(), router = useRouter(), { byId, saveColumns, patchNode, patchField } = useBoardLayout(), columnOptions = useColumnOptions(), preview = usePreviewTarget(), columns = useInternalColumns(), [view, setView] = useState("list"), [search, setSearch] = useState(""), [locale, setLocale] = useState(""), todos = useTranslationTodos(), [onlyTodo, setOnlyTodo] = useState(!1), [groupBy, setGroupBy] = useState("none"), [rawColorBy, setColorBy] = useState("tag"), [sortKey, setSortKey] = useState(
|
|
6443
|
+
let config = useKitConfig(), router = useRouter(), { byId, saveColumns, patchNode, patchField, pageOrder } = useBoardLayout(), columnOptions = useColumnOptions(), preview = usePreviewTarget(), columns = useInternalColumns(), [view, setView] = useState("list"), [search, setSearch] = useState(""), [locale, setLocale] = useState(""), todos = useTranslationTodos(), [onlyTodo, setOnlyTodo] = useState(!1), [groupBy, setGroupBy] = useState("none"), [rawColorBy, setColorBy] = useState("tag"), [sortKey, setSortKey] = useState(null), [sortDirection, setSortDirection] = useState("asc"), [page, setPage] = useState(0), [hidden, setHidden] = useState(/* @__PURE__ */ new Set()), [shownData, setShownData] = useState(/* @__PURE__ */ new Set()), toggleData = useCallback((key) => {
|
|
6380
6444
|
setShownData((current) => {
|
|
6381
6445
|
let next = new Set(current);
|
|
6382
6446
|
return next.has(key) ? next.delete(key) : next.add(key), next;
|
|
6383
6447
|
});
|
|
6384
|
-
}, []), documentColumns = useDocumentColumns(), visibleDataColumns = useMemo(() => documentColumns.filter((column) => shownData.has(column.key)), [documentColumns, shownData]), { rows, loading, error, refresh } = usePages(visibleDataColumns), colorBy = resolveColorBy(rawColorBy, columns), locales = useMemo(() => config.i18n?.locales.length ? config.i18n.locales : localesInRows(rows), [config.i18n, rows]), visible = useMemo(() => sortRows(filterRows(rows, {
|
|
6448
|
+
}, []), documentColumns = useDocumentColumns(), visibleDataColumns = useMemo(() => documentColumns.filter((column) => shownData.has(column.key)), [documentColumns, shownData]), { rows, loading, error, refresh } = usePages(visibleDataColumns), colorBy = resolveColorBy(rawColorBy, columns), locales = useMemo(() => config.i18n?.locales.length ? config.i18n.locales : localesInRows(rows), [config.i18n, rows]), effectiveSortKey = sortKey ?? (pageOrder.length > 0 ? "manual" : "structure"), visible = useMemo(() => sortRows$1(filterRows$1(rows, {
|
|
6385
6449
|
search,
|
|
6386
6450
|
locales: locale ? [locale] : void 0
|
|
6387
|
-
}).filter((row) => !onlyTodo || todos.has(row.id)),
|
|
6451
|
+
}).filter((row) => !onlyTodo || todos.has(row.id)), effectiveSortKey, sortDirection, {
|
|
6452
|
+
typeOrder: config.pageTypeNames,
|
|
6453
|
+
pageOrder
|
|
6454
|
+
}), [
|
|
6388
6455
|
rows,
|
|
6389
6456
|
search,
|
|
6390
6457
|
locale,
|
|
6391
6458
|
onlyTodo,
|
|
6392
6459
|
todos,
|
|
6393
|
-
|
|
6460
|
+
effectiveSortKey,
|
|
6394
6461
|
sortDirection,
|
|
6395
|
-
config.pageTypeNames
|
|
6462
|
+
config.pageTypeNames,
|
|
6463
|
+
pageOrder
|
|
6396
6464
|
]), pageCount = Math.max(1, Math.ceil(visible.length / 100)), current = Math.min(page, pageCount - 1), slice = visible.slice(current * 100, current * 100 + 100), groups = useMemo(() => groupPageRows(slice, groupBy, {
|
|
6397
6465
|
meta: byId,
|
|
6398
6466
|
tags: config.boardTags,
|
|
@@ -6413,7 +6481,7 @@ function PagesTool() {
|
|
|
6413
6481
|
let next = new Set(current);
|
|
6414
6482
|
return next.has(key) ? next.delete(key) : next.add(key), next;
|
|
6415
6483
|
}), onSort = (key) => {
|
|
6416
|
-
key ===
|
|
6484
|
+
key === effectiveSortKey ? setSortDirection((d) => d === "asc" ? "desc" : "asc") : (setSortKey(key), setSortDirection("asc")), setPage(0);
|
|
6417
6485
|
};
|
|
6418
6486
|
if (error) return /* @__PURE__ */ jsx(QueryError, {
|
|
6419
6487
|
error,
|
|
@@ -6632,7 +6700,7 @@ function PagesTool() {
|
|
|
6632
6700
|
})
|
|
6633
6701
|
}) : /* @__PURE__ */ jsx(PagesTable, {
|
|
6634
6702
|
groups,
|
|
6635
|
-
sortKey,
|
|
6703
|
+
sortKey: effectiveSortKey,
|
|
6636
6704
|
sortDirection,
|
|
6637
6705
|
onSort,
|
|
6638
6706
|
columns,
|
|
@@ -9144,7 +9212,7 @@ function countByFolder(assets, folders) {
|
|
|
9144
9212
|
}
|
|
9145
9213
|
return counts;
|
|
9146
9214
|
}
|
|
9147
|
-
function Row(props) {
|
|
9215
|
+
function Row$1(props) {
|
|
9148
9216
|
return /* @__PURE__ */ jsxs(Flex, {
|
|
9149
9217
|
align: "center",
|
|
9150
9218
|
gap: 1,
|
|
@@ -9224,19 +9292,19 @@ function FolderSidebar(props) {
|
|
|
9224
9292
|
/* @__PURE__ */ jsxs(Stack, {
|
|
9225
9293
|
gap: 1,
|
|
9226
9294
|
children: [
|
|
9227
|
-
/* @__PURE__ */ jsx(Row, {
|
|
9295
|
+
/* @__PURE__ */ jsx(Row$1, {
|
|
9228
9296
|
label: "Tous les médias",
|
|
9229
9297
|
count: total,
|
|
9230
9298
|
active: selection === null,
|
|
9231
9299
|
onClick: () => onSelect(null)
|
|
9232
9300
|
}),
|
|
9233
|
-
/* @__PURE__ */ jsx(Row, {
|
|
9301
|
+
/* @__PURE__ */ jsx(Row$1, {
|
|
9234
9302
|
label: "Non classés",
|
|
9235
9303
|
count: counts.get("") ?? 0,
|
|
9236
9304
|
active: selection === "",
|
|
9237
9305
|
onClick: () => onSelect("")
|
|
9238
9306
|
}),
|
|
9239
|
-
folders.map((folder) => /* @__PURE__ */ jsx(Row, {
|
|
9307
|
+
folders.map((folder) => /* @__PURE__ */ jsx(Row$1, {
|
|
9240
9308
|
label: folder.name,
|
|
9241
9309
|
count: counts.get(folder.id) ?? 0,
|
|
9242
9310
|
active: selection === folder.id,
|
|
@@ -9497,10 +9565,7 @@ function AssetsToolbar(props) {
|
|
|
9497
9565
|
}
|
|
9498
9566
|
/** Tuile d'un asset dans la grille : aperçu, nom, taille, type, usage. */
|
|
9499
9567
|
function AssetCard(props) {
|
|
9500
|
-
let { asset, selected, onToggleSelect, onOpen } = props, [failed, setFailed] = useState(!1), thumb = thumbnailUrl(asset, {
|
|
9501
|
-
w: 320,
|
|
9502
|
-
h: 220
|
|
9503
|
-
}), unused = asset.uses === 0, meta = [
|
|
9568
|
+
let { asset, selected, onToggleSelect, onOpen } = props, [failed, setFailed] = useState(!1), thumb = thumbnailUrl(asset, { w: 500 }), unused = asset.uses === 0, natural = asset.dimensions?.width && asset.dimensions?.height ? asset.dimensions.width / asset.dimensions.height : 4 / 3, ratio = thumb ? Math.min(2, Math.max(.56, natural)) : 4 / 3, meta = [
|
|
9504
9569
|
formatBytes(asset.size),
|
|
9505
9570
|
asset.dimensions?.width ? `${asset.dimensions.width}×${asset.dimensions.height}` : null,
|
|
9506
9571
|
asset.extension?.toUpperCase()
|
|
@@ -9511,9 +9576,9 @@ function AssetCard(props) {
|
|
|
9511
9576
|
padding: 0,
|
|
9512
9577
|
tone: selected ? "primary" : "default",
|
|
9513
9578
|
style: {
|
|
9514
|
-
height: "100%",
|
|
9515
9579
|
overflow: "hidden",
|
|
9516
|
-
position: "relative"
|
|
9580
|
+
position: "relative",
|
|
9581
|
+
width: "100%"
|
|
9517
9582
|
},
|
|
9518
9583
|
children: [/* @__PURE__ */ jsx(Box, {
|
|
9519
9584
|
style: {
|
|
@@ -9539,7 +9604,6 @@ function AssetCard(props) {
|
|
|
9539
9604
|
as: "button",
|
|
9540
9605
|
onClick: onOpen,
|
|
9541
9606
|
style: {
|
|
9542
|
-
height: "100%",
|
|
9543
9607
|
width: "100%",
|
|
9544
9608
|
textAlign: "left",
|
|
9545
9609
|
cursor: "pointer",
|
|
@@ -9549,7 +9613,7 @@ function AssetCard(props) {
|
|
|
9549
9613
|
},
|
|
9550
9614
|
children: [/* @__PURE__ */ jsx(Box, {
|
|
9551
9615
|
style: {
|
|
9552
|
-
aspectRatio:
|
|
9616
|
+
aspectRatio: ratio,
|
|
9553
9617
|
overflow: "hidden",
|
|
9554
9618
|
background: "var(--card-muted-bg-color, rgba(127,127,127,0.08))"
|
|
9555
9619
|
},
|
|
@@ -9818,7 +9882,7 @@ function AssetTable(props) {
|
|
|
9818
9882
|
size: 1,
|
|
9819
9883
|
muted: !0,
|
|
9820
9884
|
style: TABULAR,
|
|
9821
|
-
children: formatDate(asset._createdAt)
|
|
9885
|
+
children: formatDate$1(asset._createdAt)
|
|
9822
9886
|
})
|
|
9823
9887
|
})
|
|
9824
9888
|
]
|
|
@@ -9827,6 +9891,68 @@ function AssetTable(props) {
|
|
|
9827
9891
|
})
|
|
9828
9892
|
});
|
|
9829
9893
|
}
|
|
9894
|
+
const isObj$1 = (v) => typeof v == "object" && !!v && !Array.isArray(v);
|
|
9895
|
+
/** Chemins (segments) des objets du document qui pointent vers `assetId`. */
|
|
9896
|
+
function findAssetRefPaths(value, assetId, path = []) {
|
|
9897
|
+
let out = [], walk = (node, current) => {
|
|
9898
|
+
if (Array.isArray(node)) {
|
|
9899
|
+
node.forEach((item, index) => {
|
|
9900
|
+
let segment = isObj$1(item) && typeof item._key == "string" ? { _key: item._key } : index;
|
|
9901
|
+
walk(item, [...current, segment]);
|
|
9902
|
+
});
|
|
9903
|
+
return;
|
|
9904
|
+
}
|
|
9905
|
+
if (isObj$1(node)) {
|
|
9906
|
+
if ((isObj$1(node.asset) ? node.asset._ref : void 0) === assetId || node._type === "reference" && node._ref === assetId) {
|
|
9907
|
+
out.push(current);
|
|
9908
|
+
return;
|
|
9909
|
+
}
|
|
9910
|
+
for (let [key, child] of Object.entries(node)) key.startsWith("_") || walk(child, [...current, key]);
|
|
9911
|
+
}
|
|
9912
|
+
};
|
|
9913
|
+
return walk(value, path), out;
|
|
9914
|
+
}
|
|
9915
|
+
/** Chemin Sanity (`gallery[_key=="ab"].asset`) depuis des segments. */
|
|
9916
|
+
function toPatchPath(segments) {
|
|
9917
|
+
let out = "";
|
|
9918
|
+
for (let segment of segments) out += typeof segment == "string" ? out ? `.${segment}` : segment : typeof segment == "number" ? `[${segment}]` : `[_key=="${segment._key}"]`;
|
|
9919
|
+
return out;
|
|
9920
|
+
}
|
|
9921
|
+
/** Chemins Sanity (chaînes) à retirer d'un document pour en ôter l'asset. */
|
|
9922
|
+
function assetUnsetPaths(doc, assetId) {
|
|
9923
|
+
return findAssetRefPaths(doc, assetId).map(toPatchPath).filter(Boolean);
|
|
9924
|
+
}
|
|
9925
|
+
const baseId$2 = (id) => id.replace(/^drafts\./, "");
|
|
9926
|
+
/**
|
|
9927
|
+
* Suppression d'un asset depuis l'outil Assets. Sanity refuse de supprimer un
|
|
9928
|
+
* asset référencé : on retire d'abord l'asset de chaque document (le champ
|
|
9929
|
+
* devient vide), puis on supprime, dans une seule transaction.
|
|
9930
|
+
*/
|
|
9931
|
+
function useAssetDelete() {
|
|
9932
|
+
let client = useKitClient();
|
|
9933
|
+
return {
|
|
9934
|
+
usage: useCallback(async (assetId) => {
|
|
9935
|
+
let docs = await client.fetch("*[references($id)]{_id, _type, \"title\": coalesce(title, name, originalFilename, slug.current, _id)}", { id: assetId }), seen = /* @__PURE__ */ new Map();
|
|
9936
|
+
for (let doc of docs ?? []) {
|
|
9937
|
+
let id = baseId$2(doc._id);
|
|
9938
|
+
seen.has(id) || seen.set(id, {
|
|
9939
|
+
id,
|
|
9940
|
+
type: doc._type,
|
|
9941
|
+
title: doc.title ?? id
|
|
9942
|
+
});
|
|
9943
|
+
}
|
|
9944
|
+
return [...seen.values()];
|
|
9945
|
+
}, [client]),
|
|
9946
|
+
remove: useCallback(async (assetId) => {
|
|
9947
|
+
let docs = await client.fetch("*[references($id)]", { id: assetId }), transaction = client.transaction();
|
|
9948
|
+
for (let doc of docs ?? []) {
|
|
9949
|
+
let paths = assetUnsetPaths(doc, assetId);
|
|
9950
|
+
paths.length && transaction.patch(doc._id, { unset: paths });
|
|
9951
|
+
}
|
|
9952
|
+
transaction.delete(assetId), await transaction.commit({ visibility: "async" });
|
|
9953
|
+
}, [client])
|
|
9954
|
+
};
|
|
9955
|
+
}
|
|
9830
9956
|
function Metric(props) {
|
|
9831
9957
|
return /* @__PURE__ */ jsxs(Stack, {
|
|
9832
9958
|
gap: 2,
|
|
@@ -9843,7 +9969,13 @@ function Metric(props) {
|
|
|
9843
9969
|
});
|
|
9844
9970
|
}
|
|
9845
9971
|
function AssetDetail(props) {
|
|
9846
|
-
let { asset, folders, folder, onMove, onClose } = props, client = useKitClient(), [title, setTitle] = useState(asset.title ?? ""), [alt, setAlt] = useState(asset.altText ?? ""), [description, setDescription] = useState(asset.description ?? ""), [copied, setCopied] = useState(!1)
|
|
9972
|
+
let { asset, folders, folder, onMove, onClose, onDeleted } = props, client = useKitClient(), { usage, remove } = useAssetDelete(), [title, setTitle] = useState(asset.title ?? ""), [alt, setAlt] = useState(asset.altText ?? ""), [description, setDescription] = useState(asset.description ?? ""), [copied, setCopied] = useState(!1), [confirming, setConfirming] = useState(!1), [uses, setUses] = useState(null), [busy, setBusy] = useState(!1), [deleteError, setDeleteError] = useState(null), openDelete = () => {
|
|
9973
|
+
setConfirming(!0), setUses(null), setDeleteError(null), usage(asset._id).then((list) => setUses(list)).catch(() => setUses([]));
|
|
9974
|
+
}, doDelete = () => {
|
|
9975
|
+
setBusy(!0), setDeleteError(null), remove(asset._id).then(() => {
|
|
9976
|
+
setConfirming(!1), onDeleted?.(), onClose();
|
|
9977
|
+
}).catch((cause) => setDeleteError(cause instanceof Error ? cause.message : String(cause))).finally(() => setBusy(!1));
|
|
9978
|
+
};
|
|
9847
9979
|
useEffect(() => {
|
|
9848
9980
|
setTitle(asset.title ?? ""), setAlt(asset.altText ?? ""), setDescription(asset.description ?? "");
|
|
9849
9981
|
}, [
|
|
@@ -9862,7 +9994,7 @@ function AssetDetail(props) {
|
|
|
9862
9994
|
setCopied(!0), setTimeout(() => setCopied(!1), 1500);
|
|
9863
9995
|
});
|
|
9864
9996
|
};
|
|
9865
|
-
return /* @__PURE__ */
|
|
9997
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
9866
9998
|
borderLeft: !0,
|
|
9867
9999
|
height: "fill",
|
|
9868
10000
|
style: {
|
|
@@ -9871,7 +10003,7 @@ function AssetDetail(props) {
|
|
|
9871
10003
|
},
|
|
9872
10004
|
overflow: "auto",
|
|
9873
10005
|
tone: "transparent",
|
|
9874
|
-
children: /* @__PURE__ */ jsxs(Stack, {
|
|
10006
|
+
children: [/* @__PURE__ */ jsxs(Stack, {
|
|
9875
10007
|
gap: 4,
|
|
9876
10008
|
padding: 4,
|
|
9877
10009
|
children: [
|
|
@@ -10031,12 +10163,141 @@ function AssetDetail(props) {
|
|
|
10031
10163
|
}),
|
|
10032
10164
|
/* @__PURE__ */ jsx(Metric, {
|
|
10033
10165
|
label: "Ajouté",
|
|
10034
|
-
value: formatDate(asset._createdAt)
|
|
10166
|
+
value: formatDate$1(asset._createdAt)
|
|
10035
10167
|
})
|
|
10036
10168
|
]
|
|
10169
|
+
}),
|
|
10170
|
+
/* @__PURE__ */ jsx(Box, {
|
|
10171
|
+
style: { borderTop: "1px solid var(--card-border-color)" },
|
|
10172
|
+
paddingTop: 3,
|
|
10173
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
10174
|
+
icon: TrashIcon,
|
|
10175
|
+
text: "Supprimer le média",
|
|
10176
|
+
tone: "critical",
|
|
10177
|
+
mode: "ghost",
|
|
10178
|
+
fontSize: 1,
|
|
10179
|
+
onClick: openDelete,
|
|
10180
|
+
style: { width: "100%" }
|
|
10181
|
+
})
|
|
10037
10182
|
})
|
|
10038
10183
|
]
|
|
10039
|
-
})
|
|
10184
|
+
}), confirming ? /* @__PURE__ */ jsx(Dialog, {
|
|
10185
|
+
id: "asset-delete",
|
|
10186
|
+
header: "Supprimer le média",
|
|
10187
|
+
width: 1,
|
|
10188
|
+
onClose: () => busy ? void 0 : setConfirming(!1),
|
|
10189
|
+
footer: /* @__PURE__ */ jsxs(Flex, {
|
|
10190
|
+
justify: "flex-end",
|
|
10191
|
+
gap: 2,
|
|
10192
|
+
padding: 2,
|
|
10193
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
10194
|
+
text: "Annuler",
|
|
10195
|
+
mode: "bleed",
|
|
10196
|
+
disabled: busy,
|
|
10197
|
+
onClick: () => setConfirming(!1)
|
|
10198
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
10199
|
+
text: busy ? "Suppression…" : "Supprimer",
|
|
10200
|
+
tone: "critical",
|
|
10201
|
+
disabled: busy || uses === null,
|
|
10202
|
+
onClick: doDelete
|
|
10203
|
+
})]
|
|
10204
|
+
}),
|
|
10205
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
10206
|
+
padding: 4,
|
|
10207
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
10208
|
+
gap: 3,
|
|
10209
|
+
children: [
|
|
10210
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
10211
|
+
size: 1,
|
|
10212
|
+
children: [
|
|
10213
|
+
"Supprimer « ",
|
|
10214
|
+
assetName(asset),
|
|
10215
|
+
" » définitivement ?"
|
|
10216
|
+
]
|
|
10217
|
+
}),
|
|
10218
|
+
uses === null ? /* @__PURE__ */ jsxs(Flex, {
|
|
10219
|
+
align: "center",
|
|
10220
|
+
gap: 2,
|
|
10221
|
+
children: [/* @__PURE__ */ jsx(Spinner, {
|
|
10222
|
+
muted: !0,
|
|
10223
|
+
size: 1
|
|
10224
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
10225
|
+
size: 1,
|
|
10226
|
+
muted: !0,
|
|
10227
|
+
children: "Recherche des endroits où il est utilisé…"
|
|
10228
|
+
})]
|
|
10229
|
+
}) : uses.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
10230
|
+
size: 1,
|
|
10231
|
+
muted: !0,
|
|
10232
|
+
children: "Il n'est utilisé nulle part : aucune page ne sera affectée."
|
|
10233
|
+
}) : /* @__PURE__ */ jsxs(Stack, {
|
|
10234
|
+
gap: 2,
|
|
10235
|
+
children: [/* @__PURE__ */ jsxs(Text, {
|
|
10236
|
+
size: 1,
|
|
10237
|
+
weight: "medium",
|
|
10238
|
+
children: [
|
|
10239
|
+
"L'image deviendra vide à ",
|
|
10240
|
+
uses.length,
|
|
10241
|
+
" endroit",
|
|
10242
|
+
uses.length > 1 ? "s" : "",
|
|
10243
|
+
" :"
|
|
10244
|
+
]
|
|
10245
|
+
}), /* @__PURE__ */ jsx(Card, {
|
|
10246
|
+
tone: "caution",
|
|
10247
|
+
border: !0,
|
|
10248
|
+
radius: 2,
|
|
10249
|
+
padding: 3,
|
|
10250
|
+
children: /* @__PURE__ */ jsxs(Stack, {
|
|
10251
|
+
gap: 2,
|
|
10252
|
+
as: "ul",
|
|
10253
|
+
style: {
|
|
10254
|
+
margin: 0,
|
|
10255
|
+
paddingLeft: 16
|
|
10256
|
+
},
|
|
10257
|
+
children: [uses.slice(0, 20).map((use) => /* @__PURE__ */ jsxs(Text, {
|
|
10258
|
+
size: 1,
|
|
10259
|
+
as: "li",
|
|
10260
|
+
children: [
|
|
10261
|
+
use.title,
|
|
10262
|
+
" ",
|
|
10263
|
+
/* @__PURE__ */ jsxs("span", {
|
|
10264
|
+
style: { opacity: .6 },
|
|
10265
|
+
children: [
|
|
10266
|
+
"(",
|
|
10267
|
+
use.type,
|
|
10268
|
+
")"
|
|
10269
|
+
]
|
|
10270
|
+
})
|
|
10271
|
+
]
|
|
10272
|
+
}, use.id)), uses.length > 20 ? /* @__PURE__ */ jsxs(Text, {
|
|
10273
|
+
size: 1,
|
|
10274
|
+
muted: !0,
|
|
10275
|
+
as: "li",
|
|
10276
|
+
children: [
|
|
10277
|
+
"… et ",
|
|
10278
|
+
uses.length - 20,
|
|
10279
|
+
" autre",
|
|
10280
|
+
uses.length - 20 > 1 ? "s" : "",
|
|
10281
|
+
"."
|
|
10282
|
+
]
|
|
10283
|
+
}) : null]
|
|
10284
|
+
})
|
|
10285
|
+
})]
|
|
10286
|
+
}),
|
|
10287
|
+
deleteError ? /* @__PURE__ */ jsx(Card, {
|
|
10288
|
+
tone: "critical",
|
|
10289
|
+
border: !0,
|
|
10290
|
+
radius: 2,
|
|
10291
|
+
padding: 3,
|
|
10292
|
+
children: /* @__PURE__ */ jsxs(Text, {
|
|
10293
|
+
size: 1,
|
|
10294
|
+
children: ["Suppression échouée : ", deleteError]
|
|
10295
|
+
})
|
|
10296
|
+
}) : null
|
|
10297
|
+
]
|
|
10298
|
+
})
|
|
10299
|
+
})
|
|
10300
|
+
}) : null]
|
|
10040
10301
|
});
|
|
10041
10302
|
}
|
|
10042
10303
|
function AssetsTool() {
|
|
@@ -10274,19 +10535,22 @@ function AssetsTool() {
|
|
|
10274
10535
|
"."
|
|
10275
10536
|
]
|
|
10276
10537
|
})
|
|
10277
|
-
}) : view === "grid" ? /* @__PURE__ */ jsx(
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10538
|
+
}) : view === "grid" ? /* @__PURE__ */ jsx(Box, {
|
|
10539
|
+
style: {
|
|
10540
|
+
columnWidth: 200,
|
|
10541
|
+
columnGap: 12
|
|
10542
|
+
},
|
|
10543
|
+
children: visible.map((asset) => /* @__PURE__ */ jsx(Box, {
|
|
10544
|
+
style: {
|
|
10545
|
+
breakInside: "avoid",
|
|
10546
|
+
marginBottom: 12
|
|
10547
|
+
},
|
|
10548
|
+
children: /* @__PURE__ */ jsx(AssetCard, {
|
|
10549
|
+
asset,
|
|
10550
|
+
selected: selectedIds.has(asset._id),
|
|
10551
|
+
onToggleSelect: () => toggleSelect(asset._id),
|
|
10552
|
+
onOpen: () => setOpenedId(asset._id)
|
|
10553
|
+
})
|
|
10290
10554
|
}, asset._id))
|
|
10291
10555
|
}) : /* @__PURE__ */ jsx(AssetTable, {
|
|
10292
10556
|
assets: visible,
|
|
@@ -10309,11 +10573,46 @@ function AssetsTool() {
|
|
|
10309
10573
|
folders: meta.folders,
|
|
10310
10574
|
folder: folderOf(opened._id),
|
|
10311
10575
|
onMove: (folder) => meta.moveAsset(opened._id, folder),
|
|
10312
|
-
onClose: () => setOpenedId(null)
|
|
10576
|
+
onClose: () => setOpenedId(null),
|
|
10577
|
+
onDeleted: () => {
|
|
10578
|
+
setSelectedIds((prev) => {
|
|
10579
|
+
let next = new Set(prev);
|
|
10580
|
+
return next.delete(opened._id), next;
|
|
10581
|
+
}), setOpenedId(null), refresh();
|
|
10582
|
+
}
|
|
10313
10583
|
}) : null
|
|
10314
10584
|
]
|
|
10315
10585
|
});
|
|
10316
10586
|
}
|
|
10587
|
+
/**
|
|
10588
|
+
* Menu « + » du Studio en situation monolingue. Pur.
|
|
10589
|
+
*
|
|
10590
|
+
* `@sanity/document-internationalization` ajoute, pour chaque type traduit, un
|
|
10591
|
+
* template « paramétré » (`${type}-parameterized`) et un template statique par
|
|
10592
|
+
* langue (`${type}-${langue}`, p. ex. `article-fr`, titré « Français Article »).
|
|
10593
|
+
* Avec une seule langue branchée, ces deux-là font doublon avec le « + Article »
|
|
10594
|
+
* de base : le menu de création montre « + Article » ET « + Français Article ».
|
|
10595
|
+
*
|
|
10596
|
+
* On ne garde alors que la base. Avec plusieurs langues on ne touche à rien
|
|
10597
|
+
* (« + master » et « + langues » sont voulus).
|
|
10598
|
+
*
|
|
10599
|
+
* Détection sans connaître la liste des langues : le template `-parameterized`
|
|
10600
|
+
* est la signature du plugin ; s'il n'existe qu'UN statique pour ce type (et que
|
|
10601
|
+
* la base du type est bien présente), on est en monolingue pour ce type. Zéro ou
|
|
10602
|
+
* plusieurs statiques : on laisse tout, par prudence — jamais retirer la seule
|
|
10603
|
+
* façon de créer un document.
|
|
10604
|
+
*/
|
|
10605
|
+
function dropRedundantLanguageTemplates(options) {
|
|
10606
|
+
let ids = new Set(options.map((option) => option.templateId)), remove = /* @__PURE__ */ new Set();
|
|
10607
|
+
for (let { templateId } of options) {
|
|
10608
|
+
if (!templateId.endsWith("-parameterized")) continue;
|
|
10609
|
+
let base = templateId.slice(0, -14);
|
|
10610
|
+
if (!ids.has(base)) continue;
|
|
10611
|
+
let statics = options.filter((option) => option.templateId !== templateId && option.templateId.startsWith(`${base}-`)), only = statics.length === 1 ? statics[0] : void 0;
|
|
10612
|
+
only && (remove.add(templateId), remove.add(only.templateId));
|
|
10613
|
+
}
|
|
10614
|
+
return options.filter((option) => !remove.has(option.templateId));
|
|
10615
|
+
}
|
|
10317
10616
|
const store$1 = /* @__PURE__ */ new Map();
|
|
10318
10617
|
function entryFor$1(client, type, languageField, language) {
|
|
10319
10618
|
let { projectId, dataset } = client.config(), key = `${projectId}:${dataset}:${type}:${language ?? ""}`, entry = store$1.get(key);
|
|
@@ -12201,15 +12500,20 @@ const pathOf = (preview) => {
|
|
|
12201
12500
|
* titre ou adresse ; un clic ouvre la page dans l'aperçu ET son document à côté.
|
|
12202
12501
|
*/
|
|
12203
12502
|
function PagesNavigator() {
|
|
12204
|
-
let config = useKitConfig(), { rows, loading } = usePages(), params = usePresentationParams(!1), navigate = usePresentationNavigate(), i18n = config.i18n, shownLocale = localeOfPreview(params?.preview, i18n), [locale, setLocale] = useState(null), [search, setSearch] = useState(""), activeLocale = locale ?? shownLocale ?? i18n?.defaultLocale ?? "", current = pathOf(params?.preview), visible = useMemo(() => {
|
|
12503
|
+
let config = useKitConfig(), { rows, loading } = usePages(), { pageOrder, savePageOrder } = useBoardLayout(), params = usePresentationParams(!1), navigate = usePresentationNavigate(), i18n = config.i18n, shownLocale = localeOfPreview(params?.preview, i18n), [locale, setLocale] = useState(null), [search, setSearch] = useState(""), [dragId, setDragId] = useState(null), activeLocale = locale ?? shownLocale ?? i18n?.defaultLocale ?? "", current = pathOf(params?.preview), withPath = useMemo(() => rows.filter((r) => r.path !== null).sort((a, b) => (a.path ?? "").localeCompare(b.path ?? "")), [rows]), visible = useMemo(() => {
|
|
12205
12504
|
let q = search.trim().toLowerCase();
|
|
12206
|
-
return
|
|
12505
|
+
return orderByIds(withPath.filter((r) => !i18n || !activeLocale || !r.locale || r.locale === activeLocale).filter((r) => !q || r.title.toLowerCase().includes(q) || (r.path ?? "").toLowerCase().includes(q)), pageOrder);
|
|
12207
12506
|
}, [
|
|
12208
|
-
|
|
12507
|
+
withPath,
|
|
12209
12508
|
search,
|
|
12210
12509
|
activeLocale,
|
|
12211
|
-
i18n
|
|
12212
|
-
|
|
12510
|
+
i18n,
|
|
12511
|
+
pageOrder
|
|
12512
|
+
]), onReorder = (targetId) => {
|
|
12513
|
+
if (!dragId) return;
|
|
12514
|
+
let fullIds = orderByIds(withPath, pageOrder).map((r) => r.id);
|
|
12515
|
+
savePageOrder(reorderBefore(fullIds, dragId, targetId)), setDragId(null);
|
|
12516
|
+
};
|
|
12213
12517
|
return /* @__PURE__ */ jsxs(Card, {
|
|
12214
12518
|
height: "fill",
|
|
12215
12519
|
borderRight: !0,
|
|
@@ -12266,53 +12570,89 @@ function PagesNavigator() {
|
|
|
12266
12570
|
}) : /* @__PURE__ */ jsxs(Stack, {
|
|
12267
12571
|
gap: 1,
|
|
12268
12572
|
padding: 1,
|
|
12269
|
-
children: [
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
|
|
12573
|
+
children: [
|
|
12574
|
+
visible.map((row) => {
|
|
12575
|
+
let selected = current !== null && current === ((row.path ?? "").replace(/\/$/, "") || "/");
|
|
12576
|
+
return /* @__PURE__ */ jsx(Card, {
|
|
12577
|
+
as: "button",
|
|
12578
|
+
padding: 2,
|
|
12579
|
+
radius: 2,
|
|
12580
|
+
tone: selected ? "primary" : "default",
|
|
12581
|
+
pressed: selected,
|
|
12582
|
+
draggable: !0,
|
|
12583
|
+
onDragStart: (event) => {
|
|
12584
|
+
setDragId(row.id), event.dataTransfer.effectAllowed = "move";
|
|
12585
|
+
},
|
|
12586
|
+
onDragOver: (event) => {
|
|
12587
|
+
dragId && dragId !== row.id && event.preventDefault();
|
|
12588
|
+
},
|
|
12589
|
+
onDrop: (event) => {
|
|
12590
|
+
event.preventDefault(), onReorder(row.id);
|
|
12591
|
+
},
|
|
12592
|
+
onDragEnd: () => setDragId(null),
|
|
12593
|
+
style: {
|
|
12594
|
+
textAlign: "left",
|
|
12595
|
+
cursor: "pointer",
|
|
12596
|
+
border: 0,
|
|
12597
|
+
width: "100%",
|
|
12598
|
+
opacity: dragId === row.id ? .4 : 1
|
|
12599
|
+
},
|
|
12600
|
+
onClick: () => navigate(row.path ?? void 0, {
|
|
12601
|
+
type: row.type,
|
|
12602
|
+
id: row.id
|
|
12603
|
+
}),
|
|
12604
|
+
children: /* @__PURE__ */ jsxs(Flex, {
|
|
12605
|
+
align: "center",
|
|
12606
|
+
gap: 2,
|
|
12607
|
+
children: [
|
|
12608
|
+
/* @__PURE__ */ jsx(Text, {
|
|
12609
|
+
size: 1,
|
|
12610
|
+
muted: !0,
|
|
12611
|
+
style: {
|
|
12612
|
+
flex: "none",
|
|
12613
|
+
cursor: "grab"
|
|
12614
|
+
},
|
|
12615
|
+
title: "Glisser pour réordonner",
|
|
12616
|
+
children: /* @__PURE__ */ jsx(DragHandleIcon, {})
|
|
12617
|
+
}),
|
|
12618
|
+
/* @__PURE__ */ jsxs(Stack, {
|
|
12619
|
+
gap: 1,
|
|
12620
|
+
flex: 1,
|
|
12621
|
+
style: { minWidth: 0 },
|
|
12622
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
12623
|
+
size: 1,
|
|
12624
|
+
weight: selected ? "semibold" : "regular",
|
|
12625
|
+
textOverflow: "ellipsis",
|
|
12626
|
+
children: row.title || row.path
|
|
12627
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
12628
|
+
size: 0,
|
|
12629
|
+
muted: !0,
|
|
12630
|
+
textOverflow: "ellipsis",
|
|
12631
|
+
children: row.path
|
|
12632
|
+
})]
|
|
12633
|
+
}),
|
|
12634
|
+
row.status !== "published" && /* @__PURE__ */ jsx(StatusBadge, { status: row.status })
|
|
12635
|
+
]
|
|
12636
|
+
})
|
|
12637
|
+
}, row.id);
|
|
12638
|
+
}),
|
|
12639
|
+
dragId ? /* @__PURE__ */ jsx(Box, {
|
|
12273
12640
|
padding: 2,
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
style: {
|
|
12278
|
-
textAlign: "left",
|
|
12279
|
-
cursor: "pointer",
|
|
12280
|
-
border: 0,
|
|
12281
|
-
width: "100%"
|
|
12641
|
+
onDragOver: (event) => event.preventDefault(),
|
|
12642
|
+
onDrop: (event) => {
|
|
12643
|
+
event.preventDefault(), onReorder(null);
|
|
12282
12644
|
},
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
children: /* @__PURE__ */
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
children:
|
|
12291
|
-
gap: 1,
|
|
12292
|
-
flex: 1,
|
|
12293
|
-
style: { minWidth: 0 },
|
|
12294
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
12295
|
-
size: 1,
|
|
12296
|
-
weight: selected ? "semibold" : "regular",
|
|
12297
|
-
textOverflow: "ellipsis",
|
|
12298
|
-
children: row.title || row.path
|
|
12299
|
-
}), /* @__PURE__ */ jsx(Text, {
|
|
12300
|
-
size: 0,
|
|
12301
|
-
muted: !0,
|
|
12302
|
-
textOverflow: "ellipsis",
|
|
12303
|
-
children: row.path
|
|
12304
|
-
})]
|
|
12305
|
-
}), row.status !== "published" && /* @__PURE__ */ jsx(StatusBadge, { status: row.status })]
|
|
12645
|
+
style: { height: 24 }
|
|
12646
|
+
}) : null,
|
|
12647
|
+
!visible.length && /* @__PURE__ */ jsx(Box, {
|
|
12648
|
+
padding: 3,
|
|
12649
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
12650
|
+
size: 1,
|
|
12651
|
+
muted: !0,
|
|
12652
|
+
children: "No page."
|
|
12306
12653
|
})
|
|
12307
|
-
}, row.id);
|
|
12308
|
-
}), !visible.length && /* @__PURE__ */ jsx(Box, {
|
|
12309
|
-
padding: 3,
|
|
12310
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
12311
|
-
size: 1,
|
|
12312
|
-
muted: !0,
|
|
12313
|
-
children: "No page."
|
|
12314
12654
|
})
|
|
12315
|
-
|
|
12655
|
+
]
|
|
12316
12656
|
})
|
|
12317
12657
|
})]
|
|
12318
12658
|
});
|
|
@@ -12332,7 +12672,7 @@ function ncfPresentationComponents(options) {
|
|
|
12332
12672
|
return /* @__PURE__ */ jsx(KitProvider, {
|
|
12333
12673
|
config,
|
|
12334
12674
|
issues,
|
|
12335
|
-
children: /* @__PURE__ */ jsx(PagesNavigator, {})
|
|
12675
|
+
children: /* @__PURE__ */ jsx(BoardLayoutProvider, { children: /* @__PURE__ */ jsx(PagesNavigator, {}) })
|
|
12336
12676
|
});
|
|
12337
12677
|
}
|
|
12338
12678
|
return {
|
|
@@ -12344,6 +12684,681 @@ function ncfPresentationComponents(options) {
|
|
|
12344
12684
|
unstable_header: { component: NcfPresentationHeader }
|
|
12345
12685
|
};
|
|
12346
12686
|
}
|
|
12687
|
+
/** Champs d'un titre affichable d'un document référencé, par ordre de préférence. */
|
|
12688
|
+
const REFERENCE_TITLE_FIELDS = [
|
|
12689
|
+
"title",
|
|
12690
|
+
"name",
|
|
12691
|
+
"label",
|
|
12692
|
+
"heading"
|
|
12693
|
+
];
|
|
12694
|
+
/**
|
|
12695
|
+
* Colonnes tirées du schéma d'un type de collection. Aucune liste à tenir :
|
|
12696
|
+
* chaque champ scalaire, date ou référence devient une colonne proposable. Les
|
|
12697
|
+
* tableaux, images, fichiers et blocs sont écartés — rien à rendre en ligne.
|
|
12698
|
+
*/
|
|
12699
|
+
function deriveCollectionColumns(type, options = {}) {
|
|
12700
|
+
let maxDepth = options.depth ?? 1, found = /* @__PURE__ */ new Map(), add = (path, label, kind, projection) => {
|
|
12701
|
+
let key = keyForPath(path);
|
|
12702
|
+
!found.has(key) && isSafeColumnKey(key) && found.set(key, {
|
|
12703
|
+
key,
|
|
12704
|
+
label,
|
|
12705
|
+
kind,
|
|
12706
|
+
projection
|
|
12707
|
+
});
|
|
12708
|
+
}, visit = (fields, prefix, prefixLabel, depth) => {
|
|
12709
|
+
for (let field of fields) {
|
|
12710
|
+
if (!field.name || field.name.startsWith("_")) continue;
|
|
12711
|
+
let path = prefix ? `${prefix}.${field.name}` : field.name;
|
|
12712
|
+
if (!isSafeFieldPath(path)) continue;
|
|
12713
|
+
let label = prefixLabel ? `${prefixLabel} · ${labelOf(field)}` : labelOf(field), typeName = typeNameOf(field.type);
|
|
12714
|
+
if (typeName === "slug") {
|
|
12715
|
+
add(path, label, "text", `${path}.current`);
|
|
12716
|
+
continue;
|
|
12717
|
+
}
|
|
12718
|
+
if (isReference(field.type)) {
|
|
12719
|
+
let titles = REFERENCE_TITLE_FIELDS.map((f) => `${path}->${f}`);
|
|
12720
|
+
add(path, label, "reference", `coalesce(${titles.join(", ")}, ${path}->_id)`);
|
|
12721
|
+
continue;
|
|
12722
|
+
}
|
|
12723
|
+
if (isOpaque(field.type)) continue;
|
|
12724
|
+
if (typeName === "datetime" || typeName === "date") {
|
|
12725
|
+
add(path, label, "date", path);
|
|
12726
|
+
continue;
|
|
12727
|
+
}
|
|
12728
|
+
let json = jsonTypeOf(field.type);
|
|
12729
|
+
if (json === "string") {
|
|
12730
|
+
add(path, label, "text", path);
|
|
12731
|
+
continue;
|
|
12732
|
+
}
|
|
12733
|
+
if (json === "number" || json === "boolean") {
|
|
12734
|
+
add(path, label, json, path);
|
|
12735
|
+
continue;
|
|
12736
|
+
}
|
|
12737
|
+
json === "object" && depth < maxDepth && field.type?.fields?.length && visit(field.type.fields, path, label, depth + 1);
|
|
12738
|
+
}
|
|
12739
|
+
};
|
|
12740
|
+
return type?.fields?.length && visit(type.fields, "", "", 0), [...found.values()];
|
|
12741
|
+
}
|
|
12742
|
+
/** Nom du champ titre d'une collection, pour la colonne mise en avant. */
|
|
12743
|
+
function titleColumn(columns) {
|
|
12744
|
+
return columns.find((c) => c.key === "title") ?? columns.find((c) => c.kind === "text");
|
|
12745
|
+
}
|
|
12746
|
+
/**
|
|
12747
|
+
* Requête d'une collection : `_id`, `_updatedAt`, et une projection par colonne
|
|
12748
|
+
* **visible** (clé préfixée `ncfData_` pour ne jamais heurter un champ du
|
|
12749
|
+
* client). Les expressions des colonnes sont construites par le kit à partir de
|
|
12750
|
+
* chemins déjà validés (`deriveCollectionColumns`), donc sûres ; la clé est
|
|
12751
|
+
* revérifiée par prudence avant interpolation.
|
|
12752
|
+
*
|
|
12753
|
+
* Le type passe en paramètre (`$type`), jamais interpolé dans la requête.
|
|
12754
|
+
*
|
|
12755
|
+
* On ne filtre pas les brouillons : le client (perspective `raw`) renvoie
|
|
12756
|
+
* `drafts.x` ET `x`, que `buildCollectionRows` fusionne par id de base — sans
|
|
12757
|
+
* quoi un item jamais publié n'apparaîtrait pas.
|
|
12758
|
+
*/
|
|
12759
|
+
function buildCollectionQuery(columns) {
|
|
12760
|
+
return [
|
|
12761
|
+
"*[_type == $type]{",
|
|
12762
|
+
" _id, _updatedAt,",
|
|
12763
|
+
...columns.filter((column) => isSafeColumnKey(column.key)).map((column) => ` "${DATA_PREFIX}${column.key}": ${column.projection},`),
|
|
12764
|
+
"}"
|
|
12765
|
+
].join("\n");
|
|
12766
|
+
}
|
|
12767
|
+
const baseId$1 = (id) => id.startsWith("drafts.") ? id.slice(7) : id, isDraft = (id) => id.startsWith("drafts."), dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
12768
|
+
day: "2-digit",
|
|
12769
|
+
month: "2-digit",
|
|
12770
|
+
year: "numeric"
|
|
12771
|
+
});
|
|
12772
|
+
function formatDate(value) {
|
|
12773
|
+
if (typeof value != "string" || !value) return "";
|
|
12774
|
+
let date = new Date(value);
|
|
12775
|
+
return Number.isNaN(date.getTime()) ? "" : dateFormatter.format(date);
|
|
12776
|
+
}
|
|
12777
|
+
function cellOf(raw, kind) {
|
|
12778
|
+
if (raw == null) return {
|
|
12779
|
+
raw: null,
|
|
12780
|
+
text: ""
|
|
12781
|
+
};
|
|
12782
|
+
if (kind === "boolean") {
|
|
12783
|
+
let value = !!raw;
|
|
12784
|
+
return {
|
|
12785
|
+
raw: value,
|
|
12786
|
+
text: value ? "Yes" : "No"
|
|
12787
|
+
};
|
|
12788
|
+
}
|
|
12789
|
+
if (kind === "number") return typeof raw == "number" ? {
|
|
12790
|
+
raw,
|
|
12791
|
+
text: String(raw)
|
|
12792
|
+
} : {
|
|
12793
|
+
raw: null,
|
|
12794
|
+
text: ""
|
|
12795
|
+
};
|
|
12796
|
+
if (kind === "date") return {
|
|
12797
|
+
raw: typeof raw == "string" ? raw : null,
|
|
12798
|
+
text: formatDate(raw)
|
|
12799
|
+
};
|
|
12800
|
+
let text = typeof raw == "string" ? raw.trim() : String(raw);
|
|
12801
|
+
return {
|
|
12802
|
+
raw: text,
|
|
12803
|
+
text
|
|
12804
|
+
};
|
|
12805
|
+
}
|
|
12806
|
+
/**
|
|
12807
|
+
* Documents → lignes, une par item. Le client (perspective `raw`) renvoie le
|
|
12808
|
+
* brouillon ET la version publiée : on les fusionne par id de base, en gardant
|
|
12809
|
+
* le brouillon s'il existe (valeurs les plus fraîches).
|
|
12810
|
+
*/
|
|
12811
|
+
function buildCollectionRows(docs, columns) {
|
|
12812
|
+
let byId = /* @__PURE__ */ new Map();
|
|
12813
|
+
for (let doc of docs) {
|
|
12814
|
+
if (!doc?._id) continue;
|
|
12815
|
+
let entry = byId.get(baseId$1(doc._id)) ?? {};
|
|
12816
|
+
isDraft(doc._id) ? entry.draft = doc : entry.published = doc, byId.set(baseId$1(doc._id), entry);
|
|
12817
|
+
}
|
|
12818
|
+
let rows = [];
|
|
12819
|
+
for (let [id, { draft, published }] of byId) {
|
|
12820
|
+
let source = draft ?? published;
|
|
12821
|
+
if (!source) continue;
|
|
12822
|
+
let cells = {};
|
|
12823
|
+
for (let column of columns) cells[column.key] = cellOf(source[`${DATA_PREFIX}${column.key}`], column.kind);
|
|
12824
|
+
rows.push({
|
|
12825
|
+
id,
|
|
12826
|
+
updatedAt: source._updatedAt ?? null,
|
|
12827
|
+
draftOnly: !!draft && !published,
|
|
12828
|
+
cells
|
|
12829
|
+
});
|
|
12830
|
+
}
|
|
12831
|
+
return rows;
|
|
12832
|
+
}
|
|
12833
|
+
/**
|
|
12834
|
+
* Données d'une collection pour la vue table : colonnes tirées du schéma,
|
|
12835
|
+
* lignes en direct. Seules les colonnes visibles sont projetées (comme
|
|
12836
|
+
* `usePages`), pour ne pas tirer tout le schéma sur chaque document.
|
|
12837
|
+
*/
|
|
12838
|
+
function useCollection(type, visibleKeys) {
|
|
12839
|
+
let schema = useSchema(), allColumns = useMemo(() => deriveCollectionColumns(schema.get(type)), [schema, type]), visibleColumns = useMemo(() => visibleKeys.map((key) => allColumns.find((c) => c.key === key)).filter((c) => !!c), [allColumns, visibleKeys]), { data, loading, error, refresh } = useQueryData(useMemo(() => buildCollectionQuery(visibleColumns), [visibleColumns]), useMemo(() => ({ type }), [type]), { listenTypes: [type] });
|
|
12840
|
+
return {
|
|
12841
|
+
allColumns,
|
|
12842
|
+
visibleColumns,
|
|
12843
|
+
rows: useMemo(() => buildCollectionRows(data ?? [], visibleColumns), [data, visibleColumns]),
|
|
12844
|
+
loading,
|
|
12845
|
+
error,
|
|
12846
|
+
refresh
|
|
12847
|
+
};
|
|
12848
|
+
}
|
|
12849
|
+
/** Insensible à la casse et aux accents, comme la recherche de l'onglet Pages. */
|
|
12850
|
+
const normalize = (value) => value.toLocaleLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
12851
|
+
/** Compare deux valeurs non vides selon le type de la colonne. */
|
|
12852
|
+
function compareNonNull(ra, rb, kind) {
|
|
12853
|
+
return kind === "number" || kind === "boolean" ? Number(ra) - Number(rb) : kind === "date" ? String(ra).localeCompare(String(rb)) : String(ra).localeCompare(String(rb), void 0, { sensitivity: "base" });
|
|
12854
|
+
}
|
|
12855
|
+
function sortRows(rows, sort, columns) {
|
|
12856
|
+
if (!sort.key) return [...rows];
|
|
12857
|
+
let column = columns.find((c) => c.key === sort.key);
|
|
12858
|
+
if (!column) return [...rows];
|
|
12859
|
+
let dir = sort.direction === "asc" ? 1 : -1;
|
|
12860
|
+
return [...rows].sort((a, b) => {
|
|
12861
|
+
let ra = a.cells[column.key]?.raw ?? null, rb = b.cells[column.key]?.raw ?? null;
|
|
12862
|
+
return ra === null && rb === null ? 0 : ra === null ? 1 : rb === null ? -1 : dir * compareNonNull(ra, rb, column.kind);
|
|
12863
|
+
});
|
|
12864
|
+
}
|
|
12865
|
+
function filterRows(rows, filters, visibleColumns) {
|
|
12866
|
+
let search = filters.search?.trim() ? normalize(filters.search.trim()) : null, columnNeedles = Object.entries(filters.columns ?? {}).map(([key, value]) => [key, normalize(value.trim())]).filter(([, value]) => value.length > 0);
|
|
12867
|
+
return !search && columnNeedles.length === 0 ? [...rows] : rows.filter((row) => {
|
|
12868
|
+
if (search && !visibleColumns.map((c) => normalize(row.cells[c.key]?.text ?? "")).join(" ").includes(search)) return !1;
|
|
12869
|
+
for (let [key, needle] of columnNeedles) if (!normalize(row.cells[key]?.text ?? "").includes(needle)) return !1;
|
|
12870
|
+
return !0;
|
|
12871
|
+
});
|
|
12872
|
+
}
|
|
12873
|
+
/** Échappement RFC 4180 : guillemets doublés, champ cité s'il contient `,` `"` ou un saut de ligne. */
|
|
12874
|
+
function escapeField(value) {
|
|
12875
|
+
return /[",\n\r]/.test(value) ? `"${value.replace(/"/g, "\"\"")}"` : value;
|
|
12876
|
+
}
|
|
12877
|
+
/**
|
|
12878
|
+
* Lignes → CSV. En-têtes = libellés des colonnes visibles, cellules = le texte
|
|
12879
|
+
* déjà mis en forme (`row.cells[key].text`). Lignes séparées par CRLF, comme
|
|
12880
|
+
* l'attendent les tableurs. Pur : l'appelant ajoute l'éventuel BOM au moment du
|
|
12881
|
+
* téléchargement.
|
|
12882
|
+
*/
|
|
12883
|
+
function toCsv(rows, columns) {
|
|
12884
|
+
let header = columns.map((column) => escapeField(column.label)), body = rows.map((row) => columns.map((column) => escapeField(row.cells[column.key]?.text ?? "")).join(","));
|
|
12885
|
+
return [header.join(","), ...body].join("\r\n");
|
|
12886
|
+
}
|
|
12887
|
+
/**
|
|
12888
|
+
* Propose un fichier texte au téléchargement depuis le navigateur. Déclenché
|
|
12889
|
+
* par un clic de l'utilisateur (bouton « Exporter »), jamais tout seul.
|
|
12890
|
+
*
|
|
12891
|
+
* Un BOM UTF-8 est ajouté par défaut pour que les accents s'affichent dans
|
|
12892
|
+
* Excel. No-op hors navigateur (rendu serveur, tests).
|
|
12893
|
+
*/
|
|
12894
|
+
function downloadText(filename, text, mime = "text/csv;charset=utf-8", withBom = !0) {
|
|
12895
|
+
if (typeof window > "u" || typeof document > "u") return;
|
|
12896
|
+
let blob = new Blob([withBom ? `${text}` : text], { type: mime }), url = URL.createObjectURL(blob), anchor = document.createElement("a");
|
|
12897
|
+
anchor.href = url, anchor.download = filename, document.body.appendChild(anchor), anchor.click(), anchor.remove(), URL.revokeObjectURL(url);
|
|
12898
|
+
}
|
|
12899
|
+
/** Choix des colonnes affichées, sans quitter la table (façon tableur). */
|
|
12900
|
+
function CollectionColumnPicker(props) {
|
|
12901
|
+
let { columns, visible, onToggle } = props, visibleSet = useMemo(() => new Set(visible), [visible]);
|
|
12902
|
+
return /* @__PURE__ */ jsx(InlinePopover, {
|
|
12903
|
+
width: 264,
|
|
12904
|
+
trigger: ({ toggle }) => /* @__PURE__ */ jsx(Button, {
|
|
12905
|
+
mode: "bleed",
|
|
12906
|
+
fontSize: 1,
|
|
12907
|
+
padding: 2,
|
|
12908
|
+
icon: ControlsIcon,
|
|
12909
|
+
text: `Columns · ${visible.length}`,
|
|
12910
|
+
onClick: toggle
|
|
12911
|
+
}),
|
|
12912
|
+
children: () => /* @__PURE__ */ jsx(ColumnList, {
|
|
12913
|
+
columns,
|
|
12914
|
+
visibleSet,
|
|
12915
|
+
onToggle
|
|
12916
|
+
})
|
|
12917
|
+
});
|
|
12918
|
+
}
|
|
12919
|
+
function Row(props) {
|
|
12920
|
+
return /* @__PURE__ */ jsxs(Flex, {
|
|
12921
|
+
align: "center",
|
|
12922
|
+
gap: 2,
|
|
12923
|
+
padding: 2,
|
|
12924
|
+
onClick: props.onClick,
|
|
12925
|
+
style: {
|
|
12926
|
+
cursor: "pointer",
|
|
12927
|
+
borderRadius: 3
|
|
12928
|
+
},
|
|
12929
|
+
onMouseEnter: (event) => {
|
|
12930
|
+
event.currentTarget.style.background = "var(--card-muted-bg-color, rgba(127,127,127,0.12))";
|
|
12931
|
+
},
|
|
12932
|
+
onMouseLeave: (event) => {
|
|
12933
|
+
event.currentTarget.style.background = "transparent";
|
|
12934
|
+
},
|
|
12935
|
+
children: [/* @__PURE__ */ jsx(Box, {
|
|
12936
|
+
style: {
|
|
12937
|
+
width: 14,
|
|
12938
|
+
flex: "none"
|
|
12939
|
+
},
|
|
12940
|
+
children: props.checked && /* @__PURE__ */ jsx(CheckmarkIcon, { style: {
|
|
12941
|
+
fontSize: 14,
|
|
12942
|
+
opacity: .7
|
|
12943
|
+
} })
|
|
12944
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
12945
|
+
size: 1,
|
|
12946
|
+
muted: !props.checked,
|
|
12947
|
+
textOverflow: "ellipsis",
|
|
12948
|
+
children: props.label
|
|
12949
|
+
})]
|
|
12950
|
+
});
|
|
12951
|
+
}
|
|
12952
|
+
/** Au-delà d'une poignée de champs, un filtre apparaît pour en chercher un. */
|
|
12953
|
+
function ColumnList(props) {
|
|
12954
|
+
let { columns, visibleSet, onToggle } = props, [filter, setFilter] = useState(""), matches = useMemo(() => {
|
|
12955
|
+
let needle = filter.trim().toLowerCase();
|
|
12956
|
+
return needle ? columns.filter((column) => column.label.toLowerCase().includes(needle)) : columns;
|
|
12957
|
+
}, [columns, filter]);
|
|
12958
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
12959
|
+
gap: 0,
|
|
12960
|
+
children: [
|
|
12961
|
+
columns.length > 8 && /* @__PURE__ */ jsx(Box, {
|
|
12962
|
+
paddingX: 1,
|
|
12963
|
+
paddingBottom: 1,
|
|
12964
|
+
children: /* @__PURE__ */ jsx("input", {
|
|
12965
|
+
type: "text",
|
|
12966
|
+
value: filter,
|
|
12967
|
+
placeholder: "Filter…",
|
|
12968
|
+
onChange: (event) => setFilter(event.currentTarget.value),
|
|
12969
|
+
style: {
|
|
12970
|
+
width: "100%",
|
|
12971
|
+
font: "inherit",
|
|
12972
|
+
fontSize: 12,
|
|
12973
|
+
padding: "6px",
|
|
12974
|
+
borderRadius: 3,
|
|
12975
|
+
border: "1px solid var(--card-border-color, rgba(127,127,127,0.22))",
|
|
12976
|
+
background: "var(--card-bg-color)",
|
|
12977
|
+
color: "var(--card-fg-color)",
|
|
12978
|
+
outline: "none"
|
|
12979
|
+
}
|
|
12980
|
+
})
|
|
12981
|
+
}),
|
|
12982
|
+
matches.map((column) => /* @__PURE__ */ jsx(Row, {
|
|
12983
|
+
label: column.label,
|
|
12984
|
+
checked: visibleSet.has(column.key),
|
|
12985
|
+
onClick: () => onToggle(column.key)
|
|
12986
|
+
}, column.key)),
|
|
12987
|
+
matches.length === 0 && /* @__PURE__ */ jsx(Box, {
|
|
12988
|
+
padding: 2,
|
|
12989
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
12990
|
+
size: 0,
|
|
12991
|
+
muted: !0,
|
|
12992
|
+
children: "No matching fields."
|
|
12993
|
+
})
|
|
12994
|
+
})
|
|
12995
|
+
]
|
|
12996
|
+
});
|
|
12997
|
+
}
|
|
12998
|
+
/** Barre au-dessus de la table : recherche, colonnes, export CSV. */
|
|
12999
|
+
function CollectionToolbar(props) {
|
|
13000
|
+
let { search, onSearch, columns, visible, onToggleColumn, onExport, onRefresh, busy, summary } = props;
|
|
13001
|
+
return /* @__PURE__ */ jsxs(Flex, {
|
|
13002
|
+
align: "center",
|
|
13003
|
+
gap: 2,
|
|
13004
|
+
wrap: "wrap",
|
|
13005
|
+
children: [
|
|
13006
|
+
/* @__PURE__ */ jsx(Box, {
|
|
13007
|
+
style: {
|
|
13008
|
+
flex: 1,
|
|
13009
|
+
minWidth: 180
|
|
13010
|
+
},
|
|
13011
|
+
children: /* @__PURE__ */ jsx(TextInput, {
|
|
13012
|
+
icon: SearchIcon,
|
|
13013
|
+
fontSize: 1,
|
|
13014
|
+
padding: 2,
|
|
13015
|
+
radius: 2,
|
|
13016
|
+
placeholder: "Search",
|
|
13017
|
+
value: search,
|
|
13018
|
+
onChange: (event) => onSearch(event.currentTarget.value),
|
|
13019
|
+
clearButton: !!search,
|
|
13020
|
+
onClear: () => onSearch("")
|
|
13021
|
+
})
|
|
13022
|
+
}),
|
|
13023
|
+
/* @__PURE__ */ jsx(Text, {
|
|
13024
|
+
size: 1,
|
|
13025
|
+
muted: !0,
|
|
13026
|
+
style: { flex: "none" },
|
|
13027
|
+
children: summary
|
|
13028
|
+
}),
|
|
13029
|
+
/* @__PURE__ */ jsxs(Flex, {
|
|
13030
|
+
gap: 1,
|
|
13031
|
+
style: { flex: "none" },
|
|
13032
|
+
children: [
|
|
13033
|
+
/* @__PURE__ */ jsx(CollectionColumnPicker, {
|
|
13034
|
+
columns,
|
|
13035
|
+
visible,
|
|
13036
|
+
onToggle: onToggleColumn
|
|
13037
|
+
}),
|
|
13038
|
+
/* @__PURE__ */ jsx(Button, {
|
|
13039
|
+
mode: "bleed",
|
|
13040
|
+
fontSize: 1,
|
|
13041
|
+
padding: 2,
|
|
13042
|
+
icon: DownloadIcon,
|
|
13043
|
+
text: "Export CSV",
|
|
13044
|
+
onClick: onExport
|
|
13045
|
+
}),
|
|
13046
|
+
/* @__PURE__ */ jsx(Button, {
|
|
13047
|
+
mode: "bleed",
|
|
13048
|
+
fontSize: 1,
|
|
13049
|
+
padding: 2,
|
|
13050
|
+
icon: RefreshIcon,
|
|
13051
|
+
title: "Refresh",
|
|
13052
|
+
"aria-label": "Refresh",
|
|
13053
|
+
onClick: onRefresh,
|
|
13054
|
+
disabled: busy
|
|
13055
|
+
})
|
|
13056
|
+
]
|
|
13057
|
+
})
|
|
13058
|
+
]
|
|
13059
|
+
});
|
|
13060
|
+
}
|
|
13061
|
+
function defaultVisible(columns) {
|
|
13062
|
+
let title = columns.find((c) => c.key === "title") ?? columns.find((c) => c.kind === "text");
|
|
13063
|
+
return (title ? [title, ...columns.filter((c) => c !== title)] : [...columns]).slice(0, 6).map((c) => c.key);
|
|
13064
|
+
}
|
|
13065
|
+
function CollectionTable({ type }) {
|
|
13066
|
+
let router = useRouter(), [selected, setSelected] = useState(null), [sort, setSort] = useState({
|
|
13067
|
+
key: null,
|
|
13068
|
+
direction: "asc"
|
|
13069
|
+
}), [search, setSearch] = useState(""), [columnFilters, setColumnFilters] = useState({}), schema = useSchema(), allColumns = useMemo(() => deriveCollectionColumns(schema.get(type)), [schema, type]), visibleKeys = useMemo(() => selected ?? defaultVisible(allColumns), [selected, allColumns]), { visibleColumns, rows, loading, error, refresh } = useCollection(type, visibleKeys), visible = useMemo(() => sortRows(filterRows(rows, {
|
|
13070
|
+
search,
|
|
13071
|
+
columns: columnFilters
|
|
13072
|
+
}, visibleColumns), sort, visibleColumns), [
|
|
13073
|
+
rows,
|
|
13074
|
+
search,
|
|
13075
|
+
columnFilters,
|
|
13076
|
+
visibleColumns,
|
|
13077
|
+
sort
|
|
13078
|
+
]), onToggleColumn = useCallback((key) => {
|
|
13079
|
+
setSelected((current) => {
|
|
13080
|
+
let base = current ?? defaultVisible(allColumns);
|
|
13081
|
+
return base.includes(key) ? base.filter((k) => k !== key) : [...base, key];
|
|
13082
|
+
}), setColumnFilters((current) => {
|
|
13083
|
+
if (!current[key]) return current;
|
|
13084
|
+
let { [key]: _removed, ...rest } = current;
|
|
13085
|
+
return rest;
|
|
13086
|
+
});
|
|
13087
|
+
}, [allColumns]), onSort = useCallback((key) => {
|
|
13088
|
+
setSort((current) => current.key === key ? {
|
|
13089
|
+
key,
|
|
13090
|
+
direction: current.direction === "asc" ? "desc" : "asc"
|
|
13091
|
+
} : {
|
|
13092
|
+
key,
|
|
13093
|
+
direction: "asc"
|
|
13094
|
+
});
|
|
13095
|
+
}, []), onExport = useCallback(() => {
|
|
13096
|
+
downloadText(`${type}.csv`, toCsv(visible, visibleColumns));
|
|
13097
|
+
}, [
|
|
13098
|
+
type,
|
|
13099
|
+
visible,
|
|
13100
|
+
visibleColumns
|
|
13101
|
+
]), onColumnFilter = useCallback((key, value) => {
|
|
13102
|
+
setColumnFilters((current) => ({
|
|
13103
|
+
...current,
|
|
13104
|
+
[key]: value
|
|
13105
|
+
}));
|
|
13106
|
+
}, []);
|
|
13107
|
+
if (error) return /* @__PURE__ */ jsx(QueryError, {
|
|
13108
|
+
error,
|
|
13109
|
+
onRetry: refresh
|
|
13110
|
+
});
|
|
13111
|
+
let summary = visible.length === rows.length ? `${rows.length} item${rows.length > 1 ? "s" : ""}` : `${visible.length} of ${rows.length}`, grid = {
|
|
13112
|
+
display: "grid",
|
|
13113
|
+
gridTemplateColumns: visibleColumns.map((_, index) => index === 0 ? "minmax(200px, 1.6fr)" : "minmax(150px, 1fr)").join(" "),
|
|
13114
|
+
gap: "0.875rem",
|
|
13115
|
+
alignItems: "center"
|
|
13116
|
+
};
|
|
13117
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
13118
|
+
gap: 4,
|
|
13119
|
+
children: [/* @__PURE__ */ jsx(CollectionToolbar, {
|
|
13120
|
+
search,
|
|
13121
|
+
onSearch: setSearch,
|
|
13122
|
+
columns: allColumns,
|
|
13123
|
+
visible: visibleKeys,
|
|
13124
|
+
onToggleColumn,
|
|
13125
|
+
onExport,
|
|
13126
|
+
onRefresh: refresh,
|
|
13127
|
+
busy: loading,
|
|
13128
|
+
summary
|
|
13129
|
+
}), loading && rows.length === 0 ? /* @__PURE__ */ jsxs(Flex, {
|
|
13130
|
+
align: "center",
|
|
13131
|
+
justify: "center",
|
|
13132
|
+
padding: 6,
|
|
13133
|
+
gap: 3,
|
|
13134
|
+
children: [/* @__PURE__ */ jsx(Spinner, { muted: !0 }), /* @__PURE__ */ jsx(Text, {
|
|
13135
|
+
size: 1,
|
|
13136
|
+
muted: !0,
|
|
13137
|
+
children: "Loading…"
|
|
13138
|
+
})]
|
|
13139
|
+
}) : visibleColumns.length === 0 ? /* @__PURE__ */ jsx(Box, {
|
|
13140
|
+
padding: 5,
|
|
13141
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13142
|
+
size: 1,
|
|
13143
|
+
muted: !0,
|
|
13144
|
+
align: "center",
|
|
13145
|
+
children: "No displayable field in this type. Pick columns above."
|
|
13146
|
+
})
|
|
13147
|
+
}) : /* @__PURE__ */ jsx(Box, {
|
|
13148
|
+
style: {
|
|
13149
|
+
overflowX: "auto",
|
|
13150
|
+
border: `1px solid ${BORDER_SOFT}`,
|
|
13151
|
+
borderRadius: 6
|
|
13152
|
+
},
|
|
13153
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
13154
|
+
style: { minWidth: "min-content" },
|
|
13155
|
+
children: [
|
|
13156
|
+
/* @__PURE__ */ jsx(Box, {
|
|
13157
|
+
paddingX: 3,
|
|
13158
|
+
paddingY: 2,
|
|
13159
|
+
style: {
|
|
13160
|
+
...grid,
|
|
13161
|
+
alignItems: "end",
|
|
13162
|
+
borderBottom: `1px solid ${BORDER}`,
|
|
13163
|
+
position: "sticky",
|
|
13164
|
+
top: 0,
|
|
13165
|
+
background: "var(--card-bg-color, inherit)",
|
|
13166
|
+
zIndex: 2
|
|
13167
|
+
},
|
|
13168
|
+
children: visibleColumns.map((column) => {
|
|
13169
|
+
let active = sort.key === column.key, Arrow = sort.direction === "asc" ? ChevronUpIcon : ChevronDownIcon;
|
|
13170
|
+
return /* @__PURE__ */ jsxs(Stack, {
|
|
13171
|
+
gap: 2,
|
|
13172
|
+
style: CELL,
|
|
13173
|
+
children: [/* @__PURE__ */ jsxs(Flex, {
|
|
13174
|
+
align: "center",
|
|
13175
|
+
gap: 1,
|
|
13176
|
+
onClick: () => onSort(column.key),
|
|
13177
|
+
style: {
|
|
13178
|
+
cursor: "pointer",
|
|
13179
|
+
userSelect: "none"
|
|
13180
|
+
},
|
|
13181
|
+
title: `Sort by ${column.label.toLowerCase()}`,
|
|
13182
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
13183
|
+
size: 0,
|
|
13184
|
+
weight: "medium",
|
|
13185
|
+
muted: !active,
|
|
13186
|
+
textOverflow: "ellipsis",
|
|
13187
|
+
children: column.label
|
|
13188
|
+
}), active && /* @__PURE__ */ jsx(Arrow, { style: {
|
|
13189
|
+
fontSize: 13,
|
|
13190
|
+
opacity: .7,
|
|
13191
|
+
flex: "none"
|
|
13192
|
+
} })]
|
|
13193
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
13194
|
+
type: "text",
|
|
13195
|
+
value: columnFilters[column.key] ?? "",
|
|
13196
|
+
placeholder: "Filter…",
|
|
13197
|
+
onChange: (event) => onColumnFilter(column.key, event.currentTarget.value),
|
|
13198
|
+
style: {
|
|
13199
|
+
width: "100%",
|
|
13200
|
+
font: "inherit",
|
|
13201
|
+
fontSize: 11,
|
|
13202
|
+
padding: "3px 6px",
|
|
13203
|
+
borderRadius: 3,
|
|
13204
|
+
border: `1px solid ${BORDER_SOFT}`,
|
|
13205
|
+
background: "var(--card-bg-color)",
|
|
13206
|
+
color: "var(--card-fg-color)",
|
|
13207
|
+
outline: "none"
|
|
13208
|
+
}
|
|
13209
|
+
})]
|
|
13210
|
+
}, column.key);
|
|
13211
|
+
})
|
|
13212
|
+
}),
|
|
13213
|
+
visible.map((row) => /* @__PURE__ */ jsx(CollectionRowView, {
|
|
13214
|
+
row,
|
|
13215
|
+
columns: visibleColumns,
|
|
13216
|
+
grid,
|
|
13217
|
+
onOpen: () => router.navigateIntent("edit", {
|
|
13218
|
+
id: row.id,
|
|
13219
|
+
type
|
|
13220
|
+
})
|
|
13221
|
+
}, row.id)),
|
|
13222
|
+
visible.length === 0 && /* @__PURE__ */ jsx(Box, {
|
|
13223
|
+
padding: 5,
|
|
13224
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
13225
|
+
size: 1,
|
|
13226
|
+
muted: !0,
|
|
13227
|
+
align: "center",
|
|
13228
|
+
children: rows.length === 0 ? "No item yet." : "No match."
|
|
13229
|
+
})
|
|
13230
|
+
})
|
|
13231
|
+
]
|
|
13232
|
+
})
|
|
13233
|
+
})]
|
|
13234
|
+
});
|
|
13235
|
+
}
|
|
13236
|
+
function CollectionRowView(props) {
|
|
13237
|
+
let { row, columns, grid, onOpen } = props, [hovered, setHovered] = useState(!1);
|
|
13238
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
13239
|
+
paddingX: 3,
|
|
13240
|
+
paddingY: 2,
|
|
13241
|
+
onClick: onOpen,
|
|
13242
|
+
onMouseEnter: () => setHovered(!0),
|
|
13243
|
+
onMouseLeave: () => setHovered(!1),
|
|
13244
|
+
style: {
|
|
13245
|
+
...grid,
|
|
13246
|
+
cursor: "pointer",
|
|
13247
|
+
borderBottom: `1px solid ${BORDER_SOFT}`,
|
|
13248
|
+
background: hovered ? "var(--card-muted-bg-color, rgba(127,127,127,0.08))" : "transparent"
|
|
13249
|
+
},
|
|
13250
|
+
children: columns.map((column, index) => {
|
|
13251
|
+
let cell = row.cells[column.key], empty = !cell || cell.raw === null || cell.text === "";
|
|
13252
|
+
return /* @__PURE__ */ jsxs(Flex, {
|
|
13253
|
+
align: "center",
|
|
13254
|
+
gap: 2,
|
|
13255
|
+
style: CELL,
|
|
13256
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
13257
|
+
size: 1,
|
|
13258
|
+
muted: empty,
|
|
13259
|
+
weight: index === 0 ? "medium" : "regular",
|
|
13260
|
+
textOverflow: "ellipsis",
|
|
13261
|
+
style: {
|
|
13262
|
+
flex: 1,
|
|
13263
|
+
minWidth: 0,
|
|
13264
|
+
...column.kind === "number" || column.kind === "date" ? TABULAR : null
|
|
13265
|
+
},
|
|
13266
|
+
children: empty ? "—" : cell.text
|
|
13267
|
+
}), index === 0 && row.draftOnly && /* @__PURE__ */ jsx(Badge, {
|
|
13268
|
+
tone: "caution",
|
|
13269
|
+
fontSize: 0,
|
|
13270
|
+
style: { flex: "none" },
|
|
13271
|
+
children: "Draft"
|
|
13272
|
+
})]
|
|
13273
|
+
}, column.key);
|
|
13274
|
+
})
|
|
13275
|
+
});
|
|
13276
|
+
}
|
|
13277
|
+
const isReserved = (name) => name.startsWith("sanity.") || name.startsWith("_");
|
|
13278
|
+
/**
|
|
13279
|
+
* Types de collection retenus.
|
|
13280
|
+
*
|
|
13281
|
+
* - `include` fournie → on respecte cette liste (dans son ordre), en gardant
|
|
13282
|
+
* seulement ce qui est un type de document connu et hors `exclude`.
|
|
13283
|
+
* - sinon → tous les types de documents, moins `exclude` et les types réservés,
|
|
13284
|
+
* triés par nom pour une liste stable.
|
|
13285
|
+
*/
|
|
13286
|
+
function discoverCollectionTypes(types, options = {}) {
|
|
13287
|
+
let excluded = new Set(options.exclude ?? []), documents = new Set(types.filter((t) => t.jsonType === "document").map((t) => t.name));
|
|
13288
|
+
if (options.include?.length) {
|
|
13289
|
+
let seen = /* @__PURE__ */ new Set();
|
|
13290
|
+
return options.include.filter((name) => seen.has(name) || excluded.has(name) || !documents.has(name) ? !1 : (seen.add(name), !0));
|
|
13291
|
+
}
|
|
13292
|
+
return [...documents].filter((name) => !excluded.has(name) && !isReserved(name)).sort((a, b) => a.localeCompare(b));
|
|
13293
|
+
}
|
|
13294
|
+
/**
|
|
13295
|
+
* Composant de panneau pour une collection. Le type arrive par les `options`
|
|
13296
|
+
* du pane de structure ; la configuration est fermée par la fabrique (elle
|
|
13297
|
+
* n'est pas sérialisable dans les options).
|
|
13298
|
+
*/
|
|
13299
|
+
function createCollectionPane(config, issues) {
|
|
13300
|
+
return function NcfCollectionPane(props) {
|
|
13301
|
+
let type = typeof props.options?.type == "string" ? props.options.type : "";
|
|
13302
|
+
return /* @__PURE__ */ jsx(KitProvider, {
|
|
13303
|
+
config,
|
|
13304
|
+
issues,
|
|
13305
|
+
children: /* @__PURE__ */ jsx(Box, {
|
|
13306
|
+
padding: 3,
|
|
13307
|
+
height: "fill",
|
|
13308
|
+
overflow: "auto",
|
|
13309
|
+
children: type ? /* @__PURE__ */ jsx(CollectionTable, { type }) : null
|
|
13310
|
+
})
|
|
13311
|
+
});
|
|
13312
|
+
};
|
|
13313
|
+
}
|
|
13314
|
+
/**
|
|
13315
|
+
* Vue table d'UNE collection, à utiliser comme enfant d'une entrée de structure
|
|
13316
|
+
* pour que cliquer la collection ouvre la table (au lieu de la liste native) :
|
|
13317
|
+
*
|
|
13318
|
+
* ```ts
|
|
13319
|
+
* S.listItem().title('Articles').child(ncfCollectionTable(S, ncfOptions, 'article'))
|
|
13320
|
+
* ```
|
|
13321
|
+
*/
|
|
13322
|
+
function ncfCollectionTable(S, options, type, opts = {}) {
|
|
13323
|
+
let config = resolveConfig(options), pane = createCollectionPane(config, validateConfig(config));
|
|
13324
|
+
return S.component(pane).id(`ncf-collection-${type}`).title(opts.title ?? type).options({ type });
|
|
13325
|
+
}
|
|
13326
|
+
/** Libellé d'une entrée de collection : config, puis titre du schéma, puis nom humanisé. */
|
|
13327
|
+
function labelFor(type, config, schemaTitle) {
|
|
13328
|
+
return config.collections.labels[type] ?? schemaTitle ?? humanise(type);
|
|
13329
|
+
}
|
|
13330
|
+
/** Types toujours écartés de la découverte, en plus de l'`exclude` du projet. */
|
|
13331
|
+
function reservedExcludes(config) {
|
|
13332
|
+
return [
|
|
13333
|
+
...config.pageTypeNames,
|
|
13334
|
+
config.redirectType,
|
|
13335
|
+
config.componentPreview.defaultsType,
|
|
13336
|
+
...NCF_HIDDEN_TYPES,
|
|
13337
|
+
...config.collections.exclude
|
|
13338
|
+
].filter(Boolean);
|
|
13339
|
+
}
|
|
13340
|
+
/**
|
|
13341
|
+
* Entrées « collection » pour la structure du Studio, une par type découvert,
|
|
13342
|
+
* chacune ouvrant la vue table. À épandre dans la liste racine :
|
|
13343
|
+
*
|
|
13344
|
+
* ```ts
|
|
13345
|
+
* structure: (S, context) =>
|
|
13346
|
+
* S.list().title('Contenu').items([..., ...ncfCollections(S, context, ncfOptions)])
|
|
13347
|
+
* ```
|
|
13348
|
+
*/
|
|
13349
|
+
function ncfCollections(S, context, options) {
|
|
13350
|
+
let config = resolveConfig(options);
|
|
13351
|
+
return discoverCollectionTypes(context.schema.getTypeNames().map((name) => ({
|
|
13352
|
+
name,
|
|
13353
|
+
jsonType: context.schema.get(name)?.jsonType
|
|
13354
|
+
})), {
|
|
13355
|
+
include: config.collections.include,
|
|
13356
|
+
exclude: reservedExcludes(config)
|
|
13357
|
+
}).map((type) => {
|
|
13358
|
+
let schemaType = context.schema.get(type), label = labelFor(type, config, schemaType?.title), item = S.listItem().id(`ncf-collection-${type}`).title(label).child(ncfCollectionTable(S, options, type, { title: label }));
|
|
13359
|
+
return schemaType?.icon ? item.icon(schemaType.icon) : item;
|
|
13360
|
+
});
|
|
13361
|
+
}
|
|
12347
13362
|
const SAFE = /^[A-Za-z0-9_.-]+$/, quote = (value) => JSON.stringify(value);
|
|
12348
13363
|
/**
|
|
12349
13364
|
* Presentation : le document du panneau de droite est TOUJOURS celui de la page
|
|
@@ -12521,7 +13536,7 @@ const ncfKit = definePlugin((options) => {
|
|
|
12521
13536
|
templates: (prev) => prev.filter((template) => !isKitType(template.schemaType))
|
|
12522
13537
|
},
|
|
12523
13538
|
document: {
|
|
12524
|
-
newDocumentOptions: (prev) => prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE),
|
|
13539
|
+
newDocumentOptions: (prev) => dropRedundantLanguageTemplates(prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE)),
|
|
12525
13540
|
actions: (prev, context) => config.pageTypeNames.includes(context.schemaType) ? prev.map((action) => action.action === "unpublish" ? config.i18n ? createRemoveFromSite(config) : RemoveFromSiteAction : action.action === "publish" ? addJsonLd(config.i18n ? withTranslationRedirects(withPropagation(action, config, void 0, { allowCreate: !0 }), config) : action) : action.action === "delete" && config.i18n ? withTranslationDelete(action, config) : action) : context.schemaType === config.componentPreview.defaultsType && config.i18n ? prev.map((action) => action.action === "publish" ? withPropagation(action, config, config.i18n?.defaultsSourceLocale) : action.action === "delete" ? withTranslationDelete(action, config, config.i18n?.defaultsSourceLocale) : action) : config.i18n && !isKitType(context.schemaType) && hasLanguageField(context.schema.get(context.schemaType), config.i18n.field) ? prev.map((action) => action.action === "publish" ? withPropagation(action, config, void 0, { allowCreate: !0 }) : action.action === "delete" ? withTranslationDelete(action, config) : action.action === "unpublish" ? createRemoveFromSite(config) : action) : prev
|
|
12526
13541
|
},
|
|
12527
13542
|
studio: { components: {
|
|
@@ -12542,6 +13557,6 @@ function hasLanguageField(schemaType, field) {
|
|
|
12542
13557
|
let fields = schemaType?.fields;
|
|
12543
13558
|
return Array.isArray(fields) && fields.some((f) => f?.name === field);
|
|
12544
13559
|
}
|
|
12545
|
-
export { ANNOTATION_TYPE, ActorName, AssetSourceBrowser, AssetsTool, BOARD_LAYOUT_ID, BOARD_LAYOUT_TYPE, BRAIN_NODE_SIZE, BoardLayoutProvider, COLUMN_TYPE, CONTENT_SCAN_LIMIT, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, CUSTOM_ENVIRONMENT_ID, CodeEditorInput, CodeEmbedInput, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_DEFAULTS_TYPE, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, HelpTextStyle, KIT_API_VERSION, KIT_VERSION, NCF_ASSETS_TOOL, NCF_COMPONENTS_TOOL, NCF_DESIGN_SYSTEM_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, addColumn, addColumnOption, announce, applySavedPositions, assetName, assetsInFolder, assignmentMap, baseId, blockName, blockTypesFromSchema, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, codeEditorInput, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, countByFolder, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, depth, deriveDocumentColumns, detectPageBuilderField, diffDocuments, diffWords, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterAssets, filterRows, fixCrossLanguageReferences, flatten, formatBytes, formatDocumentValue, groupComponents, groupMap, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isImageAsset, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, nameMap, ncfAllowedOrigins, ncfKit, ncfMainDocuments, ncfPresentationComponents, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, resolvePageBuilderField, sectionNamesFromDefaults, segments, slugKey, sortAssets, sortRows, summarize, thumbnailUrl, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useAssetMeta, useAssetUpload, useAssets, useBoardLayout, useComponentNames, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, useOptionalKitConfig, useOptionalKitContext, usePageBuilder, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withCustomNames, withMoreTool, withSameLanguageReferences };
|
|
13560
|
+
export { ANNOTATION_TYPE, ActorName, AssetSourceBrowser, AssetsTool, BOARD_LAYOUT_ID, BOARD_LAYOUT_TYPE, BRAIN_NODE_SIZE, BoardLayoutProvider, COLUMN_TYPE, CONTENT_SCAN_LIMIT, CONTENT_SCAN_LIMIT as OCCURRENCE_SCAN_LIMIT, CUSTOM_ENVIRONMENT_ID, CodeEditorInput, CodeEmbedInput, CollectionTable, DATA_PREFIX, DEFAULT_BOARD_TAGS, DEFAULT_COMPONENT_DEFAULTS_TYPE, DEFAULT_COMPONENT_PREVIEW, DEFAULT_I18N, DEFAULT_INTERNAL_FIELDS, DEFAULT_MORE_TOOLS, DEFAULT_PAGE_BUILDER_FIELD, DEFAULT_SLUG_FIELD, DEFAULT_TITLE_FIELD, HelpTextStyle, KIT_API_VERSION, KIT_VERSION, NCF_ASSETS_TOOL, NCF_COMPONENTS_TOOL, NCF_DESIGN_SYSTEM_TOOL, NCF_HIDDEN_TYPES, NCF_HISTORY_TOOL, NCF_MORE_TOOL, NCF_PAGES_TOOL, NCF_TOOL_NAMES, NODE_FIELD_TYPE, NODE_HEIGHT, NODE_WIDTH, NcfKitUpdate, NcfPreviewHeader, NcfPreviewLauncher, PERSPECTIVES, PROJECTION, SECTION_NODE_TYPE, STATUS_COLORS, STATUS_LABELS, SharePreview, UNSET_LABEL, addColumn, addColumnOption, announce, applySavedPositions, assetName, assetsInFolder, assignmentMap, baseId, blockName, blockTypesFromSchema, buildCollectionQuery, buildCollectionRows, buildContentsQuery, buildLinkGraph, buildPageRows, buildPagesQuery, codeEditorInput, collectLinks, collectOccurrences, colorForRow, colorFromString, columnId, compareVersions, componentDefaultsMainDocument, componentDefaultsMainDocuments, countByFolder, createPreviewLauncher, customEnvironment, defaultNodeSize, defaultsFieldName, defineCodeEmbedType, defineComponentDefaults, depth, deriveCollectionColumns, deriveDocumentColumns, detectPageBuilderField, diffDocuments, diffWords, discoverCollectionTypes, downloadText, editIntentPath, explainGrantError, fallbackLayout, fetchDetail, fetchTimeline, fillTemplate, filterAssets, filterRows as filterCollectionRows, filterRows$1 as filterRows, fixCrossLanguageReferences, flatten, formatBytes, formatDocumentValue, groupComponents, groupMap, groupPageRows, groupValue, hasBlockingIssue, humanizeBlockName, isDraftId, isImageAsset, isKitType, isPrerelease, isSafeColumnKey, isSafeFieldPath, isTextChange, isVersionId, issuesForTool, keyForPath, kitSchemaTypes, layoutGraph, layoutSectionsMap, localesInRows, mergeVersions, missingPageTypes, moveColumn, nameMap, ncfAllowedOrigins, ncfCollectionTable, ncfCollections, ncfKit, ncfMainDocuments, ncfPresentationComponents, ncfPreviewComponents, normalizeInternalPath, normalizePath, occurrencesForTypes, pageThumbnailUrl, pageTypeFor, pageTypesFromSiteRoutes, pageTypesWithoutBuilder, parentPath, presentationPath, pruneSavedPositions, releaseId, removeColumn, renameColumn, requestPreviewGrant, requiredUnlessDefault, requiredUnlessDefaultFor, resolveColorBy, resolveConfig, resolvePageBuilderField, sectionNamesFromDefaults, segments, slugKey, sortAssets, sortRows as sortCollectionRows, sortRows$1 as sortRows, summarize, thumbnailUrl, titleColumn, toCsv, toKebabCase, toPath, toUrl, topLevelBlockCount, uniqueColumnId, upsertLayout, urlOn, useAnnotations, useAssetMeta, useAssetUpload, useAssets, useBoardLayout, useCollection, useComponentNames, useDocumentColumns, useHistory, useInternalColumns, useKitClient, useKitConfig, useKitContext, useKitUpdate, useOccurrences, useOptionalKitConfig, useOptionalKitContext, usePageBuilder, usePageContents, usePages, usePreviewTarget, useRegistration, validateConfig, withAlpha, withCustomNames, withMoreTool, withSameLanguageReferences };
|
|
12546
13561
|
|
|
12547
13562
|
//# sourceMappingURL=index.js.map
|