polymorph-ui-components 0.3.0 → 0.4.0
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.
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
panelHeight = $bindable(600),
|
|
25
25
|
minPanelWidth = 280,
|
|
26
26
|
minPanelHeight = 360,
|
|
27
|
+
expanded = $bindable(false),
|
|
28
|
+
expandedPanelWidth = $bindable(600),
|
|
29
|
+
expandedPanelHeight = $bindable(760),
|
|
27
30
|
onopen,
|
|
28
31
|
onclose,
|
|
29
32
|
ontoggle,
|
|
@@ -61,6 +64,25 @@
|
|
|
61
64
|
);
|
|
62
65
|
let resizeHandles = $derived(handlesFor(verticalSide, effectiveSide));
|
|
63
66
|
|
|
67
|
+
let liveWidth = $derived(expanded ? expandedPanelWidth : panelWidth);
|
|
68
|
+
let liveHeight = $derived(expanded ? expandedPanelHeight : panelHeight);
|
|
69
|
+
|
|
70
|
+
function setLiveWidth(value: number): void {
|
|
71
|
+
if (expanded) {
|
|
72
|
+
expandedPanelWidth = value;
|
|
73
|
+
} else {
|
|
74
|
+
panelWidth = value;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function setLiveHeight(value: number): void {
|
|
79
|
+
if (expanded) {
|
|
80
|
+
expandedPanelHeight = value;
|
|
81
|
+
} else {
|
|
82
|
+
panelHeight = value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
function snapMargin(): number {
|
|
65
87
|
if (root === null) {
|
|
66
88
|
return 24;
|
|
@@ -235,6 +257,7 @@
|
|
|
235
257
|
data-position={position}
|
|
236
258
|
data-effective-side={effectiveSide}
|
|
237
259
|
data-effective-vertical={verticalSide}
|
|
260
|
+
data-expanded={expanded}
|
|
238
261
|
data-pw={testId}
|
|
239
262
|
bind:this={root}
|
|
240
263
|
style:transform={draggable ? `translate(${dragX}px, ${dragY}px)` : null}
|
|
@@ -247,8 +270,8 @@
|
|
|
247
270
|
>
|
|
248
271
|
<Resizable
|
|
249
272
|
disabled={!resizable}
|
|
250
|
-
bind:width={
|
|
251
|
-
bind:height={
|
|
273
|
+
bind:width={() => liveWidth, setLiveWidth}
|
|
274
|
+
bind:height={() => liveHeight, setLiveHeight}
|
|
252
275
|
minWidth={minPanelWidth}
|
|
253
276
|
minHeight={minPanelHeight}
|
|
254
277
|
maxWidth={availWidth ?? Number.POSITIVE_INFINITY}
|
|
@@ -325,6 +348,11 @@
|
|
|
325
348
|
.panel-anchor {
|
|
326
349
|
position: absolute;
|
|
327
350
|
--resizable-handle-color: var(--chat-bubble-resize-handle-color, transparent);
|
|
351
|
+
--resizable-transition: var(
|
|
352
|
+
--chat-bubble-expand-transition,
|
|
353
|
+
width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
|
|
354
|
+
height 0.32s cubic-bezier(0.22, 1, 0.36, 1)
|
|
355
|
+
);
|
|
328
356
|
}
|
|
329
357
|
|
|
330
358
|
.chat-bubble[data-effective-vertical='bottom'] .panel-anchor {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChatBubbleProperties } from './properties';
|
|
2
|
-
declare const ChatBubble: import("svelte").Component<ChatBubbleProperties, {}, "open" | "dragX" | "dragY" | "panelWidth" | "panelHeight">;
|
|
2
|
+
declare const ChatBubble: import("svelte").Component<ChatBubbleProperties, {}, "open" | "dragX" | "dragY" | "panelWidth" | "panelHeight" | "expanded" | "expandedPanelWidth" | "expandedPanelHeight">;
|
|
3
3
|
type ChatBubble = ReturnType<typeof ChatBubble>;
|
|
4
4
|
export default ChatBubble;
|
|
@@ -30,6 +30,9 @@ export type OptionalChatBubbleProperties = {
|
|
|
30
30
|
panelHeight?: number;
|
|
31
31
|
minPanelWidth?: number;
|
|
32
32
|
minPanelHeight?: number;
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
expandedPanelWidth?: number;
|
|
35
|
+
expandedPanelHeight?: number;
|
|
33
36
|
testId?: string;
|
|
34
37
|
classes?: string;
|
|
35
38
|
};
|
|
@@ -210,10 +210,18 @@
|
|
|
210
210
|
box-sizing: border-box;
|
|
211
211
|
max-width: var(--resizable-max-width, none);
|
|
212
212
|
max-height: var(--resizable-max-height, none);
|
|
213
|
+
transition: var(--resizable-transition, none);
|
|
213
214
|
}
|
|
214
215
|
|
|
215
216
|
.resizable.resizing {
|
|
216
217
|
user-select: none;
|
|
218
|
+
transition: none;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@media (prefers-reduced-motion: reduce) {
|
|
222
|
+
.resizable {
|
|
223
|
+
transition: none;
|
|
224
|
+
}
|
|
217
225
|
}
|
|
218
226
|
|
|
219
227
|
.handle {
|