@agent-native/toolkit 0.10.12 → 0.11.2
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 +2 -2
- package/dist/app-shell/sidebar-footer-actions.d.ts +1 -2
- package/dist/app-shell/sidebar-footer-actions.d.ts.map +1 -1
- package/dist/app-shell/sidebar-footer-actions.js +2 -2
- package/dist/app-shell/sidebar-footer-actions.js.map +1 -1
- package/dist/app-shell/sidebar-footer-actions.spec.js +4 -4
- package/dist/app-shell/sidebar-footer-actions.spec.js.map +1 -1
- package/dist/chat-history.css +1 -0
- package/dist/composer/ComposerPlusMenu.d.ts +11 -5
- package/dist/composer/ComposerPlusMenu.d.ts.map +1 -1
- package/dist/composer/ComposerPlusMenu.js +19 -12
- package/dist/composer/ComposerPlusMenu.js.map +1 -1
- package/dist/composer/ComposerPlusMenu.spec.d.ts +2 -0
- package/dist/composer/ComposerPlusMenu.spec.d.ts.map +1 -0
- package/dist/composer/ComposerPlusMenu.spec.js +12 -0
- package/dist/composer/ComposerPlusMenu.spec.js.map +1 -0
- package/dist/composer/PromptComposer.d.ts +4 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -1
- package/dist/composer/PromptComposer.js +2 -2
- package/dist/composer/PromptComposer.js.map +1 -1
- package/dist/composer/TiptapComposer.d.ts +10 -4
- package/dist/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/composer/TiptapComposer.js +2 -2
- package/dist/composer/TiptapComposer.js.map +1 -1
- package/dist/design-tweaks/visual-style-controls.d.ts +11 -4
- package/dist/design-tweaks/visual-style-controls.d.ts.map +1 -1
- package/dist/design-tweaks/visual-style-controls.js +37 -12
- package/dist/design-tweaks/visual-style-controls.js.map +1 -1
- package/dist/design-tweaks/visual-style-controls.spec.d.ts +2 -0
- package/dist/design-tweaks/visual-style-controls.spec.d.ts.map +1 -0
- package/dist/design-tweaks/visual-style-controls.spec.js +58 -0
- package/dist/design-tweaks/visual-style-controls.spec.js.map +1 -0
- package/package.json +1 -1
- package/src/app-shell/sidebar-footer-actions.spec.tsx +3 -5
- package/src/app-shell/sidebar-footer-actions.tsx +0 -3
- package/src/chat-history.css +1 -0
- package/src/composer/ComposerPlusMenu.spec.ts +14 -0
- package/src/composer/ComposerPlusMenu.tsx +35 -14
- package/src/composer/PromptComposer.tsx +6 -0
- package/src/composer/TiptapComposer.tsx +11 -3
- package/src/design-tweaks/visual-style-controls.spec.tsx +112 -0
- package/src/design-tweaks/visual-style-controls.tsx +67 -14
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useState,
|
|
7
7
|
type KeyboardEvent,
|
|
8
8
|
type PointerEvent,
|
|
9
|
+
type ComponentPropsWithoutRef,
|
|
9
10
|
type ReactNode,
|
|
10
11
|
} from "react";
|
|
11
12
|
|
|
@@ -243,11 +244,11 @@ export function VisualInspectorPanel({
|
|
|
243
244
|
return (
|
|
244
245
|
<aside
|
|
245
246
|
className={cn(
|
|
246
|
-
"w-64 overflow-hidden rounded-xl border border-border bg-card/95 text-card-foreground shadow-2xl shadow-black/35 backdrop-blur",
|
|
247
|
+
"flex w-64 flex-col overflow-hidden rounded-xl border border-border bg-card/95 text-card-foreground shadow-2xl shadow-black/35 backdrop-blur",
|
|
247
248
|
className,
|
|
248
249
|
)}
|
|
249
250
|
>
|
|
250
|
-
<div className="flex min-h-10 items-start justify-between gap-2 border-b border-border/70 px-3 py-2.5">
|
|
251
|
+
<div className="flex min-h-10 shrink-0 items-start justify-between gap-2 border-b border-border/70 px-3 py-2.5">
|
|
251
252
|
<div className="min-w-0">
|
|
252
253
|
<div className="truncate text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">
|
|
253
254
|
{title}
|
|
@@ -260,7 +261,7 @@ export function VisualInspectorPanel({
|
|
|
260
261
|
</div>
|
|
261
262
|
{headerAction}
|
|
262
263
|
</div>
|
|
263
|
-
<div className="max-h-[min(680px,calc(100vh-7rem))] overflow-y-auto p-2">
|
|
264
|
+
<div className="min-h-0 flex-[1_1_auto] max-h-[min(680px,calc(100vh-7rem))] overflow-y-auto p-2">
|
|
264
265
|
{children}
|
|
265
266
|
</div>
|
|
266
267
|
</aside>
|
|
@@ -362,6 +363,10 @@ export function VisualColorPicker({
|
|
|
362
363
|
documentColorsLabel = "Document colors",
|
|
363
364
|
transparentLabel = "Transparent",
|
|
364
365
|
className,
|
|
366
|
+
contentProps,
|
|
367
|
+
mixed = false,
|
|
368
|
+
mixedLabel = "Mixed",
|
|
369
|
+
variant = "outline",
|
|
365
370
|
}: {
|
|
366
371
|
label: string;
|
|
367
372
|
value: string;
|
|
@@ -372,6 +377,14 @@ export function VisualColorPicker({
|
|
|
372
377
|
documentColorsLabel?: string;
|
|
373
378
|
transparentLabel?: string;
|
|
374
379
|
className?: string;
|
|
380
|
+
contentProps?: Omit<
|
|
381
|
+
ComponentPropsWithoutRef<typeof PopoverContent>,
|
|
382
|
+
"children"
|
|
383
|
+
> &
|
|
384
|
+
Record<`data-${string}`, string | undefined>;
|
|
385
|
+
mixed?: boolean;
|
|
386
|
+
mixedLabel?: string;
|
|
387
|
+
variant?: "outline" | "filled";
|
|
375
388
|
}) {
|
|
376
389
|
const [open, setOpen] = useState(false);
|
|
377
390
|
const color = parseCssColor(value) ?? FALLBACK_RGBA;
|
|
@@ -433,11 +446,14 @@ export function VisualColorPicker({
|
|
|
433
446
|
.filter(Boolean) as string[],
|
|
434
447
|
),
|
|
435
448
|
).slice(0, 16);
|
|
436
|
-
const displayValue =
|
|
437
|
-
|
|
449
|
+
const displayValue = mixed
|
|
450
|
+
? mixedLabel
|
|
451
|
+
: value === "transparent" || color.a === 0
|
|
438
452
|
? transparentLabel
|
|
439
453
|
: colorHex.replace(/^#/, "");
|
|
440
454
|
const hsv = rgbaToHsv(color);
|
|
455
|
+
const { className: contentClassName, ...popoverContentProps } =
|
|
456
|
+
contentProps ?? {};
|
|
441
457
|
|
|
442
458
|
return (
|
|
443
459
|
<Popover open={open} onOpenChange={setOpen}>
|
|
@@ -446,13 +462,16 @@ export function VisualColorPicker({
|
|
|
446
462
|
type="button"
|
|
447
463
|
aria-label={label}
|
|
448
464
|
className={cn(
|
|
449
|
-
"flex h-7 w-full cursor-pointer items-center gap-1.5 rounded-md
|
|
465
|
+
"flex h-7 w-full cursor-pointer items-center gap-1.5 rounded-md px-2 text-[11px] shadow-none transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
466
|
+
variant === "filled"
|
|
467
|
+
? "border-0 bg-muted/80 hover:bg-muted"
|
|
468
|
+
: "border border-border bg-background/70 hover:bg-accent/60",
|
|
450
469
|
className,
|
|
451
470
|
)}
|
|
452
471
|
>
|
|
453
472
|
<span
|
|
454
473
|
className="size-4 shrink-0 rounded-[3px] border border-border/70"
|
|
455
|
-
style={swatchBackground(value)}
|
|
474
|
+
style={swatchBackground(mixed ? "transparent" : value)}
|
|
456
475
|
/>
|
|
457
476
|
<span className="min-w-0 flex-1 truncate text-left font-medium tabular-nums text-foreground">
|
|
458
477
|
{displayValue}
|
|
@@ -467,8 +486,12 @@ export function VisualColorPicker({
|
|
|
467
486
|
side="left"
|
|
468
487
|
align="start"
|
|
469
488
|
sideOffset={8}
|
|
470
|
-
className=
|
|
489
|
+
className={cn(
|
|
490
|
+
"z-[10000] w-[252px] p-0 text-[11px] shadow-xl",
|
|
491
|
+
contentClassName,
|
|
492
|
+
)}
|
|
471
493
|
onFocusOutside={(event) => event.preventDefault()}
|
|
494
|
+
{...popoverContentProps}
|
|
472
495
|
>
|
|
473
496
|
<div className="rounded-md bg-popover text-popover-foreground">
|
|
474
497
|
<VisualSaturationBrightnessField
|
|
@@ -788,7 +811,7 @@ export function VisualSegmentedControl({
|
|
|
788
811
|
className,
|
|
789
812
|
}: {
|
|
790
813
|
options: VisualControlOption[];
|
|
791
|
-
value: string;
|
|
814
|
+
value: string | null;
|
|
792
815
|
onChange: (value: string) => void;
|
|
793
816
|
className?: string;
|
|
794
817
|
}) {
|
|
@@ -889,6 +912,8 @@ export function VisualScrubInput({
|
|
|
889
912
|
step = 1,
|
|
890
913
|
unit,
|
|
891
914
|
disabled = false,
|
|
915
|
+
mixed = false,
|
|
916
|
+
mixedLabel = "Mixed",
|
|
892
917
|
}: {
|
|
893
918
|
label: string;
|
|
894
919
|
value: number;
|
|
@@ -898,10 +923,15 @@ export function VisualScrubInput({
|
|
|
898
923
|
step?: number;
|
|
899
924
|
unit?: string;
|
|
900
925
|
disabled?: boolean;
|
|
926
|
+
mixed?: boolean;
|
|
927
|
+
mixedLabel?: string;
|
|
901
928
|
}) {
|
|
902
929
|
const id = useId();
|
|
903
|
-
const [draft, setDraft] = useState(() =>
|
|
930
|
+
const [draft, setDraft] = useState(() =>
|
|
931
|
+
mixed ? mixedLabel : formatNumber(value, unit),
|
|
932
|
+
);
|
|
904
933
|
const [focused, setFocused] = useState(false);
|
|
934
|
+
const [hasInteracted, setHasInteracted] = useState(false);
|
|
905
935
|
const dragRef = useRef<{
|
|
906
936
|
pointerId: number;
|
|
907
937
|
prevX: number;
|
|
@@ -909,8 +939,23 @@ export function VisualScrubInput({
|
|
|
909
939
|
} | null>(null);
|
|
910
940
|
|
|
911
941
|
useEffect(() => {
|
|
912
|
-
if (!focused)
|
|
913
|
-
|
|
942
|
+
if (!focused) {
|
|
943
|
+
setDraft(
|
|
944
|
+
mixed && !hasInteracted ? mixedLabel : formatNumber(value, unit),
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
}, [focused, hasInteracted, mixed, mixedLabel, unit, value]);
|
|
948
|
+
|
|
949
|
+
useEffect(() => {
|
|
950
|
+
if (mixed) setHasInteracted(false);
|
|
951
|
+
}, [mixed]);
|
|
952
|
+
|
|
953
|
+
const startInteraction = () => {
|
|
954
|
+
if (!hasInteracted) {
|
|
955
|
+
setHasInteracted(true);
|
|
956
|
+
setDraft(formatNumber(value, unit));
|
|
957
|
+
}
|
|
958
|
+
};
|
|
914
959
|
|
|
915
960
|
const commit = (nextDraft = draft) => {
|
|
916
961
|
const parsed = parseDraftNumber(nextDraft, value);
|
|
@@ -926,6 +971,7 @@ export function VisualScrubInput({
|
|
|
926
971
|
};
|
|
927
972
|
|
|
928
973
|
const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
|
974
|
+
startInteraction();
|
|
929
975
|
if (event.key === "Enter") {
|
|
930
976
|
event.preventDefault();
|
|
931
977
|
commit();
|
|
@@ -951,6 +997,7 @@ export function VisualScrubInput({
|
|
|
951
997
|
const onPointerDown = (event: PointerEvent<HTMLLabelElement>) => {
|
|
952
998
|
if (disabled || event.button !== 0) return;
|
|
953
999
|
event.preventDefault();
|
|
1000
|
+
startInteraction();
|
|
954
1001
|
dragRef.current = {
|
|
955
1002
|
pointerId: event.pointerId,
|
|
956
1003
|
prevX: event.clientX,
|
|
@@ -998,12 +1045,18 @@ export function VisualScrubInput({
|
|
|
998
1045
|
id={id}
|
|
999
1046
|
value={draft}
|
|
1000
1047
|
disabled={disabled}
|
|
1001
|
-
onFocus={() =>
|
|
1048
|
+
onFocus={() => {
|
|
1049
|
+
setFocused(true);
|
|
1050
|
+
startInteraction();
|
|
1051
|
+
}}
|
|
1002
1052
|
onBlur={() => {
|
|
1003
1053
|
setFocused(false);
|
|
1004
1054
|
commit();
|
|
1005
1055
|
}}
|
|
1006
|
-
onChange={(event) =>
|
|
1056
|
+
onChange={(event) => {
|
|
1057
|
+
startInteraction();
|
|
1058
|
+
setDraft(event.currentTarget.value);
|
|
1059
|
+
}}
|
|
1007
1060
|
onKeyDown={onKeyDown}
|
|
1008
1061
|
className="h-7 min-w-0 flex-1 rounded-md border border-input bg-background/70 px-2 text-right text-[11px] tabular-nums text-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring disabled:opacity-50"
|
|
1009
1062
|
/>
|