@sanity/assist 6.1.3 → 6.1.4

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 CHANGED
@@ -1,11 +1,11 @@
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, MemberFieldError, FormCallbacksProvider, FormInput, setIfMissing, insert, ObjectInputMember, isArrayOfObjectsSchemaType, defineType, defineField, defineArrayMember, definePlugin } from "sanity";
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, focusFirstDescendant, Spinner, Container, Autocomplete, Breadcrumbs, useClickOutside, Popover, useGlobalKeyDown, useTheme, rgba, Checkbox, Radio, ThemeProvider, MenuButton, MenuItem, Menu, Switch, Label } from "@sanity/ui";
5
- import { useDocumentPane, usePaneRouter, DocumentPaneProvider, DocumentInspectorHeader } from "sanity/structure";
6
- import { useRef, useState, useEffect, createContext, useContext, useCallback, useId, forwardRef, useMemo, useEffectEvent, useReducer } from "react";
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 { DocumentIcon, LinkIcon, ImageIcon, BlockContentIcon, OlistIcon, BlockquoteIcon, StringIcon, PlayIcon, SparklesIcon, SearchIcon, SyncIcon, ErrorOutlineIcon, CheckmarkCircleIcon, ClockIcon, CloseCircleIcon, ArrowRightIcon, RetryIcon, CloseIcon, icons, TranslateIcon, LockIcon, ControlsIcon, ArrowLeftIcon, TokenIcon, DocumentTextIcon, ThListIcon, CodeIcon, ComposeIcon } from "@sanity/icons";
8
+ import { DocumentIcon, LinkIcon, ImageIcon, BlockContentIcon, OlistIcon, BlockquoteIcon, StringIcon, PlayIcon, SparklesIcon, SearchIcon, SyncIcon, ErrorOutlineIcon, CheckmarkCircleIcon, ClockIcon, CloseCircleIcon, RetryIcon, ArrowRightIcon, CloseIcon, icons, TranslateIcon, LockIcon, ControlsIcon, ArrowLeftIcon, TokenIcon, DocumentTextIcon, ThListIcon, CodeIcon, ComposeIcon } from "@sanity/icons";
9
9
  import { extractWithPath } from "@sanity/mutator";
10
10
  import { keyframes, styled } from "styled-components";
11
11
  import { purple } from "@sanity/color";
@@ -970,6 +970,7 @@ function RunInstructionProvider(props) {
970
970
  close();
971
971
  }, $[6] = close, $[7] = inputs, $[8] = resolveUserInput, $[9] = runInstructionRequest, $[10] = runRequest, $[11] = t3) : t3 = $[11];
972
972
  const runWithInput = t3, open = !!runRequest;
973
+ runRequest?.userInputBlocks;
973
974
  let t4;
974
975
  $[12] !== inputs ? (t4 = Object.entries(inputs).filter(_temp4$2), $[12] = inputs, $[13] = t4) : t4 = $[13];
975
976
  const runDisabled = (runRequest?.userInputBlocks?.length ?? 0) > t4.length;
@@ -1244,10 +1245,12 @@ const fadeIn = keyframes`
1244
1245
  `, FadeInDiv = styled.div.withConfig({
1245
1246
  displayName: "FadeInDiv",
1246
1247
  componentId: "sc-1gsyaov-0"
1247
- })`animation-name:${fadeIn};animation-timing-function:ease-in-out;`, FadeInContent = forwardRef(function(t0, ref) {
1248
+ })`animation-name:${fadeIn};animation-timing-function:ease-in-out;`;
1249
+ function FadeInContent(t0) {
1248
1250
  const $ = c(6), {
1249
1251
  children,
1250
- durationMs: t1
1252
+ durationMs: t1,
1253
+ ref
1251
1254
  } = t0, t2 = `${t1 === void 0 ? 250 : t1}ms`;
1252
1255
  let t3;
1253
1256
  $[0] !== t2 ? (t3 = {
@@ -1255,7 +1258,8 @@ const fadeIn = keyframes`
1255
1258
  }, $[0] = t2, $[1] = t3) : t3 = $[1];
1256
1259
  let t4;
1257
1260
  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
- }), Root = styled.span.withConfig({
1261
+ }
1262
+ const Root = styled.span.withConfig({
1259
1263
  displayName: "Root",
1260
1264
  componentId: "sc-5en2mb-0"
1261
1265
  })`display:block;width:25px;height:25px;position:relative;`, dash = keyframes`
@@ -1417,7 +1421,7 @@ function ErrorWrapper(props) {
1417
1421
  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
1422
  /* @__PURE__ */ jsx(Text, { muted: !0, weight: "semibold", children: "An error occurred." }),
1419
1423
  /* @__PURE__ */ jsx(WrapPreCard, { flex: 1, padding: 2, tone: "critical", border: !0, children: catcher }),
1420
- /* @__PURE__ */ jsxs(Flex, { width: "fill", flex: 1, gap: 3, children: [
1424
+ /* @__PURE__ */ jsxs(Flex, { flex: 1, gap: 3, children: [
1421
1425
  /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Button, { text: "Dismiss", onClick: dismiss, tone: "primary" }) }),
1422
1426
  /* @__PURE__ */ jsx(Button, { text: "Unset value", onClick: unsetValue, tone: "critical" })
1423
1427
  ] })
@@ -1487,7 +1491,7 @@ function AssistItem(props) {
1487
1491
  let t3;
1488
1492
  $[5] !== presence ? (t3 = presence.map(_temp$9), $[5] = presence, $[6] = t3) : t3 = $[6];
1489
1493
  let t4;
1490
- return $[7] !== t2 || $[8] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Flex, { align: "center", width: "fill", style: t0, children: [
1494
+ return $[7] !== t2 || $[8] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Flex, { align: "center", style: t0, children: [
1491
1495
  t2,
1492
1496
  t3
1493
1497
  ] }), $[7] = t2, $[8] = t3, $[9] = t4) : t4 = $[9], t4;
@@ -1885,17 +1889,19 @@ function InstructionTaskHistoryButton(props) {
1885
1889
  }
1886
1890
  const TASK_STATUS_BUTTON_TOOLTIP_PROPS = {
1887
1891
  placement: "top"
1888
- }, TaskStatusButton = forwardRef(function(props, ref) {
1892
+ };
1893
+ function TaskStatusButton(props) {
1889
1894
  const $ = c(7), {
1890
1895
  disabled,
1891
1896
  hasErrors,
1892
1897
  isRunning,
1893
1898
  onClick,
1894
- selected
1899
+ selected,
1900
+ ref
1895
1901
  } = props, t0 = isRunning ? SyncSpinningIcon : hasErrors ? ErrorOutlineIcon : CheckmarkCircleIcon, t1 = hasErrors ? "critical" : void 0;
1896
1902
  let t2;
1897
1903
  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
- });
1904
+ }
1899
1905
  function TaskList(props) {
1900
1906
  const $ = c(7), {
1901
1907
  onEscape,
@@ -2577,7 +2583,7 @@ function FieldTranslationProvider(props) {
2577
2583
  })),
2578
2584
  conditionalMembers: fieldTranslationParams?.conditionalMembers
2579
2585
  }), 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];
2586
+ }, $[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
2587
  const onRunTranslation = t8;
2582
2588
  let t9;
2583
2589
  $[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = {
@@ -2731,6 +2737,7 @@ function serializeInlineOf(blockSchemaType, schema, options2) {
2731
2737
  const childrenType = blockSchemaType.fields.find((f) => f.name === "children")?.type;
2732
2738
  if (!(!childrenType || !isArraySchemaType(childrenType)))
2733
2739
  return arrayOf({
2740
+ ...childrenType,
2734
2741
  of: childrenType.of.filter((t) => !isType(t, "span"))
2735
2742
  }, schema, options2);
2736
2743
  }