@x33025/sveltely 0.1.23 → 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 +3 -2
- package/dist/components/Library/ArticleEditor/ArticleEditor.svelte +1 -2
- package/dist/components/Library/ArticleEditor/Blocks/Table.svelte +133 -172
- package/dist/components/Library/Checkbox/Checkbox.demo.svelte +5 -4
- package/dist/components/Library/Checkbox/Checkbox.svelte +6 -5
- package/dist/components/Library/Checkbox/Checkbox.svelte.d.ts +2 -1
- package/dist/components/Library/ChipInput/ChipInput.demo.svelte +3 -2
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte +20 -15
- package/dist/components/Library/Floating/Floating.svelte +5 -6
- 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 +128 -25
- package/dist/components/Library/Grid/Grid.svelte.d.ts +38 -9
- package/dist/components/Library/Grid/GridItem.svelte +18 -14
- package/dist/components/Library/Grid/GridItem.svelte.d.ts +2 -1
- package/dist/components/Library/HStack/HStack.svelte +4 -4
- package/dist/components/Library/HStack/HStack.svelte.d.ts +2 -1
- package/dist/components/Library/Image/Image.demo.svelte +3 -1
- package/dist/components/Library/Image/Image.demo.svelte.d.ts +2 -0
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte +8 -6
- package/dist/components/Library/Label/Label.demo.svelte +5 -5
- package/dist/components/Library/Label/Label.svelte +10 -26
- package/dist/components/Library/NavigationStack/Link.svelte +1 -4
- 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.demo.svelte +3 -2
- package/dist/components/Library/Pagination/Pagination.svelte +6 -18
- package/dist/components/Library/Popover/PopoverDebugOverlay.svelte +3 -3
- package/dist/components/Library/Portal/Content.svelte +20 -0
- package/dist/components/Library/Portal/Content.svelte.d.ts +10 -0
- package/dist/components/Library/Portal/Portal.svelte +4 -0
- package/dist/components/Library/Portal/Portal.svelte.d.ts +1 -0
- package/dist/components/Library/Portal/index.d.ts +1 -0
- package/dist/components/Library/Portal/index.js +1 -0
- package/dist/components/Library/ScrollView/ScrollView.svelte +88 -9
- 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 +3 -2
- package/dist/components/Library/SearchField/SearchField.svelte +5 -5
- package/dist/components/Library/SearchField/SearchField.svelte.d.ts +2 -1
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +3 -2
- package/dist/components/Library/Sheet/Sheet.demo.svelte +3 -2
- package/dist/components/Library/Sheet/Sheet.svelte +3 -3
- package/dist/components/Library/Slider/Slider.demo.svelte +3 -2
- package/dist/components/Library/Spinner/Spinner.demo.svelte +3 -2
- package/dist/components/Library/Switch/Switch.demo.svelte +5 -4
- package/dist/components/Library/Switch/Switch.svelte +6 -5
- package/dist/components/Library/Switch/Switch.svelte.d.ts +2 -1
- package/dist/components/Library/Table/Column.svelte +3 -0
- package/dist/components/Library/Table/Column.svelte.d.ts +1 -0
- package/dist/components/Library/Table/Table.demo.svelte +230 -17
- package/dist/components/Library/Table/Table.svelte +322 -78
- package/dist/components/Library/Table/Table.svelte.d.ts +5 -0
- package/dist/components/Library/Table/types.d.ts +1 -0
- package/dist/components/Library/TextField/TextField.svelte +20 -14
- package/dist/components/Library/TextShimmer/TextShimmer.demo.svelte +3 -2
- package/dist/components/Library/TimePicker/TimePicker.demo.svelte +3 -10
- package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +3 -2
- package/dist/components/Library/VStack/VStack.svelte +4 -4
- package/dist/components/Library/VStack/VStack.svelte.d.ts +2 -1
- package/dist/components/Local/ColorStyleControls.svelte +25 -72
- package/dist/components/Local/ComponentGrid.svelte +99 -27
- 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 -6
- package/dist/components/Local/LayoutStyleControls.svelte +33 -25
- package/dist/components/Local/StyleControls.svelte +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +4 -1
- package/dist/style/index.css +3 -4
- package/dist/style/layout.d.ts +15 -36
- package/dist/style/layout.js +35 -83
- package/dist/style/surface.d.ts +1 -0
- package/dist/style/surface.js +10 -0
- package/dist/style.css +3 -51
- 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,21 +1,51 @@
|
|
|
1
|
-
<script lang="ts">
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { loader as loaderAction } from '../../../actions/loader';
|
|
4
4
|
import { extractLoaderProps, resolveLoaderOptions, type LoaderProps } from '../../../style/loader';
|
|
5
5
|
import { extractLayoutProps, layoutStyle, type LayoutProps } from '../../../style/layout';
|
|
6
6
|
import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
|
|
7
|
+
import {
|
|
8
|
+
fixedGridLayout,
|
|
9
|
+
type LayoutKey,
|
|
10
|
+
type ViewportGeometry,
|
|
11
|
+
type ViewportOverscan
|
|
12
|
+
} from '../../../viewport';
|
|
13
|
+
import ScrollView from '../ScrollView';
|
|
7
14
|
|
|
8
15
|
type Props = {
|
|
9
16
|
children?: Snippet;
|
|
17
|
+
items?: T[];
|
|
18
|
+
item?: Snippet<[item: T, index: number]>;
|
|
10
19
|
columns?: number | string;
|
|
11
20
|
rows?: number | string;
|
|
12
21
|
autoRows?: number | string;
|
|
22
|
+
columnWidth?: number;
|
|
23
|
+
rowHeight?: number;
|
|
24
|
+
columnGap?: number;
|
|
25
|
+
rowGap?: number;
|
|
26
|
+
overscan?: ViewportOverscan;
|
|
27
|
+
key?: LayoutKey<T>;
|
|
13
28
|
dense?: boolean;
|
|
14
29
|
} & LayoutProps &
|
|
15
30
|
StyleProps &
|
|
16
31
|
LoaderProps;
|
|
17
32
|
|
|
18
|
-
let {
|
|
33
|
+
let {
|
|
34
|
+
children,
|
|
35
|
+
items,
|
|
36
|
+
item,
|
|
37
|
+
columns = 1,
|
|
38
|
+
rows,
|
|
39
|
+
autoRows,
|
|
40
|
+
columnWidth,
|
|
41
|
+
rowHeight,
|
|
42
|
+
columnGap = 0,
|
|
43
|
+
rowGap = 0,
|
|
44
|
+
overscan = 0,
|
|
45
|
+
key,
|
|
46
|
+
dense = false,
|
|
47
|
+
...restProps
|
|
48
|
+
}: Props & Record<string, unknown> = $props();
|
|
19
49
|
|
|
20
50
|
const extractedLoaderProps = $derived.by(() => extractLoaderProps(restProps));
|
|
21
51
|
const loaderProps = $derived(extractedLoaderProps.loaderProps);
|
|
@@ -26,7 +56,7 @@
|
|
|
26
56
|
const afterLayoutProps = $derived(extractedLayoutProps.restProps);
|
|
27
57
|
const extractedStyleProps = $derived.by(() => extractStyleProps(afterLayoutProps));
|
|
28
58
|
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
29
|
-
const
|
|
59
|
+
const forwardedProps = $derived(extractedStyleProps.restProps);
|
|
30
60
|
const templateColumns = $derived(
|
|
31
61
|
typeof columns === 'number' ? `repeat(${columns}, minmax(0, 1fr))` : columns
|
|
32
62
|
);
|
|
@@ -40,8 +70,26 @@
|
|
|
40
70
|
const gridAutoRows = $derived(
|
|
41
71
|
autoRows === undefined ? undefined : typeof autoRows === 'number' ? `${autoRows}rem` : autoRows
|
|
42
72
|
);
|
|
73
|
+
const engineEnabled = $derived(
|
|
74
|
+
items !== undefined &&
|
|
75
|
+
item !== undefined &&
|
|
76
|
+
typeof columns === 'number' &&
|
|
77
|
+
columnWidth !== undefined &&
|
|
78
|
+
rowHeight !== undefined
|
|
79
|
+
);
|
|
43
80
|
const rootStyle = $derived.by(() =>
|
|
44
81
|
[
|
|
82
|
+
'display: grid;',
|
|
83
|
+
'width: 100%;',
|
|
84
|
+
'min-width: 0;',
|
|
85
|
+
'min-height: 100%;',
|
|
86
|
+
'align-self: stretch;',
|
|
87
|
+
'align-items: stretch;',
|
|
88
|
+
'gap: var(--grid-gap, 0px);',
|
|
89
|
+
'border-radius: var(--grid-border-radius, 0px);',
|
|
90
|
+
'padding: var(--grid-padding-y, 0px) var(--grid-padding-x, 0px);',
|
|
91
|
+
'font-size: var(--grid-font-size, inherit);',
|
|
92
|
+
dense ? 'grid-auto-flow: dense;' : '',
|
|
45
93
|
`grid-template-columns: ${templateColumns};`,
|
|
46
94
|
templateRows ? `grid-template-rows: ${templateRows};` : '',
|
|
47
95
|
gridAutoRows ? `grid-auto-rows: ${gridAutoRows};` : '',
|
|
@@ -51,33 +99,88 @@
|
|
|
51
99
|
.filter(Boolean)
|
|
52
100
|
.join(' ')
|
|
53
101
|
);
|
|
102
|
+
const engineRootStyle = $derived.by(() =>
|
|
103
|
+
[
|
|
104
|
+
'width: 100%;',
|
|
105
|
+
'height: 100%;',
|
|
106
|
+
'min-width: 0;',
|
|
107
|
+
'min-height: 0;',
|
|
108
|
+
'align-self: stretch;',
|
|
109
|
+
'border-radius: var(--grid-border-radius, 0px);',
|
|
110
|
+
'font-size: var(--grid-font-size, inherit);',
|
|
111
|
+
layoutStyle(layoutProps),
|
|
112
|
+
surfaceStyle(styleProps, 'grid')
|
|
113
|
+
]
|
|
114
|
+
.filter(Boolean)
|
|
115
|
+
.join(' ')
|
|
116
|
+
);
|
|
117
|
+
let viewport = $state<ViewportGeometry>({
|
|
118
|
+
offset: { x: 0, y: 0 },
|
|
119
|
+
viewport: { width: 0, height: 0 }
|
|
120
|
+
});
|
|
121
|
+
const engineLayout = $derived.by(() =>
|
|
122
|
+
engineEnabled
|
|
123
|
+
? fixedGridLayout({
|
|
124
|
+
items: items ?? [],
|
|
125
|
+
viewport,
|
|
126
|
+
columnWidth: columnWidth ?? 1,
|
|
127
|
+
rowHeight: rowHeight ?? 1,
|
|
128
|
+
columns: typeof columns === 'number' ? columns : 1,
|
|
129
|
+
columnGap,
|
|
130
|
+
rowGap,
|
|
131
|
+
overscan,
|
|
132
|
+
key
|
|
133
|
+
})
|
|
134
|
+
: { content: { width: 0, height: 0 }, visible: [] }
|
|
135
|
+
);
|
|
136
|
+
const updateViewport = (geometry: {
|
|
137
|
+
offset: { x: number; y: number };
|
|
138
|
+
viewport: { width: number; height: number };
|
|
139
|
+
}) => {
|
|
140
|
+
viewport = {
|
|
141
|
+
offset: geometry.offset,
|
|
142
|
+
viewport: geometry.viewport
|
|
143
|
+
};
|
|
144
|
+
};
|
|
54
145
|
</script>
|
|
55
146
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
147
|
+
{#if engineEnabled}
|
|
148
|
+
<div style={engineRootStyle} {...forwardedProps} use:loaderAction={loaderOptions}>
|
|
149
|
+
{#snippet layout()}
|
|
150
|
+
{#each engineLayout.visible as placed (placed.key)}
|
|
151
|
+
<div
|
|
152
|
+
class="grid-engine-item"
|
|
153
|
+
style:width={`${placed.rect.width}px`}
|
|
154
|
+
style:height={`${placed.rect.height}px`}
|
|
155
|
+
style:transform={`translate3d(${placed.rect.x}px, ${placed.rect.y}px, 0)`}
|
|
156
|
+
>
|
|
157
|
+
{@render item?.(placed.item, placed.index)}
|
|
158
|
+
</div>
|
|
159
|
+
{/each}
|
|
160
|
+
{/snippet}
|
|
161
|
+
|
|
162
|
+
<ScrollView
|
|
163
|
+
axis="both"
|
|
164
|
+
contentSize={engineLayout.content}
|
|
165
|
+
contentStyles={{ paddingX: 0, paddingY: 0 }}
|
|
166
|
+
onScroll={updateViewport}
|
|
167
|
+
{layout}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
{:else}
|
|
171
|
+
<div style={rootStyle} {...forwardedProps} use:loaderAction={loaderOptions}>
|
|
172
|
+
{#if children}
|
|
173
|
+
{@render children()}
|
|
174
|
+
{/if}
|
|
175
|
+
</div>
|
|
176
|
+
{/if}
|
|
67
177
|
|
|
68
178
|
<style>
|
|
69
|
-
.grid {
|
|
70
|
-
|
|
179
|
+
.grid-engine-item {
|
|
180
|
+
position: absolute;
|
|
181
|
+
left: 0;
|
|
182
|
+
top: 0;
|
|
71
183
|
min-width: 0;
|
|
72
184
|
min-height: 0;
|
|
73
|
-
align-items: stretch;
|
|
74
|
-
gap: var(--grid-gap, 0px);
|
|
75
|
-
border-radius: var(--grid-border-radius, 0px);
|
|
76
|
-
padding: var(--grid-padding-y, 0px) var(--grid-padding-x, 0px);
|
|
77
|
-
font-size: var(--grid-font-size, inherit);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.grid-dense {
|
|
81
|
-
grid-auto-flow: dense;
|
|
82
185
|
}
|
|
83
186
|
</style>
|
|
@@ -2,13 +2,42 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import { type LoaderProps } from '../../../style/loader';
|
|
3
3
|
import { type LayoutProps } from '../../../style/layout';
|
|
4
4
|
import { type StyleProps } from '../../../style/surface';
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
import { type LayoutKey, type ViewportOverscan } from '../../../viewport';
|
|
6
|
+
declare function $$render<T>(): {
|
|
7
|
+
props: {
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
items?: T[];
|
|
10
|
+
item?: Snippet<[item: T, index: number]>;
|
|
11
|
+
columns?: number | string;
|
|
12
|
+
rows?: number | string;
|
|
13
|
+
autoRows?: number | string;
|
|
14
|
+
columnWidth?: number;
|
|
15
|
+
rowHeight?: number;
|
|
16
|
+
columnGap?: number;
|
|
17
|
+
rowGap?: number;
|
|
18
|
+
overscan?: ViewportOverscan;
|
|
19
|
+
key?: LayoutKey<T>;
|
|
20
|
+
dense?: boolean;
|
|
21
|
+
} & LayoutProps & StyleProps & LoaderProps & Record<string, unknown>;
|
|
22
|
+
exports: {};
|
|
23
|
+
bindings: "";
|
|
24
|
+
slots: {};
|
|
25
|
+
events: {};
|
|
26
|
+
};
|
|
27
|
+
declare class __sveltets_Render<T> {
|
|
28
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
29
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
30
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
31
|
+
bindings(): "";
|
|
32
|
+
exports(): {};
|
|
33
|
+
}
|
|
34
|
+
interface $$IsomorphicComponent {
|
|
35
|
+
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']>> & {
|
|
36
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
37
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
38
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
39
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
40
|
+
}
|
|
41
|
+
declare const Grid: $$IsomorphicComponent;
|
|
42
|
+
type Grid<T> = InstanceType<typeof Grid<T>>;
|
|
14
43
|
export default Grid;
|
|
@@ -16,7 +16,15 @@
|
|
|
16
16
|
StyleProps &
|
|
17
17
|
LoaderProps;
|
|
18
18
|
|
|
19
|
-
let {
|
|
19
|
+
let {
|
|
20
|
+
children,
|
|
21
|
+
column,
|
|
22
|
+
row,
|
|
23
|
+
columnSpan,
|
|
24
|
+
rowSpan,
|
|
25
|
+
area,
|
|
26
|
+
...restProps
|
|
27
|
+
}: Props & Record<string, unknown> = $props();
|
|
20
28
|
|
|
21
29
|
const extractedLoaderProps = $derived.by(() => extractLoaderProps(restProps));
|
|
22
30
|
const loaderProps = $derived(extractedLoaderProps.loaderProps);
|
|
@@ -27,9 +35,16 @@
|
|
|
27
35
|
const afterLayoutProps = $derived(extractedLayoutProps.restProps);
|
|
28
36
|
const extractedStyleProps = $derived.by(() => extractStyleProps(afterLayoutProps));
|
|
29
37
|
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
30
|
-
const
|
|
38
|
+
const forwardedProps = $derived(extractedStyleProps.restProps);
|
|
31
39
|
const rootStyle = $derived.by(() =>
|
|
32
40
|
[
|
|
41
|
+
'width: 100%;',
|
|
42
|
+
'min-width: 0;',
|
|
43
|
+
'min-height: 0;',
|
|
44
|
+
'height: 100%;',
|
|
45
|
+
'border-radius: var(--grid-item-border-radius, 0px);',
|
|
46
|
+
'padding: var(--grid-item-padding-y, 0px) var(--grid-item-padding-x, 0px);',
|
|
47
|
+
'font-size: var(--grid-item-font-size, inherit);',
|
|
33
48
|
column !== undefined ? `grid-column: ${column};` : '',
|
|
34
49
|
row !== undefined ? `grid-row: ${row};` : '',
|
|
35
50
|
column === undefined && columnSpan !== undefined
|
|
@@ -47,19 +62,8 @@
|
|
|
47
62
|
);
|
|
48
63
|
</script>
|
|
49
64
|
|
|
50
|
-
<div
|
|
65
|
+
<div style={rootStyle} {...forwardedProps} use:loaderAction={loaderOptions}>
|
|
51
66
|
{#if children}
|
|
52
67
|
{@render children()}
|
|
53
68
|
{/if}
|
|
54
69
|
</div>
|
|
55
|
-
|
|
56
|
-
<style>
|
|
57
|
-
.grid-item {
|
|
58
|
-
min-width: 0;
|
|
59
|
-
min-height: 0;
|
|
60
|
-
height: 100%;
|
|
61
|
-
border-radius: var(--grid-item-border-radius, 0px);
|
|
62
|
-
padding: var(--grid-item-padding-y, 0px) var(--grid-item-padding-x, 0px);
|
|
63
|
-
font-size: var(--grid-item-font-size, inherit);
|
|
64
|
-
}
|
|
65
|
-
</style>
|
|
@@ -10,6 +10,7 @@ type Props = {
|
|
|
10
10
|
rowSpan?: number;
|
|
11
11
|
area?: string;
|
|
12
12
|
} & LayoutProps & StyleProps & LoaderProps;
|
|
13
|
-
|
|
13
|
+
type $$ComponentProps = Props & Record<string, unknown>;
|
|
14
|
+
declare const GridItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
15
|
type GridItem = ReturnType<typeof GridItem>;
|
|
15
16
|
export default GridItem;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
StyleProps &
|
|
12
12
|
LoaderProps;
|
|
13
13
|
|
|
14
|
-
let { children, ...restProps }: Props = $props();
|
|
14
|
+
let { children, ...restProps }: Props & Record<string, unknown> = $props();
|
|
15
15
|
|
|
16
16
|
const extractedLoaderProps = $derived.by(() => extractLoaderProps(restProps));
|
|
17
17
|
const loaderProps = $derived(extractedLoaderProps.loaderProps);
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
const afterLayoutProps = $derived(extractedLayoutProps.restProps);
|
|
23
23
|
const extractedStyleProps = $derived.by(() => extractStyleProps(afterLayoutProps));
|
|
24
24
|
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
25
|
-
const
|
|
25
|
+
const forwardedProps = $derived(extractedStyleProps.restProps);
|
|
26
26
|
const rootStyle = $derived.by(() =>
|
|
27
27
|
[layoutStyle(layoutProps), surfaceStyle(styleProps, 'hstack')].filter(Boolean).join(' ')
|
|
28
28
|
);
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
<div class="hstack" style={rootStyle} {...
|
|
31
|
+
<div class="hstack" style={rootStyle} {...forwardedProps} use:loaderAction={loaderOptions}>
|
|
32
32
|
{#if children}
|
|
33
33
|
{@render children()}
|
|
34
34
|
{/if}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
--hstack-padding-x: 0px;
|
|
42
42
|
--hstack-padding-y: 0px;
|
|
43
43
|
--hstack-font-size: inherit;
|
|
44
|
-
display: flex;
|
|
44
|
+
display: inline-flex;
|
|
45
45
|
min-width: 0;
|
|
46
46
|
min-height: 0;
|
|
47
47
|
flex-direction: row;
|
|
@@ -5,6 +5,7 @@ import { type StyleProps } from '../../../style/surface';
|
|
|
5
5
|
type Props = {
|
|
6
6
|
children?: Snippet;
|
|
7
7
|
} & LayoutProps & StyleProps & LoaderProps;
|
|
8
|
-
|
|
8
|
+
type $$ComponentProps = Props & Record<string, unknown>;
|
|
9
|
+
declare const HStack: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
10
|
type HStack = ReturnType<typeof HStack>;
|
|
10
11
|
export default HStack;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
export const demo = {
|
|
3
3
|
name: 'Image',
|
|
4
|
-
description: 'Responsive image display with icon placeholder and busy states.'
|
|
4
|
+
description: 'Responsive image display with icon placeholder and busy states.',
|
|
5
|
+
columnSpan: 3,
|
|
6
|
+
rowSpan: 2
|
|
5
7
|
};
|
|
6
8
|
</script>
|
|
7
9
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const demo: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
|
+
columnSpan: number;
|
|
5
|
+
rowSpan: number;
|
|
4
6
|
};
|
|
5
7
|
import Image from './Image.svelte';
|
|
6
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,7 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
<script lang="ts">
|
|
11
11
|
import { Brush, Eraser, X } from '@lucide/svelte';
|
|
12
|
+
import Grid from '../Grid';
|
|
12
13
|
import Slider from '../Slider';
|
|
14
|
+
import VStack from '../VStack';
|
|
13
15
|
import ImageMask from './ImageMask.svelte';
|
|
14
16
|
import type { ImageMaskValue, MaskTool } from './types';
|
|
15
17
|
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
let clearRevision = $state(0);
|
|
20
22
|
</script>
|
|
21
23
|
|
|
22
|
-
<
|
|
24
|
+
<Grid columns="repeat(auto-fit, minmax(min(100%, 18rem), 1fr))" gap={7.5}>
|
|
23
25
|
<ImageMask
|
|
24
26
|
src="https://images.unsplash.com/photo-1542291026-7eec264c27ff?auto=format&fit=crop&w=700&q=80"
|
|
25
27
|
alt="Red sneaker"
|
|
@@ -30,14 +32,14 @@
|
|
|
30
32
|
fit="cover"
|
|
31
33
|
aspectRatio="1 / 1"
|
|
32
34
|
/>
|
|
33
|
-
<
|
|
35
|
+
<VStack gap={5} fontSize={8.75} color="var(--sveltely-text-secondary-color)">
|
|
34
36
|
<div class="font-medium text-[var(--sveltely-text-primary-color)]">Mask</div>
|
|
35
37
|
<div class="aspect-square overflow-hidden rounded-md border border-zinc-200 bg-black">
|
|
36
38
|
{#if mask}
|
|
37
39
|
<img src={mask.dataUrl} alt="Exported mask" class="size-full object-contain" />
|
|
38
40
|
{/if}
|
|
39
41
|
</div>
|
|
40
|
-
<
|
|
42
|
+
<VStack gap={5} background="white" paddingX={7.5} paddingY={7.5}>
|
|
41
43
|
<span class="font-medium text-[var(--sveltely-text-primary-color)]"
|
|
42
44
|
>Brush size {brushSize}px</span
|
|
43
45
|
>
|
|
@@ -78,9 +80,9 @@
|
|
|
78
80
|
<X size={16} />
|
|
79
81
|
</button>
|
|
80
82
|
</div>
|
|
81
|
-
</
|
|
82
|
-
</
|
|
83
|
-
</
|
|
83
|
+
</VStack>
|
|
84
|
+
</VStack>
|
|
85
|
+
</Grid>
|
|
84
86
|
|
|
85
87
|
<style>
|
|
86
88
|
.image-mask-controls {
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
let enabled = $state(true);
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
|
-
<HStack gap={10}
|
|
23
|
-
<Label label="Name" icon={UserIcon} orientation="top"
|
|
22
|
+
<HStack gap={10}>
|
|
23
|
+
<Label label="Name" icon={UserIcon} orientation="top">
|
|
24
24
|
<TextField bind:value={name} placeholder="Sveltely" />
|
|
25
25
|
</Label>
|
|
26
26
|
|
|
27
|
-
<Label label="Amount" icon={HashIcon} orientation="leading"
|
|
27
|
+
<Label label="Amount" icon={HashIcon} orientation="leading">
|
|
28
28
|
<NumberField bind:value={amount} min={0} max={100} />
|
|
29
29
|
</Label>
|
|
30
30
|
|
|
31
|
-
<Label label="Enabled" orientation="trailing"
|
|
31
|
+
<Label label="Enabled" orientation="trailing">
|
|
32
32
|
<Switch bind:checked={enabled} />
|
|
33
33
|
</Label>
|
|
34
34
|
|
|
35
|
-
<Label orientation="leading"
|
|
35
|
+
<Label orientation="leading">
|
|
36
36
|
{#snippet labelContent()}
|
|
37
37
|
<span>Name <span class="text-[var(--sveltely-text-tertiary-color)]">optional</span></span>
|
|
38
38
|
{/snippet}
|
|
@@ -23,44 +23,27 @@
|
|
|
23
23
|
iconSize,
|
|
24
24
|
iconColor,
|
|
25
25
|
orientation = 'top',
|
|
26
|
-
|
|
26
|
+
grow,
|
|
27
|
+
fit,
|
|
27
28
|
width,
|
|
28
29
|
height,
|
|
29
|
-
minWidth,
|
|
30
|
-
minHeight,
|
|
31
|
-
maxWidth,
|
|
32
|
-
maxHeight,
|
|
33
|
-
grow,
|
|
34
|
-
shrink,
|
|
35
|
-
basis,
|
|
36
|
-
border,
|
|
37
|
-
align,
|
|
38
|
-
justify,
|
|
39
30
|
fontSize,
|
|
40
31
|
paddingX,
|
|
41
32
|
paddingY,
|
|
42
33
|
gap,
|
|
43
34
|
borderRadius,
|
|
44
35
|
inset,
|
|
36
|
+
border,
|
|
45
37
|
background,
|
|
46
38
|
borderColor,
|
|
47
39
|
color
|
|
48
40
|
}: Props = $props();
|
|
49
41
|
|
|
50
42
|
const layoutProps = $derived({
|
|
51
|
-
size,
|
|
52
|
-
width,
|
|
53
|
-
height,
|
|
54
|
-
minWidth,
|
|
55
|
-
minHeight,
|
|
56
|
-
maxWidth,
|
|
57
|
-
maxHeight,
|
|
58
43
|
grow,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
align,
|
|
63
|
-
justify
|
|
44
|
+
fit,
|
|
45
|
+
width,
|
|
46
|
+
height
|
|
64
47
|
});
|
|
65
48
|
const styleProps = $derived({
|
|
66
49
|
fontSize,
|
|
@@ -69,6 +52,7 @@
|
|
|
69
52
|
gap,
|
|
70
53
|
borderRadius,
|
|
71
54
|
inset,
|
|
55
|
+
border,
|
|
72
56
|
background,
|
|
73
57
|
borderColor,
|
|
74
58
|
color
|
|
@@ -126,9 +110,9 @@
|
|
|
126
110
|
--label-font-size: var(--sveltely-font-size);
|
|
127
111
|
--label-icon-size: calc(var(--label-font-size) * 1.143);
|
|
128
112
|
display: inline-flex;
|
|
129
|
-
width:
|
|
130
|
-
min-width:
|
|
131
|
-
min-height:
|
|
113
|
+
width: fit-content;
|
|
114
|
+
min-width: 0;
|
|
115
|
+
min-height: 0;
|
|
132
116
|
gap: var(--label-gap, calc(var(--sveltely-gap) * 0.75));
|
|
133
117
|
border-radius: var(--label-border-radius, 0px);
|
|
134
118
|
color: var(--label-color, var(--sveltely-text-primary-color));
|
|
@@ -48,12 +48,9 @@
|
|
|
48
48
|
calc(var(--sveltely-padding-x) * var(--navigation-link-scale))
|
|
49
49
|
);
|
|
50
50
|
text-decoration: none;
|
|
51
|
-
transition:
|
|
52
|
-
color 150ms,
|
|
53
|
-
background-color 150ms;
|
|
51
|
+
transition: color 150ms;
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
.navigation-link:hover,
|
|
57
54
|
.navigation-link-active {
|
|
58
55
|
background: var(
|
|
59
56
|
--navigation-link-active-background,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'Notifications',
|
|
4
|
+
description: 'Animated notification stack driven by an items array.',
|
|
5
|
+
columnSpan: 2
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import Button from '../Button';
|
|
11
|
+
import HStack from '../HStack';
|
|
12
|
+
import VStack from '../VStack';
|
|
13
|
+
import Notifications, { type NotificationItem } from './index';
|
|
14
|
+
|
|
15
|
+
const tones: NotificationItem['tone'][] = ['info', 'success', 'warning'];
|
|
16
|
+
|
|
17
|
+
let nextId = 3;
|
|
18
|
+
let items = $state<NotificationItem[]>([
|
|
19
|
+
{
|
|
20
|
+
id: 1,
|
|
21
|
+
title: 'Build complete',
|
|
22
|
+
message: 'The package finished compiling.',
|
|
23
|
+
tone: 'success'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 2,
|
|
27
|
+
title: 'New deploy queued',
|
|
28
|
+
message: 'Production will update after checks pass.',
|
|
29
|
+
tone: 'info'
|
|
30
|
+
}
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
function addNotification() {
|
|
34
|
+
const id = nextId++;
|
|
35
|
+
const tone = tones[id % tones.length];
|
|
36
|
+
items = [
|
|
37
|
+
{
|
|
38
|
+
id,
|
|
39
|
+
title: `Notification ${id}`,
|
|
40
|
+
message: 'Inserted at the top of the array.',
|
|
41
|
+
tone
|
|
42
|
+
},
|
|
43
|
+
...items
|
|
44
|
+
].slice(0, 4);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function clearNotifications() {
|
|
48
|
+
items = [];
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<VStack width="100%" gap={7.5}>
|
|
53
|
+
<HStack gap={5}>
|
|
54
|
+
<Button label="Add" onclick={addNotification} />
|
|
55
|
+
<Button label="Clear" onclick={clearNotifications} />
|
|
56
|
+
</HStack>
|
|
57
|
+
|
|
58
|
+
<Notifications bind:items width="100%" animationDuration={220}>
|
|
59
|
+
{#snippet empty()}
|
|
60
|
+
No notifications
|
|
61
|
+
{/snippet}
|
|
62
|
+
</Notifications>
|
|
63
|
+
</VStack>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
columnSpan: number;
|
|
5
|
+
};
|
|
6
|
+
import Notifications from './index';
|
|
7
|
+
declare const Notifications: import("svelte").Component<Record<string, never>, {}, "">;
|
|
8
|
+
type Notifications = ReturnType<typeof Notifications>;
|
|
9
|
+
export default Notifications;
|