@sanity/assist 6.1.3 → 6.1.5
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/dist/index.js +48 -14
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { pathToString, isVersionId, getVersionFromId, getPublishedId, useEditState, useCurrentUser, useClient, typed, isObjectSchemaType, stringToPath, isKeySegment, FormFieldHeaderText, PatchEvent, unset, useSchema, usePerspective, getVersionId, getDraftId, useColorSchemeValue, isArraySchemaType, useFormCallbacks, useDocumentStore, useDocumentPresence, createPatchChannel, FormBuilder, fromMutationPatches, StatusButton, PresenceOverlay, VirtualizerScrollInstanceProvider, PerspectiveProvider, isDocumentSchemaType, isRecord, useSyncState, set, useWorkspaceSchemaId,
|
|
2
|
+
import { pathToString, isVersionId, getVersionFromId, getPublishedId, useEditState, useCurrentUser, useClient, typed, isObjectSchemaType, stringToPath, isKeySegment, FormFieldHeaderText, PatchEvent, unset, useSchema, usePerspective, getVersionId, getDraftId, useColorSchemeValue, isArraySchemaType, useFormCallbacks, useDocumentStore, useDocumentPresence, createPatchChannel, FormBuilder, fromMutationPatches, StatusButton, PresenceOverlay, VirtualizerScrollInstanceProvider, PerspectiveProvider, isDocumentSchemaType, isRecord, useSyncState, set, useWorkspaceSchemaId, FormCallbacksProvider, FormInput, MemberFieldError, setIfMissing, insert, ObjectInputMember, isArrayOfObjectsSchemaType, defineType, defineField, defineArrayMember, definePlugin } from "sanity";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import { useToast, useLayer, Dialog, Stack, Flex, Tooltip, Text, Button, TextArea, Card, Box, ErrorBoundary,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { useToast, useLayer, Dialog, Stack, Flex, Tooltip, Text, Button, TextArea, Card, Box, ErrorBoundary, Spinner, focusFirstDescendant, Container, Autocomplete, Breadcrumbs, useClickOutside, Popover, useGlobalKeyDown, useTheme, rgba, Checkbox, Radio, ThemeProvider, MenuButton, MenuItem, Menu, Switch, Label } from "@sanity/ui";
|
|
5
|
+
import { useRef, useState, useEffect, createContext, useContext, useCallback, useId, useMemo, useEffectEvent, useReducer } from "react";
|
|
6
|
+
import { useDocumentPane, usePaneRouter, DocumentInspectorHeader, DocumentPaneProvider } from "sanity/structure";
|
|
7
7
|
import { minutesToMilliseconds, isAfter, addSeconds, formatDistanceToNow } from "date-fns";
|
|
8
|
-
import {
|
|
8
|
+
import { BlockContentIcon } from "@sanity/icons/BlockContent";
|
|
9
|
+
import { BlockquoteIcon } from "@sanity/icons/Blockquote";
|
|
10
|
+
import { DocumentIcon } from "@sanity/icons/Document";
|
|
11
|
+
import { ImageIcon } from "@sanity/icons/Image";
|
|
12
|
+
import { LinkIcon } from "@sanity/icons/Link";
|
|
13
|
+
import { OlistIcon } from "@sanity/icons/Olist";
|
|
14
|
+
import { StringIcon } from "@sanity/icons/String";
|
|
9
15
|
import { extractWithPath } from "@sanity/mutator";
|
|
16
|
+
import { PlayIcon } from "@sanity/icons/Play";
|
|
10
17
|
import { keyframes, styled } from "styled-components";
|
|
11
18
|
import { purple } from "@sanity/color";
|
|
19
|
+
import { SparklesIcon } from "@sanity/icons/Sparkles";
|
|
20
|
+
import { ArrowRightIcon } from "@sanity/icons/ArrowRight";
|
|
21
|
+
import { CloseIcon } from "@sanity/icons/Close";
|
|
22
|
+
import { RetryIcon } from "@sanity/icons/Retry";
|
|
12
23
|
import { tap, mergeMap, share, take, filter, distinctUntilChanged, catchError } from "rxjs/operators";
|
|
24
|
+
import { SearchIcon } from "@sanity/icons/Search";
|
|
25
|
+
import { CheckmarkCircleIcon } from "@sanity/icons/CheckmarkCircle";
|
|
26
|
+
import { ClockIcon } from "@sanity/icons/Clock";
|
|
27
|
+
import { CloseCircleIcon } from "@sanity/icons/CloseCircle";
|
|
28
|
+
import { ErrorOutlineIcon } from "@sanity/icons/ErrorOutline";
|
|
29
|
+
import { SyncIcon } from "@sanity/icons/Sync";
|
|
13
30
|
import get from "lodash-es/get.js";
|
|
31
|
+
import { ControlsIcon } from "@sanity/icons/Controls";
|
|
32
|
+
import { icons } from "@sanity/icons";
|
|
33
|
+
import { TranslateIcon } from "@sanity/icons/Translate";
|
|
34
|
+
import { LockIcon } from "@sanity/icons/Lock";
|
|
35
|
+
import { CodeIcon } from "@sanity/icons/Code";
|
|
36
|
+
import { ComposeIcon } from "@sanity/icons/Compose";
|
|
37
|
+
import { ThListIcon } from "@sanity/icons/ThList";
|
|
38
|
+
import { ArrowLeftIcon } from "@sanity/icons/ArrowLeft";
|
|
39
|
+
import { DocumentTextIcon } from "@sanity/icons/DocumentText";
|
|
40
|
+
import { TokenIcon } from "@sanity/icons/Token";
|
|
14
41
|
import isEqual from "react-fast-compare";
|
|
15
42
|
import { throwError, of, partition, merge, switchMap, delay, defer } from "rxjs";
|
|
16
43
|
import { exhaustMapToWithTrailing } from "rxjs-exhaustmap-with-trailing";
|
|
@@ -970,6 +997,7 @@ function RunInstructionProvider(props) {
|
|
|
970
997
|
close();
|
|
971
998
|
}, $[6] = close, $[7] = inputs, $[8] = resolveUserInput, $[9] = runInstructionRequest, $[10] = runRequest, $[11] = t3) : t3 = $[11];
|
|
972
999
|
const runWithInput = t3, open = !!runRequest;
|
|
1000
|
+
runRequest?.userInputBlocks;
|
|
973
1001
|
let t4;
|
|
974
1002
|
$[12] !== inputs ? (t4 = Object.entries(inputs).filter(_temp4$2), $[12] = inputs, $[13] = t4) : t4 = $[13];
|
|
975
1003
|
const runDisabled = (runRequest?.userInputBlocks?.length ?? 0) > t4.length;
|
|
@@ -1244,10 +1272,12 @@ const fadeIn = keyframes`
|
|
|
1244
1272
|
`, FadeInDiv = styled.div.withConfig({
|
|
1245
1273
|
displayName: "FadeInDiv",
|
|
1246
1274
|
componentId: "sc-1gsyaov-0"
|
|
1247
|
-
})`animation-name:${fadeIn};animation-timing-function:ease-in-out
|
|
1275
|
+
})`animation-name:${fadeIn};animation-timing-function:ease-in-out;`;
|
|
1276
|
+
function FadeInContent(t0) {
|
|
1248
1277
|
const $ = c(6), {
|
|
1249
1278
|
children,
|
|
1250
|
-
durationMs: t1
|
|
1279
|
+
durationMs: t1,
|
|
1280
|
+
ref
|
|
1251
1281
|
} = t0, t2 = `${t1 === void 0 ? 250 : t1}ms`;
|
|
1252
1282
|
let t3;
|
|
1253
1283
|
$[0] !== t2 ? (t3 = {
|
|
@@ -1255,7 +1285,8 @@ const fadeIn = keyframes`
|
|
|
1255
1285
|
}, $[0] = t2, $[1] = t3) : t3 = $[1];
|
|
1256
1286
|
let t4;
|
|
1257
1287
|
return $[2] !== children || $[3] !== ref || $[4] !== t3 ? (t4 = /* @__PURE__ */ jsx(FadeInDiv, { ref, style: t3, children }), $[2] = children, $[3] = ref, $[4] = t3, $[5] = t4) : t4 = $[5], t4;
|
|
1258
|
-
}
|
|
1288
|
+
}
|
|
1289
|
+
const Root = styled.span.withConfig({
|
|
1259
1290
|
displayName: "Root",
|
|
1260
1291
|
componentId: "sc-5en2mb-0"
|
|
1261
1292
|
})`display:block;width:25px;height:25px;position:relative;`, dash = keyframes`
|
|
@@ -1417,7 +1448,7 @@ function ErrorWrapper(props) {
|
|
|
1417
1448
|
return $[6] !== catcher || $[7] !== error || $[8] !== unsetValue ? (t4 = error ? /* @__PURE__ */ jsx(Card, { border: !0, tone: "critical", padding: 2, contentEditable: !1, children: /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
1418
1449
|
/* @__PURE__ */ jsx(Text, { muted: !0, weight: "semibold", children: "An error occurred." }),
|
|
1419
1450
|
/* @__PURE__ */ jsx(WrapPreCard, { flex: 1, padding: 2, tone: "critical", border: !0, children: catcher }),
|
|
1420
|
-
/* @__PURE__ */ jsxs(Flex, {
|
|
1451
|
+
/* @__PURE__ */ jsxs(Flex, { flex: 1, gap: 3, children: [
|
|
1421
1452
|
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Button, { text: "Dismiss", onClick: dismiss, tone: "primary" }) }),
|
|
1422
1453
|
/* @__PURE__ */ jsx(Button, { text: "Unset value", onClick: unsetValue, tone: "critical" })
|
|
1423
1454
|
] })
|
|
@@ -1487,7 +1518,7 @@ function AssistItem(props) {
|
|
|
1487
1518
|
let t3;
|
|
1488
1519
|
$[5] !== presence ? (t3 = presence.map(_temp$9), $[5] = presence, $[6] = t3) : t3 = $[6];
|
|
1489
1520
|
let t4;
|
|
1490
|
-
return $[7] !== t2 || $[8] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Flex, { align: "center",
|
|
1521
|
+
return $[7] !== t2 || $[8] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Flex, { align: "center", style: t0, children: [
|
|
1491
1522
|
t2,
|
|
1492
1523
|
t3
|
|
1493
1524
|
] }), $[7] = t2, $[8] = t3, $[9] = t4) : t4 = $[9], t4;
|
|
@@ -1885,17 +1916,19 @@ function InstructionTaskHistoryButton(props) {
|
|
|
1885
1916
|
}
|
|
1886
1917
|
const TASK_STATUS_BUTTON_TOOLTIP_PROPS = {
|
|
1887
1918
|
placement: "top"
|
|
1888
|
-
}
|
|
1919
|
+
};
|
|
1920
|
+
function TaskStatusButton(props) {
|
|
1889
1921
|
const $ = c(7), {
|
|
1890
1922
|
disabled,
|
|
1891
1923
|
hasErrors,
|
|
1892
1924
|
isRunning,
|
|
1893
1925
|
onClick,
|
|
1894
|
-
selected
|
|
1926
|
+
selected,
|
|
1927
|
+
ref
|
|
1895
1928
|
} = props, t0 = isRunning ? SyncSpinningIcon : hasErrors ? ErrorOutlineIcon : CheckmarkCircleIcon, t1 = hasErrors ? "critical" : void 0;
|
|
1896
1929
|
let t2;
|
|
1897
1930
|
return $[0] !== disabled || $[1] !== onClick || $[2] !== ref || $[3] !== selected || $[4] !== t0 || $[5] !== t1 ? (t2 = /* @__PURE__ */ jsx(StatusButton, { label: `${pluginTitle} status`, "aria-label": `${pluginTitle} status`, icon: t0, mode: "bleed", onClick, tone: t1, disabled, ref, selected, tooltipProps: TASK_STATUS_BUTTON_TOOLTIP_PROPS }), $[0] = disabled, $[1] = onClick, $[2] = ref, $[3] = selected, $[4] = t0, $[5] = t1, $[6] = t2) : t2 = $[6], t2;
|
|
1898
|
-
}
|
|
1931
|
+
}
|
|
1899
1932
|
function TaskList(props) {
|
|
1900
1933
|
const $ = c(7), {
|
|
1901
1934
|
onEscape,
|
|
@@ -2577,7 +2610,7 @@ function FieldTranslationProvider(props) {
|
|
|
2577
2610
|
})),
|
|
2578
2611
|
conditionalMembers: fieldTranslationParams?.conditionalMembers
|
|
2579
2612
|
}), close();
|
|
2580
|
-
}, $[20] = documentId, $[21] = fieldLanguageMaps, $[22] = fieldTranslationParams?.conditionalMembers, $[23] = fieldTranslationParams?.documentSchema, $[24] = fieldTranslationParams?.translatePath, $[25] = languageClient, $[26] = runTranslate, $[27] = styleguide, $[28] = toLanguages, $[29] = t8) : t8 = $[29];
|
|
2613
|
+
}, $[20] = documentId, $[21] = fieldLanguageMaps, $[22] = fieldTranslationParams?.conditionalMembers, $[23] = fieldTranslationParams?.documentSchema, $[24] = fieldTranslationParams?.translatePath, $[25] = languageClient, $[26] = runTranslate, $[27] = styleguide, $[28] = toLanguages, $[29] = t8) : t8 = $[29], fieldTranslationParams?.translatePath, fieldTranslationParams?.conditionalMembers, fieldTranslationParams?.documentSchema;
|
|
2581
2614
|
const onRunTranslation = t8;
|
|
2582
2615
|
let t9;
|
|
2583
2616
|
$[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = {
|
|
@@ -2731,6 +2764,7 @@ function serializeInlineOf(blockSchemaType, schema, options2) {
|
|
|
2731
2764
|
const childrenType = blockSchemaType.fields.find((f) => f.name === "children")?.type;
|
|
2732
2765
|
if (!(!childrenType || !isArraySchemaType(childrenType)))
|
|
2733
2766
|
return arrayOf({
|
|
2767
|
+
...childrenType,
|
|
2734
2768
|
of: childrenType.of.filter((t) => !isType(t, "span"))
|
|
2735
2769
|
}, schema, options2);
|
|
2736
2770
|
}
|