sanity 3.73.1-next.0 → 3.74.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.
@@ -6587,72 +6587,82 @@ const DocumentPaneProvider = React.memo((props) => {
6587
6587
  });
6588
6588
  DocumentPaneProvider.displayName = "Memo(DocumentPaneProvider)";
6589
6589
  const DocumentEventsPane = (props) => {
6590
- const $ = reactCompilerRuntime.c(33), {
6590
+ const $ = reactCompilerRuntime.c(37), {
6591
6591
  params: t0
6592
- } = usePaneRouter(), params = t0 === void 0 ? EMPTY_PARAMS$1 : t0, options = usePaneOptions(props.pane.options, params), {
6593
- selectedPerspectiveName
6592
+ } = usePaneRouter(), params = t0 === void 0 ? EMPTY_PARAMS$1 : t0, options = usePaneOptions(props.pane.options, params), schema = sanity.useSchema(), documentType = options.type, liveEdit = !!schema.get(options.type)?.liveEdit, {
6593
+ selectedPerspectiveName,
6594
+ selectedReleaseId,
6595
+ selectedPerspective
6594
6596
  } = sanity.usePerspective(), {
6595
6597
  data: archivedReleases
6596
- } = sanity.useArchivedReleases(), {
6598
+ } = sanity.useArchivedReleases();
6599
+ let t1;
6600
+ $[0] !== options.id ? (t1 = sanity.getPublishedId(options.id), $[0] = options.id, $[1] = t1) : t1 = $[1];
6601
+ const editState = sanity.useEditState(t1, documentType, "default", selectedReleaseId), showingPublishedOnDraft = liveEdit && selectedPerspective === "drafts" && !editState?.draft, {
6597
6602
  rev,
6598
6603
  since
6599
6604
  } = params, historyVersion = params.historyVersion;
6600
- let t1;
6605
+ let t2;
6601
6606
  bb0: {
6607
+ if (showingPublishedOnDraft) {
6608
+ let t32;
6609
+ $[2] !== options.id ? (t32 = sanity.getPublishedId(options.id), $[2] = options.id, $[3] = t32) : t32 = $[3], t2 = t32;
6610
+ break bb0;
6611
+ }
6602
6612
  if (historyVersion && archivedReleases.some((release) => sanity.getReleaseIdFromReleaseDocumentId(release._id) === historyVersion)) {
6603
- let t22;
6604
- $[0] !== historyVersion || $[1] !== options.id ? (t22 = sanity.getVersionId(options.id, historyVersion), $[0] = historyVersion, $[1] = options.id, $[2] = t22) : t22 = $[2], t1 = t22;
6613
+ let t32;
6614
+ $[4] !== historyVersion || $[5] !== options.id ? (t32 = sanity.getVersionId(options.id, historyVersion), $[4] = historyVersion, $[5] = options.id, $[6] = t32) : t32 = $[6], t2 = t32;
6605
6615
  break bb0;
6606
6616
  }
6607
6617
  if (typeof selectedPerspectiveName > "u") {
6608
- let t22;
6609
- $[3] !== options.id ? (t22 = sanity.getDraftId(options.id), $[3] = options.id, $[4] = t22) : t22 = $[4], t1 = t22;
6618
+ let t32;
6619
+ $[7] !== options.id ? (t32 = sanity.getDraftId(options.id), $[7] = options.id, $[8] = t32) : t32 = $[8], t2 = t32;
6610
6620
  break bb0;
6611
6621
  }
6612
6622
  if (selectedPerspectiveName === "published") {
6613
- let t22;
6614
- $[5] !== options.id ? (t22 = sanity.getPublishedId(options.id), $[5] = options.id, $[6] = t22) : t22 = $[6], t1 = t22;
6623
+ let t32;
6624
+ $[9] !== options.id ? (t32 = sanity.getPublishedId(options.id), $[9] = options.id, $[10] = t32) : t32 = $[10], t2 = t32;
6615
6625
  break bb0;
6616
6626
  }
6617
- if (selectedPerspectiveName.startsWith("r")) {
6618
- let t22;
6619
- $[7] !== options.id || $[8] !== selectedPerspectiveName ? (t22 = sanity.getVersionId(options.id, selectedPerspectiveName), $[7] = options.id, $[8] = selectedPerspectiveName, $[9] = t22) : t22 = $[9], t1 = t22;
6627
+ if (selectedReleaseId) {
6628
+ let t32;
6629
+ $[11] !== options.id || $[12] !== selectedPerspectiveName ? (t32 = sanity.getVersionId(options.id, selectedPerspectiveName), $[11] = options.id, $[12] = selectedPerspectiveName, $[13] = t32) : t32 = $[13], t2 = t32;
6620
6630
  break bb0;
6621
6631
  }
6622
- t1 = options.id;
6632
+ t2 = options.id;
6623
6633
  }
6624
- const documentId = t1;
6625
- let t2;
6626
- $[10] !== documentId || $[11] !== options.type || $[12] !== rev || $[13] !== since ? (t2 = {
6634
+ const documentId = t2;
6635
+ let t3;
6636
+ $[14] !== documentId || $[15] !== options.type || $[16] !== rev || $[17] !== since ? (t3 = {
6627
6637
  documentId,
6628
6638
  documentType: options.type,
6629
6639
  rev,
6630
6640
  since
6631
- }, $[10] = documentId, $[11] = options.type, $[12] = rev, $[13] = since, $[14] = t2) : t2 = $[14];
6632
- const eventsStore = sanity.useEventsStore(t2);
6633
- let t3;
6634
- const t4 = eventsStore.error, t5 = eventsStore.revision?.revisionId || null, t6 = !!(eventsStore.revision?.document && eventsStore.revision?.revisionId), t7 = eventsStore.revision?.document || null, t8 = eventsStore.sinceRevision?.document || null, t9 = !eventsStore.loading, t10 = eventsStore.events.length === 0;
6635
- let t11;
6636
- $[15] !== eventsStore.events ? (t11 = eventsStore.events.find(_temp$5)?.id || null, $[15] = eventsStore.events, $[16] = t11) : t11 = $[16];
6641
+ }, $[14] = documentId, $[15] = options.type, $[16] = rev, $[17] = since, $[18] = t3) : t3 = $[18];
6642
+ const eventsStore = sanity.useEventsStore(t3);
6643
+ let t4;
6644
+ const t5 = eventsStore.error, t6 = eventsStore.revision?.revisionId || null, t7 = !!(eventsStore.revision?.document && eventsStore.revision?.revisionId), t8 = eventsStore.revision?.document || null, t9 = eventsStore.sinceRevision?.document || null, t10 = !eventsStore.loading, t11 = eventsStore.events.length === 0;
6637
6645
  let t12;
6638
- $[17] !== eventsStore.error || $[18] !== t10 || $[19] !== t11 || $[20] !== t5 || $[21] !== t6 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9 ? (t12 = {
6639
- error: t4,
6640
- revisionId: t5,
6641
- onOlderRevision: t6,
6642
- revisionDocument: t7,
6643
- sinceDocument: t8,
6644
- ready: t9,
6645
- isPristine: t10,
6646
- lastNonDeletedRevId: t11
6647
- }, $[17] = eventsStore.error, $[18] = t10, $[19] = t11, $[20] = t5, $[21] = t6, $[22] = t7, $[23] = t8, $[24] = t9, $[25] = t12) : t12 = $[25], t3 = t12;
6648
- const historyStoreProps = t3;
6646
+ $[19] !== eventsStore.events ? (t12 = eventsStore.events.find(_temp$5)?.id || null, $[19] = eventsStore.events, $[20] = t12) : t12 = $[20];
6649
6647
  let t13;
6650
- t13 = eventsStore;
6651
- const value = t13;
6648
+ $[21] !== eventsStore.error || $[22] !== t10 || $[23] !== t11 || $[24] !== t12 || $[25] !== t6 || $[26] !== t7 || $[27] !== t8 || $[28] !== t9 ? (t13 = {
6649
+ error: t5,
6650
+ revisionId: t6,
6651
+ onOlderRevision: t7,
6652
+ revisionDocument: t8,
6653
+ sinceDocument: t9,
6654
+ ready: t10,
6655
+ isPristine: t11,
6656
+ lastNonDeletedRevId: t12
6657
+ }, $[21] = eventsStore.error, $[22] = t10, $[23] = t11, $[24] = t12, $[25] = t6, $[26] = t7, $[27] = t8, $[28] = t9, $[29] = t13) : t13 = $[29], t4 = t13;
6658
+ const historyStoreProps = t4;
6652
6659
  let t14;
6653
- $[26] !== historyStoreProps || $[27] !== historyVersion || $[28] !== props ? (t14 = historyVersion ? /* @__PURE__ */ jsxRuntime.jsx(sanity.PerspectiveProvider, { selectedPerspectiveName: historyVersion, excludedPerspectives: sanity.EMPTY_ARRAY, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentPaneProvider, { ...props, historyStore: historyStoreProps }) }) : /* @__PURE__ */ jsxRuntime.jsx(DocumentPaneProvider, { ...props, historyStore: historyStoreProps }), $[26] = historyStoreProps, $[27] = historyVersion, $[28] = props, $[29] = t14) : t14 = $[29];
6660
+ t14 = eventsStore;
6661
+ const value = t14;
6654
6662
  let t15;
6655
- return $[30] !== t14 || $[31] !== value ? (t15 = /* @__PURE__ */ jsxRuntime.jsx(sanity.EventsProvider, { value, children: t14 }), $[30] = t14, $[31] = value, $[32] = t15) : t15 = $[32], t15;
6663
+ $[30] !== historyStoreProps || $[31] !== historyVersion || $[32] !== props ? (t15 = historyVersion ? /* @__PURE__ */ jsxRuntime.jsx(sanity.PerspectiveProvider, { selectedPerspectiveName: historyVersion, excludedPerspectives: sanity.EMPTY_ARRAY, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentPaneProvider, { ...props, historyStore: historyStoreProps }) }) : /* @__PURE__ */ jsxRuntime.jsx(DocumentPaneProvider, { ...props, historyStore: historyStoreProps }), $[30] = historyStoreProps, $[31] = historyVersion, $[32] = props, $[33] = t15) : t15 = $[33];
6664
+ let t16;
6665
+ return $[34] !== t15 || $[35] !== value ? (t16 = /* @__PURE__ */ jsxRuntime.jsx(sanity.EventsProvider, { value, children: t15 }), $[34] = t15, $[35] = value, $[36] = t16) : t16 = $[36], t16;
6656
6666
  };
6657
6667
  function _temp$5(e) {
6658
6668
  return !sanity.isDeleteDocumentGroupEvent(e) && !sanity.isDeleteDocumentVersionEvent(e);