@x33025/sveltely 0.1.24 → 0.1.25
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/actions/LoaderOverlay.svelte +10 -3
- package/dist/components/Library/Accordion/Accordion.demo.svelte +21 -0
- package/dist/components/Library/Accordion/Accordion.demo.svelte.d.ts +9 -0
- package/dist/components/Library/Accordion/Accordion.svelte +78 -0
- package/dist/components/Library/Accordion/Accordion.svelte.d.ts +14 -0
- package/dist/components/Library/Accordion/Content.svelte +57 -0
- package/dist/components/Library/Accordion/Content.svelte.d.ts +8 -0
- package/dist/components/Library/Accordion/Header.svelte +98 -0
- package/dist/components/Library/Accordion/Header.svelte.d.ts +10 -0
- package/dist/components/Library/Accordion/context.d.ts +9 -0
- package/dist/components/Library/Accordion/context.js +6 -0
- package/dist/components/Library/Accordion/index.d.ts +9 -0
- package/dist/components/Library/Accordion/index.js +7 -0
- package/dist/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +1 -1
- package/dist/components/Library/ArticleEditor/ArticleEditor.svelte +1 -2
- package/dist/components/Library/ArticleEditor/Blocks/Table.svelte +1 -1
- package/dist/components/Library/ChipInput/ChipInput.demo.svelte +1 -1
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte +5 -3
- package/dist/components/Library/Grid/Grid.demo.svelte +58 -0
- package/dist/components/Library/Grid/Grid.demo.svelte.d.ts +25 -0
- package/dist/components/Library/Grid/Grid.svelte +120 -26
- package/dist/components/Library/Grid/Grid.svelte.d.ts +38 -10
- package/dist/components/Library/Grid/GridItem.svelte +8 -13
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte +1 -1
- package/dist/components/Library/Label/Label.demo.svelte +1 -1
- package/dist/components/Library/Label/Label.svelte +5 -13
- package/dist/components/Library/Notifications/Notifications.demo.svelte +63 -0
- package/dist/components/Library/Notifications/Notifications.demo.svelte.d.ts +9 -0
- package/dist/components/Library/Notifications/Notifications.svelte +155 -0
- package/dist/components/Library/Notifications/Notifications.svelte.d.ts +35 -0
- package/dist/components/Library/Notifications/index.d.ts +2 -0
- package/dist/components/Library/Notifications/index.js +1 -0
- package/dist/components/Library/Notifications/types.d.ts +8 -0
- package/dist/components/Library/Notifications/types.js +1 -0
- package/dist/components/Library/NumberField/NumberField.svelte +25 -19
- package/dist/components/Library/Pagination/Pagination.svelte +6 -18
- package/dist/components/Library/ScrollView/ScrollView.svelte +76 -4
- package/dist/components/Library/ScrollView/ScrollView.svelte.d.ts +9 -2
- package/dist/components/Library/ScrollView/index.d.ts +1 -1
- package/dist/components/Library/SearchField/SearchField.demo.svelte +1 -1
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +1 -1
- package/dist/components/Library/Slider/Slider.demo.svelte +1 -1
- package/dist/components/Library/Table/Table.demo.svelte +9 -1
- package/dist/components/Library/Table/Table.svelte +315 -112
- package/dist/components/Library/Table/Table.svelte.d.ts +7 -1
- package/dist/components/Library/TextField/TextField.svelte +20 -14
- package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +1 -1
- package/dist/components/Local/ColorStyleControls.svelte +25 -64
- package/dist/components/Local/ComponentGrid.svelte +103 -22
- package/dist/components/Local/ComponentGrid.svelte.d.ts +2 -1
- package/dist/components/Local/ComponentPage.svelte +74 -0
- package/dist/components/Local/ComponentPage.svelte.d.ts +13 -0
- package/dist/components/Local/HeroCard.svelte +10 -5
- package/dist/components/Local/LayoutStyleControls.svelte +6 -6
- package/dist/index.d.ts +8 -3
- package/dist/index.js +4 -1
- package/dist/style/index.css +1 -2
- package/dist/style/layout.d.ts +11 -26
- package/dist/style/layout.js +31 -53
- package/dist/style.css +4 -1
- package/dist/viewport/geometry.d.ts +8 -0
- package/dist/viewport/geometry.js +43 -0
- package/dist/viewport/index.d.ts +4 -0
- package/dist/viewport/index.js +4 -0
- package/dist/viewport/layout.d.ts +4 -0
- package/dist/viewport/layout.js +138 -0
- package/dist/viewport/placement.d.ts +4 -0
- package/dist/viewport/placement.js +14 -0
- package/dist/viewport/types.d.ts +81 -0
- package/dist/viewport/types.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Spinner from '../components/Library/Spinner/Spinner.svelte';
|
|
3
|
-
import VStack from '../components/Library/VStack/VStack.svelte';
|
|
4
3
|
|
|
5
4
|
type Props = {
|
|
6
5
|
text: string;
|
|
@@ -32,12 +31,12 @@
|
|
|
32
31
|
aria-label={text || 'Loading'}
|
|
33
32
|
style={overlayStyle}
|
|
34
33
|
>
|
|
35
|
-
<
|
|
34
|
+
<div class="sveltely-loader-content">
|
|
36
35
|
<Spinner size="calc(var(--sveltely-loader-font-size) * 1.143)" />
|
|
37
36
|
{#if text}
|
|
38
37
|
<span class="sveltely-loader-text">{text}</span>
|
|
39
38
|
{/if}
|
|
40
|
-
</
|
|
39
|
+
</div>
|
|
41
40
|
</div>
|
|
42
41
|
|
|
43
42
|
<style>
|
|
@@ -57,6 +56,14 @@
|
|
|
57
56
|
text-align: center;
|
|
58
57
|
}
|
|
59
58
|
|
|
59
|
+
.sveltely-loader-content {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
gap: var(--sveltely-gap, 0.5rem);
|
|
65
|
+
}
|
|
66
|
+
|
|
60
67
|
.sveltely-loader-text {
|
|
61
68
|
max-width: 100%;
|
|
62
69
|
overflow: hidden;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'Accordion',
|
|
4
|
+
description: 'Single collapsible disclosure primitive with header and content.',
|
|
5
|
+
columnSpan: 2
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import Accordion from './index';
|
|
11
|
+
|
|
12
|
+
let open = $state(true);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Accordion bind:open>
|
|
16
|
+
<Accordion.Header>Release notes</Accordion.Header>
|
|
17
|
+
<Accordion.Content>
|
|
18
|
+
Small primitives stay easy to compose: the header owns the toggle and the content collapses
|
|
19
|
+
under it.
|
|
20
|
+
</Accordion.Content>
|
|
21
|
+
</Accordion>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
columnSpan: number;
|
|
5
|
+
};
|
|
6
|
+
import Accordion from './index';
|
|
7
|
+
declare const Accordion: import("svelte").Component<Record<string, never>, {}, "">;
|
|
8
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
9
|
+
export default Accordion;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export { default as Header } from './Header.svelte';
|
|
3
|
+
export { default as Content } from './Content.svelte';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
9
|
+
import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
|
|
10
|
+
import { setAccordionContext } from './context';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
} & StyleProps &
|
|
18
|
+
Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'style'>;
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
open = $bindable(false),
|
|
23
|
+
disabled = false,
|
|
24
|
+
onOpenChange,
|
|
25
|
+
...restProps
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
|
|
29
|
+
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
30
|
+
const forwardedProps = $derived(extractedStyleProps.restProps);
|
|
31
|
+
const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'accordion'));
|
|
32
|
+
|
|
33
|
+
function setOpen(nextOpen: boolean) {
|
|
34
|
+
if (disabled || open === nextOpen) return;
|
|
35
|
+
open = nextOpen;
|
|
36
|
+
onOpenChange?.(nextOpen);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setAccordionContext({
|
|
40
|
+
get open() {
|
|
41
|
+
return open;
|
|
42
|
+
},
|
|
43
|
+
get disabled() {
|
|
44
|
+
return disabled;
|
|
45
|
+
},
|
|
46
|
+
toggle: () => setOpen(!open),
|
|
47
|
+
openPanel: () => setOpen(true),
|
|
48
|
+
closePanel: () => setOpen(false)
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<div class="accordion" data-open={open} data-disabled={disabled} style={rootStyle} {...forwardedProps}>
|
|
53
|
+
{#if children}
|
|
54
|
+
{@render children()}
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.accordion {
|
|
60
|
+
--accordion-border-radius: var(--sveltely-border-radius);
|
|
61
|
+
--accordion-font-size: var(--sveltely-font-size);
|
|
62
|
+
--accordion-padding-x: var(--sveltely-padding-x);
|
|
63
|
+
--accordion-padding-y: var(--sveltely-padding-y);
|
|
64
|
+
--accordion-gap: var(--sveltely-gap);
|
|
65
|
+
align-self: flex-start;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
border: 1px solid var(--sveltely-border-color);
|
|
68
|
+
border-radius: var(--accordion-border-radius);
|
|
69
|
+
background: var(--sveltely-background-color);
|
|
70
|
+
color: var(--sveltely-text-primary-color);
|
|
71
|
+
font-size: var(--accordion-font-size);
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.accordion[data-disabled='true'] {
|
|
76
|
+
opacity: 0.6;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as Header } from './Header.svelte';
|
|
2
|
+
export { default as Content } from './Content.svelte';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import { type StyleProps } from '../../../style/surface';
|
|
6
|
+
type Props = {
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
} & StyleProps & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'style'>;
|
|
12
|
+
declare const Accordion: import("svelte").Component<Props, {}, "open">;
|
|
13
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
14
|
+
export default Accordion;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { getAccordionContext } from './context';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'style'>;
|
|
9
|
+
|
|
10
|
+
let { children, ...props }: Props = $props();
|
|
11
|
+
|
|
12
|
+
const accordion = getAccordionContext();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
class="accordion-content"
|
|
17
|
+
data-open={accordion.open}
|
|
18
|
+
role="region"
|
|
19
|
+
aria-hidden={!accordion.open}
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<div class="accordion-content-inner">
|
|
23
|
+
{#if children}
|
|
24
|
+
{@render children()}
|
|
25
|
+
{/if}
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.accordion-content {
|
|
31
|
+
display: grid;
|
|
32
|
+
grid-template-rows: 0fr;
|
|
33
|
+
border-top: 1px solid transparent;
|
|
34
|
+
transform-origin: top;
|
|
35
|
+
transition:
|
|
36
|
+
grid-template-rows 180ms ease,
|
|
37
|
+
border-color 180ms ease;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.accordion-content[data-open='true'] {
|
|
41
|
+
grid-template-rows: 1fr;
|
|
42
|
+
border-top-color: var(--sveltely-border-color);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.accordion-content-inner {
|
|
46
|
+
min-height: 0;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
padding: 0 var(--accordion-padding-x, var(--sveltely-padding-x));
|
|
49
|
+
color: var(--sveltely-text-secondary-color);
|
|
50
|
+
line-height: 1.5;
|
|
51
|
+
transition: padding-block 180ms ease;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.accordion-content[data-open='true'] .accordion-content-inner {
|
|
55
|
+
padding-block: var(--accordion-padding-y, var(--sveltely-padding-y));
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type Props = {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class' | 'style'>;
|
|
6
|
+
declare const Content: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type Content = ReturnType<typeof Content>;
|
|
8
|
+
export default Content;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ChevronDownIcon } from '@lucide/svelte';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
5
|
+
import { getAccordionContext, type AccordionState } from './context';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
children?: Snippet<[AccordionState]>;
|
|
9
|
+
label?: string;
|
|
10
|
+
} & Omit<HTMLButtonAttributes, 'children' | 'class' | 'style'>;
|
|
11
|
+
type ButtonMouseEvent = MouseEvent & { currentTarget: EventTarget & HTMLButtonElement };
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
label,
|
|
16
|
+
disabled = false,
|
|
17
|
+
type = 'button',
|
|
18
|
+
onclick,
|
|
19
|
+
...props
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
const accordion = getAccordionContext();
|
|
23
|
+
const buttonDisabled = $derived(disabled || accordion.disabled);
|
|
24
|
+
|
|
25
|
+
function handleClick(event: ButtonMouseEvent) {
|
|
26
|
+
if (buttonDisabled) return;
|
|
27
|
+
onclick?.(event);
|
|
28
|
+
if (!event.defaultPrevented) accordion.toggle();
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<button
|
|
33
|
+
{type}
|
|
34
|
+
class="accordion-header"
|
|
35
|
+
data-open={accordion.open}
|
|
36
|
+
aria-expanded={accordion.open}
|
|
37
|
+
disabled={buttonDisabled}
|
|
38
|
+
{...props}
|
|
39
|
+
onclick={handleClick}
|
|
40
|
+
>
|
|
41
|
+
<span class="accordion-header-label">
|
|
42
|
+
{#if children}
|
|
43
|
+
{@render children(accordion)}
|
|
44
|
+
{:else if label}
|
|
45
|
+
{label}
|
|
46
|
+
{/if}
|
|
47
|
+
</span>
|
|
48
|
+
<ChevronDownIcon class="accordion-header-icon" aria-hidden="true" />
|
|
49
|
+
</button>
|
|
50
|
+
|
|
51
|
+
<style>
|
|
52
|
+
.accordion-header {
|
|
53
|
+
display: flex;
|
|
54
|
+
width: 100%;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: space-between;
|
|
58
|
+
border: 0;
|
|
59
|
+
background: transparent;
|
|
60
|
+
color: inherit;
|
|
61
|
+
gap: var(--accordion-gap, var(--sveltely-gap));
|
|
62
|
+
padding: var(--accordion-padding-y, var(--sveltely-padding-y))
|
|
63
|
+
var(--accordion-padding-x, var(--sveltely-padding-x));
|
|
64
|
+
font: inherit;
|
|
65
|
+
line-height: 1.35;
|
|
66
|
+
text-align: left;
|
|
67
|
+
transition: background-color 150ms;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.accordion-header:disabled {
|
|
71
|
+
cursor: not-allowed;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.accordion-header:not(:disabled) {
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.accordion-header:not(:disabled):hover {
|
|
79
|
+
background: var(--sveltely-control-background-color);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.accordion-header-label {
|
|
83
|
+
min-width: 0;
|
|
84
|
+
flex: 1 1 auto;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.accordion-header-icon {
|
|
88
|
+
width: 1rem;
|
|
89
|
+
height: 1rem;
|
|
90
|
+
flex: 0 0 auto;
|
|
91
|
+
color: var(--sveltely-text-secondary-color);
|
|
92
|
+
transition: transform 150ms;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.accordion-header[data-open='true'] :global(.accordion-header-icon) {
|
|
96
|
+
transform: rotate(180deg);
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import { type AccordionState } from './context';
|
|
4
|
+
type Props = {
|
|
5
|
+
children?: Snippet<[AccordionState]>;
|
|
6
|
+
label?: string;
|
|
7
|
+
} & Omit<HTMLButtonAttributes, 'children' | 'class' | 'style'>;
|
|
8
|
+
declare const Header: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type Header = ReturnType<typeof Header>;
|
|
10
|
+
export default Header;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type AccordionState = {
|
|
2
|
+
get open(): boolean;
|
|
3
|
+
get disabled(): boolean;
|
|
4
|
+
toggle: () => void;
|
|
5
|
+
openPanel: () => void;
|
|
6
|
+
closePanel: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const setAccordionContext: (context: AccordionState) => void;
|
|
9
|
+
export declare const getAccordionContext: () => AccordionState;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const accordionContextKey = Symbol('accordion');
|
|
3
|
+
export const setAccordionContext = (context) => {
|
|
4
|
+
setContext(accordionContextKey, context);
|
|
5
|
+
};
|
|
6
|
+
export const getAccordionContext = () => getContext(accordionContextKey);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import AccordionComponent from './Accordion.svelte';
|
|
2
|
+
import Header from './Header.svelte';
|
|
3
|
+
import Content from './Content.svelte';
|
|
4
|
+
declare const Accordion: typeof AccordionComponent & {
|
|
5
|
+
Header: typeof Header;
|
|
6
|
+
Content: typeof Content;
|
|
7
|
+
};
|
|
8
|
+
export default Accordion;
|
|
9
|
+
export type { AccordionState } from './context';
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
let tags = $state(['svelte', 'ui', 'search']);
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
|
-
<VStack width="
|
|
15
|
+
<VStack width="24rem" gap={5}>
|
|
16
16
|
<ChipInput bind:tags />
|
|
17
17
|
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">Tags: {tags.join(', ')}</p>
|
|
18
18
|
</VStack>
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
{#snippet trigger()}
|
|
124
124
|
<Dropdown.Trigger>
|
|
125
125
|
{#if selectedWebsite}
|
|
126
|
-
<HStack
|
|
126
|
+
<HStack gap={5}>
|
|
127
127
|
<span class="truncate text-[var(--sveltely-text-primary-color)]"
|
|
128
128
|
>{selectedWebsite.name}</span
|
|
129
129
|
>
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
{#each visibleWebsites as website (website.id)}
|
|
167
167
|
<Dropdown.Item value={website.id}>
|
|
168
168
|
{#snippet children({ selected })}
|
|
169
|
-
<VStack
|
|
169
|
+
<VStack gap={1.25}>
|
|
170
170
|
<span class="truncate">{website.name}</span>
|
|
171
171
|
{#if website.domain}
|
|
172
172
|
<span class="truncate text-xs text-[var(--sveltely-text-secondary-color)]"
|
|
@@ -189,6 +189,8 @@
|
|
|
189
189
|
{/if}
|
|
190
190
|
</Dropdown.Section>
|
|
191
191
|
</Dropdown>
|
|
192
|
-
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">
|
|
192
|
+
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">
|
|
193
|
+
Actions clicked: {actionCount}
|
|
194
|
+
</p>
|
|
193
195
|
</VStack>
|
|
194
196
|
</Grid>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
type Tile = {
|
|
3
|
+
id: number;
|
|
4
|
+
title: string;
|
|
5
|
+
tone: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const demo = {
|
|
9
|
+
name: 'Grid',
|
|
10
|
+
description: 'Virtualized fixed-size grid powered by the viewport layout engine.',
|
|
11
|
+
columnSpan: 2,
|
|
12
|
+
rowSpan: 2
|
|
13
|
+
};
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import Grid from './index';
|
|
18
|
+
|
|
19
|
+
const tones = ['#2563eb', '#16a34a', '#d97706', '#db2777'];
|
|
20
|
+
const tiles: Tile[] = Array.from({ length: 400 }, (_, index) => ({
|
|
21
|
+
id: index + 1,
|
|
22
|
+
title: `Tile ${index + 1}`,
|
|
23
|
+
tone: tones[index % tones.length]
|
|
24
|
+
}));
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#snippet tile(item: Tile)}
|
|
28
|
+
<div class="grid-demo-tile" style:--grid-demo-tone={item.tone}>
|
|
29
|
+
<span>{item.title}</span>
|
|
30
|
+
</div>
|
|
31
|
+
{/snippet}
|
|
32
|
+
|
|
33
|
+
<Grid
|
|
34
|
+
items={tiles}
|
|
35
|
+
item={tile}
|
|
36
|
+
columns={4}
|
|
37
|
+
columnWidth={120}
|
|
38
|
+
rowHeight={84}
|
|
39
|
+
columnGap={8}
|
|
40
|
+
rowGap={8}
|
|
41
|
+
overscan={96}
|
|
42
|
+
height="100%"
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.grid-demo-tile {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
height: 100%;
|
|
50
|
+
border: 1px solid color-mix(in oklab, var(--grid-demo-tone) 24%, transparent);
|
|
51
|
+
border-radius: var(--sveltely-border-radius-nested);
|
|
52
|
+
background: color-mix(in oklab, var(--grid-demo-tone) 10%, var(--sveltely-background-color));
|
|
53
|
+
padding: 0.75rem;
|
|
54
|
+
color: var(--sveltely-text-primary-color);
|
|
55
|
+
font-size: 0.85rem;
|
|
56
|
+
font-weight: 600;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
columnSpan: number;
|
|
5
|
+
rowSpan: number;
|
|
6
|
+
};
|
|
7
|
+
import Grid from './index';
|
|
8
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
9
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
10
|
+
$$bindings?: Bindings;
|
|
11
|
+
} & Exports;
|
|
12
|
+
(internal: unknown, props: {
|
|
13
|
+
$$events?: Events;
|
|
14
|
+
$$slots?: Slots;
|
|
15
|
+
}): Exports & {
|
|
16
|
+
$set?: any;
|
|
17
|
+
$on?: any;
|
|
18
|
+
};
|
|
19
|
+
z_$$bindings?: Bindings;
|
|
20
|
+
}
|
|
21
|
+
declare const Grid: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, string>;
|
|
24
|
+
type Grid = InstanceType<typeof Grid>;
|
|
25
|
+
export default Grid;
|