flowbite-svelte 1.24.1 → 1.26.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.
- package/dist/command-palette/CommandPalette.svelte +1 -1
- package/dist/command-palette/CommandPalette.svelte.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/kanban/KanbanCard.svelte +1 -1
- package/dist/kanban/KanbanCard.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/spinner/Spinner.svelte +72 -14
- package/dist/spinner/Spinner.svelte.d.ts +2 -1
- package/dist/spinner/theme.d.ts +23 -2
- package/dist/spinner/theme.js +29 -22
- package/dist/split-pane/Divider.svelte +3 -2
- package/dist/split-pane/Divider.svelte.d.ts +1 -1
- package/dist/split-pane/Pane.svelte +1 -1
- package/dist/split-pane/Pane.svelte.d.ts +1 -1
- package/dist/split-pane/SplitPane.svelte +35 -91
- package/dist/split-pane/SplitPane.svelte.d.ts +1 -1
- package/dist/step-indicator/StepIndicator.svelte +1 -1
- package/dist/step-indicator/StepIndicator.svelte.d.ts +1 -1
- package/dist/stepper/BreadcrumbStepper.svelte +1 -1
- package/dist/stepper/BreadcrumbStepper.svelte.d.ts +1 -1
- package/dist/stepper/DetailedStepper.svelte +1 -1
- package/dist/stepper/DetailedStepper.svelte.d.ts +1 -1
- package/dist/stepper/ProgressStepper.svelte +1 -1
- package/dist/stepper/ProgressStepper.svelte.d.ts +1 -1
- package/dist/stepper/Stepper.svelte +1 -1
- package/dist/stepper/Stepper.svelte.d.ts +1 -1
- package/dist/stepper/TimelineStepper.svelte +1 -1
- package/dist/stepper/TimelineStepper.svelte.d.ts +1 -1
- package/dist/stepper/VerticalStepper.svelte +1 -1
- package/dist/stepper/VerticalStepper.svelte.d.ts +1 -1
- package/dist/table/Table.svelte +1 -1
- package/dist/table/Table.svelte.d.ts +1 -1
- package/dist/table/TableBody.svelte +1 -1
- package/dist/table/TableBody.svelte.d.ts +1 -1
- package/dist/table/TableBodyCell.svelte +1 -1
- package/dist/table/TableBodyCell.svelte.d.ts +1 -1
- package/dist/table/TableBodyRow.svelte +1 -1
- package/dist/table/TableBodyRow.svelte.d.ts +1 -1
- package/dist/table/TableHead.svelte +1 -1
- package/dist/table/TableHead.svelte.d.ts +1 -1
- package/dist/table/TableHeadCell.svelte +1 -1
- package/dist/table/TableHeadCell.svelte.d.ts +1 -1
- package/dist/table/TableSearch.svelte +1 -1
- package/dist/table/TableSearch.svelte.d.ts +1 -1
- package/dist/tabs/TabItem.svelte +1 -1
- package/dist/tabs/TabItem.svelte.d.ts +1 -1
- package/dist/tabs/Tabs.svelte +1 -1
- package/dist/tabs/Tabs.svelte.d.ts +1 -1
- package/dist/theme/themes.d.ts +1 -0
- package/dist/theme/themes.js +1 -0
- package/dist/timeline/Activity.svelte +1 -1
- package/dist/timeline/Activity.svelte.d.ts +1 -1
- package/dist/timeline/ActivityItem.svelte +1 -1
- package/dist/timeline/ActivityItem.svelte.d.ts +1 -1
- package/dist/timeline/Group.svelte +1 -1
- package/dist/timeline/Group.svelte.d.ts +1 -1
- package/dist/timeline/GroupItem.svelte +1 -1
- package/dist/timeline/GroupItem.svelte.d.ts +1 -1
- package/dist/timeline/Timeline.svelte +1 -1
- package/dist/timeline/Timeline.svelte.d.ts +1 -1
- package/dist/timeline/TimelineItem.svelte +1 -1
- package/dist/timeline/TimelineItem.svelte.d.ts +1 -1
- package/dist/toast/Toast.svelte +1 -1
- package/dist/toast/Toast.svelte.d.ts +1 -1
- package/dist/tooltip/Tooltip.svelte +1 -1
- package/dist/tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/typography/a/A.svelte +1 -1
- package/dist/typography/a/A.svelte.d.ts +1 -1
- package/dist/typography/blockquote/Blockquote.svelte +1 -1
- package/dist/typography/blockquote/Blockquote.svelte.d.ts +1 -1
- package/dist/typography/descriptionlist/DescriptionList.svelte +1 -1
- package/dist/typography/descriptionlist/DescriptionList.svelte.d.ts +1 -1
- package/dist/typography/heading/Heading.svelte +1 -1
- package/dist/typography/heading/Heading.svelte.d.ts +1 -1
- package/dist/typography/img/EnhancedImg.svelte +1 -1
- package/dist/typography/img/EnhancedImg.svelte.d.ts +1 -1
- package/dist/typography/img/Img.svelte +1 -1
- package/dist/typography/img/Img.svelte.d.ts +1 -1
- package/dist/typography/layout/Layout.svelte +1 -1
- package/dist/typography/layout/Layout.svelte.d.ts +1 -1
- package/dist/typography/list/Li.svelte +1 -1
- package/dist/typography/list/Li.svelte.d.ts +1 -1
- package/dist/typography/list/List.svelte +1 -1
- package/dist/typography/list/List.svelte.d.ts +1 -1
- package/dist/typography/mark/Mark.svelte +1 -1
- package/dist/typography/mark/Mark.svelte.d.ts +1 -1
- package/dist/typography/paragraph/P.svelte +1 -1
- package/dist/typography/paragraph/P.svelte.d.ts +1 -1
- package/dist/typography/secondary/Secondary.svelte +1 -1
- package/dist/typography/secondary/Secondary.svelte.d.ts +1 -1
- package/dist/typography/span/Span.svelte +1 -1
- package/dist/typography/span/Span.svelte.d.ts +1 -1
- package/dist/utils/Arrow.svelte +1 -1
- package/dist/utils/Arrow.svelte.d.ts +1 -1
- package/dist/utils/Popper.svelte +1 -1
- package/dist/utils/Popper.svelte.d.ts +1 -1
- package/dist/utils/nonPassiveTouch.d.ts +3 -0
- package/dist/utils/nonPassiveTouch.js +8 -0
- package/dist/video/Video.svelte +1 -1
- package/dist/video/Video.svelte.d.ts +1 -1
- package/dist/virtual-masonry/VirtualMasonry.svelte +185 -0
- package/dist/virtual-masonry/VirtualMasonry.svelte.d.ts +44 -0
- package/dist/virtual-masonry/index.d.ts +3 -0
- package/dist/virtual-masonry/index.js +2 -0
- package/dist/virtual-masonry/theme.d.ts +40 -0
- package/dist/virtual-masonry/theme.js +18 -0
- package/package.json +5 -1
|
@@ -2,7 +2,7 @@ import type { LiProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [LiProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [LiProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2009)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop icon
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
@component
|
|
29
29
|
[Go to docs](https://flowbite-svelte.com/)
|
|
30
30
|
## Type
|
|
31
|
-
[ListProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
31
|
+
[ListProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2001)
|
|
32
32
|
## Props
|
|
33
33
|
@prop children
|
|
34
34
|
@prop tag = "ul"
|
|
@@ -2,7 +2,7 @@ import type { ListProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [ListProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [ListProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2001)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop tag = "ul"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
@component
|
|
18
18
|
[Go to docs](https://flowbite-svelte.com/)
|
|
19
19
|
## Type
|
|
20
|
-
[MarkProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
20
|
+
[MarkProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2015)
|
|
21
21
|
## Props
|
|
22
22
|
@prop children
|
|
23
23
|
@prop class: className
|
|
@@ -2,7 +2,7 @@ import type { MarkProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [MarkProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [MarkProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2015)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop class: className
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
@component
|
|
33
33
|
[Go to docs](https://flowbite-svelte.com/)
|
|
34
34
|
## Type
|
|
35
|
-
[ParagraphProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
35
|
+
[ParagraphProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2020)
|
|
36
36
|
## Props
|
|
37
37
|
@prop children
|
|
38
38
|
@prop class: className = "text-gray-900 dark:text-white"
|
|
@@ -2,7 +2,7 @@ import type { ParagraphProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [ParagraphProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [ParagraphProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2020)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop class: className = "text-gray-900 dark:text-white"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
@component
|
|
18
18
|
[Go to docs](https://flowbite-svelte.com/)
|
|
19
19
|
## Type
|
|
20
|
-
[SecondaryProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
20
|
+
[SecondaryProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2028)
|
|
21
21
|
## Props
|
|
22
22
|
@prop children
|
|
23
23
|
@prop class: className
|
|
@@ -2,7 +2,7 @@ import type { SecondaryProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [SecondaryProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [SecondaryProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2028)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop class: className
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
@component
|
|
35
35
|
[Go to docs](https://flowbite-svelte.com/)
|
|
36
36
|
## Type
|
|
37
|
-
[SpanProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
37
|
+
[SpanProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2033)
|
|
38
38
|
## Props
|
|
39
39
|
@prop children
|
|
40
40
|
@prop class: className
|
|
@@ -2,7 +2,7 @@ import type { SpanProps } from "../../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [SpanProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [SpanProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2033)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop class: className
|
package/dist/utils/Arrow.svelte
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
@component
|
|
51
51
|
[Go to docs](https://flowbite-svelte.com/)
|
|
52
52
|
## Type
|
|
53
|
-
[ArrowProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
53
|
+
[ArrowProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2077)
|
|
54
54
|
## Props
|
|
55
55
|
@prop placement = "top"
|
|
56
56
|
@prop cords
|
|
@@ -2,7 +2,7 @@ import type { ArrowProps } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [ArrowProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [ArrowProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2077)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop placement = "top"
|
|
8
8
|
* @prop cords
|
package/dist/utils/Popper.svelte
CHANGED
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
@component
|
|
263
263
|
[Go to docs](https://flowbite-svelte.com/)
|
|
264
264
|
## Type
|
|
265
|
-
[PopperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
265
|
+
[PopperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2055)
|
|
266
266
|
## Props
|
|
267
267
|
@prop triggeredBy
|
|
268
268
|
@prop triggerDelay = DEFAULT_TRIGGER_DELAY
|
|
@@ -2,7 +2,7 @@ import type { PopperProps } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [PopperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [PopperProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2055)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop triggeredBy
|
|
8
8
|
* @prop triggerDelay = DEFAULT_TRIGGER_DELAY
|
package/dist/video/Video.svelte
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
@component
|
|
22
22
|
[Go to docs](https://flowbite-svelte.com/)
|
|
23
23
|
## Type
|
|
24
|
-
[VideoProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
24
|
+
[VideoProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2042)
|
|
25
25
|
## Props
|
|
26
26
|
@prop children
|
|
27
27
|
@prop type = "video/mp4"
|
|
@@ -2,7 +2,7 @@ import type { VideoProps } from "../types";
|
|
|
2
2
|
/**
|
|
3
3
|
* [Go to docs](https://flowbite-svelte.com/)
|
|
4
4
|
* ## Type
|
|
5
|
-
* [VideoProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#
|
|
5
|
+
* [VideoProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L2042)
|
|
6
6
|
* ## Props
|
|
7
7
|
* @prop children
|
|
8
8
|
* @prop type = "video/mp4"
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { VirtualMasonryProps } from "../types";
|
|
3
|
+
import { virtualMasonry } from "./theme";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { getTheme } from "../theme/themeUtils";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
items = [],
|
|
9
|
+
columns = 3,
|
|
10
|
+
gap = 16,
|
|
11
|
+
height = 600,
|
|
12
|
+
overscan = 200,
|
|
13
|
+
getItemHeight,
|
|
14
|
+
scrollToIndex,
|
|
15
|
+
children,
|
|
16
|
+
ariaLabel = "Virtual masonry grid",
|
|
17
|
+
class: className,
|
|
18
|
+
classes,
|
|
19
|
+
contained = false
|
|
20
|
+
}: VirtualMasonryProps<T> = $props();
|
|
21
|
+
|
|
22
|
+
const theme = getTheme("virtualMasonry");
|
|
23
|
+
|
|
24
|
+
let container: HTMLDivElement | undefined;
|
|
25
|
+
let containerWidth = $state(0);
|
|
26
|
+
let scrollTop = $state(0);
|
|
27
|
+
let rafId: number | undefined;
|
|
28
|
+
|
|
29
|
+
const styles = virtualMasonry({ contained });
|
|
30
|
+
|
|
31
|
+
const containStyle = $derived.by(() => {
|
|
32
|
+
if (!contained) return "";
|
|
33
|
+
const itemClasses = clsx(classes?.item);
|
|
34
|
+
const hasCustomContain = /\[contain:[^\]]+\]/.test(itemClasses);
|
|
35
|
+
return hasCustomContain ? "" : "contain: layout style paint;";
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Calculate column width based on container width
|
|
39
|
+
const columnWidth = $derived.by(() => {
|
|
40
|
+
if (containerWidth === 0) return 0;
|
|
41
|
+
return (containerWidth - gap * (columns - 1)) / columns;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Position items in columns
|
|
45
|
+
interface PositionedItem {
|
|
46
|
+
item: T;
|
|
47
|
+
index: number;
|
|
48
|
+
x: number;
|
|
49
|
+
y: number;
|
|
50
|
+
height: number;
|
|
51
|
+
column: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const positionedItems = $derived.by((): PositionedItem[] => {
|
|
55
|
+
if (columnWidth === 0) return [];
|
|
56
|
+
|
|
57
|
+
const columnHeights = new Array(columns).fill(0);
|
|
58
|
+
const positioned: PositionedItem[] = [];
|
|
59
|
+
|
|
60
|
+
for (let i = 0; i < items.length; i++) {
|
|
61
|
+
// Find shortest column
|
|
62
|
+
const shortestColumn = columnHeights.indexOf(Math.min(...columnHeights));
|
|
63
|
+
const itemHeight = getItemHeight ? getItemHeight(items[i], i) : 200;
|
|
64
|
+
|
|
65
|
+
positioned.push({
|
|
66
|
+
item: items[i],
|
|
67
|
+
index: i,
|
|
68
|
+
x: shortestColumn * (columnWidth + gap),
|
|
69
|
+
y: columnHeights[shortestColumn],
|
|
70
|
+
height: itemHeight,
|
|
71
|
+
column: shortestColumn
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
columnHeights[shortestColumn] += itemHeight + gap;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return positioned;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Total height is the tallest column
|
|
81
|
+
const totalHeight = $derived.by(() => {
|
|
82
|
+
if (positionedItems.length === 0) return 0;
|
|
83
|
+
return Math.max(...positionedItems.map((item) => item.y + item.height));
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// Visible items based on scroll position with overscan
|
|
87
|
+
const visibleItems = $derived.by(() => {
|
|
88
|
+
const viewportTop = scrollTop - overscan;
|
|
89
|
+
const viewportBottom = scrollTop + height + overscan;
|
|
90
|
+
|
|
91
|
+
return positionedItems.filter((item) => {
|
|
92
|
+
const itemTop = item.y;
|
|
93
|
+
const itemBottom = item.y + item.height;
|
|
94
|
+
return itemBottom >= viewportTop && itemTop <= viewportBottom;
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Performance optimized scroll handler using RAF
|
|
99
|
+
function handleScroll() {
|
|
100
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
101
|
+
rafId = requestAnimationFrame(() => {
|
|
102
|
+
if (container) scrollTop = container.scrollTop;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Scroll to specific index
|
|
107
|
+
function scrollToIndexImpl(index: number) {
|
|
108
|
+
if (!container || index < 0 || index >= items.length) return;
|
|
109
|
+
const item = positionedItems[index];
|
|
110
|
+
if (item) {
|
|
111
|
+
container.scrollTop = item.y;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Bind scrollToIndex function to parent component
|
|
116
|
+
$effect(() => {
|
|
117
|
+
if (scrollToIndex) {
|
|
118
|
+
scrollToIndex(scrollToIndexImpl);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Measure container width on mount and resize
|
|
123
|
+
$effect(() => {
|
|
124
|
+
if (!container) return;
|
|
125
|
+
|
|
126
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
containerWidth = entry.contentRect.width;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
resizeObserver.observe(container);
|
|
133
|
+
|
|
134
|
+
return () => {
|
|
135
|
+
resizeObserver.disconnect();
|
|
136
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<div
|
|
142
|
+
bind:this={container}
|
|
143
|
+
onscroll={handleScroll}
|
|
144
|
+
role="list"
|
|
145
|
+
aria-label={ariaLabel}
|
|
146
|
+
class={styles.container({ class: clsx(theme?.container, className) })}
|
|
147
|
+
style={`height:${height}px; position:relative;`}
|
|
148
|
+
>
|
|
149
|
+
<div class={styles.spacer({ class: clsx(theme?.spacer, classes?.spacer) })} style={`height:${totalHeight}px;`}>
|
|
150
|
+
<div class={styles.content({ class: clsx(theme?.content, classes?.content) })}>
|
|
151
|
+
{#each visibleItems as { item, index, x, y, height: itemHeight } (index)}
|
|
152
|
+
<div
|
|
153
|
+
role="listitem"
|
|
154
|
+
aria-setsize={items.length}
|
|
155
|
+
aria-posinset={index + 1}
|
|
156
|
+
class={styles.item({ class: clsx(theme?.item, classes?.item) })}
|
|
157
|
+
style={`position:absolute; left:${x}px; top:${y}px; width:${columnWidth}px; height:${itemHeight}px; ${containStyle}`}
|
|
158
|
+
>
|
|
159
|
+
{@render children?.(item, index)}
|
|
160
|
+
</div>
|
|
161
|
+
{/each}
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<!--
|
|
167
|
+
@component
|
|
168
|
+
VirtualMasonry - Virtualized masonry/pinterest layout for efficient rendering of large image grids
|
|
169
|
+
[Go to docs](https://flowbite-svelte.com/)
|
|
170
|
+
## Type
|
|
171
|
+
[VirtualMasonryProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts)
|
|
172
|
+
## Props
|
|
173
|
+
@prop items = []
|
|
174
|
+
@prop columns = 3
|
|
175
|
+
@prop gap = 16
|
|
176
|
+
@prop height = 600
|
|
177
|
+
@prop overscan = 200
|
|
178
|
+
@prop getItemHeight
|
|
179
|
+
@prop scrollToIndex
|
|
180
|
+
@prop children
|
|
181
|
+
@prop ariaLabel = "Virtual masonry grid"
|
|
182
|
+
@prop contained = false
|
|
183
|
+
@prop class: className
|
|
184
|
+
@prop classes
|
|
185
|
+
-->
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { VirtualMasonryProps } from "../types";
|
|
2
|
+
declare function $$render<T>(): {
|
|
3
|
+
props: VirtualMasonryProps<T>;
|
|
4
|
+
exports: {};
|
|
5
|
+
bindings: "";
|
|
6
|
+
slots: {};
|
|
7
|
+
events: {};
|
|
8
|
+
};
|
|
9
|
+
declare class __sveltets_Render<T> {
|
|
10
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
13
|
+
bindings(): "";
|
|
14
|
+
exports(): {};
|
|
15
|
+
}
|
|
16
|
+
interface $$IsomorphicComponent {
|
|
17
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
18
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
19
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
20
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* VirtualMasonry - Virtualized masonry/pinterest layout for efficient rendering of large image grids
|
|
25
|
+
* [Go to docs](https://flowbite-svelte.com/)
|
|
26
|
+
* ## Type
|
|
27
|
+
* [VirtualMasonryProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts)
|
|
28
|
+
* ## Props
|
|
29
|
+
* @prop items = []
|
|
30
|
+
* @prop columns = 3
|
|
31
|
+
* @prop gap = 16
|
|
32
|
+
* @prop height = 600
|
|
33
|
+
* @prop overscan = 200
|
|
34
|
+
* @prop getItemHeight
|
|
35
|
+
* @prop scrollToIndex
|
|
36
|
+
* @prop children
|
|
37
|
+
* @prop ariaLabel = "Virtual masonry grid"
|
|
38
|
+
* @prop contained = false
|
|
39
|
+
* @prop class: className
|
|
40
|
+
* @prop classes
|
|
41
|
+
*/
|
|
42
|
+
declare const VirtualMasonry: $$IsomorphicComponent;
|
|
43
|
+
type VirtualMasonry<T> = InstanceType<typeof VirtualMasonry<T>>;
|
|
44
|
+
export default VirtualMasonry;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import type { Classes } from "../theme/themeUtils";
|
|
3
|
+
export declare const virtualMasonry: import("tailwind-variants").TVReturnType<{
|
|
4
|
+
contained: {
|
|
5
|
+
true: {
|
|
6
|
+
item: string;
|
|
7
|
+
};
|
|
8
|
+
false: {};
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
container: string;
|
|
12
|
+
spacer: string;
|
|
13
|
+
content: string;
|
|
14
|
+
item: string;
|
|
15
|
+
}, undefined, {
|
|
16
|
+
contained: {
|
|
17
|
+
true: {
|
|
18
|
+
item: string;
|
|
19
|
+
};
|
|
20
|
+
false: {};
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
container: string;
|
|
24
|
+
spacer: string;
|
|
25
|
+
content: string;
|
|
26
|
+
item: string;
|
|
27
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
28
|
+
contained: {
|
|
29
|
+
true: {
|
|
30
|
+
item: string;
|
|
31
|
+
};
|
|
32
|
+
false: {};
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
container: string;
|
|
36
|
+
spacer: string;
|
|
37
|
+
content: string;
|
|
38
|
+
item: string;
|
|
39
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
40
|
+
export type VirtualMasonryVariants = VariantProps<typeof virtualMasonry> & Classes<typeof virtualMasonry>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tv } from "tailwind-variants";
|
|
2
|
+
export const virtualMasonry = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
container: "overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-transparent",
|
|
5
|
+
spacer: "relative",
|
|
6
|
+
content: "relative w-full",
|
|
7
|
+
item: ""
|
|
8
|
+
},
|
|
9
|
+
variants: {
|
|
10
|
+
contained: {
|
|
11
|
+
true: { item: "[contain:layout_style_paint]" },
|
|
12
|
+
false: {}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
contained: false
|
|
17
|
+
}
|
|
18
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flowbite-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Flowbite components for Svelte",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": {
|
|
@@ -861,6 +861,10 @@
|
|
|
861
861
|
"types": "./dist/video/Video.svelte.d.ts",
|
|
862
862
|
"svelte": "./dist/video/Video.svelte"
|
|
863
863
|
},
|
|
864
|
+
"./VirtualMasonry.svelte": {
|
|
865
|
+
"types": "./dist/virtual-masonry/VirtualMasonry.svelte.d.ts",
|
|
866
|
+
"svelte": "./dist/virtual-masonry/VirtualMasonry.svelte"
|
|
867
|
+
},
|
|
864
868
|
"./VirtualList.svelte": {
|
|
865
869
|
"types": "./dist/virtuallist/VirtualList.svelte.d.ts",
|
|
866
870
|
"svelte": "./dist/virtuallist/VirtualList.svelte"
|