@skeletonlabs/skeleton 0.86.9 → 0.92.0
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/components/Accordion/AccordionItem.svelte +5 -2
- package/components/ConicGradient/ConicGradient.svelte +1 -1
- package/{tailwind/colors.d.ts → components/ConicGradient/settings.d.ts} +1 -1
- package/{tailwind/colors.js → components/ConicGradient/settings.js} +1 -1
- package/components/FileDropzone/FileDropzone.svelte +1 -4
- package/components/InputChip/InputChip.svelte +107 -0
- package/components/InputChip/InputChip.svelte.d.ts +29 -0
- package/components/ListBox/ListBoxItem.svelte +3 -4
- package/components/SlideToggle/SlideToggle.svelte +1 -1
- package/components/Stepper/Step.svelte +25 -6
- package/components/Stepper/Step.svelte.d.ts +5 -0
- package/components/Stepper/Stepper.svelte +13 -0
- package/components/Stepper/Stepper.svelte.d.ts +2 -0
- package/components/SvgIcon/SvgIcon.svelte +1 -1
- package/components/SvgIcon/icons.js +2 -148
- package/components/Tab/Tab.svelte +1 -1
- package/components/TableOfContents/TableOfContents.svelte +132 -0
- package/components/TableOfContents/TableOfContents.svelte.d.ts +32 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +20 -10
- package/styles/all.css +0 -3
- package/styles/core.css +3 -0
- package/styles/elements/alerts.css +43 -0
- package/styles/elements/badges.css +1 -1
- package/styles/elements/breadcrumbs.css +27 -0
- package/styles/elements/buttons.css +1 -1
- package/styles/elements/cards.css +1 -1
- package/styles/elements/chips.css +58 -7
- package/styles/elements/lists.css +1 -1
- package/styles/elements/logo-clouds.css +1 -1
- package/styles/elements/menus.css +1 -1
- package/styles/elements/placeholders.css +1 -1
- package/styles/elements/tooltips.css +1 -1
- package/styles/elements.css +2 -0
- package/styles/forms.css +57 -39
- package/styles/typography.css +2 -2
- package/tailwind/generated/allComponents.cjs +1 -0
- package/tailwind/generated/allComponents.d.cts +5552 -0
- package/tailwind/settings.cjs +20 -0
- package/tailwind/settings.d.cts +6 -0
- package/tailwind/skeleton.cjs +54 -0
- package/tailwind/skeleton.d.cts +5 -0
- package/tailwind/theme/colors.cjs +18 -0
- package/tailwind/theme/colors.d.cts +2 -0
- package/tailwind/tokens/backgrounds.cjs +40 -0
- package/tailwind/tokens/backgrounds.d.cts +2 -0
- package/tailwind/tokens/border-radius.cjs +21 -0
- package/tailwind/tokens/border-radius.d.cts +33 -0
- package/tailwind/tokens/borders.cjs +20 -0
- package/tailwind/tokens/borders.d.cts +6 -0
- package/tailwind/tokens/fills.cjs +20 -0
- package/tailwind/tokens/fills.d.cts +15 -0
- package/tailwind/tokens/rings.cjs +42 -0
- package/tailwind/tokens/rings.d.cts +17 -0
- package/tailwind/tokens/text.cjs +33 -0
- package/tailwind/tokens/text.d.cts +21 -0
- package/themes/theme-seasonal.css +2 -2
- package/themes/theme-skeleton.css +6 -6
- package/utilities/LightSwitch/LightSwitch.svelte +36 -13
- package/utilities/LightSwitch/stores.d.ts +2 -3
- package/utilities/Modal/Modal.svelte +4 -3
- package/utilities/Modal/types.d.ts +4 -2
- package/utilities/Toast/stores.js +0 -1
- package/styles/tokens/backgrounds.css +0 -329
- package/styles/tokens/border-radius.css +0 -41
- package/styles/tokens/borders.css +0 -253
- package/styles/tokens/fills.css +0 -38
- package/styles/tokens/rings.css +0 -253
- package/styles/tokens/text.css +0 -293
- package/styles/tokens.css +0 -8
- package/tailwind/theme.cjs +0 -39
- package/tailwind/theme.d.cts +0 -5
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Common Shared Settings and Constants
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
colorNames: ['primary', 'secondary', 'tertiary', 'success', 'warning', 'error', 'surface'],
|
|
5
|
+
colorShades: [50, 100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
6
|
+
colorPairings: [
|
|
7
|
+
// forward:
|
|
8
|
+
{ light: 50, dark: 900 },
|
|
9
|
+
{ light: 100, dark: 800 },
|
|
10
|
+
{ light: 200, dark: 700 },
|
|
11
|
+
{ light: 300, dark: 600 },
|
|
12
|
+
{ light: 400, dark: 500 },
|
|
13
|
+
// backwards
|
|
14
|
+
{ light: 900, dark: 50 },
|
|
15
|
+
{ light: 800, dark: 100 },
|
|
16
|
+
{ light: 700, dark: 200 },
|
|
17
|
+
{ light: 600, dark: 300 },
|
|
18
|
+
{ light: 500, dark: 400 },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// The Skeleton Tailwind Plugin
|
|
2
|
+
// Tailwind Docs: https://tailwindcss.com/docs/plugins
|
|
3
|
+
// Skeleton Docs: https://www.skeleton.dev/guides/tailwind
|
|
4
|
+
|
|
5
|
+
const plugin = require('tailwindcss/plugin');
|
|
6
|
+
|
|
7
|
+
// Skeleton Theme Modules
|
|
8
|
+
const themeColors = require('./theme/colors.cjs');
|
|
9
|
+
// Skeleton Design Token Modules
|
|
10
|
+
const tokensBackgrounds = require('./tokens/backgrounds.cjs');
|
|
11
|
+
const tokensBorders = require('./tokens/borders.cjs');
|
|
12
|
+
const tokensBorderRadius = require('./tokens/border-radius.cjs');
|
|
13
|
+
const tokensFills = require('./tokens/fills.cjs');
|
|
14
|
+
const tokensText = require('./tokens/text.cjs');
|
|
15
|
+
const tokensRings = require('./tokens/rings.cjs');
|
|
16
|
+
|
|
17
|
+
module.exports = plugin(
|
|
18
|
+
({ addUtilities, addComponents }) => {
|
|
19
|
+
addUtilities({
|
|
20
|
+
// Implement Skeleton design token classes
|
|
21
|
+
...tokensBackgrounds(),
|
|
22
|
+
...tokensBorders(),
|
|
23
|
+
...tokensBorderRadius(),
|
|
24
|
+
...tokensFills(),
|
|
25
|
+
...tokensText(),
|
|
26
|
+
...tokensRings()
|
|
27
|
+
});
|
|
28
|
+
// The following will generate the non-token classes PURELY for Intellisense.
|
|
29
|
+
// These are excluded from production, which means we still need to lean into
|
|
30
|
+
// using the `all.css` stylesheet to import non-token styles.
|
|
31
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
32
|
+
// try/catch because it will throw when allComponents.cjs isn't generated yet
|
|
33
|
+
try {
|
|
34
|
+
const all = require('./generated/allComponents.cjs');
|
|
35
|
+
// Tokens are already loaded as utilities so we'll delete them to prevent duplicate rules
|
|
36
|
+
for (const [key, _] of Object.entries(all)) {
|
|
37
|
+
if (key.includes('token')) delete all[key];
|
|
38
|
+
}
|
|
39
|
+
addComponents(all, {
|
|
40
|
+
respectImportant: true,
|
|
41
|
+
respectPrefix: true
|
|
42
|
+
});
|
|
43
|
+
} catch { }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
theme: {
|
|
48
|
+
extend: {
|
|
49
|
+
// Implement Skeleton theme colors
|
|
50
|
+
colors: themeColors()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Extends Tailwind with Skeleton theme-specific colors values
|
|
2
|
+
// Doc: https://tailwindcss.com/docs/customizing-colors#using-css-variables
|
|
3
|
+
|
|
4
|
+
const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
// ex: `50: 'rgb(var(--color-primary-50) / <alpha-value>)'`
|
|
7
|
+
function generatePaletteShades(colorName) {
|
|
8
|
+
const shadeObj = {};
|
|
9
|
+
settings.colorShades.forEach(s => shadeObj[s] = `rgb(var(--color-${colorName}-${s}) / <alpha-value>)`);
|
|
10
|
+
return shadeObj;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Generate a a color shade palette 50-900 per each color available
|
|
14
|
+
module.exports = () => {
|
|
15
|
+
const paletteObj = {};
|
|
16
|
+
settings.colorNames.forEach(n => paletteObj[n] = generatePaletteShades(n));
|
|
17
|
+
return paletteObj;
|
|
18
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Design Tokens: Background
|
|
2
|
+
// Doc: https://www.skeleton.dev/elements/tokens
|
|
3
|
+
|
|
4
|
+
const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
// Defaults
|
|
7
|
+
const backdropAlpha = 0.7;
|
|
8
|
+
const hoverAlpha = 0.1;
|
|
9
|
+
|
|
10
|
+
module.exports = () => {
|
|
11
|
+
const classes = {};
|
|
12
|
+
settings.colorNames.forEach(n => {
|
|
13
|
+
|
|
14
|
+
// Backdrops
|
|
15
|
+
// Example: .bg-primary-backdrop-token
|
|
16
|
+
classes[`.bg-${n}-backdrop-token`] = { 'background-color': `rgb(var(--color-${n}-400) / ${backdropAlpha})` };
|
|
17
|
+
classes[`.dark .bg-${n}-backdrop-token`] = { 'background-color': `rgb(var(--color-${n}-900) / ${backdropAlpha})` };
|
|
18
|
+
|
|
19
|
+
// Hover
|
|
20
|
+
// Example: .bg-primary-hover-token
|
|
21
|
+
classes[`.bg-${n}-hover-token:hover`] = { 'background-color': `rgb(var(--color-${n}-500) / ${hoverAlpha})` };
|
|
22
|
+
|
|
23
|
+
// Active
|
|
24
|
+
// Example: .bg-primary-active-token
|
|
25
|
+
classes[`.bg-${n}-active-token`] = {
|
|
26
|
+
'background-color': `rgb(var(--color-${n}-500)) !important`,
|
|
27
|
+
'color': `rgb(var(--on-${n}))`,
|
|
28
|
+
'fill': `rgb(var(--on-${n}))`,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Color Pairings
|
|
32
|
+
// Example: .bg-primary-50-900-token | .bg-primary-900-50-token
|
|
33
|
+
settings.colorPairings.forEach(p => {
|
|
34
|
+
classes[`.bg-${n}-${p.light}-${p.dark}-token`] = { 'background-color': `rgb(var(--color-${n}-${p.light}))` };
|
|
35
|
+
classes[`.dark .bg-${n}-${p.light}-${p.dark}-token`] = { 'background-color': `rgb(var(--color-${n}-${p.dark}))` };
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
});
|
|
39
|
+
return classes;
|
|
40
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Design Tokens: Border Radius
|
|
2
|
+
// Doc: https://www.skeleton.dev/elements/tokens
|
|
3
|
+
|
|
4
|
+
// const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
module.exports = () => {
|
|
7
|
+
return {
|
|
8
|
+
// Base
|
|
9
|
+
'.rounded-token': { 'border-radius': 'var(--theme-rounded-base)' },
|
|
10
|
+
'.rounded-tl-token': { 'border-top-left-radius': 'var(--theme-rounded-base)' },
|
|
11
|
+
'.rounded-tr-token': { 'border-top-right-radius': 'var(--theme-rounded-base)' },
|
|
12
|
+
'.rounded-bl-token': { 'border-bottom-left-radius': 'var(--theme-rounded-base)' },
|
|
13
|
+
'.rounded-br-token': { 'border-bottom-right-radius': 'var(--theme-rounded-base)' },
|
|
14
|
+
// Container
|
|
15
|
+
'.rounded-container-token': { 'border-radius': 'var(--theme-rounded-container)' },
|
|
16
|
+
'.rounded-tl-container-token': { 'border-top-left-radius': 'var(--theme-rounded-container)' },
|
|
17
|
+
'.rounded-tr-container-token': { 'border-top-right-radius': 'var(--theme-rounded-container)' },
|
|
18
|
+
'.rounded-bl-container-token': { 'border-bottom-left-radius': 'var(--theme-rounded-container)' },
|
|
19
|
+
'.rounded-br-container-token': { 'border-bottom-right-radius': 'var(--theme-rounded-container)' },
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare function _exports(): {
|
|
2
|
+
'.rounded-token': {
|
|
3
|
+
'border-radius': string;
|
|
4
|
+
};
|
|
5
|
+
'.rounded-tl-token': {
|
|
6
|
+
'border-top-left-radius': string;
|
|
7
|
+
};
|
|
8
|
+
'.rounded-tr-token': {
|
|
9
|
+
'border-top-right-radius': string;
|
|
10
|
+
};
|
|
11
|
+
'.rounded-bl-token': {
|
|
12
|
+
'border-bottom-left-radius': string;
|
|
13
|
+
};
|
|
14
|
+
'.rounded-br-token': {
|
|
15
|
+
'border-bottom-right-radius': string;
|
|
16
|
+
};
|
|
17
|
+
'.rounded-container-token': {
|
|
18
|
+
'border-radius': string;
|
|
19
|
+
};
|
|
20
|
+
'.rounded-tl-container-token': {
|
|
21
|
+
'border-top-left-radius': string;
|
|
22
|
+
};
|
|
23
|
+
'.rounded-tr-container-token': {
|
|
24
|
+
'border-top-right-radius': string;
|
|
25
|
+
};
|
|
26
|
+
'.rounded-bl-container-token': {
|
|
27
|
+
'border-bottom-left-radius': string;
|
|
28
|
+
};
|
|
29
|
+
'.rounded-br-container-token': {
|
|
30
|
+
'border-bottom-right-radius': string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export = _exports;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Design Tokens: Borders
|
|
2
|
+
// Doc: https://www.skeleton.dev/elements/tokens
|
|
3
|
+
|
|
4
|
+
const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
module.exports = () => {
|
|
7
|
+
const classes = {
|
|
8
|
+
// Border Width - ex: .border-token
|
|
9
|
+
'.border-token': { 'border-width': 'var(--theme-border-base)' }
|
|
10
|
+
};
|
|
11
|
+
settings.colorNames.forEach(n => {
|
|
12
|
+
// Color Pairings
|
|
13
|
+
// Example: .border-primary-50-900-token | .border-primary-900-50-token
|
|
14
|
+
settings.colorPairings.forEach(p => {
|
|
15
|
+
classes[`.border-${n}-${p.light}-${p.dark}-token`] = { 'border-color': `rgb(var(--color-${n}-${p.light}))` };
|
|
16
|
+
classes[`.dark .border-${n}-${p.light}-${p.dark}-token`] = { 'border-color': `rgb(var(--color-${n}-${p.dark}))` };
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return classes;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Design Tokens: SVG Fill
|
|
2
|
+
// Doc: https://www.skeleton.dev/elements/tokens
|
|
3
|
+
|
|
4
|
+
const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
module.exports = () => {
|
|
7
|
+
const classes = {
|
|
8
|
+
'.fill-base-token': { 'fill': 'rgba(var(--theme-font-color-base))' },
|
|
9
|
+
'.fill-dark-token': { 'fill': 'rgba(var(--theme-font-color-dark))' },
|
|
10
|
+
// Fill Token - ex: .fill-token
|
|
11
|
+
'.fill-token': { 'fill': 'rgba(var(--theme-font-color-base))' },
|
|
12
|
+
'.dark .fill-token': { 'fill': 'rgba(var(--theme-font-color-dark))' },
|
|
13
|
+
};
|
|
14
|
+
settings.colorNames.forEach(n => {
|
|
15
|
+
// On-X Fill Colors
|
|
16
|
+
// Example: .fill-on-primary-token
|
|
17
|
+
classes[`.fill-on-${n}-token`] = { 'fill': `rgb(var(--on-${n}))` };
|
|
18
|
+
});
|
|
19
|
+
return classes;
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Design Tokens: Rings
|
|
2
|
+
// Doc: https://www.skeleton.dev/elements/tokens
|
|
3
|
+
|
|
4
|
+
const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
// Local
|
|
7
|
+
const ringOutlineShared = {
|
|
8
|
+
// .ring-[1px]
|
|
9
|
+
'--tw-ring-offset-shadow': 'var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)',
|
|
10
|
+
'--tw-ring-shadow': 'var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)',
|
|
11
|
+
'box-shadow': 'var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)',
|
|
12
|
+
// .ring-inset
|
|
13
|
+
'--tw-ring-inset': 'inset'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = () => {
|
|
17
|
+
const classes = {
|
|
18
|
+
// Ring Outline (for cards)
|
|
19
|
+
// Example: .ring-outline-token
|
|
20
|
+
'.ring-outline-token': {
|
|
21
|
+
...ringOutlineShared,
|
|
22
|
+
'--tw-ring-color': 'rgb(23 23 23 / 0.05);', // neutral-900, 5% opacity
|
|
23
|
+
},
|
|
24
|
+
'.dark .ring-outline-token': {
|
|
25
|
+
...ringOutlineShared,
|
|
26
|
+
'--tw-ring-color': 'rgb(250 250 250 / 0.05)', // neutral-50, 5% opacity
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
settings.colorNames.forEach(n => {
|
|
30
|
+
// Color Pairings
|
|
31
|
+
// Example: .ring-primary-50-900-token | .ring-primary-900-50-token
|
|
32
|
+
settings.colorPairings.forEach(p => {
|
|
33
|
+
classes[`.ring-${n}-${p.light}-${p.dark}-token`] = {
|
|
34
|
+
'--tw-ring-color': `rgb(var(--color-${n}-${p.light}) / 1)`
|
|
35
|
+
};
|
|
36
|
+
classes[`.dark .ring-${n}-${p.light}-${p.dark}-token`] = {
|
|
37
|
+
'--tw-ring-color': `rgb(var(--color-${n}-${p.dark}) / 1)`
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return classes;
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare function _exports(): {
|
|
2
|
+
'.ring-outline-token': {
|
|
3
|
+
'--tw-ring-color': string;
|
|
4
|
+
'--tw-ring-offset-shadow': string;
|
|
5
|
+
'--tw-ring-shadow': string;
|
|
6
|
+
'box-shadow': string;
|
|
7
|
+
'--tw-ring-inset': string;
|
|
8
|
+
};
|
|
9
|
+
'.dark .ring-outline-token': {
|
|
10
|
+
'--tw-ring-color': string;
|
|
11
|
+
'--tw-ring-offset-shadow': string;
|
|
12
|
+
'--tw-ring-shadow': string;
|
|
13
|
+
'box-shadow': string;
|
|
14
|
+
'--tw-ring-inset': string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export = _exports;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Design Tokens: Text
|
|
2
|
+
// Doc: https://www.skeleton.dev/elements/tokens
|
|
3
|
+
|
|
4
|
+
const settings = require('../settings.cjs');
|
|
5
|
+
|
|
6
|
+
module.exports = () => {
|
|
7
|
+
const classes = {
|
|
8
|
+
// Font Family
|
|
9
|
+
'.font-heading-token': { 'font-family': 'var(--theme-font-family-heading)' },
|
|
10
|
+
'.font-token': { 'font-family': 'var(--theme-font-family-base)' },
|
|
11
|
+
// Default Text Colors
|
|
12
|
+
'.text-base-token': { 'color': 'rgba(var(--theme-font-color-base))' },
|
|
13
|
+
'.text-dark-token': { 'color': 'rgba(var(--theme-font-color-dark))' },
|
|
14
|
+
// Light/Dark Text Color - ex: .text-token
|
|
15
|
+
'.text-token': { 'color': 'rgba(var(--theme-font-color-base))' },
|
|
16
|
+
'.dark .text-token': { 'color': 'rgba(var(--theme-font-color-dark))' },
|
|
17
|
+
};
|
|
18
|
+
settings.colorNames.forEach(n => {
|
|
19
|
+
|
|
20
|
+
// On-X Text Colors
|
|
21
|
+
// Example: .text-on-primary-token
|
|
22
|
+
classes[`.text-on-${n}-token`] = { 'color': `rgb(var(--on-${n}))` };
|
|
23
|
+
|
|
24
|
+
// Color Pairings
|
|
25
|
+
// Example: .text-primary-50-900-token | .text-primary-900-50-token
|
|
26
|
+
settings.colorPairings.forEach(p => {
|
|
27
|
+
classes[`.text-${n}-${p.light}-${p.dark}-token`] = { 'color': `rgb(var(--color-${n}-${p.light}))` };
|
|
28
|
+
classes[`.dark .text-${n}-${p.light}-${p.dark}-token`] = { 'color': `rgb(var(--color-${n}-${p.dark}))` };
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
return classes;
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare function _exports(): {
|
|
2
|
+
'.font-heading-token': {
|
|
3
|
+
'font-family': string;
|
|
4
|
+
};
|
|
5
|
+
'.font-token': {
|
|
6
|
+
'font-family': string;
|
|
7
|
+
};
|
|
8
|
+
'.text-base-token': {
|
|
9
|
+
color: string;
|
|
10
|
+
};
|
|
11
|
+
'.text-dark-token': {
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
'.text-token': {
|
|
15
|
+
color: string;
|
|
16
|
+
};
|
|
17
|
+
'.dark .text-token': {
|
|
18
|
+
color: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export = _exports;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
/* A New Years inspired theme. */
|
|
2
|
+
|
|
1
3
|
/* https://fonts.google.com/specimen/Quicksand?query=Quicksand */
|
|
2
4
|
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');
|
|
3
5
|
|
|
4
|
-
/* A New Years inspired theme. */
|
|
5
|
-
|
|
6
6
|
:root {
|
|
7
7
|
/* =~= Theme Properties =~= */
|
|
8
8
|
--theme-font-family-base: system-ui;
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
[data-theme='skeleton'] {
|
|
114
114
|
/* prettier-ignore */
|
|
115
115
|
background-image:
|
|
116
|
-
radial-gradient(at 73% 84%, hsla(213,80%,69%,0.
|
|
117
|
-
radial-gradient(at 16% 79%, hsla(268,79%,73%,0.
|
|
118
|
-
radial-gradient(at 88% 64%, hsla(290,68%,62%,0.
|
|
119
|
-
radial-gradient(at 67% 14%, hsla(167,87%,76%,0.
|
|
120
|
-
radial-gradient(at 70% 75%, hsla(170,71%,68%,0.
|
|
116
|
+
radial-gradient(at 73% 84%, hsla(213,80%,69%,0.30) 0px, transparent 50%),
|
|
117
|
+
radial-gradient(at 16% 79%, hsla(268,79%,73%,0.30) 0px, transparent 50%),
|
|
118
|
+
radial-gradient(at 88% 64%, hsla(290,68%,62%,0.30) 0px, transparent 50%),
|
|
119
|
+
radial-gradient(at 67% 14%, hsla(167,87%,76%,0.30) 0px, transparent 50%),
|
|
120
|
+
radial-gradient(at 70% 75%, hsla(170,71%,68%,0.30) 0px, transparent 50%),
|
|
121
121
|
radial-gradient(at 98% 62%, hsla(244,77%,60%,0.18) 0px, transparent 50%),
|
|
122
|
-
radial-gradient(at 50% 19%, hsla(322,97%,63%,0.
|
|
122
|
+
radial-gradient(at 50% 19%, hsla(322,97%,63%,0.30) 0px, transparent 50%);
|
|
123
123
|
}
|
|
124
124
|
.dark [data-theme='skeleton'] {
|
|
125
125
|
/* prettier-ignore */
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
<script>import { createEventDispatcher, onMount } from 'svelte';
|
|
3
3
|
// Event Handler
|
|
4
4
|
const dispatch = createEventDispatcher();
|
|
5
|
-
// Components
|
|
6
|
-
import SvgIcon from '../../components/SvgIcon/SvgIcon.svelte';
|
|
7
5
|
// Stores
|
|
8
6
|
import { storePrefersDarkScheme, storeLightSwitch } from './stores';
|
|
9
7
|
// Base Classes
|
|
@@ -14,16 +12,27 @@ const cIcon = 'block w-4 h-4';
|
|
|
14
12
|
function setPrefersDarkScheme() {
|
|
15
13
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
16
14
|
storePrefersDarkScheme.set(prefersDark);
|
|
17
|
-
}
|
|
18
|
-
// Toggles a 'dark' class on the <html> element
|
|
19
|
-
function setElemHtmlClass() {
|
|
20
|
-
const elemHtmlClassList = document.documentElement.classList;
|
|
21
15
|
// If $storeLightSwitch not set, match the OS preference
|
|
22
16
|
if ($storeLightSwitch === undefined) {
|
|
23
17
|
$storeLightSwitch = $storePrefersDarkScheme;
|
|
24
18
|
}
|
|
19
|
+
}
|
|
20
|
+
// Toggles a 'dark' class on the <html> element
|
|
21
|
+
function setElemHtmlClass() {
|
|
22
|
+
const elemHtmlClassList = document.documentElement.classList;
|
|
25
23
|
// Update HTML element class
|
|
26
|
-
$storeLightSwitch
|
|
24
|
+
$storeLightSwitch ? elemHtmlClassList.add('dark') : elemHtmlClassList.remove('dark');
|
|
25
|
+
}
|
|
26
|
+
// Sets the color scheme based on localStorage or OS preference in
|
|
27
|
+
// the <head> of the document.
|
|
28
|
+
function setColorScheme() {
|
|
29
|
+
if (localStorage.getItem('storeLightSwitch') === 'true' ||
|
|
30
|
+
(!('storeLightSwitch' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
|
31
|
+
document.documentElement.classList.add('dark');
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
document.documentElement.classList.remove('dark');
|
|
35
|
+
}
|
|
27
36
|
}
|
|
28
37
|
// On Click Handler
|
|
29
38
|
function onClick(event) {
|
|
@@ -39,7 +48,7 @@ function onKeyDown(event) {
|
|
|
39
48
|
// Enter/Space triggers selecton event
|
|
40
49
|
if (['Enter', 'Space'].includes(event.code)) {
|
|
41
50
|
event.preventDefault();
|
|
42
|
-
event.
|
|
51
|
+
event.currentTarget.click();
|
|
43
52
|
}
|
|
44
53
|
/** @event {{ event }} keydown - Fires when the component has keydown event. */
|
|
45
54
|
dispatch('keydown', event);
|
|
@@ -48,8 +57,6 @@ function onKeyDown(event) {
|
|
|
48
57
|
onMount(() => {
|
|
49
58
|
// Determine OS Preference
|
|
50
59
|
setPrefersDarkScheme();
|
|
51
|
-
// Finally, update HTML element class as needed
|
|
52
|
-
setElemHtmlClass();
|
|
53
60
|
});
|
|
54
61
|
// Reactive Classses
|
|
55
62
|
$: classesPosition = $storeLightSwitch ? 'translate-x-full' : 'translate-x-0';
|
|
@@ -57,10 +64,17 @@ $: classesBase = `${cTrack} ${$$props.class ?? ''}`;
|
|
|
57
64
|
$: classesThumb = `${cThumb} ${classesPosition}`;
|
|
58
65
|
</script>
|
|
59
66
|
|
|
67
|
+
<svelte:head>
|
|
68
|
+
{@html `<script>${setColorScheme.toString()} setColorScheme();</script>`}
|
|
69
|
+
</svelte:head>
|
|
70
|
+
|
|
60
71
|
<!-- prettier-ignore -->
|
|
61
72
|
<div
|
|
62
73
|
class="lightswitch {classesBase}"
|
|
63
|
-
on:click={onClick}
|
|
74
|
+
on:click={onClick}
|
|
75
|
+
on:keydown={onKeyDown}
|
|
76
|
+
on:keyup
|
|
77
|
+
on:keypress
|
|
64
78
|
role="switch"
|
|
65
79
|
aria-label="Light Switch"
|
|
66
80
|
aria-checked={$storeLightSwitch}
|
|
@@ -69,7 +83,16 @@ $: classesThumb = `${cThumb} ${classesPosition}`;
|
|
|
69
83
|
>
|
|
70
84
|
<!-- Thumb -->
|
|
71
85
|
<div class="lightswitch-thumb {classesThumb}">
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
{#if $storeLightSwitch === false}
|
|
87
|
+
<!-- Icon Light -->
|
|
88
|
+
<svg class="lightswitch-icon fill-black {cIcon}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
89
|
+
<path d="M361.5 1.2c5 2.1 8.6 6.6 9.6 11.9L391 121l107.9 19.8c5.3 1 9.8 4.6 11.9 9.6s1.5 10.7-1.6 15.2L446.9 256l62.3 90.3c3.1 4.5 3.7 10.2 1.6 15.2s-6.6 8.6-11.9 9.6L391 391 371.1 498.9c-1 5.3-4.6 9.8-9.6 11.9s-10.7 1.5-15.2-1.6L256 446.9l-90.3 62.3c-4.5 3.1-10.2 3.7-15.2 1.6s-8.6-6.6-9.6-11.9L121 391 13.1 371.1c-5.3-1-9.8-4.6-11.9-9.6s-1.5-10.7 1.6-15.2L65.1 256 2.8 165.7c-3.1-4.5-3.7-10.2-1.6-15.2s6.6-8.6 11.9-9.6L121 121 140.9 13.1c1-5.3 4.6-9.8 9.6-11.9s10.7-1.5 15.2 1.6L256 65.1 346.3 2.8c4.5-3.1 10.2-3.7 15.2-1.6zM352 256c0 53-43 96-96 96s-96-43-96-96s43-96 96-96s96 43 96 96zm32 0c0-70.7-57.3-128-128-128s-128 57.3-128 128s57.3 128 128 128s128-57.3 128-128z"/>
|
|
90
|
+
</svg>
|
|
91
|
+
{:else}
|
|
92
|
+
<!-- Icon Dark -->
|
|
93
|
+
<svg class="lightswitch-icon fill-white {cIcon}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">
|
|
94
|
+
<path d="M223.5 32C100 32 0 132.3 0 256S100 480 223.5 480c60.6 0 115.5-24.2 155.8-63.4c5-4.9 6.3-12.5 3.1-18.7s-10.1-9.7-17-8.5c-9.8 1.7-19.8 2.6-30.1 2.6c-96.9 0-175.5-78.8-175.5-176c0-65.8 36-123.1 89.3-153.3c6.1-3.5 9.2-10.5 7.7-17.3s-7.3-11.9-14.3-12.5c-6.3-.5-12.6-.8-19-.8z"/>
|
|
95
|
+
</svg>
|
|
96
|
+
{/if}
|
|
74
97
|
</div>
|
|
75
98
|
</div>
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const storeLightSwitch: Writable<boolean | undefined>;
|
|
1
|
+
export declare const storePrefersDarkScheme: import("svelte/store").Writable<boolean>;
|
|
2
|
+
export declare const storeLightSwitch: import("svelte/store").Writable<boolean | undefined>;
|
|
@@ -44,6 +44,7 @@ export let regionBody = 'max-h-[200px] overflow-hidden';
|
|
|
44
44
|
export let regionFooter = 'flex justify-end space-x-2';
|
|
45
45
|
// Base Styles
|
|
46
46
|
const cBackdrop = 'fixed top-0 left-0 right-0 bottom-0 z-[999] flex justify-center items-center p-4';
|
|
47
|
+
const cModal = 'max-h-full overflow-y-auto overflow-x-hidden';
|
|
47
48
|
const cModalImage = 'w-full h-auto';
|
|
48
49
|
// Local
|
|
49
50
|
let promptValue;
|
|
@@ -96,7 +97,7 @@ function onKeyDown(event) {
|
|
|
96
97
|
}
|
|
97
98
|
// Reactive
|
|
98
99
|
$: classesBackdrop = `${cBackdrop} ${regionBackdrop} ${$$props.class || ''}`;
|
|
99
|
-
$: classesModal = `${background} ${width} ${height} ${padding} ${spacing} ${rounded} ${shadow}`;
|
|
100
|
+
$: classesModal = `${cModal} ${background} ${width} ${height} ${padding} ${spacing} ${rounded} ${shadow}`;
|
|
100
101
|
// IMPORTANT: add values to pass to the children templates.
|
|
101
102
|
// There is a way to self-reference component values, but it involes svelte-internal and is not yet stable.
|
|
102
103
|
// REPL: https://svelte.dev/repl/badd0f11aa99450ca69dca6690d4d5a4?version=3.52.0
|
|
@@ -131,7 +132,7 @@ $: parent = {
|
|
|
131
132
|
{#key $modalStore}
|
|
132
133
|
<!-- Backdrop -->
|
|
133
134
|
<div
|
|
134
|
-
class="modal-backdrop {classesBackdrop}"
|
|
135
|
+
class="modal-backdrop {classesBackdrop} {$modalStore[0].backdropClasses}"
|
|
135
136
|
on:mousedown={onBackdropInteraction}
|
|
136
137
|
on:touchstart={onBackdropInteraction}
|
|
137
138
|
transition:fade={{ duration }}
|
|
@@ -139,7 +140,7 @@ $: parent = {
|
|
|
139
140
|
>
|
|
140
141
|
<!-- Modal -->
|
|
141
142
|
<div
|
|
142
|
-
class="modal {classesModal} {$modalStore[0].
|
|
143
|
+
class="modal {classesModal} {$modalStore[0].modalClasses}"
|
|
143
144
|
transition:fly={{ duration, opacity: 0, y: 100 }}
|
|
144
145
|
use:focusTrap={true}
|
|
145
146
|
data-testid="modal"
|
|
@@ -21,8 +21,10 @@ export interface ModalSettings {
|
|
|
21
21
|
component?: ModalComponent;
|
|
22
22
|
/** Provide a function. Returns the repsonse value. */
|
|
23
23
|
response?: (r: any) => void;
|
|
24
|
-
/** Provide
|
|
25
|
-
|
|
24
|
+
/** Provide abitrary classes to the backdrop. */
|
|
25
|
+
backdropClasses?: string;
|
|
26
|
+
/** Provide abitrary classes to the modal window. */
|
|
27
|
+
modalClasses?: string;
|
|
26
28
|
/** Override the Cancel button label. */
|
|
27
29
|
buttonTextCancel?: string;
|
|
28
30
|
/** Override the Confirm button label. */
|