sanity 5.1.0-next.18 → 5.1.0-next.19

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.
@@ -1,4 +1,4 @@
1
- var version = "5.1.0-next.18+a0b47a9932", peerDependencies = {
1
+ var version = "5.1.0-next.19+df4d72cb45", peerDependencies = {
2
2
  "styled-components": "^6.1.15"
3
3
  };
4
4
  export {
@@ -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.1.0-next.18+a0b47a9932";
10
+ "5.1.0-next.19+df4d72cb45";
11
11
  } catch {
12
12
  }
13
13
  const SANITY_VERSION = buildVersion || `${version}-dev`;
package/lib/index.js CHANGED
@@ -58109,7 +58109,7 @@ function useComlinkViewHistory(t0) {
58109
58109
  $[13] !== displayed || $[14] !== editState2.ready || $[15] !== recordEvent || $[16] !== t7 ? (t8 = [t7, displayed, editState2.ready, recordEvent], $[13] = displayed, $[14] = editState2.ready, $[15] = recordEvent, $[16] = t7, $[17] = t8) : t8 = $[17], useEffect(t6, t8);
58110
58110
  }
58111
58111
  function useDocumentForm(options) {
58112
- const $ = c(164), {
58112
+ const $ = c(165), {
58113
58113
  documentType,
58114
58114
  getFormDocumentValue,
58115
58115
  documentId,
@@ -58182,7 +58182,7 @@ function useDocumentForm(options) {
58182
58182
  _type: documentType
58183
58183
  }, $[15] = documentId, $[16] = documentType, $[17] = initialValue?.value, $[18] = t82) : t82 = $[18];
58184
58184
  const baseValue = t82;
58185
- if (selectedPerspectiveName) {
58185
+ if (releaseId) {
58186
58186
  if (editState2.version && isGoingToUnpublish(editState2.version)) {
58187
58187
  t7 = editState2.published || baseValue;
58188
58188
  break bb1;
@@ -58198,7 +58198,7 @@ function useDocumentForm(options) {
58198
58198
  }), $[19] = baseValue, $[20] = documentId, $[21] = documentType, $[22] = editState2.published, $[23] = liveEdit, $[24] = t92) : t92 = $[24], t7 = t92;
58199
58199
  break bb1;
58200
58200
  }
58201
- if (!selectedPerspectiveName && onlyHasVersions) {
58201
+ if (selectedPerspectiveName || onlyHasVersions) {
58202
58202
  t7 = editState2.version || editState2.draft || editState2.published || baseValue;
58203
58203
  break bb1;
58204
58204
  }
@@ -58282,41 +58282,41 @@ function useDocumentForm(options) {
58282
58282
  isLockedByCanvas
58283
58283
  } = useCanvasCompanionDoc(value._id);
58284
58284
  let t23;
58285
- $[58] !== connectionState || $[59] !== editState2 || $[60] !== isCreateLinked || $[61] !== isLockedByCanvas || $[62] !== isNonExistent || $[63] !== isPermissionsLoading || $[64] !== isReleaseLocked || $[65] !== liveEdit || $[66] !== onlyHasVersions || $[67] !== permissions?.granted || $[68] !== readOnlyProp || $[69] !== ready || $[70] !== schemaType || $[71] !== selectedPerspectiveName || $[72] !== value ? (t23 = () => {
58285
+ $[58] !== connectionState || $[59] !== editState2 || $[60] !== isCreateLinked || $[61] !== isLockedByCanvas || $[62] !== isNonExistent || $[63] !== isPermissionsLoading || $[64] !== isReleaseLocked || $[65] !== liveEdit || $[66] !== onlyHasVersions || $[67] !== permissions?.granted || $[68] !== readOnlyProp || $[69] !== ready || $[70] !== releaseId || $[71] !== schemaType || $[72] !== selectedPerspectiveName || $[73] !== value ? (t23 = () => {
58286
58286
  const hasNoPermission = !isPermissionsLoading && !permissions?.granted, updateActionDisabled = !isActionEnabled(schemaType, "update"), createActionDisabled = isNonExistent && !isActionEnabled(schemaType, "create"), reconnecting = connectionState === "reconnecting", isLocked = editState2.transactionSyncLock?.enabled, willBeUnpublished = value ? isGoingToUnpublish(value) : !1;
58287
- return editState2.version && !editState2.draft && !editState2.published && onlyHasVersions && selectedPerspectiveName !== getVersionFromId(editState2.version._id) && isNewDocument(editState2) === !1 || liveEdit && editState2.draft?._id || !liveEdit && selectedPerspectiveName === "published" || selectedPerspectiveName && getVersionFromId(value._id) !== selectedPerspectiveName && isNewDocument(editState2) === !1 || !ready || isLockedByCanvas || hasNoPermission || updateActionDisabled || createActionDisabled || reconnecting || isLocked || isCreateLinked || willBeUnpublished || isReleaseLocked ? !0 : typeof readOnlyProp == "function" ? readOnlyProp(editState2) : !!readOnlyProp;
58288
- }, $[58] = connectionState, $[59] = editState2, $[60] = isCreateLinked, $[61] = isLockedByCanvas, $[62] = isNonExistent, $[63] = isPermissionsLoading, $[64] = isReleaseLocked, $[65] = liveEdit, $[66] = onlyHasVersions, $[67] = permissions?.granted, $[68] = readOnlyProp, $[69] = ready, $[70] = schemaType, $[71] = selectedPerspectiveName, $[72] = value, $[73] = t23) : t23 = $[73];
58287
+ return editState2.version && !editState2.draft && !editState2.published && onlyHasVersions && selectedPerspectiveName !== getVersionFromId(editState2.version._id) && isNewDocument(editState2) === !1 || liveEdit && editState2.draft?._id || !liveEdit && selectedPerspectiveName === "published" || releaseId && getVersionFromId(value._id) !== releaseId && isNewDocument(editState2) === !1 || !ready || isLockedByCanvas || hasNoPermission || updateActionDisabled || createActionDisabled || reconnecting || isLocked || isCreateLinked || willBeUnpublished || isReleaseLocked ? !0 : typeof readOnlyProp == "function" ? readOnlyProp(editState2) : !!readOnlyProp;
58288
+ }, $[58] = connectionState, $[59] = editState2, $[60] = isCreateLinked, $[61] = isLockedByCanvas, $[62] = isNonExistent, $[63] = isPermissionsLoading, $[64] = isReleaseLocked, $[65] = liveEdit, $[66] = onlyHasVersions, $[67] = permissions?.granted, $[68] = readOnlyProp, $[69] = ready, $[70] = releaseId, $[71] = schemaType, $[72] = selectedPerspectiveName, $[73] = value, $[74] = t23) : t23 = $[74];
58289
58289
  let t24;
58290
- $[74] !== t23 ? (t24 = t23(), $[74] = t23, $[75] = t24) : t24 = $[75];
58290
+ $[75] !== t23 ? (t24 = t23(), $[75] = t23, $[76] = t24) : t24 = $[76];
58291
58291
  const readOnly = t24, {
58292
58292
  patch: patch2
58293
58293
  } = useDocumentOperation(documentId, documentType, activeDocumentReleaseId), patchRef = useRef(_temp$1s);
58294
58294
  let t25;
58295
- $[76] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t25 = (event) => patchRef.current(event), $[76] = t25) : t25 = $[76];
58295
+ $[77] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t25 = (event) => patchRef.current(event), $[77] = t25) : t25 = $[77];
58296
58296
  const handleChange = t25;
58297
58297
  let t26;
58298
- $[77] !== editState2.draft || $[78] !== editState2.published || $[79] !== initialValue?.value || $[80] !== isCreateLinked || $[81] !== patch2 || $[82] !== readOnly || $[83] !== telemetry ? (t26 = () => {
58298
+ $[78] !== editState2.draft || $[79] !== editState2.published || $[80] !== initialValue?.value || $[81] !== isCreateLinked || $[82] !== patch2 || $[83] !== readOnly || $[84] !== telemetry ? (t26 = () => {
58299
58299
  readOnly && !isCreateLinked ? patchRef.current = _temp2$B : patchRef.current = (event_0) => {
58300
58300
  !editState2.draft && !editState2.published && telemetry.log(CreatedDraft), patch2.execute(toMutationPatches(event_0.patches), initialValue?.value);
58301
58301
  };
58302
- }, $[77] = editState2.draft, $[78] = editState2.published, $[79] = initialValue?.value, $[80] = isCreateLinked, $[81] = patch2, $[82] = readOnly, $[83] = telemetry, $[84] = t26) : t26 = $[84];
58302
+ }, $[78] = editState2.draft, $[79] = editState2.published, $[80] = initialValue?.value, $[81] = isCreateLinked, $[82] = patch2, $[83] = readOnly, $[84] = telemetry, $[85] = t26) : t26 = $[85];
58303
58303
  let t27;
58304
- $[85] !== editState2.draft || $[86] !== editState2.published || $[87] !== initialValue || $[88] !== isCreateLinked || $[89] !== patch2 || $[90] !== readOnly || $[91] !== telemetry ? (t27 = [editState2.draft, editState2.published, initialValue, patch2, telemetry, readOnly, isCreateLinked], $[85] = editState2.draft, $[86] = editState2.published, $[87] = initialValue, $[88] = isCreateLinked, $[89] = patch2, $[90] = readOnly, $[91] = telemetry, $[92] = t27) : t27 = $[92], useInsertionEffect(t26, t27);
58304
+ $[86] !== editState2.draft || $[87] !== editState2.published || $[88] !== initialValue || $[89] !== isCreateLinked || $[90] !== patch2 || $[91] !== readOnly || $[92] !== telemetry ? (t27 = [editState2.draft, editState2.published, initialValue, patch2, telemetry, readOnly, isCreateLinked], $[86] = editState2.draft, $[87] = editState2.published, $[88] = initialValue, $[89] = isCreateLinked, $[90] = patch2, $[91] = readOnly, $[92] = telemetry, $[93] = t27) : t27 = $[93], useInsertionEffect(t26, t27);
58305
58305
  let t28;
58306
58306
  bb3: {
58307
58307
  if (getFormDocumentValue) {
58308
58308
  let t292;
58309
- $[93] !== getFormDocumentValue || $[94] !== value ? (t292 = getFormDocumentValue(value), $[93] = getFormDocumentValue, $[94] = value, $[95] = t292) : t292 = $[95], t28 = t292;
58309
+ $[94] !== getFormDocumentValue || $[95] !== value ? (t292 = getFormDocumentValue(value), $[94] = getFormDocumentValue, $[95] = value, $[96] = t292) : t292 = $[96], t28 = t292;
58310
58310
  break bb3;
58311
58311
  }
58312
58312
  t28 = value;
58313
58313
  }
58314
58314
  const formDocumentValue = t28;
58315
58315
  let t29;
58316
- $[96] !== upstreamEditState ? (t29 = selectUpstreamVersion(upstreamEditState), $[96] = upstreamEditState, $[97] = t29) : t29 = $[97];
58316
+ $[97] !== upstreamEditState ? (t29 = selectUpstreamVersion(upstreamEditState), $[97] = upstreamEditState, $[98] = t29) : t29 = $[98];
58317
58317
  const hasUpstreamVersion = t29 !== null, t30 = comparisonValue || value;
58318
58318
  let t31;
58319
- $[98] !== changesOpen || $[99] !== collapsedFieldSets || $[100] !== collapsedPaths || $[101] !== displayInlineChanges || $[102] !== fieldGroupState || $[103] !== focusPath || $[104] !== formDocumentValue || $[105] !== hasUpstreamVersion || $[106] !== openPath || $[107] !== presence || $[108] !== readOnly || $[109] !== schemaType || $[110] !== selectedPerspective || $[111] !== t30 || $[112] !== validation2 ? (t31 = {
58319
+ $[99] !== changesOpen || $[100] !== collapsedFieldSets || $[101] !== collapsedPaths || $[102] !== displayInlineChanges || $[103] !== fieldGroupState || $[104] !== focusPath || $[105] !== formDocumentValue || $[106] !== hasUpstreamVersion || $[107] !== openPath || $[108] !== presence || $[109] !== readOnly || $[110] !== schemaType || $[111] !== selectedPerspective || $[112] !== t30 || $[113] !== validation2 ? (t31 = {
58320
58320
  schemaType,
58321
58321
  documentValue: formDocumentValue,
58322
58322
  readOnly,
@@ -58332,25 +58332,25 @@ function useDocumentForm(options) {
58332
58332
  changesOpen,
58333
58333
  hasUpstreamVersion,
58334
58334
  displayInlineChanges
58335
- }, $[98] = changesOpen, $[99] = collapsedFieldSets, $[100] = collapsedPaths, $[101] = displayInlineChanges, $[102] = fieldGroupState, $[103] = focusPath, $[104] = formDocumentValue, $[105] = hasUpstreamVersion, $[106] = openPath, $[107] = presence, $[108] = readOnly, $[109] = schemaType, $[110] = selectedPerspective, $[111] = t30, $[112] = validation2, $[113] = t31) : t31 = $[113];
58335
+ }, $[99] = changesOpen, $[100] = collapsedFieldSets, $[101] = collapsedPaths, $[102] = displayInlineChanges, $[103] = fieldGroupState, $[104] = focusPath, $[105] = formDocumentValue, $[106] = hasUpstreamVersion, $[107] = openPath, $[108] = presence, $[109] = readOnly, $[110] = schemaType, $[111] = selectedPerspective, $[112] = t30, $[113] = validation2, $[114] = t31) : t31 = $[114];
58336
58336
  const formState = useFormState(t31), formStateRef = useRef(formState);
58337
58337
  let t32, t33;
58338
- $[114] !== formState ? (t32 = () => {
58338
+ $[115] !== formState ? (t32 = () => {
58339
58339
  formStateRef.current = formState;
58340
- }, t33 = [formState], $[114] = formState, $[115] = t32, $[116] = t33) : (t32 = $[115], t33 = $[116]), useEffect(t32, t33);
58340
+ }, t33 = [formState], $[115] = formState, $[116] = t32, $[117] = t33) : (t32 = $[116], t33 = $[117]), useEffect(t32, t33);
58341
58341
  let t34;
58342
- $[117] !== editState2 ? (t34 = {
58342
+ $[118] !== editState2 ? (t34 = {
58343
58343
  editState: editState2
58344
- }, $[117] = editState2, $[118] = t34) : t34 = $[118], useComlinkViewHistory(t34);
58344
+ }, $[118] = editState2, $[119] = t34) : t34 = $[119], useComlinkViewHistory(t34);
58345
58345
  let t35;
58346
- $[119] !== onSetCollapsedFieldSets || $[120] !== onSetCollapsedPath || $[121] !== onSetFieldGroupState || $[122] !== onSetOpenPath ? (t35 = (path_2) => {
58346
+ $[120] !== onSetCollapsedFieldSets || $[121] !== onSetCollapsedPath || $[122] !== onSetFieldGroupState || $[123] !== onSetOpenPath ? (t35 = (path_2) => {
58347
58347
  getExpandOperations(formStateRef.current, path_2).forEach((op) => {
58348
58348
  op.type === "expandPath" && onSetCollapsedPath((prevState_2) => setAtPath(prevState_2, op.path, !1)), op.type === "expandFieldSet" && onSetCollapsedFieldSets((prevState_3) => setAtPath(prevState_3, op.path, !1)), op.type === "setSelectedGroup" && onSetFieldGroupState((prevState_4) => setAtPath(prevState_4, op.path, op.groupName));
58349
58349
  }), onSetOpenPath(path_2);
58350
- }, $[119] = onSetCollapsedFieldSets, $[120] = onSetCollapsedPath, $[121] = onSetFieldGroupState, $[122] = onSetOpenPath, $[123] = t35) : t35 = $[123];
58350
+ }, $[120] = onSetCollapsedFieldSets, $[121] = onSetCollapsedPath, $[122] = onSetFieldGroupState, $[123] = onSetOpenPath, $[124] = t35) : t35 = $[124];
58351
58351
  const handleSetOpenPath = t35;
58352
58352
  let t36;
58353
- $[124] !== presenceStore || $[125] !== value._id ? (t36 = throttle((nextFocusPath, payload) => {
58353
+ $[125] !== presenceStore || $[126] !== value._id ? (t36 = throttle((nextFocusPath, payload) => {
58354
58354
  presenceStore.setLocation([{
58355
58355
  type: "document",
58356
58356
  documentId: value._id,
@@ -58361,13 +58361,13 @@ function useDocumentForm(options) {
58361
58361
  }, 1e3, {
58362
58362
  leading: !0,
58363
58363
  trailing: !0
58364
- }), $[124] = presenceStore, $[125] = value._id, $[126] = t36) : t36 = $[126];
58364
+ }), $[125] = presenceStore, $[126] = value._id, $[127] = t36) : t36 = $[127];
58365
58365
  const updatePresenceThrottled = t36;
58366
58366
  let t37;
58367
- $[127] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t37 = [], $[127] = t37) : t37 = $[127];
58367
+ $[128] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t37 = [], $[128] = t37) : t37 = $[128];
58368
58368
  const focusPathRef = useRef(t37);
58369
58369
  let t38;
58370
- $[128] !== enhancedObjectDialogEnabled || $[129] !== handleSetOpenPath || $[130] !== onFocusPath || $[131] !== setFocusPath || $[132] !== updatePresenceThrottled ? (t38 = (_nextFocusPath, payload_0) => {
58370
+ $[129] !== enhancedObjectDialogEnabled || $[130] !== handleSetOpenPath || $[131] !== onFocusPath || $[132] !== setFocusPath || $[133] !== updatePresenceThrottled ? (t38 = (_nextFocusPath, payload_0) => {
58371
58371
  const nextFocusPath_0 = pathFor(_nextFocusPath);
58372
58372
  if (nextFocusPath_0 !== focusPathRef.current) {
58373
58373
  if (setFocusPath(pathFor(nextFocusPath_0)), enhancedObjectDialogEnabled) {
@@ -58381,20 +58381,20 @@ function useDocumentForm(options) {
58381
58381
  focusPathRef.current = nextFocusPath_0, onFocusPath?.(nextFocusPath_0);
58382
58382
  }
58383
58383
  updatePresenceThrottled(nextFocusPath_0, payload_0);
58384
- }, $[128] = enhancedObjectDialogEnabled, $[129] = handleSetOpenPath, $[130] = onFocusPath, $[131] = setFocusPath, $[132] = updatePresenceThrottled, $[133] = t38) : t38 = $[133];
58384
+ }, $[129] = enhancedObjectDialogEnabled, $[130] = handleSetOpenPath, $[131] = onFocusPath, $[132] = setFocusPath, $[133] = updatePresenceThrottled, $[134] = t38) : t38 = $[134];
58385
58385
  const handleFocus = t38;
58386
58386
  let t39;
58387
- $[134] !== onFocusPath || $[135] !== setFocusPath ? (t39 = (_blurredPath) => {
58387
+ $[135] !== onFocusPath || $[136] !== setFocusPath ? (t39 = (_blurredPath) => {
58388
58388
  setFocusPath(EMPTY_ARRAY$B), focusPathRef.current !== EMPTY_ARRAY$B && (focusPathRef.current = EMPTY_ARRAY$B, onFocusPath?.(EMPTY_ARRAY$B));
58389
- }, $[134] = onFocusPath, $[135] = setFocusPath, $[136] = t39) : t39 = $[136];
58389
+ }, $[135] = onFocusPath, $[136] = setFocusPath, $[137] = t39) : t39 = $[137];
58390
58390
  const handleBlur = t39;
58391
58391
  let t40;
58392
- $[137] !== handleSetOpenPath || $[138] !== onFocusPath || $[139] !== setFocusPath ? (t40 = (nextPath) => {
58392
+ $[138] !== handleSetOpenPath || $[139] !== onFocusPath || $[140] !== setFocusPath ? (t40 = (nextPath) => {
58393
58393
  deepEquals(focusPathRef.current, nextPath) || (setFocusPath(nextPath), handleSetOpenPath(nextPath), onFocusPath?.(nextPath), focusPathRef.current = nextPath);
58394
- }, $[137] = handleSetOpenPath, $[138] = onFocusPath, $[139] = setFocusPath, $[140] = t40) : t40 = $[140];
58394
+ }, $[138] = handleSetOpenPath, $[139] = onFocusPath, $[140] = setFocusPath, $[141] = t40) : t40 = $[141];
58395
58395
  const handleProgrammaticFocus = t40;
58396
58396
  let t41;
58397
- return $[141] !== collapsedFieldSets || $[142] !== collapsedPaths || $[143] !== connectionState || $[144] !== editState2 || $[145] !== focusPath || $[146] !== formState || $[147] !== handleBlur || $[148] !== handleFocus || $[149] !== handleOnSetCollapsedFieldSet || $[150] !== handleOnSetCollapsedPath || $[151] !== handleProgrammaticFocus || $[152] !== handleSetActiveFieldGroup || $[153] !== handleSetOpenPath || $[154] !== hasUpstreamVersion || $[155] !== isPermissionsLoading || $[156] !== openPath || $[157] !== permissions || $[158] !== ready || $[159] !== schemaType || $[160] !== upstreamEditState || $[161] !== validation2 || $[162] !== value ? (t41 = {
58397
+ return $[142] !== collapsedFieldSets || $[143] !== collapsedPaths || $[144] !== connectionState || $[145] !== editState2 || $[146] !== focusPath || $[147] !== formState || $[148] !== handleBlur || $[149] !== handleFocus || $[150] !== handleOnSetCollapsedFieldSet || $[151] !== handleOnSetCollapsedPath || $[152] !== handleProgrammaticFocus || $[153] !== handleSetActiveFieldGroup || $[154] !== handleSetOpenPath || $[155] !== hasUpstreamVersion || $[156] !== isPermissionsLoading || $[157] !== openPath || $[158] !== permissions || $[159] !== ready || $[160] !== schemaType || $[161] !== upstreamEditState || $[162] !== validation2 || $[163] !== value ? (t41 = {
58398
58398
  editState: editState2,
58399
58399
  upstreamEditState,
58400
58400
  connectionState,
@@ -58419,7 +58419,7 @@ function useDocumentForm(options) {
58419
58419
  onSetActiveFieldGroup: handleSetActiveFieldGroup,
58420
58420
  onSetCollapsedPath: handleOnSetCollapsedPath,
58421
58421
  onSetCollapsedFieldSet: handleOnSetCollapsedFieldSet
58422
- }, $[141] = collapsedFieldSets, $[142] = collapsedPaths, $[143] = connectionState, $[144] = editState2, $[145] = focusPath, $[146] = formState, $[147] = handleBlur, $[148] = handleFocus, $[149] = handleOnSetCollapsedFieldSet, $[150] = handleOnSetCollapsedPath, $[151] = handleProgrammaticFocus, $[152] = handleSetActiveFieldGroup, $[153] = handleSetOpenPath, $[154] = hasUpstreamVersion, $[155] = isPermissionsLoading, $[156] = openPath, $[157] = permissions, $[158] = ready, $[159] = schemaType, $[160] = upstreamEditState, $[161] = validation2, $[162] = value, $[163] = t41) : t41 = $[163], t41;
58422
+ }, $[142] = collapsedFieldSets, $[143] = collapsedPaths, $[144] = connectionState, $[145] = editState2, $[146] = focusPath, $[147] = formState, $[148] = handleBlur, $[149] = handleFocus, $[150] = handleOnSetCollapsedFieldSet, $[151] = handleOnSetCollapsedPath, $[152] = handleProgrammaticFocus, $[153] = handleSetActiveFieldGroup, $[154] = handleSetOpenPath, $[155] = hasUpstreamVersion, $[156] = isPermissionsLoading, $[157] = openPath, $[158] = permissions, $[159] = ready, $[160] = schemaType, $[161] = upstreamEditState, $[162] = validation2, $[163] = value, $[164] = t41) : t41 = $[164], t41;
58423
58423
  }
58424
58424
  function _temp3$j(seg) {
58425
58425
  return isKeySegment(seg);