@sanity/assist 6.1.5 → 6.1.6

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
@@ -28,8 +28,8 @@ import { CloseCircleIcon } from "@sanity/icons/CloseCircle";
28
28
  import { ErrorOutlineIcon } from "@sanity/icons/ErrorOutline";
29
29
  import { SyncIcon } from "@sanity/icons/Sync";
30
30
  import get from "lodash-es/get.js";
31
+ import { icons, Icon } from "@sanity/icons";
31
32
  import { ControlsIcon } from "@sanity/icons/Controls";
32
- import { icons } from "@sanity/icons";
33
33
  import { TranslateIcon } from "@sanity/icons/Translate";
34
34
  import { LockIcon } from "@sanity/icons/Lock";
35
35
  import { CodeIcon } from "@sanity/icons/Code";
@@ -1269,10 +1269,10 @@ const fadeIn = keyframes`
1269
1269
  opacity: 1;
1270
1270
  transform: scale(1);
1271
1271
  }
1272
- `, FadeInDiv = styled.div.withConfig({
1272
+ `, FadeInDiv = /* @__PURE__ */ styled.div.withConfig({
1273
1273
  displayName: "FadeInDiv",
1274
1274
  componentId: "sc-1gsyaov-0"
1275
- })`animation-name:${fadeIn};animation-timing-function:ease-in-out;`;
1275
+ })(["animation-name:", ";animation-timing-function:ease-in-out;"], fadeIn);
1276
1276
  function FadeInContent(t0) {
1277
1277
  const $ = c(6), {
1278
1278
  children,
@@ -1286,23 +1286,23 @@ function FadeInContent(t0) {
1286
1286
  let t4;
1287
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;
1288
1288
  }
1289
- const Root = styled.span.withConfig({
1289
+ const Root = /* @__PURE__ */ styled.span.withConfig({
1290
1290
  displayName: "Root",
1291
1291
  componentId: "sc-5en2mb-0"
1292
- })`display:block;width:25px;height:25px;position:relative;`, dash = keyframes`
1292
+ })(["display:block;width:25px;height:25px;position:relative;"]), dash = keyframes`
1293
1293
  0% {
1294
1294
  transform: rotate(0);
1295
1295
  }
1296
1296
  100% {
1297
1297
  transform: rotate(43deg);
1298
1298
  }
1299
- `, Outline = styled.svg.withConfig({
1299
+ `, Outline = /* @__PURE__ */ styled.svg.withConfig({
1300
1300
  displayName: "Outline",
1301
1301
  componentId: "sc-5en2mb-1"
1302
- })`display:block;position:absolute;top:0;left:0;& > circle{stroke:var(--ai-avatar-stroke-color);stroke-width:1.5px;stroke-linecap:round;transform-origin:center;animation:${dash} 500ms ease-in-out infinite;transition:stroke-dasharray 200ms ease-in-out;stroke-dasharray:2.34px 0;[data-state='active'] > &{stroke-dasharray:2px 2.34px;}}`, IconDisc = styled.span.withConfig({
1302
+ })(["display:block;position:absolute;top:0;left:0;& > circle{stroke:var(--ai-avatar-stroke-color);stroke-width:1.5px;stroke-linecap:round;transform-origin:center;animation:", " 500ms ease-in-out infinite;transition:stroke-dasharray 200ms ease-in-out;stroke-dasharray:2.34px 0;[data-state='active'] > &{stroke-dasharray:2px 2.34px;}}"], dash), IconDisc = /* @__PURE__ */ styled.span.withConfig({
1303
1303
  displayName: "IconDisc",
1304
1304
  componentId: "sc-5en2mb-2"
1305
- })`background:var(--ai-avatar-disc-color);color:white;width:21px;height:21px;display:flex;align-items:center;justify-content:center;border-radius:10.5px;position:absolute;top:2px;left:2px;`;
1305
+ })(["background:var(--ai-avatar-disc-color);color:white;width:21px;height:21px;display:flex;align-items:center;justify-content:center;border-radius:10.5px;position:absolute;top:2px;left:2px;"]);
1306
1306
  function AssistAvatar(props) {
1307
1307
  const {
1308
1308
  state = "present"
@@ -1413,10 +1413,10 @@ function AssistField(props) {
1413
1413
  __internal_slot: actions
1414
1414
  }), $[6] = actions, $[7] = props, $[8] = t3) : t3 = $[8], t3;
1415
1415
  }
1416
- const WrapPreCard = styled(Card).withConfig({
1416
+ const WrapPreCard = /* @__PURE__ */ styled(Card).withConfig({
1417
1417
  displayName: "WrapPreCard",
1418
1418
  componentId: "sc-q2jw3a-0"
1419
- })`& pre{white-space:pre-wrap !important;}`;
1419
+ })(["& pre{white-space:pre-wrap !important;}"]);
1420
1420
  function SafeValueInput(props) {
1421
1421
  const $ = c(5);
1422
1422
  let t0;
@@ -1854,10 +1854,10 @@ const rotate = keyframes`
1854
1854
  100% {
1855
1855
  transform: rotate(360deg);
1856
1856
  }
1857
- `, SyncSpinningIcon = styled(SyncIcon).withConfig({
1857
+ `, SyncSpinningIcon = /* @__PURE__ */ styled(SyncIcon).withConfig({
1858
1858
  displayName: "SyncSpinningIcon",
1859
1859
  componentId: "sc-13pmxy-0"
1860
- })`animation:${rotate} 1s linear infinite;`, TASK_CONFIG = {
1860
+ })(["animation:", " 1s linear infinite;"], rotate), TASK_CONFIG = {
1861
1861
  aborted: {
1862
1862
  title: "Canceled",
1863
1863
  icon: CloseCircleIcon,
@@ -1998,13 +1998,13 @@ function TaskItem(props) {
1998
1998
  let t14;
1999
1999
  return $[29] !== t0 || $[30] !== t13 ? (t14 = /* @__PURE__ */ jsx(Card, { radius: 2, tone: t0, children: t13 }), $[29] = t0, $[30] = t13, $[31] = t14) : t14 = $[31], t14;
2000
2000
  }
2001
- const CardWithShadowBelow = styled(Card).withConfig({
2001
+ const CardWithShadowBelow = /* @__PURE__ */ styled(Card).withConfig({
2002
2002
  displayName: "CardWithShadowBelow",
2003
2003
  componentId: "sc-yws49l-0"
2004
- })`position:relative;&:after{content:'';display:block;position:absolute;left:0;right:0;bottom:-1px;border-bottom:1px solid var(--card-border-color);opacity:0.5;z-index:100;}`, CardWithShadowAbove = styled(Card).withConfig({
2004
+ })(["position:relative;&:after{content:'';display:block;position:absolute;left:0;right:0;bottom:-1px;border-bottom:1px solid var(--card-border-color);opacity:0.5;z-index:100;}"]), CardWithShadowAbove = /* @__PURE__ */ styled(Card).withConfig({
2005
2005
  displayName: "CardWithShadowAbove",
2006
2006
  componentId: "sc-yws49l-1"
2007
- })`position:relative;&:after{content:'';display:block;position:absolute;left:0;right:0;top:-1px;border-top:1px solid var(--card-border-color);opacity:0.5;z-index:100;}`;
2007
+ })(["position:relative;&:after{content:'';display:block;position:absolute;left:0;right:0;top:-1px;border-top:1px solid var(--card-border-color);opacity:0.5;z-index:100;}"]);
2008
2008
  function AssistInspectorWrapper(props) {
2009
2009
  const $ = c(43), context = useAiAssistanceConfig();
2010
2010
  if (context.statusLoading) {
@@ -2951,9 +2951,9 @@ function IconInput(props) {
2951
2951
  const items = t1;
2952
2952
  let t2;
2953
2953
  $[3] !== value ? (t2 = getIcon(value), $[3] = value, $[4] = t2) : t2 = $[4];
2954
- const selectedIcon = t2;
2954
+ const selectedSymbol = t2;
2955
2955
  let t3;
2956
- $[5] !== selectedIcon ? (t3 = /* @__PURE__ */ jsx(Button, { icon: selectedIcon, title: "Select icon", padding: 3, mode: "ghost", radius: 1 }), $[5] = selectedIcon, $[6] = t3) : t3 = $[6];
2956
+ $[5] !== selectedSymbol ? (t3 = /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(Icon, { symbol: selectedSymbol }), title: "Select icon", padding: 3, mode: "ghost", radius: 1 }), $[5] = selectedSymbol, $[6] = t3) : t3 = $[6];
2957
2957
  let t4;
2958
2958
  $[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = {
2959
2959
  maxHeight: 300
@@ -2980,7 +2980,10 @@ function IconItem(t0) {
2980
2980
  return $[3] !== icon || $[4] !== key || $[5] !== onClick ? (t2 = /* @__PURE__ */ jsx(MenuItem, { icon, title: key, text: key, onClick }), $[3] = icon, $[4] = key, $[5] = onClick, $[6] = t2) : t2 = $[6], t2;
2981
2981
  }
2982
2982
  function getIcon(iconName) {
2983
- return Object.entries(icons).find(([key]) => key === iconName)?.[1] ?? icons.sparkles;
2983
+ return iconName && isIconSymbol(iconName) ? iconName : "sparkles";
2984
+ }
2985
+ function isIconSymbol(iconName) {
2986
+ return iconName in icons;
2984
2987
  }
2985
2988
  function useAssistSupported(_path, schemaType) {
2986
2989
  const $ = c(2);
@@ -3406,9 +3409,14 @@ function instructionItem(props) {
3406
3409
  assistSupported,
3407
3410
  instruction: instruction2
3408
3411
  } = props;
3412
+ function IconLeft() {
3413
+ const $ = c(1);
3414
+ let t0;
3415
+ return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(Icon, { symbol: getIcon(instruction2.icon) }), $[0] = t0) : t0 = $[0], t0;
3416
+ }
3409
3417
  return {
3410
3418
  type: "action",
3411
- icon: getIcon(instruction2.icon),
3419
+ icon: IconLeft,
3412
3420
  iconRight: isPrivate ? PrivateIcon : void 0,
3413
3421
  title: getInstructionTitle(instruction2),
3414
3422
  onAction: () => onInstructionAction(instruction2),
@@ -4052,10 +4060,10 @@ function Selectable(t0) {
4052
4060
  t6
4053
4061
  ] }), $[16] = t3, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
4054
4062
  }
4055
- const PteMods = styled(Box).withConfig({
4063
+ const PteMods = /* @__PURE__ */ styled(Box).withConfig({
4056
4064
  displayName: "PteMods",
4057
4065
  componentId: "sc-grsj10-0"
4058
- })`& [data-testid='pt-editor__toolbar-card'] > div > div:last-child{display:none;}& [data-testid='pt-editor']{min-height:300px;}& [data-testid='pt-editor'] .pt-inline-object *{max-width:400px;}`;
4066
+ })(["& [data-testid='pt-editor__toolbar-card'] > div > div:last-child{display:none;}& [data-testid='pt-editor']{min-height:300px;}& [data-testid='pt-editor'] .pt-inline-object *{max-width:400px;}"]);
4059
4067
  function PromptInput(props) {
4060
4068
  const $ = c(5);
4061
4069
  useOnlyInlineBlocks(props);
@@ -4400,16 +4408,16 @@ const contextDocumentSchema = defineType({
4400
4408
  }) => ({
4401
4409
  title,
4402
4410
  // oxlint-disable-next-line no-unsafe-type-assertion
4403
- icon: icon ? icons[icon] : SparklesIcon,
4411
+ icon: icon ? /* @__PURE__ */ jsx(Icon, { symbol: icon }) : SparklesIcon,
4404
4412
  userId
4405
4413
  })
4406
4414
  },
4407
4415
  components: {
4408
4416
  input: InstructionInput,
4409
4417
  preview: (props) => {
4410
- const Icon = props.icon;
4418
+ const Icon2 = props.icon;
4411
4419
  return /* @__PURE__ */ jsxs(Flex, { gap: 3, align: "center", padding: 2, children: [
4412
- Icon && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(Icon, {}) }) }),
4420
+ Icon2 && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(Icon2, {}) }) }),
4413
4421
  /* @__PURE__ */ jsx(Stack, { flex: 1, gap: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", weight: "medium", children: getInstructionTitle(props) }) }),
4414
4422
  props.userId && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(Text, { size: 1, children: "Only visible to you" }), padding: 2, placement: "top", portal: !0, children: /* @__PURE__ */ jsx(LockIcon, {}) }) })
4415
4423
  ] });