@sanity/vision 6.24.0-next.94 → 6.24.1-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CodeDiff-MkS3Q87A.js.map +1 -1
- package/lib/{SanityVision-DHgPjtr1.js → SanityVision-Byzvd4p6.js} +365 -373
- package/lib/SanityVision-Byzvd4p6.js.map +1 -0
- package/lib/{VisionRedesign-e97UZ2aL.js → VisionRedesign-Bbv4UYJV.js} +18 -18
- package/lib/VisionRedesign-Bbv4UYJV.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +12 -11
- package/lib/SanityVision-DHgPjtr1.js.map +0 -1
- package/lib/VisionRedesign-e97UZ2aL.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DEFAULT_API_VERSION, C as getActivePerspective, D as paramsExtensions, E as groqExtensions, M as prefixApiVersion, O as resultJsonExtensions, S as encodeQueryString, T as VisionCodeMirror, _ as VISION_STORAGE_KEY_PREFIX, a as getAtKeypath, b as isPlainObject, c as DelayedSpinner, d as getJsonBlobUrl, f as useSavedQueries, g as validateApiVersion, h as parseQueryUrl, i as describeKeypath, j as VARIANTS_API_VERSION, k as API_VERSIONS, l as canEncodeCsv, m as isApiCdnHost, n as createRetryableLazy, o as QueryErrorDialog, p as parseParams, r as ResultView, s as isApiVersionBelow, u as getCsvBlobUrl, v as getStorage, w as useVariantsEnabled, x as isVisionPasteTarget, y as onLocalStorageCleared } from "./SanityVision-
|
|
1
|
+
import { A as DEFAULT_API_VERSION, C as getActivePerspective, D as paramsExtensions, E as groqExtensions, M as prefixApiVersion, O as resultJsonExtensions, S as encodeQueryString, T as VisionCodeMirror, _ as VISION_STORAGE_KEY_PREFIX, a as getAtKeypath, b as isPlainObject, c as DelayedSpinner, d as getJsonBlobUrl, f as useSavedQueries, g as validateApiVersion, h as parseQueryUrl, i as describeKeypath, j as VARIANTS_API_VERSION, k as API_VERSIONS, l as canEncodeCsv, m as isApiCdnHost, n as createRetryableLazy, o as QueryErrorDialog, p as parseParams, r as ResultView, s as isApiVersionBelow, u as getCsvBlobUrl, v as getStorage, w as useVariantsEnabled, x as isVisionPasteTarget, y as onLocalStorageCleared } from "./SanityVision-Byzvd4p6.js";
|
|
2
2
|
import { t as visionLocaleNamespace } from "./i18n-CaGatdZX.js";
|
|
3
3
|
import { Component, Suspense, createContext, memo, use, useContext, useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { ContextMenuButton, InlineCode, UserAvatar, getDefaultVariant, getReleaseIdFromReleaseDocumentId, getVariantTitle, isCardinalityOneRelease, sortReleases, useActiveReleases, useClient, useDateTimeFormat, useNumberFormat, usePerspective, useProjectStore, useScheduledDraftsEnabled, useSchema, useTranslation, useWorkspace } from "sanity";
|
|
@@ -58,7 +58,7 @@ import { ChevronDownIcon } from "@sanity/icons/ChevronDown";
|
|
|
58
58
|
import { ChevronUpIcon } from "@sanity/icons/ChevronUp";
|
|
59
59
|
import { WarningOutlineIcon } from "@sanity/icons/WarningOutline";
|
|
60
60
|
import { SyncIcon } from "@sanity/icons/Sync";
|
|
61
|
-
import { evaluate, parse, typeEvaluate, unparse } from "groq-js";
|
|
61
|
+
import { evaluate as evaluate$1, parse, typeEvaluate, unparse } from "groq-js";
|
|
62
62
|
import { extractSchema } from "@sanity/schema/_internal";
|
|
63
63
|
import { CodeBlockIcon } from "@sanity/icons/CodeBlock";
|
|
64
64
|
import { EllipsisHorizontalIcon } from "@sanity/icons/EllipsisHorizontal";
|
|
@@ -3663,7 +3663,7 @@ const GROQ_FUNCTIONS = [
|
|
|
3663
3663
|
description: "Sorts an array by the expressions, each ascending unless followed by `desc`: `* | order(_createdAt desc)`.",
|
|
3664
3664
|
args: {
|
|
3665
3665
|
min: 1,
|
|
3666
|
-
max:
|
|
3666
|
+
max: 1e400
|
|
3667
3667
|
},
|
|
3668
3668
|
pipe: !0
|
|
3669
3669
|
},
|
|
@@ -3681,7 +3681,7 @@ const GROQ_FUNCTIONS = [
|
|
|
3681
3681
|
description: "Returns `true` when the document at the root of the current scope references the given document ID, or any of the IDs in an array.",
|
|
3682
3682
|
args: {
|
|
3683
3683
|
min: 1,
|
|
3684
|
-
max:
|
|
3684
|
+
max: 1e400
|
|
3685
3685
|
}
|
|
3686
3686
|
},
|
|
3687
3687
|
{
|
|
@@ -3701,7 +3701,7 @@ const GROQ_FUNCTIONS = [
|
|
|
3701
3701
|
description: "Gives every document a `_score` for the conditions it matches, to sort by with `| order(_score desc)`. Takes conditions and `boost()`, not other functions, references or subqueries.",
|
|
3702
3702
|
args: {
|
|
3703
3703
|
min: 1,
|
|
3704
|
-
max:
|
|
3704
|
+
max: 1e400
|
|
3705
3705
|
},
|
|
3706
3706
|
pipe: !0
|
|
3707
3707
|
},
|
|
@@ -4158,7 +4158,7 @@ function countArguments(count) {
|
|
|
4158
4158
|
return count === 1 ? "one argument" : `${count} arguments`;
|
|
4159
4159
|
}
|
|
4160
4160
|
function describeArity({ min, max }) {
|
|
4161
|
-
return min === max ? min === 0 ? "takes no arguments" : `takes ${countArguments(min)}` : max ===
|
|
4161
|
+
return min === max ? min === 0 ? "takes no arguments" : `takes ${countArguments(min)}` : max === 1e400 ? `takes at least ${countArguments(min)}` : `takes ${min} ${max === min + 1 ? "or" : "to"} ${max} arguments`;
|
|
4162
4162
|
}
|
|
4163
4163
|
function isInsideScore(node, query) {
|
|
4164
4164
|
for (let parent = node.parent; parent; parent = parent.parent) {
|
|
@@ -4891,7 +4891,7 @@ function applyFilter(shape, filter, outer, context) {
|
|
|
4891
4891
|
let inner = innerOf(filter);
|
|
4892
4892
|
if (isSlice(inner)) return inner.length === 1 || inner.length === 2 && inner[0].name !== "Number" ? itemOf(shape) : shape;
|
|
4893
4893
|
let scope = narrow(itemOf(shape), inner, context);
|
|
4894
|
-
return evaluate
|
|
4894
|
+
return evaluate(inner, scope, {
|
|
4895
4895
|
...context,
|
|
4896
4896
|
parents: [...context.parents, outer]
|
|
4897
4897
|
}), shape.kind === "array" ? {
|
|
@@ -4915,19 +4915,19 @@ function evaluateEntries(nodes, scope, context) {
|
|
|
4915
4915
|
let arrow = entry.findIndex((node) => node.name === "Arrow");
|
|
4916
4916
|
if (arrow !== -1) {
|
|
4917
4917
|
let condition = entry.slice(0, arrow);
|
|
4918
|
-
evaluate
|
|
4918
|
+
evaluate(condition, scope, context);
|
|
4919
4919
|
let narrowed = narrow(scope, condition, context), value = entry.slice(arrow + 1);
|
|
4920
|
-
value.length === 1 && value[0].name === "ObjectLiteral" ? evaluateEntries(innerOf(value[0]), narrowed, context) : evaluate
|
|
4920
|
+
value.length === 1 && value[0].name === "ObjectLiteral" ? evaluateEntries(innerOf(value[0]), narrowed, context) : evaluate(value, narrowed, context);
|
|
4921
4921
|
} else if (entry[0].name === "PropertyPair") {
|
|
4922
4922
|
let pair = childrenOf(entry[0]), colon = pair.findIndex((node) => node.name === ":");
|
|
4923
|
-
evaluate
|
|
4924
|
-
} else entry[0].name === "Spread" ? evaluate
|
|
4923
|
+
evaluate(pair.slice(colon + 1), scope, context);
|
|
4924
|
+
} else entry[0].name === "Spread" ? evaluate(entry.slice(1), scope, context) : evaluate(entry, scope, context);
|
|
4925
4925
|
}
|
|
4926
4926
|
}
|
|
4927
4927
|
/** A function's arguments, each read in the scope of the call */
|
|
4928
4928
|
function evaluateArguments(call, scope, context) {
|
|
4929
4929
|
let args = innerOf(call).filter((node) => node.name !== "FunctionName");
|
|
4930
|
-
for (let arg of splitBy(args, ",")) evaluate
|
|
4930
|
+
for (let arg of splitBy(args, ",")) evaluate(arg, scope, context);
|
|
4931
4931
|
}
|
|
4932
4932
|
/** A primary node followed by its postfix chain: `author->{name}`, `*[_type == "post"]` */
|
|
4933
4933
|
function evaluateChain(nodes, scope, context) {
|
|
@@ -4972,14 +4972,14 @@ function evaluateChain(nodes, scope, context) {
|
|
|
4972
4972
|
evaluateArguments(head, scope, context), shape = UNKNOWN;
|
|
4973
4973
|
break;
|
|
4974
4974
|
case "ArrayLiteral":
|
|
4975
|
-
for (let item of splitBy(innerOf(head), ",")) evaluate
|
|
4975
|
+
for (let item of splitBy(innerOf(head), ",")) evaluate(item, scope, context);
|
|
4976
4976
|
shape = UNKNOWN;
|
|
4977
4977
|
break;
|
|
4978
4978
|
case "ObjectLiteral":
|
|
4979
4979
|
evaluateEntries(innerOf(head), scope, context), shape = UNKNOWN;
|
|
4980
4980
|
break;
|
|
4981
4981
|
case "ParenExpression":
|
|
4982
|
-
shape = evaluate
|
|
4982
|
+
shape = evaluate(innerOf(head), scope, context);
|
|
4983
4983
|
break;
|
|
4984
4984
|
default: shape = UNKNOWN;
|
|
4985
4985
|
}
|
|
@@ -5023,7 +5023,7 @@ function evaluateChain(nodes, scope, context) {
|
|
|
5023
5023
|
* every chain, and returns the shape of one that stands alone. A pipe hands the shape before it
|
|
5024
5024
|
* to `order()` and `score()`, whose arguments read its items.
|
|
5025
5025
|
*/
|
|
5026
|
-
function evaluate
|
|
5026
|
+
function evaluate(nodes, scope, context) {
|
|
5027
5027
|
let shapes = [], chain = [], piped, close = () => {
|
|
5028
5028
|
if (chain.length === 0) return;
|
|
5029
5029
|
let [head, ...rest] = chain;
|
|
@@ -5054,7 +5054,7 @@ function checkQuerySchema(tree, query, schema) {
|
|
|
5054
5054
|
findings: [],
|
|
5055
5055
|
parents: []
|
|
5056
5056
|
};
|
|
5057
|
-
return evaluate
|
|
5057
|
+
return evaluate(childrenOf(tree.topNode).filter((node) => node.name !== "FunctionDef" && node.name !== ";"), UNKNOWN, context), context.findings;
|
|
5058
5058
|
}
|
|
5059
5059
|
function clamp$2(value, min, max) {
|
|
5060
5060
|
return Math.min(Math.max(value, min), max);
|
|
@@ -8748,7 +8748,7 @@ async function evaluateDelta({ query, params, before, after }) {
|
|
|
8748
8748
|
mode: "delta",
|
|
8749
8749
|
params
|
|
8750
8750
|
});
|
|
8751
|
-
return (await evaluate(tree, {
|
|
8751
|
+
return (await evaluate$1(tree, {
|
|
8752
8752
|
params,
|
|
8753
8753
|
before: before ?? void 0,
|
|
8754
8754
|
after: after ?? void 0,
|
|
@@ -15084,4 +15084,4 @@ function VisionRedesign(props) {
|
|
|
15084
15084
|
}
|
|
15085
15085
|
export { VisionRedesign };
|
|
15086
15086
|
|
|
15087
|
-
//# sourceMappingURL=VisionRedesign-
|
|
15087
|
+
//# sourceMappingURL=VisionRedesign-Bbv4UYJV.js.map
|