@sanity/vision 6.23.0-next.7 → 6.24.0-next.18
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-DHgPjtr1.js} +404 -83
- package/lib/SanityVision-DHgPjtr1.js.map +1 -0
- package/lib/VisionRedesign-e97UZ2aL.js +15087 -0
- package/lib/VisionRedesign-e97UZ2aL.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)
|
|
@@ -111,6 +119,14 @@ function createTheme(theme) {
|
|
|
111
119
|
fontSize: rem(fonts.code.sizes[1].fontSize),
|
|
112
120
|
lineHeight: "inherit"
|
|
113
121
|
},
|
|
122
|
+
".cm-gutters": {
|
|
123
|
+
backgroundColor: card.bg,
|
|
124
|
+
color: card.muted.fg,
|
|
125
|
+
border: "none",
|
|
126
|
+
borderRight: `1px solid ${card.border}`
|
|
127
|
+
},
|
|
128
|
+
".cm-activeLineGutter": { backgroundColor: "transparent" },
|
|
129
|
+
"&.cm-focused .cm-activeLineGutter": { color: card.fg },
|
|
114
130
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },
|
|
115
131
|
"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
|
|
116
132
|
".cm-panels": {
|
|
@@ -131,17 +147,17 @@ function createTheme(theme) {
|
|
|
131
147
|
},
|
|
132
148
|
".cm-panel.cm-panel-lint ul [aria-selected]": { backgroundColor: selection },
|
|
133
149
|
".cm-panel.cm-panel-lint ul [aria-selected] .cm-diagnostic": { color: card.fg },
|
|
134
|
-
".cm-
|
|
150
|
+
".cm-vision-function-doc, .cm-vision-extract-button": {
|
|
135
151
|
fontFamily: fonts.text.family,
|
|
136
152
|
fontSize: rem(fonts.text.sizes[1].fontSize)
|
|
137
153
|
},
|
|
138
|
-
".cm-
|
|
154
|
+
".cm-vision-function-code, .cm-vision-function-doc code": {
|
|
139
155
|
fontFamily: fonts.code.family,
|
|
140
156
|
fontSize: rem(fonts.code.sizes[1].fontSize)
|
|
141
157
|
},
|
|
142
|
-
".cm-
|
|
143
|
-
".cm-
|
|
144
|
-
".cm-
|
|
158
|
+
".cm-vision-function-note": { color: card.muted.fg },
|
|
159
|
+
".cm-vision-function-link": { color: card.link.fg },
|
|
160
|
+
".cm-vision-extract-button:hover, .cm-vision-extract-button:focus-visible": { backgroundColor: selection },
|
|
145
161
|
".cm-tooltip.cm-tooltip-autocomplete > ul": { fontFamily: fonts.code.family },
|
|
146
162
|
".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]": {
|
|
147
163
|
backgroundColor: selection,
|
|
@@ -331,7 +347,7 @@ function VisionCodeMirror(t0) {
|
|
|
331
347
|
to: currentDoc.length,
|
|
332
348
|
insert: newContent
|
|
333
349
|
},
|
|
334
|
-
selection: EditorSelection.cursor(newContent.length)
|
|
350
|
+
selection: EditorSelection$1.cursor(newContent.length)
|
|
335
351
|
}), editorView.scrollDOM.scrollTop = 0, editorView.scrollDOM.scrollLeft = 0);
|
|
336
352
|
}, $[5] = t7) : t7 = $[5];
|
|
337
353
|
let resetEditorContent = t7, t8;
|
|
@@ -352,7 +368,7 @@ function VisionCodeMirror(t0) {
|
|
|
352
368
|
if (!editorView_1) return;
|
|
353
369
|
let length = editorView_1.state.doc.length;
|
|
354
370
|
editorView_1.dispatch({
|
|
355
|
-
selection: EditorSelection.range(Math.min(from, length), Math.min(to, length)),
|
|
371
|
+
selection: EditorSelection$1.range(Math.min(from, length), Math.min(to, length)),
|
|
356
372
|
scrollIntoView: !0
|
|
357
373
|
}), editorView_1.focus();
|
|
358
374
|
}, $[8] = t10) : t10 = $[8];
|
|
@@ -426,10 +442,15 @@ function getActivePerspective({ visionPerspective, perspectiveStack, scheduledDr
|
|
|
426
442
|
function getActiveVariant(visionPerspective, selectedVariantName) {
|
|
427
443
|
if (visionPerspective === "pinnedRelease") return selectedVariantName;
|
|
428
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* The search params of a query request as `@sanity/client` writes them (`encodeQueryString` in
|
|
447
|
+
* its `src/data`): the query, then each param as `$name` with its value as JSON, then the
|
|
448
|
+
* options. A param whose value is `undefined` is left out, as the client leaves it out.
|
|
449
|
+
*/
|
|
429
450
|
function encodeQueryString(query, params = {}, options = {}) {
|
|
430
451
|
let searchParams = new URLSearchParams();
|
|
431
452
|
searchParams.set("query", query);
|
|
432
|
-
for (let [key, value] of Object.entries(params)) searchParams.set(`$${key}`, JSON.stringify(value));
|
|
453
|
+
for (let [key, value] of Object.entries(params)) value !== void 0 && searchParams.set(`$${key}`, JSON.stringify(value));
|
|
433
454
|
for (let [key, value] of Object.entries(options)) value && searchParams.set(key, `${value}`);
|
|
434
455
|
return `?${searchParams}`;
|
|
435
456
|
}
|
|
@@ -452,11 +473,17 @@ function isPlainObject(obj) {
|
|
|
452
473
|
return !!obj && typeof obj == "object" && Object.prototype.toString.call(obj) === "[object Object]";
|
|
453
474
|
}
|
|
454
475
|
/** Every `localStorage` key Vision writes (classic and redesign alike) starts with this prefix */
|
|
455
|
-
const hasLocalStorage = supportsLocalStorage(), clearListeners = /* @__PURE__ */ new Set();
|
|
476
|
+
const VISION_STORAGE_KEY_PREFIX = "sanityVision:", hasLocalStorage = supportsLocalStorage(), clearListeners = /* @__PURE__ */ new Set();
|
|
456
477
|
/** The `localStorage` instance when it is available and writable, `undefined` otherwise */
|
|
457
478
|
function getStorage() {
|
|
458
479
|
return hasLocalStorage ? globalThis.localStorage : void 0;
|
|
459
480
|
}
|
|
481
|
+
/** Runs `listener` after `clearLocalStorage`, so in-memory copies of stored values can drop too */
|
|
482
|
+
function onLocalStorageCleared(listener) {
|
|
483
|
+
return clearListeners.add(listener), () => {
|
|
484
|
+
clearListeners.delete(listener);
|
|
485
|
+
};
|
|
486
|
+
}
|
|
460
487
|
function clearLocalStorage() {
|
|
461
488
|
let storage = getStorage();
|
|
462
489
|
if (storage) {
|
|
@@ -470,7 +497,7 @@ function clearLocalStorage() {
|
|
|
470
497
|
clearListeners.forEach((listener) => listener());
|
|
471
498
|
}
|
|
472
499
|
function getLocalStorage(namespace) {
|
|
473
|
-
let storageKey =
|
|
500
|
+
let storageKey = `${VISION_STORAGE_KEY_PREFIX}${namespace}`, loadedState = null;
|
|
474
501
|
return {
|
|
475
502
|
get,
|
|
476
503
|
set,
|
|
@@ -536,7 +563,52 @@ function validateApiVersion(apiVersion) {
|
|
|
536
563
|
* paste handler has always picked the URL out of the pasted text with it. `parseQueryUrl` is
|
|
537
564
|
* stricter and takes the whole text to be the URL.
|
|
538
565
|
*/
|
|
539
|
-
const SANITY_QUERY_URL = /\/(vX|v1|v\d{4}-\d\d-\d\d)\/.*?(?:query|listen)\/(.*?)\?(.*)
|
|
566
|
+
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)$/;
|
|
567
|
+
/** `<project>.apicdn.sanity.io`, where `useCdn` sends queries */
|
|
568
|
+
function isApiCdnHost(hostname) {
|
|
569
|
+
return API_CDN_HOST.test(hostname);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Parses a Content Lake query (or listen) URL, as pasted from the browser's network tab, into the
|
|
573
|
+
* pieces of a tab. Returns `null` when the text is not such a URL: the whole text has to be one
|
|
574
|
+
* http(s) URL, since a query URL quoted inside other text is not a paste of that URL, and the
|
|
575
|
+
* redesign claims a paste it parses and replaces the tab's query with it.
|
|
576
|
+
*/
|
|
577
|
+
function parseQueryUrl(data, datasets) {
|
|
578
|
+
let trimmed = data.trim(), url = parseHttpUrl(trimmed), match = url?.pathname.match(QUERY_URL_PATHNAME);
|
|
579
|
+
if (!url || !match) return null;
|
|
580
|
+
let [, usedApiVersion, usedDataset] = match, parts;
|
|
581
|
+
try {
|
|
582
|
+
parts = parseApiQueryString(url.searchParams);
|
|
583
|
+
} catch {
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
if (!parts.query) return null;
|
|
587
|
+
let urlPerspective = parts.options.perspective, perspective = urlPerspective && isSupportedPerspective(urlPerspective) && !isVirtualPerspective(urlPerspective) ? urlPerspective : void 0, { resultSourceMap } = parts.options, includeSourceMap = resultSourceMap === "true" || resultSourceMap === "withKeyArraySelector";
|
|
588
|
+
return {
|
|
589
|
+
query: parts.query,
|
|
590
|
+
params: parts.params,
|
|
591
|
+
rawParams: JSON.stringify(parts.params, null, 2),
|
|
592
|
+
dataset: usedDataset,
|
|
593
|
+
isKnownDataset: datasets.includes(usedDataset),
|
|
594
|
+
apiVersion: validateApiVersion(usedApiVersion) ? usedApiVersion : void 0,
|
|
595
|
+
urlPerspective: urlPerspective || void 0,
|
|
596
|
+
perspective,
|
|
597
|
+
hasUnsupportedPerspective: !!urlPerspective && perspective === void 0,
|
|
598
|
+
variant: parts.options.variant || void 0,
|
|
599
|
+
includeSourceMap,
|
|
600
|
+
useCdn: isApiCdnHost(url.hostname),
|
|
601
|
+
url: trimmed
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
function parseHttpUrl(text) {
|
|
605
|
+
try {
|
|
606
|
+
let url = new URL(text);
|
|
607
|
+
return url.protocol === "http:" || url.protocol === "https:" ? url : null;
|
|
608
|
+
} catch {
|
|
609
|
+
return null;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
540
612
|
function tryParseParams(val, t) {
|
|
541
613
|
try {
|
|
542
614
|
let parsed = val ? JSON5.parse(val) : {};
|
|
@@ -545,7 +617,7 @@ function tryParseParams(val, t) {
|
|
|
545
617
|
return err.message = `${t("params.error.params-invalid-json")}:\n\n${err.message.replace("JSON5:", "")}`, err;
|
|
546
618
|
}
|
|
547
619
|
}
|
|
548
|
-
const _key3 = "
|
|
620
|
+
const _key3 = "JLqkdW_inputBackgroundContainer", _key10 = "JLqkdW_resultContainer";
|
|
549
621
|
function Root(t0) {
|
|
550
622
|
let $ = c(6), props, ref;
|
|
551
623
|
$[0] === t0 ? (props = $[1], ref = $[2]) : ({ref, ...props} = t0, $[0] = t0, $[1] = props, $[2] = ref);
|
|
@@ -553,28 +625,28 @@ function Root(t0) {
|
|
|
553
625
|
return $[3] !== props || $[4] !== ref ? (t1 = /* @__PURE__ */ jsx(Flex, {
|
|
554
626
|
...props,
|
|
555
627
|
ref,
|
|
556
|
-
className: "
|
|
628
|
+
className: "JLqkdW_root"
|
|
557
629
|
}), $[3] = props, $[4] = ref, $[5] = t1) : t1 = $[5], t1;
|
|
558
630
|
}
|
|
559
631
|
function Header(props) {
|
|
560
632
|
let $ = c(2), t0;
|
|
561
633
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
562
634
|
...props,
|
|
563
|
-
className: "
|
|
635
|
+
className: "JLqkdW_header"
|
|
564
636
|
}), $[0] = props, $[1] = t0), t0;
|
|
565
637
|
}
|
|
566
638
|
function StyledLabel(props) {
|
|
567
639
|
let $ = c(2), t0;
|
|
568
640
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Label, {
|
|
569
641
|
...props,
|
|
570
|
-
className: "
|
|
642
|
+
className: "JLqkdW_styledLabel"
|
|
571
643
|
}), $[0] = props, $[1] = t0), t0;
|
|
572
644
|
}
|
|
573
645
|
function SplitpaneContainer(props) {
|
|
574
646
|
let $ = c(2), t0;
|
|
575
647
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
576
648
|
...props,
|
|
577
|
-
className: "
|
|
649
|
+
className: "JLqkdW_splitpaneContainer"
|
|
578
650
|
}), $[0] = props, $[1] = t0), t0;
|
|
579
651
|
}
|
|
580
652
|
function QueryRecallPaneContainer(props) {
|
|
@@ -582,7 +654,7 @@ function QueryRecallPaneContainer(props) {
|
|
|
582
654
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Flex, {
|
|
583
655
|
...props,
|
|
584
656
|
flexDirection: "column",
|
|
585
|
-
className: "
|
|
657
|
+
className: "JLqkdW_queryRecallPaneContainer"
|
|
586
658
|
}), $[0] = props, $[1] = t0), t0;
|
|
587
659
|
}
|
|
588
660
|
function QueryRecallPaneWrapper(props) {
|
|
@@ -593,14 +665,14 @@ function QueryRecallPaneWrapper(props) {
|
|
|
593
665
|
flexBasis: "0%",
|
|
594
666
|
flexGrow: 1,
|
|
595
667
|
overflow: "hidden",
|
|
596
|
-
className: "
|
|
668
|
+
className: "JLqkdW_queryRecallPaneWrapper"
|
|
597
669
|
}), $[0] = props, $[1] = t0), t0;
|
|
598
670
|
}
|
|
599
671
|
function QueryCopyLink(props) {
|
|
600
672
|
let $ = c(2), t0;
|
|
601
673
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx("a", {
|
|
602
674
|
...props,
|
|
603
|
-
className: "
|
|
675
|
+
className: "JLqkdW_queryCopyLink"
|
|
604
676
|
}), $[0] = props, $[1] = t0), t0;
|
|
605
677
|
}
|
|
606
678
|
function InputBackgroundContainer(props) {
|
|
@@ -614,34 +686,34 @@ function InputBackgroundContainerLeft(props) {
|
|
|
614
686
|
let $ = c(2), t0;
|
|
615
687
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
616
688
|
...props,
|
|
617
|
-
className: `${_key3}
|
|
689
|
+
className: `${_key3} JLqkdW_inputBackgroundContainerLeft`
|
|
618
690
|
}), $[0] = props, $[1] = t0), t0;
|
|
619
691
|
}
|
|
620
692
|
function InputContainer(props) {
|
|
621
693
|
let $ = c(2), t0;
|
|
622
694
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
623
695
|
...props,
|
|
624
|
-
className: "
|
|
696
|
+
className: "JLqkdW_inputContainer"
|
|
625
697
|
}), $[0] = props, $[1] = t0), t0;
|
|
626
698
|
}
|
|
627
699
|
function ResultOuterContainer(props) {
|
|
628
700
|
let $ = c(2), t0;
|
|
629
701
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Flex, {
|
|
630
702
|
...props,
|
|
631
|
-
className: "
|
|
703
|
+
className: "JLqkdW_resultOuterContainer"
|
|
632
704
|
}), $[0] = props, $[1] = t0), t0;
|
|
633
705
|
}
|
|
634
706
|
function ResultInnerContainer(props) {
|
|
635
707
|
let $ = c(2), t0;
|
|
636
708
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
637
709
|
...props,
|
|
638
|
-
className: "
|
|
710
|
+
className: "JLqkdW_resultInnerContainer"
|
|
639
711
|
}), $[0] = props, $[1] = t0), t0;
|
|
640
712
|
}
|
|
641
713
|
function ResultContainer(t0) {
|
|
642
714
|
let $ = c(6), isInvalid, props;
|
|
643
715
|
$[0] === t0 ? (isInvalid = $[1], props = $[2]) : ({isInvalid, ...props} = t0, $[0] = t0, $[1] = isInvalid, $[2] = props);
|
|
644
|
-
let t1 = isInvalid ? `${_key10}
|
|
716
|
+
let t1 = isInvalid ? `${_key10} JLqkdW_resultContainerInvalid` : _key10, t2;
|
|
645
717
|
return $[3] !== props || $[4] !== t1 ? (t2 = /* @__PURE__ */ jsx(Card, {
|
|
646
718
|
...props,
|
|
647
719
|
className: t1
|
|
@@ -651,21 +723,21 @@ function Result(props) {
|
|
|
651
723
|
let $ = c(2), t0;
|
|
652
724
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
653
725
|
...props,
|
|
654
|
-
className: "
|
|
726
|
+
className: "JLqkdW_result"
|
|
655
727
|
}), $[0] = props, $[1] = t0), t0;
|
|
656
728
|
}
|
|
657
729
|
function ResultFooter(props) {
|
|
658
730
|
let $ = c(2), t0;
|
|
659
731
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Flex, {
|
|
660
732
|
...props,
|
|
661
|
-
className: "
|
|
733
|
+
className: "JLqkdW_resultFooter"
|
|
662
734
|
}), $[0] = props, $[1] = t0), t0;
|
|
663
735
|
}
|
|
664
736
|
function TimingsCard(props) {
|
|
665
737
|
let $ = c(2), t0;
|
|
666
738
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
667
739
|
...props,
|
|
668
|
-
className: "
|
|
740
|
+
className: "JLqkdW_timingsCard"
|
|
669
741
|
}), $[0] = props, $[1] = t0), t0;
|
|
670
742
|
}
|
|
671
743
|
function TimingsTextContainer(props) {
|
|
@@ -676,7 +748,7 @@ function TimingsTextContainer(props) {
|
|
|
676
748
|
let style = t3, t4;
|
|
677
749
|
return $[4] !== props || $[5] !== style ? (t4 = /* @__PURE__ */ jsx(Flex, {
|
|
678
750
|
...props,
|
|
679
|
-
className: "
|
|
751
|
+
className: "JLqkdW_timingsTextContainer",
|
|
680
752
|
style
|
|
681
753
|
}), $[4] = props, $[5] = style, $[6] = t4) : t4 = $[6], t4;
|
|
682
754
|
}
|
|
@@ -684,7 +756,7 @@ function DownloadsCard(props) {
|
|
|
684
756
|
let $ = c(2), t0;
|
|
685
757
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Card, {
|
|
686
758
|
...props,
|
|
687
|
-
className: "
|
|
759
|
+
className: "JLqkdW_downloadsCard"
|
|
688
760
|
}), $[0] = props, $[1] = t0), t0;
|
|
689
761
|
}
|
|
690
762
|
function SaveResultLabel(props) {
|
|
@@ -695,19 +767,21 @@ function SaveResultLabel(props) {
|
|
|
695
767
|
let style = t2, t3;
|
|
696
768
|
return $[4] !== props || $[5] !== style ? (t3 = /* @__PURE__ */ jsx(Text, {
|
|
697
769
|
...props,
|
|
698
|
-
className: "
|
|
699
|
-
style
|
|
770
|
+
className: "JLqkdW_saveResultLabel",
|
|
771
|
+
style,
|
|
772
|
+
as: "div",
|
|
773
|
+
trim: !0
|
|
700
774
|
}), $[4] = props, $[5] = style, $[6] = t3) : t3 = $[6], t3;
|
|
701
775
|
}
|
|
702
776
|
function ControlsContainer(props) {
|
|
703
777
|
let $ = c(2), t0;
|
|
704
778
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
705
779
|
...props,
|
|
706
|
-
className: "
|
|
780
|
+
className: "JLqkdW_controlsContainer"
|
|
707
781
|
}), $[0] = props, $[1] = t0), t0;
|
|
708
782
|
}
|
|
709
783
|
function ParamsEditor(props) {
|
|
710
|
-
let $ = c(
|
|
784
|
+
let $ = c(22), { onChange, paramsError, hasValidParams, editorRef } = props, { t } = useTranslation(visionLocaleNamespace), t0;
|
|
711
785
|
$[0] === onChange ? t0 = $[1] : (t0 = (newValue) => {
|
|
712
786
|
onChange(newValue);
|
|
713
787
|
}, $[0] = onChange, $[1] = t0);
|
|
@@ -721,36 +795,43 @@ function ParamsEditor(props) {
|
|
|
721
795
|
children: t3
|
|
722
796
|
}), $[6] = t3, $[7] = t4);
|
|
723
797
|
let t5;
|
|
724
|
-
$[8]
|
|
798
|
+
$[8] !== hasValidParams || $[9] !== paramsError ? (t5 = paramsError && /* @__PURE__ */ jsx(Tooltip, {
|
|
725
799
|
animate: !0,
|
|
726
800
|
placement: "top",
|
|
727
801
|
portal: !0,
|
|
728
802
|
content: /* @__PURE__ */ jsx(Text, {
|
|
729
803
|
size: 1,
|
|
804
|
+
as: "div",
|
|
805
|
+
trim: !0,
|
|
730
806
|
children: paramsError
|
|
731
807
|
}),
|
|
732
808
|
children: /* @__PURE__ */ jsx(Box, {
|
|
733
809
|
padding: 1,
|
|
734
810
|
marginX: 2,
|
|
735
|
-
children: /* @__PURE__ */ jsx(
|
|
811
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
812
|
+
icon: ErrorOutlineIcon,
|
|
813
|
+
muted: !0,
|
|
814
|
+
style: { margin: "-0.4375rem" },
|
|
815
|
+
tone: hasValidParams ? void 0 : "critical"
|
|
816
|
+
})
|
|
736
817
|
})
|
|
737
|
-
}), $[8] =
|
|
818
|
+
}), $[8] = hasValidParams, $[9] = paramsError, $[10] = t5) : t5 = $[10];
|
|
738
819
|
let t6;
|
|
739
|
-
$[
|
|
820
|
+
$[11] !== t4 || $[12] !== t5 ? (t6 = /* @__PURE__ */ jsx(InputBackgroundContainerLeft, { children: /* @__PURE__ */ jsxs(Flex, { children: [t4, t5] }) }), $[11] = t4, $[12] = t5, $[13] = t6) : t6 = $[13];
|
|
740
821
|
let t7 = props.value || "{\n \n}", t8;
|
|
741
|
-
$[
|
|
822
|
+
$[14] !== editorRef || $[15] !== handleChange || $[16] !== t7 ? (t8 = /* @__PURE__ */ jsx(VisionCodeMirror, {
|
|
742
823
|
ref: editorRef,
|
|
743
824
|
initialValue: t7,
|
|
744
825
|
onChange: handleChange,
|
|
745
826
|
extensions: paramsExtensions
|
|
746
|
-
}), $[
|
|
827
|
+
}), $[14] = editorRef, $[15] = handleChange, $[16] = t7, $[17] = t8) : t8 = $[17];
|
|
747
828
|
let t9;
|
|
748
|
-
return $[
|
|
829
|
+
return $[18] !== t2 || $[19] !== t6 || $[20] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Card, {
|
|
749
830
|
flex: 1,
|
|
750
831
|
tone: t2,
|
|
751
832
|
"data-testid": "params-editor",
|
|
752
833
|
children: [t6, t8]
|
|
753
|
-
}), $[
|
|
834
|
+
}), $[18] = t2, $[19] = t6, $[20] = t8, $[21] = t9) : t9 = $[21], t9;
|
|
754
835
|
}
|
|
755
836
|
function parseParams(value, t) {
|
|
756
837
|
let parsedParams = tryParseParams(value, t), params = parsedParams instanceof Error ? {} : parsedParams, validationError = parsedParams instanceof Error ? parsedParams.message : void 0;
|
|
@@ -869,7 +950,7 @@ function useSavedQueries() {
|
|
|
869
950
|
let run = () => task().finally(() => {
|
|
870
951
|
--pendingPersonalWritesRef.current;
|
|
871
952
|
}), result = personalWritesRef.current.then(run, run);
|
|
872
|
-
return personalWritesRef.current = result.catch(_temp$
|
|
953
|
+
return personalWritesRef.current = result.catch(_temp$6), result;
|
|
873
954
|
}, $[17] = t12) : t12 = $[17];
|
|
874
955
|
let enqueuePersonalWrite = t12, t13;
|
|
875
956
|
$[18] === Symbol.for("react.memo_cache_sentinel") ? (t13 = (before, attempted, kept) => {
|
|
@@ -1058,7 +1139,7 @@ function _temp3$3(count) {
|
|
|
1058
1139
|
function _temp2$4(a, b) {
|
|
1059
1140
|
return new Date(b.savedAt || 0).getTime() - new Date(a.savedAt || 0).getTime();
|
|
1060
1141
|
}
|
|
1061
|
-
function _temp$
|
|
1142
|
+
function _temp$6() {}
|
|
1062
1143
|
function FixedHeader(props) {
|
|
1063
1144
|
let $ = c(2), t0;
|
|
1064
1145
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(VStack, {
|
|
@@ -1416,7 +1497,7 @@ function QueryRecall(t0) {
|
|
|
1416
1497
|
}) : /* @__PURE__ */ jsx(Text, {
|
|
1417
1498
|
weight: "bold",
|
|
1418
1499
|
size: compactMode ? 2 : 3,
|
|
1419
|
-
|
|
1500
|
+
truncate: 1,
|
|
1420
1501
|
style: {
|
|
1421
1502
|
maxWidth: compactMode ? "180px" : "220px",
|
|
1422
1503
|
cursor: canMutateQuery ? "pointer" : "default",
|
|
@@ -1426,6 +1507,8 @@ function QueryRecall(t0) {
|
|
|
1426
1507
|
onClick: canMutateQuery ? () => {
|
|
1427
1508
|
setEditingKey(q_5._key), setEditingTitle(q_5.title || q_5._key.slice(0, 5));
|
|
1428
1509
|
} : void 0,
|
|
1510
|
+
as: "div",
|
|
1511
|
+
trim: !0,
|
|
1429
1512
|
children: optimisticTitles[q_5._key] || q_5.title || q_5._key.slice(q_5._key.length - 5, q_5._key.length)
|
|
1430
1513
|
}), isEdited && /* @__PURE__ */ jsx(Box, { style: {
|
|
1431
1514
|
width: "6px",
|
|
@@ -1549,6 +1632,8 @@ function QueryRecall(t0) {
|
|
|
1549
1632
|
}), /* @__PURE__ */ jsx(Text, {
|
|
1550
1633
|
size: 1,
|
|
1551
1634
|
muted: !0,
|
|
1635
|
+
as: "div",
|
|
1636
|
+
trim: !0,
|
|
1552
1637
|
children: formatDate.format(new Date(q_5.savedAt || ""))
|
|
1553
1638
|
})]
|
|
1554
1639
|
}) : /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -1594,11 +1679,15 @@ function QueryRecall(t0) {
|
|
|
1594
1679
|
/* @__PURE__ */ jsx(Text, {
|
|
1595
1680
|
size: 1,
|
|
1596
1681
|
muted: !0,
|
|
1682
|
+
as: "div",
|
|
1683
|
+
trim: !0,
|
|
1597
1684
|
children: "•"
|
|
1598
1685
|
}),
|
|
1599
1686
|
/* @__PURE__ */ jsx(Text, {
|
|
1600
1687
|
size: 1,
|
|
1601
1688
|
muted: !0,
|
|
1689
|
+
as: "div",
|
|
1690
|
+
trim: !0,
|
|
1602
1691
|
children: formatDate.format(new Date(q_5.savedAt || ""))
|
|
1603
1692
|
})
|
|
1604
1693
|
]
|
|
@@ -1663,6 +1752,8 @@ function QueryRecall(t0) {
|
|
|
1663
1752
|
padding: 4,
|
|
1664
1753
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1665
1754
|
size: 2,
|
|
1755
|
+
as: "div",
|
|
1756
|
+
trim: !0,
|
|
1666
1757
|
children: t("save-query.share-warning")
|
|
1667
1758
|
})
|
|
1668
1759
|
})
|
|
@@ -1688,7 +1779,7 @@ function calculatePaneSizeOptions(height) {
|
|
|
1688
1779
|
};
|
|
1689
1780
|
}
|
|
1690
1781
|
function usePaneSize(t0) {
|
|
1691
|
-
let $ = c(7), { visionRootRef } = t0, [rootSize, setRootSize] = useState(_temp$
|
|
1782
|
+
let $ = c(7), { visionRootRef } = t0, [rootSize, setRootSize] = useState(_temp$5), [isNarrowBreakpoint, setIsNarrowBreakpoint] = useState(_temp2$3), [paneSizeOptions, setPaneSizeOptions] = useState(_temp3$2), t1, t2;
|
|
1692
1783
|
$[0] === visionRootRef ? (t1 = $[1], t2 = $[2]) : (t1 = () => {
|
|
1693
1784
|
if (!visionRootRef.current) return;
|
|
1694
1785
|
let handleResize = (entries) => {
|
|
@@ -1715,7 +1806,7 @@ function _temp3$2() {
|
|
|
1715
1806
|
function _temp2$3() {
|
|
1716
1807
|
return narrowBreakpoint();
|
|
1717
1808
|
}
|
|
1718
|
-
function _temp$
|
|
1809
|
+
function _temp$5() {
|
|
1719
1810
|
return {
|
|
1720
1811
|
width: typeof window < "u" ? window.innerWidth : 1e3,
|
|
1721
1812
|
height: typeof window < "u" ? window.innerHeight : 800
|
|
@@ -1734,6 +1825,8 @@ function VisionGuiControls(t0) {
|
|
|
1734
1825
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1735
1826
|
size: 1,
|
|
1736
1827
|
muted: !0,
|
|
1828
|
+
as: "div",
|
|
1829
|
+
trim: !0,
|
|
1737
1830
|
children: t1
|
|
1738
1831
|
})
|
|
1739
1832
|
}), $[2] = t1, $[3] = t2);
|
|
@@ -1790,12 +1883,14 @@ function VisionGuiControls(t0) {
|
|
|
1790
1883
|
animate: !0,
|
|
1791
1884
|
content: /* @__PURE__ */ jsx(Text, {
|
|
1792
1885
|
size: 1,
|
|
1793
|
-
|
|
1886
|
+
as: "div",
|
|
1887
|
+
trim: !0,
|
|
1888
|
+
children: t("vision.redesign.try.description")
|
|
1794
1889
|
}),
|
|
1795
1890
|
placement: "top",
|
|
1796
1891
|
portal: !0,
|
|
1797
1892
|
children: /* @__PURE__ */ jsx(Button, {
|
|
1798
|
-
"aria-label": t("
|
|
1893
|
+
"aria-label": t("vision.redesign.try"),
|
|
1799
1894
|
"data-testid": "vision-try-redesign",
|
|
1800
1895
|
icon: RocketIcon,
|
|
1801
1896
|
mode: "bleed",
|
|
@@ -1832,26 +1927,26 @@ function PerspectivePopoverContent(props) {
|
|
|
1832
1927
|
let $ = c(2), t0;
|
|
1833
1928
|
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, {
|
|
1834
1929
|
...props,
|
|
1835
|
-
className: "
|
|
1930
|
+
className: "_yLaVW_perspectivePopoverContent"
|
|
1836
1931
|
}), $[0] = props, $[1] = t0), t0;
|
|
1837
1932
|
}
|
|
1838
1933
|
function PerspectivePopoverLink(props) {
|
|
1839
1934
|
let $ = c(2), t0;
|
|
1840
|
-
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(
|
|
1935
|
+
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Link, {
|
|
1841
1936
|
...props,
|
|
1842
|
-
className: "
|
|
1937
|
+
className: "_yLaVW_perspectivePopoverLink"
|
|
1843
1938
|
}), $[0] = props, $[1] = t0), t0;
|
|
1844
1939
|
}
|
|
1845
1940
|
function Dot(t0) {
|
|
1846
1941
|
let $ = c(2), { tone } = t0, t1 = `var(--card-badge-${tone}-dot-color)`, t2;
|
|
1847
1942
|
return $[0] === t1 ? t2 = $[1] : (t2 = /* @__PURE__ */ jsx("div", {
|
|
1848
|
-
className: "
|
|
1943
|
+
className: "_yLaVW_dot",
|
|
1849
1944
|
style: { backgroundColor: t1 }
|
|
1850
1945
|
}), $[0] = t1, $[1] = t2), t2;
|
|
1851
1946
|
}
|
|
1852
1947
|
function PerspectivePopover() {
|
|
1853
1948
|
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$
|
|
1949
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setOpen(_temp$4), $[0] = t0) : t0 = $[0];
|
|
1855
1950
|
let handleClick = t0, { t } = useTranslation(visionLocaleNamespace), t1, t2;
|
|
1856
1951
|
$[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
1952
|
let t3;
|
|
@@ -1861,6 +1956,8 @@ function PerspectivePopover() {
|
|
|
1861
1956
|
gap: 2,
|
|
1862
1957
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1863
1958
|
weight: "medium",
|
|
1959
|
+
as: "div",
|
|
1960
|
+
trim: !0,
|
|
1864
1961
|
children: t3
|
|
1865
1962
|
})
|
|
1866
1963
|
}), $[5] = t3, $[6] = t4);
|
|
@@ -1869,6 +1966,8 @@ function PerspectivePopover() {
|
|
|
1869
1966
|
let t6;
|
|
1870
1967
|
$[9] === t5 ? t6 = $[10] : (t6 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Text, {
|
|
1871
1968
|
muted: !0,
|
|
1969
|
+
as: "div",
|
|
1970
|
+
trim: !0,
|
|
1872
1971
|
children: t5
|
|
1873
1972
|
}) }), $[9] = t5, $[10] = t6);
|
|
1874
1973
|
let t7;
|
|
@@ -1881,6 +1980,8 @@ function PerspectivePopover() {
|
|
|
1881
1980
|
let t9;
|
|
1882
1981
|
$[15] === t ? t9 = $[16] : (t9 = /* @__PURE__ */ jsx(Text, {
|
|
1883
1982
|
muted: !0,
|
|
1983
|
+
as: "div",
|
|
1984
|
+
trim: !0,
|
|
1884
1985
|
children: /* @__PURE__ */ jsx(Translate, {
|
|
1885
1986
|
t,
|
|
1886
1987
|
i18nKey: "settings.perspective.preview-drafts-renamed-to-drafts.description"
|
|
@@ -1896,12 +1997,16 @@ function PerspectivePopover() {
|
|
|
1896
1997
|
let t12;
|
|
1897
1998
|
$[22] === t ? t12 = $[23] : (t12 = t("settings.perspectives.action.docs-link"), $[22] = t, $[23] = t12);
|
|
1898
1999
|
let t13;
|
|
1899
|
-
$[24] === t12 ? t13 = $[25] : (t13 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Text, {
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
2000
|
+
$[24] === t12 ? t13 = $[25] : (t13 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Text, {
|
|
2001
|
+
as: "div",
|
|
2002
|
+
trim: !0,
|
|
2003
|
+
children: /* @__PURE__ */ jsxs(PerspectivePopoverLink, {
|
|
2004
|
+
href: "https://www.sanity.io/docs/perspectives",
|
|
2005
|
+
openInNewTab: !0,
|
|
2006
|
+
underlined: !1,
|
|
2007
|
+
children: [t12, " →"]
|
|
2008
|
+
})
|
|
2009
|
+
}) }), $[24] = t12, $[25] = t13);
|
|
1905
2010
|
let t14;
|
|
1906
2011
|
$[26] !== t10 || $[27] !== t11 || $[28] !== t13 || $[29] !== t4 || $[30] !== t6 ? (t14 = /* @__PURE__ */ jsx(PerspectivePopoverContent, { children: /* @__PURE__ */ jsxs(VStack, {
|
|
1907
2012
|
gap: 4,
|
|
@@ -1940,7 +2045,7 @@ function PerspectivePopover() {
|
|
|
1940
2045
|
children: t16
|
|
1941
2046
|
}), $[35] = open, $[36] = t14, $[37] = t16, $[38] = t17) : t17 = $[38], t17;
|
|
1942
2047
|
}
|
|
1943
|
-
function _temp$
|
|
2048
|
+
function _temp$4(o) {
|
|
1944
2049
|
return !o;
|
|
1945
2050
|
}
|
|
1946
2051
|
const PinnedReleasePerspectiveOption = (t0) => {
|
|
@@ -1951,7 +2056,7 @@ const PinnedReleasePerspectiveOption = (t0) => {
|
|
|
1951
2056
|
name,
|
|
1952
2057
|
t2,
|
|
1953
2058
|
label
|
|
1954
|
-
].filter(_temp$
|
|
2059
|
+
].filter(_temp$3), $[3] = label, $[4] = name, $[5] = t2, $[6] = t3) : t3 = $[6];
|
|
1955
2060
|
let text = t3.join(" "), t4;
|
|
1956
2061
|
$[7] === pinnedPerspective ? t4 = $[8] : (t4 = hasPinnedPerspective(pinnedPerspective), $[7] = pinnedPerspective, $[8] = t4);
|
|
1957
2062
|
let t5 = !t4, t6;
|
|
@@ -2022,6 +2127,8 @@ function VisionGuiHeader(t0) {
|
|
|
2022
2127
|
let t15;
|
|
2023
2128
|
$[29] === t14 ? t15 = $[30] : (t15 = /* @__PURE__ */ jsx(Text, {
|
|
2024
2129
|
size: 1,
|
|
2130
|
+
as: "div",
|
|
2131
|
+
trim: !0,
|
|
2025
2132
|
children: t14
|
|
2026
2133
|
}), $[29] = t14, $[30] = t15);
|
|
2027
2134
|
let t16 = !isApiVersionLocked, t17 = customApiVersion === !1 ? apiVersion : "other", t18;
|
|
@@ -2199,7 +2306,7 @@ function _temp3$1(version) {
|
|
|
2199
2306
|
function _temp2$2(ds) {
|
|
2200
2307
|
return /* @__PURE__ */ jsx("option", { children: ds }, ds);
|
|
2201
2308
|
}
|
|
2202
|
-
function _temp$
|
|
2309
|
+
function _temp$3(value) {
|
|
2203
2310
|
return value !== void 0;
|
|
2204
2311
|
}
|
|
2205
2312
|
function getBlobUrl(content, mimeType) {
|
|
@@ -2223,6 +2330,14 @@ function getMemoizedBlobUrlResolver(mimeType, stringEncoder) {
|
|
|
2223
2330
|
})();
|
|
2224
2331
|
}
|
|
2225
2332
|
const getJsonBlobUrl = getMemoizedBlobUrlResolver("application/json", (input) => JSON.stringify(input, null, 2)), getCsvBlobUrl = getMemoizedBlobUrlResolver("text/csv", (input) => json2csv(Array.isArray(input) ? input : [input]).trim());
|
|
2333
|
+
/**
|
|
2334
|
+
* Whether `getCsvBlobUrl` can produce anything for a result: `json2csv` yields nothing unless at
|
|
2335
|
+
* least one item is an object. A look at the shape, so a download button can be disabled without
|
|
2336
|
+
* converting a result nobody asked to download.
|
|
2337
|
+
*/
|
|
2338
|
+
function canEncodeCsv(input) {
|
|
2339
|
+
return (Array.isArray(input) ? input : [input]).some((item) => typeof item == "object" && !!item && !Array.isArray(item));
|
|
2340
|
+
}
|
|
2226
2341
|
function DelayedSpinner(props) {
|
|
2227
2342
|
let $ = c(5), [show, setShow] = useState(!1), t0, t1;
|
|
2228
2343
|
$[0] === props.delay ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
|
|
@@ -2346,6 +2461,8 @@ function QueryErrorDialog(props) {
|
|
|
2346
2461
|
T0 = Flex, t0 = 5, t1 = 2, t2 = "column", t3 = unsatisfiedCapability ? /* @__PURE__ */ jsx(Text, {
|
|
2347
2462
|
"data-testid": "query-error-api-version-capability-hint",
|
|
2348
2463
|
size: 1,
|
|
2464
|
+
as: "div",
|
|
2465
|
+
trim: !0,
|
|
2349
2466
|
children: t(unsatisfiedCapability.explanationKey, { apiVersion: prefixApiVersion(unsatisfiedCapability.requiredApiVersion) })
|
|
2350
2467
|
}) : null, $[0] = apiVersion, $[1] = error, $[2] = perspective, $[3] = t, $[4] = variant, $[5] = T0, $[6] = t0, $[7] = t1, $[8] = t2, $[9] = t3;
|
|
2351
2468
|
} else T0 = $[5], t0 = $[6], t1 = $[7], t2 = $[8], t3 = $[9];
|
|
@@ -2368,6 +2485,10 @@ function QueryErrorDialog(props) {
|
|
|
2368
2485
|
]
|
|
2369
2486
|
}), $[14] = T0, $[15] = t0, $[16] = t1, $[17] = t2, $[18] = t3, $[19] = t4, $[20] = t5, $[21] = t6) : t6 = $[21], t6;
|
|
2370
2487
|
}
|
|
2488
|
+
/** A dotted key path written the way it reads in code: `0.author.tags.1` as `[0].author.tags[1]` */
|
|
2489
|
+
function describeKeypath(keypath) {
|
|
2490
|
+
return keypath.split(".").map((segment, index) => /^\d+$/.test(segment) ? `[${segment}]` : index === 0 ? segment : `.${segment}`).join("");
|
|
2491
|
+
}
|
|
2371
2492
|
/**
|
|
2372
2493
|
* The value at one of `@rexxars/react-json-inspector`'s dotted key paths (`0.author.name`; empty
|
|
2373
2494
|
* for the root). A key may contain dots itself, so at each step the longest run of segments that
|
|
@@ -2640,6 +2761,8 @@ function VisionGuiResult(t0) {
|
|
|
2640
2761
|
$[42] !== t19 || $[43] !== t20 || $[44] !== t21 ? (t22 = /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, {
|
|
2641
2762
|
muted: !0,
|
|
2642
2763
|
size: t19,
|
|
2764
|
+
as: "div",
|
|
2765
|
+
trim: !0,
|
|
2643
2766
|
children: [
|
|
2644
2767
|
t20,
|
|
2645
2768
|
":",
|
|
@@ -2655,6 +2778,8 @@ function VisionGuiResult(t0) {
|
|
|
2655
2778
|
$[51] !== t24 || $[52] !== t25 || $[53] !== t26 ? (t27 = /* @__PURE__ */ jsxs(Text, {
|
|
2656
2779
|
muted: !0,
|
|
2657
2780
|
size: t24,
|
|
2781
|
+
as: "div",
|
|
2782
|
+
trim: !0,
|
|
2658
2783
|
children: [
|
|
2659
2784
|
t25,
|
|
2660
2785
|
":",
|
|
@@ -2769,7 +2894,7 @@ function VisionGui(props) {
|
|
|
2769
2894
|
}
|
|
2770
2895
|
let t17;
|
|
2771
2896
|
if ($[35] !== isDraftModelEnabled || $[36] !== releases) {
|
|
2772
|
-
let scheduledDraftReleases = releases.filter(_temp$
|
|
2897
|
+
let scheduledDraftReleases = releases.filter(_temp$2), releaseIds = sortReleases(scheduledDraftReleases).map(_temp2$1), t18;
|
|
2773
2898
|
$[38] === isDraftModelEnabled ? t18 = $[39] : (t18 = isDraftModelEnabled ? ["drafts"] : ["published"], $[38] = isDraftModelEnabled, $[39] = t18);
|
|
2774
2899
|
let defaultPerspective = t18;
|
|
2775
2900
|
t17 = [...releaseIds, ...defaultPerspective], $[35] = isDraftModelEnabled, $[36] = releases, $[37] = t17;
|
|
@@ -3166,7 +3291,7 @@ function VisionGui(props) {
|
|
|
3166
3291
|
function _temp2$1(release_0) {
|
|
3167
3292
|
return getReleaseIdFromReleaseDocumentId(release_0._id);
|
|
3168
3293
|
}
|
|
3169
|
-
function _temp$
|
|
3294
|
+
function _temp$2(release) {
|
|
3170
3295
|
return isCardinalityOneRelease(release) && release.state === "scheduled";
|
|
3171
3296
|
}
|
|
3172
3297
|
function useDatasets(t0) {
|
|
@@ -3180,7 +3305,7 @@ function useDatasets(t0) {
|
|
|
3180
3305
|
let t2;
|
|
3181
3306
|
if ($[2] !== client.observable.datasets || $[3] !== configDatasets) {
|
|
3182
3307
|
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;
|
|
3308
|
+
$[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
3309
|
} else t2 = $[4];
|
|
3185
3310
|
t1 = t2;
|
|
3186
3311
|
}
|
|
@@ -3192,7 +3317,7 @@ function _temp3(err) {
|
|
|
3192
3317
|
function _temp2(ds) {
|
|
3193
3318
|
return ds.name;
|
|
3194
3319
|
}
|
|
3195
|
-
function _temp(d) {
|
|
3320
|
+
function _temp$1(d) {
|
|
3196
3321
|
return d.name;
|
|
3197
3322
|
}
|
|
3198
3323
|
function VisionContainer(props) {
|
|
@@ -3300,8 +3425,175 @@ var VisionErrorBoundary = class extends Component {
|
|
|
3300
3425
|
});
|
|
3301
3426
|
}
|
|
3302
3427
|
};
|
|
3428
|
+
const TOAST_ID = "vision-redesign-invitation";
|
|
3429
|
+
/**
|
|
3430
|
+
* The toast's body. It renders in the studio's toast layer, which can sit outside the locale
|
|
3431
|
+
* provider that has Vision's strings, so it is handed them translated
|
|
3432
|
+
*/
|
|
3433
|
+
function RedesignToastActions(props) {
|
|
3434
|
+
let $ = c(14), { description, acceptLabel, dismissLabel, onAccept, onDismiss } = props, t0;
|
|
3435
|
+
$[0] === description ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Text, {
|
|
3436
|
+
size: 1,
|
|
3437
|
+
as: "div",
|
|
3438
|
+
trim: !0,
|
|
3439
|
+
children: description
|
|
3440
|
+
}), $[0] = description, $[1] = t0);
|
|
3441
|
+
let t1;
|
|
3442
|
+
$[2] !== acceptLabel || $[3] !== onAccept ? (t1 = /* @__PURE__ */ jsx(Button, {
|
|
3443
|
+
"data-testid": "vision-redesign-accept",
|
|
3444
|
+
fontSize: 1,
|
|
3445
|
+
onClick: onAccept,
|
|
3446
|
+
padding: 2,
|
|
3447
|
+
text: acceptLabel,
|
|
3448
|
+
tone: "primary"
|
|
3449
|
+
}), $[2] = acceptLabel, $[3] = onAccept, $[4] = t1) : t1 = $[4];
|
|
3450
|
+
let t2;
|
|
3451
|
+
$[5] !== dismissLabel || $[6] !== onDismiss ? (t2 = /* @__PURE__ */ jsx(Button, {
|
|
3452
|
+
"data-testid": "vision-redesign-dismiss",
|
|
3453
|
+
fontSize: 1,
|
|
3454
|
+
mode: "bleed",
|
|
3455
|
+
onClick: onDismiss,
|
|
3456
|
+
padding: 2,
|
|
3457
|
+
text: dismissLabel
|
|
3458
|
+
}), $[5] = dismissLabel, $[6] = onDismiss, $[7] = t2) : t2 = $[7];
|
|
3459
|
+
let t3;
|
|
3460
|
+
$[8] !== t1 || $[9] !== t2 ? (t3 = /* @__PURE__ */ jsxs(Flex, {
|
|
3461
|
+
gap: 2,
|
|
3462
|
+
children: [t1, t2]
|
|
3463
|
+
}), $[8] = t1, $[9] = t2, $[10] = t3) : t3 = $[10];
|
|
3464
|
+
let t4;
|
|
3465
|
+
return $[11] !== t0 || $[12] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Stack, {
|
|
3466
|
+
gap: 3,
|
|
3467
|
+
paddingTop: 1,
|
|
3468
|
+
children: [t0, t3]
|
|
3469
|
+
}), $[11] = t0, $[12] = t3, $[13] = t4) : t4 = $[13], t4;
|
|
3470
|
+
}
|
|
3471
|
+
/**
|
|
3472
|
+
* Invites the user to try the redesigned Vision. Renders nothing itself: it pushes a persistent
|
|
3473
|
+
* toast while mounted and removes it again on unmount, so it disappears as soon as the user opts
|
|
3474
|
+
* in or leaves the tool.
|
|
3475
|
+
*/
|
|
3476
|
+
function RedesignToast(t0) {
|
|
3477
|
+
let $ = c(8), { onAccept, onDismiss } = t0, toast = useToast(), { t } = useTranslation(visionLocaleNamespace), accept = useEffectEvent(onAccept), dismiss = useEffectEvent(onDismiss), t1;
|
|
3478
|
+
$[0] !== accept || $[1] !== dismiss || $[2] !== t || $[3] !== toast ? (t1 = () => {
|
|
3479
|
+
let remove = () => {
|
|
3480
|
+
toast.push({
|
|
3481
|
+
id: TOAST_ID,
|
|
3482
|
+
duration: .01
|
|
3483
|
+
});
|
|
3484
|
+
};
|
|
3485
|
+
return toast.push({
|
|
3486
|
+
id: TOAST_ID,
|
|
3487
|
+
closable: !1,
|
|
3488
|
+
duration: Infinity,
|
|
3489
|
+
status: "info",
|
|
3490
|
+
title: t("vision.redesign.toast.title"),
|
|
3491
|
+
description: /* @__PURE__ */ jsx(RedesignToastActions, {
|
|
3492
|
+
acceptLabel: t("vision.redesign.toast.accept"),
|
|
3493
|
+
description: t("vision.redesign.toast.description"),
|
|
3494
|
+
dismissLabel: t("vision.redesign.toast.dismiss"),
|
|
3495
|
+
onAccept: () => {
|
|
3496
|
+
remove(), accept();
|
|
3497
|
+
},
|
|
3498
|
+
onDismiss: () => {
|
|
3499
|
+
remove(), dismiss();
|
|
3500
|
+
}
|
|
3501
|
+
})
|
|
3502
|
+
}), remove;
|
|
3503
|
+
}, $[0] = accept, $[1] = dismiss, $[2] = t, $[3] = toast, $[4] = t1) : t1 = $[4];
|
|
3504
|
+
let t2;
|
|
3505
|
+
return $[5] !== t || $[6] !== toast ? (t2 = [t, toast], $[5] = t, $[6] = toast, $[7] = t2) : t2 = $[7], useEffect(t1, t2), null;
|
|
3506
|
+
}
|
|
3507
|
+
const DEFAULT_PREFERENCE = {
|
|
3508
|
+
optedIn: !1,
|
|
3509
|
+
dismissed: !1
|
|
3510
|
+
}, cache = /* @__PURE__ */ new Map(), listeners = /* @__PURE__ */ new Set();
|
|
3511
|
+
function storageKey(projectId) {
|
|
3512
|
+
return `${VISION_STORAGE_KEY_PREFIX}redesign:${projectId}`;
|
|
3513
|
+
}
|
|
3514
|
+
function notify() {
|
|
3515
|
+
listeners.forEach((listener) => listener());
|
|
3516
|
+
}
|
|
3517
|
+
function subscribe(listener) {
|
|
3518
|
+
listeners.add(listener);
|
|
3519
|
+
let unsubscribeClear = onLocalStorageCleared(() => {
|
|
3520
|
+
cache.clear(), listener();
|
|
3521
|
+
});
|
|
3522
|
+
return () => {
|
|
3523
|
+
listeners.delete(listener), unsubscribeClear();
|
|
3524
|
+
};
|
|
3525
|
+
}
|
|
3526
|
+
function parsePreference(raw) {
|
|
3527
|
+
if (raw === null) return DEFAULT_PREFERENCE;
|
|
3528
|
+
try {
|
|
3529
|
+
let stored = JSON.parse(raw);
|
|
3530
|
+
return isPlainObject(stored) ? {
|
|
3531
|
+
optedIn: stored.optedIn === !0,
|
|
3532
|
+
dismissed: stored.dismissed === !0
|
|
3533
|
+
} : DEFAULT_PREFERENCE;
|
|
3534
|
+
} catch {
|
|
3535
|
+
return DEFAULT_PREFERENCE;
|
|
3536
|
+
}
|
|
3537
|
+
}
|
|
3538
|
+
function readRedesignPreference(projectId) {
|
|
3539
|
+
let storage = getStorage(), cached = cache.get(projectId);
|
|
3540
|
+
if (!storage) return cached?.preference ?? DEFAULT_PREFERENCE;
|
|
3541
|
+
let raw = storage.getItem(storageKey(projectId));
|
|
3542
|
+
if (cached && cached.raw === raw) return cached.preference;
|
|
3543
|
+
let preference = parsePreference(raw);
|
|
3544
|
+
return cache.set(projectId, {
|
|
3545
|
+
raw,
|
|
3546
|
+
preference
|
|
3547
|
+
}), preference;
|
|
3548
|
+
}
|
|
3549
|
+
function writeRedesignPreference(projectId, patch) {
|
|
3550
|
+
let next = {
|
|
3551
|
+
...readRedesignPreference(projectId),
|
|
3552
|
+
...patch
|
|
3553
|
+
}, storage = getStorage(), raw = JSON.stringify(next);
|
|
3554
|
+
try {
|
|
3555
|
+
storage?.setItem(storageKey(projectId), raw);
|
|
3556
|
+
} catch {
|
|
3557
|
+
raw = storage?.getItem(storageKey(projectId)) ?? null;
|
|
3558
|
+
}
|
|
3559
|
+
return cache.set(projectId, {
|
|
3560
|
+
raw,
|
|
3561
|
+
preference: next
|
|
3562
|
+
}), notify(), next;
|
|
3563
|
+
}
|
|
3564
|
+
function useRedesignPreference(projectId) {
|
|
3565
|
+
let $ = c(2), t0;
|
|
3566
|
+
return $[0] === projectId ? t0 = $[1] : (t0 = () => readRedesignPreference(projectId), $[0] = projectId, $[1] = t0), useSyncExternalStore(subscribe, t0, _temp);
|
|
3567
|
+
}
|
|
3568
|
+
function _temp() {
|
|
3569
|
+
return DEFAULT_PREFERENCE;
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* A `lazy()` component whose failed import can be tried again. React keeps a rejected `lazy()`
|
|
3573
|
+
* for good, so `retry` (for the error boundary's Retry) swaps in a fresh one. The rejected one
|
|
3574
|
+
* stays until then: swapped as soon as the import fails, the Suspense boundary's next render
|
|
3575
|
+
* would start another import instead of surfacing the error, so a chunk that keeps failing
|
|
3576
|
+
* would be fetched over and over and never reach the error boundary.
|
|
3577
|
+
*/
|
|
3578
|
+
function createRetryableLazy(load) {
|
|
3579
|
+
let failed = !1, attempt = () => load().catch((error) => {
|
|
3580
|
+
throw failed = !0, error;
|
|
3581
|
+
}), LazyComponent = lazy(attempt);
|
|
3582
|
+
function RetryableLazy(props) {
|
|
3583
|
+
let $ = c(2), t0;
|
|
3584
|
+
return $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(LazyComponent, { ...props }), $[0] = props, $[1] = t0), t0;
|
|
3585
|
+
}
|
|
3586
|
+
return {
|
|
3587
|
+
Component: RetryableLazy,
|
|
3588
|
+
retry: () => {
|
|
3589
|
+
failed && (failed = !1, LazyComponent = lazy(attempt));
|
|
3590
|
+
}
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
var SanityVision_exports = /* @__PURE__ */ __exportAll({ default: () => SanityVision });
|
|
3594
|
+
const visionRedesign = createRetryableLazy(() => import("./VisionRedesign-e97UZ2aL.js").then((module) => ({ default: module.VisionRedesign }))), VisionRedesignLoader = visionRedesign.Component;
|
|
3303
3595
|
function SanityVision(props) {
|
|
3304
|
-
let $ = c(
|
|
3596
|
+
let $ = c(31), t0;
|
|
3305
3597
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "1" }, $[0] = t0) : t0 = $[0];
|
|
3306
3598
|
let client = useClient(t0), t1;
|
|
3307
3599
|
$[1] === props.tool.options ? t1 = $[2] : (t1 = {
|
|
@@ -3309,18 +3601,47 @@ function SanityVision(props) {
|
|
|
3309
3601
|
...props.tool.options
|
|
3310
3602
|
}, $[1] = props.tool.options, $[2] = t1);
|
|
3311
3603
|
let config = t1, t2;
|
|
3312
|
-
$[3]
|
|
3604
|
+
$[3] === client ? t2 = $[4] : (t2 = client.config().projectId || "default", $[3] = client, $[4] = t2);
|
|
3605
|
+
let projectId = t2, redesignEnabled = config.beta?.redesign?.enabled === !0, preference = useRedesignPreference(projectId), showRedesign = redesignEnabled && preference.optedIn, t3;
|
|
3606
|
+
$[5] === projectId ? t3 = $[6] : (t3 = () => writeRedesignPreference(projectId, {
|
|
3607
|
+
optedIn: !0,
|
|
3608
|
+
dismissed: !1
|
|
3609
|
+
}), $[5] = projectId, $[6] = t3);
|
|
3610
|
+
let optIn = t3, t4;
|
|
3611
|
+
$[7] === projectId ? t4 = $[8] : (t4 = () => writeRedesignPreference(projectId, { dismissed: !0 }), $[7] = projectId, $[8] = t4);
|
|
3612
|
+
let dismiss = t4, t5;
|
|
3613
|
+
$[9] === projectId ? t5 = $[10] : (t5 = () => writeRedesignPreference(projectId, {
|
|
3614
|
+
optedIn: !1,
|
|
3615
|
+
dismissed: !1
|
|
3616
|
+
}), $[9] = projectId, $[10] = t5);
|
|
3617
|
+
let switchToClassic = t5, t6;
|
|
3618
|
+
$[11] !== client || $[12] !== config || $[13] !== optIn || $[14] !== redesignEnabled || $[15] !== showRedesign || $[16] !== switchToClassic ? (t6 = (loaded) => showRedesign ? /* @__PURE__ */ jsx(VisionRedesignLoader, {
|
|
3619
|
+
...loaded,
|
|
3620
|
+
config,
|
|
3621
|
+
onSwitchToClassic: switchToClassic
|
|
3622
|
+
}) : /* @__PURE__ */ jsx(VisionGui, {
|
|
3313
3623
|
...loaded,
|
|
3314
3624
|
client,
|
|
3315
|
-
config
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3625
|
+
config,
|
|
3626
|
+
onSwitchToRedesign: redesignEnabled ? optIn : void 0
|
|
3627
|
+
}), $[11] = client, $[12] = config, $[13] = optIn, $[14] = redesignEnabled, $[15] = showRedesign, $[16] = switchToClassic, $[17] = t6) : t6 = $[17];
|
|
3628
|
+
let t7;
|
|
3629
|
+
$[18] !== client || $[19] !== config || $[20] !== t6 ? (t7 = /* @__PURE__ */ jsx(VisionContainer, {
|
|
3319
3630
|
client,
|
|
3320
3631
|
config,
|
|
3321
|
-
children:
|
|
3322
|
-
})
|
|
3632
|
+
children: t6
|
|
3633
|
+
}), $[18] = client, $[19] = config, $[20] = t6, $[21] = t7) : t7 = $[21];
|
|
3634
|
+
let t8;
|
|
3635
|
+
$[22] !== dismiss || $[23] !== optIn || $[24] !== preference || $[25] !== redesignEnabled || $[26] !== showRedesign ? (t8 = redesignEnabled && !showRedesign && !preference.dismissed && /* @__PURE__ */ jsx(RedesignToast, {
|
|
3636
|
+
onAccept: optIn,
|
|
3637
|
+
onDismiss: dismiss
|
|
3638
|
+
}), $[22] = dismiss, $[23] = optIn, $[24] = preference, $[25] = redesignEnabled, $[26] = showRedesign, $[27] = t8) : t8 = $[27];
|
|
3639
|
+
let t9;
|
|
3640
|
+
return $[28] !== t7 || $[29] !== t8 ? (t9 = /* @__PURE__ */ jsxs(VisionErrorBoundary, {
|
|
3641
|
+
onRetry: visionRedesign.retry,
|
|
3642
|
+
children: [t7, t8]
|
|
3643
|
+
}), $[28] = t7, $[29] = t8, $[30] = t9) : t9 = $[30], t9;
|
|
3323
3644
|
}
|
|
3324
|
-
export { SanityVision as default };
|
|
3645
|
+
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
3646
|
|
|
3326
|
-
//# sourceMappingURL=SanityVision-
|
|
3647
|
+
//# sourceMappingURL=SanityVision-DHgPjtr1.js.map
|