@sanity/embeddings-index-ui

4.0.194.0.20
dist/index.js
~dist/index.jsModified
+37−38
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -337,8 +337,13 @@
 }
 function _temp$3(error, i) {
 	return /* @__PURE__ */ jsx("li", { children: error }, `${error}-${i}`);
 }
+const INITIAL_PREVIEW_STATE = {
+	snapshot: null,
+	isLoading: !0,
+	original: null
+};
 function DocumentPreview(t0) {
 	let $ = c(23), buttonProps, documentId, schemaTypeName, style;
 	$[0] === t0 ? (buttonProps = $[1], documentId = $[2], schemaTypeName = $[3], style = $[4]) : ({documentId, style, schemaTypeName, ...buttonProps} = t0, $[0] = t0, $[1] = buttonProps, $[2] = documentId, $[3] = schemaTypeName, $[4] = style);
 	let schema = useSchema(), t1;
@@ -386,68 +391,62 @@
 		...buttonProps
 	}), $[17] = buttonProps, $[18] = documentId, $[19] = schemaType, $[20] = schemaTypeName, $[21] = style, $[22] = t2) : t2 = $[22], t2;
 }
 function DocumentPreviewInner(t0) {
-	let $ = c(31), { documentId, schemaType, style, button } = t0, documentPreviewStore = useDocumentPreviewStore(), t1;
+	let $ = c(30), { documentId, schemaType, style, button } = t0, documentPreviewStore = useDocumentPreviewStore(), t1;
 	$[0] !== documentId || $[1] !== documentPreviewStore || $[2] !== schemaType ? (t1 = getPreviewStateObservable(documentPreviewStore, schemaType, documentId), $[0] = documentId, $[1] = documentPreviewStore, $[2] = schemaType, $[3] = t1) : t1 = $[3];
-	let previewStateObservable = t1, t2;
-	$[4] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
-		snapshot: null,
-		isLoading: !0,
-		original: null
-	}, $[4] = t2) : t2 = $[4];
-	let { snapshot, original, isLoading: previewIsLoading } = useObservable(previewStateObservable, t2), t3;
-	$[5] !== documentId || $[6] !== schemaType?.name ? (t3 = () => ({
+	let { snapshot, original, isLoading: previewIsLoading } = useObservable(t1, INITIAL_PREVIEW_STATE), t2;
+	$[4] !== documentId || $[5] !== schemaType?.name ? (t2 = () => ({
 		_id: documentId,
 		_type: schemaType?.name
-	}), $[5] = documentId, $[6] = schemaType?.name, $[7] = t3) : t3 = $[7], schemaType?.name;
-	let t4;
-	$[8] === t3 ? t4 = $[9] : (t4 = t3(), $[8] = t3, $[9] = t4);
-	let sanityDocument = t4, t5 = schemaType?.name, t6;
-	$[10] !== documentId || $[11] !== t5 ? (t6 = {
+	}), $[4] = documentId, $[5] = schemaType?.name, $[6] = t2) : t2 = $[6], schemaType?.name;
+	let t3;
+	$[7] === t2 ? t3 = $[8] : (t3 = t2(), $[7] = t2, $[8] = t3);
+	let sanityDocument = t3, t4 = schemaType?.name, t5;
+	$[9] !== documentId || $[10] !== t4 ? (t5 = {
 		intent: "edit",
 		params: {
 			id: documentId,
-			type: t5
+			type: t4
 		}
-	}, $[10] = documentId, $[11] = t5, $[12] = t6) : t6 = $[12];
-	let { onClick: onIntentClick, href } = useIntentLink(t6), t7;
-	$[13] !== original || $[14] !== sanityDocument || $[15] !== snapshot ? (t7 = getPreviewValueWithFallback({
+	}, $[9] = documentId, $[10] = t4, $[11] = t5) : t5 = $[11];
+	let { onClick: onIntentClick, href } = useIntentLink(t5), t6;
+	$[12] !== original || $[13] !== sanityDocument || $[14] !== snapshot ? (t6 = getPreviewValueWithFallback({
 		snapshot,
 		original,
 		fallback: sanityDocument
-	}), $[13] = original, $[14] = sanityDocument, $[15] = snapshot, $[16] = t7) : t7 = $[16];
-	let t8 = previewIsLoading ?? !0, t9 = schemaType?.icon, t10;
-	$[17] !== t7 || $[18] !== t8 || $[19] !== t9 ? (t10 = /* @__PURE__ */ jsx(SanityDefaultPreview, {
-		...t7,
-		isPlaceholder: t8,
+	}), $[12] = original, $[13] = sanityDocument, $[14] = snapshot, $[15] = t6) : t6 = $[15];
+	let t7 = previewIsLoading ?? !0, t8 = schemaType?.icon, t9;
+	$[16] !== t6 || $[17] !== t7 || $[18] !== t8 ? (t9 = /* @__PURE__ */ jsx(SanityDefaultPreview, {
+		...t6,
+		isPlaceholder: t7,
 		layout: "default",
-		icon: t9
-	}), $[17] = t7, $[18] = t8, $[19] = t9, $[20] = t10) : t10 = $[20];
-	let preview = t10;
+		icon: t8
+	}), $[16] = t6, $[17] = t7, $[18] = t8, $[19] = t9) : t9 = $[19];
+	let preview = t9;
 	if (button) {
-		let t11;
-		$[21] === style ? t11 = $[22] : (t11 = {
+		let t10;
+		$[20] === style ? t10 = $[21] : (t10 = {
 			width: "100%",
 			...style
-		}, $[21] = style, $[22] = t11);
-		let t12;
-		return $[23] !== href || $[24] !== onIntentClick || $[25] !== preview || $[26] !== t11 ? (t12 = /* @__PURE__ */ jsx(Button, {
+		}, $[20] = style, $[21] = t10);
+		let t11;
+		return $[22] !== href || $[23] !== onIntentClick || $[24] !== preview || $[25] !== t10 ? (t11 = /* @__PURE__ */ jsx(Button, {
 			as: "a",
 			href,
 			onClick: onIntentClick,
 			mode: "ghost",
-			style: t11,
+			style: t10,
 			children: preview
-		}), $[23] = href, $[24] = onIntentClick, $[25] = preview, $[26] = t11, $[27] = t12) : t12 = $[27], t12;
+		}), $[22] = href, $[23] = onIntentClick, $[24] = preview, $[25] = t10, $[26] = t11) : t11 = $[26], t11;
 	}
+	let t10;
+	$[27] === Symbol.for("react.memo_cache_sentinel") ? (t10 = { width: "100%" }, $[27] = t10) : t10 = $[27];
 	let t11;
-	$[28] === Symbol.for("react.memo_cache_sentinel") ? (t11 = { width: "100%" }, $[28] = t11) : t11 = $[28];
-	let t12;
-	return $[29] === preview ? t12 = $[30] : (t12 = /* @__PURE__ */ jsx(Box, {
-		style: t11,
+	return $[28] === preview ? t11 = $[29] : (t11 = /* @__PURE__ */ jsx(Box, {
+		style: t10,
 		children: preview
-	}), $[29] = preview, $[30] = t12), t12;
+	}), $[28] = preview, $[29] = t11), t11;
 }
 const NO_OPTIONS = [], NO_FILTER = () => !0;
 function SemanticSearchAutocomplete(props) {
 	let $ = c(27), { indexConfig, filterResult, getEmptySearchValue, readOnly, onFocus, onBlur, onSelect, typeFilter, ref } = props, id = useId(), [query, setQuery] = useState(""), queryRef = useRef(query), debouncedQuery = useDebouncedValue(query, 300), prevDebouncedQuery = useRef(debouncedQuery), [searching, setSearching] = useState(!1), [options, setOptions] = useState(NO_OPTIONS), client = useApiClient(), t0;