@sanity/assist 6.1.18 → 6.1.20
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.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -43
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "@sanity/ui/styles.css";
|
|
2
2
|
import { CurrentUser, DocumentFieldActionDivider, DocumentFieldActionGroup, DocumentFieldActionItem, ObjectSchemaType, Path, SanityClient, SanityDocumentLike, SchemaType } from "sanity";
|
|
3
|
-
import { SanityClient as SanityClient$1 } from "@sanity/client";
|
|
4
|
-
import { AgentActionPath } from "@sanity/client/stega";
|
|
3
|
+
import { AgentActionPath, SanityClient as SanityClient$1 } from "@sanity/client";
|
|
5
4
|
import { PortableTextBlock, PortableTextMarkDefinition, PortableTextSpan } from "@portabletext/types";
|
|
6
5
|
interface AssistConfig {
|
|
7
6
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/assistTypes.ts","../src/fieldActions/customFieldActions.tsx","../src/translate/types.ts","../src/types.ts","../src/plugin.tsx","../src/schemas/serialize/SchemTypeTool.tsx","../src/schemas/typeDefExtensions.ts","../src/translate/paths.ts","../src/fieldActions/useUserInput.ts","../src/helpers/typeUtils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/assistTypes.ts","../src/fieldActions/customFieldActions.tsx","../src/translate/types.ts","../src/types.ts","../src/plugin.tsx","../src/schemas/serialize/SchemTypeTool.tsx","../src/schemas/typeDefExtensions.ts","../src/translate/paths.ts","../src/fieldActions/useUserInput.ts","../src/helpers/typeUtils.ts"],"mappings":";;;;UAEiB;;;;;;;;;;;;;;;;;;EAkBf,kBAAkB,SAAS,0BAA0B;;;;;;;;;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[4] = resolveUserInput, $[5] = t2);
|
|
888
888
|
let close = t2, t3;
|
|
889
889
|
$[6] !== close || $[7] !== inputs || $[8] !== resolveUserInput || $[9] !== runInstructionRequest || $[10] !== runRequest ? (t3 = () => {
|
|
890
|
-
if (runRequest)
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
let
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
890
|
+
if (runRequest) {
|
|
891
|
+
if ("instruction" in runRequest) {
|
|
892
|
+
let { instruction: instruction_0, userInputBlocks: _, ...request_0 } = runRequest;
|
|
893
|
+
runInstructionRequest({
|
|
894
|
+
...request_0,
|
|
895
|
+
instructionKey: instruction_0._key,
|
|
896
|
+
userTexts: Object.entries(inputs).map(_temp3$4)
|
|
897
|
+
});
|
|
898
|
+
} else {
|
|
899
|
+
let userInputs = Object.values(inputs).map((input_0, i_0) => {
|
|
900
|
+
let userInputBlock = runRequest.userInputBlocks[i_0];
|
|
901
|
+
return {
|
|
902
|
+
input: {
|
|
903
|
+
id: userInputBlock._key,
|
|
904
|
+
title: userInputBlock.message ?? "",
|
|
905
|
+
description: userInputBlock.description
|
|
906
|
+
},
|
|
907
|
+
result: input_0
|
|
908
|
+
};
|
|
909
|
+
});
|
|
910
|
+
resolveUserInput?.(userInputs), setResolveUserInput(void 0);
|
|
911
|
+
}
|
|
910
912
|
}
|
|
911
913
|
close();
|
|
912
914
|
}, $[6] = close, $[7] = inputs, $[8] = resolveUserInput, $[9] = runInstructionRequest, $[10] = runRequest, $[11] = t3) : t3 = $[11];
|
|
@@ -2129,10 +2131,10 @@ function isolatePathParams(nextParams, hostParams) {
|
|
|
2129
2131
|
}
|
|
2130
2132
|
const EMPTY_PANE_PARAMS = {}, CardWithShadowBelow = styled(Card).withConfig({
|
|
2131
2133
|
displayName: "CardWithShadowBelow",
|
|
2132
|
-
componentId: "sc-
|
|
2134
|
+
componentId: "sc-56ewtn-0"
|
|
2133
2135
|
})`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({
|
|
2134
2136
|
displayName: "CardWithShadowAbove",
|
|
2135
|
-
componentId: "sc-
|
|
2137
|
+
componentId: "sc-56ewtn-1"
|
|
2136
2138
|
})`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;}`;
|
|
2137
2139
|
function AssistInspectorWrapper(props) {
|
|
2138
2140
|
let $ = c(43), context = useAiAssistanceConfig();
|
|
@@ -3458,9 +3460,11 @@ function useCustomFieldActions(props) {
|
|
|
3458
3460
|
expanded: !0
|
|
3459
3461
|
}] : []) ?? [];
|
|
3460
3462
|
}, [
|
|
3463
|
+
addSyntheticTask,
|
|
3461
3464
|
configActions,
|
|
3462
3465
|
fieldActions,
|
|
3463
|
-
pushToast
|
|
3466
|
+
pushToast,
|
|
3467
|
+
removeSyntheticTask
|
|
3464
3468
|
]);
|
|
3465
3469
|
}
|
|
3466
3470
|
function createSafeNode(args) {
|
|
@@ -4351,12 +4355,13 @@ function ObjectOutputInput(t0) {
|
|
|
4351
4355
|
useEmptySelectAllValue(value, fields, onChange);
|
|
4352
4356
|
let t2;
|
|
4353
4357
|
$[5] !== fields || $[6] !== onChange || $[7] !== value?.length ? (t2 = (checked, selectedValue) => {
|
|
4354
|
-
if (checked)
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4358
|
+
if (checked) {
|
|
4359
|
+
if (value?.length) onChange(PatchEvent.from(unset([{ _key: selectedValue }])));
|
|
4360
|
+
else {
|
|
4361
|
+
let items = fields.filter((f) => f.name !== selectedValue).map(_temp2$1);
|
|
4362
|
+
onChange(PatchEvent.from([setIfMissing([]), insert(items, "after", [-1])]));
|
|
4363
|
+
}
|
|
4364
|
+
} else {
|
|
4360
4365
|
let patchValue = {
|
|
4361
4366
|
_key: selectedValue,
|
|
4362
4367
|
_type: "sanity.assist.output.field",
|
|
@@ -4404,12 +4409,13 @@ function ArrayOutputInput(t0) {
|
|
|
4404
4409
|
useEmptySelectAllValue(value, ofItems, onChange);
|
|
4405
4410
|
let t2;
|
|
4406
4411
|
$[5] !== ofItems || $[6] !== onChange || $[7] !== value?.length ? (t2 = (checked, selectedValue) => {
|
|
4407
|
-
if (checked)
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4412
|
+
if (checked) {
|
|
4413
|
+
if (value?.length) onChange(PatchEvent.from(unset([{ _key: selectedValue }])));
|
|
4414
|
+
else {
|
|
4415
|
+
let items = ofItems.filter((f) => f.name !== selectedValue).map(_temp4);
|
|
4416
|
+
onChange(PatchEvent.from([setIfMissing([]), insert(items, "after", [-1])]));
|
|
4417
|
+
}
|
|
4418
|
+
} else {
|
|
4413
4419
|
let patchValue = {
|
|
4414
4420
|
_key: selectedValue,
|
|
4415
4421
|
_type: "sanity.assist.output.type",
|
|
@@ -4477,7 +4483,7 @@ function Selectable(t0) {
|
|
|
4477
4483
|
}
|
|
4478
4484
|
const PteMods = styled(Box).withConfig({
|
|
4479
4485
|
displayName: "PteMods",
|
|
4480
|
-
componentId: "sc-
|
|
4486
|
+
componentId: "sc-lrz2c-0"
|
|
4481
4487
|
})`& [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;}`;
|
|
4482
4488
|
function PromptInput(props) {
|
|
4483
4489
|
let $ = c(5);
|
|
@@ -4509,9 +4515,11 @@ function PromptInput(props) {
|
|
|
4509
4515
|
}) }), $[3] = t1, $[4] = t2), t2;
|
|
4510
4516
|
}
|
|
4511
4517
|
function useOnlyInlineBlocks(props) {
|
|
4512
|
-
let $ = c(
|
|
4513
|
-
$[0]
|
|
4514
|
-
|
|
4518
|
+
let $ = c(4), { value, onChange } = props, didRunRef = useRef(!1), t0, t1;
|
|
4519
|
+
$[0] !== onChange || $[1] !== value ? (t0 = () => {
|
|
4520
|
+
if (didRunRef.current) return;
|
|
4521
|
+
didRunRef.current = !0;
|
|
4522
|
+
let needsFix = !1, val = (value ?? []).map((block) => block._type === "block" ? block : (needsFix = !0, typed({
|
|
4515
4523
|
_key: randomKey(12),
|
|
4516
4524
|
_type: "block",
|
|
4517
4525
|
level: 0,
|
|
@@ -4519,10 +4527,8 @@ function useOnlyInlineBlocks(props) {
|
|
|
4519
4527
|
style: "normal",
|
|
4520
4528
|
children: [block]
|
|
4521
4529
|
})));
|
|
4522
|
-
needsFix &&
|
|
4523
|
-
}, $[0] =
|
|
4524
|
-
let t1;
|
|
4525
|
-
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[2] = t1) : t1 = $[2], useEffect(t0, t1);
|
|
4530
|
+
needsFix && onChange(set(val));
|
|
4531
|
+
}, t1 = [onChange, value], $[0] = onChange, $[1] = value, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1);
|
|
4526
4532
|
}
|
|
4527
4533
|
function InstructionsArrayField(props) {
|
|
4528
4534
|
return props.renderDefault({
|