@skeletonlabs/skeleton 0.80.8 → 0.86.9
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 +1 -1
- package/actions/Filters/svg-filters/Apollo.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/BlueNight.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/Emerald.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/GreenFall.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/Noir.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/NoirLight.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/Rustic.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/Summer84.svelte.d.ts +6 -2
- package/actions/Filters/svg-filters/XPro.svelte.d.ts +6 -2
- package/components/Accordion/AccordionGroup.svelte +1 -2
- package/components/Accordion/AccordionItem.svelte +1 -1
- package/components/Accordion/AccordionItem.svelte.d.ts +1 -0
- package/components/Alert/Alert.svelte +3 -3
- package/components/AppRail/AppRailTile.svelte +17 -18
- package/components/AppShell/AppShell.svelte +3 -3
- package/components/Breadcrumb/Crumb.svelte +3 -1
- package/components/Breadcrumb/Crumb.svelte.d.ts +5 -0
- package/components/ConicGradient/ConicGradient.svelte +1 -1
- package/components/ConicGradient/ConicGradient.svelte.d.ts +5 -0
- package/components/FileButton/FileButton.svelte +2 -2
- package/components/FileButton/FileButton.svelte.d.ts +3 -0
- package/components/FileDropzone/FileDropzone.svelte +4 -0
- package/components/FileDropzone/FileDropzone.svelte.d.ts +4 -0
- package/components/GradientHeading/GradientHeading.svelte +1 -1
- package/components/ListBox/ListBoxItem.svelte +3 -1
- package/components/ListBox/ListBoxItem.svelte.d.ts +2 -0
- package/components/Paginator/Paginator.svelte +21 -9
- package/components/Paginator/Paginator.svelte.d.ts +5 -1
- package/components/ProgressBar/ProgressBar.svelte +6 -4
- package/components/ProgressBar/ProgressBar.svelte.d.ts +1 -0
- package/components/ProgressRadial/ProgressRadial.svelte +1 -1
- package/components/Radio/RadioGroup.svelte +2 -2
- package/components/Radio/RadioItem.svelte +3 -1
- package/components/Radio/RadioItem.svelte.d.ts +2 -0
- package/components/RangeSlider/RangeSlider.svelte +1 -1
- package/components/SlideToggle/SlideToggle.svelte +8 -5
- package/components/SlideToggle/SlideToggle.svelte.d.ts +4 -1
- package/components/Stepper/Step.svelte +27 -7
- package/components/Stepper/Step.svelte.d.ts +6 -3
- package/components/Stepper/Stepper.svelte +19 -10
- package/components/Stepper/Stepper.svelte.d.ts +6 -3
- package/components/Tab/Tab.svelte +15 -3
- package/components/Tab/Tab.svelte.d.ts +5 -0
- package/components/Table/Table.svelte +3 -3
- package/package.json +18 -20
- package/styles/elements/badges.css +11 -5
- package/styles/elements/buttons.css +33 -9
- package/styles/elements/cards.css +22 -3
- package/styles/elements/chips.css +4 -2
- package/styles/elements/tables.css +1 -1
- package/styles/forms.css +4 -4
- package/styles/tokens/backgrounds.css +119 -29
- package/styles/tokens/borders.css +90 -22
- package/styles/tokens/fills.css +14 -5
- package/styles/tokens/rings.css +90 -22
- package/styles/tokens/text.css +104 -27
- package/styles/tokens.css +0 -3
- package/styles/typography.css +6 -6
- package/tailwind/colors.d.ts +1 -1
- package/tailwind/colors.js +1 -1
- package/tailwind/theme.cjs +4 -2
- package/themes/theme-crimson.css +88 -64
- package/themes/theme-gold-nouveau.css +108 -115
- package/themes/theme-hamlindigo.css +97 -74
- package/themes/theme-modern.css +107 -64
- package/themes/theme-rocket.css +96 -63
- package/themes/theme-sahara.css +104 -65
- package/themes/theme-seafoam.css +100 -66
- package/themes/theme-seasonal.css +111 -65
- package/themes/theme-skeleton.css +99 -75
- package/themes/theme-vintage.css +102 -63
- package/utilities/CodeBlock/CodeBlock.svelte +6 -1
- package/utilities/CodeBlock/CodeBlock.svelte.d.ts +2 -0
- package/utilities/DataTable/DataTable.js +3 -1
- package/utilities/Drawer/Drawer.svelte +11 -10
- package/utilities/Drawer/Drawer.svelte.d.ts +1 -2
- package/utilities/Drawer/stores.d.ts +1 -1
- package/utilities/LightSwitch/LightSwitch.svelte +9 -4
- package/utilities/LightSwitch/LightSwitch.svelte.d.ts +6 -1
- package/utilities/LocalStorageStore/LocalStorageStore.d.ts +3 -1
- package/utilities/LocalStorageStore/LocalStorageStore.js +9 -4
- package/utilities/Menu/menu.js +11 -7
- package/utilities/Modal/Modal.svelte +21 -9
- package/utilities/Modal/Modal.svelte.d.ts +2 -0
- package/utilities/Modal/types.d.ts +8 -0
- package/utilities/Toast/Toast.svelte +2 -2
- package/utilities/Toast/stores.js +18 -1
- package/utilities/Toast/types.d.ts +5 -0
- package/styles/tokens/misc.css +0 -22
package/themes/theme-vintage.css
CHANGED
|
@@ -5,75 +5,99 @@
|
|
|
5
5
|
|
|
6
6
|
:root {
|
|
7
7
|
/* =~= Theme Styles =~= */
|
|
8
|
-
--theme-border-base: 1px;
|
|
9
|
-
--theme-font-family-heading: 'Abril Fatface', cursive;
|
|
10
8
|
--theme-font-family-base: 'Noto Sans', sans-serif;
|
|
9
|
+
--theme-font-family-heading: 'Abril Fatface', cursive;
|
|
11
10
|
--theme-font-color-base: var(--color-primary-900);
|
|
12
11
|
--theme-font-color-dark: var(--color-primary-100);
|
|
13
12
|
--theme-rounded-base: 2px;
|
|
14
13
|
--theme-rounded-container: 4px;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
--on-
|
|
18
|
-
--on-
|
|
19
|
-
--on-
|
|
20
|
-
--on-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
--
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
--color-primary-
|
|
27
|
-
--color-primary-
|
|
28
|
-
--color-primary-
|
|
29
|
-
--color-primary-
|
|
30
|
-
--color-primary-
|
|
31
|
-
--color-primary-
|
|
32
|
-
--color-primary-
|
|
33
|
-
/*
|
|
34
|
-
--color-
|
|
35
|
-
--color-
|
|
36
|
-
|
|
37
|
-
--color-
|
|
38
|
-
--color-
|
|
39
|
-
--color-
|
|
40
|
-
--color-
|
|
41
|
-
--color-
|
|
42
|
-
--color-
|
|
43
|
-
--color-
|
|
44
|
-
/*
|
|
45
|
-
--color-
|
|
46
|
-
--color-
|
|
47
|
-
|
|
48
|
-
--color-tertiary-
|
|
49
|
-
--color-tertiary-
|
|
14
|
+
--theme-border-base: 1px;
|
|
15
|
+
/* =~= Theme On-X Colors =~= */
|
|
16
|
+
--on-primary: 0 0 0;
|
|
17
|
+
--on-secondary: 0 0 0;
|
|
18
|
+
--on-tertiary: 0 0 0;
|
|
19
|
+
--on-success: 0 0 0;
|
|
20
|
+
--on-warning: 0 0 0;
|
|
21
|
+
--on-error: 0 0 0;
|
|
22
|
+
--on-surface: 255 255 255;
|
|
23
|
+
/* =~= Theme Colors =~= */
|
|
24
|
+
/* primary | #ea861a */
|
|
25
|
+
--color-primary-50: 252 237 221; /* ⬅ #fceddd */
|
|
26
|
+
--color-primary-100: 251 231 209; /* ⬅ #fbe7d1 */
|
|
27
|
+
--color-primary-200: 250 225 198; /* ⬅ #fae1c6 */
|
|
28
|
+
--color-primary-300: 247 207 163; /* ⬅ #f7cfa3 */
|
|
29
|
+
--color-primary-400: 240 170 95; /* ⬅ #f0aa5f */
|
|
30
|
+
--color-primary-500: 234 134 26; /* ⬅ #ea861a */
|
|
31
|
+
--color-primary-600: 211 121 23; /* ⬅ #d37917 */
|
|
32
|
+
--color-primary-700: 176 101 20; /* ⬅ #b06514 */
|
|
33
|
+
--color-primary-800: 140 80 16; /* ⬅ #8c5010 */
|
|
34
|
+
--color-primary-900: 115 66 13; /* ⬅ #73420d */
|
|
35
|
+
/* secondary | #97cea5 */
|
|
36
|
+
--color-secondary-50: 239 248 242; /* ⬅ #eff8f2 */
|
|
37
|
+
--color-secondary-100: 234 245 237; /* ⬅ #eaf5ed */
|
|
38
|
+
--color-secondary-200: 229 243 233; /* ⬅ #e5f3e9 */
|
|
39
|
+
--color-secondary-300: 213 235 219; /* ⬅ #d5ebdb */
|
|
40
|
+
--color-secondary-400: 182 221 192; /* ⬅ #b6ddc0 */
|
|
41
|
+
--color-secondary-500: 151 206 165; /* ⬅ #97cea5 */
|
|
42
|
+
--color-secondary-600: 136 185 149; /* ⬅ #88b995 */
|
|
43
|
+
--color-secondary-700: 113 155 124; /* ⬅ #719b7c */
|
|
44
|
+
--color-secondary-800: 91 124 99; /* ⬅ #5b7c63 */
|
|
45
|
+
--color-secondary-900: 74 101 81; /* ⬅ #4a6551 */
|
|
46
|
+
/* tertiary | #06b6d4 */
|
|
47
|
+
--color-tertiary-50: 218 244 249; /* ⬅ #daf4f9 */
|
|
48
|
+
--color-tertiary-100: 205 240 246; /* ⬅ #cdf0f6 */
|
|
49
|
+
--color-tertiary-200: 193 237 244; /* ⬅ #c1edf4 */
|
|
50
|
+
--color-tertiary-300: 155 226 238; /* ⬅ #9be2ee */
|
|
51
|
+
--color-tertiary-400: 81 204 225; /* ⬅ #51cce1 */
|
|
50
52
|
--color-tertiary-500: 6 182 212; /* ⬅ #06b6d4 */
|
|
51
|
-
--color-tertiary-600:
|
|
52
|
-
--color-tertiary-700:
|
|
53
|
-
--color-tertiary-800:
|
|
54
|
-
--color-tertiary-900:
|
|
55
|
-
/*
|
|
56
|
-
--color-
|
|
57
|
-
--color-
|
|
58
|
-
--color-
|
|
59
|
-
--color-
|
|
60
|
-
--color-
|
|
61
|
-
--color-
|
|
62
|
-
--color-
|
|
63
|
-
--color-
|
|
64
|
-
--color-
|
|
65
|
-
--color-
|
|
66
|
-
/*
|
|
67
|
-
--color-
|
|
68
|
-
--color-
|
|
69
|
-
--color-
|
|
70
|
-
--color-
|
|
71
|
-
--color-
|
|
72
|
-
--color-
|
|
73
|
-
--color-
|
|
74
|
-
--color-
|
|
75
|
-
--color-
|
|
76
|
-
--color-
|
|
53
|
+
--color-tertiary-600: 5 164 191; /* ⬅ #05a4bf */
|
|
54
|
+
--color-tertiary-700: 5 137 159; /* ⬅ #05899f */
|
|
55
|
+
--color-tertiary-800: 4 109 127; /* ⬅ #046d7f */
|
|
56
|
+
--color-tertiary-900: 3 89 104; /* ⬅ #035968 */
|
|
57
|
+
/* success | #84cb5d */
|
|
58
|
+
--color-success-50: 237 247 231; /* ⬅ #edf7e7 */
|
|
59
|
+
--color-success-100: 230 245 223; /* ⬅ #e6f5df */
|
|
60
|
+
--color-success-200: 224 242 215; /* ⬅ #e0f2d7 */
|
|
61
|
+
--color-success-300: 206 234 190; /* ⬅ #ceeabe */
|
|
62
|
+
--color-success-400: 169 219 142; /* ⬅ #a9db8e */
|
|
63
|
+
--color-success-500: 132 203 93; /* ⬅ #84cb5d */
|
|
64
|
+
--color-success-600: 119 183 84; /* ⬅ #77b754 */
|
|
65
|
+
--color-success-700: 99 152 70; /* ⬅ #639846 */
|
|
66
|
+
--color-success-800: 79 122 56; /* ⬅ #4f7a38 */
|
|
67
|
+
--color-success-900: 65 99 46; /* ⬅ #41632e */
|
|
68
|
+
/* warning | #f2ac23 */
|
|
69
|
+
--color-warning-50: 253 243 222; /* ⬅ #fdf3de */
|
|
70
|
+
--color-warning-100: 252 238 211; /* ⬅ #fceed3 */
|
|
71
|
+
--color-warning-200: 252 234 200; /* ⬅ #fceac8 */
|
|
72
|
+
--color-warning-300: 250 222 167; /* ⬅ #fadea7 */
|
|
73
|
+
--color-warning-400: 246 197 101; /* ⬅ #f6c565 */
|
|
74
|
+
--color-warning-500: 242 172 35; /* ⬅ #f2ac23 */
|
|
75
|
+
--color-warning-600: 218 155 32; /* ⬅ #da9b20 */
|
|
76
|
+
--color-warning-700: 182 129 26; /* ⬅ #b6811a */
|
|
77
|
+
--color-warning-800: 145 103 21; /* ⬅ #916715 */
|
|
78
|
+
--color-warning-900: 119 84 17; /* ⬅ #775411 */
|
|
79
|
+
/* error | #d57e78 */
|
|
80
|
+
--color-error-50: 249 236 235; /* ⬅ #f9eceb */
|
|
81
|
+
--color-error-100: 247 229 228; /* ⬅ #f7e5e4 */
|
|
82
|
+
--color-error-200: 245 223 221; /* ⬅ #f5dfdd */
|
|
83
|
+
--color-error-300: 238 203 201; /* ⬅ #eecbc9 */
|
|
84
|
+
--color-error-400: 226 165 161; /* ⬅ #e2a5a1 */
|
|
85
|
+
--color-error-500: 213 126 120; /* ⬅ #d57e78 */
|
|
86
|
+
--color-error-600: 192 113 108; /* ⬅ #c0716c */
|
|
87
|
+
--color-error-700: 160 95 90; /* ⬅ #a05f5a */
|
|
88
|
+
--color-error-800: 128 76 72; /* ⬅ #804c48 */
|
|
89
|
+
--color-error-900: 104 62 59; /* ⬅ #683e3b */
|
|
90
|
+
/* surface | #3f3731 */
|
|
91
|
+
--color-surface-50: 226 225 224; /* ⬅ #e2e1e0 */
|
|
92
|
+
--color-surface-100: 217 215 214; /* ⬅ #d9d7d6 */
|
|
93
|
+
--color-surface-200: 207 205 204; /* ⬅ #cfcdcc */
|
|
94
|
+
--color-surface-300: 178 175 173; /* ⬅ #b2afad */
|
|
95
|
+
--color-surface-400: 121 115 111; /* ⬅ #79736f */
|
|
96
|
+
--color-surface-500: 63 55 49; /* ⬅ #3f3731 */
|
|
97
|
+
--color-surface-600: 57 50 44; /* ⬅ #39322c */
|
|
98
|
+
--color-surface-700: 47 41 37; /* ⬅ #2f2925 */
|
|
99
|
+
--color-surface-800: 38 33 29; /* ⬅ #26211d */
|
|
100
|
+
--color-surface-900: 31 27 24; /* ⬅ #1f1b18 */
|
|
77
101
|
}
|
|
78
102
|
|
|
79
103
|
[data-theme='vintage'] h1,
|
|
@@ -84,3 +108,18 @@
|
|
|
84
108
|
[data-theme='vintage'] h6 {
|
|
85
109
|
letter-spacing: 1px;
|
|
86
110
|
}
|
|
111
|
+
|
|
112
|
+
/* Applied to body with `<body data-theme="vintage">` */
|
|
113
|
+
/* Created with: https://csshero.org/mesher/ */
|
|
114
|
+
[data-theme='vintage'] {
|
|
115
|
+
/* prettier-ignore */
|
|
116
|
+
background-image:
|
|
117
|
+
radial-gradient(at 100% 0%, hsla(135,34%,70%,0.20) 0px, transparent 50%),
|
|
118
|
+
radial-gradient(at 85% 100%, hsla(31,83%,50%,0.20) 0px, transparent 50%);
|
|
119
|
+
}
|
|
120
|
+
.dark [data-theme='vintage'] {
|
|
121
|
+
/* prettier-ignore */
|
|
122
|
+
background-image:
|
|
123
|
+
radial-gradient(at 100% 0%, hsla(135,34%,70%,0.14) 0px, transparent 50%),
|
|
124
|
+
radial-gradient(at 85% 100%, hsla(31,83%,50%,0.14) 0px, transparent 50%);
|
|
125
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
<script>import {
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
// Event Handler
|
|
3
|
+
const dispatch = createEventDispatcher();
|
|
4
|
+
import { storeHighlightJs } from './stores';
|
|
2
5
|
import { clipboard } from '../../actions/Clipboard/clipboard';
|
|
3
6
|
// Props
|
|
4
7
|
/** Sets a language alias for Highlight.js syntax highlighting. */
|
|
@@ -35,6 +38,8 @@ function onCopyClick() {
|
|
|
35
38
|
copyState = true;
|
|
36
39
|
// prettier-ignore
|
|
37
40
|
setTimeout(() => { copyState = false; }, 2000);
|
|
41
|
+
/** @event {{}} copy - Fires when the Copy button is pressed. */
|
|
42
|
+
dispatch('copy', {});
|
|
38
43
|
}
|
|
39
44
|
// Trigger syntax highlighting if highlight.js is available
|
|
40
45
|
$: if ($storeHighlightJs !== undefined) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script>import { fade, fly } from 'svelte/transition';
|
|
2
|
-
import { onMount } from 'svelte';
|
|
2
|
+
import { createEventDispatcher, onMount } from 'svelte';
|
|
3
|
+
// Event Handler
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
3
5
|
// Actions
|
|
4
6
|
import { focusTrap } from '../../actions/FocusTrap/focusTrap';
|
|
5
7
|
import { drawerStore } from './stores';
|
|
@@ -100,14 +102,16 @@ function percentage(percent, amount) {
|
|
|
100
102
|
return (amount / 100) * percent;
|
|
101
103
|
}
|
|
102
104
|
// Input Handlers
|
|
103
|
-
function
|
|
104
|
-
if (
|
|
105
|
+
function onBackdropInteraction(event) {
|
|
106
|
+
if (event.target === elemBackdrop)
|
|
105
107
|
drawerStore.close();
|
|
108
|
+
/** @event {{ event }} backdrop - Fires on backdrop interaction. */
|
|
109
|
+
dispatch('backdrop', event);
|
|
106
110
|
}
|
|
107
|
-
function onKeydownWindow(
|
|
111
|
+
function onKeydownWindow(event) {
|
|
108
112
|
if (!$drawerStore)
|
|
109
113
|
return;
|
|
110
|
-
if (
|
|
114
|
+
if (event.code === 'Escape')
|
|
111
115
|
drawerStore.close();
|
|
112
116
|
}
|
|
113
117
|
// Lifecycle
|
|
@@ -131,11 +135,8 @@ $: classesDrawer = `${cBaseDrawer} ${classesWidth} ${classesHeight} ${bgDrawer}
|
|
|
131
135
|
class="drawer-backdrop {classesBackdrop}"
|
|
132
136
|
data-testid="drawer-backdrop"
|
|
133
137
|
transition:fade|local={{ duration }}
|
|
134
|
-
on:
|
|
135
|
-
|
|
136
|
-
}}
|
|
137
|
-
on:keydown
|
|
138
|
-
on:keyup
|
|
138
|
+
on:mousedown={onBackdropInteraction}
|
|
139
|
+
on:touchstart={onBackdropInteraction}
|
|
139
140
|
on:keypress
|
|
140
141
|
use:focusTrap={true}
|
|
141
142
|
>
|
|
@@ -4,7 +4,7 @@ export declare const drawerStore: {
|
|
|
4
4
|
set: (this: void, value: DrawerSettings) => void;
|
|
5
5
|
update: (this: void, updater: import("svelte/store").Updater<DrawerSettings>) => void;
|
|
6
6
|
/** Open the drawer. */
|
|
7
|
-
open: (newSettings
|
|
7
|
+
open: (newSettings?: DrawerSettings) => void;
|
|
8
8
|
/** Close the drawer. */
|
|
9
9
|
close: () => void;
|
|
10
10
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<!-- https://tailwindcss.com/docs/dark-mode -->
|
|
2
|
-
<script>import { onMount } from 'svelte';
|
|
2
|
+
<script>import { createEventDispatcher, onMount } from 'svelte';
|
|
3
|
+
// Event Handler
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
3
5
|
// Components
|
|
4
6
|
import SvgIcon from '../../components/SvgIcon/SvgIcon.svelte';
|
|
5
7
|
// Stores
|
|
@@ -24,11 +26,13 @@ function setElemHtmlClass() {
|
|
|
24
26
|
$storeLightSwitch === true ? elemHtmlClassList.add('dark') : elemHtmlClassList.remove('dark');
|
|
25
27
|
}
|
|
26
28
|
// On Click Handler
|
|
27
|
-
function onClick() {
|
|
29
|
+
function onClick(event) {
|
|
28
30
|
// Set the Store Value
|
|
29
31
|
storeLightSwitch.set(($storeLightSwitch = !$storeLightSwitch));
|
|
30
32
|
// Apply to <html> Element
|
|
31
33
|
setElemHtmlClass();
|
|
34
|
+
/** @event {{ event }} click - Fires when the component is clicked. */
|
|
35
|
+
dispatch('click', event);
|
|
32
36
|
}
|
|
33
37
|
// A11y Input Handlers
|
|
34
38
|
function onKeyDown(event) {
|
|
@@ -37,6 +41,8 @@ function onKeyDown(event) {
|
|
|
37
41
|
event.preventDefault();
|
|
38
42
|
event.target.click();
|
|
39
43
|
}
|
|
44
|
+
/** @event {{ event }} keydown - Fires when the component has keydown event. */
|
|
45
|
+
dispatch('keydown', event);
|
|
40
46
|
}
|
|
41
47
|
// Lifecycle
|
|
42
48
|
onMount(() => {
|
|
@@ -54,8 +60,7 @@ $: classesThumb = `${cThumb} ${classesPosition}`;
|
|
|
54
60
|
<!-- prettier-ignore -->
|
|
55
61
|
<div
|
|
56
62
|
class="lightswitch {classesBase}"
|
|
57
|
-
on:click={onClick}
|
|
58
|
-
on:keydown={onKeyDown}
|
|
63
|
+
on:click={onClick} on:keydown={onKeyDown} on:keyup on:keypress
|
|
59
64
|
role="switch"
|
|
60
65
|
aria-label="Light Switch"
|
|
61
66
|
aria-checked={$storeLightSwitch}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
[x: string]:
|
|
4
|
+
[x: string]: never;
|
|
5
5
|
};
|
|
6
6
|
events: {
|
|
7
|
+
keyup: KeyboardEvent;
|
|
8
|
+
keypress: KeyboardEvent;
|
|
9
|
+
click: CustomEvent<any>;
|
|
10
|
+
keydown: CustomEvent<any>;
|
|
11
|
+
} & {
|
|
7
12
|
[evt: string]: CustomEvent<any>;
|
|
8
13
|
};
|
|
9
14
|
slots: {};
|
|
@@ -3,8 +3,10 @@ interface Serializer<T> {
|
|
|
3
3
|
parse(text: string): T;
|
|
4
4
|
stringify(object: T): string;
|
|
5
5
|
}
|
|
6
|
+
type StorageType = 'local' | 'session';
|
|
6
7
|
interface Options<T> {
|
|
7
|
-
serializer
|
|
8
|
+
serializer?: Serializer<T>;
|
|
9
|
+
storage?: StorageType;
|
|
8
10
|
}
|
|
9
11
|
export declare function localStorageStore<T>(key: string, initialValue: T, options?: Options<T>): Writable<T>;
|
|
10
12
|
export {};
|
|
@@ -2,18 +2,23 @@
|
|
|
2
2
|
// https://github.com/joshnuss/svelte-local-storage-store/blob/master/index.ts
|
|
3
3
|
// Represents version v0.3.1 (2022-08-21)
|
|
4
4
|
import { writable as internal, get } from 'svelte/store';
|
|
5
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
6
|
const stores = {};
|
|
7
|
+
function getStorage(type) {
|
|
8
|
+
return type === 'local' ? localStorage : sessionStorage;
|
|
9
|
+
}
|
|
6
10
|
export function localStorageStore(key, initialValue, options) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
11
|
+
const serializer = options?.serializer ?? JSON;
|
|
12
|
+
const storageType = options?.storage ?? 'local';
|
|
13
|
+
const browser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
9
14
|
function updateStorage(key, value) {
|
|
10
15
|
if (!browser)
|
|
11
16
|
return;
|
|
12
|
-
|
|
17
|
+
getStorage(storageType).setItem(key, serializer.stringify(value));
|
|
13
18
|
}
|
|
14
19
|
if (!stores[key]) {
|
|
15
20
|
const store = internal(initialValue, (set) => {
|
|
16
|
-
const json = browser ?
|
|
21
|
+
const json = browser ? getStorage(storageType).getItem(key) : null;
|
|
17
22
|
if (json) {
|
|
18
23
|
set(serializer.parse(json));
|
|
19
24
|
}
|
package/utilities/Menu/menu.js
CHANGED
|
@@ -37,9 +37,9 @@ export function menu(node, args) {
|
|
|
37
37
|
args.state({ menu: args.menu, state });
|
|
38
38
|
};
|
|
39
39
|
// Click Handlers ---
|
|
40
|
-
const
|
|
40
|
+
const toggleMenu = () => {
|
|
41
41
|
// When the node is clicked, open the menu if it is closed, otherwise close it
|
|
42
|
-
if (elemMenu.style.display
|
|
42
|
+
if (elemMenu.style.display != 'block') {
|
|
43
43
|
autoUpdateOrigin();
|
|
44
44
|
menuOpen();
|
|
45
45
|
}
|
|
@@ -52,17 +52,23 @@ export function menu(node, args) {
|
|
|
52
52
|
};
|
|
53
53
|
// Interactive FALSE - any click closes the menu
|
|
54
54
|
const standardClickHandler = (event) => {
|
|
55
|
-
// Any click
|
|
55
|
+
// Any click outside the node closes the menu, but a click inside the node toggles the menu.
|
|
56
56
|
const outsideNode = node && !node.contains(event.target);
|
|
57
57
|
if (outsideNode) {
|
|
58
58
|
menuClose();
|
|
59
59
|
}
|
|
60
|
+
else {
|
|
61
|
+
toggleMenu();
|
|
62
|
+
}
|
|
60
63
|
};
|
|
61
64
|
// Interactive TRUE - clicks outside close menu
|
|
62
65
|
const interactiveClickHandler = (event) => {
|
|
63
66
|
const outsideNode = node && !node.contains(event.target);
|
|
64
67
|
const outsideMenu = elemMenu && !elemMenu.contains(event.target);
|
|
65
|
-
if (outsideNode
|
|
68
|
+
if (!outsideNode) {
|
|
69
|
+
toggleMenu();
|
|
70
|
+
}
|
|
71
|
+
else if (outsideNode && outsideMenu) {
|
|
66
72
|
menuClose();
|
|
67
73
|
}
|
|
68
74
|
};
|
|
@@ -85,7 +91,7 @@ export function menu(node, args) {
|
|
|
85
91
|
if (key === 'Enter' || key === 'Space') {
|
|
86
92
|
event.preventDefault();
|
|
87
93
|
// Toggle menu
|
|
88
|
-
|
|
94
|
+
toggleMenu();
|
|
89
95
|
}
|
|
90
96
|
};
|
|
91
97
|
const onWindowKeyDown = (event) => {
|
|
@@ -128,7 +134,6 @@ export function menu(node, args) {
|
|
|
128
134
|
window.addEventListener('click', onWindowClick, true);
|
|
129
135
|
window.addEventListener('keydown', onWindowKeyDown, true);
|
|
130
136
|
// Trigger Node Events
|
|
131
|
-
node.addEventListener('click', onTriggerClick);
|
|
132
137
|
node.addEventListener('keydown', onTriggerKeyDown);
|
|
133
138
|
node.addEventListener('change', (e) => {
|
|
134
139
|
console.log(e);
|
|
@@ -140,7 +145,6 @@ export function menu(node, args) {
|
|
|
140
145
|
window.removeEventListener('resize', onWindowClick, true);
|
|
141
146
|
window.removeEventListener('click', onWindowClick, true);
|
|
142
147
|
window.removeEventListener('keydown', onWindowKeyDown, true);
|
|
143
|
-
node.removeEventListener('click', onTriggerClick);
|
|
144
148
|
node.removeEventListener('keydown', onTriggerKeyDown);
|
|
145
149
|
}
|
|
146
150
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
<script>import {
|
|
2
|
-
|
|
1
|
+
<script>import { createEventDispatcher } from 'svelte';
|
|
2
|
+
import { fade, fly } from 'svelte/transition';
|
|
3
|
+
// Event Handler
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
3
5
|
import { focusTrap } from '../../actions/FocusTrap/focusTrap';
|
|
4
|
-
// Stores
|
|
5
6
|
import { modalStore } from './stores';
|
|
6
7
|
// Props
|
|
7
8
|
/** The open/close animation duration. Set '0' (zero) to disable. */
|
|
@@ -46,19 +47,30 @@ const cBackdrop = 'fixed top-0 left-0 right-0 bottom-0 z-[999] flex justify-cent
|
|
|
46
47
|
const cModalImage = 'w-full h-auto';
|
|
47
48
|
// Local
|
|
48
49
|
let promptValue;
|
|
50
|
+
const buttonTextDefaults = {
|
|
51
|
+
buttonTextCancel,
|
|
52
|
+
buttonTextConfirm,
|
|
53
|
+
buttonTextSubmit
|
|
54
|
+
};
|
|
49
55
|
// Modal Store Subscription
|
|
50
56
|
modalStore.subscribe((dArr) => {
|
|
51
57
|
if (!dArr.length)
|
|
52
58
|
return;
|
|
53
|
-
// Set
|
|
59
|
+
// Set Prompt input value and type
|
|
54
60
|
promptValue = dArr[0].value;
|
|
61
|
+
// Override button text per instance, if available
|
|
62
|
+
buttonTextCancel = dArr[0].buttonTextCancel || buttonTextDefaults.buttonTextCancel;
|
|
63
|
+
buttonTextConfirm = dArr[0].buttonTextConfirm || buttonTextDefaults.buttonTextConfirm;
|
|
64
|
+
buttonTextSubmit = dArr[0].buttonTextSubmit || buttonTextDefaults.buttonTextSubmit;
|
|
55
65
|
});
|
|
56
66
|
// Event Handlers ---
|
|
57
|
-
function onBackdropInteraction(
|
|
58
|
-
if (!(
|
|
67
|
+
function onBackdropInteraction(event) {
|
|
68
|
+
if (!(event.target instanceof Element))
|
|
59
69
|
return;
|
|
60
|
-
if (
|
|
70
|
+
if (event.target.classList.contains('modal-backdrop'))
|
|
61
71
|
onClose();
|
|
72
|
+
/** @event {{ event }} backdrop - Fires on backdrop interaction. */
|
|
73
|
+
dispatch('backdrop', event);
|
|
62
74
|
}
|
|
63
75
|
function onClose() {
|
|
64
76
|
if ($modalStore[0].response)
|
|
@@ -163,11 +175,11 @@ $: parent = {
|
|
|
163
175
|
</footer>
|
|
164
176
|
{:else if $modalStore[0].type === 'prompt'}
|
|
165
177
|
<!-- Template: Prompt -->
|
|
166
|
-
<input class="modal-prompt-input" type="text" bind:value={promptValue}
|
|
178
|
+
<input class="modal-prompt-input" type="text" bind:value={promptValue} />
|
|
167
179
|
<!-- prettier-ignore -->
|
|
168
180
|
<footer class="modal-footer {regionFooter}">
|
|
169
181
|
<button class="btn {buttonNeutral}" on:click={onClose}>{buttonTextCancel}</button>
|
|
170
|
-
<button class="btn {buttonPositive}" on:click={onPromptSubmit}>{buttonTextSubmit}</button>
|
|
182
|
+
<button class="btn {buttonPositive}" on:click={onPromptSubmit} disabled={!promptValue}>{buttonTextSubmit}</button>
|
|
171
183
|
</footer>
|
|
172
184
|
{:else if $modalStore[0].type === 'component'}
|
|
173
185
|
<!-- Template: Component -->
|
|
@@ -23,4 +23,12 @@ export interface ModalSettings {
|
|
|
23
23
|
response?: (r: any) => void;
|
|
24
24
|
/** Provide abritrary classes to apply to the Modal element. Use `!` for important. */
|
|
25
25
|
classes?: string;
|
|
26
|
+
/** Override the Cancel button label. */
|
|
27
|
+
buttonTextCancel?: string;
|
|
28
|
+
/** Override the Confirm button label. */
|
|
29
|
+
buttonTextConfirm?: string;
|
|
30
|
+
/** Override the Submit button label. */
|
|
31
|
+
buttonTextSubmit?: string;
|
|
32
|
+
/** Pass abitrary data per modal instance. */
|
|
33
|
+
meta?: any;
|
|
26
34
|
}
|
|
@@ -12,11 +12,11 @@ export let max = 3;
|
|
|
12
12
|
export let duration = 150;
|
|
13
13
|
// Props (styles)
|
|
14
14
|
/** Provide classes to set the background color. */
|
|
15
|
-
export let background = 'bg-
|
|
15
|
+
export let background = 'bg-secondary-500';
|
|
16
16
|
/** Provide classes to set width styles. */
|
|
17
17
|
export let width = 'max-w-[640px]';
|
|
18
18
|
/** Provide classes to set the text color. */
|
|
19
|
-
export let color = 'text-on-
|
|
19
|
+
export let color = 'text-on-secondary-token';
|
|
20
20
|
/** Provide classes to set the padding. */
|
|
21
21
|
export let padding = 'p-4';
|
|
22
22
|
/** Provide classes to set the horizontal spacing. */
|
|
@@ -21,8 +21,25 @@ function toastService() {
|
|
|
21
21
|
/** Add a new toast to the queue. */
|
|
22
22
|
trigger: (toast) => update((tStore) => {
|
|
23
23
|
const id = randomUUID();
|
|
24
|
+
// Apply Preset Color Styles
|
|
25
|
+
let classes = toast.classes ?? '';
|
|
26
|
+
// prettier-ignore
|
|
27
|
+
switch (toast.preset) {
|
|
28
|
+
// Success/Error
|
|
29
|
+
case ('success'):
|
|
30
|
+
classes += '!bg-success-500 text-on-success-token';
|
|
31
|
+
break;
|
|
32
|
+
case ('error'):
|
|
33
|
+
classes += '!bg-error-500 text-on-error-token';
|
|
34
|
+
break;
|
|
35
|
+
// Theme
|
|
36
|
+
default:
|
|
37
|
+
classes += `!bg-${toast.preset}-500 text-on-${toast.preset}-token`;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
24
40
|
// Merge into store
|
|
25
|
-
const tMerged = { ...toastDefaults, ...toast, id };
|
|
41
|
+
const tMerged = { ...toastDefaults, ...toast, id, classes };
|
|
42
|
+
console.log(tMerged);
|
|
26
43
|
tStore.push(tMerged);
|
|
27
44
|
// Handle auto-hide, if needed
|
|
28
45
|
handleAutoHide(tMerged);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export interface ToastSettings {
|
|
2
2
|
/** Provide the toast message. Supports HTML. */
|
|
3
3
|
message: string;
|
|
4
|
+
/**
|
|
5
|
+
* Applies a canned set of styles.
|
|
6
|
+
* @type {'primary' | 'secondary' | 'tertiary' | 'warning' | 'success' | 'error'}
|
|
7
|
+
*/
|
|
8
|
+
preset?: 'primary' | 'secondary' | 'tertiary' | 'warning' | 'success' | 'error';
|
|
4
9
|
/** Enables auto-hide after the timeout duration. */
|
|
5
10
|
autohide?: boolean;
|
|
6
11
|
/** Set the auto-hide timeout duration. */
|
package/styles/tokens/misc.css
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* Design Tokens: Misc */
|
|
2
|
-
|
|
3
|
-
@layer utilities {
|
|
4
|
-
/* === Input Accent Color === */
|
|
5
|
-
/* https://developer.mozilla.org/en-US/docs/Web/CSS/accent-color */
|
|
6
|
-
|
|
7
|
-
.accent-primary-token {
|
|
8
|
-
@apply accent-accent-500;
|
|
9
|
-
}
|
|
10
|
-
.accent-accent-token {
|
|
11
|
-
@apply accent-accent-500;
|
|
12
|
-
}
|
|
13
|
-
.accent-tertiary-token {
|
|
14
|
-
@apply accent-accent-500;
|
|
15
|
-
}
|
|
16
|
-
.accent-warning-token {
|
|
17
|
-
@apply accent-accent-500;
|
|
18
|
-
}
|
|
19
|
-
.accent-surface-token {
|
|
20
|
-
@apply accent-accent-500;
|
|
21
|
-
}
|
|
22
|
-
}
|