@x33025/sveltely 0.1.1 → 0.1.3
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/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +1 -1
- package/dist/components/Library/AsyncButton/AsyncButton.svelte +42 -16
- package/dist/components/Library/Button/Button.demo.svelte +5 -3
- package/dist/components/Library/Button/Button.demo.svelte.d.ts +1 -0
- package/dist/components/Library/Button/Button.svelte +21 -13
- package/dist/components/Library/Calendar/Calendar.demo.svelte +2 -14
- package/dist/components/Library/Calendar/Calendar.svelte +69 -65
- package/dist/components/Library/Checkbox/Checkbox.svelte +13 -14
- package/dist/components/Library/ChipInput/ChipInput.demo.svelte +1 -1
- package/dist/components/Library/ChipInput/ChipInput.svelte +7 -4
- package/dist/components/Library/Divider/Divider.svelte +10 -0
- package/dist/components/Library/Divider/Divider.svelte.d.ts +26 -0
- package/dist/components/Library/Divider/index.d.ts +1 -0
- package/dist/components/Library/Divider/index.js +1 -0
- package/dist/components/Library/Dropdown/Action.svelte +60 -0
- package/dist/components/Library/Dropdown/Action.svelte.d.ts +11 -0
- package/dist/components/Library/Dropdown/Divider.svelte +5 -0
- package/dist/components/Library/Dropdown/Divider.svelte.d.ts +19 -0
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte +182 -65
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte.d.ts +2 -1
- package/dist/components/Library/Dropdown/Dropdown.svelte +95 -250
- package/dist/components/Library/Dropdown/Dropdown.svelte.d.ts +17 -16
- package/dist/components/Library/Dropdown/Item.svelte +68 -0
- package/dist/components/Library/Dropdown/Item.svelte.d.ts +31 -0
- package/dist/components/Library/Dropdown/Section.svelte +34 -0
- package/dist/components/Library/Dropdown/Section.svelte.d.ts +8 -0
- package/dist/components/Library/Dropdown/context.d.ts +34 -0
- package/dist/components/Library/Dropdown/context.js +6 -0
- package/dist/components/Library/Dropdown/index.d.ts +13 -2
- package/dist/components/Library/Dropdown/index.js +11 -1
- package/dist/components/Library/Floating/Floating.svelte +44 -7
- package/dist/components/Library/ForEach/ForEach.svelte +14 -0
- package/dist/components/Library/ForEach/ForEach.svelte.d.ts +28 -0
- package/dist/components/Library/ForEach/index.d.ts +1 -0
- package/dist/components/Library/ForEach/index.js +1 -0
- package/dist/components/Library/Grid/Grid.svelte +74 -0
- package/dist/components/Library/Grid/Grid.svelte.d.ts +13 -0
- package/dist/components/Library/Grid/index.d.ts +1 -0
- package/dist/components/Library/Grid/index.js +1 -0
- package/dist/components/Library/GridItem/GridItem.svelte +65 -0
- package/dist/components/Library/GridItem/GridItem.svelte.d.ts +14 -0
- package/dist/components/Library/GridItem/index.d.ts +1 -0
- package/dist/components/Library/GridItem/index.js +1 -0
- package/dist/components/Library/HStack/HStack.svelte +45 -0
- package/dist/components/Library/HStack/HStack.svelte.d.ts +9 -0
- package/dist/components/Library/HStack/index.d.ts +1 -0
- package/dist/components/Library/HStack/index.js +1 -0
- package/dist/components/Library/Image/Image.demo.svelte +18 -0
- package/dist/components/Library/Image/Image.demo.svelte.d.ts +23 -0
- package/dist/components/Library/Image/Image.svelte +57 -0
- package/dist/components/Library/Image/Image.svelte.d.ts +17 -0
- package/dist/components/Library/Image/ImagePlaceholder.svelte +202 -0
- package/dist/components/Library/Image/ImagePlaceholder.svelte.d.ts +7 -0
- package/dist/components/Library/Image/index.d.ts +1 -0
- package/dist/components/Library/Image/index.js +1 -0
- package/dist/components/Library/ImageMask/BrushPreview.svelte +119 -0
- package/dist/components/Library/ImageMask/BrushPreview.svelte.d.ts +11 -0
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte +117 -0
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte.d.ts +10 -0
- package/dist/components/Library/ImageMask/ImageMask.svelte +46 -0
- package/dist/components/Library/ImageMask/ImageMask.svelte.d.ts +20 -0
- package/dist/components/Library/ImageMask/MaskLayer.svelte +341 -0
- package/dist/components/Library/ImageMask/MaskLayer.svelte.d.ts +12 -0
- package/dist/components/Library/ImageMask/contour.d.ts +11 -0
- package/dist/components/Library/ImageMask/contour.js +152 -0
- package/dist/components/Library/ImageMask/index.d.ts +2 -0
- package/dist/components/Library/ImageMask/index.js +1 -0
- package/dist/components/Library/ImageMask/marchingAnts.d.ts +8 -0
- package/dist/components/Library/ImageMask/marchingAnts.js +29 -0
- package/dist/components/Library/ImageMask/maskSurface.d.ts +5 -0
- package/dist/components/Library/ImageMask/maskSurface.js +94 -0
- package/dist/components/Library/ImageMask/types.d.ts +23 -0
- package/dist/components/Library/Label/Label.demo.svelte +28 -0
- package/dist/components/Library/Label/Label.demo.svelte.d.ts +9 -0
- package/dist/components/Library/Label/Label.svelte +175 -0
- package/dist/components/Library/Label/Label.svelte.d.ts +18 -0
- package/dist/components/Library/Label/index.d.ts +1 -0
- package/dist/components/Library/Label/index.js +1 -0
- package/dist/components/Library/NavigationStack/NavigationStack.svelte +17 -7
- package/dist/components/Library/NavigationStack/Toolbar.svelte +7 -2
- package/dist/components/Library/NumberField/NumberField.demo.svelte +21 -0
- package/dist/components/Library/NumberField/NumberField.demo.svelte.d.ts +8 -0
- package/dist/components/Library/NumberField/NumberField.svelte +199 -0
- package/dist/components/Library/NumberField/NumberField.svelte.d.ts +21 -0
- package/dist/components/Library/NumberField/index.d.ts +1 -0
- package/dist/components/Library/NumberField/index.js +1 -0
- package/dist/components/Library/Pagination/Pagination.svelte +16 -20
- package/dist/components/Library/Popover/Popover.demo.svelte +2 -2
- package/dist/components/Library/Popover/Popover.svelte +7 -4
- package/dist/components/Library/ScrollView/ScrollView.svelte +165 -12
- package/dist/components/Library/ScrollView/ScrollView.svelte.d.ts +32 -4
- package/dist/components/Library/ScrollView/index.d.ts +1 -0
- package/dist/components/Library/{SearchInput/SearchInput.demo.svelte → SearchField/SearchField.demo.svelte} +4 -4
- package/dist/components/Library/SearchField/SearchField.demo.svelte.d.ts +8 -0
- package/dist/components/Library/{SearchInput/SearchInput.svelte → SearchField/SearchField.svelte} +26 -30
- package/dist/components/Library/{SearchInput/SearchInput.svelte.d.ts → SearchField/SearchField.svelte.d.ts} +3 -3
- package/dist/components/Library/SearchField/index.d.ts +1 -0
- package/dist/components/Library/SearchField/index.js +1 -0
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +1 -1
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.svelte +9 -9
- package/dist/components/Library/Sheet/Sheet.demo.svelte +1 -1
- package/dist/components/Library/Sheet/Sheet.svelte +8 -5
- package/dist/components/Library/Slider/Slider.demo.svelte +1 -1
- package/dist/components/Library/Slider/Slider.svelte +11 -10
- package/dist/components/Library/Spacer/Spacer.svelte +7 -0
- package/dist/components/Library/Spacer/Spacer.svelte.d.ts +26 -0
- package/dist/components/Library/Spacer/index.d.ts +1 -0
- package/dist/components/Library/Spacer/index.js +1 -0
- package/dist/components/Library/Spinner/Spinner.demo.svelte +1 -1
- package/dist/components/Library/Switch/Switch.svelte +6 -11
- package/dist/components/Library/TextField/TextField.demo.svelte +14 -0
- package/dist/components/Library/TextField/TextField.demo.svelte.d.ts +8 -0
- package/dist/components/Library/TextField/TextField.svelte +154 -0
- package/dist/components/Library/TextField/TextField.svelte.d.ts +19 -0
- package/dist/components/Library/TextField/index.d.ts +1 -0
- package/dist/components/Library/TextField/index.js +1 -0
- package/dist/components/Library/{TokenSearchInput/TokenSearchInput.demo.svelte → TokenSearchField/TokenSearchField.demo.svelte} +4 -4
- package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte.d.ts +9 -0
- package/dist/components/Library/{TokenSearchInput/TokenSearchInput.svelte → TokenSearchField/TokenSearchField.svelte} +70 -66
- package/dist/components/Library/{TokenSearchInput/TokenSearchInput.svelte.d.ts → TokenSearchField/TokenSearchField.svelte.d.ts} +3 -3
- package/dist/components/Library/TokenSearchField/index.d.ts +1 -0
- package/dist/components/Library/TokenSearchField/index.js +1 -0
- package/dist/components/Library/VStack/VStack.svelte +45 -0
- package/dist/components/Library/VStack/VStack.svelte.d.ts +9 -0
- package/dist/components/Library/VStack/index.d.ts +1 -0
- package/dist/components/Library/VStack/index.js +1 -0
- package/dist/components/Library/WheelPicker/WheelColumn.svelte +4 -10
- package/dist/components/Library/WheelPicker/WheelPicker.svelte +5 -9
- package/dist/components/Local/ComponentGrid.svelte +15 -31
- package/dist/components/Local/HeroCard.svelte +30 -38
- package/dist/components/Local/HeroCard.svelte.d.ts +0 -2
- package/dist/components/Local/StyleControls.svelte +58 -27
- package/dist/components/Local/StyleControls.svelte.d.ts +3 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.js +19 -2
- package/dist/style/index.css +35 -20
- package/dist/style/label.d.ts +6 -0
- package/dist/style/label.js +4 -0
- package/dist/style/layout.d.ts +57 -0
- package/dist/style/layout.js +128 -0
- package/dist/style/media.d.ts +12 -0
- package/dist/style/media.js +8 -0
- package/dist/style/scroll.d.ts +7 -0
- package/dist/style/scroll.js +5 -0
- package/dist/style/text-editor.d.ts +34 -0
- package/dist/style/text-editor.js +29 -0
- package/dist/style.css +112 -58
- package/package.json +1 -1
- package/dist/components/Library/Dropdown/types.d.ts +0 -27
- package/dist/components/Library/SearchInput/SearchInput.demo.svelte.d.ts +0 -8
- package/dist/components/Library/SearchInput/index.d.ts +0 -1
- package/dist/components/Library/SearchInput/index.js +0 -1
- package/dist/components/Library/TokenSearchInput/TokenSearchInput.demo.svelte.d.ts +0 -9
- package/dist/components/Library/TokenSearchInput/index.d.ts +0 -1
- package/dist/components/Library/TokenSearchInput/index.js +0 -1
- /package/dist/components/Library/{Dropdown → ImageMask}/types.js +0 -0
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
19
|
<div class="vstack center gap-3">
|
|
20
|
-
<div class="text-3xl font-semibold text-
|
|
20
|
+
<div class="text-3xl font-semibold text-[var(--sveltely-primary-color)]">
|
|
21
21
|
<AnimatedNumber {value} />
|
|
22
22
|
</div>
|
|
23
23
|
<Button label="Change number" variant="solid" onclick={bump} />
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
iconColor?: string;
|
|
18
18
|
iconSize?: number | string;
|
|
19
19
|
labelColor?: string;
|
|
20
|
-
} & StyleProps &
|
|
20
|
+
} & StyleProps &
|
|
21
|
+
Omit<HTMLButtonAttributes, 'children' | 'onclick' | 'class' | 'style'>;
|
|
21
22
|
|
|
22
23
|
let {
|
|
23
24
|
icon,
|
|
@@ -135,32 +136,57 @@
|
|
|
135
136
|
--async-button-font-size: var(--sveltely-font-size);
|
|
136
137
|
--async-button-scale: calc(var(--async-button-font-size) / 1rem);
|
|
137
138
|
--async-button-icon-size: calc(var(--async-button-font-size) * 1.143);
|
|
138
|
-
border: 1px solid var(--async-button-border-color, var(--sveltely-
|
|
139
|
+
border: 1px solid var(--async-button-border-color, var(--sveltely-active-color));
|
|
139
140
|
border-radius: var(--async-button-border-radius, var(--sveltely-border-radius));
|
|
140
|
-
background: var(--async-button-background, var(--sveltely-
|
|
141
|
-
color: var(--async-button-color,
|
|
141
|
+
background: var(--async-button-background, var(--sveltely-active-color));
|
|
142
|
+
color: var(--async-button-color, var(--sveltely-background-color));
|
|
142
143
|
gap: var(--async-button-gap, var(--sveltely-gap));
|
|
143
144
|
font-size: var(--async-button-font-size);
|
|
144
145
|
line-height: 1.25;
|
|
145
|
-
padding:
|
|
146
|
-
|
|
146
|
+
padding: var(
|
|
147
|
+
--async-button-padding-y,
|
|
148
|
+
calc(var(--sveltely-padding-y) * 0.67 * var(--async-button-scale))
|
|
149
|
+
)
|
|
147
150
|
var(--async-button-padding-x, calc(var(--sveltely-padding-x) * var(--async-button-scale)));
|
|
148
|
-
transition:
|
|
151
|
+
transition:
|
|
152
|
+
color 150ms,
|
|
153
|
+
border-color 150ms,
|
|
154
|
+
background-color 150ms;
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
.async-button:hover {
|
|
152
|
-
background: var(
|
|
153
|
-
--async-button-hover-background,
|
|
154
|
-
var(--sveltely-active-hover-color)
|
|
155
|
-
);
|
|
158
|
+
background: var(--async-button-hover-background, var(--sveltely-active-hover-color));
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
.async-button-icon-only {
|
|
159
|
-
padding:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
padding: var(
|
|
163
|
+
--async-button-padding-y,
|
|
164
|
+
calc(var(--sveltely-padding-y) * 0.67 * var(--async-button-scale))
|
|
165
|
+
)
|
|
166
|
+
var(
|
|
167
|
+
--async-button-padding-x,
|
|
168
|
+
calc(var(--sveltely-padding-x) * 0.67 * var(--async-button-scale))
|
|
169
|
+
);
|
|
170
|
+
min-width: calc(
|
|
171
|
+
(
|
|
172
|
+
var(
|
|
173
|
+
--async-button-padding-x,
|
|
174
|
+
calc(var(--sveltely-padding-x) * 0.67 * var(--async-button-scale))
|
|
175
|
+
) *
|
|
176
|
+
2
|
|
177
|
+
) +
|
|
178
|
+
1rem
|
|
179
|
+
);
|
|
180
|
+
min-height: calc(
|
|
181
|
+
(
|
|
182
|
+
var(
|
|
183
|
+
--async-button-padding-y,
|
|
184
|
+
calc(var(--sveltely-padding-y) * 0.67 * var(--async-button-scale))
|
|
185
|
+
) *
|
|
186
|
+
2
|
|
187
|
+
) +
|
|
188
|
+
1rem
|
|
189
|
+
);
|
|
164
190
|
}
|
|
165
191
|
|
|
166
192
|
.async-button-icon-frame {
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
export const demo = {
|
|
3
3
|
name: 'Button',
|
|
4
|
-
description: 'Token-aware button primitive with optional icon support.'
|
|
4
|
+
description: 'Token-aware button primitive with optional icon support.',
|
|
5
|
+
columnSpan: 2
|
|
5
6
|
};
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<script lang="ts">
|
|
9
10
|
import { SaveIcon } from '@lucide/svelte';
|
|
10
11
|
import Button from './Button.svelte';
|
|
12
|
+
import HStack from '../HStack';
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
|
-
<
|
|
15
|
+
<HStack align="center" gap={0.75}>
|
|
14
16
|
<Button label="Default" />
|
|
15
17
|
<Button label="Solid" variant="solid" />
|
|
16
18
|
<Button icon={SaveIcon} label="With icon" />
|
|
17
|
-
</
|
|
19
|
+
</HStack>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const demo: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
|
+
columnSpan: number;
|
|
4
5
|
};
|
|
5
6
|
import Button from './Button.svelte';
|
|
6
7
|
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> {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
iconSize?: number | string;
|
|
11
11
|
iconColor?: string;
|
|
12
12
|
variant?: 'default' | 'solid' | 'ghost';
|
|
13
|
-
} & StyleProps &
|
|
13
|
+
} & StyleProps &
|
|
14
|
+
Omit<HTMLButtonAttributes, 'children' | 'class' | 'style'>;
|
|
14
15
|
|
|
15
16
|
let {
|
|
16
17
|
children,
|
|
@@ -77,15 +78,17 @@
|
|
|
77
78
|
--button-icon-size: calc(var(--button-font-size) * 1.143);
|
|
78
79
|
border: 1px solid var(--button-border-color, var(--sveltely-border-color));
|
|
79
80
|
border-radius: var(--button-border-radius, var(--sveltely-border-radius));
|
|
80
|
-
background: var(--button-background,
|
|
81
|
-
color: var(--button-color, var(--
|
|
81
|
+
background: var(--button-background, var(--sveltely-background-color));
|
|
82
|
+
color: var(--button-color, var(--sveltely-primary-color));
|
|
82
83
|
gap: var(--button-gap, var(--sveltely-gap));
|
|
83
84
|
font-size: var(--button-font-size);
|
|
84
85
|
line-height: 1.25;
|
|
85
|
-
padding:
|
|
86
|
-
var(--button-padding-y, calc(var(--sveltely-padding-y) * 0.67 * var(--button-scale)))
|
|
86
|
+
padding: var(--button-padding-y, calc(var(--sveltely-padding-y) * 0.67 * var(--button-scale)))
|
|
87
87
|
var(--button-padding-x, calc(var(--sveltely-padding-x) * var(--button-scale)));
|
|
88
|
-
transition:
|
|
88
|
+
transition:
|
|
89
|
+
color 150ms,
|
|
90
|
+
border-color 150ms,
|
|
91
|
+
background-color 150ms;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
.button[data-variant='default']:hover {
|
|
@@ -93,9 +96,9 @@
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
.button[data-variant='solid'] {
|
|
96
|
-
border-color: var(--button-solid-border-color, var(--sveltely-
|
|
97
|
-
background: var(--button-solid-background, var(--sveltely-
|
|
98
|
-
color: var(--button-solid-color,
|
|
99
|
+
border-color: var(--button-solid-border-color, var(--sveltely-active-color));
|
|
100
|
+
background: var(--button-solid-background, var(--sveltely-active-color));
|
|
101
|
+
color: var(--button-solid-color, var(--sveltely-background-color));
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
.button[data-variant='solid']:hover {
|
|
@@ -112,11 +115,16 @@
|
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
.button-icon-only {
|
|
115
|
-
padding:
|
|
116
|
-
var(--button-padding-y, calc(var(--sveltely-padding-y) * 0.67 * var(--button-scale)))
|
|
118
|
+
padding: var(--button-padding-y, calc(var(--sveltely-padding-y) * 0.67 * var(--button-scale)))
|
|
117
119
|
var(--button-padding-x, calc(var(--sveltely-padding-x) * 0.67 * var(--button-scale)));
|
|
118
|
-
min-width: calc(
|
|
119
|
-
|
|
120
|
+
min-width: calc(
|
|
121
|
+
(var(--button-padding-x, calc(var(--sveltely-padding-x) * 0.67 * var(--button-scale))) * 2) +
|
|
122
|
+
1rem
|
|
123
|
+
);
|
|
124
|
+
min-height: calc(
|
|
125
|
+
(var(--button-padding-y, calc(var(--sveltely-padding-y) * 0.67 * var(--button-scale))) * 2) +
|
|
126
|
+
1rem
|
|
127
|
+
);
|
|
120
128
|
}
|
|
121
129
|
|
|
122
130
|
.button-icon-frame {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
name: 'Calendar',
|
|
4
4
|
description: 'Compact month calendar with token-driven spacing and radius.',
|
|
5
5
|
columnSpan: 2,
|
|
6
|
-
rowSpan:
|
|
6
|
+
rowSpan: 3
|
|
7
7
|
};
|
|
8
8
|
</script>
|
|
9
9
|
|
|
@@ -15,16 +15,4 @@
|
|
|
15
15
|
let weekStart = $state<'monday' | 'sunday'>('monday');
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<
|
|
19
|
-
<div class="hstack gap-2">
|
|
20
|
-
<button type="button" onclick={() => (weekStart = 'monday')}>Monday start</button>
|
|
21
|
-
<button type="button" onclick={() => (weekStart = 'sunday')}>Sunday start</button>
|
|
22
|
-
</div>
|
|
23
|
-
<Calendar bind:value bind:month {weekStart} />
|
|
24
|
-
<p class="text-xs text-zinc-500">
|
|
25
|
-
Selected: {value ? value.toLocaleDateString() : 'none'} | Month: {month.toLocaleDateString(undefined, {
|
|
26
|
-
month: 'long',
|
|
27
|
-
year: 'numeric'
|
|
28
|
-
})} | Week starts: {weekStart}
|
|
29
|
-
</p>
|
|
30
|
-
</div>
|
|
18
|
+
<Calendar bind:value bind:month {weekStart} />
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
const startOfDay = (value: Date) =>
|
|
6
6
|
new Date(value.getFullYear(), value.getMonth(), value.getDate());
|
|
7
7
|
|
|
8
|
-
const startOfMonth = (value: Date) =>
|
|
9
|
-
new Date(value.getFullYear(), value.getMonth(), 1);
|
|
8
|
+
const startOfMonth = (value: Date) => new Date(value.getFullYear(), value.getMonth(), 1);
|
|
10
9
|
|
|
11
10
|
type CalendarCell = {
|
|
12
11
|
key: string;
|
|
@@ -23,7 +22,8 @@
|
|
|
23
22
|
month?: Date;
|
|
24
23
|
weekdayLabels?: string[];
|
|
25
24
|
weekStart?: 'monday' | 'sunday';
|
|
26
|
-
} & StyleProps &
|
|
25
|
+
} & StyleProps &
|
|
26
|
+
Record<string, unknown>;
|
|
27
27
|
|
|
28
28
|
const defaultWeekdayLabels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
|
29
29
|
const today = new Date();
|
|
@@ -42,14 +42,10 @@
|
|
|
42
42
|
const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'calendar'));
|
|
43
43
|
|
|
44
44
|
const orderedWeekdayLabels = $derived(
|
|
45
|
-
weekStart === 'sunday'
|
|
46
|
-
? [weekdayLabels[6], ...weekdayLabels.slice(0, 6)]
|
|
47
|
-
: weekdayLabels
|
|
45
|
+
weekStart === 'sunday' ? [weekdayLabels[6], ...weekdayLabels.slice(0, 6)] : weekdayLabels
|
|
48
46
|
);
|
|
49
47
|
|
|
50
|
-
const weekendColumnIndexes = $derived(
|
|
51
|
-
weekStart === 'sunday' ? [0, 6] : [5, 6]
|
|
52
|
-
);
|
|
48
|
+
const weekendColumnIndexes = $derived(weekStart === 'sunday' ? [0, 6] : [5, 6]);
|
|
53
49
|
|
|
54
50
|
function shiftMonth(offset: number) {
|
|
55
51
|
month = new Date(month.getFullYear(), month.getMonth() + offset, 1);
|
|
@@ -59,6 +55,17 @@
|
|
|
59
55
|
value = startOfDay(nextValue);
|
|
60
56
|
}
|
|
61
57
|
|
|
58
|
+
function activateCell(cell: CalendarCell) {
|
|
59
|
+
if (!cell.value) return;
|
|
60
|
+
|
|
61
|
+
if (cell.isCurrentMonth) {
|
|
62
|
+
selectDate(cell.value);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
month = startOfMonth(cell.value);
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
const displayYear = $derived(month.getFullYear());
|
|
63
70
|
const displayMonth = $derived(month.getMonth());
|
|
64
71
|
const todayYear = today.getFullYear();
|
|
@@ -74,37 +81,28 @@
|
|
|
74
81
|
|
|
75
82
|
const cells = $derived.by(() => {
|
|
76
83
|
const firstDay = new Date(displayYear, displayMonth, 1);
|
|
77
|
-
const daysInMonth = new Date(displayYear, displayMonth + 1, 0).getDate();
|
|
78
84
|
const leadingEmptyDays =
|
|
79
85
|
weekStart === 'sunday' ? firstDay.getDay() : (firstDay.getDay() + 6) % 7;
|
|
80
86
|
|
|
81
|
-
return Array.from({ length:
|
|
87
|
+
return Array.from({ length: 42 }, (_, index): CalendarCell => {
|
|
82
88
|
const dayNumber = index - leadingEmptyDays + 1;
|
|
83
|
-
if (dayNumber < 1) {
|
|
84
|
-
return {
|
|
85
|
-
key: `empty-${index}`,
|
|
86
|
-
label: '',
|
|
87
|
-
isCurrentMonth: false,
|
|
88
|
-
isToday: false,
|
|
89
|
-
isWeekend: false,
|
|
90
|
-
isSelected: false
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
89
|
const cellDate = new Date(displayYear, displayMonth, dayNumber);
|
|
95
90
|
const dayOfWeek = cellDate.getDay();
|
|
91
|
+
const isCurrentMonth = cellDate.getMonth() === displayMonth;
|
|
96
92
|
|
|
97
93
|
return {
|
|
98
|
-
key: `day-${
|
|
99
|
-
label: String(
|
|
100
|
-
isCurrentMonth
|
|
94
|
+
key: `day-${cellDate.getFullYear()}-${cellDate.getMonth()}-${cellDate.getDate()}`,
|
|
95
|
+
label: String(cellDate.getDate()),
|
|
96
|
+
isCurrentMonth,
|
|
101
97
|
value: cellDate,
|
|
102
98
|
isToday:
|
|
99
|
+
isCurrentMonth &&
|
|
103
100
|
displayYear === todayYear &&
|
|
104
101
|
displayMonth === todayMonth &&
|
|
105
|
-
|
|
102
|
+
cellDate.getDate() === todayDate,
|
|
106
103
|
isWeekend: dayOfWeek === 0 || dayOfWeek === 6,
|
|
107
104
|
isSelected:
|
|
105
|
+
isCurrentMonth &&
|
|
108
106
|
value !== null &&
|
|
109
107
|
cellDate.getFullYear() === value.getFullYear() &&
|
|
110
108
|
cellDate.getMonth() === value.getMonth() &&
|
|
@@ -116,16 +114,26 @@
|
|
|
116
114
|
|
|
117
115
|
<div class="calendar vstack" style={rootStyle} {...props}>
|
|
118
116
|
<div class="calendar-grid">
|
|
119
|
-
<button
|
|
117
|
+
<button
|
|
118
|
+
class="calendar-nav-button"
|
|
119
|
+
type="button"
|
|
120
|
+
aria-label="Previous month"
|
|
121
|
+
onclick={() => shiftMonth(-1)}
|
|
122
|
+
>
|
|
120
123
|
<ChevronLeftIcon class="calendar-nav-icon" strokeWidth={2} />
|
|
121
124
|
</button>
|
|
122
125
|
<div class="calendar-title-cell">
|
|
123
126
|
<h2 class="calendar-title">{monthLabel}</h2>
|
|
124
127
|
</div>
|
|
125
|
-
<button
|
|
128
|
+
<button
|
|
129
|
+
class="calendar-nav-button"
|
|
130
|
+
type="button"
|
|
131
|
+
aria-label="Next month"
|
|
132
|
+
onclick={() => shiftMonth(1)}
|
|
133
|
+
>
|
|
126
134
|
<ChevronRightIcon class="calendar-nav-icon" strokeWidth={2} />
|
|
127
135
|
</button>
|
|
128
|
-
{#each orderedWeekdayLabels as weekday, index}
|
|
136
|
+
{#each orderedWeekdayLabels as weekday, index (weekday)}
|
|
129
137
|
<div
|
|
130
138
|
class="calendar-weekday"
|
|
131
139
|
class:calendar-weekday-weekend={weekendColumnIndexes.includes(index)}
|
|
@@ -135,23 +143,18 @@
|
|
|
135
143
|
{/each}
|
|
136
144
|
|
|
137
145
|
{#each cells as cell (cell.key)}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{:else}
|
|
151
|
-
<div class="calendar-day calendar-day-empty">
|
|
152
|
-
{cell.label}
|
|
153
|
-
</div>
|
|
154
|
-
{/if}
|
|
146
|
+
<button
|
|
147
|
+
type="button"
|
|
148
|
+
class="calendar-day"
|
|
149
|
+
class:calendar-day-outside={!cell.isCurrentMonth}
|
|
150
|
+
class:calendar-day-today={cell.isToday}
|
|
151
|
+
class:calendar-day-selected={cell.isSelected}
|
|
152
|
+
class:calendar-day-weekend={cell.isWeekend}
|
|
153
|
+
aria-pressed={cell.isSelected}
|
|
154
|
+
onclick={() => activateCell(cell)}
|
|
155
|
+
>
|
|
156
|
+
{cell.label}
|
|
157
|
+
</button>
|
|
155
158
|
{/each}
|
|
156
159
|
</div>
|
|
157
160
|
</div>
|
|
@@ -161,11 +164,13 @@
|
|
|
161
164
|
--calendar-font-size: calc(var(--sveltely-font-size) * 0.971);
|
|
162
165
|
--calendar-scale: calc(var(--calendar-font-size) / 1rem);
|
|
163
166
|
--calendar-cell-core-size: max(2ch, calc(2ch * var(--calendar-scale)));
|
|
164
|
-
--calendar-weekend-color: var(--
|
|
165
|
-
--calendar-weekend-header-color: var(--
|
|
166
|
-
--calendar-weekend-selected-color:
|
|
167
|
+
--calendar-weekend-color: var(--sveltely-secondary-color);
|
|
168
|
+
--calendar-weekend-header-color: var(--sveltely-secondary-color);
|
|
169
|
+
--calendar-weekend-selected-color: var(--sveltely-background-color);
|
|
167
170
|
--calendar-cell-width: calc(var(--calendar-cell-core-size) + (var(--sveltely-padding-x) * 2.2));
|
|
168
|
-
--calendar-cell-height: calc(
|
|
171
|
+
--calendar-cell-height: calc(
|
|
172
|
+
var(--calendar-cell-core-size) + (var(--sveltely-padding-y) * 2.2)
|
|
173
|
+
);
|
|
169
174
|
--calendar-title-size: calc(var(--calendar-font-size) * 1.03);
|
|
170
175
|
--calendar-weekday-size: calc(var(--calendar-font-size) * 0.75);
|
|
171
176
|
font-size: var(--calendar-font-size);
|
|
@@ -188,7 +193,7 @@
|
|
|
188
193
|
font-size: var(--calendar-title-size);
|
|
189
194
|
line-height: 1.4;
|
|
190
195
|
font-weight: 600;
|
|
191
|
-
color: var(--
|
|
196
|
+
color: var(--sveltely-primary-color);
|
|
192
197
|
}
|
|
193
198
|
|
|
194
199
|
.calendar-nav-button {
|
|
@@ -205,15 +210,15 @@
|
|
|
205
210
|
max-height: var(--calendar-cell-height);
|
|
206
211
|
border: 1px solid color-mix(in oklab, var(--sveltely-border-color) 75%, white);
|
|
207
212
|
border-radius: var(--sveltely-border-radius);
|
|
208
|
-
background: color-mix(in oklab, white 92%, var(--
|
|
213
|
+
background: color-mix(in oklab, white 92%, var(--sveltely-inactive-color));
|
|
209
214
|
padding: 0;
|
|
210
|
-
color: var(--
|
|
215
|
+
color: var(--sveltely-secondary-color);
|
|
211
216
|
cursor: pointer;
|
|
212
217
|
appearance: none;
|
|
213
218
|
}
|
|
214
219
|
|
|
215
220
|
.calendar-nav-button:focus-visible {
|
|
216
|
-
outline: 2px solid color-mix(in oklab, var(--sveltely-
|
|
221
|
+
outline: 2px solid color-mix(in oklab, var(--sveltely-active-color) 24%, white);
|
|
217
222
|
outline-offset: 2px;
|
|
218
223
|
}
|
|
219
224
|
|
|
@@ -245,7 +250,7 @@
|
|
|
245
250
|
font-size: var(--calendar-weekday-size);
|
|
246
251
|
line-height: 1;
|
|
247
252
|
text-align: center;
|
|
248
|
-
color: var(--
|
|
253
|
+
color: var(--sveltely-secondary-color);
|
|
249
254
|
}
|
|
250
255
|
|
|
251
256
|
.calendar-weekday-weekend {
|
|
@@ -261,11 +266,11 @@
|
|
|
261
266
|
height: 100%;
|
|
262
267
|
border: 1px solid color-mix(in oklab, var(--sveltely-border-color) 75%, white);
|
|
263
268
|
border-radius: var(--sveltely-border-radius);
|
|
264
|
-
background: color-mix(in oklab, white 92%, var(--
|
|
269
|
+
background: color-mix(in oklab, white 92%, var(--sveltely-inactive-color));
|
|
265
270
|
padding: 0;
|
|
266
271
|
font-size: calc(var(--calendar-font-size) * 0.85);
|
|
267
272
|
line-height: 1;
|
|
268
|
-
color: var(--
|
|
273
|
+
color: var(--sveltely-primary-color);
|
|
269
274
|
cursor: pointer;
|
|
270
275
|
appearance: none;
|
|
271
276
|
}
|
|
@@ -275,7 +280,7 @@
|
|
|
275
280
|
}
|
|
276
281
|
|
|
277
282
|
.calendar-day:focus-visible {
|
|
278
|
-
outline: 2px solid color-mix(in oklab, var(--sveltely-
|
|
283
|
+
outline: 2px solid color-mix(in oklab, var(--sveltely-active-color) 24%, white);
|
|
279
284
|
outline-offset: 2px;
|
|
280
285
|
}
|
|
281
286
|
|
|
@@ -283,21 +288,20 @@
|
|
|
283
288
|
background: var(--sveltely-hover-color);
|
|
284
289
|
}
|
|
285
290
|
|
|
286
|
-
.calendar-day-
|
|
291
|
+
.calendar-day-outside {
|
|
287
292
|
border-color: transparent;
|
|
288
293
|
background: transparent;
|
|
289
|
-
color:
|
|
290
|
-
cursor: default;
|
|
294
|
+
color: var(--sveltely-secondary-color);
|
|
291
295
|
}
|
|
292
296
|
|
|
293
297
|
.calendar-day-today {
|
|
294
|
-
border-color: color-mix(in oklab, var(--sveltely-
|
|
298
|
+
border-color: color-mix(in oklab, var(--sveltely-active-color) 18%, white);
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
.calendar-day-selected {
|
|
298
|
-
border-color: var(--sveltely-
|
|
299
|
-
background: var(--sveltely-
|
|
300
|
-
color:
|
|
302
|
+
border-color: var(--sveltely-active-color);
|
|
303
|
+
background: var(--sveltely-active-color);
|
|
304
|
+
color: var(--sveltely-background-color);
|
|
301
305
|
}
|
|
302
306
|
|
|
303
307
|
.calendar-day-selected:hover {
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
checked?: boolean;
|
|
9
9
|
label?: string;
|
|
10
10
|
children?: Snippet;
|
|
11
|
-
} & StyleProps &
|
|
11
|
+
} & StyleProps &
|
|
12
|
+
Omit<HTMLInputAttributes, 'type' | 'children' | 'class' | 'style' | 'checked'>;
|
|
12
13
|
|
|
13
14
|
let {
|
|
14
15
|
checked = $bindable(false),
|
|
@@ -52,13 +53,14 @@
|
|
|
52
53
|
--checkbox-font-size: var(--sveltely-font-size);
|
|
53
54
|
--checkbox-scale: calc(var(--checkbox-font-size) / 1rem);
|
|
54
55
|
--checkbox-box-size: calc(
|
|
55
|
-
(var(--checkbox-font-size) * 0.92) +
|
|
56
|
+
(var(--checkbox-font-size) * 0.92) +
|
|
57
|
+
(var(--sveltely-padding-y) * 0.28 * var(--checkbox-scale))
|
|
56
58
|
);
|
|
57
59
|
--checkbox-icon-size: calc(var(--checkbox-box-size) * 0.64);
|
|
58
60
|
gap: var(--checkbox-gap, var(--sveltely-gap));
|
|
59
61
|
font-size: var(--checkbox-font-size);
|
|
60
62
|
line-height: 1.25;
|
|
61
|
-
color: var(--checkbox-color, var(--
|
|
63
|
+
color: var(--checkbox-color, var(--sveltely-primary-color));
|
|
62
64
|
cursor: pointer;
|
|
63
65
|
user-select: none;
|
|
64
66
|
}
|
|
@@ -93,7 +95,10 @@
|
|
|
93
95
|
display: inline-flex;
|
|
94
96
|
align-items: center;
|
|
95
97
|
justify-content: center;
|
|
96
|
-
transition:
|
|
98
|
+
transition:
|
|
99
|
+
color 150ms,
|
|
100
|
+
border-color 150ms,
|
|
101
|
+
background-color 150ms;
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
.checkbox:hover .checkbox-mark {
|
|
@@ -103,22 +108,16 @@
|
|
|
103
108
|
.checkbox-control input:checked + .checkbox-mark {
|
|
104
109
|
border-color: var(--checkbox-checked-border-color, var(--sveltely-active-color));
|
|
105
110
|
background: var(--checkbox-checked-background, var(--sveltely-active-color));
|
|
106
|
-
color: var(--checkbox-checked-color,
|
|
111
|
+
color: var(--checkbox-checked-color, var(--sveltely-background-color));
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
.checkbox:hover .checkbox-control input:checked + .checkbox-mark {
|
|
110
|
-
background: var(
|
|
111
|
-
|
|
112
|
-
var(--sveltely-active-hover-color)
|
|
113
|
-
);
|
|
114
|
-
border-color: var(
|
|
115
|
-
--checkbox-checked-hover-border-color,
|
|
116
|
-
var(--sveltely-active-hover-color)
|
|
117
|
-
);
|
|
115
|
+
background: var(--checkbox-checked-hover-background, var(--sveltely-active-hover-color));
|
|
116
|
+
border-color: var(--checkbox-checked-hover-border-color, var(--sveltely-active-hover-color));
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
.checkbox-control input:focus-visible + .checkbox-mark {
|
|
121
|
-
outline: 2px solid color-mix(in oklab, var(--sveltely-
|
|
120
|
+
outline: 2px solid color-mix(in oklab, var(--sveltely-active-color) 24%, white);
|
|
122
121
|
outline-offset: 2px;
|
|
123
122
|
}
|
|
124
123
|
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
selection?: string[];
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
action?: Snippet;
|
|
13
|
-
} & StyleProps &
|
|
13
|
+
} & StyleProps &
|
|
14
|
+
Record<string, unknown>;
|
|
14
15
|
|
|
15
16
|
let {
|
|
16
17
|
placeholder = 'Add a tag...',
|
|
@@ -321,7 +322,9 @@
|
|
|
321
322
|
--chip-input-icon-size: calc(var(--chip-input-font-size) * 1);
|
|
322
323
|
--chip-input-padding-y: calc(var(--sveltely-padding-y) * 0.33 * var(--chip-input-scale));
|
|
323
324
|
--chip-input-padding-x: calc(var(--sveltely-padding-x) * 0.67 * var(--chip-input-scale));
|
|
324
|
-
--chip-input-control-height: calc(
|
|
325
|
+
--chip-input-control-height: calc(
|
|
326
|
+
var(--chip-input-line-height) + (var(--chip-input-padding-y) * 2) + 2px
|
|
327
|
+
);
|
|
325
328
|
gap: calc(var(--sveltely-gap) * 0.5);
|
|
326
329
|
}
|
|
327
330
|
|
|
@@ -329,7 +332,7 @@
|
|
|
329
332
|
box-sizing: border-box;
|
|
330
333
|
border: 1px solid var(--sveltely-border-color);
|
|
331
334
|
border-radius: var(--sveltely-border-radius);
|
|
332
|
-
background: var(--
|
|
335
|
+
background: var(--sveltely-inactive-color);
|
|
333
336
|
color: black;
|
|
334
337
|
min-height: var(--chip-input-control-height);
|
|
335
338
|
padding: var(--chip-input-padding-y) var(--chip-input-padding-x);
|
|
@@ -339,7 +342,7 @@
|
|
|
339
342
|
}
|
|
340
343
|
|
|
341
344
|
.chip-selected {
|
|
342
|
-
border-color: var(--
|
|
345
|
+
border-color: var(--sveltely-border-color);
|
|
343
346
|
}
|
|
344
347
|
|
|
345
348
|
.chip:hover,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Divider;
|
|
2
|
+
type Divider = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Divider: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Divider.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Divider.svelte';
|