sanity 6.2.0-next.113 → 6.2.0-next.115

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.
@@ -732,6 +732,14 @@ declare const PaneContainer: import("react").MemoExoticComponent<(props: BaseStr
732
732
  * @internal
733
733
  */
734
734
  type DocumentListPaneProps = ComponentProps<typeof PaneContainer>;
735
+ /**
736
+ * Reserved sentinel field name. A sort order using this field signals that the
737
+ * list should be ordered to match the incoming `$ids` param rather than sorted
738
+ * server-side, so the surrounding pane preserves the caller-provided ordering.
739
+ *
740
+ * @internal
741
+ */
742
+ declare const ORDER_BY_IDS_PARAM_FIELD = "__orderByIdsParam";
735
743
  /**
736
744
  * The structureTool is a studio plugin which adds the “structure tool” – a tool within
737
745
  * Sanity Studio in which content editors can drill down to specific documents to edit them.
@@ -793,4 +801,4 @@ declare function StructureToolProvider({
793
801
  }: StructureToolProviderProps): React.JSX.Element;
794
802
  /** @internal */
795
803
  declare function useStructureTool(): StructureToolContextValue;
796
- export { PaneLayout as C, ConfirmDeleteDialogProps as D, ConfirmDeleteDialogContainer as E, BaseStructureToolPaneProps as O, usePaneRouter as S, Pane as T, StructureLocaleResourceKeys as _, structureTool as a, IncomingReferenceAction as b, useDocumentPane as c, useDocumentTitle as d, DocumentPaneProviderWrapper as f, structureLocaleNamespace as g, DocumentPaneProviderProps as h, StructureToolProviderProps as i, DocumentInspectorHeader as l, usePaneOptions as m, useStructureTool as n, DocumentListPaneProps as o, DocumentPane as p, StructureToolProvider as r, PaneContainer as s, PaneRouterContext as t, UseDocumentTitle as u, isIncomingReferenceCreation as v, PaneContent as w, IncomingReferencesOptions as x, defineIncomingReferenceDecoration as y };
804
+ export { usePaneRouter as C, ConfirmDeleteDialogContainer as D, Pane as E, ConfirmDeleteDialogProps as O, IncomingReferencesOptions as S, PaneContent as T, structureLocaleNamespace as _, structureTool as a, defineIncomingReferenceDecoration as b, PaneContainer as c, UseDocumentTitle as d, useDocumentTitle as f, DocumentPaneProviderProps as g, usePaneOptions as h, StructureToolProviderProps as i, BaseStructureToolPaneProps as k, useDocumentPane as l, DocumentPane as m, useStructureTool as n, ORDER_BY_IDS_PARAM_FIELD as o, DocumentPaneProviderWrapper as p, StructureToolProvider as r, DocumentListPaneProps as s, PaneRouterContext as t, DocumentInspectorHeader as u, StructureLocaleResourceKeys as v, PaneLayout as w, IncomingReferenceAction as x, isIncomingReferenceCreation as y };
@@ -2435,6 +2435,8 @@ interface DocumentListPaneNode extends BaseResolvedPaneNode<'documentList'> {
2435
2435
  params?: Record<string, unknown>;
2436
2436
  apiVersion?: string;
2437
2437
  };
2438
+ /** Suppresses auto-injected restore-default sort/layout menu items for panes with a fixed ordering choice. */
2439
+ suppressRestoreDefaultMenuItems?: boolean;
2438
2440
  schemaTypeName: string;
2439
2441
  source?: string;
2440
2442
  }
@@ -15,7 +15,7 @@ import { PresentationSharedStateContext, PresentationPanelsContext, Presentation
15
15
  import { Tab, Button, ErrorBoundary, Tooltip, MenuItem, MenuButton, TooltipDelayGroupProvider } from "./index.js";
16
16
  import "react-i18next";
17
17
  import { WarningOutlineIcon, LaunchIcon, ResetIcon, CopyIcon, ShareIcon, PanelLeftIcon, MobileDeviceIcon, DesktopIcon, RefreshIcon } from "@sanity/icons";
18
- import { PaneRouterContext, PaneLayout, StructureToolProvider, DocumentListPane as DocumentListPane$1, DocumentPane as DocumentPane$1 } from "sanity/structure";
18
+ import { PaneRouterContext, PaneLayout, StructureToolProvider, ORDER_BY_IDS_PARAM_FIELD, DocumentListPane as DocumentListPane$1, DocumentPane as DocumentPane$1 } from "sanity/structure";
19
19
  import { toString } from "@sanity/util/paths";
20
20
  import { StructureToolProvider as StructureToolProvider$1 } from "./StructureToolProvider.js";
21
21
  import { studioPath } from "@sanity/client/csm";
@@ -216,7 +216,7 @@ const itemKey = "presentation/panels", getStoredItem = () => JSON.parse(localSto
216
216
  localStorage.setItem(itemKey, JSON.stringify(data));
217
217
  }, getKeyForPanels = (panels) => panels.map((panel) => [panel.id, panel.order].join(":")).join(",");
218
218
  function usePanelsStorage() {
219
- const $ = c(1), get = _temp2$9, set = _temp3$4;
219
+ const $ = c(1), get = _temp2$8, set = _temp3$5;
220
220
  let t0;
221
221
  if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
222
222
  const setDebounced = debounce(set, 100);
@@ -229,14 +229,14 @@ function usePanelsStorage() {
229
229
  t0 = $[0];
230
230
  return t0;
231
231
  }
232
- function _temp3$4(panels_0, widths) {
232
+ function _temp3$5(panels_0, widths) {
233
233
  const stored_0 = getStoredItem(), key_0 = getKeyForPanels(panels_0), data = {
234
234
  ...stored_0,
235
235
  [key_0]: widths
236
236
  };
237
237
  setStoredItem(data);
238
238
  }
239
- function _temp2$9(panels) {
239
+ function _temp2$8(panels) {
240
240
  const stored = getStoredItem(), key = getKeyForPanels(panels);
241
241
  return Array.isArray(stored[key]) && stored[key].some(_temp$g) ? void 0 : stored[key];
242
242
  }
@@ -769,9 +769,9 @@ function PresentationPaneRouterProvider(props) {
769
769
  BackLink: t6,
770
770
  ReferenceChildLink: t7,
771
771
  ParameterizedLink: _temp$f,
772
- closeCurrentAndAfter: _temp2$8,
772
+ closeCurrentAndAfter: _temp2$7,
773
773
  handleEditReference: t8,
774
- replaceCurrent: _temp3$3,
774
+ replaceCurrent: _temp3$4,
775
775
  closeCurrent: _temp4$2,
776
776
  duplicateCurrent: _temp5$2,
777
777
  setView: _temp6$1,
@@ -799,10 +799,10 @@ function _temp5$2(pane_0) {
799
799
  function _temp4$2() {
800
800
  console.warn("closeCurrent");
801
801
  }
802
- function _temp3$3(pane) {
802
+ function _temp3$4(pane) {
803
803
  console.warn("replaceCurrent", pane);
804
804
  }
805
- function _temp2$8() {
805
+ function _temp2$7() {
806
806
  console.warn("closeCurrentAndAfter");
807
807
  }
808
808
  function _temp$f() {
@@ -818,71 +818,132 @@ const RootLayout = styled(PaneLayout).withConfig({
818
818
  displayName: "WrappedCode",
819
819
  componentId: "sc-18wb5dr-2"
820
820
  })`white-space:pre-wrap;`;
821
+ function deriveOrderedIds({
822
+ visualOrderPublishedIds,
823
+ refs,
824
+ mainDocumentId
825
+ }) {
826
+ const seenPublishedIds = /* @__PURE__ */ new Set();
827
+ return [...visualOrderPublishedIds, ...refs.map((ref) => getPublishedId(ref._id))].reduce((accumulatedIds, publishedId) => (publishedId === mainDocumentId || seenPublishedIds.has(publishedId) || (seenPublishedIds.add(publishedId), accumulatedIds.push(publishedId)), accumulatedIds), []);
828
+ }
821
829
  function DocumentListPane(props) {
822
- const $ = c(34), {
830
+ const $ = c(41), {
823
831
  mainDocumentState,
824
832
  onEditReference,
825
833
  onStructureParams,
826
834
  searchParams,
827
- refs
835
+ refs,
836
+ visualOrderPublishedIds
828
837
  } = props, {
829
838
  t
830
839
  } = useTranslation(presentationLocaleNamespace), {
831
840
  devMode
832
- } = usePresentationTool();
833
- let t0;
834
- if ($[0] !== mainDocumentState?.document?._id || $[1] !== refs) {
835
- let t12;
836
- $[3] !== mainDocumentState?.document?._id ? (t12 = (r) => getPublishedId(r._id) !== mainDocumentState?.document?._id, $[3] = mainDocumentState?.document?._id, $[4] = t12) : t12 = $[4], t0 = refs.filter(t12).map(_temp$e), $[0] = mainDocumentState?.document?._id, $[1] = refs, $[2] = t0;
837
- } else
838
- t0 = $[2];
839
- const ids = t0;
841
+ } = usePresentationTool(), t0 = mainDocumentState?.document?._id;
840
842
  let t1;
841
- $[5] !== ids ? (t1 = {
842
- filter: "_id in $ids",
843
- params: {
844
- ids
845
- }
846
- }, $[5] = ids, $[6] = t1) : t1 = $[6];
843
+ $[0] !== refs || $[1] !== t0 || $[2] !== visualOrderPublishedIds ? (t1 = deriveOrderedIds({
844
+ visualOrderPublishedIds,
845
+ refs,
846
+ mainDocumentId: t0
847
+ }), $[0] = refs, $[1] = t0, $[2] = visualOrderPublishedIds, $[3] = t1) : t1 = $[3];
848
+ const ids = t1;
847
849
  let t2;
848
- $[7] !== t ? (t2 = t("document-list-pane.document-list.title"), $[7] = t, $[8] = t2) : t2 = $[8];
850
+ $[4] !== ids ? (t2 = {
851
+ ids
852
+ }, $[4] = ids, $[5] = t2) : t2 = $[5];
849
853
  let t3;
850
- $[9] !== t1 || $[10] !== t2 ? (t3 = {
851
- id: "$root",
852
- options: t1,
853
- schemaTypeName: "",
854
- title: t2,
855
- type: "documentList"
856
- }, $[9] = t1, $[10] = t2, $[11] = t3) : t3 = $[11];
857
- const pane = t3, [errorParams, setErrorParams] = useState(null);
854
+ $[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = [{
855
+ field: ORDER_BY_IDS_PARAM_FIELD,
856
+ direction: "asc"
857
+ }], $[6] = t3) : t3 = $[6];
858
858
  let t4;
859
- $[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = () => setErrorParams(null), $[12] = t4) : t4 = $[12];
860
- const handleRetry = t4, [structureParams] = useState(_temp2$7);
859
+ $[7] !== t2 ? (t4 = {
860
+ filter: "_id in $ids",
861
+ params: t2,
862
+ defaultOrdering: t3
863
+ }, $[7] = t2, $[8] = t4) : t4 = $[8];
861
864
  let t5;
862
- $[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t5 = () => setErrorParams(null), $[13] = t5) : t5 = $[13];
865
+ $[9] !== t ? (t5 = t("document-list-pane.document-list.title"), $[9] = t, $[10] = t5) : t5 = $[10];
863
866
  let t6;
864
- if ($[14] !== refs ? (t6 = [refs], $[14] = refs, $[15] = t6) : t6 = $[15], useEffect(t5, t6), errorParams) {
865
- let t72;
866
- $[16] !== t ? (t72 = t("document-list-pane.error.text"), $[16] = t, $[17] = t72) : t72 = $[17];
867
- let t82;
868
- $[18] !== devMode || $[19] !== errorParams || $[20] !== t ? (t82 = devMode && /* @__PURE__ */ jsx(Card, { overflow: "auto", padding: 3, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
867
+ $[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t6 = [{
868
+ id: "sorting"
869
+ }], $[11] = t6) : t6 = $[11];
870
+ let t7;
871
+ $[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t7 = {
872
+ title: {
873
+ key: "document-list-pane.ordering.by-appearance",
874
+ ns: presentationLocaleNamespace
875
+ }
876
+ }, $[12] = t7) : t7 = $[12];
877
+ let t8;
878
+ $[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = {
879
+ group: "sorting",
880
+ action: "setSortOrder",
881
+ i18n: t7,
882
+ title: "By appearance",
883
+ params: {
884
+ by: [{
885
+ field: ORDER_BY_IDS_PARAM_FIELD,
886
+ direction: "asc"
887
+ }]
888
+ }
889
+ }, $[13] = t8) : t8 = $[13];
890
+ let t9;
891
+ $[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = {
892
+ title: {
893
+ key: "document-list-pane.ordering.last-edited",
894
+ ns: presentationLocaleNamespace
895
+ }
896
+ }, $[14] = t9) : t9 = $[14];
897
+ let t10;
898
+ $[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = [t8, {
899
+ group: "sorting",
900
+ action: "setSortOrder",
901
+ i18n: t9,
902
+ title: "Last edited",
903
+ params: {
904
+ by: [{
905
+ field: "_updatedAt",
906
+ direction: "desc"
907
+ }]
908
+ }
909
+ }], $[15] = t10) : t10 = $[15];
910
+ let t11;
911
+ $[16] !== t4 || $[17] !== t5 ? (t11 = {
912
+ id: "presentationDocumentsOnPage",
913
+ options: t4,
914
+ schemaTypeName: "",
915
+ title: t5,
916
+ type: "documentList",
917
+ menuItemGroups: t6,
918
+ menuItems: t10,
919
+ suppressRestoreDefaultMenuItems: !0
920
+ }, $[16] = t4, $[17] = t5, $[18] = t11) : t11 = $[18];
921
+ const pane = t11, [errorParams, setErrorParams] = useState(null);
922
+ let t12;
923
+ $[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t12 = () => setErrorParams(null), $[19] = t12) : t12 = $[19];
924
+ const handleRetry = t12, [structureParams] = useState(_temp$e);
925
+ let t13;
926
+ $[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t13 = () => setErrorParams(null), $[20] = t13) : t13 = $[20];
927
+ let t14;
928
+ if ($[21] !== refs ? (t14 = [refs], $[21] = refs, $[22] = t14) : t14 = $[22], useEffect(t13, t14), errorParams) {
929
+ let t152;
930
+ $[23] !== t ? (t152 = t("document-list-pane.error.text"), $[23] = t, $[24] = t152) : t152 = $[24];
931
+ let t162;
932
+ $[25] !== devMode || $[26] !== errorParams || $[27] !== t ? (t162 = devMode && /* @__PURE__ */ jsx(Card, { overflow: "auto", padding: 3, radius: 2, tone: "critical", children: /* @__PURE__ */ jsxs(Stack, { space: 3, children: [
869
933
  /* @__PURE__ */ jsx(Label, { muted: !0, size: 0, children: t("presentation-error.label") }),
870
934
  /* @__PURE__ */ jsx(WrappedCode$1, { size: 1, children: errorParams.error.message })
871
- ] }) }), $[18] = devMode, $[19] = errorParams, $[20] = t, $[21] = t82) : t82 = $[21];
872
- let t9;
873
- return $[22] !== t72 || $[23] !== t82 ? (t9 = /* @__PURE__ */ jsx(ErrorCard, { flex: 1, message: t72, onRetry: handleRetry, children: t82 }), $[22] = t72, $[23] = t82, $[24] = t9) : t9 = $[24], t9;
935
+ ] }) }), $[25] = devMode, $[26] = errorParams, $[27] = t, $[28] = t162) : t162 = $[28];
936
+ let t17;
937
+ return $[29] !== t152 || $[30] !== t162 ? (t17 = /* @__PURE__ */ jsx(ErrorCard, { flex: 1, message: t152, onRetry: handleRetry, children: t162 }), $[29] = t152, $[30] = t162, $[31] = t17) : t17 = $[31], t17;
874
938
  }
875
- let t7;
876
- $[25] !== pane ? (t7 = /* @__PURE__ */ jsx(Root, { direction: "column", flex: 1, children: /* @__PURE__ */ jsx(DocumentListPane$1, { index: 0, itemId: "$root", pane, paneKey: "$root" }) }), $[25] = pane, $[26] = t7) : t7 = $[26];
877
- let t8;
878
- return $[27] !== onEditReference || $[28] !== onStructureParams || $[29] !== refs || $[30] !== searchParams || $[31] !== structureParams || $[32] !== t7 ? (t8 = /* @__PURE__ */ jsx(ErrorBoundary, { onCatch: setErrorParams, children: /* @__PURE__ */ jsx(RootLayout, { children: /* @__PURE__ */ jsx(StructureToolProvider, { children: /* @__PURE__ */ jsx(PresentationPaneRouterProvider, { onEditReference, onStructureParams, structureParams, searchParams, refs, children: t7 }) }) }) }), $[27] = onEditReference, $[28] = onStructureParams, $[29] = refs, $[30] = searchParams, $[31] = structureParams, $[32] = t7, $[33] = t8) : t8 = $[33], t8;
939
+ let t15;
940
+ $[32] !== pane ? (t15 = /* @__PURE__ */ jsx(Root, { direction: "column", flex: 1, children: /* @__PURE__ */ jsx(DocumentListPane$1, { index: 0, itemId: "$root", pane, paneKey: "$root" }) }), $[32] = pane, $[33] = t15) : t15 = $[33];
941
+ let t16;
942
+ return $[34] !== onEditReference || $[35] !== onStructureParams || $[36] !== refs || $[37] !== searchParams || $[38] !== structureParams || $[39] !== t15 ? (t16 = /* @__PURE__ */ jsx(ErrorBoundary, { onCatch: setErrorParams, children: /* @__PURE__ */ jsx(RootLayout, { children: /* @__PURE__ */ jsx(StructureToolProvider, { children: /* @__PURE__ */ jsx(PresentationPaneRouterProvider, { onEditReference, onStructureParams, structureParams, searchParams, refs, children: t15 }) }) }) }), $[34] = onEditReference, $[35] = onStructureParams, $[36] = refs, $[37] = searchParams, $[38] = structureParams, $[39] = t15, $[40] = t16) : t16 = $[40], t16;
879
943
  }
880
- function _temp2$7() {
944
+ function _temp$e() {
881
945
  return {};
882
946
  }
883
- function _temp$e(r_0) {
884
- return getPublishedId(r_0._id);
885
- }
886
947
  const WrappedCode = styled(Code).withConfig({
887
948
  displayName: "WrappedCode",
888
949
  componentId: "sc-m0u57n-0"
@@ -991,7 +1052,7 @@ function usePreviewState(documentId, schemaType2) {
991
1052
  }, t2 = [documentPreviewStore, schemaType2, documentId, perspectiveStack], $[1] = documentId, $[2] = documentPreviewStore, $[3] = perspectiveStack, $[4] = schemaType2, $[5] = t1, $[6] = t2) : (t1 = $[5], t2 = $[6]), useEffect(t1, t2), preview;
992
1053
  }
993
1054
  function ContentEditor(props) {
994
- const $ = c(40), {
1055
+ const $ = c(41), {
995
1056
  documentId,
996
1057
  documentType,
997
1058
  mainDocumentState,
@@ -999,6 +1060,7 @@ function ContentEditor(props) {
999
1060
  onFocusPath,
1000
1061
  onStructureParams,
1001
1062
  refs,
1063
+ visualOrderPublishedIds,
1002
1064
  searchParams,
1003
1065
  structureParams
1004
1066
  } = props, {
@@ -1047,12 +1109,12 @@ function ContentEditor(props) {
1047
1109
  } }) }) })
1048
1110
  ] }) }) }), $[26] = MainDocumentLink, $[27] = mainDocumentState, $[28] = preview, $[29] = t, $[30] = t3) : t3 = $[30];
1049
1111
  let t4;
1050
- $[31] !== mainDocumentState || $[32] !== onEditReference || $[33] !== onStructureParams || $[34] !== refs || $[35] !== searchParams ? (t4 = /* @__PURE__ */ jsx(DocumentListPane, { mainDocumentState, onEditReference, onStructureParams, searchParams, refs }), $[31] = mainDocumentState, $[32] = onEditReference, $[33] = onStructureParams, $[34] = refs, $[35] = searchParams, $[36] = t4) : t4 = $[36];
1112
+ $[31] !== mainDocumentState || $[32] !== onEditReference || $[33] !== onStructureParams || $[34] !== refs || $[35] !== searchParams || $[36] !== visualOrderPublishedIds ? (t4 = /* @__PURE__ */ jsx(DocumentListPane, { mainDocumentState, onEditReference, onStructureParams, searchParams, refs, visualOrderPublishedIds }), $[31] = mainDocumentState, $[32] = onEditReference, $[33] = onStructureParams, $[34] = refs, $[35] = searchParams, $[36] = visualOrderPublishedIds, $[37] = t4) : t4 = $[37];
1051
1113
  let t5;
1052
- return $[37] !== t3 || $[38] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, height: "fill", children: [
1114
+ return $[38] !== t3 || $[39] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, { direction: "column", flex: 1, height: "fill", children: [
1053
1115
  t3,
1054
1116
  t4
1055
- ] }), $[37] = t3, $[38] = t4, $[39] = t5) : t5 = $[39], t5;
1117
+ ] }), $[38] = t3, $[39] = t4, $[40] = t5) : t5 = $[40], t5;
1056
1118
  }
1057
1119
  function usePanelId(id) {
1058
1120
  const $ = c(2);
@@ -1186,9 +1248,10 @@ const Resizer = styled.div.withConfig({
1186
1248
  t4
1187
1249
  ] }), $[13] = t0, $[14] = t4, $[15] = t5) : t5 = $[15], t5;
1188
1250
  }, PresentationContent = (props) => {
1189
- const $ = c(17), {
1251
+ const $ = c(18), {
1190
1252
  documentId,
1191
1253
  documentsOnPage,
1254
+ visualOrderPublishedIds,
1192
1255
  documentType,
1193
1256
  getCommentIntent,
1194
1257
  hidden,
@@ -1202,9 +1265,9 @@ const Resizer = styled.div.withConfig({
1202
1265
  structureParams
1203
1266
  } = props;
1204
1267
  let t0;
1205
- $[0] !== documentId || $[1] !== documentType || $[2] !== documentsOnPage || $[3] !== mainDocumentState || $[4] !== onEditReference || $[5] !== onFocusPath || $[6] !== onStructureParams || $[7] !== searchParams || $[8] !== structureParams ? (t0 = /* @__PURE__ */ jsx(ContentEditor, { documentId, documentType, mainDocumentState, onEditReference, onFocusPath, onStructureParams, refs: documentsOnPage, searchParams, structureParams }), $[0] = documentId, $[1] = documentType, $[2] = documentsOnPage, $[3] = mainDocumentState, $[4] = onEditReference, $[5] = onFocusPath, $[6] = onStructureParams, $[7] = searchParams, $[8] = structureParams, $[9] = t0) : t0 = $[9];
1268
+ $[0] !== documentId || $[1] !== documentType || $[2] !== documentsOnPage || $[3] !== mainDocumentState || $[4] !== onEditReference || $[5] !== onFocusPath || $[6] !== onStructureParams || $[7] !== searchParams || $[8] !== structureParams || $[9] !== visualOrderPublishedIds ? (t0 = /* @__PURE__ */ jsx(ContentEditor, { documentId, documentType, mainDocumentState, onEditReference, onFocusPath, onStructureParams, refs: documentsOnPage, visualOrderPublishedIds, searchParams, structureParams }), $[0] = documentId, $[1] = documentType, $[2] = documentsOnPage, $[3] = mainDocumentState, $[4] = onEditReference, $[5] = onFocusPath, $[6] = onStructureParams, $[7] = searchParams, $[8] = structureParams, $[9] = visualOrderPublishedIds, $[10] = t0) : t0 = $[10];
1206
1269
  let t1;
1207
- return $[10] !== documentId || $[11] !== getCommentIntent || $[12] !== hidden || $[13] !== resizerHidden || $[14] !== setDisplayedDocument || $[15] !== t0 ? (t1 = /* @__PURE__ */ jsx(PresentationContentWrapper, { documentId, getCommentIntent, hidden, resizerHidden, setDisplayedDocument, children: t0 }), $[10] = documentId, $[11] = getCommentIntent, $[12] = hidden, $[13] = resizerHidden, $[14] = setDisplayedDocument, $[15] = t0, $[16] = t1) : t1 = $[16], t1;
1270
+ return $[11] !== documentId || $[12] !== getCommentIntent || $[13] !== hidden || $[14] !== resizerHidden || $[15] !== setDisplayedDocument || $[16] !== t0 ? (t1 = /* @__PURE__ */ jsx(PresentationContentWrapper, { documentId, getCommentIntent, hidden, resizerHidden, setDisplayedDocument, children: t0 }), $[11] = documentId, $[12] = getCommentIntent, $[13] = hidden, $[14] = resizerHidden, $[15] = setDisplayedDocument, $[16] = t0, $[17] = t1) : t1 = $[17], t1;
1208
1271
  }, PresentationNavigateProvider = function(props) {
1209
1272
  const $ = c(5), {
1210
1273
  children,
@@ -1757,7 +1820,7 @@ const PreviewHeaderDefault = (props) => {
1757
1820
  }));
1758
1821
  });
1759
1822
  }, $[3] = iframeRef, $[4] = onRefresh, $[5] = presentationRef, $[6] = previewUrl, $[7] = targetOrigin, $[8] = t1) : t1 = $[8];
1760
- const handleRefresh = t1, isLoading = useSelector(presentationRef, _temp$a), isLoaded = useSelector(presentationRef, _temp2$6), isRefreshing = useSelector(presentationRef, _temp3$2), isReloading = useSelector(presentationRef, _temp4$1), overlaysEnabled = useSelector(presentationRef, _temp5$1);
1823
+ const handleRefresh = t1, isLoading = useSelector(presentationRef, _temp$a), isLoaded = useSelector(presentationRef, _temp2$6), isRefreshing = useSelector(presentationRef, _temp3$3), isReloading = useSelector(presentationRef, _temp4$1), overlaysEnabled = useSelector(presentationRef, _temp5$1);
1761
1824
  let t2;
1762
1825
  if ($[9] !== previewUrl || $[10] !== targetOrigin) {
1763
1826
  const previewURL = new URL(previewUrl || "/", targetOrigin);
@@ -1904,7 +1967,7 @@ function _temp$a(state) {
1904
1967
  function _temp2$6(state_0) {
1905
1968
  return state_0.matches("loaded");
1906
1969
  }
1907
- function _temp3$2(state_1) {
1970
+ function _temp3$3(state_1) {
1908
1971
  return state_1.matches({
1909
1972
  loaded: "refreshing"
1910
1973
  });
@@ -2214,7 +2277,7 @@ function defineWarnOnce() {
2214
2277
  }
2215
2278
  const warnOnceAboutCrossDatasetReference = defineWarnOnce();
2216
2279
  function useDocumentsOnPage(perspective, frameStateRef) {
2217
- const $ = c(11);
2280
+ const $ = c(15);
2218
2281
  validateApiPerspective(perspective);
2219
2282
  let t0;
2220
2283
  $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {}, $[0] = t0) : t0 = $[0];
@@ -2248,7 +2311,30 @@ function useDocumentsOnPage(perspective, frameStateRef) {
2248
2311
  $[6] !== uniqueDocuments ? (t4 = Object.values(uniqueDocuments), $[6] = uniqueDocuments, $[7] = t4) : t4 = $[7];
2249
2312
  const documentsOnPage = t4;
2250
2313
  let t5;
2251
- return $[8] !== documentsOnPage || $[9] !== setDocumentsOnPage ? (t5 = [documentsOnPage, setDocumentsOnPage], $[8] = documentsOnPage, $[9] = setDocumentsOnPage, $[10] = t5) : t5 = $[10], t5;
2314
+ bb0: {
2315
+ const visualCache = (perspective === "published" ? published : previewDrafts)["visual-editing"];
2316
+ if (!visualCache) {
2317
+ let t63;
2318
+ $[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t63 = [], $[8] = t63) : t63 = $[8], t5 = t63;
2319
+ break bb0;
2320
+ }
2321
+ let t62;
2322
+ $[9] !== visualCache ? (t62 = Object.values(visualCache).reduce(_temp3$2, {
2323
+ orderedIds: [],
2324
+ seen: /* @__PURE__ */ new Set()
2325
+ }), $[9] = visualCache, $[10] = t62) : t62 = $[10];
2326
+ const {
2327
+ orderedIds
2328
+ } = t62;
2329
+ t5 = orderedIds;
2330
+ }
2331
+ const visualOrderPublishedIds = t5;
2332
+ let t6;
2333
+ return $[11] !== documentsOnPage || $[12] !== setDocumentsOnPage || $[13] !== visualOrderPublishedIds ? (t6 = [documentsOnPage, setDocumentsOnPage, visualOrderPublishedIds], $[11] = documentsOnPage, $[12] = setDocumentsOnPage, $[13] = visualOrderPublishedIds, $[14] = t6) : t6 = $[14], t6;
2334
+ }
2335
+ function _temp3$2(accumulator, document_0) {
2336
+ const publishedId = getPublishedId(document_0._id);
2337
+ return accumulator.seen.has(publishedId) || (accumulator.seen.add(publishedId), accumulator.orderedIds.push(publishedId)), accumulator;
2252
2338
  }
2253
2339
  function _temp2$5(acc, cache_0) {
2254
2340
  return Object.values(cache_0).forEach((doc) => {
@@ -2686,7 +2772,7 @@ function resolveActiveTab(activeTab, navigatorEnabled) {
2686
2772
  return activeTab === "navigator" && navigatorEnabled ? "navigator" : activeTab === "navigator" ? "preview" : activeTab;
2687
2773
  }
2688
2774
  function PresentationTool(props) {
2689
- const $ = c(214), {
2775
+ const $ = c(215), {
2690
2776
  canToggleSharePreviewAccess,
2691
2777
  canUseSharedPreviewAccess,
2692
2778
  tool,
@@ -2738,7 +2824,7 @@ function PresentationTool(props) {
2738
2824
  $[12] !== params.scheduledDraft ? (t5 = {
2739
2825
  scheduledDraft: params.scheduledDraft
2740
2826
  }, $[12] = params.scheduledDraft, $[13] = t5) : t5 = $[13];
2741
- const perspective = usePresentationPerspective(t5), presentationRef = useActorRef(presentationMachine), viewport = params.viewport ? "mobile" : "desktop", [documentsOnPage, setDocumentsOnPage] = useDocumentsOnPage(perspective, frameStateRef), projectId = useProjectId(), dataset = useDataset(), t6 = tool.options?.resolve?.mainDocuments;
2827
+ const perspective = usePresentationPerspective(t5), presentationRef = useActorRef(presentationMachine), viewport = params.viewport ? "mobile" : "desktop", [documentsOnPage, setDocumentsOnPage, visualOrderPublishedIds] = useDocumentsOnPage(perspective, frameStateRef), projectId = useProjectId(), dataset = useDataset(), t6 = tool.options?.resolve?.mainDocuments;
2742
2828
  let t7;
2743
2829
  $[14] !== navigate || $[15] !== navigationHistory || $[16] !== params.preview || $[17] !== perspective || $[18] !== t6 || $[19] !== targetOrigin ? (t7 = {
2744
2830
  navigate,
@@ -3020,44 +3106,44 @@ function PresentationTool(props) {
3020
3106
  $[132] !== t37 || $[133] !== t38 || $[134] !== t40 ? (t41 = /* @__PURE__ */ jsx(Panel, { id: "preview", htmlId: t36, minWidth: 325, defaultSize: t37, order: 3, hidden: t38, children: t40 }), $[132] = t37, $[133] = t38, $[134] = t40, $[135] = t41) : t41 = $[135];
3021
3107
  const t42 = isNarrow && resolvedTab !== "content";
3022
3108
  let t43;
3023
- $[136] !== documentsOnPage || $[137] !== getCommentIntent || $[138] !== handleEditReference || $[139] !== handleFocusPath || $[140] !== handleStructureParams || $[141] !== isNarrow || $[142] !== mainDocumentState || $[143] !== params.id || $[144] !== params.type || $[145] !== searchParams || $[146] !== structureParams || $[147] !== t42 ? (t43 = /* @__PURE__ */ jsx(PresentationContent, { documentId: params.id, documentsOnPage, documentType: params.type, getCommentIntent, hidden: t42, mainDocumentState, onEditReference: handleEditReference, onFocusPath: handleFocusPath, onStructureParams: handleStructureParams, resizerHidden: isNarrow, searchParams, setDisplayedDocument, structureParams }), $[136] = documentsOnPage, $[137] = getCommentIntent, $[138] = handleEditReference, $[139] = handleFocusPath, $[140] = handleStructureParams, $[141] = isNarrow, $[142] = mainDocumentState, $[143] = params.id, $[144] = params.type, $[145] = searchParams, $[146] = structureParams, $[147] = t42, $[148] = t43) : t43 = $[148];
3109
+ $[136] !== documentsOnPage || $[137] !== getCommentIntent || $[138] !== handleEditReference || $[139] !== handleFocusPath || $[140] !== handleStructureParams || $[141] !== isNarrow || $[142] !== mainDocumentState || $[143] !== params.id || $[144] !== params.type || $[145] !== searchParams || $[146] !== structureParams || $[147] !== t42 || $[148] !== visualOrderPublishedIds ? (t43 = /* @__PURE__ */ jsx(PresentationContent, { documentId: params.id, documentsOnPage, visualOrderPublishedIds, documentType: params.type, getCommentIntent, hidden: t42, mainDocumentState, onEditReference: handleEditReference, onFocusPath: handleFocusPath, onStructureParams: handleStructureParams, resizerHidden: isNarrow, searchParams, setDisplayedDocument, structureParams }), $[136] = documentsOnPage, $[137] = getCommentIntent, $[138] = handleEditReference, $[139] = handleFocusPath, $[140] = handleStructureParams, $[141] = isNarrow, $[142] = mainDocumentState, $[143] = params.id, $[144] = params.type, $[145] = searchParams, $[146] = structureParams, $[147] = t42, $[148] = visualOrderPublishedIds, $[149] = t43) : t43 = $[149];
3024
3110
  let t44;
3025
- $[149] !== t35 || $[150] !== t41 || $[151] !== t43 ? (t44 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, style: t33, children: /* @__PURE__ */ jsxs(Panels, { children: [
3111
+ $[150] !== t35 || $[151] !== t41 || $[152] !== t43 ? (t44 = /* @__PURE__ */ jsx(Flex, { direction: "column", flex: 1, style: t33, children: /* @__PURE__ */ jsxs(Panels, { children: [
3026
3112
  t35,
3027
3113
  t41,
3028
3114
  t43
3029
- ] }) }), $[149] = t35, $[150] = t41, $[151] = t43, $[152] = t44) : t44 = $[152];
3115
+ ] }) }), $[150] = t35, $[151] = t41, $[152] = t43, $[153] = t44) : t44 = $[153];
3030
3116
  let t45;
3031
- $[153] !== t32 || $[154] !== t44 ? (t45 = /* @__PURE__ */ jsxs(Container, { "data-testid": "presentation-root", direction: "column", height: "fill", children: [
3117
+ $[154] !== t32 || $[155] !== t44 ? (t45 = /* @__PURE__ */ jsxs(Container, { "data-testid": "presentation-root", direction: "column", height: "fill", children: [
3032
3118
  t32,
3033
3119
  t44
3034
- ] }), $[153] = t32, $[154] = t44, $[155] = t45) : t45 = $[155];
3120
+ ] }), $[154] = t32, $[155] = t44, $[156] = t45) : t45 = $[156];
3035
3121
  let t46;
3036
- $[156] !== t45 || $[157] !== visualEditingComlink ? (t46 = /* @__PURE__ */ jsx(SharedStateProvider, { comlink: visualEditingComlink, children: t45 }), $[156] = t45, $[157] = visualEditingComlink, $[158] = t46) : t46 = $[158];
3122
+ $[157] !== t45 || $[158] !== visualEditingComlink ? (t46 = /* @__PURE__ */ jsx(SharedStateProvider, { comlink: visualEditingComlink, children: t45 }), $[157] = t45, $[158] = visualEditingComlink, $[159] = t46) : t46 = $[159];
3037
3123
  let t47;
3038
- $[159] !== params || $[160] !== t46 ? (t47 = /* @__PURE__ */ jsx(PresentationParamsProvider, { params, children: t46 }), $[159] = params, $[160] = t46, $[161] = t47) : t47 = $[161];
3124
+ $[160] !== params || $[161] !== t46 ? (t47 = /* @__PURE__ */ jsx(PresentationParamsProvider, { params, children: t46 }), $[160] = params, $[161] = t46, $[162] = t47) : t47 = $[162];
3039
3125
  let t48;
3040
- $[162] !== navigate || $[163] !== t47 ? (t48 = /* @__PURE__ */ jsx(PresentationNavigateProvider, { navigate, children: t47 }), $[162] = navigate, $[163] = t47, $[164] = t48) : t48 = $[164];
3126
+ $[163] !== navigate || $[164] !== t47 ? (t48 = /* @__PURE__ */ jsx(PresentationNavigateProvider, { navigate, children: t47 }), $[163] = navigate, $[164] = t47, $[165] = t48) : t48 = $[165];
3041
3127
  let t49;
3042
- $[165] !== devMode || $[166] !== name || $[167] !== navigate || $[168] !== params || $[169] !== searchParams || $[170] !== structureParams || $[171] !== t48 ? (t49 = /* @__PURE__ */ jsx(PresentationProvider, { devMode, name, navigate, params, searchParams, structureParams, children: t48 }), $[165] = devMode, $[166] = name, $[167] = navigate, $[168] = params, $[169] = searchParams, $[170] = structureParams, $[171] = t48, $[172] = t49) : t49 = $[172];
3128
+ $[166] !== devMode || $[167] !== name || $[168] !== navigate || $[169] !== params || $[170] !== searchParams || $[171] !== structureParams || $[172] !== t48 ? (t49 = /* @__PURE__ */ jsx(PresentationProvider, { devMode, name, navigate, params, searchParams, structureParams, children: t48 }), $[166] = devMode, $[167] = name, $[168] = navigate, $[169] = params, $[170] = searchParams, $[171] = structureParams, $[172] = t48, $[173] = t49) : t49 = $[173];
3043
3129
  let t50;
3044
- $[173] !== controller || $[174] !== displayedDocument || $[175] !== perspective || $[176] !== setDocumentsOnPage || $[177] !== setLoadersConnection ? (t50 = controller && /* @__PURE__ */ jsx(LiveQueries, { controller, perspective, liveDocument: displayedDocument, onDocumentsOnPage: setDocumentsOnPage, onLoadersConnection: setLoadersConnection }), $[173] = controller, $[174] = displayedDocument, $[175] = perspective, $[176] = setDocumentsOnPage, $[177] = setLoadersConnection, $[178] = t50) : t50 = $[178];
3130
+ $[174] !== controller || $[175] !== displayedDocument || $[176] !== perspective || $[177] !== setDocumentsOnPage || $[178] !== setLoadersConnection ? (t50 = controller && /* @__PURE__ */ jsx(LiveQueries, { controller, perspective, liveDocument: displayedDocument, onDocumentsOnPage: setDocumentsOnPage, onLoadersConnection: setLoadersConnection }), $[174] = controller, $[175] = displayedDocument, $[176] = perspective, $[177] = setDocumentsOnPage, $[178] = setLoadersConnection, $[179] = t50) : t50 = $[179];
3045
3131
  let t51;
3046
- $[179] !== loadersConnection || $[180] !== params.id || $[181] !== params.type || $[182] !== previewKitConnection || $[183] !== visualEditingComlink ? (t51 = visualEditingComlink && params.id && params.type && /* @__PURE__ */ jsx(PostMessageRefreshMutations, { comlink: visualEditingComlink, id: params.id, type: params.type, loadersConnection, previewKitConnection }), $[179] = loadersConnection, $[180] = params.id, $[181] = params.type, $[182] = previewKitConnection, $[183] = visualEditingComlink, $[184] = t51) : t51 = $[184];
3132
+ $[180] !== loadersConnection || $[181] !== params.id || $[182] !== params.type || $[183] !== previewKitConnection || $[184] !== visualEditingComlink ? (t51 = visualEditingComlink && params.id && params.type && /* @__PURE__ */ jsx(PostMessageRefreshMutations, { comlink: visualEditingComlink, id: params.id, type: params.type, loadersConnection, previewKitConnection }), $[180] = loadersConnection, $[181] = params.id, $[182] = params.type, $[183] = previewKitConnection, $[184] = visualEditingComlink, $[185] = t51) : t51 = $[185];
3047
3133
  let t52;
3048
- $[185] !== perspective || $[186] !== visualEditingComlink ? (t52 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageSchema, { comlink: visualEditingComlink, perspective }), $[185] = perspective, $[186] = visualEditingComlink, $[187] = t52) : t52 = $[187];
3134
+ $[186] !== perspective || $[187] !== visualEditingComlink ? (t52 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageSchema, { comlink: visualEditingComlink, perspective }), $[186] = perspective, $[187] = visualEditingComlink, $[188] = t52) : t52 = $[188];
3049
3135
  let t53;
3050
- $[188] !== documentsOnPage || $[189] !== perspective || $[190] !== visualEditingComlink ? (t53 = visualEditingComlink && documentsOnPage.length > 0 && /* @__PURE__ */ jsx(PostMessagePreviewSnapshots, { comlink: visualEditingComlink, perspective, refs: documentsOnPage }), $[188] = documentsOnPage, $[189] = perspective, $[190] = visualEditingComlink, $[191] = t53) : t53 = $[191];
3136
+ $[189] !== documentsOnPage || $[190] !== perspective || $[191] !== visualEditingComlink ? (t53 = visualEditingComlink && documentsOnPage.length > 0 && /* @__PURE__ */ jsx(PostMessagePreviewSnapshots, { comlink: visualEditingComlink, perspective, refs: documentsOnPage }), $[189] = documentsOnPage, $[190] = perspective, $[191] = visualEditingComlink, $[192] = t53) : t53 = $[192];
3051
3137
  let t54;
3052
- $[192] !== perspective || $[193] !== visualEditingComlink ? (t54 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageDocuments, { comlink: visualEditingComlink, perspective }), $[192] = perspective, $[193] = visualEditingComlink, $[194] = t54) : t54 = $[194];
3138
+ $[193] !== perspective || $[194] !== visualEditingComlink ? (t54 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageDocuments, { comlink: visualEditingComlink, perspective }), $[193] = perspective, $[194] = visualEditingComlink, $[195] = t54) : t54 = $[195];
3053
3139
  let t55;
3054
- $[195] !== visualEditingComlink ? (t55 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageFeatures, { comlink: visualEditingComlink }), $[195] = visualEditingComlink, $[196] = t55) : t55 = $[196];
3140
+ $[196] !== visualEditingComlink ? (t55 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageFeatures, { comlink: visualEditingComlink }), $[196] = visualEditingComlink, $[197] = t55) : t55 = $[197];
3055
3141
  let t56;
3056
- $[197] !== perspective || $[198] !== visualEditingComlink ? (t56 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessagePerspective, { comlink: visualEditingComlink, perspective, setHandlesPerspectiveChange }), $[197] = perspective, $[198] = visualEditingComlink, $[199] = t56) : t56 = $[199];
3142
+ $[198] !== perspective || $[199] !== visualEditingComlink ? (t56 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessagePerspective, { comlink: visualEditingComlink, perspective, setHandlesPerspectiveChange }), $[198] = perspective, $[199] = visualEditingComlink, $[200] = t56) : t56 = $[200];
3057
3143
  let t57;
3058
- $[200] !== visualEditingComlink ? (t57 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageTelemetry, { comlink: visualEditingComlink }), $[200] = visualEditingComlink, $[201] = t57) : t57 = $[201];
3144
+ $[201] !== visualEditingComlink ? (t57 = visualEditingComlink && /* @__PURE__ */ jsx(PostMessageTelemetry, { comlink: visualEditingComlink }), $[201] = visualEditingComlink, $[202] = t57) : t57 = $[202];
3059
3145
  let t58;
3060
- $[202] !== t50 || $[203] !== t51 || $[204] !== t52 || $[205] !== t53 || $[206] !== t54 || $[207] !== t55 || $[208] !== t56 || $[209] !== t57 ? (t58 = /* @__PURE__ */ jsxs(Suspense, { children: [
3146
+ $[203] !== t50 || $[204] !== t51 || $[205] !== t52 || $[206] !== t53 || $[207] !== t54 || $[208] !== t55 || $[209] !== t56 || $[210] !== t57 ? (t58 = /* @__PURE__ */ jsxs(Suspense, { children: [
3061
3147
  t50,
3062
3148
  t51,
3063
3149
  t52,
@@ -3066,12 +3152,12 @@ function PresentationTool(props) {
3066
3152
  t55,
3067
3153
  t56,
3068
3154
  t57
3069
- ] }), $[202] = t50, $[203] = t51, $[204] = t52, $[205] = t53, $[206] = t54, $[207] = t55, $[208] = t56, $[209] = t57, $[210] = t58) : t58 = $[210];
3155
+ ] }), $[203] = t50, $[204] = t51, $[205] = t52, $[206] = t53, $[207] = t54, $[208] = t55, $[209] = t56, $[210] = t57, $[211] = t58) : t58 = $[211];
3070
3156
  let t59;
3071
- return $[211] !== t49 || $[212] !== t58 ? (t59 = /* @__PURE__ */ jsxs(Fragment, { children: [
3157
+ return $[212] !== t49 || $[213] !== t58 ? (t59 = /* @__PURE__ */ jsxs(Fragment, { children: [
3072
3158
  t49,
3073
3159
  t58
3074
- ] }), $[211] = t49, $[212] = t58, $[213] = t59) : t59 = $[213], t59;
3160
+ ] }), $[212] = t49, $[213] = t58, $[214] = t59) : t59 = $[214], t59;
3075
3161
  }
3076
3162
  function _temp2$2(state_0) {
3077
3163
  return state_0.matches("loading");