@nocode-factory/sanity-kit 2.52.0 → 2.53.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/dist/index.js CHANGED
@@ -50,6 +50,7 @@ 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";
@@ -566,6 +567,12 @@ const TRANSLATION_TODO_TYPE = "ncfTranslationTodo", translationTodoId = (documen
566
567
  type: "array",
567
568
  of: [{ type: SECTION_NODE_TYPE }]
568
569
  }),
570
+ defineField({
571
+ name: "pageOrder",
572
+ title: "Manual page order",
573
+ type: "array",
574
+ of: [{ type: "string" }]
575
+ }),
569
576
  defineField({
570
577
  name: "updatedBy",
571
578
  title: "Modified by",
@@ -845,10 +852,10 @@ const fieldsFromStored = (stored) => {
845
852
  * instance fournie par `BoardLayoutProvider`.
846
853
  */
847
854
  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);
855
+ 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
856
  useEffect(() => {
850
857
  let cancelled = !1;
851
- return client.fetch("*[_id == $id][0]{nodes, sections, columns, columnsSet, annotations}", { id: BOARD_LAYOUT_ID }).then((doc) => {
858
+ return client.fetch("*[_id == $id][0]{nodes, sections, columns, columnsSet, annotations, pageOrder}", { id: BOARD_LAYOUT_ID }).then((doc) => {
852
859
  cancelled || (setLayout(clean(doc?.nodes ?? [])), setSections((doc?.sections ?? []).map(({ blockName, x, y }) => ({
853
860
  blockName,
854
861
  x,
@@ -862,9 +869,9 @@ function useBoardLayoutState() {
862
869
  label: ol,
863
870
  ...color ? { color } : {}
864
871
  })) } : {}
865
- }))), setColumnsSet(!!doc?.columnsSet), setAnnotations((doc?.annotations ?? []).map(({ _key, ...rest }) => ({ ...rest }))));
872
+ }))), setColumnsSet(!!doc?.columnsSet), setAnnotations((doc?.annotations ?? []).map(({ _key, ...rest }) => ({ ...rest }))), setPageOrder(Array.isArray(doc?.pageOrder) ? doc.pageOrder.filter((id) => typeof id == "string") : []));
866
873
  }).catch(() => {
867
- cancelled || (setLayout([]), setSections([]), setColumns([]), setColumnsSet(!1), setAnnotations([]));
874
+ cancelled || (setLayout([]), setSections([]), setColumns([]), setColumnsSet(!1), setAnnotations([]), setPageOrder([]));
868
875
  }).finally(() => {
869
876
  cancelled || setLoading(!1);
870
877
  }), () => {
@@ -875,10 +882,10 @@ function useBoardLayoutState() {
875
882
  useEffect(() => () => {
876
883
  timer.current && clearTimeout(timer.current);
877
884
  }, []);
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;
885
+ let layoutRef = useRef([]), sectionsRef = useRef([]), columnsRef = useRef([]), columnsSetRef = useRef(!1), annotationsRef = useRef([]), pageOrderRef = useRef([]);
886
+ layoutRef.current = layout, sectionsRef.current = sections, columnsRef.current = columns, columnsSetRef.current = columnsSet, annotationsRef.current = annotations, pageOrderRef.current = pageOrder;
880
887
  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;
888
+ 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
889
  client.createOrReplace({
883
890
  _id: BOARD_LAYOUT_ID,
884
891
  _type: BOARD_LAYOUT_TYPE,
@@ -909,6 +916,7 @@ function useBoardLayoutState() {
909
916
  }))
910
917
  })),
911
918
  columnsSet: nextColumnsSet,
919
+ pageOrder: nextPageOrder,
912
920
  annotations: nextAnnotations.map((annotation) => ({
913
921
  _key: annotation.id,
914
922
  _type: "ncfAnnotation",
@@ -963,6 +971,9 @@ function useBoardLayoutState() {
963
971
  setAnnotations(value), timer.current && clearTimeout(timer.current), timer.current = setTimeout(() => write({ annotations: value }), 800);
964
972
  }, [write]), resetSections = useCallback(() => {
965
973
  timer.current && clearTimeout(timer.current), setSections([]), write({ sections: [] });
974
+ }, [write]), savePageOrder = useCallback((ids) => {
975
+ let value = [...ids];
976
+ setPageOrder(value), timer.current && clearTimeout(timer.current), timer.current = setTimeout(() => write({ pageOrder: value }), 800);
966
977
  }, [write]), sectionsByName = useMemo(() => new Map(sections.map((entry) => [entry.blockName, entry])), [sections]);
967
978
  return {
968
979
  layout,
@@ -980,6 +991,8 @@ function useBoardLayoutState() {
980
991
  saveColumns,
981
992
  annotations,
982
993
  saveAnnotations,
994
+ pageOrder,
995
+ savePageOrder,
983
996
  reset,
984
997
  resetSections
985
998
  };
@@ -1407,7 +1420,7 @@ function explainGrantError(error) {
1407
1420
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
1408
1421
  * le vérifie.
1409
1422
  */
1410
- const KIT_VERSION = "2.52.0";
1423
+ const KIT_VERSION = "2.53.0";
1411
1424
  /**
1412
1425
  * Signale ce Studio au service du kit, une fois par montage.
1413
1426
  *
@@ -1905,7 +1918,7 @@ function useKitUpdate() {
1905
1918
  !controller.signal.aborted && body?.version && setLatest(body.version);
1906
1919
  }).catch(() => {}), () => controller.abort();
1907
1920
  }, []);
1908
- let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.52.0") > 0);
1921
+ let available = !!(latest && !isPrerelease(latest) && compareVersions(latest, "2.53.0") > 0);
1909
1922
  return {
1910
1923
  current: KIT_VERSION,
1911
1924
  latest,
@@ -2463,6 +2476,39 @@ function buildContentsQuery(config, limit) {
2463
2476
  ].join("\n");
2464
2477
  }
2465
2478
  /**
2479
+ * Ordre manuel des pages, partagé par le navigateur de Presentation et l'onglet
2480
+ * Pages. Stocké comme une liste d'ids (board singleton `pageOrder`). Pur.
2481
+ */
2482
+ /**
2483
+ * Ordonne des éléments par la liste d'ids `order` : ceux présents d'abord (dans
2484
+ * l'ordre de `order`), les autres ensuite dans leur ordre d'entrée (donc une
2485
+ * page nouvelle, absente de l'ordre manuel, apparaît à la fin).
2486
+ */
2487
+ function orderByIds(items, order) {
2488
+ if (order.length === 0) return [...items];
2489
+ let rank = new Map(order.map((id, index) => [id, index]));
2490
+ return [...items].sort((a, b) => {
2491
+ let ra = rank.get(a.id), rb = rank.get(b.id);
2492
+ return ra === void 0 && rb === void 0 ? 0 : ra === void 0 ? 1 : rb === void 0 ? -1 : ra - rb;
2493
+ });
2494
+ }
2495
+ /**
2496
+ * Déplace `dragged` juste avant `target` dans la séquence d'ids `ordered`
2497
+ * (l'ordre courant complet). `target` null = place en fin. Filtre-sûr : on
2498
+ * travaille sur les ids, pas sur une vue filtrée.
2499
+ */
2500
+ function reorderBefore(ordered, dragged, target) {
2501
+ if (dragged === target) return [...ordered];
2502
+ let without = ordered.filter((id) => id !== dragged);
2503
+ if (target === null) return [...without, dragged];
2504
+ let index = without.indexOf(target);
2505
+ return index < 0 ? [...without, dragged] : [
2506
+ ...without.slice(0, index),
2507
+ dragged,
2508
+ ...without.slice(index)
2509
+ ];
2510
+ }
2511
+ /**
2466
2512
  * Met une valeur du document en forme pour une cellule.
2467
2513
  *
2468
2514
  * Ce qui ne tient pas sur une ligne — un objet, un tableau de sections — n'est
@@ -2516,6 +2562,10 @@ const STATUS_ORDER = {
2516
2562
  }
2517
2563
  };
2518
2564
  function sortRows(rows, key, direction, options = {}) {
2565
+ if (key === "manual") {
2566
+ let sorted = orderByIds([...rows].sort((a, b) => a.title.localeCompare(b.title, void 0, { sensitivity: "base" })), options.pageOrder ?? []);
2567
+ return direction === "asc" ? sorted : sorted.reverse();
2568
+ }
2519
2569
  let sorted = [...rows].sort((a, b) => compare(a, b, key, options));
2520
2570
  return direction === "asc" ? sorted : sorted.reverse();
2521
2571
  }
@@ -3278,7 +3328,7 @@ const VALUE_TYPE_NAMES = /* @__PURE__ */ new Set([
3278
3328
  "datetime",
3279
3329
  "number",
3280
3330
  "boolean"
3281
- ]), SKIP_KEYS = /* @__PURE__ */ new Set(["language", "slug"]), isObj$1 = (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$1(i) && typeof i._key == "string");
3331
+ ]), 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
3332
  function typeNames(t) {
3283
3333
  let out = [];
3284
3334
  for (let c = t; c; c = c.type) c.name && out.push(c.name);
@@ -3298,7 +3348,7 @@ function kindOf(t, value) {
3298
3348
  }
3299
3349
  return t.jsonType === "object" ? "object" : t.jsonType === "string" ? t.options?.list?.length ? "value" : "text" : "value";
3300
3350
  }
3301
- return keyed$1(value) ? "list" : isObj$1(value) ? "object" : "value";
3351
+ return keyed$1(value) ? "list" : isObj$2(value) ? "object" : "value";
3302
3352
  }
3303
3353
  function fieldType(t, name) {
3304
3354
  for (let c = t; c; c = c.type) {
@@ -3315,8 +3365,8 @@ function itemType(t, item) {
3315
3365
  function collectTexts(value, t, path, acc) {
3316
3366
  let kind = kindOf(t, value);
3317
3367
  if (kind === "text") value != null && value !== "" && acc.toTranslate.push(path);
3318
- else if (kind === "object" && isObj$1(value)) for (let [k, v] of Object.entries(value)) k.startsWith("_") || collectTexts(v, fieldType(t, k), `${path}.${k}`, acc);
3319
- else if (kind === "list" && Array.isArray(value)) for (let item of value) isObj$1(item) && collectTexts(item, itemType(t, item), `${path}[${String(item._key)}]`, acc);
3368
+ 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);
3369
+ 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
3370
  }
3321
3371
  const ABSENT$1 = Symbol("absent");
3322
3372
  function merge(target, before, after, t, path, acc) {
@@ -3325,8 +3375,8 @@ function merge(target, before, after, t, path, acc) {
3325
3375
  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
3376
  if (kind === "value") return acc.copied.push(path), after === void 0 ? ABSENT$1 : after;
3327
3377
  if (kind === "object") {
3328
- if (!isObj$1(after)) return acc.copied.push(path), after === void 0 ? ABSENT$1 : after;
3329
- let base = isObj$1(target) ? { ...target } : { _type: after._type }, b = isObj$1(before) ? before : {};
3378
+ if (!isObj$2(after)) return acc.copied.push(path), after === void 0 ? ABSENT$1 : after;
3379
+ let base = isObj$2(target) ? { ...target } : { _type: after._type }, b = isObj$2(before) ? before : {};
3330
3380
  for (let k of /* @__PURE__ */ new Set([...Object.keys(b), ...Object.keys(after)])) {
3331
3381
  if (k.startsWith("_") || SKIP_KEYS.has(k)) continue;
3332
3382
  let v = merge(base[k], b[k], after[k], fieldType(t, k), path ? `${path}.${k}` : k, acc);
@@ -3334,7 +3384,7 @@ function merge(target, before, after, t, path, acc) {
3334
3384
  }
3335
3385
  return base;
3336
3386
  }
3337
- let tgt = Array.isArray(target) ? target.filter(isObj$1) : [], bef = Array.isArray(before) ? before.filter(isObj$1) : [], aft = Array.isArray(after) ? after.filter(isObj$1) : [], byKey = (list) => new Map(list.map((i) => [i._key, i])), tMap = byKey(tgt), bMap = byKey(bef), aMap = byKey(aft), result = [];
3387
+ 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
3388
  for (let item of aft) {
3339
3389
  let key = item._key, it = itemType(t, item);
3340
3390
  if (tMap.has(key)) {
@@ -3368,7 +3418,7 @@ function propagate(target, before, after, documentType) {
3368
3418
  return {
3369
3419
  document: {
3370
3420
  ...target ?? {},
3371
- ...isObj$1(merged) ? merged : {}
3421
+ ...isObj$2(merged) ? merged : {}
3372
3422
  },
3373
3423
  ...acc
3374
3424
  };
@@ -6376,23 +6426,27 @@ function BoardView(props) {
6376
6426
  return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(Board, { ...props }) });
6377
6427
  }
6378
6428
  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("structure"), [sortDirection, setSortDirection] = useState("asc"), [page, setPage] = useState(0), [hidden, setHidden] = useState(/* @__PURE__ */ new Set()), [shownData, setShownData] = useState(/* @__PURE__ */ new Set()), toggleData = useCallback((key) => {
6429
+ 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
6430
  setShownData((current) => {
6381
6431
  let next = new Set(current);
6382
6432
  return next.has(key) ? next.delete(key) : next.add(key), next;
6383
6433
  });
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, {
6434
+ }, []), 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(filterRows(rows, {
6385
6435
  search,
6386
6436
  locales: locale ? [locale] : void 0
6387
- }).filter((row) => !onlyTodo || todos.has(row.id)), sortKey, sortDirection, { typeOrder: config.pageTypeNames }), [
6437
+ }).filter((row) => !onlyTodo || todos.has(row.id)), effectiveSortKey, sortDirection, {
6438
+ typeOrder: config.pageTypeNames,
6439
+ pageOrder
6440
+ }), [
6388
6441
  rows,
6389
6442
  search,
6390
6443
  locale,
6391
6444
  onlyTodo,
6392
6445
  todos,
6393
- sortKey,
6446
+ effectiveSortKey,
6394
6447
  sortDirection,
6395
- config.pageTypeNames
6448
+ config.pageTypeNames,
6449
+ pageOrder
6396
6450
  ]), 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
6451
  meta: byId,
6398
6452
  tags: config.boardTags,
@@ -6413,7 +6467,7 @@ function PagesTool() {
6413
6467
  let next = new Set(current);
6414
6468
  return next.has(key) ? next.delete(key) : next.add(key), next;
6415
6469
  }), onSort = (key) => {
6416
- key === sortKey ? setSortDirection((d) => d === "asc" ? "desc" : "asc") : (setSortKey(key), setSortDirection("asc")), setPage(0);
6470
+ key === effectiveSortKey ? setSortDirection((d) => d === "asc" ? "desc" : "asc") : (setSortKey(key), setSortDirection("asc")), setPage(0);
6417
6471
  };
6418
6472
  if (error) return /* @__PURE__ */ jsx(QueryError, {
6419
6473
  error,
@@ -6632,7 +6686,7 @@ function PagesTool() {
6632
6686
  })
6633
6687
  }) : /* @__PURE__ */ jsx(PagesTable, {
6634
6688
  groups,
6635
- sortKey,
6689
+ sortKey: effectiveSortKey,
6636
6690
  sortDirection,
6637
6691
  onSort,
6638
6692
  columns,
@@ -9497,10 +9551,7 @@ function AssetsToolbar(props) {
9497
9551
  }
9498
9552
  /** Tuile d'un asset dans la grille : aperçu, nom, taille, type, usage. */
9499
9553
  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 = [
9554
+ 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
9555
  formatBytes(asset.size),
9505
9556
  asset.dimensions?.width ? `${asset.dimensions.width}×${asset.dimensions.height}` : null,
9506
9557
  asset.extension?.toUpperCase()
@@ -9511,9 +9562,9 @@ function AssetCard(props) {
9511
9562
  padding: 0,
9512
9563
  tone: selected ? "primary" : "default",
9513
9564
  style: {
9514
- height: "100%",
9515
9565
  overflow: "hidden",
9516
- position: "relative"
9566
+ position: "relative",
9567
+ width: "100%"
9517
9568
  },
9518
9569
  children: [/* @__PURE__ */ jsx(Box, {
9519
9570
  style: {
@@ -9539,7 +9590,6 @@ function AssetCard(props) {
9539
9590
  as: "button",
9540
9591
  onClick: onOpen,
9541
9592
  style: {
9542
- height: "100%",
9543
9593
  width: "100%",
9544
9594
  textAlign: "left",
9545
9595
  cursor: "pointer",
@@ -9549,7 +9599,7 @@ function AssetCard(props) {
9549
9599
  },
9550
9600
  children: [/* @__PURE__ */ jsx(Box, {
9551
9601
  style: {
9552
- aspectRatio: "16 / 11",
9602
+ aspectRatio: ratio,
9553
9603
  overflow: "hidden",
9554
9604
  background: "var(--card-muted-bg-color, rgba(127,127,127,0.08))"
9555
9605
  },
@@ -9827,6 +9877,68 @@ function AssetTable(props) {
9827
9877
  })
9828
9878
  });
9829
9879
  }
9880
+ const isObj$1 = (v) => typeof v == "object" && !!v && !Array.isArray(v);
9881
+ /** Chemins (segments) des objets du document qui pointent vers `assetId`. */
9882
+ function findAssetRefPaths(value, assetId, path = []) {
9883
+ let out = [], walk = (node, current) => {
9884
+ if (Array.isArray(node)) {
9885
+ node.forEach((item, index) => {
9886
+ let segment = isObj$1(item) && typeof item._key == "string" ? { _key: item._key } : index;
9887
+ walk(item, [...current, segment]);
9888
+ });
9889
+ return;
9890
+ }
9891
+ if (isObj$1(node)) {
9892
+ if ((isObj$1(node.asset) ? node.asset._ref : void 0) === assetId || node._type === "reference" && node._ref === assetId) {
9893
+ out.push(current);
9894
+ return;
9895
+ }
9896
+ for (let [key, child] of Object.entries(node)) key.startsWith("_") || walk(child, [...current, key]);
9897
+ }
9898
+ };
9899
+ return walk(value, path), out;
9900
+ }
9901
+ /** Chemin Sanity (`gallery[_key=="ab"].asset`) depuis des segments. */
9902
+ function toPatchPath(segments) {
9903
+ let out = "";
9904
+ for (let segment of segments) out += typeof segment == "string" ? out ? `.${segment}` : segment : typeof segment == "number" ? `[${segment}]` : `[_key=="${segment._key}"]`;
9905
+ return out;
9906
+ }
9907
+ /** Chemins Sanity (chaînes) à retirer d'un document pour en ôter l'asset. */
9908
+ function assetUnsetPaths(doc, assetId) {
9909
+ return findAssetRefPaths(doc, assetId).map(toPatchPath).filter(Boolean);
9910
+ }
9911
+ const baseId$1 = (id) => id.replace(/^drafts\./, "");
9912
+ /**
9913
+ * Suppression d'un asset depuis l'outil Assets. Sanity refuse de supprimer un
9914
+ * asset référencé : on retire d'abord l'asset de chaque document (le champ
9915
+ * devient vide), puis on supprime, dans une seule transaction.
9916
+ */
9917
+ function useAssetDelete() {
9918
+ let client = useKitClient();
9919
+ return {
9920
+ usage: useCallback(async (assetId) => {
9921
+ let docs = await client.fetch("*[references($id)]{_id, _type, \"title\": coalesce(title, name, originalFilename, slug.current, _id)}", { id: assetId }), seen = /* @__PURE__ */ new Map();
9922
+ for (let doc of docs ?? []) {
9923
+ let id = baseId$1(doc._id);
9924
+ seen.has(id) || seen.set(id, {
9925
+ id,
9926
+ type: doc._type,
9927
+ title: doc.title ?? id
9928
+ });
9929
+ }
9930
+ return [...seen.values()];
9931
+ }, [client]),
9932
+ remove: useCallback(async (assetId) => {
9933
+ let docs = await client.fetch("*[references($id)]", { id: assetId }), transaction = client.transaction();
9934
+ for (let doc of docs ?? []) {
9935
+ let paths = assetUnsetPaths(doc, assetId);
9936
+ paths.length && transaction.patch(doc._id, { unset: paths });
9937
+ }
9938
+ transaction.delete(assetId), await transaction.commit({ visibility: "async" });
9939
+ }, [client])
9940
+ };
9941
+ }
9830
9942
  function Metric(props) {
9831
9943
  return /* @__PURE__ */ jsxs(Stack, {
9832
9944
  gap: 2,
@@ -9843,7 +9955,13 @@ function Metric(props) {
9843
9955
  });
9844
9956
  }
9845
9957
  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);
9958
+ 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 = () => {
9959
+ setConfirming(!0), setUses(null), setDeleteError(null), usage(asset._id).then((list) => setUses(list)).catch(() => setUses([]));
9960
+ }, doDelete = () => {
9961
+ setBusy(!0), setDeleteError(null), remove(asset._id).then(() => {
9962
+ setConfirming(!1), onDeleted?.(), onClose();
9963
+ }).catch((cause) => setDeleteError(cause instanceof Error ? cause.message : String(cause))).finally(() => setBusy(!1));
9964
+ };
9847
9965
  useEffect(() => {
9848
9966
  setTitle(asset.title ?? ""), setAlt(asset.altText ?? ""), setDescription(asset.description ?? "");
9849
9967
  }, [
@@ -9862,7 +9980,7 @@ function AssetDetail(props) {
9862
9980
  setCopied(!0), setTimeout(() => setCopied(!1), 1500);
9863
9981
  });
9864
9982
  };
9865
- return /* @__PURE__ */ jsx(Card, {
9983
+ return /* @__PURE__ */ jsxs(Card, {
9866
9984
  borderLeft: !0,
9867
9985
  height: "fill",
9868
9986
  style: {
@@ -9871,7 +9989,7 @@ function AssetDetail(props) {
9871
9989
  },
9872
9990
  overflow: "auto",
9873
9991
  tone: "transparent",
9874
- children: /* @__PURE__ */ jsxs(Stack, {
9992
+ children: [/* @__PURE__ */ jsxs(Stack, {
9875
9993
  gap: 4,
9876
9994
  padding: 4,
9877
9995
  children: [
@@ -10034,9 +10152,138 @@ function AssetDetail(props) {
10034
10152
  value: formatDate(asset._createdAt)
10035
10153
  })
10036
10154
  ]
10155
+ }),
10156
+ /* @__PURE__ */ jsx(Box, {
10157
+ style: { borderTop: "1px solid var(--card-border-color)" },
10158
+ paddingTop: 3,
10159
+ children: /* @__PURE__ */ jsx(Button, {
10160
+ icon: TrashIcon,
10161
+ text: "Supprimer le média",
10162
+ tone: "critical",
10163
+ mode: "ghost",
10164
+ fontSize: 1,
10165
+ onClick: openDelete,
10166
+ style: { width: "100%" }
10167
+ })
10037
10168
  })
10038
10169
  ]
10039
- })
10170
+ }), confirming ? /* @__PURE__ */ jsx(Dialog, {
10171
+ id: "asset-delete",
10172
+ header: "Supprimer le média",
10173
+ width: 1,
10174
+ onClose: () => busy ? void 0 : setConfirming(!1),
10175
+ footer: /* @__PURE__ */ jsxs(Flex, {
10176
+ justify: "flex-end",
10177
+ gap: 2,
10178
+ padding: 2,
10179
+ children: [/* @__PURE__ */ jsx(Button, {
10180
+ text: "Annuler",
10181
+ mode: "bleed",
10182
+ disabled: busy,
10183
+ onClick: () => setConfirming(!1)
10184
+ }), /* @__PURE__ */ jsx(Button, {
10185
+ text: busy ? "Suppression…" : "Supprimer",
10186
+ tone: "critical",
10187
+ disabled: busy || uses === null,
10188
+ onClick: doDelete
10189
+ })]
10190
+ }),
10191
+ children: /* @__PURE__ */ jsx(Box, {
10192
+ padding: 4,
10193
+ children: /* @__PURE__ */ jsxs(Stack, {
10194
+ gap: 3,
10195
+ children: [
10196
+ /* @__PURE__ */ jsxs(Text, {
10197
+ size: 1,
10198
+ children: [
10199
+ "Supprimer « ",
10200
+ assetName(asset),
10201
+ " » définitivement ?"
10202
+ ]
10203
+ }),
10204
+ uses === null ? /* @__PURE__ */ jsxs(Flex, {
10205
+ align: "center",
10206
+ gap: 2,
10207
+ children: [/* @__PURE__ */ jsx(Spinner, {
10208
+ muted: !0,
10209
+ size: 1
10210
+ }), /* @__PURE__ */ jsx(Text, {
10211
+ size: 1,
10212
+ muted: !0,
10213
+ children: "Recherche des endroits où il est utilisé…"
10214
+ })]
10215
+ }) : uses.length === 0 ? /* @__PURE__ */ jsx(Text, {
10216
+ size: 1,
10217
+ muted: !0,
10218
+ children: "Il n'est utilisé nulle part : aucune page ne sera affectée."
10219
+ }) : /* @__PURE__ */ jsxs(Stack, {
10220
+ gap: 2,
10221
+ children: [/* @__PURE__ */ jsxs(Text, {
10222
+ size: 1,
10223
+ weight: "medium",
10224
+ children: [
10225
+ "L'image deviendra vide à ",
10226
+ uses.length,
10227
+ " endroit",
10228
+ uses.length > 1 ? "s" : "",
10229
+ " :"
10230
+ ]
10231
+ }), /* @__PURE__ */ jsx(Card, {
10232
+ tone: "caution",
10233
+ border: !0,
10234
+ radius: 2,
10235
+ padding: 3,
10236
+ children: /* @__PURE__ */ jsxs(Stack, {
10237
+ gap: 2,
10238
+ as: "ul",
10239
+ style: {
10240
+ margin: 0,
10241
+ paddingLeft: 16
10242
+ },
10243
+ children: [uses.slice(0, 20).map((use) => /* @__PURE__ */ jsxs(Text, {
10244
+ size: 1,
10245
+ as: "li",
10246
+ children: [
10247
+ use.title,
10248
+ " ",
10249
+ /* @__PURE__ */ jsxs("span", {
10250
+ style: { opacity: .6 },
10251
+ children: [
10252
+ "(",
10253
+ use.type,
10254
+ ")"
10255
+ ]
10256
+ })
10257
+ ]
10258
+ }, use.id)), uses.length > 20 ? /* @__PURE__ */ jsxs(Text, {
10259
+ size: 1,
10260
+ muted: !0,
10261
+ as: "li",
10262
+ children: [
10263
+ "… et ",
10264
+ uses.length - 20,
10265
+ " autre",
10266
+ uses.length - 20 > 1 ? "s" : "",
10267
+ "."
10268
+ ]
10269
+ }) : null]
10270
+ })
10271
+ })]
10272
+ }),
10273
+ deleteError ? /* @__PURE__ */ jsx(Card, {
10274
+ tone: "critical",
10275
+ border: !0,
10276
+ radius: 2,
10277
+ padding: 3,
10278
+ children: /* @__PURE__ */ jsxs(Text, {
10279
+ size: 1,
10280
+ children: ["Suppression échouée : ", deleteError]
10281
+ })
10282
+ }) : null
10283
+ ]
10284
+ })
10285
+ })
10286
+ }) : null]
10040
10287
  });
10041
10288
  }
10042
10289
  function AssetsTool() {
@@ -10274,19 +10521,22 @@ function AssetsTool() {
10274
10521
  "."
10275
10522
  ]
10276
10523
  })
10277
- }) : view === "grid" ? /* @__PURE__ */ jsx(Grid, {
10278
- gridTemplateColumns: [
10279
- 2,
10280
- 3,
10281
- 4,
10282
- 5
10283
- ],
10284
- gap: 3,
10285
- children: visible.map((asset) => /* @__PURE__ */ jsx(AssetCard, {
10286
- asset,
10287
- selected: selectedIds.has(asset._id),
10288
- onToggleSelect: () => toggleSelect(asset._id),
10289
- onOpen: () => setOpenedId(asset._id)
10524
+ }) : view === "grid" ? /* @__PURE__ */ jsx(Box, {
10525
+ style: {
10526
+ columnWidth: 200,
10527
+ columnGap: 12
10528
+ },
10529
+ children: visible.map((asset) => /* @__PURE__ */ jsx(Box, {
10530
+ style: {
10531
+ breakInside: "avoid",
10532
+ marginBottom: 12
10533
+ },
10534
+ children: /* @__PURE__ */ jsx(AssetCard, {
10535
+ asset,
10536
+ selected: selectedIds.has(asset._id),
10537
+ onToggleSelect: () => toggleSelect(asset._id),
10538
+ onOpen: () => setOpenedId(asset._id)
10539
+ })
10290
10540
  }, asset._id))
10291
10541
  }) : /* @__PURE__ */ jsx(AssetTable, {
10292
10542
  assets: visible,
@@ -10309,11 +10559,46 @@ function AssetsTool() {
10309
10559
  folders: meta.folders,
10310
10560
  folder: folderOf(opened._id),
10311
10561
  onMove: (folder) => meta.moveAsset(opened._id, folder),
10312
- onClose: () => setOpenedId(null)
10562
+ onClose: () => setOpenedId(null),
10563
+ onDeleted: () => {
10564
+ setSelectedIds((prev) => {
10565
+ let next = new Set(prev);
10566
+ return next.delete(opened._id), next;
10567
+ }), setOpenedId(null), refresh();
10568
+ }
10313
10569
  }) : null
10314
10570
  ]
10315
10571
  });
10316
10572
  }
10573
+ /**
10574
+ * Menu « + » du Studio en situation monolingue. Pur.
10575
+ *
10576
+ * `@sanity/document-internationalization` ajoute, pour chaque type traduit, un
10577
+ * template « paramétré » (`${type}-parameterized`) et un template statique par
10578
+ * langue (`${type}-${langue}`, p. ex. `article-fr`, titré « Français Article »).
10579
+ * Avec une seule langue branchée, ces deux-là font doublon avec le « + Article »
10580
+ * de base : le menu de création montre « + Article » ET « + Français Article ».
10581
+ *
10582
+ * On ne garde alors que la base. Avec plusieurs langues on ne touche à rien
10583
+ * (« + master » et « + langues » sont voulus).
10584
+ *
10585
+ * Détection sans connaître la liste des langues : le template `-parameterized`
10586
+ * est la signature du plugin ; s'il n'existe qu'UN statique pour ce type (et que
10587
+ * la base du type est bien présente), on est en monolingue pour ce type. Zéro ou
10588
+ * plusieurs statiques : on laisse tout, par prudence — jamais retirer la seule
10589
+ * façon de créer un document.
10590
+ */
10591
+ function dropRedundantLanguageTemplates(options) {
10592
+ let ids = new Set(options.map((option) => option.templateId)), remove = /* @__PURE__ */ new Set();
10593
+ for (let { templateId } of options) {
10594
+ if (!templateId.endsWith("-parameterized")) continue;
10595
+ let base = templateId.slice(0, -14);
10596
+ if (!ids.has(base)) continue;
10597
+ let statics = options.filter((option) => option.templateId !== templateId && option.templateId.startsWith(`${base}-`)), only = statics.length === 1 ? statics[0] : void 0;
10598
+ only && (remove.add(templateId), remove.add(only.templateId));
10599
+ }
10600
+ return options.filter((option) => !remove.has(option.templateId));
10601
+ }
10317
10602
  const store$1 = /* @__PURE__ */ new Map();
10318
10603
  function entryFor$1(client, type, languageField, language) {
10319
10604
  let { projectId, dataset } = client.config(), key = `${projectId}:${dataset}:${type}:${language ?? ""}`, entry = store$1.get(key);
@@ -12201,15 +12486,20 @@ const pathOf = (preview) => {
12201
12486
  * titre ou adresse ; un clic ouvre la page dans l'aperçu ET son document à côté.
12202
12487
  */
12203
12488
  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(() => {
12489
+ 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
12490
  let q = search.trim().toLowerCase();
12206
- return rows.filter((r) => r.path !== null).filter((r) => !i18n || !activeLocale || !r.locale || r.locale === activeLocale).filter((r) => !q || r.title.toLowerCase().includes(q) || (r.path ?? "").toLowerCase().includes(q)).sort((a, b) => (a.path ?? "").localeCompare(b.path ?? ""));
12491
+ 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
12492
  }, [
12208
- rows,
12493
+ withPath,
12209
12494
  search,
12210
12495
  activeLocale,
12211
- i18n
12212
- ]);
12496
+ i18n,
12497
+ pageOrder
12498
+ ]), onReorder = (targetId) => {
12499
+ if (!dragId) return;
12500
+ let fullIds = orderByIds(withPath, pageOrder).map((r) => r.id);
12501
+ savePageOrder(reorderBefore(fullIds, dragId, targetId)), setDragId(null);
12502
+ };
12213
12503
  return /* @__PURE__ */ jsxs(Card, {
12214
12504
  height: "fill",
12215
12505
  borderRight: !0,
@@ -12266,53 +12556,89 @@ function PagesNavigator() {
12266
12556
  }) : /* @__PURE__ */ jsxs(Stack, {
12267
12557
  gap: 1,
12268
12558
  padding: 1,
12269
- children: [visible.map((row) => {
12270
- let selected = current !== null && current === ((row.path ?? "").replace(/\/$/, "") || "/");
12271
- return /* @__PURE__ */ jsx(Card, {
12272
- as: "button",
12559
+ children: [
12560
+ visible.map((row) => {
12561
+ let selected = current !== null && current === ((row.path ?? "").replace(/\/$/, "") || "/");
12562
+ return /* @__PURE__ */ jsx(Card, {
12563
+ as: "button",
12564
+ padding: 2,
12565
+ radius: 2,
12566
+ tone: selected ? "primary" : "default",
12567
+ pressed: selected,
12568
+ draggable: !0,
12569
+ onDragStart: (event) => {
12570
+ setDragId(row.id), event.dataTransfer.effectAllowed = "move";
12571
+ },
12572
+ onDragOver: (event) => {
12573
+ dragId && dragId !== row.id && event.preventDefault();
12574
+ },
12575
+ onDrop: (event) => {
12576
+ event.preventDefault(), onReorder(row.id);
12577
+ },
12578
+ onDragEnd: () => setDragId(null),
12579
+ style: {
12580
+ textAlign: "left",
12581
+ cursor: "pointer",
12582
+ border: 0,
12583
+ width: "100%",
12584
+ opacity: dragId === row.id ? .4 : 1
12585
+ },
12586
+ onClick: () => navigate(row.path ?? void 0, {
12587
+ type: row.type,
12588
+ id: row.id
12589
+ }),
12590
+ children: /* @__PURE__ */ jsxs(Flex, {
12591
+ align: "center",
12592
+ gap: 2,
12593
+ children: [
12594
+ /* @__PURE__ */ jsx(Text, {
12595
+ size: 1,
12596
+ muted: !0,
12597
+ style: {
12598
+ flex: "none",
12599
+ cursor: "grab"
12600
+ },
12601
+ title: "Glisser pour réordonner",
12602
+ children: /* @__PURE__ */ jsx(DragHandleIcon, {})
12603
+ }),
12604
+ /* @__PURE__ */ jsxs(Stack, {
12605
+ gap: 1,
12606
+ flex: 1,
12607
+ style: { minWidth: 0 },
12608
+ children: [/* @__PURE__ */ jsx(Text, {
12609
+ size: 1,
12610
+ weight: selected ? "semibold" : "regular",
12611
+ textOverflow: "ellipsis",
12612
+ children: row.title || row.path
12613
+ }), /* @__PURE__ */ jsx(Text, {
12614
+ size: 0,
12615
+ muted: !0,
12616
+ textOverflow: "ellipsis",
12617
+ children: row.path
12618
+ })]
12619
+ }),
12620
+ row.status !== "published" && /* @__PURE__ */ jsx(StatusBadge, { status: row.status })
12621
+ ]
12622
+ })
12623
+ }, row.id);
12624
+ }),
12625
+ dragId ? /* @__PURE__ */ jsx(Box, {
12273
12626
  padding: 2,
12274
- radius: 2,
12275
- tone: selected ? "primary" : "default",
12276
- pressed: selected,
12277
- style: {
12278
- textAlign: "left",
12279
- cursor: "pointer",
12280
- border: 0,
12281
- width: "100%"
12627
+ onDragOver: (event) => event.preventDefault(),
12628
+ onDrop: (event) => {
12629
+ event.preventDefault(), onReorder(null);
12282
12630
  },
12283
- onClick: () => navigate(row.path ?? void 0, {
12284
- type: row.type,
12285
- id: row.id
12286
- }),
12287
- children: /* @__PURE__ */ jsxs(Flex, {
12288
- align: "center",
12289
- gap: 2,
12290
- children: [/* @__PURE__ */ jsxs(Stack, {
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 })]
12631
+ style: { height: 24 }
12632
+ }) : null,
12633
+ !visible.length && /* @__PURE__ */ jsx(Box, {
12634
+ padding: 3,
12635
+ children: /* @__PURE__ */ jsx(Text, {
12636
+ size: 1,
12637
+ muted: !0,
12638
+ children: "No page."
12306
12639
  })
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
12640
  })
12315
- })]
12641
+ ]
12316
12642
  })
12317
12643
  })]
12318
12644
  });
@@ -12332,7 +12658,7 @@ function ncfPresentationComponents(options) {
12332
12658
  return /* @__PURE__ */ jsx(KitProvider, {
12333
12659
  config,
12334
12660
  issues,
12335
- children: /* @__PURE__ */ jsx(PagesNavigator, {})
12661
+ children: /* @__PURE__ */ jsx(BoardLayoutProvider, { children: /* @__PURE__ */ jsx(PagesNavigator, {}) })
12336
12662
  });
12337
12663
  }
12338
12664
  return {
@@ -12521,7 +12847,7 @@ const ncfKit = definePlugin((options) => {
12521
12847
  templates: (prev) => prev.filter((template) => !isKitType(template.schemaType))
12522
12848
  },
12523
12849
  document: {
12524
- newDocumentOptions: (prev) => prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE),
12850
+ newDocumentOptions: (prev) => dropRedundantLanguageTemplates(prev.filter((option) => option.templateId !== BOARD_LAYOUT_TYPE)),
12525
12851
  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
12852
  },
12527
12853
  studio: { components: {