seblify 0.1.4
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/README.md +18 -0
- package/dist/components/AppShell.svelte +136 -0
- package/dist/components/AppShell.svelte.d.ts +13 -0
- package/dist/components/Banner.svelte +56 -0
- package/dist/components/Banner.svelte.d.ts +9 -0
- package/dist/components/Button.svelte +64 -0
- package/dist/components/Button.svelte.d.ts +13 -0
- package/dist/components/Icon.svelte +67 -0
- package/dist/components/Icon.svelte.d.ts +8 -0
- package/dist/components/Sidebar.svelte +106 -0
- package/dist/components/Sidebar.svelte.d.ts +14 -0
- package/dist/components/Snackbar.svelte +26 -0
- package/dist/components/Snackbar.svelte.d.ts +7 -0
- package/dist/components/Toast.svelte +27 -0
- package/dist/components/Toast.svelte.d.ts +7 -0
- package/dist/components/action/input/field/pin-input/PinInput.svelte +156 -0
- package/dist/components/action/input/field/pin-input/PinInput.svelte.d.ts +10 -0
- package/dist/components/action/input/select/checkbox/Checkbox.svelte +71 -0
- package/dist/components/action/input/select/checkbox/Checkbox.svelte.d.ts +10 -0
- package/dist/components/action/input/select/segment-control/SegmentControl.svelte +150 -0
- package/dist/components/action/input/select/segment-control/SegmentControl.svelte.d.ts +15 -0
- package/dist/components/action/input/select/slider/Slider.svelte +79 -0
- package/dist/components/action/input/select/slider/Slider.svelte.d.ts +11 -0
- package/dist/components/action/input/select/switch/Switch.svelte +122 -0
- package/dist/components/action/input/select/switch/Switch.svelte.d.ts +10 -0
- package/dist/components/action/input/select/theme-switch/ThemeSwitch.svelte +43 -0
- package/dist/components/action/input/select/theme-switch/ThemeSwitch.svelte.d.ts +10 -0
- package/dist/components/component-doc.d.ts +23 -0
- package/dist/components/component-doc.js +1 -0
- package/dist/components/display/annotation/badge/Badge.svelte +296 -0
- package/dist/components/display/annotation/badge/Badge.svelte.d.ts +16 -0
- package/dist/components/display/annotation/tag/Tag.svelte +227 -0
- package/dist/components/display/annotation/tag/Tag.svelte.d.ts +16 -0
- package/dist/components/display/annotation/tag-group/TagGroup.svelte +33 -0
- package/dist/components/display/annotation/tag-group/TagGroup.svelte.d.ts +12 -0
- package/dist/components/display/feedback/loading/loading-dots/LoadingDots.svelte +136 -0
- package/dist/components/display/feedback/loading/loading-dots/LoadingDots.svelte.d.ts +8 -0
- package/dist/components/display/feedback/loading/spinner/Spinner.svelte +110 -0
- package/dist/components/display/feedback/loading/spinner/Spinner.svelte.d.ts +8 -0
- package/dist/components/display/media/icon/Icon.svelte +41 -0
- package/dist/components/display/media/icon/Icon.svelte.d.ts +8 -0
- package/dist/components/display/media/icon/IconGlyph.svelte +56 -0
- package/dist/components/display/media/icon/IconGlyph.svelte.d.ts +8 -0
- package/dist/components/display/typography/eyebrow/Eyebrow.svelte +48 -0
- package/dist/components/display/typography/eyebrow/Eyebrow.svelte.d.ts +8 -0
- package/dist/components/display/typography/highlight/Highlight.svelte +160 -0
- package/dist/components/display/typography/highlight/Highlight.svelte.d.ts +10 -0
- package/dist/components/framework/layout/alignment/cluster/Cluster.svelte +142 -0
- package/dist/components/framework/layout/alignment/cluster/Cluster.svelte.d.ts +17 -0
- package/dist/components/framework/layout/alignment/grid/Grid.svelte +120 -0
- package/dist/components/framework/layout/alignment/grid/Grid.svelte.d.ts +18 -0
- package/dist/components/framework/layout/alignment/row/Row.svelte +142 -0
- package/dist/components/framework/layout/alignment/row/Row.svelte.d.ts +17 -0
- package/dist/components/framework/layout/alignment/stack/Stack.svelte +142 -0
- package/dist/components/framework/layout/alignment/stack/Stack.svelte.d.ts +17 -0
- package/dist/components/framework/layout/container/app-shell/AppShell.svelte +82 -0
- package/dist/components/framework/layout/container/app-shell/AppShell.svelte.d.ts +9 -0
- package/dist/components/framework/layout/container/page-header/PageHeader.svelte +114 -0
- package/dist/components/framework/layout/container/page-header/PageHeader.svelte.d.ts +11 -0
- package/dist/components/framework/layout/container/sidebar/Sidebar.svelte +134 -0
- package/dist/components/framework/layout/container/sidebar/Sidebar.svelte.d.ts +9 -0
- package/dist/components/framework/navigation/context/breadcrumb/Breadcrumb.svelte +72 -0
- package/dist/components/framework/navigation/context/breadcrumb/Breadcrumb.svelte.d.ts +10 -0
- package/dist/components/framework/navigation/sidenav/Sidenav.svelte +86 -0
- package/dist/components/framework/navigation/sidenav/Sidenav.svelte.d.ts +8 -0
- package/dist/components/framework/navigation/sidenav/SidenavTree.svelte +265 -0
- package/dist/components/framework/navigation/sidenav/SidenavTree.svelte.d.ts +14 -0
- package/dist/components/framework/navigation/sidenav/sidenav.d.ts +6 -0
- package/dist/components/framework/navigation/sidenav/sidenav.js +1 -0
- package/dist/components/framework/surface/paper/Paper.svelte +179 -0
- package/dist/components/framework/surface/paper/Paper.svelte.d.ts +18 -0
- package/dist/design-system/reserved-props/allowed-options.d.ts +46 -0
- package/dist/design-system/reserved-props/allowed-options.js +1 -0
- package/dist/design-system/reserved-props/blocked-props.d.ts +9 -0
- package/dist/design-system/reserved-props/blocked-props.js +1 -0
- package/dist/design-system/reserved-props/complex-types.d.ts +1 -0
- package/dist/design-system/reserved-props/complex-types.js +1 -0
- package/dist/design-system/reserved-props/type.d.ts +16 -0
- package/dist/design-system/reserved-props/type.js +1 -0
- package/dist/design-system/theme/tokens.d.ts +7 -0
- package/dist/design-system/theme/tokens.js +219 -0
- package/dist/icons/generated/chevron-double-down.svelte +16 -0
- package/dist/icons/generated/chevron-double-down.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-double-left.svelte +16 -0
- package/dist/icons/generated/chevron-double-left.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-double-right.svelte +16 -0
- package/dist/icons/generated/chevron-double-right.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-double-up.svelte +16 -0
- package/dist/icons/generated/chevron-double-up.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-down.svelte +16 -0
- package/dist/icons/generated/chevron-down.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-left.svelte +16 -0
- package/dist/icons/generated/chevron-left.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-right.svelte +16 -0
- package/dist/icons/generated/chevron-right.svelte.d.ts +7 -0
- package/dist/icons/generated/chevron-up.svelte +16 -0
- package/dist/icons/generated/chevron-up.svelte.d.ts +7 -0
- package/dist/icons/generated/fallback.svelte +17 -0
- package/dist/icons/generated/fallback.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-circle-outline.svelte +16 -0
- package/dist/icons/generated/heart-circle-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-circle.svelte +16 -0
- package/dist/icons/generated/heart-circle.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-half-full.svelte +16 -0
- package/dist/icons/generated/heart-half-full.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-half-outline.svelte +16 -0
- package/dist/icons/generated/heart-half-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-half.svelte +16 -0
- package/dist/icons/generated/heart-half.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-multiple-outline.svelte +23 -0
- package/dist/icons/generated/heart-multiple-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-multiple.svelte +23 -0
- package/dist/icons/generated/heart-multiple.svelte.d.ts +7 -0
- package/dist/icons/generated/heart-outline.svelte +16 -0
- package/dist/icons/generated/heart-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/heart.svelte +16 -0
- package/dist/icons/generated/heart.svelte.d.ts +7 -0
- package/dist/icons/generated/home-edit-outline.svelte +16 -0
- package/dist/icons/generated/home-edit-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/home-edit.svelte +16 -0
- package/dist/icons/generated/home-edit.svelte.d.ts +7 -0
- package/dist/icons/generated/home-outline.svelte +16 -0
- package/dist/icons/generated/home-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/home.svelte +16 -0
- package/dist/icons/generated/home.svelte.d.ts +7 -0
- package/dist/icons/generated/index.d.ts +24 -0
- package/dist/icons/generated/index.js +24 -0
- package/dist/icons/generated/manifest.d.ts +7 -0
- package/dist/icons/generated/manifest.js +198 -0
- package/dist/icons/generated/tag-heart-outline.svelte +16 -0
- package/dist/icons/generated/tag-heart-outline.svelte.d.ts +7 -0
- package/dist/icons/generated/tag-heart.svelte +16 -0
- package/dist/icons/generated/tag-heart.svelte.d.ts +7 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +28 -0
- package/dist/svelte.d.ts +18 -0
- package/dist/theme.css +161 -0
- package/package.json +69 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CustomCssSize, SeblifyProps } from 'seblify';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type ClusterElement = keyof HTMLElementTagNameMap;
|
|
6
|
+
type ClusterAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
7
|
+
type ClusterGap =
|
|
8
|
+
| 'none'
|
|
9
|
+
| 'xxs'
|
|
10
|
+
| 'xs'
|
|
11
|
+
| 'sm'
|
|
12
|
+
| 'md'
|
|
13
|
+
| 'lg'
|
|
14
|
+
| 'xl'
|
|
15
|
+
| 'xxl'
|
|
16
|
+
| CustomCssSize;
|
|
17
|
+
type ClusterJustify =
|
|
18
|
+
| 'start'
|
|
19
|
+
| 'center'
|
|
20
|
+
| 'end'
|
|
21
|
+
| 'between'
|
|
22
|
+
| 'around'
|
|
23
|
+
| 'evenly';
|
|
24
|
+
|
|
25
|
+
type Props = SeblifyProps<{
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
align?: ClusterAlign;
|
|
28
|
+
as?: ClusterElement;
|
|
29
|
+
children?: Snippet;
|
|
30
|
+
class?: string;
|
|
31
|
+
gap?: ClusterGap;
|
|
32
|
+
justify?: ClusterJustify;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
align = 'center',
|
|
37
|
+
as = 'div',
|
|
38
|
+
children,
|
|
39
|
+
class: className,
|
|
40
|
+
gap = 'md',
|
|
41
|
+
justify = 'start',
|
|
42
|
+
...restProps
|
|
43
|
+
}: Props = $props();
|
|
44
|
+
|
|
45
|
+
function cssLength(value: ClusterGap | number | string): string {
|
|
46
|
+
if (value === 'none') {
|
|
47
|
+
return '0';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (value === 'xs') {
|
|
51
|
+
return '0.5rem';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (value === 'xxs') {
|
|
55
|
+
return '0.25rem';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (value === 'sm') {
|
|
59
|
+
return '0.75rem';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (value === 'md') {
|
|
63
|
+
return '1rem';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (value === 'lg') {
|
|
67
|
+
return '1.5rem';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (value === 'xl') {
|
|
71
|
+
return '2rem';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (value === 'xxl') {
|
|
75
|
+
return '3rem';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function alignItems(value: ClusterAlign): string {
|
|
82
|
+
if (value === 'start') {
|
|
83
|
+
return 'flex-start';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (value === 'end') {
|
|
87
|
+
return 'flex-end';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function justifyContent(value: ClusterJustify): string {
|
|
94
|
+
if (value === 'start') {
|
|
95
|
+
return 'flex-start';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (value === 'end') {
|
|
99
|
+
return 'flex-end';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (value === 'between') {
|
|
103
|
+
return 'space-between';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (value === 'around') {
|
|
107
|
+
return 'space-around';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (value === 'evenly') {
|
|
111
|
+
return 'space-evenly';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const gapValue = $derived(cssLength(gap));
|
|
118
|
+
const alignValue = $derived(alignItems(align));
|
|
119
|
+
const justifyValue = $derived(justifyContent(justify));
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<svelte:element
|
|
123
|
+
this={as}
|
|
124
|
+
{...restProps}
|
|
125
|
+
class={`cluster${className ? ` ${className}` : ''}`}
|
|
126
|
+
style:--cluster-gap={gapValue}
|
|
127
|
+
style:--cluster-align={alignValue}
|
|
128
|
+
style:--cluster-justify={justifyValue}
|
|
129
|
+
>
|
|
130
|
+
{@render children?.()}
|
|
131
|
+
</svelte:element>
|
|
132
|
+
|
|
133
|
+
<style>
|
|
134
|
+
.cluster {
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-wrap: wrap;
|
|
137
|
+
gap: var(--cluster-gap, 1rem);
|
|
138
|
+
align-items: var(--cluster-align, center);
|
|
139
|
+
justify-content: var(--cluster-justify, flex-start);
|
|
140
|
+
min-width: 0;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CustomCssSize } from 'seblify';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type ClusterElement = keyof HTMLElementTagNameMap;
|
|
4
|
+
type ClusterAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
5
|
+
type ClusterGap = 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | CustomCssSize;
|
|
6
|
+
type ClusterJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
7
|
+
declare const Cluster: import("svelte").Component<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
align?: ClusterAlign | undefined;
|
|
10
|
+
as?: ClusterElement | undefined;
|
|
11
|
+
children?: Snippet | undefined;
|
|
12
|
+
class?: string | undefined;
|
|
13
|
+
gap?: ClusterGap | undefined;
|
|
14
|
+
justify?: ClusterJustify | undefined;
|
|
15
|
+
}, {}, "">;
|
|
16
|
+
type Cluster = ReturnType<typeof Cluster>;
|
|
17
|
+
export default Cluster;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CustomCssSize, SeblifyProps } from 'seblify';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type GridColumns = 'auto' | number;
|
|
6
|
+
type GridElement = keyof HTMLElementTagNameMap;
|
|
7
|
+
type GridGap =
|
|
8
|
+
| 'none'
|
|
9
|
+
| 'xxs'
|
|
10
|
+
| 'xs'
|
|
11
|
+
| 'sm'
|
|
12
|
+
| 'md'
|
|
13
|
+
| 'lg'
|
|
14
|
+
| 'xl'
|
|
15
|
+
| 'xxl'
|
|
16
|
+
| CustomCssSize;
|
|
17
|
+
|
|
18
|
+
type Props = SeblifyProps<{
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
as?: GridElement;
|
|
21
|
+
children?: Snippet;
|
|
22
|
+
class?: string;
|
|
23
|
+
columnGap?: GridGap;
|
|
24
|
+
columns?: GridColumns;
|
|
25
|
+
gap?: GridGap;
|
|
26
|
+
minItemWidth?: number | string;
|
|
27
|
+
rowGap?: GridGap;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
let {
|
|
31
|
+
as = 'div',
|
|
32
|
+
children,
|
|
33
|
+
class: className,
|
|
34
|
+
columnGap,
|
|
35
|
+
columns = 'auto',
|
|
36
|
+
gap = 'md',
|
|
37
|
+
minItemWidth = '16rem',
|
|
38
|
+
rowGap,
|
|
39
|
+
...restProps
|
|
40
|
+
}: Props = $props();
|
|
41
|
+
|
|
42
|
+
function cssLength(value: GridGap | number | string): string {
|
|
43
|
+
if (value === 'none') {
|
|
44
|
+
return '0';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (value === 'xxs') {
|
|
48
|
+
return '0.25rem';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (value === 'xs') {
|
|
52
|
+
return '0.5rem';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (value === 'sm') {
|
|
56
|
+
return '0.75rem';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (value === 'md') {
|
|
60
|
+
return '1rem';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (value === 'lg') {
|
|
64
|
+
return '1.5rem';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (value === 'xl') {
|
|
68
|
+
return '2rem';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (value === 'xxl') {
|
|
72
|
+
return '3rem';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function gridTemplateValue(
|
|
79
|
+
value: GridColumns,
|
|
80
|
+
minimumWidth: number | string,
|
|
81
|
+
): string {
|
|
82
|
+
if (value === 'auto') {
|
|
83
|
+
const minimumValue =
|
|
84
|
+
typeof minimumWidth === 'number' ? `${minimumWidth}px` : minimumWidth;
|
|
85
|
+
|
|
86
|
+
return `repeat(auto-fit, minmax(min(${minimumValue}, 100%), 1fr))`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return `repeat(${value}, minmax(0, 1fr))`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const gapValue = $derived(cssLength(gap));
|
|
93
|
+
const rowGapValue = $derived(rowGap ? cssLength(rowGap) : gapValue);
|
|
94
|
+
const columnGapValue = $derived(columnGap ? cssLength(columnGap) : gapValue);
|
|
95
|
+
const templateValue = $derived(gridTemplateValue(columns, minItemWidth));
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<svelte:element
|
|
99
|
+
this={as}
|
|
100
|
+
{...restProps}
|
|
101
|
+
class={`grid${className ? ` ${className}` : ''}`}
|
|
102
|
+
style:--grid-column-gap={columnGapValue}
|
|
103
|
+
style:--grid-row-gap={rowGapValue}
|
|
104
|
+
style:--grid-template-columns={templateValue}
|
|
105
|
+
>
|
|
106
|
+
{@render children?.()}
|
|
107
|
+
</svelte:element>
|
|
108
|
+
|
|
109
|
+
<style>
|
|
110
|
+
.grid {
|
|
111
|
+
display: grid;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
grid-template-columns: var(
|
|
114
|
+
--grid-template-columns,
|
|
115
|
+
repeat(auto-fit, minmax(min(16rem, 100%), 1fr))
|
|
116
|
+
);
|
|
117
|
+
column-gap: var(--grid-column-gap, 1rem);
|
|
118
|
+
row-gap: var(--grid-row-gap, 1rem);
|
|
119
|
+
}
|
|
120
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CustomCssSize } from 'seblify';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type GridColumns = 'auto' | number;
|
|
4
|
+
type GridElement = keyof HTMLElementTagNameMap;
|
|
5
|
+
type GridGap = 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | CustomCssSize;
|
|
6
|
+
declare const Grid: import("svelte").Component<{
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
as?: GridElement | undefined;
|
|
9
|
+
children?: Snippet | undefined;
|
|
10
|
+
class?: string | undefined;
|
|
11
|
+
columnGap?: GridGap | undefined;
|
|
12
|
+
columns?: GridColumns | undefined;
|
|
13
|
+
gap?: GridGap | undefined;
|
|
14
|
+
minItemWidth?: number | string | undefined;
|
|
15
|
+
rowGap?: GridGap | undefined;
|
|
16
|
+
}, {}, "">;
|
|
17
|
+
type Grid = ReturnType<typeof Grid>;
|
|
18
|
+
export default Grid;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CustomCssSize, SeblifyProps } from 'seblify';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type RowElement = keyof HTMLElementTagNameMap;
|
|
6
|
+
type RowAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
7
|
+
type RowGap =
|
|
8
|
+
| 'none'
|
|
9
|
+
| 'xxs'
|
|
10
|
+
| 'xs'
|
|
11
|
+
| 'sm'
|
|
12
|
+
| 'md'
|
|
13
|
+
| 'lg'
|
|
14
|
+
| 'xl'
|
|
15
|
+
| 'xxl'
|
|
16
|
+
| CustomCssSize;
|
|
17
|
+
type RowJustify =
|
|
18
|
+
| 'start'
|
|
19
|
+
| 'center'
|
|
20
|
+
| 'end'
|
|
21
|
+
| 'between'
|
|
22
|
+
| 'around'
|
|
23
|
+
| 'evenly';
|
|
24
|
+
|
|
25
|
+
type Props = SeblifyProps<{
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
align?: RowAlign;
|
|
28
|
+
as?: RowElement;
|
|
29
|
+
children?: Snippet;
|
|
30
|
+
class?: string;
|
|
31
|
+
gap?: RowGap;
|
|
32
|
+
justify?: RowJustify;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
align = 'center',
|
|
37
|
+
as = 'div',
|
|
38
|
+
children,
|
|
39
|
+
class: className,
|
|
40
|
+
gap = 'md',
|
|
41
|
+
justify = 'start',
|
|
42
|
+
...restProps
|
|
43
|
+
}: Props = $props();
|
|
44
|
+
|
|
45
|
+
function cssLength(value: RowGap | number | string): string {
|
|
46
|
+
if (value === 'none') {
|
|
47
|
+
return '0';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (value === 'xs') {
|
|
51
|
+
return '0.5rem';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (value === 'xxs') {
|
|
55
|
+
return '0.25rem';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (value === 'sm') {
|
|
59
|
+
return '0.75rem';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (value === 'md') {
|
|
63
|
+
return '1rem';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (value === 'lg') {
|
|
67
|
+
return '1.5rem';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (value === 'xl') {
|
|
71
|
+
return '2rem';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (value === 'xxl') {
|
|
75
|
+
return '3rem';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function alignItems(value: RowAlign): string {
|
|
82
|
+
if (value === 'start') {
|
|
83
|
+
return 'flex-start';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (value === 'end') {
|
|
87
|
+
return 'flex-end';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function justifyContent(value: RowJustify): string {
|
|
94
|
+
if (value === 'start') {
|
|
95
|
+
return 'flex-start';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (value === 'end') {
|
|
99
|
+
return 'flex-end';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (value === 'between') {
|
|
103
|
+
return 'space-between';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (value === 'around') {
|
|
107
|
+
return 'space-around';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (value === 'evenly') {
|
|
111
|
+
return 'space-evenly';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const gapValue = $derived(cssLength(gap));
|
|
118
|
+
const alignValue = $derived(alignItems(align));
|
|
119
|
+
const justifyValue = $derived(justifyContent(justify));
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<svelte:element
|
|
123
|
+
this={as}
|
|
124
|
+
{...restProps}
|
|
125
|
+
class={`row${className ? ` ${className}` : ''}`}
|
|
126
|
+
style:--row-gap={gapValue}
|
|
127
|
+
style:--row-align={alignValue}
|
|
128
|
+
style:--row-justify={justifyValue}
|
|
129
|
+
>
|
|
130
|
+
{@render children?.()}
|
|
131
|
+
</svelte:element>
|
|
132
|
+
|
|
133
|
+
<style>
|
|
134
|
+
.row {
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-wrap: nowrap;
|
|
137
|
+
gap: var(--row-gap, 1rem);
|
|
138
|
+
align-items: var(--row-align, center);
|
|
139
|
+
justify-content: var(--row-justify, flex-start);
|
|
140
|
+
min-width: 0;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CustomCssSize } from 'seblify';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type RowElement = keyof HTMLElementTagNameMap;
|
|
4
|
+
type RowAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
5
|
+
type RowGap = 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | CustomCssSize;
|
|
6
|
+
type RowJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
7
|
+
declare const Row: import("svelte").Component<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
align?: RowAlign | undefined;
|
|
10
|
+
as?: RowElement | undefined;
|
|
11
|
+
children?: Snippet | undefined;
|
|
12
|
+
class?: string | undefined;
|
|
13
|
+
gap?: RowGap | undefined;
|
|
14
|
+
justify?: RowJustify | undefined;
|
|
15
|
+
}, {}, "">;
|
|
16
|
+
type Row = ReturnType<typeof Row>;
|
|
17
|
+
export default Row;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { CustomCssSize, SeblifyProps } from 'seblify';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type StackElement = keyof HTMLElementTagNameMap;
|
|
6
|
+
type StackAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
7
|
+
type StackGap =
|
|
8
|
+
| 'none'
|
|
9
|
+
| 'xxs'
|
|
10
|
+
| 'xs'
|
|
11
|
+
| 'sm'
|
|
12
|
+
| 'md'
|
|
13
|
+
| 'lg'
|
|
14
|
+
| 'xl'
|
|
15
|
+
| 'xxl'
|
|
16
|
+
| CustomCssSize;
|
|
17
|
+
type StackJustify =
|
|
18
|
+
| 'start'
|
|
19
|
+
| 'center'
|
|
20
|
+
| 'end'
|
|
21
|
+
| 'between'
|
|
22
|
+
| 'around'
|
|
23
|
+
| 'evenly';
|
|
24
|
+
|
|
25
|
+
type Props = SeblifyProps<{
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
align?: StackAlign;
|
|
28
|
+
as?: StackElement;
|
|
29
|
+
children?: Snippet;
|
|
30
|
+
class?: string;
|
|
31
|
+
gap?: StackGap;
|
|
32
|
+
justify?: StackJustify;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
align = 'stretch',
|
|
37
|
+
as = 'div',
|
|
38
|
+
children,
|
|
39
|
+
class: className,
|
|
40
|
+
gap = 'md',
|
|
41
|
+
justify = 'start',
|
|
42
|
+
...restProps
|
|
43
|
+
}: Props = $props();
|
|
44
|
+
|
|
45
|
+
function cssLength(value: StackGap | number | string): string {
|
|
46
|
+
if (value === 'none') {
|
|
47
|
+
return '0';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (value === 'xs') {
|
|
51
|
+
return '0.5rem';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (value === 'xxs') {
|
|
55
|
+
return '0.25rem';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (value === 'sm') {
|
|
59
|
+
return '0.75rem';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (value === 'md') {
|
|
63
|
+
return '1rem';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (value === 'lg') {
|
|
67
|
+
return '1.5rem';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (value === 'xl') {
|
|
71
|
+
return '2rem';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (value === 'xxl') {
|
|
75
|
+
return '3rem';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function alignItems(value: StackAlign): string {
|
|
82
|
+
if (value === 'start') {
|
|
83
|
+
return 'flex-start';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (value === 'end') {
|
|
87
|
+
return 'flex-end';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function justifyContent(value: StackJustify): string {
|
|
94
|
+
if (value === 'start') {
|
|
95
|
+
return 'flex-start';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (value === 'end') {
|
|
99
|
+
return 'flex-end';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (value === 'between') {
|
|
103
|
+
return 'space-between';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (value === 'around') {
|
|
107
|
+
return 'space-around';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (value === 'evenly') {
|
|
111
|
+
return 'space-evenly';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return value;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const gapValue = $derived(cssLength(gap));
|
|
118
|
+
const alignValue = $derived(alignItems(align));
|
|
119
|
+
const justifyValue = $derived(justifyContent(justify));
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<svelte:element
|
|
123
|
+
this={as}
|
|
124
|
+
{...restProps}
|
|
125
|
+
class={`stack${className ? ` ${className}` : ''}`}
|
|
126
|
+
style:--stack-gap={gapValue}
|
|
127
|
+
style:--stack-align={alignValue}
|
|
128
|
+
style:--stack-justify={justifyValue}
|
|
129
|
+
>
|
|
130
|
+
{@render children?.()}
|
|
131
|
+
</svelte:element>
|
|
132
|
+
|
|
133
|
+
<style>
|
|
134
|
+
.stack {
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
gap: var(--stack-gap, 1rem);
|
|
138
|
+
align-items: var(--stack-align, stretch);
|
|
139
|
+
justify-content: var(--stack-justify, flex-start);
|
|
140
|
+
min-width: 0;
|
|
141
|
+
}
|
|
142
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CustomCssSize } from 'seblify';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type StackElement = keyof HTMLElementTagNameMap;
|
|
4
|
+
type StackAlign = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
5
|
+
type StackGap = 'none' | 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | CustomCssSize;
|
|
6
|
+
type StackJustify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
|
|
7
|
+
declare const Stack: import("svelte").Component<{
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
align?: StackAlign | undefined;
|
|
10
|
+
as?: StackElement | undefined;
|
|
11
|
+
children?: Snippet | undefined;
|
|
12
|
+
class?: string | undefined;
|
|
13
|
+
gap?: StackGap | undefined;
|
|
14
|
+
justify?: StackJustify | undefined;
|
|
15
|
+
}, {}, "">;
|
|
16
|
+
type Stack = ReturnType<typeof Stack>;
|
|
17
|
+
export default Stack;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SeblifyProps } from 'seblify';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
|
|
5
|
+
type Props = SeblifyProps<{
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
header?: Snippet;
|
|
8
|
+
sidebar?: Snippet;
|
|
9
|
+
sidebarWidth?: string;
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
let { children, header, sidebar, sidebarWidth = '280px' }: Props = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="app-shell" style:--app-shell-sidebar-width={sidebarWidth}>
|
|
16
|
+
{#if sidebar}
|
|
17
|
+
<div class="app-shell__sidebar">
|
|
18
|
+
{@render sidebar()}
|
|
19
|
+
</div>
|
|
20
|
+
{/if}
|
|
21
|
+
|
|
22
|
+
<div class="app-shell__workspace">
|
|
23
|
+
{#if header}
|
|
24
|
+
<div class="app-shell__header">
|
|
25
|
+
{@render header()}
|
|
26
|
+
</div>
|
|
27
|
+
{/if}
|
|
28
|
+
|
|
29
|
+
<main class="app-shell__content">
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</main>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<style>
|
|
36
|
+
.app-shell {
|
|
37
|
+
display: grid;
|
|
38
|
+
grid-template-columns: var(--app-shell-sidebar-width) minmax(0, 1fr);
|
|
39
|
+
min-height: 100vh;
|
|
40
|
+
background: var(--seblify-color-page, #f4f6f8);
|
|
41
|
+
color: var(--seblify-color-text, #172033);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.app-shell__sidebar,
|
|
45
|
+
.app-shell__workspace,
|
|
46
|
+
.app-shell__content {
|
|
47
|
+
min-width: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.app-shell__workspace {
|
|
51
|
+
display: grid;
|
|
52
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.app-shell__header {
|
|
56
|
+
position: sticky;
|
|
57
|
+
top: 0;
|
|
58
|
+
z-index: 10;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.app-shell__content {
|
|
62
|
+
padding: var(--app-shell-content-padding, 40px 48px 72px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media (max-width: 760px) {
|
|
66
|
+
.app-shell {
|
|
67
|
+
grid-template-columns: 1fr;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.app-shell__sidebar {
|
|
71
|
+
display: contents;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.app-shell__header {
|
|
75
|
+
position: static;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.app-shell__content {
|
|
79
|
+
padding: var(--app-shell-content-padding-mobile, 28px 22px 56px);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
declare const AppShell: import("svelte").Component<{
|
|
3
|
+
children?: Snippet | undefined;
|
|
4
|
+
header?: Snippet | undefined;
|
|
5
|
+
sidebar?: Snippet | undefined;
|
|
6
|
+
sidebarWidth?: string | undefined;
|
|
7
|
+
}, {}, "">;
|
|
8
|
+
type AppShell = ReturnType<typeof AppShell>;
|
|
9
|
+
export default AppShell;
|