@sanity/assist 6.1.9 → 6.1.10

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/README.md CHANGED
@@ -5,6 +5,7 @@
5
5
  - [Table of contents](#table-of-contents)
6
6
  - [About Sanity AI Assist](#about-sanity-ai-assist)
7
7
  - [Installation](#installation)
8
+ - [Build errors about missing icon exports](#build-errors-about-missing-icon-exports)
8
9
  - [Setup](#setup)
9
10
  - [Add the plugin](#add-the-plugin)
10
11
  - [Enabling the AI Assist API](#enabling-the-ai-assist-api)
@@ -57,6 +58,30 @@ npm install @sanity/assist sanity@latest
57
58
 
58
59
  This plugin requires `sanity` version `3.26` or greater.
59
60
 
61
+ ### Build errors about missing icon exports
62
+
63
+ This plugin depends on `@sanity/icons` v5, which [removed the per-icon exports from the package root](https://github.com/sanity-io/icons/releases/tag/v5.0.0): every icon now lives on its own export path. If `sanity build` or `sanity dev` fails with an error like
64
+
65
+ ```
66
+ [MISSING_EXPORT] "CopyIcon" is not exported by "node_modules/@sanity/icons/dist/index.js"
67
+ ```
68
+
69
+ the file referenced by the error still imports icons from the package root — usually the studio's own schema or structure code, or another dependency that has not been updated yet. Update those imports to the per-icon export paths:
70
+
71
+ ```diff
72
+ - import {CopyIcon, ListIcon} from '@sanity/icons'
73
+ + import {CopyIcon} from '@sanity/icons/Copy'
74
+ + import {ListIcon} from '@sanity/icons/List'
75
+ ```
76
+
77
+ Also make sure `@sanity/icons` is declared in the studio's own `package.json` when studio code imports it; which copy an undeclared import resolves to depends on package manager hoisting, and can change when installing or upgrading plugins.
78
+
79
+ If you cannot update the importing code right away (for example when it lives in a third-party package), pin `@sanity/icons` to v4 in the studio's own `package.json` until it catches up — v4 supports both import styles:
80
+
81
+ ```sh
82
+ npm install @sanity/icons@4
83
+ ```
84
+
60
85
  ## Setup
61
86
 
62
87
  > **Note:** AI Assist is available for all projects on the Growth plan and up.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { FormBuilder, FormCallbacksProvider, FormFieldHeaderText, FormInput, MemberFieldError, ObjectInputMember, PatchEvent, PerspectiveProvider, PresenceOverlay, StatusButton, VirtualizerScrollInstanceProvider, createPatchChannel, defineArrayMember, defineField, definePlugin, defineType, fromMutationPatches, getDraftId, getPublishedId, getVersionFromId, getVersionId, insert, isArrayOfObjectsSchemaType, isArraySchemaType, isDocumentSchemaType, isKeySegment, isObjectSchemaType, isRecord, isVersionId, pathToString, set, setIfMissing, stringToPath, typed, unset, useClient, useColorSchemeValue, useCurrentUser, useDocumentPresence, useDocumentStore, useEditState, useFormCallbacks, usePerspective, useSchema, useSyncState, useWorkspaceSchemaId } from "sanity";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { Autocomplete, Box, Breadcrumbs, Button, Card, Checkbox, Container, Dialog, ErrorBoundary, Flex, Label, Menu, MenuButton, MenuItem, Popover, Radio, Spinner, Stack, Switch, Text, TextArea, ThemeProvider, Tooltip, focusFirstDescendant, rgba, useClickOutside, useGlobalKeyDown, useLayer, useTheme, useToast } from "@sanity/ui";
4
- import { createContext, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useReducer, useRef, useState } from "react";
4
+ import { createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useReducer, useRef, useState } from "react";
5
5
  import { DocumentInspectorHeader, DocumentPaneProvider, useDocumentPane, usePaneRouter } from "sanity/structure";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { addSeconds, formatDistanceToNow, isAfter, minutesToMilliseconds } from "date-fns";
@@ -4702,19 +4702,19 @@ const contextDocumentSchema = defineType({
4702
4702
  components: {
4703
4703
  input: InstructionInput,
4704
4704
  preview: (props) => {
4705
- let Icon = props.icon;
4705
+ let IconValue = props.icon, icon = isValidElement(IconValue) ? IconValue : IconValue ? /* @__PURE__ */ jsx(IconValue, {}) : null;
4706
4706
  return /* @__PURE__ */ jsxs(Flex, {
4707
4707
  gap: 3,
4708
4708
  align: "center",
4709
4709
  padding: 2,
4710
4710
  children: [
4711
- Icon && /* @__PURE__ */ jsx(Box, {
4711
+ icon ? /* @__PURE__ */ jsx(Box, {
4712
4712
  flex: "none",
4713
4713
  children: /* @__PURE__ */ jsx(Text, {
4714
4714
  size: 1,
4715
- children: /* @__PURE__ */ jsx(Icon, {})
4715
+ children: icon
4716
4716
  })
4717
- }),
4717
+ }) : null,
4718
4718
  /* @__PURE__ */ jsx(Stack, {
4719
4719
  flex: 1,
4720
4720
  gap: 2,