sanity 5.3.0-next.12 → 5.3.0-next.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ try {
7
7
  try {
8
8
  buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
9
9
  // and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
10
- "5.3.0-next.12+5e9770d032";
10
+ "5.3.0-next.14+27686cb16d";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.d.ts CHANGED
@@ -16167,31 +16167,24 @@ export declare interface UnscheduleDocumentVersionEvent extends BaseEvent {
16167
16167
  export declare function unset(path?: Path): FormUnsetPatch
16168
16168
 
16169
16169
  /**
16170
+ * @deprecated Use `useUnstableObserveDocument` instead
16170
16171
  * @internal
16171
16172
  * @beta
16172
- *
16173
- * Observes a document by its ID and returns the document and loading state
16174
- * it will listen to the document changes.
16175
16173
  */
16176
- export declare function unstable_useObserveDocument<T extends SanityDocument_2>(
16177
- documentId: string,
16178
- apiConfig?: ObserveDocumentAPIConfig,
16179
- ): {
16180
- document: T | null
16174
+ export declare const unstable_useObserveDocument: (
16175
+ args: Parameters<typeof useUnstableObserveDocument>,
16176
+ ) => {
16177
+ document: SanityDocument_2 | null
16181
16178
  loading: boolean
16182
16179
  }
16183
16180
 
16184
16181
  /**
16185
16182
  * @internal
16186
- * @deprecated FOR INTERNAL USE.
16183
+ * @deprecated use useValuePreview instead
16187
16184
  */
16188
- export declare function unstable_useValuePreview(props: {
16189
- enabled?: boolean
16190
- ordering?: SortOrdering
16191
- schemaType?: SchemaType
16192
- value: unknown | undefined
16193
- perspectiveStack?: PerspectiveStack
16194
- }): State_2
16185
+ export declare function unstable_useValuePreview(
16186
+ args: Parameters<typeof useValuePreview>[0],
16187
+ ): State_2
16195
16188
 
16196
16189
  /**
16197
16190
  * @hidden
@@ -17813,6 +17806,21 @@ export declare type UseUnitFormatterOptions = Pick<
17813
17806
  'notation' | 'signDisplay' | 'unitDisplay' | 'maximumFractionDigits' | 'minimumFractionDigits'
17814
17807
  >
17815
17808
 
17809
+ /**
17810
+ * @internal
17811
+ * @beta
17812
+ *
17813
+ * Observes a document by its ID and returns the document and loading state
17814
+ * it will listen to the document changes.
17815
+ */
17816
+ export declare function useUnstableObserveDocument<T extends SanityDocument_2>(
17817
+ documentId: string,
17818
+ apiConfig?: ObserveDocumentAPIConfig,
17819
+ ): {
17820
+ document: T | null
17821
+ loading: boolean
17822
+ }
17823
+
17816
17824
  /** @internal */
17817
17825
  export declare function useUser(userId: string): LoadingTuple<User | null | undefined>
17818
17826
 
@@ -17843,6 +17851,17 @@ export declare function useValidationStatus(
17843
17851
  requirePublishedReferences: boolean,
17844
17852
  ): ValidationStatus
17845
17853
 
17854
+ /**
17855
+ * @internal
17856
+ */
17857
+ export declare function useValuePreview(props: {
17858
+ enabled?: boolean
17859
+ ordering?: SortOrdering
17860
+ schemaType?: SchemaType
17861
+ value: unknown | undefined
17862
+ perspectiveStack?: PerspectiveStack
17863
+ }): State_2
17864
+
17846
17865
  /** @internal */
17847
17866
  export declare function useVersionOperations(): VersionOperationsValue
17848
17867
 
package/lib/index.js CHANGED
@@ -22949,6 +22949,9 @@ function useSearchableList(items) {
22949
22949
  function isGoingToUnpublish(document2) {
22950
22950
  return document2._system?.delete === !0;
22951
22951
  }
22952
+ function unstable_useValuePreview(args) {
22953
+ return useValuePreview(args);
22954
+ }
22952
22955
  const INITIAL_STATE$9 = {
22953
22956
  isLoading: !0
22954
22957
  }, IDLE_STATE = {
@@ -22958,7 +22961,7 @@ const INITIAL_STATE$9 = {
22958
22961
  description: void 0
22959
22962
  }
22960
22963
  };
22961
- function useDocumentPreview(props2) {
22964
+ function useValuePreview(props2) {
22962
22965
  const $ = c(10);
22963
22966
  let t0;
22964
22967
  $[0] !== props2 ? (t0 = props2 || {}, $[0] = props2, $[1] = t0) : t0 = $[1];
@@ -23013,7 +23016,7 @@ function _temp$3l(event) {
23013
23016
  };
23014
23017
  }
23015
23018
  function useValuePreviewWithFallback(props2) {
23016
- const $ = c(9), preview = useDocumentPreview(props2), {
23019
+ const $ = c(9), preview = useValuePreview(props2), {
23017
23020
  t
23018
23021
  } = useTranslation(), t0 = preview?.value;
23019
23022
  let t1;
@@ -42099,7 +42102,7 @@ function PreviewLoader(props2) {
42099
42102
  value,
42100
42103
  perspectiveStack
42101
42104
  }, $[9] = perspectiveStack, $[10] = schemaType, $[11] = t0, $[12] = value, $[13] = t1) : t1 = $[13];
42102
- const preview = useDocumentPreview(t1), t2 = styleProp?.minWidth || 1, t3 = styleProp?.minHeight || 1;
42105
+ const preview = useValuePreview(t1), t2 = styleProp?.minWidth || 1, t3 = styleProp?.minHeight || 1;
42103
42106
  let t4;
42104
42107
  $[14] !== styleProp || $[15] !== t2 || $[16] !== t3 ? (t4 = {
42105
42108
  ...styleProp,
@@ -43845,7 +43848,7 @@ const INITIAL_STATE$6 = {
43845
43848
  loading: !0,
43846
43849
  document: null
43847
43850
  };
43848
- function useObserveDocument(documentId, apiConfig) {
43851
+ function useUnstableObserveDocument(documentId, apiConfig) {
43849
43852
  const $ = c(4), documentPreviewStore = useDocumentPreviewStore();
43850
43853
  let t0;
43851
43854
  return $[0] !== apiConfig || $[1] !== documentId || $[2] !== documentPreviewStore ? (t0 = documentPreviewStore.unstable_observeDocument(documentId, apiConfig).pipe(map(_temp$2h)), $[0] = apiConfig, $[1] = documentId, $[2] = documentPreviewStore, $[3] = t0) : t0 = $[3], useObservable(t0, INITIAL_STATE$6);
@@ -43856,6 +43859,7 @@ function _temp$2h(document2) {
43856
43859
  document: document2
43857
43860
  };
43858
43861
  }
43862
+ const unstable_useObserveDocument = (args) => useUnstableObserveDocument(...args);
43859
43863
  function getPreviewStateObservable$1(documentPreviewStore, schemaType, documentId, perspective, viewOptions) {
43860
43864
  const perspectiveSnapshot = documentPreviewStore.observeForPreview({
43861
43865
  _id: getPublishedId(documentId)
@@ -45168,7 +45172,7 @@ function UnpublishVersionDialog(props2) {
45168
45172
  schemaType,
45169
45173
  value: t2
45170
45174
  }, $[12] = schemaType, $[13] = t2, $[14] = t3) : t3 = $[14];
45171
- const preview = useDocumentPreview(t3);
45175
+ const preview = useValuePreview(t3);
45172
45176
  let t4;
45173
45177
  $[15] !== coreT || $[16] !== documentVersionId || $[17] !== onClose || $[18] !== preview?.value?.title || $[19] !== toast || $[20] !== unpublishVersion ? (t4 = async () => {
45174
45178
  setIsUnpublishing(!0);
@@ -51541,7 +51545,7 @@ function SearchResultItem(t0) {
51541
51545
  schemaType: type,
51542
51546
  value: documentStub
51543
51547
  }, $[31] = documentStub, $[32] = type, $[33] = t10) : t10 = $[33];
51544
- const preview = useDocumentPreview(t10);
51548
+ const preview = useValuePreview(t10);
51545
51549
  let t11;
51546
51550
  $[34] !== disableIntentLink || $[35] !== documentId || $[36] !== documentType || $[37] !== onClick2 || $[38] !== onIntentClick || $[39] !== onItemSelect || $[40] !== preview ? (t11 = (e) => {
51547
51551
  onItemSelect?.({
@@ -53817,7 +53821,7 @@ function useScheduledDraftDocument(releaseDocumentId, t0) {
53817
53821
  const {
53818
53822
  value: previewValue,
53819
53823
  isLoading: previewLoading
53820
- } = useDocumentPreview(t7), t8 = includePreview ? previewValue : void 0, t9 = includePreview ? previewLoading : !1;
53824
+ } = unstable_useValuePreview(t7), t8 = includePreview ? previewValue : void 0, t9 = includePreview ? previewLoading : !1;
53821
53825
  let t10;
53822
53826
  return $[11] !== documentsCount || $[12] !== error || $[13] !== firstDocument || $[14] !== firstDocumentValidation || $[15] !== loading || $[16] !== t8 || $[17] !== t9 ? (t10 = {
53823
53827
  firstDocument,
@@ -64820,7 +64824,7 @@ const useDocumentTitle = (t0) => {
64820
64824
  const {
64821
64825
  error,
64822
64826
  value
64823
- } = useDocumentPreview(t3);
64827
+ } = useValuePreview(t3);
64824
64828
  if (!schemaType) {
64825
64829
  let t42;
64826
64830
  return $[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t42 = {
@@ -90485,8 +90489,8 @@ export {
90485
90489
  truncateString,
90486
90490
  uncaughtErrorHandler,
90487
90491
  unset,
90488
- useObserveDocument as unstable_useObserveDocument,
90489
- useDocumentPreview as unstable_useValuePreview,
90492
+ unstable_useObserveDocument,
90493
+ unstable_useValuePreview,
90490
90494
  usEnglishLocale,
90491
90495
  useActiveReleases,
90492
90496
  useActiveWorkspace,
@@ -90613,12 +90617,14 @@ export {
90613
90617
  useTranslation,
90614
90618
  useUnique,
90615
90619
  useUnitFormatter,
90620
+ useUnstableObserveDocument,
90616
90621
  useUser,
90617
90622
  useUserColor,
90618
90623
  useUserColorManager,
90619
90624
  useUserListWithPermissions,
90620
90625
  useUserStore,
90621
90626
  useValidationStatus,
90627
+ useValuePreview,
90622
90628
  useVersionOperations,
90623
90629
  useVirtualizerScrollInstance,
90624
90630
  useWorkspace,