flowbite-svelte 1.24.0 → 1.24.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/dist/command-palette/CommandPalette.svelte +1 -1
- package/dist/command-palette/CommandPalette.svelte.d.ts +1 -1
- package/dist/scroll-spy/ScrollSpy.svelte +1 -1
- package/dist/scroll-spy/ScrollSpy.svelte.d.ts +1 -1
- package/dist/split-pane/Divider.svelte +3 -1
- package/dist/split-pane/Divider.svelte.d.ts +1 -0
- package/dist/split-pane/Pane.svelte +9 -1
- package/dist/split-pane/SplitPane.svelte +79 -0
- package/dist/split-pane/SplitPane.svelte.d.ts +1 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
@component
|
|
195
195
|
[Go to docs](https://flowbite-svelte.com/)
|
|
196
196
|
## Type
|
|
197
|
-
[CommandPaletteProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
197
|
+
[CommandPaletteProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2190)
|
|
198
198
|
## Props
|
|
199
199
|
@prop open = $bindable(false)
|
|
200
200
|
@prop items = []
|
|
@@ -2,7 +2,7 @@ import type { CommandPaletteProps } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [CommandPaletteProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [CommandPaletteProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2190)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop open = $bindable(false)
|
|
8
8
|
* @prop items = []
|
|
@@ -255,7 +255,7 @@
|
|
|
255
255
|
@component
|
|
256
256
|
[Go to docs](https://flowbite-svelte.com/)
|
|
257
257
|
## Type
|
|
258
|
-
[ScrollSpyProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
258
|
+
[ScrollSpyProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2205)
|
|
259
259
|
## Props
|
|
260
260
|
@prop items
|
|
261
261
|
@prop position = "top"
|
|
@@ -2,7 +2,7 @@ import type { ScrollSpyProps } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [ScrollSpyProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [ScrollSpyProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2205)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop items
|
|
8
8
|
* @prop position = "top"
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { getTheme } from "../theme/themeUtils";
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
|
|
7
|
-
let { direction, index, onMouseDown, onKeyDown, isDragging, currentSize, class: className = "" }: DividerProps = $props();
|
|
7
|
+
let { direction, index, onMouseDown, onTouchStart, onKeyDown, isDragging, currentSize, class: className = "" }: DividerProps = $props();
|
|
8
8
|
|
|
9
9
|
const themePane = getTheme("divider");
|
|
10
10
|
const themeDividerHitArea = getTheme("dividerHitArea");
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
aria-valuetext={`${roundedSize} percent`}
|
|
27
27
|
class={divider({ direction, isDragging, class: clsx(themePane, className) })}
|
|
28
28
|
onmousedown={(e) => onMouseDown(e, index)}
|
|
29
|
+
ontouchstart={(e) => onTouchStart(e, index)}
|
|
29
30
|
onkeydown={(e) => onKeyDown(e, index)}
|
|
30
31
|
>
|
|
31
32
|
<div class={dividerHitArea({ direction, class: clsx(themeDividerHitArea, className) })}></div>
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
@prop direction
|
|
41
42
|
@prop index
|
|
42
43
|
@prop onMouseDown
|
|
44
|
+
@prop onTouchStart
|
|
43
45
|
@prop onKeyDown
|
|
44
46
|
@prop isDragging
|
|
45
47
|
@prop currentSize
|
|
@@ -32,7 +32,15 @@
|
|
|
32
32
|
</div>
|
|
33
33
|
|
|
34
34
|
{#if showDivider && context}
|
|
35
|
-
<Divider
|
|
35
|
+
<Divider
|
|
36
|
+
{direction}
|
|
37
|
+
index={paneIndex}
|
|
38
|
+
{isDragging}
|
|
39
|
+
currentSize={context.getPaneSize(paneIndex)}
|
|
40
|
+
onMouseDown={context.onMouseDown}
|
|
41
|
+
onTouchStart={context.onTouchStart}
|
|
42
|
+
onKeyDown={context.onKeyDown}
|
|
43
|
+
/>
|
|
36
44
|
{/if}
|
|
37
45
|
|
|
38
46
|
<!--
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
getDirection: () => "horizontal" | "vertical";
|
|
12
12
|
getIsDragging: () => boolean;
|
|
13
13
|
onMouseDown: (e: MouseEvent, index: number) => void;
|
|
14
|
+
onTouchStart: (e: TouchEvent, index: number) => void;
|
|
14
15
|
onKeyDown: (e: KeyboardEvent, index: number) => void;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -106,6 +107,7 @@
|
|
|
106
107
|
getDirection: () => currentDirection,
|
|
107
108
|
getIsDragging: () => isDragging,
|
|
108
109
|
onMouseDown: startResize,
|
|
110
|
+
onTouchStart: startTouchResize,
|
|
109
111
|
onKeyDown: handleKeyResize
|
|
110
112
|
});
|
|
111
113
|
|
|
@@ -281,6 +283,34 @@
|
|
|
281
283
|
document.body.style.userSelect = "";
|
|
282
284
|
}
|
|
283
285
|
|
|
286
|
+
function startTouchResize(e: TouchEvent, index: number) {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
isDragging = true;
|
|
289
|
+
transition = false;
|
|
290
|
+
|
|
291
|
+
const touch = e.touches[0];
|
|
292
|
+
startPos = currentDirection === "horizontal" ? touch.clientX : touch.clientY;
|
|
293
|
+
|
|
294
|
+
const moveHandler = (ev: TouchEvent) => resizeTouch(ev, index);
|
|
295
|
+
const endHandler = () => stopTouchResize(moveHandler, endHandler);
|
|
296
|
+
|
|
297
|
+
window.addEventListener("touchmove", moveHandler, { passive: false });
|
|
298
|
+
window.addEventListener("touchend", endHandler);
|
|
299
|
+
window.addEventListener("touchcancel", endHandler);
|
|
300
|
+
|
|
301
|
+
document.body.style.userSelect = "none";
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function stopTouchResize(moveHandler: (e: TouchEvent) => void, endHandler: () => void) {
|
|
305
|
+
isDragging = false;
|
|
306
|
+
transition = transitionProp;
|
|
307
|
+
window.removeEventListener("touchmove", moveHandler);
|
|
308
|
+
window.removeEventListener("touchend", endHandler);
|
|
309
|
+
window.removeEventListener("touchcancel", endHandler);
|
|
310
|
+
|
|
311
|
+
document.body.style.userSelect = "";
|
|
312
|
+
}
|
|
313
|
+
|
|
284
314
|
function resize(e: MouseEvent, index: number) {
|
|
285
315
|
if (!isDragging || !container) return;
|
|
286
316
|
if (index < 0 || index + 1 >= sizes.length) return;
|
|
@@ -327,6 +357,55 @@
|
|
|
327
357
|
}
|
|
328
358
|
}
|
|
329
359
|
|
|
360
|
+
function resizeTouch(e: TouchEvent, index: number) {
|
|
361
|
+
if (!isDragging || !container) return;
|
|
362
|
+
if (index < 0 || index + 1 >= sizes.length) return;
|
|
363
|
+
|
|
364
|
+
e.preventDefault(); // Prevent scrolling while dragging
|
|
365
|
+
|
|
366
|
+
const touch = e.touches[0];
|
|
367
|
+
const currentPos = currentDirection === "horizontal" ? touch.clientX : touch.clientY;
|
|
368
|
+
const delta = currentPos - startPos;
|
|
369
|
+
|
|
370
|
+
if (Math.abs(delta) < MIN_DELTA) return; // Ignore very small movements
|
|
371
|
+
|
|
372
|
+
const containerSize = currentDirection === "horizontal" ? container.offsetWidth : container.offsetHeight;
|
|
373
|
+
|
|
374
|
+
// Bail out if container has zero or near-zero dimensions
|
|
375
|
+
if (containerSize < 1) return;
|
|
376
|
+
|
|
377
|
+
const deltaPercent = (delta / containerSize) * 100;
|
|
378
|
+
|
|
379
|
+
// Calculate min as percentage based on current container size
|
|
380
|
+
const minPercent = (minSize / containerSize) * 100;
|
|
381
|
+
|
|
382
|
+
// Store original sizes
|
|
383
|
+
const oldSize1 = sizes[index];
|
|
384
|
+
const oldSize2 = sizes[index + 1];
|
|
385
|
+
const totalSize = oldSize1 + oldSize2;
|
|
386
|
+
|
|
387
|
+
// Calculate desired new sizes
|
|
388
|
+
let newSize1 = oldSize1 + deltaPercent;
|
|
389
|
+
let newSize2 = oldSize2 - deltaPercent;
|
|
390
|
+
|
|
391
|
+
// Apply minimum constraints - clamp to valid range
|
|
392
|
+
newSize1 = Math.max(minPercent, newSize1);
|
|
393
|
+
newSize2 = totalSize - newSize1;
|
|
394
|
+
|
|
395
|
+
// Check if second pane violates minimum constraint after first pane clamping
|
|
396
|
+
if (newSize2 < minPercent) {
|
|
397
|
+
newSize2 = minPercent;
|
|
398
|
+
newSize1 = totalSize - newSize2;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Only update if changed significantly
|
|
402
|
+
if (Math.abs(newSize1 - oldSize1) > MIN_CHANGE_THRESHOLD) {
|
|
403
|
+
sizes[index] = newSize1;
|
|
404
|
+
sizes[index + 1] = newSize2;
|
|
405
|
+
startPos = currentPos;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
330
409
|
function handleKeyResize(e: KeyboardEvent, index: number) {
|
|
331
410
|
if (!container) return;
|
|
332
411
|
if (index < 0 || index + 1 >= sizes.length) return;
|
|
@@ -6,6 +6,7 @@ interface SplitPaneContext {
|
|
|
6
6
|
getDirection: () => "horizontal" | "vertical";
|
|
7
7
|
getIsDragging: () => boolean;
|
|
8
8
|
onMouseDown: (e: MouseEvent, index: number) => void;
|
|
9
|
+
onTouchStart: (e: TouchEvent, index: number) => void;
|
|
9
10
|
onKeyDown: (e: KeyboardEvent, index: number) => void;
|
|
10
11
|
}
|
|
11
12
|
export declare function setSplitPaneContext(ctx: SplitPaneContext): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -1815,6 +1815,7 @@ export interface DividerProps {
|
|
|
1815
1815
|
direction: "horizontal" | "vertical";
|
|
1816
1816
|
index: number;
|
|
1817
1817
|
onMouseDown: (e: MouseEvent, index: number) => void;
|
|
1818
|
+
onTouchStart: (e: TouchEvent, index: number) => void;
|
|
1818
1819
|
onKeyDown: (e: KeyboardEvent, index: number) => void;
|
|
1819
1820
|
isDragging: boolean;
|
|
1820
1821
|
class?: string;
|