sanity 5.1.0-next.8 → 5.1.0-next.9
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/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/index.js +42 -38
- package/lib/index.js.map +1 -1
- package/package.json +15 -15
|
@@ -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.
|
|
10
|
+
"5.1.0-next.9+fd2e7cf165";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/index.js
CHANGED
|
@@ -58115,7 +58115,7 @@ function useComlinkViewHistory(t0) {
|
|
|
58115
58115
|
$[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);
|
|
58116
58116
|
}
|
|
58117
58117
|
function useDocumentForm(options) {
|
|
58118
|
-
const $ = c(
|
|
58118
|
+
const $ = c(164), {
|
|
58119
58119
|
documentType,
|
|
58120
58120
|
getFormDocumentValue,
|
|
58121
58121
|
documentId,
|
|
@@ -58161,19 +58161,23 @@ function useDocumentForm(options) {
|
|
|
58161
58161
|
const firstVersion = t5;
|
|
58162
58162
|
let t6;
|
|
58163
58163
|
bb0: {
|
|
58164
|
-
if (
|
|
58165
|
-
t6 =
|
|
58164
|
+
if (isSystemBundle(selectedPerspectiveName)) {
|
|
58165
|
+
t6 = void 0;
|
|
58166
58166
|
break bb0;
|
|
58167
58167
|
}
|
|
58168
|
-
if (
|
|
58169
|
-
t6 =
|
|
58168
|
+
if (documentVersions.some((id_0) => getVersionFromId(id_0) === selectedPerspectiveName)) {
|
|
58169
|
+
t6 = selectedPerspectiveName;
|
|
58170
|
+
break bb0;
|
|
58171
|
+
}
|
|
58172
|
+
if (selectedPerspectiveName && (!documentVersions.length || !onlyHasVersions)) {
|
|
58173
|
+
t6 = selectedPerspectiveName;
|
|
58170
58174
|
break bb0;
|
|
58171
58175
|
}
|
|
58172
58176
|
const t72 = firstVersion ?? "";
|
|
58173
58177
|
let t82;
|
|
58174
58178
|
$[13] !== t72 ? (t82 = getVersionFromId(t72), $[13] = t72, $[14] = t82) : t82 = $[14], t6 = t82;
|
|
58175
58179
|
}
|
|
58176
|
-
const editState2 = useEditState(documentId, documentType, "default",
|
|
58180
|
+
const activeDocumentReleaseId = t6, editState2 = useEditState(documentId, documentType, "default", activeDocumentReleaseId), connectionState = useConnectionState(documentId, documentType, activeDocumentReleaseId);
|
|
58177
58181
|
useReconnectingToast(connectionState === "reconnecting");
|
|
58178
58182
|
const [focusPath, setFocusPath] = useState(initialFocusPath || EMPTY_ARRAY$B);
|
|
58179
58183
|
let t7;
|
|
@@ -58184,7 +58188,7 @@ function useDocumentForm(options) {
|
|
|
58184
58188
|
_type: documentType
|
|
58185
58189
|
}, $[15] = documentId, $[16] = documentType, $[17] = initialValue?.value, $[18] = t82) : t82 = $[18];
|
|
58186
58190
|
const baseValue = t82;
|
|
58187
|
-
if (
|
|
58191
|
+
if (selectedPerspectiveName) {
|
|
58188
58192
|
if (editState2.version && isGoingToUnpublish(editState2.version)) {
|
|
58189
58193
|
t7 = editState2.published || baseValue;
|
|
58190
58194
|
break bb1;
|
|
@@ -58259,7 +58263,7 @@ function useDocumentForm(options) {
|
|
|
58259
58263
|
const handleOnSetCollapsedFieldSet = t16;
|
|
58260
58264
|
let t17;
|
|
58261
58265
|
$[43] !== onSetFieldGroupState ? (t17 = (path_1, groupName) => onSetFieldGroupState((prevState_1) => setAtPath(prevState_1, path_1, groupName)), $[43] = onSetFieldGroupState, $[44] = t17) : t17 = $[44];
|
|
58262
|
-
const handleSetActiveFieldGroup = t17, requiredPermission = value._createdAt ? "update" : "create", targetDocumentId =
|
|
58266
|
+
const handleSetActiveFieldGroup = t17, requiredPermission = value._createdAt ? "update" : "create", targetDocumentId = activeDocumentReleaseId ? getVersionId(publishedId, activeDocumentReleaseId) : liveEdit ? editState2?.draft?._id || publishedId : getDraftId(documentId);
|
|
58263
58267
|
let t18;
|
|
58264
58268
|
$[45] !== targetDocumentId || $[46] !== value ? (t18 = {
|
|
58265
58269
|
...value,
|
|
@@ -58284,41 +58288,41 @@ function useDocumentForm(options) {
|
|
|
58284
58288
|
isLockedByCanvas
|
|
58285
58289
|
} = useCanvasCompanionDoc(value._id);
|
|
58286
58290
|
let t23;
|
|
58287
|
-
$[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] !==
|
|
58291
|
+
$[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 = () => {
|
|
58288
58292
|
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;
|
|
58289
|
-
return editState2.version && !editState2.draft && !editState2.published && onlyHasVersions && selectedPerspectiveName !== getVersionFromId(editState2.version._id) && isNewDocument(editState2) === !1 || liveEdit && editState2.draft?._id || !liveEdit && selectedPerspectiveName === "published" ||
|
|
58290
|
-
}, $[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] =
|
|
58293
|
+
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;
|
|
58294
|
+
}, $[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];
|
|
58291
58295
|
let t24;
|
|
58292
|
-
$[
|
|
58296
|
+
$[74] !== t23 ? (t24 = t23(), $[74] = t23, $[75] = t24) : t24 = $[75];
|
|
58293
58297
|
const readOnly = t24, {
|
|
58294
58298
|
patch: patch2
|
|
58295
|
-
} = useDocumentOperation(documentId, documentType,
|
|
58299
|
+
} = useDocumentOperation(documentId, documentType, activeDocumentReleaseId), patchRef = useRef(_temp$1r);
|
|
58296
58300
|
let t25;
|
|
58297
|
-
$[
|
|
58301
|
+
$[76] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t25 = (event) => patchRef.current(event), $[76] = t25) : t25 = $[76];
|
|
58298
58302
|
const handleChange = t25;
|
|
58299
58303
|
let t26;
|
|
58300
|
-
$[
|
|
58304
|
+
$[77] !== editState2.draft || $[78] !== editState2.published || $[79] !== initialValue?.value || $[80] !== isCreateLinked || $[81] !== patch2 || $[82] !== readOnly || $[83] !== telemetry ? (t26 = () => {
|
|
58301
58305
|
readOnly && !isCreateLinked ? patchRef.current = _temp2$B : patchRef.current = (event_0) => {
|
|
58302
58306
|
!editState2.draft && !editState2.published && telemetry.log(CreatedDraft), patch2.execute(toMutationPatches(event_0.patches), initialValue?.value);
|
|
58303
58307
|
};
|
|
58304
|
-
}, $[
|
|
58308
|
+
}, $[77] = editState2.draft, $[78] = editState2.published, $[79] = initialValue?.value, $[80] = isCreateLinked, $[81] = patch2, $[82] = readOnly, $[83] = telemetry, $[84] = t26) : t26 = $[84];
|
|
58305
58309
|
let t27;
|
|
58306
|
-
$[
|
|
58310
|
+
$[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);
|
|
58307
58311
|
let t28;
|
|
58308
58312
|
bb3: {
|
|
58309
58313
|
if (getFormDocumentValue) {
|
|
58310
58314
|
let t292;
|
|
58311
|
-
$[
|
|
58315
|
+
$[93] !== getFormDocumentValue || $[94] !== value ? (t292 = getFormDocumentValue(value), $[93] = getFormDocumentValue, $[94] = value, $[95] = t292) : t292 = $[95], t28 = t292;
|
|
58312
58316
|
break bb3;
|
|
58313
58317
|
}
|
|
58314
58318
|
t28 = value;
|
|
58315
58319
|
}
|
|
58316
58320
|
const formDocumentValue = t28;
|
|
58317
58321
|
let t29;
|
|
58318
|
-
$[
|
|
58322
|
+
$[96] !== upstreamEditState ? (t29 = selectUpstreamVersion(upstreamEditState), $[96] = upstreamEditState, $[97] = t29) : t29 = $[97];
|
|
58319
58323
|
const hasUpstreamVersion = t29 !== null, t30 = comparisonValue || value;
|
|
58320
58324
|
let t31;
|
|
58321
|
-
$[
|
|
58325
|
+
$[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 = {
|
|
58322
58326
|
schemaType,
|
|
58323
58327
|
documentValue: formDocumentValue,
|
|
58324
58328
|
readOnly,
|
|
@@ -58334,25 +58338,25 @@ function useDocumentForm(options) {
|
|
|
58334
58338
|
changesOpen,
|
|
58335
58339
|
hasUpstreamVersion,
|
|
58336
58340
|
displayInlineChanges
|
|
58337
|
-
}, $[
|
|
58341
|
+
}, $[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];
|
|
58338
58342
|
const formState = useFormState(t31), formStateRef = useRef(formState);
|
|
58339
58343
|
let t32, t33;
|
|
58340
|
-
$[
|
|
58344
|
+
$[114] !== formState ? (t32 = () => {
|
|
58341
58345
|
formStateRef.current = formState;
|
|
58342
|
-
}, t33 = [formState], $[
|
|
58346
|
+
}, t33 = [formState], $[114] = formState, $[115] = t32, $[116] = t33) : (t32 = $[115], t33 = $[116]), useEffect(t32, t33);
|
|
58343
58347
|
let t34;
|
|
58344
|
-
$[
|
|
58348
|
+
$[117] !== editState2 ? (t34 = {
|
|
58345
58349
|
editState: editState2
|
|
58346
|
-
}, $[
|
|
58350
|
+
}, $[117] = editState2, $[118] = t34) : t34 = $[118], useComlinkViewHistory(t34);
|
|
58347
58351
|
let t35;
|
|
58348
|
-
$[
|
|
58352
|
+
$[119] !== onSetCollapsedFieldSets || $[120] !== onSetCollapsedPath || $[121] !== onSetFieldGroupState || $[122] !== onSetOpenPath ? (t35 = (path_2) => {
|
|
58349
58353
|
getExpandOperations(formStateRef.current, path_2).forEach((op) => {
|
|
58350
58354
|
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));
|
|
58351
58355
|
}), onSetOpenPath(path_2);
|
|
58352
|
-
}, $[
|
|
58356
|
+
}, $[119] = onSetCollapsedFieldSets, $[120] = onSetCollapsedPath, $[121] = onSetFieldGroupState, $[122] = onSetOpenPath, $[123] = t35) : t35 = $[123];
|
|
58353
58357
|
const handleSetOpenPath = t35;
|
|
58354
58358
|
let t36;
|
|
58355
|
-
$[
|
|
58359
|
+
$[124] !== presenceStore || $[125] !== value._id ? (t36 = throttle((nextFocusPath, payload) => {
|
|
58356
58360
|
presenceStore.setLocation([{
|
|
58357
58361
|
type: "document",
|
|
58358
58362
|
documentId: value._id,
|
|
@@ -58363,13 +58367,13 @@ function useDocumentForm(options) {
|
|
|
58363
58367
|
}, 1e3, {
|
|
58364
58368
|
leading: !0,
|
|
58365
58369
|
trailing: !0
|
|
58366
|
-
}), $[
|
|
58370
|
+
}), $[124] = presenceStore, $[125] = value._id, $[126] = t36) : t36 = $[126];
|
|
58367
58371
|
const updatePresenceThrottled = t36;
|
|
58368
58372
|
let t37;
|
|
58369
|
-
$[
|
|
58373
|
+
$[127] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t37 = [], $[127] = t37) : t37 = $[127];
|
|
58370
58374
|
const focusPathRef = useRef(t37);
|
|
58371
58375
|
let t38;
|
|
58372
|
-
$[
|
|
58376
|
+
$[128] !== enhancedObjectDialogEnabled || $[129] !== handleSetOpenPath || $[130] !== onFocusPath || $[131] !== setFocusPath || $[132] !== updatePresenceThrottled ? (t38 = (_nextFocusPath, payload_0) => {
|
|
58373
58377
|
const nextFocusPath_0 = pathFor(_nextFocusPath);
|
|
58374
58378
|
if (nextFocusPath_0 !== focusPathRef.current) {
|
|
58375
58379
|
if (setFocusPath(pathFor(nextFocusPath_0)), enhancedObjectDialogEnabled) {
|
|
@@ -58383,20 +58387,20 @@ function useDocumentForm(options) {
|
|
|
58383
58387
|
focusPathRef.current = nextFocusPath_0, onFocusPath?.(nextFocusPath_0);
|
|
58384
58388
|
}
|
|
58385
58389
|
updatePresenceThrottled(nextFocusPath_0, payload_0);
|
|
58386
|
-
}, $[
|
|
58390
|
+
}, $[128] = enhancedObjectDialogEnabled, $[129] = handleSetOpenPath, $[130] = onFocusPath, $[131] = setFocusPath, $[132] = updatePresenceThrottled, $[133] = t38) : t38 = $[133];
|
|
58387
58391
|
const handleFocus = t38;
|
|
58388
58392
|
let t39;
|
|
58389
|
-
$[
|
|
58393
|
+
$[134] !== onFocusPath || $[135] !== setFocusPath ? (t39 = (_blurredPath) => {
|
|
58390
58394
|
setFocusPath(EMPTY_ARRAY$B), focusPathRef.current !== EMPTY_ARRAY$B && (focusPathRef.current = EMPTY_ARRAY$B, onFocusPath?.(EMPTY_ARRAY$B));
|
|
58391
|
-
}, $[
|
|
58395
|
+
}, $[134] = onFocusPath, $[135] = setFocusPath, $[136] = t39) : t39 = $[136];
|
|
58392
58396
|
const handleBlur = t39;
|
|
58393
58397
|
let t40;
|
|
58394
|
-
$[
|
|
58398
|
+
$[137] !== handleSetOpenPath || $[138] !== onFocusPath || $[139] !== setFocusPath ? (t40 = (nextPath) => {
|
|
58395
58399
|
deepEquals(focusPathRef.current, nextPath) || (setFocusPath(nextPath), handleSetOpenPath(nextPath), onFocusPath?.(nextPath), focusPathRef.current = nextPath);
|
|
58396
|
-
}, $[
|
|
58400
|
+
}, $[137] = handleSetOpenPath, $[138] = onFocusPath, $[139] = setFocusPath, $[140] = t40) : t40 = $[140];
|
|
58397
58401
|
const handleProgrammaticFocus = t40;
|
|
58398
58402
|
let t41;
|
|
58399
|
-
return $[
|
|
58403
|
+
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 = {
|
|
58400
58404
|
editState: editState2,
|
|
58401
58405
|
upstreamEditState,
|
|
58402
58406
|
connectionState,
|
|
@@ -58421,7 +58425,7 @@ function useDocumentForm(options) {
|
|
|
58421
58425
|
onSetActiveFieldGroup: handleSetActiveFieldGroup,
|
|
58422
58426
|
onSetCollapsedPath: handleOnSetCollapsedPath,
|
|
58423
58427
|
onSetCollapsedFieldSet: handleOnSetCollapsedFieldSet
|
|
58424
|
-
}, $[
|
|
58428
|
+
}, $[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;
|
|
58425
58429
|
}
|
|
58426
58430
|
function _temp3$j(seg) {
|
|
58427
58431
|
return isKeySegment(seg);
|