sanity 5.1.0-next.21 → 5.1.0-next.23
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/_singletons.d.ts +1 -1
- package/lib/desk.d.ts +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +40 -29
- package/lib/index.js.map +1 -1
- package/lib/presentation.d.ts +1 -1
- package/lib/structure.d.ts +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.23+c8498450d5";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/_singletons.d.ts
CHANGED
package/lib/desk.d.ts
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -5274,7 +5274,7 @@ export declare interface DocumentStore {
|
|
|
5274
5274
|
validation: (
|
|
5275
5275
|
validationTargetId: string,
|
|
5276
5276
|
type: string,
|
|
5277
|
-
|
|
5277
|
+
validatePublishedReferences: boolean,
|
|
5278
5278
|
) => Observable<ValidationStatus>
|
|
5279
5279
|
}
|
|
5280
5280
|
}
|
|
@@ -17771,7 +17771,7 @@ export declare function useUserStore(): UserStore
|
|
|
17771
17771
|
export declare function useValidationStatus(
|
|
17772
17772
|
validationTargetId: string,
|
|
17773
17773
|
docTypeName: string,
|
|
17774
|
-
|
|
17774
|
+
requirePublishedReferences: boolean,
|
|
17775
17775
|
): ValidationStatus
|
|
17776
17776
|
|
|
17777
17777
|
/** @internal */
|
|
@@ -17926,7 +17926,7 @@ export declare const validation: (
|
|
|
17926
17926
|
{draftId, publishedId, versionId}: IdPair,
|
|
17927
17927
|
typeName: string,
|
|
17928
17928
|
validationTarget: DocumentVariantType,
|
|
17929
|
-
|
|
17929
|
+
validatePublishedReferences: boolean,
|
|
17930
17930
|
) => Observable<ValidationStatus>
|
|
17931
17931
|
|
|
17932
17932
|
/**
|
package/lib/index.js
CHANGED
|
@@ -6861,10 +6861,13 @@ function shareLatestWithRefCount$1() {
|
|
|
6861
6861
|
refCount: !0
|
|
6862
6862
|
});
|
|
6863
6863
|
}
|
|
6864
|
-
function validateDocumentWithReferences(ctx, document$,
|
|
6864
|
+
function validateDocumentWithReferences(ctx, document$, requirePublishedReferences) {
|
|
6865
6865
|
const referenceIds$ = document$.pipe(map((document2) => findReferenceIds(document2)), mergeMap((ids) => from(ids))), versionId$ = document$.pipe(distinctUntilChanged()), referenceExistence$ = combineLatest([versionId$, referenceIds$]).pipe(groupBy$1(([_, referenceId]) => referenceId, {
|
|
6866
6866
|
duration: () => timer(1e3 * 60 * 30)
|
|
6867
|
-
}), mergeMap((refIds$) => refIds$.pipe(distinct(), mergeMap(([document2, referenceId]) =>
|
|
6867
|
+
}), mergeMap((refIds$) => refIds$.pipe(distinct(), mergeMap(([document2, referenceId]) => {
|
|
6868
|
+
const versionId = requirePublishedReferences ? void 0 : getVersionFromId(document2?._id || "");
|
|
6869
|
+
return listenDocumentExists(ctx.observeDocumentPairAvailability, referenceId, versionId).pipe(map((result) => [referenceId, result]));
|
|
6870
|
+
}))), scan((acc, [id2, result]) => acc[id2] === result ? acc : {
|
|
6868
6871
|
...acc,
|
|
6869
6872
|
[id2]: result
|
|
6870
6873
|
}, {}), distinctUntilChanged(shallowEquals), shareLatestWithRefCount$1()), getDocumentExists = ({
|
|
@@ -6915,7 +6918,7 @@ const validation = memoize((ctx, {
|
|
|
6915
6918
|
draftId,
|
|
6916
6919
|
publishedId,
|
|
6917
6920
|
versionId
|
|
6918
|
-
}, typeName, validationTarget,
|
|
6921
|
+
}, typeName, validationTarget, validatePublishedReferences) => {
|
|
6919
6922
|
const document$ = editState(ctx, {
|
|
6920
6923
|
draftId,
|
|
6921
6924
|
publishedId,
|
|
@@ -6930,10 +6933,10 @@ const validation = memoize((ctx, {
|
|
|
6930
6933
|
}), throttleTime(DOC_UPDATE_DELAY, asyncScheduler, {
|
|
6931
6934
|
trailing: !0
|
|
6932
6935
|
}), distinctUntilChanged((prev, next) => prev?._rev === next?._rev ? !0 : shallowEquals(omit(prev, "_rev", "_updatedAt"), omit(next, "_rev", "_updatedAt"))), shareLatestWithRefCount());
|
|
6933
|
-
return validateDocumentWithReferences(ctx, document$,
|
|
6934
|
-
}, (ctx, idPair, typeName, validationTarget,
|
|
6936
|
+
return validateDocumentWithReferences(ctx, document$, validatePublishedReferences);
|
|
6937
|
+
}, (ctx, idPair, typeName, validationTarget, validatePublishedReferences) => {
|
|
6935
6938
|
const documentId = validationTarget === "draft" ? idPair.draftId : validationTarget === "version" ? idPair.versionId : idPair.publishedId;
|
|
6936
|
-
return `${memoizeKeyGen(ctx.client, idPair, typeName)}-${documentId}-${
|
|
6939
|
+
return `${memoizeKeyGen(ctx.client, idPair, typeName)}-${documentId}-${validatePublishedReferences}`;
|
|
6937
6940
|
}), documentEvents = memoize((client, idPair, typeName, serverActionsEnabled, pairListenerOptions) => memoizedPair(client, idPair, typeName, serverActionsEnabled, pairListenerOptions).pipe(switchMap(({
|
|
6938
6941
|
draft,
|
|
6939
6942
|
published
|
|
@@ -7380,11 +7383,11 @@ function createDocumentStore({
|
|
|
7380
7383
|
};
|
|
7381
7384
|
}));
|
|
7382
7385
|
},
|
|
7383
|
-
validation(validationTargetId, type,
|
|
7386
|
+
validation(validationTargetId, type, requirePublishedReferences) {
|
|
7384
7387
|
const publishedId = getPublishedId(validationTargetId), idPair = getIdPair(publishedId, {
|
|
7385
7388
|
version: getVersionFromId(validationTargetId)
|
|
7386
7389
|
}), validationTarget = getDocumentVariantType(validationTargetId);
|
|
7387
|
-
return validation(ctx, idPair, type, validationTarget,
|
|
7390
|
+
return validation(ctx, idPair, type, validationTarget, requirePublishedReferences);
|
|
7388
7391
|
}
|
|
7389
7392
|
}
|
|
7390
7393
|
};
|
|
@@ -58071,10 +58074,10 @@ const INITIAL = {
|
|
|
58071
58074
|
validation: [],
|
|
58072
58075
|
isValidating: !1
|
|
58073
58076
|
};
|
|
58074
|
-
function useValidationStatus(validationTargetId, docTypeName,
|
|
58077
|
+
function useValidationStatus(validationTargetId, docTypeName, requirePublishedReferences) {
|
|
58075
58078
|
const $ = c(5), documentStore = useDocumentStore();
|
|
58076
58079
|
let t0;
|
|
58077
|
-
return $[0] !== docTypeName || $[1] !== documentStore.pair || $[2] !==
|
|
58080
|
+
return $[0] !== docTypeName || $[1] !== documentStore.pair || $[2] !== requirePublishedReferences || $[3] !== validationTargetId ? (t0 = documentStore.pair.validation(validationTargetId, docTypeName, requirePublishedReferences), $[0] = docTypeName, $[1] = documentStore.pair, $[2] = requirePublishedReferences, $[3] = validationTargetId, $[4] = t0) : t0 = $[4], useObservable(t0, INITIAL);
|
|
58078
58081
|
}
|
|
58079
58082
|
function getSelectedPerspective(selectedPerspectiveName, releases2) {
|
|
58080
58083
|
return selectedPerspectiveName ? selectedPerspectiveName === "published" ? "published" : releases2.find((release) => getReleaseIdFromReleaseDocumentId(release._id) === selectedPerspectiveName) || selectedPerspectiveName : "drafts";
|
|
@@ -80758,28 +80761,36 @@ const POPOVER_PROPS = {
|
|
|
80758
80761
|
tone: "default"
|
|
80759
80762
|
};
|
|
80760
80763
|
function WorkspaceMenuButton() {
|
|
80761
|
-
const $ = c(
|
|
80764
|
+
const $ = c(25), workspaces = useWorkspaces(), {
|
|
80762
80765
|
activeWorkspace
|
|
80763
80766
|
} = useActiveWorkspace(), [authStates] = useWorkspaceAuthStates(workspaces), {
|
|
80764
80767
|
t
|
|
80765
|
-
} = useTranslation(),
|
|
80768
|
+
} = useTranslation(), [scrollbarWidth, setScrollbarWidth] = useState(0);
|
|
80766
80769
|
let t0;
|
|
80767
|
-
$[0]
|
|
80770
|
+
$[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = (node) => {
|
|
80771
|
+
if (node) {
|
|
80772
|
+
const hasScroll = node.scrollHeight > node.clientHeight;
|
|
80773
|
+
setScrollbarWidth(hasScroll ? node.offsetWidth - node.clientWidth : 0);
|
|
80774
|
+
}
|
|
80775
|
+
}, $[0] = t0) : t0 = $[0];
|
|
80776
|
+
const stackRef = t0, disabled = !authStates;
|
|
80768
80777
|
let t1;
|
|
80769
|
-
$[
|
|
80778
|
+
$[1] !== t ? (t1 = t("workspaces.select-workspace-tooltip"), $[1] = t, $[2] = t1) : t1 = $[2];
|
|
80770
80779
|
let t2;
|
|
80771
|
-
$[
|
|
80780
|
+
$[3] !== activeWorkspace.title ? (t2 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text$1, { size: 1, textOverflow: "ellipsis", weight: "medium", children: activeWorkspace.title }) }), $[3] = activeWorkspace.title, $[4] = t2) : t2 = $[4];
|
|
80772
80781
|
let t3;
|
|
80773
|
-
$[5]
|
|
80774
|
-
t1,
|
|
80775
|
-
t2
|
|
80776
|
-
] }), $[5] = t1, $[6] = t3) : t3 = $[6];
|
|
80782
|
+
$[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Text$1, { size: 1, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }), $[5] = t3) : t3 = $[5];
|
|
80777
80783
|
let t4;
|
|
80778
|
-
$[
|
|
80784
|
+
$[6] !== t2 ? (t4 = /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 2, children: [
|
|
80785
|
+
t2,
|
|
80786
|
+
t3
|
|
80787
|
+
] }), $[6] = t2, $[7] = t4) : t4 = $[7];
|
|
80779
80788
|
let t5;
|
|
80780
|
-
$[
|
|
80789
|
+
$[8] !== disabled || $[9] !== t4 ? (t5 = /* @__PURE__ */ jsx(Button$1, { disabled, mode: "bleed", padding: 2, width: "fill", children: t4 }), $[8] = disabled, $[9] = t4, $[10] = t5) : t5 = $[10];
|
|
80781
80790
|
let t6;
|
|
80782
|
-
$[
|
|
80791
|
+
$[11] !== disabled || $[12] !== t1 || $[13] !== t5 ? (t6 = /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(Tooltip, { content: t1, disabled, portal: !0, children: t5 }) }), $[11] = disabled, $[12] = t1, $[13] = t5, $[14] = t6) : t6 = $[14];
|
|
80792
|
+
let t7;
|
|
80793
|
+
$[15] !== activeWorkspace.name || $[16] !== authStates || $[17] !== disabled || $[18] !== scrollbarWidth || $[19] !== t || $[20] !== workspaces ? (t7 = !disabled && authStates ? /* @__PURE__ */ jsxs(Menu, { padding: 0, style: {
|
|
80783
80794
|
maxWidth: "350px",
|
|
80784
80795
|
minWidth: "250px",
|
|
80785
80796
|
overflowY: "hidden"
|
|
@@ -80790,22 +80801,22 @@ function WorkspaceMenuButton() {
|
|
|
80790
80801
|
padding: 0
|
|
80791
80802
|
} }),
|
|
80792
80803
|
/* @__PURE__ */ jsxs(Box, { paddingTop: 2, paddingBottom: 1, children: [
|
|
80793
|
-
/* @__PURE__ */ jsx(Box, { paddingRight: 5, paddingLeft: 4, paddingBottom:
|
|
80794
|
-
/* @__PURE__ */ jsx(Stack, { space: 1, style: {
|
|
80804
|
+
/* @__PURE__ */ jsx(Box, { paddingRight: 5, paddingLeft: 4, paddingBottom: 3, children: /* @__PURE__ */ jsx(Text$1, { size: 0, weight: "medium", children: t("workspaces.action.switch-workspace") }) }),
|
|
80805
|
+
/* @__PURE__ */ jsx(Stack, { ref: stackRef, space: 1, style: {
|
|
80795
80806
|
overflowY: "auto",
|
|
80796
80807
|
maxHeight: "40vh"
|
|
80797
80808
|
}, children: workspaces.map((workspace) => {
|
|
80798
80809
|
const state = authStates[workspace.name].authenticated ? "logged-in" : workspace.auth.LoginComponent ? "logged-out" : "no-access", isSelected = workspace.name === activeWorkspace.name;
|
|
80799
80810
|
return /* @__PURE__ */ jsx(MenuItem, { as: "a", href: workspace.basePath, badgeText: STATE_TITLES[state], iconRight: isSelected ? CheckmarkIcon : void 0, pressed: isSelected, preview: /* @__PURE__ */ jsx(WorkspacePreviewIcon, { icon: workspace.icon, size: "small" }), selected: isSelected, __unstable_subtitle: workspace.subtitle, text: workspace?.title || workspace.name, style: {
|
|
80800
|
-
marginLeft: "
|
|
80801
|
-
marginRight:
|
|
80811
|
+
marginLeft: "1rem",
|
|
80812
|
+
marginRight: `calc(1.25rem - ${scrollbarWidth}px)`
|
|
80802
80813
|
}, __unstable_space: 0 }, workspace.name);
|
|
80803
80814
|
}) })
|
|
80804
80815
|
] })
|
|
80805
80816
|
] })
|
|
80806
|
-
] }) : void 0, $[
|
|
80807
|
-
let
|
|
80808
|
-
return $[
|
|
80817
|
+
] }) : void 0, $[15] = activeWorkspace.name, $[16] = authStates, $[17] = disabled, $[18] = scrollbarWidth, $[19] = t, $[20] = workspaces, $[21] = t7) : t7 = $[21];
|
|
80818
|
+
let t8;
|
|
80819
|
+
return $[22] !== t6 || $[23] !== t7 ? (t8 = /* @__PURE__ */ jsx(MenuButton, { button: t6, id: "workspace-menu", menu: t7, popover: POPOVER_PROPS }), $[22] = t6, $[23] = t7, $[24] = t8) : t8 = $[24], t8;
|
|
80809
80820
|
}
|
|
80810
80821
|
function AuthenticateScreen() {
|
|
80811
80822
|
const $ = c(1);
|