@juspay/svelte-ui-components 3.5.0 → 3.5.1
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 +1 -1
- package/dist/Accordion/Accordion.svelte +1 -5
- package/dist/Accordion/properties.d.ts +0 -1
- package/dist/AreaChart/AreaChart.svelte +2 -8
- package/dist/AreaChart/properties.d.ts +0 -10
- package/dist/AttachmentChipRow/AttachmentChipRow.svelte +30 -30
- package/dist/AttachmentChipRow/properties.d.ts +6 -6
- package/dist/Banner/Banner.svelte +1 -5
- package/dist/Banner/properties.d.ts +0 -1
- package/dist/BarChart/BarChart.svelte +7 -13
- package/dist/BarChart/properties.d.ts +1 -9
- package/dist/Book/Book.svelte +1 -5
- package/dist/Book/properties.d.ts +0 -1
- package/dist/Calendar/Calendar.svelte +3 -11
- package/dist/Calendar/properties.d.ts +0 -11
- package/dist/Chat/Chat.svelte +9 -29
- package/dist/Chat/properties.d.ts +0 -9
- package/dist/Chat/types.d.ts +7 -0
- package/dist/ChatBubble/ChatBubble.svelte +3 -11
- package/dist/ChatBubble/properties.d.ts +0 -3
- package/dist/ChatComposer/ChatComposer.svelte +18 -44
- package/dist/ChatComposer/properties.d.ts +0 -12
- package/dist/ChatHeader/ChatHeader.svelte +1 -5
- package/dist/ChatHeader/properties.d.ts +0 -1
- package/dist/ChatMessage/ChatMessage.svelte +87 -11
- package/dist/ChatMessage/properties.d.ts +18 -3
- package/dist/ChatMessageList/ChatMessageList.svelte +5 -11
- package/dist/ChatMessageList/properties.d.ts +0 -6
- package/dist/ChatSuggestions/ChatSuggestions.svelte +1 -5
- package/dist/ChatSuggestions/properties.d.ts +0 -1
- package/dist/CheckListItem/CheckListItem.svelte +1 -5
- package/dist/CheckListItem/properties.d.ts +0 -1
- package/dist/Checkbox/Checkbox.svelte +1 -5
- package/dist/Checkbox/properties.d.ts +0 -1
- package/dist/ChipInput/ChipInput.svelte +10 -20
- package/dist/ChipInput/properties.d.ts +0 -4
- package/dist/Choicebox/Choicebox.svelte +1 -5
- package/dist/Choicebox/properties.d.ts +0 -1
- package/dist/ColorPicker/ColorPicker.svelte +4 -10
- package/dist/ColorPicker/properties.d.ts +0 -2
- package/dist/Combobox/Combobox.svelte +15 -33
- package/dist/Combobox/properties.d.ts +0 -8
- package/dist/CommandMenu/CommandMenu.svelte +2 -8
- package/dist/CommandMenu/properties.d.ts +0 -2
- package/dist/ContextMenu/ContextMenu.svelte +3 -11
- package/dist/ContextMenu/properties.d.ts +0 -3
- package/dist/DateRangePicker/DateRangePicker.svelte +6 -20
- package/dist/DateRangePicker/properties.d.ts +0 -19
- package/dist/Draggable/Draggable.svelte +7 -7
- package/dist/Draggable/properties.d.ts +3 -3
- package/dist/DualAxisBarChart/DualAxisBarChart.svelte +1 -5
- package/dist/DualAxisBarChart/properties.d.ts +0 -4
- package/dist/FileDropzoneTrigger/FileDropzoneTrigger.svelte +1 -5
- package/dist/FileDropzoneTrigger/properties.d.ts +0 -1
- package/dist/FileInput/FileInput.svelte +2 -8
- package/dist/FileInput/properties.d.ts +0 -2
- package/dist/FunnelChart/FunnelChart.svelte +2 -8
- package/dist/FunnelChart/properties.d.ts +0 -8
- package/dist/Gallery/Gallery.svelte +15 -15
- package/dist/Gallery/properties.d.ts +6 -6
- package/dist/HITL/HITL.svelte +10 -8
- package/dist/HITL/properties.d.ts +2 -2
- package/dist/IframeViewer/IframeViewer.svelte +3 -2
- package/dist/IframeViewer/properties.d.ts +1 -1
- package/dist/Img/Img.svelte +119 -39
- package/dist/Img/properties.d.ts +0 -1
- package/dist/Input/Input.svelte +22 -37
- package/dist/Input/properties.d.ts +3 -10
- package/dist/InputButton/InputButton.svelte +2 -2
- package/dist/LineChart/LineChart.svelte +4 -10
- package/dist/LineChart/properties.d.ts +1 -11
- package/dist/ListItem/ListItem.svelte +10 -22
- package/dist/ListItem/properties.d.ts +5 -10
- package/dist/LottiePlayer/LottiePlayer.svelte +2 -8
- package/dist/LottiePlayer/properties.d.ts +0 -2
- package/dist/MediaPlayer/MediaPlayer.svelte +1 -5
- package/dist/MediaPlayer/properties.d.ts +0 -1
- package/dist/MediaUpload/MediaUpload.svelte +6 -6
- package/dist/MediaUpload/properties.d.ts +3 -3
- package/dist/Menu/Menu.svelte +3 -11
- package/dist/Menu/properties.d.ts +0 -3
- package/dist/Modal/Modal.svelte +15 -31
- package/dist/Modal/properties.d.ts +5 -11
- package/dist/Pagination/Pagination.svelte +3 -7
- package/dist/Pagination/properties.d.ts +1 -2
- package/dist/PieChart/PieChart.svelte +4 -10
- package/dist/PieChart/properties.d.ts +1 -9
- package/dist/Pill/Pill.svelte +1 -5
- package/dist/Pill/properties.d.ts +0 -1
- package/dist/Radio/Radio.svelte +1 -5
- package/dist/Radio/properties.d.ts +0 -1
- package/dist/Resizable/Resizable.svelte +3 -11
- package/dist/Resizable/properties.d.ts +0 -3
- package/dist/SankeyChart/SankeyChart.svelte +4 -14
- package/dist/SankeyChart/properties.d.ts +0 -12
- package/dist/Scroller/Scroller.svelte +1 -5
- package/dist/Scroller/properties.d.ts +0 -1
- package/dist/Select/Select.svelte +3 -11
- package/dist/Select/properties.d.ts +0 -3
- package/dist/Sheet/Sheet.svelte +3 -11
- package/dist/Sheet/properties.d.ts +0 -3
- package/dist/Slider/Slider.svelte +2 -8
- package/dist/Slider/properties.d.ts +0 -2
- package/dist/Snippet/Snippet.svelte +1 -5
- package/dist/Snippet/properties.d.ts +0 -1
- package/dist/SplitButton/SplitButton.svelte +1 -5
- package/dist/SplitButton/properties.d.ts +0 -1
- package/dist/SplitInput/SplitInput.svelte +6 -14
- package/dist/SplitInput/properties.d.ts +0 -3
- package/dist/StatCard/StatCard.svelte +2 -2
- package/dist/StatCard/properties.d.ts +1 -1
- package/dist/Status/Status.svelte +2 -6
- package/dist/Status/properties.d.ts +1 -2
- package/dist/Stepper/Stepper.svelte +2 -12
- package/dist/Stepper/properties.d.ts +1 -14
- package/dist/Table/BuiltinCell.svelte +1 -1
- package/dist/Table/Table.svelte +16 -17
- package/dist/Table/properties.d.ts +3 -35
- package/dist/Tabs/Tabs.svelte +2 -8
- package/dist/Tabs/properties.d.ts +0 -2
- package/dist/TaskList/TaskList.svelte +1 -4
- package/dist/TaskList/properties.d.ts +0 -1
- package/dist/ThemeSwitcher/ThemeSwitcher.svelte +1 -5
- package/dist/ThemeSwitcher/properties.d.ts +0 -1
- package/dist/ThinkingIndicator/ThinkingIndicator.svelte +4 -10
- package/dist/ThinkingIndicator/properties.d.ts +1 -3
- package/dist/Toast/Toast.svelte +2 -2
- package/dist/Toast/properties.d.ts +1 -1
- package/dist/Toggle/Toggle.svelte +1 -5
- package/dist/Toggle/properties.d.ts +0 -1
- package/dist/ToolCallLog/ToolCallLog.svelte +1 -10
- package/dist/ToolCallLog/properties.d.ts +0 -1
- package/dist/Toolbar/Toolbar.svelte +2 -6
- package/dist/Toolbar/properties.d.ts +1 -2
- package/dist/TypewriterText/TypewriterText.svelte +3 -3
- package/dist/TypewriterText/properties.d.ts +1 -1
- package/dist-codemod/bin.js +32 -0
- package/dist-codemod/cli.js +175 -0
- package/dist-codemod/legacy-pairs.js +228 -0
- package/dist-codemod/transform.js +278 -0
- package/dist-codemod/wc-children.js +66 -0
- package/dist-wc/index.js +4458 -5127
- package/package.json +9 -7
- package/scripts/postinstall.mjs +14 -12
- package/dist/deprecation.d.ts +0 -42
- package/dist/deprecation.js +0 -57
- package/scripts/codemod/README.md +0 -76
- package/scripts/codemod/cli.ts +0 -206
- package/scripts/codemod/map.ts +0 -118
- package/scripts/codemod/transform.ts +0 -549
- package/scripts/codemod/tsconfig.json +0 -15
- package/scripts/codemod/wc-children.ts +0 -75
|
@@ -8,20 +8,12 @@
|
|
|
8
8
|
maxHeight = '240px',
|
|
9
9
|
testId,
|
|
10
10
|
children,
|
|
11
|
-
onselect
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onOpen,
|
|
15
|
-
onclose: oncloseLegacy,
|
|
16
|
-
onClose,
|
|
11
|
+
onselect,
|
|
12
|
+
onopen,
|
|
13
|
+
onclose,
|
|
17
14
|
classes
|
|
18
15
|
}: ContextMenuProperties = $props();
|
|
19
16
|
|
|
20
|
-
// Event-casing phase 1: both spellings accepted, the correct one wins.
|
|
21
|
-
const onclose = $derived(onClose ?? oncloseLegacy);
|
|
22
|
-
const onopen = $derived(onOpen ?? onopenLegacy);
|
|
23
|
-
const onselect = $derived(onSelect ?? onselectLegacy);
|
|
24
|
-
|
|
25
17
|
let menuEl: HTMLDivElement | null = $state(null);
|
|
26
18
|
let containerEl: HTMLDivElement | null = $state(null);
|
|
27
19
|
let focusedIndex: number = $state(-1);
|
|
@@ -21,9 +21,6 @@ export type OptionalContextMenuProperties = {
|
|
|
21
21
|
};
|
|
22
22
|
export type ContextMenuEventProperties = {
|
|
23
23
|
onselect?: (item: ContextMenuItem) => void;
|
|
24
|
-
onSelect?: (item: ContextMenuItem) => void;
|
|
25
24
|
onopen?: () => void;
|
|
26
|
-
onOpen?: () => void;
|
|
27
25
|
onclose?: () => void;
|
|
28
|
-
onClose?: () => void;
|
|
29
26
|
};
|
|
@@ -54,28 +54,14 @@
|
|
|
54
54
|
initialPresetLabel,
|
|
55
55
|
compareTrigger,
|
|
56
56
|
openCompare = $bindable(false),
|
|
57
|
-
onapply
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
oncancel: oncancelLegacy,
|
|
64
|
-
onCancel,
|
|
65
|
-
onopentoggle: onopentoggleLegacy,
|
|
66
|
-
onOpenToggle,
|
|
67
|
-
onclear: onclearLegacy,
|
|
68
|
-
onClear
|
|
57
|
+
onapply,
|
|
58
|
+
onapplysingle,
|
|
59
|
+
onapplycompare,
|
|
60
|
+
oncancel,
|
|
61
|
+
onopentoggle,
|
|
62
|
+
onclear
|
|
69
63
|
}: DateRangePickerProperties = $props();
|
|
70
64
|
|
|
71
|
-
// Event-casing phase 1: both spellings accepted, the correct one wins.
|
|
72
|
-
const onapply = $derived(onApply ?? onapplyLegacy);
|
|
73
|
-
const onapplycompare = $derived(onApplyCompare ?? onapplycompareLegacy);
|
|
74
|
-
const onapplysingle = $derived(onApplySingle ?? onapplysingleLegacy);
|
|
75
|
-
const oncancel = $derived(onCancel ?? oncancelLegacy);
|
|
76
|
-
const onclear = $derived(onClear ?? onclearLegacy);
|
|
77
|
-
const onopentoggle = $derived(onOpenToggle ?? onopentoggleLegacy);
|
|
78
|
-
|
|
79
65
|
const isDualMonth: boolean = $derived(
|
|
80
66
|
typeof dualMonth === 'boolean' ? dualMonth : mode === 'range'
|
|
81
67
|
);
|
|
@@ -138,46 +138,27 @@ export type DateRangePickerEventProperties = {
|
|
|
138
138
|
rangeEnd: Date;
|
|
139
139
|
presetLabel: string | null;
|
|
140
140
|
}) => void;
|
|
141
|
-
onApply?: (event: {
|
|
142
|
-
rangeStart: Date;
|
|
143
|
-
rangeEnd: Date;
|
|
144
|
-
presetLabel: string | null;
|
|
145
|
-
}) => void;
|
|
146
141
|
/** Fired when the user clicks Apply in single mode. presetLabel is the sidebar preset name if one was active, or null for a custom calendar selection. */
|
|
147
142
|
onapplysingle?: (event: {
|
|
148
143
|
date: Date;
|
|
149
144
|
presetLabel: string | null;
|
|
150
145
|
}) => void;
|
|
151
|
-
onApplySingle?: (event: {
|
|
152
|
-
date: Date;
|
|
153
|
-
presetLabel: string | null;
|
|
154
|
-
}) => void;
|
|
155
146
|
/** Fired when the compare range is applied. presetLabel is the sidebar preset name if one was active, or null for a custom calendar selection. */
|
|
156
147
|
onapplycompare?: (event: {
|
|
157
148
|
compareStart: Date;
|
|
158
149
|
compareEnd: Date;
|
|
159
150
|
presetLabel: string | null;
|
|
160
151
|
}) => void;
|
|
161
|
-
onApplyCompare?: (event: {
|
|
162
|
-
compareStart: Date;
|
|
163
|
-
compareEnd: Date;
|
|
164
|
-
presetLabel: string | null;
|
|
165
|
-
}) => void;
|
|
166
152
|
/** Fired when the user dismisses without applying. */
|
|
167
153
|
oncancel?: () => void;
|
|
168
|
-
onCancel?: () => void;
|
|
169
154
|
/** Fired whenever the picker opens or closes. */
|
|
170
155
|
onopentoggle?: (event: {
|
|
171
156
|
open: boolean;
|
|
172
157
|
}) => void;
|
|
173
|
-
onOpenToggle?: (event: {
|
|
174
|
-
open: boolean;
|
|
175
|
-
}) => void;
|
|
176
158
|
/**
|
|
177
159
|
* Fired when the user clicks the Clear button in single mode (requires clearable=true).
|
|
178
160
|
* value is reset to null before this callback is invoked.
|
|
179
161
|
*/
|
|
180
162
|
onclear?: () => void;
|
|
181
|
-
onClear?: () => void;
|
|
182
163
|
};
|
|
183
164
|
export type DateRangePickerProperties = OptionalDateRangePickerProperties & DateRangePickerEventProperties;
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
step = 16,
|
|
12
12
|
dragLabel = 'Drag to move',
|
|
13
13
|
children,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
onmovestart,
|
|
15
|
+
onmove,
|
|
16
|
+
onmoveend,
|
|
17
17
|
testId,
|
|
18
18
|
classes
|
|
19
19
|
}: DraggableProperties = $props();
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
baseY: y
|
|
74
74
|
};
|
|
75
75
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
76
|
-
|
|
76
|
+
onmovestart?.({ x, y });
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function moveDrag(event: PointerEvent & { currentTarget: HTMLElement }): void {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
const clamped = clamp(event.currentTarget, nextX, nextY);
|
|
86
86
|
x = clamped.x;
|
|
87
87
|
y = clamped.y;
|
|
88
|
-
|
|
88
|
+
onmove?.({ x, y });
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
function endDrag(event: PointerEvent & { currentTarget: HTMLElement }): void {
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
97
97
|
}
|
|
98
98
|
active = null;
|
|
99
|
-
|
|
99
|
+
onmoveend?.({ x, y });
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
function keyDrag(event: KeyboardEvent & { currentTarget: HTMLElement }): void {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
const clamped = clamp(event.currentTarget, nextX, nextY);
|
|
125
125
|
x = clamped.x;
|
|
126
126
|
y = clamped.y;
|
|
127
|
-
|
|
127
|
+
onmove?.({ x, y });
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
</script>
|
|
@@ -20,7 +20,7 @@ export type OptionalDraggableProperties = {
|
|
|
20
20
|
classes?: string;
|
|
21
21
|
};
|
|
22
22
|
export type DraggableEventProperties = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
onmovestart?: (position: DragPosition) => void;
|
|
24
|
+
onmove?: (position: DragPosition) => void;
|
|
25
|
+
onmoveend?: (position: DragPosition) => void;
|
|
26
26
|
};
|
|
@@ -53,15 +53,11 @@
|
|
|
53
53
|
interactiveLegend = false,
|
|
54
54
|
hideLegendBelow = 360,
|
|
55
55
|
tooltipSnippet,
|
|
56
|
-
onbarclick
|
|
57
|
-
onBarClick,
|
|
56
|
+
onbarclick,
|
|
58
57
|
testId,
|
|
59
58
|
classes
|
|
60
59
|
}: DualAxisBarChartProperties = $props();
|
|
61
60
|
|
|
62
|
-
// Event-casing phase 1: both spellings accepted, the correct one wins.
|
|
63
|
-
const onbarclick = $derived(onBarClick ?? onbarclickLegacy);
|
|
64
|
-
|
|
65
61
|
// ── State ──────────────────────────────────────────────────────
|
|
66
62
|
|
|
67
63
|
let containerEl: HTMLDivElement | null = $state(null);
|
|
@@ -8,14 +8,10 @@
|
|
|
8
8
|
heading,
|
|
9
9
|
caption,
|
|
10
10
|
compact = false,
|
|
11
|
-
onclick
|
|
12
|
-
onClick,
|
|
11
|
+
onclick,
|
|
13
12
|
testId,
|
|
14
13
|
classes
|
|
15
14
|
}: FileDropzoneTriggerProperties = $props();
|
|
16
|
-
|
|
17
|
-
// Event-casing phase 1: both spellings accepted, the correct one wins.
|
|
18
|
-
const onclick = $derived(onClick ?? onclickLegacy);
|
|
19
15
|
</script>
|
|
20
16
|
|
|
21
17
|
{#if compact}
|
|
@@ -21,5 +21,4 @@ export type OptionalFileDropzoneTriggerProperties = {
|
|
|
21
21
|
export type FileDropzoneTriggerEventProperties = {
|
|
22
22
|
/** Wire to `FileInput`'s `openFilePicker`. Non-compact only — compact relies on `FileInput`'s own whole-area click/drop handling. */
|
|
23
23
|
onclick?: () => void;
|
|
24
|
-
onClick?: () => void;
|
|
25
24
|
};
|
|
@@ -9,16 +9,10 @@
|
|
|
9
9
|
disabled = false,
|
|
10
10
|
testId,
|
|
11
11
|
classes,
|
|
12
|
-
onfiles
|
|
13
|
-
|
|
14
|
-
onerror: onerrorLegacy,
|
|
15
|
-
onError
|
|
12
|
+
onfiles,
|
|
13
|
+
onerror
|
|
16
14
|
}: FileInputProperties = $props();
|
|
17
15
|
|
|
18
|
-
// Event-casing phase 1: both spellings accepted, the correct one wins.
|
|
19
|
-
const onerror = $derived(onError ?? onerrorLegacy);
|
|
20
|
-
const onfiles = $derived(onFiles ?? onfilesLegacy);
|
|
21
|
-
|
|
22
16
|
let dragOver = $state(false);
|
|
23
17
|
let inputEl: HTMLInputElement | null = $state(null);
|
|
24
18
|
let pickerBusy = false;
|
|
@@ -28,16 +28,10 @@
|
|
|
28
28
|
testId,
|
|
29
29
|
classes,
|
|
30
30
|
empty,
|
|
31
|
-
onstageclick
|
|
32
|
-
|
|
33
|
-
onstagehover: onstagehoverLegacy,
|
|
34
|
-
onStageHover
|
|
31
|
+
onstageclick,
|
|
32
|
+
onstagehover
|
|
35
33
|
}: FunnelChartProperties = $props();
|
|
36
34
|
|
|
37
|
-
// Event-casing phase 1: both spellings accepted, the correct one wins.
|
|
38
|
-
const onstageclick = $derived(onStageClick ?? onstageclickLegacy);
|
|
39
|
-
const onstagehover = $derived(onStageHover ?? onstagehoverLegacy);
|
|
40
|
-
|
|
41
35
|
// ── State ──────────────────────────────────────────────────────
|
|
42
36
|
|
|
43
37
|
let containerEl: HTMLDivElement | null = $state(null);
|
|
@@ -78,17 +78,9 @@ export type FunnelChartEventProperties = {
|
|
|
78
78
|
index: number;
|
|
79
79
|
stage: FunnelStage;
|
|
80
80
|
}) => void;
|
|
81
|
-
onStageClick?: (event: {
|
|
82
|
-
index: number;
|
|
83
|
-
stage: FunnelStage;
|
|
84
|
-
}) => void;
|
|
85
81
|
/** Fires when the user hovers over or leaves a stage bar. `null` on leave. */
|
|
86
82
|
onstagehover?: (event: {
|
|
87
83
|
index: number;
|
|
88
84
|
stage: FunnelStage;
|
|
89
85
|
} | null) => void;
|
|
90
|
-
onStageHover?: (event: {
|
|
91
|
-
index: number;
|
|
92
|
-
stage: FunnelStage;
|
|
93
|
-
} | null) => void;
|
|
94
86
|
};
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
deleteIcon,
|
|
29
29
|
itemFooter,
|
|
30
30
|
testId,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
onimageclick,
|
|
32
|
+
oneditclick,
|
|
33
|
+
ondeleteclick,
|
|
34
|
+
onopen,
|
|
35
|
+
onclose,
|
|
36
|
+
onchange,
|
|
37
37
|
onkeydown,
|
|
38
38
|
classes
|
|
39
39
|
}: GalleryProperties = $props();
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
let activeImage = $derived(images.at(activeIndex));
|
|
48
48
|
let hasPrevious = $derived(loop ? images.length > 1 : activeIndex > 0);
|
|
49
49
|
let hasNext = $derived(loop ? images.length > 1 : activeIndex < images.length - 1);
|
|
50
|
-
let itemsAreInteractive = $derived(enableLightbox || typeof
|
|
50
|
+
let itemsAreInteractive = $derived(enableLightbox || typeof onimageclick === 'function');
|
|
51
51
|
let hasItemFooter = $derived(view === 'grid' && typeof itemFooter === 'function');
|
|
52
|
-
let showEditButton = $derived(typeof
|
|
53
|
-
let showDeleteButton = $derived(typeof
|
|
52
|
+
let showEditButton = $derived(typeof oneditclick === 'function');
|
|
53
|
+
let showDeleteButton = $derived(typeof ondeleteclick === 'function');
|
|
54
54
|
let showItemActions = $derived(showEditButton || showDeleteButton);
|
|
55
55
|
|
|
56
56
|
function lightboxAction(node: HTMLElement) {
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
}
|
|
79
79
|
activeIndex = index;
|
|
80
80
|
open = true;
|
|
81
|
-
|
|
81
|
+
onopen?.(index);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function closeLightbox(): void {
|
|
85
85
|
open = false;
|
|
86
|
-
|
|
86
|
+
onclose?.();
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
async function goToIndex(index: number): Promise<void> {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
activeIndex = index;
|
|
94
|
-
|
|
94
|
+
onchange?.(activeIndex);
|
|
95
95
|
await tick();
|
|
96
96
|
if (lightboxDiv !== null && !lightboxDiv.contains(document.activeElement)) {
|
|
97
97
|
lightboxDiv.focus();
|
|
@@ -115,18 +115,18 @@
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
function handleImageClick(index: number, event: MouseEvent): void {
|
|
118
|
-
|
|
118
|
+
onimageclick?.(index, event);
|
|
119
119
|
if (enableLightbox) {
|
|
120
120
|
openLightbox(index, event.currentTarget);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
function handleEditClick(index: number, event: MouseEvent): void {
|
|
125
|
-
|
|
125
|
+
oneditclick?.(index, event);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
function handleDeleteClick(index: number, event: MouseEvent): void {
|
|
129
|
-
|
|
129
|
+
ondeleteclick?.(index, event);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function trapFocus(event: KeyboardEvent): void {
|
|
@@ -29,11 +29,11 @@ export type OptionalGalleryProperties = {
|
|
|
29
29
|
classes?: string;
|
|
30
30
|
};
|
|
31
31
|
export type GalleryEventProperties = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
onimageclick?: (index: number, event: MouseEvent) => void;
|
|
33
|
+
oneditclick?: (index: number, event: MouseEvent) => void;
|
|
34
|
+
ondeleteclick?: (index: number, event: MouseEvent) => void;
|
|
35
|
+
onopen?: (index: number) => void;
|
|
36
|
+
onclose?: () => void;
|
|
37
|
+
onchange?: (index: number) => void;
|
|
38
38
|
onkeydown?: (event: KeyboardEvent) => void;
|
|
39
39
|
};
|
package/dist/HITL/HITL.svelte
CHANGED
|
@@ -20,13 +20,15 @@
|
|
|
20
20
|
sections,
|
|
21
21
|
functionArguments,
|
|
22
22
|
hiddenKeys,
|
|
23
|
-
|
|
23
|
+
onconfirm,
|
|
24
24
|
confirmLabel = 'Confirm',
|
|
25
25
|
cancelLabel = 'Cancel',
|
|
26
26
|
countdownSeconds = 10,
|
|
27
27
|
autoCancelSeconds = 0,
|
|
28
28
|
isMicMuted = false,
|
|
29
|
-
|
|
29
|
+
// The resolver this replaced defaulted to null, and the call sites test for
|
|
30
|
+
// exactly null before awaiting it.
|
|
31
|
+
onmictoggle = null,
|
|
30
32
|
isHistoryMode = false,
|
|
31
33
|
initialState = null,
|
|
32
34
|
approvedIcon,
|
|
@@ -66,7 +68,7 @@
|
|
|
66
68
|
// History mode renders the settled state from props; live mode from local state.
|
|
67
69
|
// A history card with no initialState renders as expired rather than falling
|
|
68
70
|
// through to the pending interactive card — a replayed card must never be able
|
|
69
|
-
// to fire
|
|
71
|
+
// to fire onconfirm.
|
|
70
72
|
const userResponse = $derived.by((): HITLResponse | null => {
|
|
71
73
|
if (isHistoryMode) {
|
|
72
74
|
if (initialState === null) {
|
|
@@ -109,9 +111,9 @@
|
|
|
109
111
|
};
|
|
110
112
|
|
|
111
113
|
const restoreMicState = async (): Promise<void> => {
|
|
112
|
-
if (
|
|
114
|
+
if (onmictoggle !== null && originalMicState !== null && isMicMuted !== originalMicState) {
|
|
113
115
|
try {
|
|
114
|
-
await
|
|
116
|
+
await onmictoggle();
|
|
115
117
|
} catch {
|
|
116
118
|
// Mic restoration is best-effort; a failure must not block the decision.
|
|
117
119
|
}
|
|
@@ -131,7 +133,7 @@
|
|
|
131
133
|
localResponse = action;
|
|
132
134
|
isProcessing = true;
|
|
133
135
|
try {
|
|
134
|
-
|
|
136
|
+
onconfirm?.({
|
|
135
137
|
confirmationId,
|
|
136
138
|
action,
|
|
137
139
|
approved: action !== 'rejected'
|
|
@@ -182,10 +184,10 @@
|
|
|
182
184
|
if (isHistoryMode) {
|
|
183
185
|
return;
|
|
184
186
|
}
|
|
185
|
-
if (
|
|
187
|
+
if (onmictoggle !== null) {
|
|
186
188
|
originalMicState = isMicMuted;
|
|
187
189
|
if (!isMicMuted) {
|
|
188
|
-
void Promise.resolve(
|
|
190
|
+
void Promise.resolve(onmictoggle()).catch(() => {
|
|
189
191
|
// Auto-mute is best-effort.
|
|
190
192
|
});
|
|
191
193
|
}
|
|
@@ -32,7 +32,7 @@ export type OptionalHITLProperties = {
|
|
|
32
32
|
functionArguments?: Record<string, unknown>;
|
|
33
33
|
/** Argument keys (case-insensitive) hidden from the generic formatting. */
|
|
34
34
|
hiddenKeys?: string[];
|
|
35
|
-
|
|
35
|
+
onconfirm?: (event: HITLEvent) => void;
|
|
36
36
|
confirmLabel?: string;
|
|
37
37
|
cancelLabel?: string;
|
|
38
38
|
/**
|
|
@@ -47,7 +47,7 @@ export type OptionalHITLProperties = {
|
|
|
47
47
|
autoCancelSeconds?: number;
|
|
48
48
|
/** Current mic state — muted while the card is open, restored on decision. */
|
|
49
49
|
isMicMuted?: boolean;
|
|
50
|
-
|
|
50
|
+
onmictoggle?: (() => void | Promise<void>) | null;
|
|
51
51
|
/** Renders a settled card from `initialState` with no timers or buttons. */
|
|
52
52
|
isHistoryMode?: boolean;
|
|
53
53
|
initialState?: HITLInitialState | null;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
credentialless,
|
|
14
14
|
testId,
|
|
15
15
|
classes,
|
|
16
|
-
|
|
16
|
+
// Called unguarded below, so it keeps the no-op default the resolver gave it.
|
|
17
|
+
onmessage = () => {}
|
|
17
18
|
}: IframeViewerProperties = $props();
|
|
18
19
|
|
|
19
20
|
let iframeEl: HTMLIFrameElement | null = $state(null);
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
) {
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
onmessage(event);
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
onMount(() => {
|
|
@@ -36,5 +36,5 @@ export type IframeViewerEventProperties = {
|
|
|
36
36
|
* Called with the `MessageEvent` for `postMessage` events whose origin is in
|
|
37
37
|
* `allowedOrigins` and whose source is the embedded iframe window.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
onmessage?: (event: MessageEvent) => void;
|
|
40
40
|
};
|