sk-clib 1.19.0 → 2.0.5
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 +12 -32
- package/dist/index.d.ts +0 -2
- package/dist/index.js +2 -2
- package/dist/theme/index.d.ts +3 -4
- package/dist/theme/index.js +3 -7
- package/dist/theme/logic.d.ts +23 -3
- package/dist/theme/logic.js +74 -71
- package/dist/theme/theme-init/components/theme-init.svelte +9 -20
- package/dist/theme/theme-init/components/theme-init.svelte.d.ts +4 -14
- package/dist/theme/theme.css +162 -0
- package/dist/theme/types.d.ts +4 -15
- package/dist/theme/types.js +9 -10
- package/dist/ui/button/components/button.svelte +3 -3
- package/dist/ui/button/components/button.svelte.d.ts +4 -14
- package/dist/ui/flex/components/flex.svelte +1 -1
- package/dist/ui/flex/components/flex.svelte.d.ts +4 -14
- package/dist/ui/frame/components/frame.svelte +1 -1
- package/dist/ui/frame/components/frame.svelte.d.ts +4 -14
- package/dist/ui/index.d.ts +0 -2
- package/dist/ui/index.js +0 -1
- package/dist/ui/input/components/input.svelte +2 -1
- package/dist/ui/input/components/input.svelte.d.ts +4 -14
- package/dist/ui/spacer/components/spacer.svelte +1 -1
- package/dist/ui/spacer/components/spacer.svelte.d.ts +4 -14
- package/dist/ui/text/components/text.svelte +1 -1
- package/dist/ui/text/components/text.svelte.d.ts +4 -14
- package/dist/{utils.d.ts → utils/classname.d.ts} +0 -9
- package/dist/{utils.js → utils/classname.js} +0 -21
- package/dist/utils/crypto.d.ts +1 -0
- package/dist/utils/crypto.js +3 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/number.d.ts +8 -0
- package/dist/utils/number.js +10 -0
- package/dist/utils/string.d.ts +18 -0
- package/dist/utils/string.js +28 -0
- package/package.json +35 -48
- package/dist/assets/favicon.svg +0 -1
- package/dist/styles.css +0 -1152
- package/dist/ui/header/components/header.svelte +0 -147
- package/dist/ui/header/components/header.svelte.d.ts +0 -52
- package/dist/ui/header/index.d.ts +0 -2
- package/dist/ui/header/index.js +0 -1
- package/dist/ui/header/types.d.ts +0 -31
- package/dist/ui/header/types.js +0 -1
- /package/dist/theme/{stores.svelte.d.ts → state.svelte.d.ts} +0 -0
- /package/dist/theme/{stores.svelte.js → state.svelte.js} +0 -0
package/README.md
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# [sk-clib](https://treltasev.github.io/sk-clib/)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/sk-clib)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A flexible and modular component library built for my SvelteKit projects.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 📦 Installation
|
|
8
8
|
|
|
9
|
-
```
|
|
10
|
-
#
|
|
11
|
-
npx sv create my-app
|
|
9
|
+
```bash
|
|
10
|
+
npm install sk-clib # Install from npmjs
|
|
12
11
|
```
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
```css
|
|
14
|
+
/* app.css */
|
|
15
|
+
@import 'sk-clib/style';
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
# recreate this project
|
|
18
|
-
npx sv@0.15.1 create --template minimal --types ts --add prettier eslint tailwindcss="plugins:none" --no-download-check --install npm .
|
|
17
|
+
/* ... Other Styling ... */
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
##
|
|
20
|
+
## 🔧 Documentation
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
npm run dev
|
|
27
|
-
|
|
28
|
-
# or start the server and open the app in a new browser tab
|
|
29
|
-
npm run dev -- --open
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Building
|
|
33
|
-
|
|
34
|
-
To create a production version of your app:
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
npm run build
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
You can preview the production build with `npm run preview`.
|
|
41
|
-
|
|
42
|
-
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
22
|
+
Take a look at [https://treltasev.github.io/sk-clib/](https://treltasev.github.io/sk-clib/)
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
// Reexport your entry components here
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './logic';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export { theme_state as theme } from './state.svelte';
|
|
2
4
|
export { default as ThemeInit } from './theme-init/components/theme-init.svelte';
|
|
3
|
-
export type { tThemeInitProps } from './theme-init/types';
|
|
4
|
-
export * from "./logic";
|
|
5
|
-
export * from './types.js';
|
package/dist/theme/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
export * from './logic';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export { theme_state as theme } from './state.svelte';
|
|
4
4
|
export { default as ThemeInit } from './theme-init/components/theme-init.svelte';
|
|
5
|
-
// Logic
|
|
6
|
-
export * from "./logic";
|
|
7
|
-
// Types
|
|
8
|
-
export * from './types.js';
|
package/dist/theme/logic.d.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import type { Mode, Variant } from './types
|
|
1
|
+
import type { Mode, Variant } from './types';
|
|
2
|
+
import { DynamicScheme } from '@poupe/material-color-utilities';
|
|
3
|
+
/**
|
|
4
|
+
* Returns a dictionary representation of a generated color pallette given a `seed` `mode` and `contrast`
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @param seed Hex color string like `#ff0000`
|
|
8
|
+
* @param mode Chooses light/dark rendering
|
|
9
|
+
* @param variant Selects the algorithm variant
|
|
10
|
+
* @param contrast is a -1..1 modifier for contrast
|
|
11
|
+
*/
|
|
12
|
+
export declare function build(seed: string, mode?: Mode, variant?: Variant, contrast?: number): DynamicScheme;
|
|
13
|
+
/**
|
|
14
|
+
* Applies a given scheme to the root document element
|
|
15
|
+
*
|
|
16
|
+
* @param scheme Generated scheme that will be applied to the root element
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyScheme(scheme: DynamicScheme): void;
|
|
19
|
+
/**
|
|
20
|
+
* Stores the theme as a string in cookies
|
|
21
|
+
*
|
|
22
|
+
* @param theme JSON object to store
|
|
23
|
+
*/
|
|
2
24
|
export declare function saveTheme(theme: object): void;
|
|
3
|
-
export declare function build(seedHex: string, mode?: Mode, variant?: Variant, contrast?: number): any;
|
|
4
|
-
export declare function applyScheme(scheme: any, color?: string, mode?: string, variant?: string): any;
|
package/dist/theme/logic.js
CHANGED
|
@@ -1,77 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
import { argbFromHex,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
1
|
+
import { snakeOrKebabToCamel, snakeToKebab } from '../utils/string';
|
|
2
|
+
import { argbFromHex, DynamicScheme, Hct, hexFromArgb, SchemeContent, Variant as PVariant, SchemeExpressive, SchemeFidelity, SchemeFruitSalad, SchemeMonochrome, SchemeNeutral, SchemeRainbow, SchemeTonalSpot, SchemeVibrant, DynamicColor } from '@poupe/material-color-utilities';
|
|
3
|
+
// map variant keys to scheme constructor functions
|
|
4
|
+
const VARIANTMAP = {
|
|
5
|
+
content: SchemeContent,
|
|
6
|
+
expressive: SchemeExpressive,
|
|
7
|
+
fidelity: SchemeFidelity,
|
|
8
|
+
'fruit-salad': SchemeFruitSalad,
|
|
9
|
+
monochrome: SchemeMonochrome,
|
|
10
|
+
neutral: SchemeNeutral,
|
|
11
|
+
rainbow: SchemeRainbow,
|
|
12
|
+
'tonal-spot': SchemeTonalSpot,
|
|
13
|
+
vibrant: SchemeVibrant
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Returns a dictionary representation of a generated color pallette given a `seed` `mode` and `contrast`
|
|
17
|
+
*
|
|
18
|
+
*
|
|
19
|
+
* @param seed Hex color string like `#ff0000`
|
|
20
|
+
* @param mode Chooses light/dark rendering
|
|
21
|
+
* @param variant Selects the algorithm variant
|
|
22
|
+
* @param contrast is a -1..1 modifier for contrast
|
|
23
|
+
*/
|
|
24
|
+
export function build(seed, mode = 'dark', variant = 'content', contrast = 0) {
|
|
25
|
+
const source = Hct.fromInt(argbFromHex(seed));
|
|
26
|
+
const isDark = mode == 'dark';
|
|
27
|
+
const SchemeCtor = VARIANTMAP[variant] ?? SchemeContent;
|
|
28
|
+
const schemeRaw = new SchemeCtor(source, isDark, contrast);
|
|
29
|
+
return schemeRaw;
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"--color-on-secondary": scheme.onSecondary,
|
|
37
|
-
"--color-secondary-container": scheme.secondaryContainer,
|
|
38
|
-
"--color-on-secondary-container": scheme.onSecondaryContainer,
|
|
39
|
-
"--color-tertiary": scheme.tertiary,
|
|
40
|
-
"--color-on-tertiary": scheme.onTertiary,
|
|
41
|
-
"--color-tertiary-container": scheme.tertiaryContainer,
|
|
42
|
-
"--color-on-tertiary-container": scheme.onTertiaryContainer,
|
|
43
|
-
"--color-error": scheme.error,
|
|
44
|
-
"--color-on-error": scheme.onError,
|
|
45
|
-
"--color-error-container": scheme.errorContainer,
|
|
46
|
-
"--color-on-error-container": scheme.onErrorContainer,
|
|
47
|
-
"--color-background": scheme.background,
|
|
48
|
-
"--color-on-background": scheme.onBackground,
|
|
49
|
-
"--color-surface": scheme.surface,
|
|
50
|
-
"--color-on-surface": scheme.onSurface,
|
|
51
|
-
"--color-surface-variant": scheme.surfaceVariant,
|
|
52
|
-
"--color-on-surface-variant": scheme.onSurfaceVariant,
|
|
53
|
-
"--color-outline": scheme.outline,
|
|
54
|
-
"--color-outline-variant": scheme.outlineVariant,
|
|
55
|
-
"--color-shadow": scheme.shadow,
|
|
56
|
-
"--color-scrim": scheme.scrim,
|
|
57
|
-
"--color-inverse-surface": scheme.inverseSurface,
|
|
58
|
-
"--color-inverse-on-surface": scheme.inverseOnSurface,
|
|
59
|
-
"--color-inverse-primary": scheme.inversePrimary
|
|
60
|
-
};
|
|
61
|
-
let out = {};
|
|
31
|
+
/**
|
|
32
|
+
* Applies a given scheme to the root document element
|
|
33
|
+
*
|
|
34
|
+
* @param scheme Generated scheme that will be applied to the root element
|
|
35
|
+
*/
|
|
36
|
+
export function applyScheme(scheme) {
|
|
37
|
+
const mode = scheme.isDark ? 'dark' : 'light';
|
|
38
|
+
const variant = Object.values(PVariant)[scheme.variant].toString().toLowerCase();
|
|
62
39
|
const root = document.documentElement;
|
|
63
|
-
for
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
40
|
+
// Apply missing colors that library for some reason doesn't cover @material-color-utilities#199
|
|
41
|
+
const missingColors = [
|
|
42
|
+
"shadow",
|
|
43
|
+
"scrim",
|
|
44
|
+
"surfaceVariant",
|
|
45
|
+
"surfaceTint",
|
|
46
|
+
"primaryPaletteKeyColor",
|
|
47
|
+
"secondaryPaletteKeyColor",
|
|
48
|
+
"tertiaryPaletteKeyColor",
|
|
49
|
+
"neutralPaletteKeyColor",
|
|
50
|
+
"neutralVariantPaletteKeyColor"
|
|
51
|
+
];
|
|
52
|
+
// Set the color properties
|
|
53
|
+
const allColors = [...scheme.colors.allColors, ...missingColors];
|
|
54
|
+
allColors.forEach((dynamicColor) => {
|
|
55
|
+
const colorName = typeof dynamicColor === 'string' ? dynamicColor : dynamicColor.name;
|
|
56
|
+
console.log(colorName);
|
|
57
|
+
const prop = snakeOrKebabToCamel(colorName);
|
|
58
|
+
const value = scheme[prop];
|
|
59
|
+
root.style.setProperty(`--md-${snakeToKebab(colorName)}`, hexFromArgb(value));
|
|
60
|
+
});
|
|
67
61
|
const conf_out = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
'--md-seed': hexFromArgb(scheme.sourceColorArgb),
|
|
63
|
+
'--md-mode': mode,
|
|
64
|
+
'--md-variant': variant
|
|
71
65
|
};
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
// Set the config properties
|
|
67
|
+
for (const [key, value] of Object.entries(conf_out)) {
|
|
68
|
+
root.style.setProperty(key, value);
|
|
74
69
|
}
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Stores the theme as a string in cookies
|
|
73
|
+
*
|
|
74
|
+
* @param theme JSON object to store
|
|
75
|
+
*/
|
|
76
|
+
export function saveTheme(theme) {
|
|
77
|
+
const expires = new Date();
|
|
78
|
+
expires.setFullYear(expires.getFullYear() + 10);
|
|
79
|
+
document.cookie = `md-theme=${JSON.stringify(theme)}; expires=${expires.toUTCString()}; path=/`;
|
|
77
80
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
// --- Logic ---
|
|
3
|
-
import { cn } from '../../../utils';
|
|
3
|
+
import { cn } from '../../../utils/classname';
|
|
4
4
|
import type { Props } from '..';
|
|
5
5
|
import { onMount } from 'svelte';
|
|
6
6
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
// === State ===
|
|
10
10
|
import { theme, build, applyScheme, saveTheme } from '../..';
|
|
11
|
+
import { parse } from 'svelte/compiler';
|
|
11
12
|
|
|
12
13
|
const {
|
|
13
14
|
defaults = {
|
|
@@ -17,24 +18,6 @@
|
|
|
17
18
|
}
|
|
18
19
|
}: Props = $props();
|
|
19
20
|
|
|
20
|
-
/**
|
|
21
|
-
* Checks if the user already has a set md-theme
|
|
22
|
-
*/
|
|
23
|
-
function hasTheme() {
|
|
24
|
-
const match = document.cookie.match(/(?:^|;\s*)md-theme=([^;]*)/);
|
|
25
|
-
return match ? true : false;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Returns a fallback value if designated value is undefined
|
|
30
|
-
* @param value Value to return normally
|
|
31
|
-
* @param _default default if value is undefined
|
|
32
|
-
*/
|
|
33
|
-
function fallback(value: any, _default: any) {
|
|
34
|
-
return value === undefined ? _default : value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
21
|
$effect.pre(() => {
|
|
39
22
|
let mode = Cookie.get("theme.mode") || defaults.defaultMode
|
|
40
23
|
let variant = Cookie.get("theme.variant") || defaults.defaultVariant
|
|
@@ -71,7 +54,13 @@
|
|
|
71
54
|
*/
|
|
72
55
|
function getTheme() {
|
|
73
56
|
const match = document.cookie.match(/(?:^|;\s*)md-theme=([^;]*)/);
|
|
74
|
-
|
|
57
|
+
|
|
58
|
+
let parsed = undefined;
|
|
59
|
+
try {
|
|
60
|
+
parsed = JSON.parse(decodeURIComponent(match[1]))
|
|
61
|
+
} catch {/* Do Nothing */}
|
|
62
|
+
|
|
63
|
+
return parsed ? parsed : undefined;
|
|
75
64
|
}
|
|
76
65
|
|
|
77
66
|
/**
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: Record<string, never>;
|
|
4
|
-
events: {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
export type ThemeInitProps = typeof __propDef.props;
|
|
10
|
-
export type ThemeInitEvents = typeof __propDef.events;
|
|
11
|
-
export type ThemeInitSlots = typeof __propDef.slots;
|
|
1
|
+
import type { Props } from '..';
|
|
12
2
|
/**
|
|
13
3
|
* ---
|
|
14
4
|
* name: ThemeInit
|
|
@@ -18,6 +8,6 @@ export type ThemeInitSlots = typeof __propDef.slots;
|
|
|
18
8
|
*
|
|
19
9
|
* Used to initialize the theme within your projects
|
|
20
10
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export
|
|
11
|
+
declare const ThemeInit: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type ThemeInit = ReturnType<typeof ThemeInit>;
|
|
13
|
+
export default ThemeInit;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/* ! ========== Theme ========= */
|
|
5
|
+
@theme {
|
|
6
|
+
/* Palettes [PA] */
|
|
7
|
+
--color-primary-palette-key-color: var(--md-primary-palette-key-color);
|
|
8
|
+
--color-secondary-palette-key-color: var(--md-secondary-palette-key-color);
|
|
9
|
+
--color-tertiary-palette-key-color: var(--md-tertiary-palette-key-color);
|
|
10
|
+
--color-neutral-palette-key-color: var(--md-neutral-palette-key-color);
|
|
11
|
+
--color-neutral-variant-palette-key-color: var(--md-neutral-variant-palette-key-color);
|
|
12
|
+
|
|
13
|
+
/* Surfaces [S] */
|
|
14
|
+
--color-background: var(--md-background);
|
|
15
|
+
--color-on-background: var(--md-on-background);
|
|
16
|
+
--color-surface: var(--md-surface);
|
|
17
|
+
--color-surface-dim: var(--md-surface-dim);
|
|
18
|
+
--color-surface-bright: var(--md-surface-bright);
|
|
19
|
+
--color-surface-container-lowest: var(--md-surface-container-lowest);
|
|
20
|
+
--color-surface-container-low: var(--md-surface-container-low);
|
|
21
|
+
--color-surface-container: var(--md-surface-container);
|
|
22
|
+
--color-surface-container-high: var(--md-surface-container-high);
|
|
23
|
+
--color-surface-container-highest: var(--md-surface-container-highest);
|
|
24
|
+
--color-on-surface: var(--md-on-surface);
|
|
25
|
+
--color-on-surface-variant: var(--md-on-surface-variant);
|
|
26
|
+
--color-outline: var(--md-outline);
|
|
27
|
+
--color-outline-variant: var(--md-outline-variant);
|
|
28
|
+
--color-inverse-surface: var(--md-inverse-surface);
|
|
29
|
+
--color-inverse-on-surface: var(--md-inverse-on-surface);
|
|
30
|
+
--color-shadow: var(--md-shadow);
|
|
31
|
+
--color-scrim: var(--md-shadow);
|
|
32
|
+
--color-surface-variant: var(--md-surface-variant);
|
|
33
|
+
--color-surface-tint: var(--md-surface-tint);
|
|
34
|
+
|
|
35
|
+
/* Primaries [P] */
|
|
36
|
+
--color-primary: var(--md-primary);
|
|
37
|
+
--color-primary-dim: var(--md-primary-dim);
|
|
38
|
+
--color-on-primary: var(--md-on-primary);
|
|
39
|
+
--color-primary-container: var(--md-primary-container);
|
|
40
|
+
--color-on-primary-container: var(--md-on-primary-container);
|
|
41
|
+
--color-primary-fixed: var(--md-primary-fixed);
|
|
42
|
+
--color-primary-fixed-dim: var(--md-primary-fixed-dim);
|
|
43
|
+
--color-on-primary-fixed: var(--md-on-primary-fixed);
|
|
44
|
+
--color-on-primary-fixed-variant: var(--md-on-primary-fixed-variant);
|
|
45
|
+
--color-inverse-primary: var(--md-inverse-primary);
|
|
46
|
+
|
|
47
|
+
/* Secondaries [S] */
|
|
48
|
+
--color-secondary: var(--md-secondary);
|
|
49
|
+
--color-secondary-dim: var(--md-secondary-dim);
|
|
50
|
+
--color-on-secondary: var(--md-on-secondary);
|
|
51
|
+
--color-secondary-container: var(--md-secondary-container);
|
|
52
|
+
--color-on-secondary-container: var(--md-on-secondary-container);
|
|
53
|
+
--color-secondary-fixed: var(--md-secondary-fixed);
|
|
54
|
+
--color-secondary-fixed-dim: var(--md-secondary-fixed-dim);
|
|
55
|
+
--color-on-secondary-fixed: var(--md-on-secondary-fixed);
|
|
56
|
+
--color-on-secondary-fixed-variant: var(--md-on-secondary-fixed-variant);
|
|
57
|
+
|
|
58
|
+
/* Tertiaries [T] */
|
|
59
|
+
--color-tertiary: var(--md-tertiary);
|
|
60
|
+
--color-tertiary-dim: var(--md-tertiary-dim);
|
|
61
|
+
--color-on-tertiary: var(--md-on-tertiary);
|
|
62
|
+
--color-tertiary-container: var(--md-tertiary-container);
|
|
63
|
+
--color-on-tertiary-container: var(--md-on-tertiary-container);
|
|
64
|
+
--color-tertiary-fixed: var(--md-tertiary-fixed);
|
|
65
|
+
--color-tertiary-fixed-dim: var(--md-tertiary-fixed-dim);
|
|
66
|
+
--color-on-tertiary-fixed: var(--md-on-tertiary-fixed);
|
|
67
|
+
--color-on-tertiary-fixed-variant: var(--md-on-tertiary-fixed-variant);
|
|
68
|
+
|
|
69
|
+
/* Errors [E] */
|
|
70
|
+
--color-error: var(--md-error);
|
|
71
|
+
--color-error-dim: var(--md-error-dim);
|
|
72
|
+
--color-on-error: var(--md-on-error);
|
|
73
|
+
--color-error-container: var(--md-error-container);
|
|
74
|
+
--color-on-error-container: var(--md-on-error-container);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
/* ! ========== Components ========= */
|
|
79
|
+
@layer components {
|
|
80
|
+
/* Surfaces [S] */
|
|
81
|
+
.surface-background {
|
|
82
|
+
@apply bg-background text-on-background;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.surface {
|
|
86
|
+
@apply bg-surface text-on-surface;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.surface-variant {
|
|
90
|
+
@apply bg-surface-variant text-on-surface-variant;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Primaries [P] */
|
|
94
|
+
.surface-primary {
|
|
95
|
+
@apply bg-primary text-on-primary;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.surface-primary-container {
|
|
99
|
+
@apply bg-primary-container text-on-primary-container;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.surface-primary-fixed {
|
|
103
|
+
@apply bg-primary-fixed text-on-primary-fixed;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.surface-primary-fixed-variant {
|
|
107
|
+
@apply bg-primary-fixed-dim text-on-primary-fixed-variant;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* Secondaries [S] */
|
|
111
|
+
.surface-secondary {
|
|
112
|
+
@apply bg-secondary text-on-secondary;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.surface-secondary-container {
|
|
116
|
+
@apply bg-secondary-container text-on-secondary-container;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.surface-secondary-fixed {
|
|
120
|
+
@apply bg-secondary-fixed text-on-secondary-fixed;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.surface-secondary-fixed-variant {
|
|
124
|
+
@apply bg-secondary-fixed-dim text-on-secondary-fixed-variant;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Tertiaries [T] */
|
|
128
|
+
.surface-tertiary {
|
|
129
|
+
@apply bg-tertiary text-on-tertiary;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.surface-tertiary-container {
|
|
133
|
+
@apply bg-tertiary-container text-on-tertiary-container;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.surface-tertiary-fixed {
|
|
137
|
+
@apply bg-tertiary-fixed text-on-tertiary-fixed;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.surface-tertiary-fixed-variant {
|
|
141
|
+
@apply bg-tertiary-fixed-dim text-on-tertiary-fixed-variant;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Errors [E] */
|
|
145
|
+
.surface-error {
|
|
146
|
+
@apply bg-error text-on-error;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.surface-error-container {
|
|
150
|
+
@apply bg-error-container text-on-error-container;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* ! ========== Base ========== */
|
|
155
|
+
@layer base {
|
|
156
|
+
html,
|
|
157
|
+
body {
|
|
158
|
+
@apply size-full;
|
|
159
|
+
margin: 0;
|
|
160
|
+
padding: 0;
|
|
161
|
+
}
|
|
162
|
+
}
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
export declare const MODES: readonly [
|
|
2
|
-
export type Mode =
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
'content',
|
|
6
|
-
'expressive',
|
|
7
|
-
'fidelity',
|
|
8
|
-
'fruit-salad',
|
|
9
|
-
'monochrome',
|
|
10
|
-
'neutral',
|
|
11
|
-
'rainbow',
|
|
12
|
-
'tonal-spot',
|
|
13
|
-
'vibrant'
|
|
14
|
-
];
|
|
15
|
-
export type Variant = string | (typeof VARIANTS)[number];
|
|
1
|
+
export declare const MODES: readonly ["light", "dark"];
|
|
2
|
+
export type Mode = (typeof MODES)[number];
|
|
3
|
+
export declare const VARIANTS: readonly ["content", "expressive", "fidelity", "fruit-salad", "monochrome", "neutral", "rainbow", "tonal-spot", "vibrant"];
|
|
4
|
+
export type Variant = (typeof VARIANTS)[number];
|
package/dist/theme/types.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export const MODES = ['light', 'dark'];
|
|
2
|
-
|
|
3
2
|
export const VARIANTS = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
'content',
|
|
4
|
+
'expressive',
|
|
5
|
+
'fidelity',
|
|
6
|
+
'fruit-salad',
|
|
7
|
+
'monochrome',
|
|
8
|
+
'neutral',
|
|
9
|
+
'rainbow',
|
|
10
|
+
'tonal-spot',
|
|
11
|
+
'vibrant'
|
|
13
12
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
// --- Logic ---
|
|
3
|
-
import { cn } from '../../../utils';
|
|
3
|
+
import { cn } from '../../../utils/classname';
|
|
4
4
|
import type { Props } from '..';
|
|
5
5
|
|
|
6
6
|
let { children, class: className = $bindable(undefined), buttonClass = $bindable('px-4 py-2 rounded-md bg-[var(--color-primary)] color-[var(--color-white)] w-fit'), href, ...rest }: Props = $props();
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
asd
|
|
16
16
|
|
|
17
17
|
{#if href}
|
|
18
|
-
<a {href} class={cn(buttonCls)} {...rest} tabindex="0">
|
|
18
|
+
<a {href} class={cn(buttonCls)} {...(rest as any)} tabindex="0">
|
|
19
19
|
{@render children?.()}
|
|
20
20
|
</a>
|
|
21
21
|
{:else}
|
|
22
|
-
<button class={cn(buttonCls)} {...rest} tabindex="0">
|
|
22
|
+
<button class={cn(buttonCls)} {...(rest as any)} tabindex="0">
|
|
23
23
|
{@render children?.()}
|
|
24
24
|
</button>
|
|
25
25
|
{/if}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: Record<string, never>;
|
|
4
|
-
events: {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
export type ButtonProps = typeof __propDef.props;
|
|
10
|
-
export type ButtonEvents = typeof __propDef.events;
|
|
11
|
-
export type ButtonSlots = typeof __propDef.slots;
|
|
1
|
+
import type { Props } from '..';
|
|
12
2
|
/**
|
|
13
3
|
* Generated by SvelteForge🔥
|
|
14
4
|
*
|
|
@@ -16,6 +6,6 @@ export type ButtonSlots = typeof __propDef.slots;
|
|
|
16
6
|
* Simple button component for easy customization and easy onclick functionality
|
|
17
7
|
* Button is easily configured, colored, and will also abide to WCAG standards.
|
|
18
8
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export
|
|
9
|
+
declare const Button: import("svelte").Component<Props, {}, "class" | "buttonClass">;
|
|
10
|
+
type Button = ReturnType<typeof Button>;
|
|
11
|
+
export default Button;
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: Record<string, never>;
|
|
4
|
-
events: {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
};
|
|
7
|
-
slots: {};
|
|
8
|
-
};
|
|
9
|
-
export type FlexProps = typeof __propDef.props;
|
|
10
|
-
export type FlexEvents = typeof __propDef.events;
|
|
11
|
-
export type FlexSlots = typeof __propDef.slots;
|
|
1
|
+
import type { Props } from "..";
|
|
12
2
|
/**
|
|
13
3
|
* Generated by SvelteForge🔥
|
|
14
4
|
*
|
|
15
5
|
* # Flex Component
|
|
16
6
|
* Wrapper component for Frame with the flex attribute passed
|
|
17
7
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
8
|
+
declare const Flex: import("svelte").Component<Props, {}, "class">;
|
|
9
|
+
type Flex = ReturnType<typeof Flex>;
|
|
10
|
+
export default Flex;
|