@sanity/assist 6.1.5 → 6.1.7
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 +38 -32
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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
|
-
})
|
|
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) {
|
|
@@ -2942,18 +2942,15 @@ function IconInput(props) {
|
|
|
2942
2942
|
onChange
|
|
2943
2943
|
} = props, id = useId();
|
|
2944
2944
|
let t0;
|
|
2945
|
-
$[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = Object.
|
|
2945
|
+
$[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = Object.keys(icons).filter(isIconSymbol), $[0] = t0) : t0 = $[0];
|
|
2946
2946
|
let t1;
|
|
2947
|
-
$[1] !== onChange ? (t1 = t0.map((
|
|
2948
|
-
const [key, icon] = t22;
|
|
2949
|
-
return /* @__PURE__ */ jsx(IconItem, { iconKey: key, icon, onChange }, key);
|
|
2950
|
-
}), $[1] = onChange, $[2] = t1) : t1 = $[2];
|
|
2947
|
+
$[1] !== onChange ? (t1 = t0.map((key) => /* @__PURE__ */ jsx(IconItem, { iconKey: key, onChange }, key)), $[1] = onChange, $[2] = t1) : t1 = $[2];
|
|
2951
2948
|
const items = t1;
|
|
2952
2949
|
let t2;
|
|
2953
2950
|
$[3] !== value ? (t2 = getIcon(value), $[3] = value, $[4] = t2) : t2 = $[4];
|
|
2954
|
-
const
|
|
2951
|
+
const selectedSymbol = t2;
|
|
2955
2952
|
let t3;
|
|
2956
|
-
$[5] !==
|
|
2953
|
+
$[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
2954
|
let t4;
|
|
2958
2955
|
$[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = {
|
|
2959
2956
|
maxHeight: 300
|
|
@@ -2968,8 +2965,7 @@ function IconInput(props) {
|
|
|
2968
2965
|
return $[11] !== id || $[12] !== t3 || $[13] !== t5 ? (t7 = /* @__PURE__ */ jsx(MenuButton, { button: t3, id, menu: t5, popover: t6 }), $[11] = id, $[12] = t3, $[13] = t5, $[14] = t7) : t7 = $[14], t7;
|
|
2969
2966
|
}
|
|
2970
2967
|
function IconItem(t0) {
|
|
2971
|
-
const $ = c(
|
|
2972
|
-
icon,
|
|
2968
|
+
const $ = c(9), {
|
|
2973
2969
|
iconKey: key,
|
|
2974
2970
|
onChange
|
|
2975
2971
|
} = t0;
|
|
@@ -2977,10 +2973,15 @@ function IconItem(t0) {
|
|
|
2977
2973
|
$[0] !== key || $[1] !== onChange ? (t1 = () => onChange(set(key)), $[0] = key, $[1] = onChange, $[2] = t1) : t1 = $[2];
|
|
2978
2974
|
const onClick = t1;
|
|
2979
2975
|
let t2;
|
|
2980
|
-
|
|
2976
|
+
$[3] !== key ? (t2 = /* @__PURE__ */ jsx(Icon, { symbol: key }), $[3] = key, $[4] = t2) : t2 = $[4];
|
|
2977
|
+
let t3;
|
|
2978
|
+
return $[5] !== key || $[6] !== onClick || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsx(MenuItem, { icon: t2, title: key, text: key, onClick }), $[5] = key, $[6] = onClick, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
|
|
2981
2979
|
}
|
|
2982
2980
|
function getIcon(iconName) {
|
|
2983
|
-
return
|
|
2981
|
+
return iconName && isIconSymbol(iconName) ? iconName : "sparkles";
|
|
2982
|
+
}
|
|
2983
|
+
function isIconSymbol(iconName) {
|
|
2984
|
+
return iconName in icons;
|
|
2984
2985
|
}
|
|
2985
2986
|
function useAssistSupported(_path, schemaType) {
|
|
2986
2987
|
const $ = c(2);
|
|
@@ -3406,9 +3407,14 @@ function instructionItem(props) {
|
|
|
3406
3407
|
assistSupported,
|
|
3407
3408
|
instruction: instruction2
|
|
3408
3409
|
} = props;
|
|
3410
|
+
function IconLeft() {
|
|
3411
|
+
const $ = c(1);
|
|
3412
|
+
let t0;
|
|
3413
|
+
return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(Icon, { symbol: getIcon(instruction2.icon) }), $[0] = t0) : t0 = $[0], t0;
|
|
3414
|
+
}
|
|
3409
3415
|
return {
|
|
3410
3416
|
type: "action",
|
|
3411
|
-
icon:
|
|
3417
|
+
icon: IconLeft,
|
|
3412
3418
|
iconRight: isPrivate ? PrivateIcon : void 0,
|
|
3413
3419
|
title: getInstructionTitle(instruction2),
|
|
3414
3420
|
onAction: () => onInstructionAction(instruction2),
|
|
@@ -4052,10 +4058,10 @@ function Selectable(t0) {
|
|
|
4052
4058
|
t6
|
|
4053
4059
|
] }), $[16] = t3, $[17] = t6, $[18] = t7) : t7 = $[18], t7;
|
|
4054
4060
|
}
|
|
4055
|
-
const PteMods = styled(Box).withConfig({
|
|
4061
|
+
const PteMods = /* @__PURE__ */ styled(Box).withConfig({
|
|
4056
4062
|
displayName: "PteMods",
|
|
4057
4063
|
componentId: "sc-grsj10-0"
|
|
4058
|
-
})
|
|
4064
|
+
})(["& [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
4065
|
function PromptInput(props) {
|
|
4060
4066
|
const $ = c(5);
|
|
4061
4067
|
useOnlyInlineBlocks(props);
|
|
@@ -4400,16 +4406,16 @@ const contextDocumentSchema = defineType({
|
|
|
4400
4406
|
}) => ({
|
|
4401
4407
|
title,
|
|
4402
4408
|
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
4403
|
-
icon: icon ?
|
|
4409
|
+
icon: icon ? /* @__PURE__ */ jsx(Icon, { symbol: icon }) : SparklesIcon,
|
|
4404
4410
|
userId
|
|
4405
4411
|
})
|
|
4406
4412
|
},
|
|
4407
4413
|
components: {
|
|
4408
4414
|
input: InstructionInput,
|
|
4409
4415
|
preview: (props) => {
|
|
4410
|
-
const
|
|
4416
|
+
const Icon2 = props.icon;
|
|
4411
4417
|
return /* @__PURE__ */ jsxs(Flex, { gap: 3, align: "center", padding: 2, children: [
|
|
4412
|
-
|
|
4418
|
+
Icon2 && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(Icon2, {}) }) }),
|
|
4413
4419
|
/* @__PURE__ */ jsx(Stack, { flex: 1, gap: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", weight: "medium", children: getInstructionTitle(props) }) }),
|
|
4414
4420
|
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
4421
|
] });
|