@widgetic/design-system 0.5.27 → 0.5.29
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/components/CopyableHeader.svelte +29 -10
- package/dist/components/CopyableHeader.svelte.d.ts +3 -0
- package/dist/components/EmptyState.svelte +13 -3
- package/dist/components/chat/ChatHeader.svelte +29 -3
- package/dist/components/chat/ChatHeader.svelte.d.ts +5 -0
- package/dist/components/chat/Composer.svelte +58 -1
- package/dist/components/chat/Composer.svelte.d.ts +8 -0
- package/dist/components/chat/MessageCheckpointRow.svelte +87 -0
- package/dist/components/chat/MessageCheckpointRow.svelte.d.ts +21 -0
- package/dist/components/chat/MessageRatingActions.svelte +157 -0
- package/dist/components/chat/MessageRatingActions.svelte.d.ts +26 -0
- package/dist/components/chat/chatHeaderLogic.d.ts +8 -0
- package/dist/components/chat/chatHeaderLogic.js +14 -0
- package/dist/components/chat/composerModelMenuLogic.d.ts +9 -0
- package/dist/components/chat/composerModelMenuLogic.js +12 -0
- package/dist/components/chat/index.d.ts +10 -0
- package/dist/components/chat/index.js +8 -0
- package/dist/components/chat/messageRatingActionsLogic.d.ts +11 -0
- package/dist/components/chat/messageRatingActionsLogic.js +17 -0
- package/dist/components/chat/messageRatingTypes.d.ts +2 -0
- package/dist/components/chat/messageRatingTypes.js +1 -0
- package/dist/components/modals/BaseModal.svelte +133 -11
- package/dist/components/modals/BaseModal.svelte.d.ts +1 -0
- package/dist/components/modals/NewItemDialog.svelte +2 -0
- package/dist/components/shad-editor/custom/Extentions/SearchAndReplace.js +0 -1
- package/dist/components/shad-editor/custom/utils.d.ts +1 -1
- package/dist/components/shad-editor/custom/utils.js +0 -1
- package/dist/components/shell/ErrorState.svelte +5 -2
- package/dist/components/shell/ErrorState.svelte.d.ts +2 -1
- package/dist/components/shell/NavRow.svelte +5 -4
- package/dist/components/shell/NavRow.svelte.d.ts +3 -3
- package/dist/components/shell/SettingsDialog.svelte +65 -4
- package/dist/components/shell/WidgetRow.svelte +6 -6
- package/dist/components/shell/WidgetRow.svelte.d.ts +2 -2
- package/dist/components/ui/accordion/accordion-content.svelte +5 -1
- package/dist/components/ui/accordion/accordion-item.svelte +2 -1
- package/dist/components/ui/accordion/accordion-trigger.svelte +38 -0
- package/dist/components/ui/button/button.svelte +1 -1
- package/dist/components/ui/button/button.svelte.d.ts +3 -3
- package/dist/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/components/ui/checkbox/checkbox.svelte +1 -1
- package/dist/components/ui/dialog/dialog-overlay.svelte +8 -1
- package/dist/components/ui/icon-button/icon-button.svelte +1 -1
- package/dist/components/ui/icon-button/icon-button.svelte.d.ts +2 -2
- package/dist/components/ui/input-otp/input-otp-slot.svelte.d.ts +1 -1
- package/dist/components/ui/radio-group/radio-group-item.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +1 -1
- package/dist/components/ui/select/select-content.svelte +2 -2
- package/dist/components/ui/select/select-scroll-down-button.svelte +1 -1
- package/dist/components/ui/select/select-scroll-up-button.svelte +1 -1
- package/dist/components/ui/select/select-trigger.svelte +1 -1
- package/dist/components/ui/stepper-button/stepper-button.svelte +1 -1
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/components/widget-system/Moveable.svelte +24 -21
- package/dist/utils/isEditableEventTarget.d.ts +5 -0
- package/dist/utils/isEditableEventTarget.js +25 -0
- package/dist/utils/modalFocusTrap.d.ts +28 -0
- package/dist/utils/modalFocusTrap.js +135 -0
- package/dist/utils/overlayMotion.d.ts +6 -0
- package/dist/utils/overlayMotion.js +7 -0
- package/dist/utils/overlayStacking.d.ts +47 -0
- package/dist/utils/overlayStacking.js +63 -0
- package/package.json +1 -1
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
5
5
|
|
|
6
6
|
export const navRowVariants = tv({
|
|
7
|
-
base: 'group/nav-row flex h-8 w-full min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2 pe-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2',
|
|
7
|
+
base: 'group/nav-row flex h-8 w-full min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2 pe-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar active:bg-accent-hover disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2',
|
|
8
8
|
variants: {
|
|
9
9
|
active: {
|
|
10
|
-
true: 'bg-sidebar-accent text-sidebar-accent-foreground text-body-medium',
|
|
10
|
+
true: 'bg-sidebar-accent text-sidebar-accent-foreground text-body-medium active:bg-accent-hover',
|
|
11
11
|
// The inactive row carries its own type style (14/20 regular, Figma Nav Row): without it the label took the size
|
|
12
12
|
// of whatever it sat in (16px in a dialog), bigger than the active row's 14/20 medium.
|
|
13
13
|
false:
|
|
14
|
-
'text-body text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground'
|
|
14
|
+
'text-body text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-accent-hover active:text-sidebar-accent-foreground'
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
defaultVariants: {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
export type NavRowVisualState = 'default' | 'hover' | 'active' | 'focus' | 'disabled';
|
|
22
|
+
export type NavRowVisualState = 'default' | 'hover' | 'pressed' | 'active' | 'focus' | 'disabled';
|
|
23
23
|
|
|
24
24
|
export type NavRowProps = WithElementRef<HTMLButtonAttributes> &
|
|
25
25
|
WithElementRef<HTMLAnchorAttributes> & {
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
const showcaseClass = $derived.by(() => {
|
|
73
73
|
if (!visualState || visualState === 'default' || visualState === 'active') return '';
|
|
74
74
|
if (visualState === 'hover') return 'bg-sidebar-accent text-sidebar-accent-foreground';
|
|
75
|
+
if (visualState === 'pressed') return 'bg-accent-hover text-sidebar-accent-foreground';
|
|
75
76
|
if (visualState === 'focus')
|
|
76
77
|
return 'ring-2 ring-sidebar-ring ring-offset-2 ring-offset-sidebar';
|
|
77
78
|
return '';
|
|
@@ -5,7 +5,7 @@ export declare const navRowVariants: import("tailwind-variants").TVReturnType<{
|
|
|
5
5
|
true: string;
|
|
6
6
|
false: string;
|
|
7
7
|
};
|
|
8
|
-
}, undefined, "group/nav-row flex h-8 w-full min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2 pe-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
8
|
+
}, undefined, "group/nav-row flex h-8 w-full min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2 pe-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar active:bg-accent-hover disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
9
9
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
10
10
|
active?: boolean | (string | number | symbol)[] | undefined;
|
|
11
11
|
} | undefined;
|
|
@@ -27,7 +27,7 @@ export declare const navRowVariants: import("tailwind-variants").TVReturnType<{
|
|
|
27
27
|
true: string;
|
|
28
28
|
false: string;
|
|
29
29
|
};
|
|
30
|
-
}, undefined, "group/nav-row flex h-8 w-full min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2 pe-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
30
|
+
}, undefined, "group/nav-row flex h-8 w-full min-w-0 items-center gap-2 rounded-lg py-1.5 ps-2 pe-2 text-start transition-colors duration-fast focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 focus-visible:ring-offset-sidebar active:bg-accent-hover disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
31
31
|
active: {
|
|
32
32
|
true: string;
|
|
33
33
|
false: string;
|
|
@@ -38,7 +38,7 @@ export declare const navRowVariants: import("tailwind-variants").TVReturnType<{
|
|
|
38
38
|
false: string;
|
|
39
39
|
};
|
|
40
40
|
}>, unknown, unknown, undefined>>;
|
|
41
|
-
export type NavRowVisualState = 'default' | 'hover' | 'active' | 'focus' | 'disabled';
|
|
41
|
+
export type NavRowVisualState = 'default' | 'hover' | 'pressed' | 'active' | 'focus' | 'disabled';
|
|
42
42
|
export type NavRowProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
|
|
43
43
|
ref?: HTMLAnchorElement | HTMLButtonElement | null;
|
|
44
44
|
class?: string;
|
|
@@ -75,6 +75,37 @@
|
|
|
75
75
|
})
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
// Parent keeps pe-8 (32px). A native bar always sits against the content box, so when the page scrolls we
|
|
80
|
+
// (1) pull the scroll area into that padding and (2) add matching padding-right so the cards stay on the
|
|
81
|
+
// pe-8 line and the bar is centred in the leftover space between the cards and the dialog edge.
|
|
82
|
+
const PANE_RIGHT_PADDING_PX = 32;
|
|
83
|
+
let paneScrollStyle = $state('');
|
|
84
|
+
|
|
85
|
+
function overlayScrollbar(node: HTMLElement) {
|
|
86
|
+
function check() {
|
|
87
|
+
const overflows = node.scrollHeight > node.clientHeight;
|
|
88
|
+
if (!overflows) {
|
|
89
|
+
paneScrollStyle = '';
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Read the real bar width (often ~14px in Chromium, 8px when thin styles apply).
|
|
93
|
+
const barWidth = Math.max(node.offsetWidth - node.clientWidth, 8);
|
|
94
|
+
const outerGap = Math.max((PANE_RIGHT_PADDING_PX - barWidth) / 2, 0);
|
|
95
|
+
const pull = PANE_RIGHT_PADDING_PX - outerGap;
|
|
96
|
+
// End side, not the right: the bar sits at the inline end of the page, so a dialog read right to left mirrors it
|
|
97
|
+
// (tests/rtl/sourcePlacement.test.ts fails on a physical side). Left to right, this is margin-right/padding-right.
|
|
98
|
+
paneScrollStyle = `margin-inline-end: -${pull}px; padding-inline-end: ${outerGap}px`;
|
|
99
|
+
}
|
|
100
|
+
const resizeObserver = new ResizeObserver(check);
|
|
101
|
+
resizeObserver.observe(node);
|
|
102
|
+
check();
|
|
103
|
+
return {
|
|
104
|
+
destroy() {
|
|
105
|
+
resizeObserver.disconnect();
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
78
109
|
</script>
|
|
79
110
|
|
|
80
111
|
<Dialog.Root bind:open={() => open, requestOpenChange}>
|
|
@@ -102,8 +133,8 @@
|
|
|
102
133
|
>
|
|
103
134
|
<SettingsNav {groups} {activeId} {onSelect} class="flex-1" />
|
|
104
135
|
</aside>
|
|
105
|
-
<div class="flex min-h-0 min-w-0 flex-1 flex-col gap-6 overflow-
|
|
106
|
-
<header class="flex flex-col gap-1 pe-10">
|
|
136
|
+
<div class="settings-dialog-main-ct flex min-h-0 min-w-0 flex-1 flex-col gap-6 overflow-hidden pe-8 pt-8">
|
|
137
|
+
<header class="settings-dialog-header flex shrink-0 flex-col gap-1 ps-8 pe-10">
|
|
107
138
|
<DialogPrimitive.Title class="text-heading-page text-foreground"
|
|
108
139
|
>{title}</DialogPrimitive.Title
|
|
109
140
|
>
|
|
@@ -123,11 +154,18 @@
|
|
|
123
154
|
</DialogPrimitive.Description>
|
|
124
155
|
{/if}
|
|
125
156
|
</header>
|
|
126
|
-
|
|
157
|
+
<!-- Only the page under the title scrolls. When it overflows, margin+padding centre the bar in the parent's pe-8. -->
|
|
158
|
+
<div
|
|
159
|
+
class="settings-dialog-pane-scroll flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto overflow-x-hidden ps-8 pb-8"
|
|
160
|
+
use:overlayScrollbar
|
|
161
|
+
style={paneScrollStyle}
|
|
162
|
+
>
|
|
163
|
+
{@render children()}
|
|
164
|
+
</div>
|
|
127
165
|
</div>
|
|
128
166
|
</div>
|
|
129
167
|
<DialogPrimitive.Close
|
|
130
|
-
class="text-foreground hover:bg-accent duration-fast focus-visible:ring-ring focus-visible:ring-offset-background absolute end-
|
|
168
|
+
class="text-foreground hover:bg-accent duration-fast focus-visible:ring-ring focus-visible:ring-offset-background absolute end-2 top-2 inline-flex size-8 items-center justify-center rounded-lg transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
|
|
131
169
|
>
|
|
132
170
|
<IconX class="size-4 stroke-2" aria-hidden="true" />
|
|
133
171
|
<span class="sr-only">{closeLabel}</span>
|
|
@@ -135,3 +173,26 @@
|
|
|
135
173
|
</DialogPrimitive.Content>
|
|
136
174
|
</Dialog.Portal>
|
|
137
175
|
</Dialog.Root>
|
|
176
|
+
|
|
177
|
+
<style>
|
|
178
|
+
/* Transparent track; thumb overlays the parent's right padding via the conditional negative margin above. */
|
|
179
|
+
.settings-dialog-pane-scroll {
|
|
180
|
+
scrollbar-width: thin;
|
|
181
|
+
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
|
|
182
|
+
}
|
|
183
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar {
|
|
184
|
+
width: 8px;
|
|
185
|
+
height: 8px;
|
|
186
|
+
background: transparent;
|
|
187
|
+
}
|
|
188
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-track {
|
|
189
|
+
background: transparent;
|
|
190
|
+
}
|
|
191
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-thumb {
|
|
192
|
+
background: rgba(0, 0, 0, 0.2);
|
|
193
|
+
border-radius: 4px;
|
|
194
|
+
}
|
|
195
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-thumb:hover {
|
|
196
|
+
background: rgba(0, 0, 0, 0.35);
|
|
197
|
+
}
|
|
198
|
+
</style>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!-- Figma: Widget Row (component set 54:5, node 54:5). -->
|
|
1
|
+
<!-- Figma: Widget Row (component set 54:5, node 54:5). The row fills its container (1120px on the desktop dashboard, 720px on tablet, 374px on phones): the page sets the width, the row sets no maximum. -->
|
|
2
2
|
<script lang="ts" module>
|
|
3
3
|
import type { VariantProps } from 'tailwind-variants';
|
|
4
4
|
|
|
5
5
|
export const widgetRowVariants = tv({
|
|
6
|
-
base: 'group/widget-row flex
|
|
6
|
+
base: 'group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden',
|
|
7
7
|
variants: {
|
|
8
8
|
selected: {
|
|
9
9
|
true: 'bg-brand-subtle ring-2 ring-brand',
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
{#if isLoading}
|
|
68
68
|
<div
|
|
69
69
|
class={cn(
|
|
70
|
-
'
|
|
70
|
+
'flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4',
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
role="status"
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
{/if}
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
|
-
<div class="min-w-0 flex-1 flex-col gap-0 overflow-hidden">
|
|
105
|
-
<span class="text-body-medium text-foreground block truncate">{title}</span>
|
|
104
|
+
<div class="flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-0 overflow-hidden">
|
|
105
|
+
<span class="text-body-medium text-foreground block h-5 truncate leading-5">{title}</span>
|
|
106
106
|
{#if meta}
|
|
107
|
-
<span class="text-caption text-muted-foreground block truncate">{meta}</span>
|
|
107
|
+
<span class="text-caption text-muted-foreground block h-4 truncate leading-4">{meta}</span>
|
|
108
108
|
{/if}
|
|
109
109
|
</div>
|
|
110
110
|
|
|
@@ -7,7 +7,7 @@ export declare const widgetRowVariants: import("tailwind-variants").TVReturnType
|
|
|
7
7
|
true: string;
|
|
8
8
|
false: string;
|
|
9
9
|
};
|
|
10
|
-
}, undefined, "group/widget-row flex
|
|
10
|
+
}, undefined, "group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden", {
|
|
11
11
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
12
12
|
selected?: boolean | (string | number | symbol)[] | undefined;
|
|
13
13
|
loading?: boolean | (string | number | symbol)[] | undefined;
|
|
@@ -38,7 +38,7 @@ export declare const widgetRowVariants: import("tailwind-variants").TVReturnType
|
|
|
38
38
|
true: string;
|
|
39
39
|
false: string;
|
|
40
40
|
};
|
|
41
|
-
}, undefined, "group/widget-row flex
|
|
41
|
+
}, undefined, "group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
42
42
|
selected: {
|
|
43
43
|
true: string;
|
|
44
44
|
false: string;
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
<AccordionPrimitive.Content
|
|
14
14
|
bind:ref
|
|
15
15
|
class={cn(
|
|
16
|
-
"text-body
|
|
16
|
+
"text-body overflow-hidden",
|
|
17
|
+
"group-data-[animate=true]/accordion-item:transition-[height]",
|
|
18
|
+
// A closing animates for the toggled item and for the siblings that close with it; an opening only for the toggled item.
|
|
19
|
+
"group-data-[animate-close=true]/accordion-item:data-[state=closed]:animate-accordion-up",
|
|
20
|
+
"group-data-[animate=true]/accordion-item:data-[state=open]:animate-accordion-down",
|
|
17
21
|
className
|
|
18
22
|
)}
|
|
19
23
|
{...restProps}
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
The stroke is an inset ring, not a border, so it takes no room: the trigger and the rows keep the full 402px of the Figma frame. -->
|
|
14
14
|
<AccordionPrimitive.Item
|
|
15
15
|
bind:ref
|
|
16
|
+
data-accordion-item
|
|
16
17
|
class={cn(
|
|
17
|
-
"bg-popover text-popover-foreground ring-border overflow-hidden rounded-xl ring-1 ring-inset",
|
|
18
|
+
"group/accordion-item bg-popover text-popover-foreground ring-border overflow-hidden rounded-xl ring-1 ring-inset",
|
|
18
19
|
className
|
|
19
20
|
)}
|
|
20
21
|
{...restProps}
|
|
@@ -8,10 +8,46 @@
|
|
|
8
8
|
class: className,
|
|
9
9
|
level = 3,
|
|
10
10
|
children,
|
|
11
|
+
onclick,
|
|
12
|
+
onkeydown,
|
|
11
13
|
...restProps
|
|
12
14
|
}: WithoutChild<AccordionPrimitive.TriggerProps> & {
|
|
13
15
|
level?: AccordionPrimitive.HeaderProps["level"];
|
|
14
16
|
} = $props();
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Height animations start with the first user toggle, never on mount (an item that is open by default appears open).
|
|
20
|
+
* The toggled item animates both ways (`data-animate`). The other items of the accordion may close because of this
|
|
21
|
+
* click (a single-open accordion closes the open item as another one opens), so they animate a closing
|
|
22
|
+
* (`data-animate-close`) and nothing else: an item that stays open takes no animation from that flag, so it does not
|
|
23
|
+
* collapse and open again when a sibling is toggled.
|
|
24
|
+
*/
|
|
25
|
+
function markAccordionItemsAnimate(event: Event) {
|
|
26
|
+
try {
|
|
27
|
+
const trigger = event.currentTarget as HTMLElement | null;
|
|
28
|
+
const accordionRoot = trigger?.closest("[data-accordion-root]");
|
|
29
|
+
const ownItem = trigger?.closest("[data-accordion-item]");
|
|
30
|
+
ownItem?.setAttribute("data-animate", "true");
|
|
31
|
+
ownItem?.setAttribute("data-animate-close", "true");
|
|
32
|
+
accordionRoot?.querySelectorAll("[data-accordion-item]").forEach((item) => {
|
|
33
|
+
if (item !== ownItem) item.setAttribute("data-animate-close", "true");
|
|
34
|
+
});
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.warn("[accordion] could not mark the items to animate:", error);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleTriggerClick(event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
41
|
+
markAccordionItemsAnimate(event);
|
|
42
|
+
onclick?.(event);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function handleTriggerKeydown(event: KeyboardEvent & { currentTarget: EventTarget & HTMLButtonElement }) {
|
|
46
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
47
|
+
markAccordionItemsAnimate(event);
|
|
48
|
+
}
|
|
49
|
+
onkeydown?.(event);
|
|
50
|
+
}
|
|
15
51
|
</script>
|
|
16
52
|
|
|
17
53
|
<AccordionPrimitive.Header {level} class="flex">
|
|
@@ -22,6 +58,8 @@
|
|
|
22
58
|
"text-body-medium text-foreground focus-visible:ring-ring flex h-12 flex-1 items-center justify-between gap-2 px-4 text-start transition-colors duration-fast outline-none hover:bg-accent focus-visible:rounded-xl focus-visible:ring-2 focus-visible:ring-inset [&[data-state=open]>svg]:rotate-180",
|
|
23
59
|
className
|
|
24
60
|
)}
|
|
61
|
+
onclick={handleTriggerClick}
|
|
62
|
+
onkeydown={handleTriggerKeydown}
|
|
25
63
|
{...restProps}
|
|
26
64
|
>
|
|
27
65
|
{@render children?.()}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import type { VariantProps } from "tailwind-variants";
|
|
14
14
|
|
|
15
15
|
export const buttonVariants = tv({
|
|
16
|
-
base: "inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2",
|
|
16
|
+
base: "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2",
|
|
17
17
|
variants: {
|
|
18
18
|
variant: {
|
|
19
19
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
@@ -23,11 +23,11 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
23
23
|
true: string;
|
|
24
24
|
false: string;
|
|
25
25
|
};
|
|
26
|
-
}, undefined, "inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
26
|
+
}, undefined, "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
27
27
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
28
28
|
size?: boolean | (string | number | symbol)[] | undefined;
|
|
29
|
-
variant?: boolean | (string | number | symbol)[] | undefined;
|
|
30
29
|
iconPadding?: boolean | (string | number | symbol)[] | undefined;
|
|
30
|
+
variant?: boolean | (string | number | symbol)[] | undefined;
|
|
31
31
|
} | undefined;
|
|
32
32
|
} & import("tailwind-variants/dist/config.js").TWMConfig & {
|
|
33
33
|
twMergeConfig: {
|
|
@@ -81,7 +81,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
81
81
|
true: string;
|
|
82
82
|
false: string;
|
|
83
83
|
};
|
|
84
|
-
}, undefined, "inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
84
|
+
}, undefined, "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
85
85
|
variant: {
|
|
86
86
|
default: string;
|
|
87
87
|
destructive: string;
|
|
@@ -6,6 +6,6 @@ export type CalendarProps = WithoutChildrenOrChild<CalendarPrimitive.RootProps>
|
|
|
6
6
|
nextLabel?: string;
|
|
7
7
|
};
|
|
8
8
|
import * as Calendar from "./index.js";
|
|
9
|
-
declare const Calendar: import("svelte").Component<CalendarProps, {}, "
|
|
9
|
+
declare const Calendar: import("svelte").Component<CalendarProps, {}, "ref" | "value" | "placeholder">;
|
|
10
10
|
type Calendar = ReturnType<typeof Calendar>;
|
|
11
11
|
export default Calendar;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<CheckboxPrimitive.Root
|
|
22
22
|
bind:ref
|
|
23
23
|
class={cn(
|
|
24
|
-
"peer flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-background text-primary-foreground hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary active:border-input active:data-[state=checked]:border-primary active:data-[state=indeterminate]:border-primary press-feedback",
|
|
24
|
+
"peer flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-sm border border-input bg-background text-primary-foreground hover:bg-muted focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background active:ring-2 active:ring-ring active:ring-offset-2 active:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary active:border-input active:data-[state=checked]:border-primary active:data-[state=indeterminate]:border-primary press-feedback",
|
|
25
25
|
className
|
|
26
26
|
)}
|
|
27
27
|
bind:checked
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
overlayDialogOverlayClasses,
|
|
10
10
|
overlayReducedMotionClasses
|
|
11
11
|
} from "../../../utils/overlayMotion.js";
|
|
12
|
+
// A scrim drawn over another scrim only dims (the page is blurred once): see overlayStacking.ts.
|
|
13
|
+
import { stackedScrimMark } from "../../../utils/overlayStacking.js";
|
|
12
14
|
|
|
13
15
|
let {
|
|
14
16
|
ref = $bindable(null),
|
|
@@ -27,4 +29,9 @@
|
|
|
27
29
|
className
|
|
28
30
|
)}
|
|
29
31
|
{...restProps}
|
|
30
|
-
|
|
32
|
+
>
|
|
33
|
+
{#snippet child({ props })}
|
|
34
|
+
<!-- The element is created here, only while the dialog is shown: it is marked as it is created, so a scrim over another one never has the blur to lose. -->
|
|
35
|
+
<div {...props} data-stacked={stackedScrimMark()}></div>
|
|
36
|
+
{/snippet}
|
|
37
|
+
</DialogPrimitive.Overlay>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { VariantProps } from "tailwind-variants";
|
|
9
9
|
|
|
10
10
|
export const iconButtonVariants = tv({
|
|
11
|
-
base: "inline-flex shrink-0 items-center justify-center press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2",
|
|
11
|
+
base: "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2",
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
|
14
14
|
ghost:
|
|
@@ -13,7 +13,7 @@ export declare const iconButtonVariants: import("tailwind-variants").TVReturnTyp
|
|
|
13
13
|
default: string;
|
|
14
14
|
sm: string;
|
|
15
15
|
};
|
|
16
|
-
}, undefined, "inline-flex shrink-0 items-center justify-center press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
16
|
+
}, undefined, "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
17
17
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
18
18
|
size?: boolean | (string | number | symbol)[] | undefined;
|
|
19
19
|
variant?: boolean | (string | number | symbol)[] | undefined;
|
|
@@ -50,7 +50,7 @@ export declare const iconButtonVariants: import("tailwind-variants").TVReturnTyp
|
|
|
50
50
|
default: string;
|
|
51
51
|
sm: string;
|
|
52
52
|
};
|
|
53
|
-
}, undefined, "inline-flex shrink-0 items-center justify-center press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
53
|
+
}, undefined, "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
54
54
|
variant: {
|
|
55
55
|
ghost: string;
|
|
56
56
|
secondary: string;
|
|
@@ -3,7 +3,7 @@ export type InputOtpSlotProps = ComponentProps<typeof InputOTPPrimitive.Cell>;
|
|
|
3
3
|
import type { ComponentProps } from "svelte";
|
|
4
4
|
declare const InputOtpSlot: import("svelte").Component<Omit<{
|
|
5
5
|
cell: import("bits-ui").PinInputCell;
|
|
6
|
-
}, "
|
|
6
|
+
}, "children" | "child"> & {
|
|
7
7
|
child?: import("svelte").Snippet<[{
|
|
8
8
|
props: Record<string, unknown>;
|
|
9
9
|
}]> | undefined;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<RadioGroupPrimitive.Item
|
|
18
18
|
bind:ref
|
|
19
19
|
class={cn(
|
|
20
|
-
"aspect-square size-4 shrink-0 rounded-full border border-input bg-background text-primary hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[state=checked]:border-primary active:border-input active:data-[state=checked]:border-primary press-feedback",
|
|
20
|
+
"aspect-square size-4 shrink-0 cursor-pointer rounded-full border border-input bg-background text-primary hover:bg-muted focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background active:ring-2 active:ring-ring active:ring-offset-2 active:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary active:border-input active:data-[state=checked]:border-primary press-feedback",
|
|
21
21
|
className
|
|
22
22
|
)}
|
|
23
23
|
{...restProps}
|
|
@@ -6,6 +6,6 @@ export type RangeCalendarProps = WithoutChildrenOrChild<RangeCalendarPrimitive.R
|
|
|
6
6
|
nextLabel?: string;
|
|
7
7
|
};
|
|
8
8
|
import * as RangeCalendar from "./index.js";
|
|
9
|
-
declare const RangeCalendar: import("svelte").Component<RangeCalendarProps, {}, "
|
|
9
|
+
declare const RangeCalendar: import("svelte").Component<RangeCalendarProps, {}, "ref" | "value" | "placeholder">;
|
|
10
10
|
type RangeCalendar = ReturnType<typeof RangeCalendar>;
|
|
11
11
|
export default RangeCalendar;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
bind:ref
|
|
20
20
|
{orientation}
|
|
21
21
|
class={cn(
|
|
22
|
-
"flex touch-none select-none transition-colors",
|
|
22
|
+
"z-10 flex touch-none select-none transition-colors",
|
|
23
23
|
orientation === "vertical" && "h-full w-2.5 border-s border-s-transparent p-px",
|
|
24
24
|
orientation === "horizontal" && "h-2.5 w-full border-t border-t-transparent p-px",
|
|
25
25
|
className
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
type="button"
|
|
138
138
|
tabindex={-1}
|
|
139
139
|
aria-hidden="true"
|
|
140
|
-
class="select-scroll-step select-scroll-step-up flex w-full cursor-
|
|
140
|
+
class="select-scroll-step select-scroll-step-up flex w-full cursor-pointer items-center justify-center py-1 [&_svg]:cursor-pointer"
|
|
141
141
|
onpointerdown={(event) => handleScrollButtonPointerDown(event, -1)}
|
|
142
142
|
onpointerup={handleScrollButtonPointerUp}
|
|
143
143
|
onpointerleave={handleScrollButtonPointerUp}
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
type="button"
|
|
161
161
|
tabindex={-1}
|
|
162
162
|
aria-hidden="true"
|
|
163
|
-
class="select-scroll-step select-scroll-step-down flex w-full cursor-
|
|
163
|
+
class="select-scroll-step select-scroll-step-down flex w-full cursor-pointer items-center justify-center py-1 [&_svg]:cursor-pointer"
|
|
164
164
|
onpointerdown={(event) => handleScrollButtonPointerDown(event, 1)}
|
|
165
165
|
onpointerup={handleScrollButtonPointerUp}
|
|
166
166
|
onpointerleave={handleScrollButtonPointerUp}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<SelectPrimitive.ScrollDownButton
|
|
18
18
|
bind:ref
|
|
19
|
-
class={cn("flex cursor-
|
|
19
|
+
class={cn("flex cursor-pointer items-center justify-center py-1 [&_svg]:cursor-pointer", className)}
|
|
20
20
|
{...restProps}
|
|
21
21
|
>
|
|
22
22
|
<IconChevronDown class="size-4 stroke-2" aria-hidden="true" />
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<SelectPrimitive.ScrollUpButton
|
|
18
18
|
bind:ref
|
|
19
|
-
class={cn("flex cursor-
|
|
19
|
+
class={cn("flex cursor-pointer items-center justify-center py-1 [&_svg]:cursor-pointer", className)}
|
|
20
20
|
{...restProps}
|
|
21
21
|
>
|
|
22
22
|
<IconChevronUp class="size-4 stroke-2" aria-hidden="true" />
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<SelectPrimitive.Trigger
|
|
20
20
|
bind:ref
|
|
21
21
|
class={cn(
|
|
22
|
-
"flex h-9 w-full items-center justify-between gap-2 rounded-lg border border-input bg-background px-3 py-2 text-start text-body transition-colors duration-fast hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[placeholder]:text-muted-foreground aria-invalid:border-destructive [&>span]:line-clamp-1 [&[data-state=open]>svg:last-child]:rotate-180",
|
|
22
|
+
"flex h-9 w-full cursor-pointer items-center justify-between gap-2 rounded-lg border border-input bg-background px-3 py-2 text-start text-body transition-colors duration-fast hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground aria-invalid:border-destructive [&>span]:line-clamp-1 [&[data-state=open]>svg:last-child]:rotate-180",
|
|
23
23
|
className
|
|
24
24
|
)}
|
|
25
25
|
{...restProps}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
{disabled}
|
|
30
30
|
data-pressed={dataPressed}
|
|
31
31
|
class={cn(
|
|
32
|
-
"inline-flex size-6 shrink-0 items-center justify-center rounded-lg bg-transparent text-foreground hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 press-feedback [&_svg]:pointer-events-none",
|
|
32
|
+
"inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-lg bg-transparent text-foreground hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 press-feedback [&_svg]:pointer-events-none",
|
|
33
33
|
className
|
|
34
34
|
)}
|
|
35
35
|
{...restProps}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
{sideOffset}
|
|
25
25
|
dir={$textDirection}
|
|
26
26
|
class={cn(
|
|
27
|
-
"bg-popover text-popover-foreground border-border text-caption animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-lg border px-3 py-1.5",
|
|
27
|
+
"bg-popover text-popover-foreground border-border text-caption animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-w-[min(18rem,calc(100vw-2rem))] overflow-hidden rounded-lg border px-3 py-1.5 text-balance whitespace-normal",
|
|
28
28
|
className
|
|
29
29
|
)}
|
|
30
30
|
{...restProps}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onMount, createEventDispatcher } from 'svelte';
|
|
3
|
+
import { isEditableEventTarget } from '../../utils/isEditableEventTarget';
|
|
3
4
|
|
|
4
5
|
// COMPONENT PROPS
|
|
5
6
|
// Class & Style
|
|
@@ -52,8 +53,16 @@
|
|
|
52
53
|
// console.log(`${prefix} - Position: (${currentLeft.toFixed(1)}, ${currentTop.toFixed(1)}), Size: ${Math.round(currentWidth)}x${Math.round(currentHeight)}`);
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
/** Modifier keys apply visually only while the pointer is over the widget or a drag/resize is active. */
|
|
57
|
+
$: pointerInteractionActive = isHovering || isDragging || isResizing;
|
|
58
|
+
$: showDragMode = pointerInteractionActive && (isCmdCtrlKeyDown || isSpaceKeyDown);
|
|
59
|
+
$: showProportionalMode = pointerInteractionActive && isShiftKeyDown && !isAltOptKeyDown;
|
|
60
|
+
$: showSymmetricalMode = pointerInteractionActive && isAltOptKeyDown && !isShiftKeyDown;
|
|
61
|
+
$: showCombinedMode = pointerInteractionActive && isShiftKeyDown && isAltOptKeyDown;
|
|
62
|
+
|
|
55
63
|
// Track key states
|
|
56
64
|
function handleKeyDown(e: KeyboardEvent) {
|
|
65
|
+
if (isEditableEventTarget(e)) return;
|
|
57
66
|
if ((isMac && e.key === 'Meta') || (!isMac && e.key === 'Control')) {
|
|
58
67
|
isCmdCtrlKeyDown = true;
|
|
59
68
|
updateContainerClasses();
|
|
@@ -95,25 +104,19 @@
|
|
|
95
104
|
|
|
96
105
|
function updateContainerClasses() {
|
|
97
106
|
if (!container) return;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
container.classList.
|
|
101
|
-
container.classList.
|
|
102
|
-
container.classList.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
container.classList.add('combined-mode');
|
|
112
|
-
} else if (isShiftKeyDown) {
|
|
113
|
-
container.classList.add('proportional-mode');
|
|
114
|
-
} else if (isAltOptKeyDown) {
|
|
115
|
-
container.classList.add('symmetrical-mode');
|
|
116
|
-
}
|
|
107
|
+
container.classList.remove('drag-mode', 'proportional-mode', 'symmetrical-mode', 'combined-mode');
|
|
108
|
+
if (showDragMode) container.classList.add('drag-mode');
|
|
109
|
+
if (showCombinedMode) container.classList.add('combined-mode');
|
|
110
|
+
else if (showProportionalMode) container.classList.add('proportional-mode');
|
|
111
|
+
else if (showSymmetricalMode) container.classList.add('symmetrical-mode');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
$: if (container) {
|
|
115
|
+
showDragMode;
|
|
116
|
+
showProportionalMode;
|
|
117
|
+
showSymmetricalMode;
|
|
118
|
+
showCombinedMode;
|
|
119
|
+
updateContainerClasses();
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
// Reclaim focus from iframes so Cmd/Ctrl keydown reaches document listeners
|
|
@@ -497,7 +500,7 @@
|
|
|
497
500
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
498
501
|
<div
|
|
499
502
|
bind:this={container}
|
|
500
|
-
class="moveable-content-ct moveable-container {
|
|
503
|
+
class="moveable-content-ct moveable-container {showDragMode ? 'drag-mode' : ''} {showProportionalMode ? 'proportional-mode' : ''} {showSymmetricalMode ? 'symmetrical-mode' : ''} {showCombinedMode ? 'combined-mode' : ''} {isResizing ? 'resizing-mode' : ''}"
|
|
501
504
|
class:hovering={isHovering || alwaysShowControls}
|
|
502
505
|
style="position: absolute; left: 8px; top: 8px; width: {currentWidth}px; height: {currentHeight}px;"
|
|
503
506
|
on:mousedown={handleMouseDown}
|
|
@@ -505,7 +508,7 @@
|
|
|
505
508
|
<slot></slot>
|
|
506
509
|
|
|
507
510
|
<!-- Drag overlay: real DOM element that sits above iframes to capture mouse events in drag mode -->
|
|
508
|
-
{#if
|
|
511
|
+
{#if showDragMode}
|
|
509
512
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
510
513
|
<div class="drag-overlay" on:mousedown={handleMouseDown}></div>
|
|
511
514
|
{/if}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when a keyboard event originated from (or should be treated as) typing in an editable control,
|
|
3
|
+
* including fields inside shadow roots and portaled popovers (composedPath).
|
|
4
|
+
*/
|
|
5
|
+
export declare function isEditableEventTarget(event: Pick<KeyboardEvent, 'composedPath' | 'target'>): boolean;
|