@sanity/vision 6.23.0-next.7 → 6.23.0
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/CodeDiff-MkS3Q87A.js +61 -0
- package/lib/CodeDiff-MkS3Q87A.js.map +1 -0
- package/lib/{SanityVision-CD-bx0vw.js → SanityVision-BSByYf4K.js} +396 -83
- package/lib/SanityVision-BSByYf4K.js.map +1 -0
- package/lib/VisionRedesign-C3iwsYdI.js +15087 -0
- package/lib/VisionRedesign-C3iwsYdI.js.map +1 -0
- package/lib/bundle.css +631 -34
- package/lib/{i18n-DFRqoJ_F.js → i18n-CaGatdZX.js} +2 -2
- package/lib/{i18n-DFRqoJ_F.js.map → i18n-CaGatdZX.js.map} +1 -1
- package/lib/index.d.ts +385 -374
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/{resources-VRZHPMVB.js → resources-CpTD0UAN.js} +386 -372
- package/lib/resources-CpTD0UAN.js.map +1 -0
- package/package.json +7 -7
- package/lib/SanityVision-CD-bx0vw.js.map +0 -1
- package/lib/resources-VRZHPMVB.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { t as visionLocaleNamespace } from "./i18n-
|
|
2
|
-
import { Component, Fragment, Suspense, createContext, use, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
1
|
+
import { t as visionLocaleNamespace } from "./i18n-CaGatdZX.js";
|
|
2
|
+
import { Component, Fragment, Suspense, createContext, lazy, use, useEffect, useImperativeHandle, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
import { ContextMenuButton, RELEASES_STUDIO_CLIENT_OPTIONS, Translate, UserAvatar, VARIANTS_STUDIO_CLIENT_OPTIONS, getDefaultVariant, getReleaseIdFromReleaseDocumentId, getVariantTitle, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useCurrentUser, useDataset, useDateTimeFormat, useKeyValueStore, usePerspective, useScheduledDraftsEnabled, useTranslation, useWorkspace } from "sanity";
|
|
4
4
|
import { IntentLink } from "sanity/router";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
6
|
import { SplitPane } from "@rexxars/react-split-pane";
|
|
7
7
|
import { ChevronLeftIcon } from "@sanity/icons/ChevronLeft";
|
|
8
8
|
import { ChevronRightIcon } from "@sanity/icons/ChevronRight";
|
|
9
|
-
import { Badge, Button, Card, Dialog, Heading, Hotkeys, Inline, Label, Select, Spinner, Tab, TabList,
|
|
9
|
+
import { Badge, Button, Card, Dialog, Heading, Hotkeys, Inline, Label, Select, Spinner, Stack, Tab, TabList, TextInput, rem, useClickOutsideEvent, useTheme, useTheme_v2 } from "@sanity/ui";
|
|
10
10
|
import { useToast } from "@sanity/ui/toast";
|
|
11
11
|
import { isHotkey } from "is-hotkey-esm";
|
|
12
|
-
import { Box, Container, Flex, Grid, VStack } from "ui5";
|
|
12
|
+
import { Box, Container, Flex, Grid, Icon, Link, Text, VStack } from "ui5";
|
|
13
13
|
import { useEffectEvent } from "use-effect-event";
|
|
14
14
|
import { closeBrackets } from "@codemirror/autocomplete";
|
|
15
15
|
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands";
|
|
@@ -19,7 +19,7 @@ import { highlightSelectionMatches } from "@codemirror/search";
|
|
|
19
19
|
import { EditorState } from "@codemirror/state";
|
|
20
20
|
import { EditorView, drawSelection, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, keymap, lineNumbers } from "@codemirror/view";
|
|
21
21
|
import { groq } from "@sanity/lezer-groq";
|
|
22
|
-
import CodeMirror, { EditorSelection } from "@uiw/react-codemirror";
|
|
22
|
+
import CodeMirror, { EditorSelection as EditorSelection$1 } from "@uiw/react-codemirror";
|
|
23
23
|
import { tags } from "@lezer/highlight";
|
|
24
24
|
import { hues } from "@sanity/color";
|
|
25
25
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -51,6 +51,14 @@ import LRU from "quick-lru";
|
|
|
51
51
|
import { DocumentSheetIcon } from "@sanity/icons/DocumentSheet";
|
|
52
52
|
import { useObservablePromise } from "react-rx";
|
|
53
53
|
import { catchError, map, of } from "rxjs";
|
|
54
|
+
var __defProp = Object.defineProperty, __exportAll = (all, no_symbols) => {
|
|
55
|
+
let target = {};
|
|
56
|
+
for (var name in all) __defProp(target, name, {
|
|
57
|
+
get: all[name],
|
|
58
|
+
enumerable: !0
|
|
59
|
+
});
|
|
60
|
+
return no_symbols || __defProp(target, Symbol.toStringTag, { value: "Module" }), target;
|
|
61
|
+
};
|
|
54
62
|
function prefixApiVersion(version) {
|
|
55
63
|
return version[0] !== "v" && version !== "other" ? `v${version}` : version;
|
|
56
64
|
}
|
|
@@ -84,8 +92,8 @@ const VARIANTS_API_VERSION = prefixApiVersion(VARIANTS_STUDIO_CLIENT_OPTIONS.api
|
|
|
84
92
|
...defaultKeymap,
|
|
85
93
|
...historyKeymap
|
|
86
94
|
])
|
|
87
|
-
], groqExtensions = [groq(), ...sharedExtensions], paramsExtensions = [javascriptLanguage, ...sharedExtensions]
|
|
88
|
-
|
|
95
|
+
], groqExtensions = [groq(), ...sharedExtensions], paramsExtensions = [javascriptLanguage, ...sharedExtensions], resultJsonExtensions = [
|
|
96
|
+
javascriptLanguage,
|
|
89
97
|
...sharedExtensions,
|
|
90
98
|
foldGutter(),
|
|
91
99
|
EditorState.readOnly.of(!0)
|
|
@@ -131,17 +139,17 @@ function createTheme(theme) {
|
|
|
131
139
|
},
|
|
132
140
|
".cm-panel.cm-panel-lint ul [aria-selected]": { backgroundColor: selection },
|
|
133
141
|
".cm-panel.cm-panel-lint ul [aria-selected] .cm-diagnostic": { color: card.fg },
|
|
134
|
-
".cm-
|
|
142
|
+
".cm-vision-function-doc, .cm-vision-extract-button": {
|
|
135
143
|
fontFamily: fonts.text.family,
|
|
136
144
|
fontSize: rem(fonts.text.sizes[1].fontSize)
|
|
137
145
|
},
|
|
138
|
-
".cm-
|
|
146
|
+
".cm-vision-function-code, .cm-vision-function-doc code": {
|
|
139
147
|
fontFamily: fonts.code.family,
|
|
140
148
|
fontSize: rem(fonts.code.sizes[1].fontSize)
|
|
141
149
|
},
|
|
142
|
-
".cm-
|
|
143
|
-
".cm-
|
|
144
|
-
".cm-
|
|
150
|
+
".cm-vision-function-note": { color: card.muted.fg },
|
|
151
|
+
".cm-vision-function-link": { color: card.link.fg },
|
|
152
|
+
".cm-vision-extract-button:hover, .cm-vision-extract-button:focus-visible": { backgroundColor: selection },
|
|
145
153
|
".cm-tooltip.cm-tooltip-autocomplete > ul": { fontFamily: fonts.code.family },
|
|
146
154
|
".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]": {
|
|
147
155
|
backgroundColor: selection,
|
|
@@ -331,7 +339,7 @@ function VisionCodeMirror(t0) {
|
|
|
331
339
|
to: currentDoc.length,
|
|
332
340
|
insert: newContent
|
|
333
341
|
},
|
|
334
|
-
selection: EditorSelection.cursor(newContent.length)
|
|
342
|
+
selection: EditorSelection$1.cursor(newContent.length)
|
|
335
343
|
}), editorView.scrollDOM.scrollTop = 0, editorView.scrollDOM.scrollLeft = 0);
|
|
336
344
|
}, $[5] = t7) : t7 = $[5];
|
|
337
345
|
let resetEditorContent = t7, t8;
|
|
@@ -352,7 +360,7 @@ function VisionCodeMirror(t0) {
|
|
|
352
360
|
if (!editorView_1) return;
|
|
353
361
|
let length = editorView_1.state.doc.length;
|
|
354
362
|
editorView_1.dispatch({
|
|
355
|
-
selection: EditorSelection.range(Math.min(from, length), Math.min(to, length)),
|
|
363
|
+
selection: EditorSelection$1.range(Math.min(from, length), Math.min(to, length)),
|
|
356
364
|
scrollIntoView: !0
|
|
357
365
|
}), editorView_1.focus();
|
|
358
366
|
}, $[8] = t10) : t10 = $[8];
|
|
@@ -426,10 +434,15 @@ function getActivePerspective({ visionPerspective, perspectiveStack, scheduledDr
|
|
|
426
434
|
function getActiveVariant(visionPerspective, selectedVariantName) {
|
|
427
435
|
if (visionPerspective === "pinnedRelease") return selectedVariantName;
|
|
428
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* The search params of a query request as `@sanity/client` writes them (`encodeQueryString` in
|
|
439
|
+
* its `src/data`): the query, then each param as `$name` with its value as JSON, then the
|
|
440
|
+
* options. A param whose value is `undefined` is left out, as the client leaves it out.
|
|
441
|
+
*/
|
|
429
442
|
function encodeQueryString(query, params = {}, options = {}) {
|
|
430
443
|
let searchParams = new URLSearchParams();
|
|
431
444
|
searchParams.set("query", query);
|
|
432
|
-
for (let [key, value] of Object.entries(params)) searchParams.set(`$${key}`, JSON.stringify(value));
|
|
445
|
+
for (let [key, value] of Object.entries(params)) value !== void 0 && searchParams.set(`$${key}`, JSON.stringify(value));
|
|
433
446
|
for (let [key, value] of Object.entries(options)) value && searchParams.set(key, `${value}`);
|
|
434
447
|
return `?${searchParams}`;
|
|
435
448
|
}
|
|
@@ -452,11 +465,17 @@ function isPlainObject(obj) {
|
|
|
452
465
|
return !!obj && typeof obj == "object" && Object.prototype.toString.call(obj) === "[object Object]";
|
|
453
466
|
}
|
|
454
467
|
/** Every `localStorage` key Vision writes (classic and redesign alike) starts with this prefix */
|
|
455
|
-
const hasLocalStorage = supportsLocalStorage(), clearListeners = /* @__PURE__ */ new Set();
|
|
468
|
+
const VISION_STORAGE_KEY_PREFIX = "sanityVision:", hasLocalStorage = supportsLocalStorage(), clearListeners = /* @__PURE__ */ new Set();
|
|
456
469
|
/** The `localStorage` instance when it is available and writable, `undefined` otherwise */
|
|
457
470
|
function getStorage() {
|
|
458
471
|
return hasLocalStorage ? globalThis.localStorage : void 0;
|
|
459
472
|
}
|
|
473
|
+
/** Runs `listener` after `clearLocalStorage`, so in-memory copies of stored values can drop too */
|
|
474
|
+
function onLocalStorageCleared(listener) {
|
|
475
|
+
return clearListeners.add(listener), () => {
|
|
476
|
+
clearListeners.delete(listener);
|
|
477
|
+
};
|
|
478
|
+
}
|
|
460
479
|
function clearLocalStorage() {
|
|
461
480
|
let storage = getStorage();
|
|
462
481
|
if (storage) {
|
|
@@ -470,7 +489,7 @@ function clearLocalStorage() {
|
|
|
470
489
|
clearListeners.forEach((listener) => listener());
|
|
471
490
|
}
|
|
472
491
|
function getLocalStorage(namespace) {
|
|
473
|
-
let storageKey =
|
|
492
|
+
let storageKey = `${VISION_STORAGE_KEY_PREFIX}${namespace}`, loadedState = null;
|
|
474
493
|
return {
|
|
475
494
|
get,
|
|
476
495
|
set,
|
|
@@ -536,7 +555,52 @@ function validateApiVersion(apiVersion) {
|
|
|
536
555
|
* paste handler has always picked the URL out of the pasted text with it. `parseQueryUrl` is
|
|
537
556
|
* stricter and takes the whole text to be the URL.
|
|
538
557
|
*/
|
|
539
|
-
const SANITY_QUERY_URL = /\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)
|
|
558
|
+
const SANITY_QUERY_URL = /\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)/, QUERY_URL_PATHNAME = /^\/(vX|v1|v\d{4}-\d\d-\d\d)\/(?:[^/]+\/)*(?:query|listen)\/([^/]+)\/?$/, API_CDN_HOST = /(?:^|\.)apicdn\.sanity\.(?:io|work)$/;
|
|
559
|
+
/** `<project>.apicdn.sanity.io`, where `useCdn` sends queries */
|
|
560
|
+
function isApiCdnHost(hostname) {
|
|
561
|
+
return API_CDN_HOST.test(hostname);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Parses a Content Lake query (or listen) URL, as pasted from the browser's network tab, into the
|
|
565
|
+
* pieces of a tab. Returns `null` when the text is not such a URL: the whole text has to be one
|
|
566
|
+
* http(s) URL, since a query URL quoted inside other text is not a paste of that URL, and the
|
|
567
|
+
* redesign claims a paste it parses and replaces the tab's query with it.
|
|
568
|
+
*/
|
|
569
|
+
function parseQueryUrl(data, datasets) {
|
|
570
|
+
let trimmed = data.trim(), url = parseHttpUrl(trimmed), match = url?.pathname.match(QUERY_URL_PATHNAME);
|
|
571
|
+
if (!url || !match) return null;
|
|
572
|
+
let [, usedApiVersion, usedDataset] = match, parts;
|
|
573
|
+
try {
|
|
574
|
+
parts = parseApiQueryString(url.searchParams);
|
|
575
|
+
} catch {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
if (!parts.query) return null;
|
|
579
|
+
let urlPerspective = parts.options.perspective, perspective = urlPerspective && isSupportedPerspective(urlPerspective) && !isVirtualPerspective(urlPerspective) ? urlPerspective : void 0, { resultSourceMap } = parts.options, includeSourceMap = resultSourceMap === "true" || resultSourceMap === "withKeyArraySelector";
|
|
580
|
+
return {
|
|
581
|
+
query: parts.query,
|
|
582
|
+
params: parts.params,
|
|
583
|
+
rawParams: JSON.stringify(parts.params, null, 2),
|
|
584
|
+
dataset: usedDataset,
|
|
585
|
+
isKnownDataset: datasets.includes(usedDataset),
|
|
586
|
+
apiVersion: validateApiVersion(usedApiVersion) ? usedApiVersion : void 0,
|
|
587
|
+
urlPerspective: urlPerspective || void 0,
|
|
588
|
+
perspective,
|
|
589
|
+
hasUnsupportedPerspective: !!urlPerspective && perspective === void 0,
|
|
590
|
+
variant: parts.options.variant || void 0,
|
|
591
|
+
includeSourceMap,
|
|
592
|
+
useCdn: isApiCdnHost(url.hostname),
|
|
593
|
+
url: trimmed
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function parseHttpUrl(text) {
|
|
597
|
+
try {
|
|
598
|
+
let url = new URL(text);
|
|
599
|
+
return url.protocol === "http:" || url.protocol === "https:" ? url : null;
|
|
600
|
+
} catch {
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
540
604
|
function tryParseParams(val, t) {
|
|
541
605
|
try {
|
|
542
606
|
let parsed = val ? JSON5.parse(val) : {};
|
|
@@ -545,7 +609,7 @@ function tryParseParams(val, t) {
|
|
|
545
609
|
return err.message = `${t("params.error.params-invalid-json")}:\n\n${err.message.replace("JSON5:", "")}`, err;
|
|
546
610
|
}
|
|
547
611
|
}
|
|
548
|
-
const _key3 = "
|
|
612
|
+
const _key3 = "JLqkdW_inputBackgroundContainer", _key10 = "JLqkdW_resultContainer";
|
|
549
613
|
function Root(t0) {
|
|
550
614
|
let $ = c(6), props, ref;
|
|
551
615
|
$[0] === t0 ? (props = $[1], ref = $[2]) : ({ref, ...props} = t0, $[0] = t0, $[1] = props, $[2] = ref);
|
|
@@ -553,28 +617,28 @@ function Root(t0) {
|
|
|
553
617
|
return $[3] !== props || $[4] !== ref ? (t1 = /* @__PURE__ */ jsx(Flex, {
|
|
554
618
|
...props,
|
|
555
619
|
ref,
|
|
556
|
-
className: "
|
|
620
|
+
className: "JLqkdW_root"
|
|
557
621
|
}), $[3] = props, $[4] = ref, $[5] = t1) : t1 = $[5], t1;
|
|
558
622
|
}
|
|
559
623
|
function Header(props) {
|
|
560
624
|
let $ = c(2), t0;
|
|
561
625
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
562
626
|
...props,
|
|
563
|
-
className: "
|
|
627
|
+
className: "JLqkdW_header"
|
|
564
628
|
}), $[0] = props, $[1] = t0), t0;
|
|
565
629
|
}
|
|
566
630
|
function StyledLabel(props) {
|
|
567
631
|
let $ = c(2), t0;
|
|
568
632
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Label, {
|
|
569
633
|
...props,
|
|
570
|
-
className: "
|
|
634
|
+
className: "JLqkdW_styledLabel"
|
|
571
635
|
}), $[0] = props, $[1] = t0), t0;
|
|
572
636
|
}
|
|
573
637
|
function SplitpaneContainer(props) {
|
|
574
638
|
let $ = c(2), t0;
|
|
575
639
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
576
640
|
...props,
|
|
577
|
-
className: "
|
|
641
|
+
className: "JLqkdW_splitpaneContainer"
|
|
578
642
|
}), $[0] = props, $[1] = t0), t0;
|
|
579
643
|
}
|
|
580
644
|
function QueryRecallPaneContainer(props) {
|
|
@@ -582,7 +646,7 @@ function QueryRecallPaneContainer(props) {
|
|
|
582
646
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Flex, {
|
|
583
647
|
...props,
|
|
584
648
|
flexDirection: "column",
|
|
585
|
-
className: "
|
|
649
|
+
className: "JLqkdW_queryRecallPaneContainer"
|
|
586
650
|
}), $[0] = props, $[1] = t0), t0;
|
|
587
651
|
}
|
|
588
652
|
function QueryRecallPaneWrapper(props) {
|
|
@@ -593,14 +657,14 @@ function QueryRecallPaneWrapper(props) {
|
|
|
593
657
|
flexBasis: "0%",
|
|
594
658
|
flexGrow: 1,
|
|
595
659
|
overflow: "hidden",
|
|
596
|
-
className: "
|
|
660
|
+
className: "JLqkdW_queryRecallPaneWrapper"
|
|
597
661
|
}), $[0] = props, $[1] = t0), t0;
|
|
598
662
|
}
|
|
599
663
|
function QueryCopyLink(props) {
|
|
600
664
|
let $ = c(2), t0;
|
|
601
665
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("a", {
|
|
602
666
|
...props,
|
|
603
|
-
className: "
|
|
667
|
+
className: "JLqkdW_queryCopyLink"
|
|
604
668
|
}), $[0] = props, $[1] = t0), t0;
|
|
605
669
|
}
|
|
606
670
|
function InputBackgroundContainer(props) {
|
|
@@ -614,34 +678,34 @@ function InputBackgroundContainerLeft(props) {
|
|
|
614
678
|
let $ = c(2), t0;
|
|
615
679
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
616
680
|
...props,
|
|
617
|
-
className: `${_key3}
|
|
681
|
+
className: `${_key3} JLqkdW_inputBackgroundContainerLeft`
|
|
618
682
|
}), $[0] = props, $[1] = t0), t0;
|
|
619
683
|
}
|
|
620
684
|
function InputContainer(props) {
|
|
621
685
|
let $ = c(2), t0;
|
|
622
686
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
623
687
|
...props,
|
|
624
|
-
className: "
|
|
688
|
+
className: "JLqkdW_inputContainer"
|
|
625
689
|
}), $[0] = props, $[1] = t0), t0;
|
|
626
690
|
}
|
|
627
691
|
function ResultOuterContainer(props) {
|
|
628
692
|
let $ = c(2), t0;
|
|
629
693
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Flex, {
|
|
630
694
|
...props,
|
|
631
|
-
className: "
|
|
695
|
+
className: "JLqkdW_resultOuterContainer"
|
|
632
696
|
}), $[0] = props, $[1] = t0), t0;
|
|
633
697
|
}
|
|
634
698
|
function ResultInnerContainer(props) {
|
|
635
699
|
let $ = c(2), t0;
|
|
636
700
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
637
701
|
...props,
|
|
638
|
-
className: "
|
|
702
|
+
className: "JLqkdW_resultInnerContainer"
|
|
639
703
|
}), $[0] = props, $[1] = t0), t0;
|
|
640
704
|
}
|
|
641
705
|
function ResultContainer(t0) {
|
|
642
706
|
let $ = c(6), isInvalid, props;
|
|
643
707
|
$[0] === t0 ? (isInvalid = $[1], props = $[2]) : ({isInvalid, ...props} = t0, $[0] = t0, $[1] = isInvalid, $[2] = props);
|
|
644
|
-
let t1 = isInvalid ? `${_key10}
|
|
708
|
+
let t1 = isInvalid ? `${_key10} JLqkdW_resultContainerInvalid` : _key10, t2;
|
|
645
709
|
return $[3] !== props || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(Card, {
|
|
646
710
|
...props,
|
|
647
711
|
className: t1
|
|
@@ -651,21 +715,21 @@ function Result(props) {
|
|
|
651
715
|
let $ = c(2), t0;
|
|
652
716
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
653
717
|
...props,
|
|
654
|
-
className: "
|
|
718
|
+
className: "JLqkdW_result"
|
|
655
719
|
}), $[0] = props, $[1] = t0), t0;
|
|
656
720
|
}
|
|
657
721
|
function ResultFooter(props) {
|
|
658
722
|
let $ = c(2), t0;
|
|
659
723
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Flex, {
|
|
660
724
|
...props,
|
|
661
|
-
className: "
|
|
725
|
+
className: "JLqkdW_resultFooter"
|
|
662
726
|
}), $[0] = props, $[1] = t0), t0;
|
|
663
727
|
}
|
|
664
728
|
function TimingsCard(props) {
|
|
665
729
|
let $ = c(2), t0;
|
|
666
730
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
667
731
|
...props,
|
|
668
|
-
className: "
|
|
732
|
+
className: "JLqkdW_timingsCard"
|
|
669
733
|
}), $[0] = props, $[1] = t0), t0;
|
|
670
734
|
}
|
|
671
735
|
function TimingsTextContainer(props) {
|
|
@@ -676,7 +740,7 @@ function TimingsTextContainer(props) {
|
|
|
676
740
|
let style = t3, t4;
|
|
677
741
|
return $[4] !== props || $[5] !== style ? (t4 = /* @__PURE__ */ jsx(Flex, {
|
|
678
742
|
...props,
|
|
679
|
-
className: "
|
|
743
|
+
className: "JLqkdW_timingsTextContainer",
|
|
680
744
|
style
|
|
681
745
|
}), $[4] = props, $[5] = style, $[6] = t4) : t4 = $[6], t4;
|
|
682
746
|
}
|
|
@@ -684,7 +748,7 @@ function DownloadsCard(props) {
|
|
|
684
748
|
let $ = c(2), t0;
|
|
685
749
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
686
750
|
...props,
|
|
687
|
-
className: "
|
|
751
|
+
className: "JLqkdW_downloadsCard"
|
|
688
752
|
}), $[0] = props, $[1] = t0), t0;
|
|
689
753
|
}
|
|
690
754
|
function SaveResultLabel(props) {
|
|
@@ -695,19 +759,21 @@ function SaveResultLabel(props) {
|
|
|
695
759
|
let style = t2, t3;
|
|
696
760
|
return $[4] !== props || $[5] !== style ? (t3 = /* @__PURE__ */ jsx(Text, {
|
|
697
761
|
...props,
|
|
698
|
-
className: "
|
|
699
|
-
style
|
|
762
|
+
className: "JLqkdW_saveResultLabel",
|
|
763
|
+
style,
|
|
764
|
+
as: "div",
|
|
765
|
+
trim: !0
|
|
700
766
|
}), $[4] = props, $[5] = style, $[6] = t3) : t3 = $[6], t3;
|
|
701
767
|
}
|
|
702
768
|
function ControlsContainer(props) {
|
|
703
769
|
let $ = c(2), t0;
|
|
704
770
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
705
771
|
...props,
|
|
706
|
-
className: "
|
|
772
|
+
className: "JLqkdW_controlsContainer"
|
|
707
773
|
}), $[0] = props, $[1] = t0), t0;
|
|
708
774
|
}
|
|
709
775
|
function ParamsEditor(props) {
|
|
710
|
-
let $ = c(
|
|
776
|
+
let $ = c(22), { onChange, paramsError, hasValidParams, editorRef } = props, { t } = useTranslation(visionLocaleNamespace), t0;
|
|
711
777
|
$[0] === onChange ? t0 = $[1] : (t0 = (newValue) => {
|
|
712
778
|
onChange(newValue);
|
|
713
779
|
}, $[0] = onChange, $[1] = t0);
|
|
@@ -721,36 +787,43 @@ function ParamsEditor(props) {
|
|
|
721
787
|
children: t3
|
|
722
788
|
}), $[6] = t3, $[7] = t4);
|
|
723
789
|
let t5;
|
|
724
|
-
$[8]
|
|
790
|
+
$[8] !== hasValidParams || $[9] !== paramsError ? (t5 = paramsError && /* @__PURE__ */ jsx(Tooltip, {
|
|
725
791
|
animate: !0,
|
|
726
792
|
placement: "top",
|
|
727
793
|
portal: !0,
|
|
728
794
|
content: /* @__PURE__ */ jsx(Text, {
|
|
729
795
|
size: 1,
|
|
796
|
+
as: "div",
|
|
797
|
+
trim: !0,
|
|
730
798
|
children: paramsError
|
|
731
799
|
}),
|
|
732
800
|
children: /* @__PURE__ */ jsx(Box, {
|
|
733
801
|
padding: 1,
|
|
734
802
|
marginX: 2,
|
|
735
|
-
children: /* @__PURE__ */ jsx(
|
|
803
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
804
|
+
icon: ErrorOutlineIcon,
|
|
805
|
+
muted: !0,
|
|
806
|
+
style: { margin: "-0.4375rem" },
|
|
807
|
+
tone: hasValidParams ? void 0 : "critical"
|
|
808
|
+
})
|
|
736
809
|
})
|
|
737
|
-
}), $[8] =
|
|
810
|
+
}), $[8] = hasValidParams, $[9] = paramsError, $[10] = t5) : t5 = $[10];
|
|
738
811
|
let t6;
|
|
739
|
-
$[
|
|
812
|
+
$[11] !== t4 || $[12] !== t5 ? (t6 = /* @__PURE__ */ jsx(InputBackgroundContainerLeft, { children: /* @__PURE__ */ jsxs(Flex, { children: [t4, t5] }) }), $[11] = t4, $[12] = t5, $[13] = t6) : t6 = $[13];
|
|
740
813
|
let t7 = props.value || "{\n \n}", t8;
|
|
741
|
-
$[
|
|
814
|
+
$[14] !== editorRef || $[15] !== handleChange || $[16] !== t7 ? (t8 = /* @__PURE__ */ jsx(VisionCodeMirror, {
|
|
742
815
|
ref: editorRef,
|
|
743
816
|
initialValue: t7,
|
|
744
817
|
onChange: handleChange,
|
|
745
818
|
extensions: paramsExtensions
|
|
746
|
-
}), $[
|
|
819
|
+
}), $[14] = editorRef, $[15] = handleChange, $[16] = t7, $[17] = t8) : t8 = $[17];
|
|
747
820
|
let t9;
|
|
748
|
-
return $[
|
|
821
|
+
return $[18] !== t2 || $[19] !== t6 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Card, {
|
|
749
822
|
flex: 1,
|
|
750
823
|
tone: t2,
|
|
751
824
|
"data-testid": "params-editor",
|
|
752
825
|
children: [t6, t8]
|
|
753
|
-
}), $[
|
|
826
|
+
}), $[18] = t2, $[19] = t6, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
|
|
754
827
|
}
|
|
755
828
|
function parseParams(value, t) {
|
|
756
829
|
let parsedParams = tryParseParams(value, t), params = parsedParams instanceof Error ? {} : parsedParams, validationError = parsedParams instanceof Error ? parsedParams.message : void 0;
|
|
@@ -869,7 +942,7 @@ function useSavedQueries() {
|
|
|
869
942
|
let run = () => task().finally(() => {
|
|
870
943
|
--pendingPersonalWritesRef.current;
|
|
871
944
|
}), result = personalWritesRef.current.then(run, run);
|
|
872
|
-
return personalWritesRef.current = result.catch(_temp$
|
|
945
|
+
return personalWritesRef.current = result.catch(_temp$6), result;
|
|
873
946
|
}, $[17] = t12) : t12 = $[17];
|
|
874
947
|
let enqueuePersonalWrite = t12, t13;
|
|
875
948
|
$[18] === Symbol.for("react.memo_cache_sentinel") ? (t13 = (before, attempted, kept) => {
|
|
@@ -1058,7 +1131,7 @@ function _temp3$3(count) {
|
|
|
1058
1131
|
function _temp2$4(a, b) {
|
|
1059
1132
|
return new Date(b.savedAt || 0).getTime() - new Date(a.savedAt || 0).getTime();
|
|
1060
1133
|
}
|
|
1061
|
-
function _temp$
|
|
1134
|
+
function _temp$6() {}
|
|
1062
1135
|
function FixedHeader(props) {
|
|
1063
1136
|
let $ = c(2), t0;
|
|
1064
1137
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(VStack, {
|
|
@@ -1416,7 +1489,7 @@ function QueryRecall(t0) {
|
|
|
1416
1489
|
}) : /* @__PURE__ */ jsx(Text, {
|
|
1417
1490
|
weight: "bold",
|
|
1418
1491
|
size: compactMode ? 2 : 3,
|
|
1419
|
-
|
|
1492
|
+
truncate: 1,
|
|
1420
1493
|
style: {
|
|
1421
1494
|
maxWidth: compactMode ? "180px" : "220px",
|
|
1422
1495
|
cursor: canMutateQuery ? "pointer" : "default",
|
|
@@ -1426,6 +1499,8 @@ function QueryRecall(t0) {
|
|
|
1426
1499
|
onClick: canMutateQuery ? () => {
|
|
1427
1500
|
setEditingKey(q_5._key), setEditingTitle(q_5.title || q_5._key.slice(0, 5));
|
|
1428
1501
|
} : void 0,
|
|
1502
|
+
as: "div",
|
|
1503
|
+
trim: !0,
|
|
1429
1504
|
children: optimisticTitles[q_5._key] || q_5.title || q_5._key.slice(q_5._key.length - 5, q_5._key.length)
|
|
1430
1505
|
}), isEdited && /* @__PURE__ */ jsx(Box, { style: {
|
|
1431
1506
|
width: "6px",
|
|
@@ -1549,6 +1624,8 @@ function QueryRecall(t0) {
|
|
|
1549
1624
|
}), /* @__PURE__ */ jsx(Text, {
|
|
1550
1625
|
size: 1,
|
|
1551
1626
|
muted: !0,
|
|
1627
|
+
as: "div",
|
|
1628
|
+
trim: !0,
|
|
1552
1629
|
children: formatDate.format(new Date(q_5.savedAt || ""))
|
|
1553
1630
|
})]
|
|
1554
1631
|
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -1594,11 +1671,15 @@ function QueryRecall(t0) {
|
|
|
1594
1671
|
/* @__PURE__ */ jsx(Text, {
|
|
1595
1672
|
size: 1,
|
|
1596
1673
|
muted: !0,
|
|
1674
|
+
as: "div",
|
|
1675
|
+
trim: !0,
|
|
1597
1676
|
children: "•"
|
|
1598
1677
|
}),
|
|
1599
1678
|
/* @__PURE__ */ jsx(Text, {
|
|
1600
1679
|
size: 1,
|
|
1601
1680
|
muted: !0,
|
|
1681
|
+
as: "div",
|
|
1682
|
+
trim: !0,
|
|
1602
1683
|
children: formatDate.format(new Date(q_5.savedAt || ""))
|
|
1603
1684
|
})
|
|
1604
1685
|
]
|
|
@@ -1663,6 +1744,8 @@ function QueryRecall(t0) {
|
|
|
1663
1744
|
padding: 4,
|
|
1664
1745
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1665
1746
|
size: 2,
|
|
1747
|
+
as: "div",
|
|
1748
|
+
trim: !0,
|
|
1666
1749
|
children: t("save-query.share-warning")
|
|
1667
1750
|
})
|
|
1668
1751
|
})
|
|
@@ -1688,7 +1771,7 @@ function calculatePaneSizeOptions(height) {
|
|
|
1688
1771
|
};
|
|
1689
1772
|
}
|
|
1690
1773
|
function usePaneSize(t0) {
|
|
1691
|
-
let $ = c(7), { visionRootRef } = t0, [rootSize, setRootSize] = useState(_temp$
|
|
1774
|
+
let $ = c(7), { visionRootRef } = t0, [rootSize, setRootSize] = useState(_temp$5), [isNarrowBreakpoint, setIsNarrowBreakpoint] = useState(_temp2$3), [paneSizeOptions, setPaneSizeOptions] = useState(_temp3$2), t1, t2;
|
|
1692
1775
|
$[0] === visionRootRef ? (t1 = $[1], t2 = $[2]) : (t1 = () => {
|
|
1693
1776
|
if (!visionRootRef.current) return;
|
|
1694
1777
|
let handleResize = (entries) => {
|
|
@@ -1715,7 +1798,7 @@ function _temp3$2() {
|
|
|
1715
1798
|
function _temp2$3() {
|
|
1716
1799
|
return narrowBreakpoint();
|
|
1717
1800
|
}
|
|
1718
|
-
function _temp$
|
|
1801
|
+
function _temp$5() {
|
|
1719
1802
|
return {
|
|
1720
1803
|
width: typeof window < "u" ? window.innerWidth : 1e3,
|
|
1721
1804
|
height: typeof window < "u" ? window.innerHeight : 800
|
|
@@ -1734,6 +1817,8 @@ function VisionGuiControls(t0) {
|
|
|
1734
1817
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1735
1818
|
size: 1,
|
|
1736
1819
|
muted: !0,
|
|
1820
|
+
as: "div",
|
|
1821
|
+
trim: !0,
|
|
1737
1822
|
children: t1
|
|
1738
1823
|
})
|
|
1739
1824
|
}), $[2] = t1, $[3] = t2);
|
|
@@ -1790,12 +1875,14 @@ function VisionGuiControls(t0) {
|
|
|
1790
1875
|
animate: !0,
|
|
1791
1876
|
content: /* @__PURE__ */ jsx(Text, {
|
|
1792
1877
|
size: 1,
|
|
1793
|
-
|
|
1878
|
+
as: "div",
|
|
1879
|
+
trim: !0,
|
|
1880
|
+
children: t("vision.redesign.try.description")
|
|
1794
1881
|
}),
|
|
1795
1882
|
placement: "top",
|
|
1796
1883
|
portal: !0,
|
|
1797
1884
|
children: /* @__PURE__ */ jsx(Button, {
|
|
1798
|
-
"aria-label": t("
|
|
1885
|
+
"aria-label": t("vision.redesign.try"),
|
|
1799
1886
|
"data-testid": "vision-try-redesign",
|
|
1800
1887
|
icon: RocketIcon,
|
|
1801
1888
|
mode: "bleed",
|
|
@@ -1832,26 +1919,26 @@ function PerspectivePopoverContent(props) {
|
|
|
1832
1919
|
let $ = c(2), t0;
|
|
1833
1920
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
1834
1921
|
...props,
|
|
1835
|
-
className: "
|
|
1922
|
+
className: "_yLaVW_perspectivePopoverContent"
|
|
1836
1923
|
}), $[0] = props, $[1] = t0), t0;
|
|
1837
1924
|
}
|
|
1838
1925
|
function PerspectivePopoverLink(props) {
|
|
1839
1926
|
let $ = c(2), t0;
|
|
1840
|
-
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(
|
|
1927
|
+
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Link, {
|
|
1841
1928
|
...props,
|
|
1842
|
-
className: "
|
|
1929
|
+
className: "_yLaVW_perspectivePopoverLink"
|
|
1843
1930
|
}), $[0] = props, $[1] = t0), t0;
|
|
1844
1931
|
}
|
|
1845
1932
|
function Dot(t0) {
|
|
1846
1933
|
let $ = c(2), { tone } = t0, t1 = `var(--card-badge-${tone}-dot-color)`, t2;
|
|
1847
1934
|
return $[0] === t1 ? t2 = $[1] : (t2 = /* @__PURE__ */ jsx("div", {
|
|
1848
|
-
className: "
|
|
1935
|
+
className: "_yLaVW_dot",
|
|
1849
1936
|
style: { backgroundColor: t1 }
|
|
1850
1937
|
}), $[0] = t1, $[1] = t2), t2;
|
|
1851
1938
|
}
|
|
1852
1939
|
function PerspectivePopover() {
|
|
1853
1940
|
let $ = c(39), [open, setOpen] = useState(!1), buttonRef = useRef(null), popoverRef = useRef(null), t0;
|
|
1854
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setOpen(_temp$
|
|
1941
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setOpen(_temp$4), $[0] = t0) : t0 = $[0];
|
|
1855
1942
|
let handleClick = t0, { t } = useTranslation(visionLocaleNamespace), t1, t2;
|
|
1856
1943
|
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setOpen(!1), t2 = () => [buttonRef.current, popoverRef.current], $[1] = t1, $[2] = t2) : (t1 = $[1], t2 = $[2]), useClickOutsideEvent(t1, t2);
|
|
1857
1944
|
let t3;
|
|
@@ -1861,6 +1948,8 @@ function PerspectivePopover() {
|
|
|
1861
1948
|
gap: 2,
|
|
1862
1949
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1863
1950
|
weight: "medium",
|
|
1951
|
+
as: "div",
|
|
1952
|
+
trim: !0,
|
|
1864
1953
|
children: t3
|
|
1865
1954
|
})
|
|
1866
1955
|
}), $[5] = t3, $[6] = t4);
|
|
@@ -1869,6 +1958,8 @@ function PerspectivePopover() {
|
|
|
1869
1958
|
let t6;
|
|
1870
1959
|
$[9] === t5 ? t6 = $[10] : (t6 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Text, {
|
|
1871
1960
|
muted: !0,
|
|
1961
|
+
as: "div",
|
|
1962
|
+
trim: !0,
|
|
1872
1963
|
children: t5
|
|
1873
1964
|
}) }), $[9] = t5, $[10] = t6);
|
|
1874
1965
|
let t7;
|
|
@@ -1881,6 +1972,8 @@ function PerspectivePopover() {
|
|
|
1881
1972
|
let t9;
|
|
1882
1973
|
$[15] === t ? t9 = $[16] : (t9 = /* @__PURE__ */ jsx(Text, {
|
|
1883
1974
|
muted: !0,
|
|
1975
|
+
as: "div",
|
|
1976
|
+
trim: !0,
|
|
1884
1977
|
children: /* @__PURE__ */ jsx(Translate, {
|
|
1885
1978
|
t,
|
|
1886
1979
|
i18nKey: "settings.perspective.preview-drafts-renamed-to-drafts.description"
|
|
@@ -1896,12 +1989,16 @@ function PerspectivePopover() {
|
|
|
1896
1989
|
let t12;
|
|
1897
1990
|
$[22] === t ? t12 = $[23] : (t12 = t("settings.perspectives.action.docs-link"), $[22] = t, $[23] = t12);
|
|
1898
1991
|
let t13;
|
|
1899
|
-
$[24] === t12 ? t13 = $[25] : (t13 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Text, {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1992
|
+
$[24] === t12 ? t13 = $[25] : (t13 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Text, {
|
|
1993
|
+
as: "div",
|
|
1994
|
+
trim: !0,
|
|
1995
|
+
children: /* @__PURE__ */ jsxs(PerspectivePopoverLink, {
|
|
1996
|
+
href: "https://www.sanity.io/docs/perspectives",
|
|
1997
|
+
openInNewTab: !0,
|
|
1998
|
+
underlined: !1,
|
|
1999
|
+
children: [t12, " →"]
|
|
2000
|
+
})
|
|
2001
|
+
}) }), $[24] = t12, $[25] = t13);
|
|
1905
2002
|
let t14;
|
|
1906
2003
|
$[26] !== t10 || $[27] !== t11 || $[28] !== t13 || $[29] !== t4 || $[30] !== t6 ? (t14 = /* @__PURE__ */ jsx(PerspectivePopoverContent, { children: /* @__PURE__ */ jsxs(VStack, {
|
|
1907
2004
|
gap: 4,
|
|
@@ -1940,7 +2037,7 @@ function PerspectivePopover() {
|
|
|
1940
2037
|
children: t16
|
|
1941
2038
|
}), $[35] = open, $[36] = t14, $[37] = t16, $[38] = t17) : t17 = $[38], t17;
|
|
1942
2039
|
}
|
|
1943
|
-
function _temp$
|
|
2040
|
+
function _temp$4(o) {
|
|
1944
2041
|
return !o;
|
|
1945
2042
|
}
|
|
1946
2043
|
const PinnedReleasePerspectiveOption = (t0) => {
|
|
@@ -1951,7 +2048,7 @@ const PinnedReleasePerspectiveOption = (t0) => {
|
|
|
1951
2048
|
name,
|
|
1952
2049
|
t2,
|
|
1953
2050
|
label
|
|
1954
|
-
].filter(_temp$
|
|
2051
|
+
].filter(_temp$3), $[3] = label, $[4] = name, $[5] = t2, $[6] = t3) : t3 = $[6];
|
|
1955
2052
|
let text = t3.join(" "), t4;
|
|
1956
2053
|
$[7] === pinnedPerspective ? t4 = $[8] : (t4 = hasPinnedPerspective(pinnedPerspective), $[7] = pinnedPerspective, $[8] = t4);
|
|
1957
2054
|
let t5 = !t4, t6;
|
|
@@ -2022,6 +2119,8 @@ function VisionGuiHeader(t0) {
|
|
|
2022
2119
|
let t15;
|
|
2023
2120
|
$[29] === t14 ? t15 = $[30] : (t15 = /* @__PURE__ */ jsx(Text, {
|
|
2024
2121
|
size: 1,
|
|
2122
|
+
as: "div",
|
|
2123
|
+
trim: !0,
|
|
2025
2124
|
children: t14
|
|
2026
2125
|
}), $[29] = t14, $[30] = t15);
|
|
2027
2126
|
let t16 = !isApiVersionLocked, t17 = customApiVersion === !1 ? apiVersion : "other", t18;
|
|
@@ -2199,7 +2298,7 @@ function _temp3$1(version) {
|
|
|
2199
2298
|
function _temp2$2(ds) {
|
|
2200
2299
|
return /* @__PURE__ */ jsx("option", { children: ds }, ds);
|
|
2201
2300
|
}
|
|
2202
|
-
function _temp$
|
|
2301
|
+
function _temp$3(value) {
|
|
2203
2302
|
return value !== void 0;
|
|
2204
2303
|
}
|
|
2205
2304
|
function getBlobUrl(content, mimeType) {
|
|
@@ -2223,6 +2322,14 @@ function getMemoizedBlobUrlResolver(mimeType, stringEncoder) {
|
|
|
2223
2322
|
})();
|
|
2224
2323
|
}
|
|
2225
2324
|
const getJsonBlobUrl = getMemoizedBlobUrlResolver("application/json", (input) => JSON.stringify(input, null, 2)), getCsvBlobUrl = getMemoizedBlobUrlResolver("text/csv", (input) => json2csv(Array.isArray(input) ? input : [input]).trim());
|
|
2325
|
+
/**
|
|
2326
|
+
* Whether `getCsvBlobUrl` can produce anything for a result: `json2csv` yields nothing unless at
|
|
2327
|
+
* least one item is an object. A look at the shape, so a download button can be disabled without
|
|
2328
|
+
* converting a result nobody asked to download.
|
|
2329
|
+
*/
|
|
2330
|
+
function canEncodeCsv(input) {
|
|
2331
|
+
return (Array.isArray(input) ? input : [input]).some((item) => typeof item == "object" && !!item && !Array.isArray(item));
|
|
2332
|
+
}
|
|
2226
2333
|
function DelayedSpinner(props) {
|
|
2227
2334
|
let $ = c(5), [show, setShow] = useState(!1), t0, t1;
|
|
2228
2335
|
$[0] === props.delay ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
|
|
@@ -2346,6 +2453,8 @@ function QueryErrorDialog(props) {
|
|
|
2346
2453
|
T0 = Flex, t0 = 5, t1 = 2, t2 = "column", t3 = unsatisfiedCapability ? /* @__PURE__ */ jsx(Text, {
|
|
2347
2454
|
"data-testid": "query-error-api-version-capability-hint",
|
|
2348
2455
|
size: 1,
|
|
2456
|
+
as: "div",
|
|
2457
|
+
trim: !0,
|
|
2349
2458
|
children: t(unsatisfiedCapability.explanationKey, { apiVersion: prefixApiVersion(unsatisfiedCapability.requiredApiVersion) })
|
|
2350
2459
|
}) : null, $[0] = apiVersion, $[1] = error, $[2] = perspective, $[3] = t, $[4] = variant, $[5] = T0, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3;
|
|
2351
2460
|
} else T0 = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9];
|
|
@@ -2368,6 +2477,10 @@ function QueryErrorDialog(props) {
|
|
|
2368
2477
|
]
|
|
2369
2478
|
}), $[14] = T0, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6) : t6 = $[21], t6;
|
|
2370
2479
|
}
|
|
2480
|
+
/** A dotted key path written the way it reads in code: `0.author.tags.1` as `[0].author.tags[1]` */
|
|
2481
|
+
function describeKeypath(keypath) {
|
|
2482
|
+
return keypath.split(".").map((segment, index) => /^\d+$/.test(segment) ? `[${segment}]` : index === 0 ? segment : `.${segment}`).join("");
|
|
2483
|
+
}
|
|
2371
2484
|
/**
|
|
2372
2485
|
* The value at one of `@rexxars/react-json-inspector`'s dotted key paths (`0.author.name`; empty
|
|
2373
2486
|
* for the root). A key may contain dots itself, so at each step the longest run of segments that
|
|
@@ -2640,6 +2753,8 @@ function VisionGuiResult(t0) {
|
|
|
2640
2753
|
$[42] !== t19 || $[43] !== t20 || $[44] !== t21 ? (t22 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, {
|
|
2641
2754
|
muted: !0,
|
|
2642
2755
|
size: t19,
|
|
2756
|
+
as: "div",
|
|
2757
|
+
trim: !0,
|
|
2643
2758
|
children: [
|
|
2644
2759
|
t20,
|
|
2645
2760
|
":",
|
|
@@ -2655,6 +2770,8 @@ function VisionGuiResult(t0) {
|
|
|
2655
2770
|
$[51] !== t24 || $[52] !== t25 || $[53] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Text, {
|
|
2656
2771
|
muted: !0,
|
|
2657
2772
|
size: t24,
|
|
2773
|
+
as: "div",
|
|
2774
|
+
trim: !0,
|
|
2658
2775
|
children: [
|
|
2659
2776
|
t25,
|
|
2660
2777
|
":",
|
|
@@ -2769,7 +2886,7 @@ function VisionGui(props) {
|
|
|
2769
2886
|
}
|
|
2770
2887
|
let t17;
|
|
2771
2888
|
if ($[35] !== isDraftModelEnabled || $[36] !== releases) {
|
|
2772
|
-
let scheduledDraftReleases = releases.filter(_temp$
|
|
2889
|
+
let scheduledDraftReleases = releases.filter(_temp$2), releaseIds = sortReleases(scheduledDraftReleases).map(_temp2$1), t18;
|
|
2773
2890
|
$[38] === isDraftModelEnabled ? t18 = $[39] : (t18 = isDraftModelEnabled ? ["drafts"] : ["published"], $[38] = isDraftModelEnabled, $[39] = t18);
|
|
2774
2891
|
let defaultPerspective = t18;
|
|
2775
2892
|
t17 = [...releaseIds, ...defaultPerspective], $[35] = isDraftModelEnabled, $[36] = releases, $[37] = t17;
|
|
@@ -3166,7 +3283,7 @@ function VisionGui(props) {
|
|
|
3166
3283
|
function _temp2$1(release_0) {
|
|
3167
3284
|
return getReleaseIdFromReleaseDocumentId(release_0._id);
|
|
3168
3285
|
}
|
|
3169
|
-
function _temp$
|
|
3286
|
+
function _temp$2(release) {
|
|
3170
3287
|
return isCardinalityOneRelease(release) && release.state === "scheduled";
|
|
3171
3288
|
}
|
|
3172
3289
|
function useDatasets(t0) {
|
|
@@ -3180,7 +3297,7 @@ function useDatasets(t0) {
|
|
|
3180
3297
|
let t2;
|
|
3181
3298
|
if ($[2] !== client.observable.datasets || $[3] !== configDatasets) {
|
|
3182
3299
|
let t3;
|
|
3183
|
-
$[5] === configDatasets ? t3 = $[6] : (t3 = (result) => typeof configDatasets == "function" ? configDatasets(result).map(_temp) : result.map(_temp2), $[5] = configDatasets, $[6] = t3), t2 = client.observable.datasets.list().pipe(map(t3), catchError(_temp3)), $[2] = client.observable.datasets, $[3] = configDatasets, $[4] = t2;
|
|
3300
|
+
$[5] === configDatasets ? t3 = $[6] : (t3 = (result) => typeof configDatasets == "function" ? configDatasets(result).map(_temp$1) : result.map(_temp2), $[5] = configDatasets, $[6] = t3), t2 = client.observable.datasets.list().pipe(map(t3), catchError(_temp3)), $[2] = client.observable.datasets, $[3] = configDatasets, $[4] = t2;
|
|
3184
3301
|
} else t2 = $[4];
|
|
3185
3302
|
t1 = t2;
|
|
3186
3303
|
}
|
|
@@ -3192,7 +3309,7 @@ function _temp3(err) {
|
|
|
3192
3309
|
function _temp2(ds) {
|
|
3193
3310
|
return ds.name;
|
|
3194
3311
|
}
|
|
3195
|
-
function _temp(d) {
|
|
3312
|
+
function _temp$1(d) {
|
|
3196
3313
|
return d.name;
|
|
3197
3314
|
}
|
|
3198
3315
|
function VisionContainer(props) {
|
|
@@ -3300,8 +3417,175 @@ var VisionErrorBoundary = class extends Component {
|
|
|
3300
3417
|
});
|
|
3301
3418
|
}
|
|
3302
3419
|
};
|
|
3420
|
+
const TOAST_ID = "vision-redesign-invitation";
|
|
3421
|
+
/**
|
|
3422
|
+
* The toast's body. It renders in the studio's toast layer, which can sit outside the locale
|
|
3423
|
+
* provider that has Vision's strings, so it is handed them translated
|
|
3424
|
+
*/
|
|
3425
|
+
function RedesignToastActions(props) {
|
|
3426
|
+
let $ = c(14), { description, acceptLabel, dismissLabel, onAccept, onDismiss } = props, t0;
|
|
3427
|
+
$[0] === description ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Text, {
|
|
3428
|
+
size: 1,
|
|
3429
|
+
as: "div",
|
|
3430
|
+
trim: !0,
|
|
3431
|
+
children: description
|
|
3432
|
+
}), $[0] = description, $[1] = t0);
|
|
3433
|
+
let t1;
|
|
3434
|
+
$[2] !== acceptLabel || $[3] !== onAccept ? (t1 = /* @__PURE__ */ jsx(Button, {
|
|
3435
|
+
"data-testid": "vision-redesign-accept",
|
|
3436
|
+
fontSize: 1,
|
|
3437
|
+
onClick: onAccept,
|
|
3438
|
+
padding: 2,
|
|
3439
|
+
text: acceptLabel,
|
|
3440
|
+
tone: "primary"
|
|
3441
|
+
}), $[2] = acceptLabel, $[3] = onAccept, $[4] = t1) : t1 = $[4];
|
|
3442
|
+
let t2;
|
|
3443
|
+
$[5] !== dismissLabel || $[6] !== onDismiss ? (t2 = /* @__PURE__ */ jsx(Button, {
|
|
3444
|
+
"data-testid": "vision-redesign-dismiss",
|
|
3445
|
+
fontSize: 1,
|
|
3446
|
+
mode: "bleed",
|
|
3447
|
+
onClick: onDismiss,
|
|
3448
|
+
padding: 2,
|
|
3449
|
+
text: dismissLabel
|
|
3450
|
+
}), $[5] = dismissLabel, $[6] = onDismiss, $[7] = t2) : t2 = $[7];
|
|
3451
|
+
let t3;
|
|
3452
|
+
$[8] !== t1 || $[9] !== t2 ? (t3 = /* @__PURE__ */ jsxs(Flex, {
|
|
3453
|
+
gap: 2,
|
|
3454
|
+
children: [t1, t2]
|
|
3455
|
+
}), $[8] = t1, $[9] = t2, $[10] = t3) : t3 = $[10];
|
|
3456
|
+
let t4;
|
|
3457
|
+
return $[11] !== t0 || $[12] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Stack, {
|
|
3458
|
+
gap: 3,
|
|
3459
|
+
paddingTop: 1,
|
|
3460
|
+
children: [t0, t3]
|
|
3461
|
+
}), $[11] = t0, $[12] = t3, $[13] = t4) : t4 = $[13], t4;
|
|
3462
|
+
}
|
|
3463
|
+
/**
|
|
3464
|
+
* Invites the user to try the redesigned Vision. Renders nothing itself: it pushes a persistent
|
|
3465
|
+
* toast while mounted and removes it again on unmount, so it disappears as soon as the user opts
|
|
3466
|
+
* in or leaves the tool.
|
|
3467
|
+
*/
|
|
3468
|
+
function RedesignToast(t0) {
|
|
3469
|
+
let $ = c(8), { onAccept, onDismiss } = t0, toast = useToast(), { t } = useTranslation(visionLocaleNamespace), accept = useEffectEvent(onAccept), dismiss = useEffectEvent(onDismiss), t1;
|
|
3470
|
+
$[0] !== accept || $[1] !== dismiss || $[2] !== t || $[3] !== toast ? (t1 = () => {
|
|
3471
|
+
let remove = () => {
|
|
3472
|
+
toast.push({
|
|
3473
|
+
id: TOAST_ID,
|
|
3474
|
+
duration: .01
|
|
3475
|
+
});
|
|
3476
|
+
};
|
|
3477
|
+
return toast.push({
|
|
3478
|
+
id: TOAST_ID,
|
|
3479
|
+
closable: !1,
|
|
3480
|
+
duration: Infinity,
|
|
3481
|
+
status: "info",
|
|
3482
|
+
title: t("vision.redesign.toast.title"),
|
|
3483
|
+
description: /* @__PURE__ */ jsx(RedesignToastActions, {
|
|
3484
|
+
acceptLabel: t("vision.redesign.toast.accept"),
|
|
3485
|
+
description: t("vision.redesign.toast.description"),
|
|
3486
|
+
dismissLabel: t("vision.redesign.toast.dismiss"),
|
|
3487
|
+
onAccept: () => {
|
|
3488
|
+
remove(), accept();
|
|
3489
|
+
},
|
|
3490
|
+
onDismiss: () => {
|
|
3491
|
+
remove(), dismiss();
|
|
3492
|
+
}
|
|
3493
|
+
})
|
|
3494
|
+
}), remove;
|
|
3495
|
+
}, $[0] = accept, $[1] = dismiss, $[2] = t, $[3] = toast, $[4] = t1) : t1 = $[4];
|
|
3496
|
+
let t2;
|
|
3497
|
+
return $[5] !== t || $[6] !== toast ? (t2 = [t, toast], $[5] = t, $[6] = toast, $[7] = t2) : t2 = $[7], useEffect(t1, t2), null;
|
|
3498
|
+
}
|
|
3499
|
+
const DEFAULT_PREFERENCE = {
|
|
3500
|
+
optedIn: !1,
|
|
3501
|
+
dismissed: !1
|
|
3502
|
+
}, cache = /* @__PURE__ */ new Map(), listeners = /* @__PURE__ */ new Set();
|
|
3503
|
+
function storageKey(projectId) {
|
|
3504
|
+
return `${VISION_STORAGE_KEY_PREFIX}redesign:${projectId}`;
|
|
3505
|
+
}
|
|
3506
|
+
function notify() {
|
|
3507
|
+
listeners.forEach((listener) => listener());
|
|
3508
|
+
}
|
|
3509
|
+
function subscribe(listener) {
|
|
3510
|
+
listeners.add(listener);
|
|
3511
|
+
let unsubscribeClear = onLocalStorageCleared(() => {
|
|
3512
|
+
cache.clear(), listener();
|
|
3513
|
+
});
|
|
3514
|
+
return () => {
|
|
3515
|
+
listeners.delete(listener), unsubscribeClear();
|
|
3516
|
+
};
|
|
3517
|
+
}
|
|
3518
|
+
function parsePreference(raw) {
|
|
3519
|
+
if (raw === null) return DEFAULT_PREFERENCE;
|
|
3520
|
+
try {
|
|
3521
|
+
let stored = JSON.parse(raw);
|
|
3522
|
+
return isPlainObject(stored) ? {
|
|
3523
|
+
optedIn: stored.optedIn === !0,
|
|
3524
|
+
dismissed: stored.dismissed === !0
|
|
3525
|
+
} : DEFAULT_PREFERENCE;
|
|
3526
|
+
} catch {
|
|
3527
|
+
return DEFAULT_PREFERENCE;
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
function readRedesignPreference(projectId) {
|
|
3531
|
+
let storage = getStorage(), cached = cache.get(projectId);
|
|
3532
|
+
if (!storage) return cached?.preference ?? DEFAULT_PREFERENCE;
|
|
3533
|
+
let raw = storage.getItem(storageKey(projectId));
|
|
3534
|
+
if (cached && cached.raw === raw) return cached.preference;
|
|
3535
|
+
let preference = parsePreference(raw);
|
|
3536
|
+
return cache.set(projectId, {
|
|
3537
|
+
raw,
|
|
3538
|
+
preference
|
|
3539
|
+
}), preference;
|
|
3540
|
+
}
|
|
3541
|
+
function writeRedesignPreference(projectId, patch) {
|
|
3542
|
+
let next = {
|
|
3543
|
+
...readRedesignPreference(projectId),
|
|
3544
|
+
...patch
|
|
3545
|
+
}, storage = getStorage(), raw = JSON.stringify(next);
|
|
3546
|
+
try {
|
|
3547
|
+
storage?.setItem(storageKey(projectId), raw);
|
|
3548
|
+
} catch {
|
|
3549
|
+
raw = storage?.getItem(storageKey(projectId)) ?? null;
|
|
3550
|
+
}
|
|
3551
|
+
return cache.set(projectId, {
|
|
3552
|
+
raw,
|
|
3553
|
+
preference: next
|
|
3554
|
+
}), notify(), next;
|
|
3555
|
+
}
|
|
3556
|
+
function useRedesignPreference(projectId) {
|
|
3557
|
+
let $ = c(2), t0;
|
|
3558
|
+
return $[0] === projectId ? t0 = $[1] : (t0 = () => readRedesignPreference(projectId), $[0] = projectId, $[1] = t0), useSyncExternalStore(subscribe, t0, _temp);
|
|
3559
|
+
}
|
|
3560
|
+
function _temp() {
|
|
3561
|
+
return DEFAULT_PREFERENCE;
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* A `lazy()` component whose failed import can be tried again. React keeps a rejected `lazy()`
|
|
3565
|
+
* for good, so `retry` (for the error boundary's Retry) swaps in a fresh one. The rejected one
|
|
3566
|
+
* stays until then: swapped as soon as the import fails, the Suspense boundary's next render
|
|
3567
|
+
* would start another import instead of surfacing the error, so a chunk that keeps failing
|
|
3568
|
+
* would be fetched over and over and never reach the error boundary.
|
|
3569
|
+
*/
|
|
3570
|
+
function createRetryableLazy(load) {
|
|
3571
|
+
let failed = !1, attempt = () => load().catch((error) => {
|
|
3572
|
+
throw failed = !0, error;
|
|
3573
|
+
}), LazyComponent = lazy(attempt);
|
|
3574
|
+
function RetryableLazy(props) {
|
|
3575
|
+
let $ = c(2), t0;
|
|
3576
|
+
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(LazyComponent, { ...props }), $[0] = props, $[1] = t0), t0;
|
|
3577
|
+
}
|
|
3578
|
+
return {
|
|
3579
|
+
Component: RetryableLazy,
|
|
3580
|
+
retry: () => {
|
|
3581
|
+
failed && (failed = !1, LazyComponent = lazy(attempt));
|
|
3582
|
+
}
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
var SanityVision_exports = /* @__PURE__ */ __exportAll({ default: () => SanityVision });
|
|
3586
|
+
const visionRedesign = createRetryableLazy(() => import("./VisionRedesign-C3iwsYdI.js").then((module) => ({ default: module.VisionRedesign }))), VisionRedesignLoader = visionRedesign.Component;
|
|
3303
3587
|
function SanityVision(props) {
|
|
3304
|
-
let $ = c(
|
|
3588
|
+
let $ = c(31), t0;
|
|
3305
3589
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "1" }, $[0] = t0) : t0 = $[0];
|
|
3306
3590
|
let client = useClient(t0), t1;
|
|
3307
3591
|
$[1] === props.tool.options ? t1 = $[2] : (t1 = {
|
|
@@ -3309,18 +3593,47 @@ function SanityVision(props) {
|
|
|
3309
3593
|
...props.tool.options
|
|
3310
3594
|
}, $[1] = props.tool.options, $[2] = t1);
|
|
3311
3595
|
let config = t1, t2;
|
|
3312
|
-
$[3]
|
|
3596
|
+
$[3] === client ? t2 = $[4] : (t2 = client.config().projectId || "default", $[3] = client, $[4] = t2);
|
|
3597
|
+
let projectId = t2, redesignEnabled = config.beta?.redesign?.enabled === !0, preference = useRedesignPreference(projectId), showRedesign = redesignEnabled && preference.optedIn, t3;
|
|
3598
|
+
$[5] === projectId ? t3 = $[6] : (t3 = () => writeRedesignPreference(projectId, {
|
|
3599
|
+
optedIn: !0,
|
|
3600
|
+
dismissed: !1
|
|
3601
|
+
}), $[5] = projectId, $[6] = t3);
|
|
3602
|
+
let optIn = t3, t4;
|
|
3603
|
+
$[7] === projectId ? t4 = $[8] : (t4 = () => writeRedesignPreference(projectId, { dismissed: !0 }), $[7] = projectId, $[8] = t4);
|
|
3604
|
+
let dismiss = t4, t5;
|
|
3605
|
+
$[9] === projectId ? t5 = $[10] : (t5 = () => writeRedesignPreference(projectId, {
|
|
3606
|
+
optedIn: !1,
|
|
3607
|
+
dismissed: !1
|
|
3608
|
+
}), $[9] = projectId, $[10] = t5);
|
|
3609
|
+
let switchToClassic = t5, t6;
|
|
3610
|
+
$[11] !== client || $[12] !== config || $[13] !== optIn || $[14] !== redesignEnabled || $[15] !== showRedesign || $[16] !== switchToClassic ? (t6 = (loaded) => showRedesign ? /* @__PURE__ */ jsx(VisionRedesignLoader, {
|
|
3611
|
+
...loaded,
|
|
3612
|
+
config,
|
|
3613
|
+
onSwitchToClassic: switchToClassic
|
|
3614
|
+
}) : /* @__PURE__ */ jsx(VisionGui, {
|
|
3313
3615
|
...loaded,
|
|
3314
3616
|
client,
|
|
3315
|
-
config
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3617
|
+
config,
|
|
3618
|
+
onSwitchToRedesign: redesignEnabled ? optIn : void 0
|
|
3619
|
+
}), $[11] = client, $[12] = config, $[13] = optIn, $[14] = redesignEnabled, $[15] = showRedesign, $[16] = switchToClassic, $[17] = t6) : t6 = $[17];
|
|
3620
|
+
let t7;
|
|
3621
|
+
$[18] !== client || $[19] !== config || $[20] !== t6 ? (t7 = /* @__PURE__ */ jsx(VisionContainer, {
|
|
3319
3622
|
client,
|
|
3320
3623
|
config,
|
|
3321
|
-
children:
|
|
3322
|
-
})
|
|
3624
|
+
children: t6
|
|
3625
|
+
}), $[18] = client, $[19] = config, $[20] = t6, $[21] = t7) : t7 = $[21];
|
|
3626
|
+
let t8;
|
|
3627
|
+
$[22] !== dismiss || $[23] !== optIn || $[24] !== preference || $[25] !== redesignEnabled || $[26] !== showRedesign ? (t8 = redesignEnabled && !showRedesign && !preference.dismissed && /* @__PURE__ */ jsx(RedesignToast, {
|
|
3628
|
+
onAccept: optIn,
|
|
3629
|
+
onDismiss: dismiss
|
|
3630
|
+
}), $[22] = dismiss, $[23] = optIn, $[24] = preference, $[25] = redesignEnabled, $[26] = showRedesign, $[27] = t8) : t8 = $[27];
|
|
3631
|
+
let t9;
|
|
3632
|
+
return $[28] !== t7 || $[29] !== t8 ? (t9 = /* @__PURE__ */ jsxs(VisionErrorBoundary, {
|
|
3633
|
+
onRetry: visionRedesign.retry,
|
|
3634
|
+
children: [t7, t8]
|
|
3635
|
+
}), $[28] = t7, $[29] = t8, $[30] = t9) : t9 = $[30], t9;
|
|
3323
3636
|
}
|
|
3324
|
-
export { SanityVision as default };
|
|
3637
|
+
export { DEFAULT_API_VERSION as A, getActivePerspective as C, paramsExtensions as D, groqExtensions as E, prefixApiVersion as M, resultJsonExtensions as O, encodeQueryString as S, VisionCodeMirror as T, VISION_STORAGE_KEY_PREFIX as _, getAtKeypath as a, isPlainObject as b, DelayedSpinner as c, getJsonBlobUrl as d, SanityVision as default, useSavedQueries as f, validateApiVersion as g, parseQueryUrl as h, describeKeypath as i, VARIANTS_API_VERSION as j, API_VERSIONS as k, canEncodeCsv as l, isApiCdnHost as m, createRetryableLazy as n, QueryErrorDialog as o, parseParams as p, ResultView as r, isApiVersionBelow as s, SanityVision_exports as t, getCsvBlobUrl as u, getStorage as v, useVariantsEnabled as w, isVisionPasteTarget as x, onLocalStorageCleared as y };
|
|
3325
3638
|
|
|
3326
|
-
//# sourceMappingURL=SanityVision-
|
|
3639
|
+
//# sourceMappingURL=SanityVision-BSByYf4K.js.map
|