sk-clib 1.18.9 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +12 -32
  2. package/dist/index.d.ts +0 -0
  3. package/dist/index.js +2 -0
  4. package/dist/theme/index.d.ts +4 -0
  5. package/dist/theme/index.js +4 -0
  6. package/dist/theme/logic.d.ts +24 -0
  7. package/dist/theme/logic.js +80 -0
  8. package/dist/theme/state.svelte.d.ts +24 -0
  9. package/dist/theme/state.svelte.js +33 -0
  10. package/dist/theme/theme-init/components/theme-init.svelte +85 -0
  11. package/dist/theme/theme-init/components/theme-init.svelte.d.ts +13 -0
  12. package/dist/theme/theme-init/index.d.ts +2 -0
  13. package/dist/theme/theme-init/index.js +1 -0
  14. package/dist/theme/theme-init/types.d.ts +15 -0
  15. package/dist/theme/theme-init/types.js +1 -0
  16. package/dist/theme/theme.css +162 -0
  17. package/dist/theme/types.d.ts +4 -0
  18. package/dist/theme/types.js +12 -0
  19. package/dist/ui/button/components/button.svelte +33 -0
  20. package/dist/ui/button/components/button.svelte.d.ts +11 -0
  21. package/dist/ui/button/index.d.ts +2 -0
  22. package/dist/ui/button/index.js +1 -0
  23. package/dist/ui/button/types.d.ts +5 -0
  24. package/dist/ui/button/types.js +1 -0
  25. package/dist/ui/flex/components/flex.svelte +28 -0
  26. package/dist/ui/flex/components/flex.svelte.d.ts +10 -0
  27. package/dist/ui/flex/index.d.ts +2 -0
  28. package/dist/ui/flex/index.js +1 -0
  29. package/dist/ui/flex/types.d.ts +2 -0
  30. package/dist/ui/flex/types.js +1 -0
  31. package/dist/ui/frame/components/frame.svelte +133 -0
  32. package/dist/ui/frame/components/frame.svelte.d.ts +22 -0
  33. package/dist/ui/frame/index.d.ts +2 -0
  34. package/dist/ui/frame/index.js +1 -0
  35. package/dist/ui/frame/types.d.ts +33 -0
  36. package/dist/ui/frame/types.js +1 -0
  37. package/dist/ui/index.d.ts +12 -0
  38. package/dist/ui/index.js +9 -0
  39. package/dist/ui/input/components/input.svelte +75 -0
  40. package/dist/ui/input/components/input.svelte.d.ts +10 -0
  41. package/dist/ui/input/index.d.ts +2 -0
  42. package/dist/ui/input/index.js +1 -0
  43. package/dist/ui/input/types.d.ts +6 -0
  44. package/dist/ui/input/types.js +1 -0
  45. package/dist/ui/spacer/components/spacer.svelte +50 -0
  46. package/dist/ui/spacer/components/spacer.svelte.d.ts +17 -0
  47. package/dist/ui/spacer/index.d.ts +2 -0
  48. package/dist/ui/spacer/index.js +1 -0
  49. package/dist/ui/spacer/types.d.ts +7 -0
  50. package/dist/ui/spacer/types.js +1 -0
  51. package/dist/ui/text/components/text.svelte +90 -0
  52. package/dist/ui/text/components/text.svelte.d.ts +5 -0
  53. package/dist/ui/text/index.d.ts +2 -0
  54. package/dist/ui/text/index.js +1 -0
  55. package/dist/ui/text/types.d.ts +34 -0
  56. package/dist/ui/text/types.js +25 -0
  57. package/dist/utils/classname.d.ts +72 -0
  58. package/dist/utils/classname.js +107 -0
  59. package/dist/utils/crypto.d.ts +1 -0
  60. package/dist/utils/crypto.js +3 -0
  61. package/dist/utils/index.d.ts +3 -0
  62. package/dist/utils/index.js +3 -0
  63. package/dist/utils/number.d.ts +8 -0
  64. package/dist/utils/number.js +10 -0
  65. package/dist/utils/string.d.ts +18 -0
  66. package/dist/utils/string.js +28 -0
  67. package/package.json +32 -38
package/README.md CHANGED
@@ -1,42 +1,22 @@
1
- # sv
1
+ # [sk-clib](https://treltasev.github.io/sk-clib/)
2
2
 
3
- Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
3
+ [![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/sk-clib)
4
4
 
5
- ## Creating a project
5
+ A flexible and modular component library built for my SvelteKit projects.
6
6
 
7
- If you're seeing this, you've probably already done this step. Congrats!
7
+ ## 📦 Installation
8
8
 
9
- ```sh
10
- # create a new project
11
- npx sv create my-app
9
+ ```bash
10
+ npm install sk-clib # Install from npmjs
12
11
  ```
13
12
 
14
- To recreate this project with the same configuration:
13
+ ```css
14
+ /* app.css */
15
+ @import 'sk-clib/style';
15
16
 
16
- ```sh
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
- ## Developing
20
+ ## 🔧 Documentation
22
21
 
23
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
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/)
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ // Reexport your entry components here
@@ -0,0 +1,4 @@
1
+ export * from './logic';
2
+ export * from './types';
3
+ export { theme_state as theme } from './state.svelte';
4
+ export { default as ThemeInit } from './theme-init/components/theme-init.svelte';
@@ -0,0 +1,4 @@
1
+ export * from './logic';
2
+ export * from './types';
3
+ export { theme_state as theme } from './state.svelte';
4
+ export { default as ThemeInit } from './theme-init/components/theme-init.svelte';
@@ -0,0 +1,24 @@
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
+ */
24
+ export declare function saveTheme(theme: object): void;
@@ -0,0 +1,80 @@
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;
30
+ }
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();
39
+ const root = document.documentElement;
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
+ });
61
+ const conf_out = {
62
+ '--md-seed': hexFromArgb(scheme.sourceColorArgb),
63
+ '--md-mode': mode,
64
+ '--md-variant': variant
65
+ };
66
+ // Set the config properties
67
+ for (const [key, value] of Object.entries(conf_out)) {
68
+ root.style.setProperty(key, value);
69
+ }
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=/`;
80
+ }
@@ -0,0 +1,24 @@
1
+ export const theme_state: ThemeState;
2
+ /**
3
+ * Class representing the current state of the theme
4
+ *
5
+ * If either `mode`, `variant` or `seedColor` are updated, the whole theme will refresh
6
+ */
7
+ declare class ThemeState {
8
+ /**
9
+ * Current mode of the theme, either light or dark
10
+ * @type {"dark"|"light"|undefined}
11
+ */
12
+ mode: "dark" | "light" | undefined;
13
+ /**
14
+ * Variant of the theme, Changes the look and feel of the used colors
15
+ * @type {"content"|"expressive"|"fidelity"|"fruit-salad"|"monochrome"|"neutral"|"rainbow"|"tonal-spot"|"vibrant"|undefined}
16
+ */
17
+ variant: "content" | "expressive" | "fidelity" | "fruit-salad" | "monochrome" | "neutral" | "rainbow" | "tonal-spot" | "vibrant" | undefined;
18
+ /**
19
+ * Main color used to generate the theme.
20
+ * @type {string|undefined}
21
+ */
22
+ seedColor: string | undefined;
23
+ }
24
+ export {};
@@ -0,0 +1,33 @@
1
+
2
+
3
+
4
+ /**
5
+ * Class representing the current state of the theme
6
+ *
7
+ * If either `mode`, `variant` or `seedColor` are updated, the whole theme will refresh
8
+ */
9
+ class ThemeState {
10
+
11
+ /**
12
+ * Current mode of the theme, either light or dark
13
+ * @type {"dark"|"light"|undefined}
14
+ */
15
+ mode = $state(undefined)
16
+
17
+ /**
18
+ * Variant of the theme, Changes the look and feel of the used colors
19
+ * @type {"content"|"expressive"|"fidelity"|"fruit-salad"|"monochrome"|"neutral"|"rainbow"|"tonal-spot"|"vibrant"|undefined}
20
+ */
21
+ variant = $state(undefined)
22
+
23
+ /**
24
+ * Main color used to generate the theme.
25
+ * @type {string|undefined}
26
+ */
27
+ seedColor = $state(undefined)
28
+ }
29
+
30
+ const theme_state = new ThemeState();
31
+
32
+ export { theme_state }
33
+
@@ -0,0 +1,85 @@
1
+ <script lang="ts">
2
+ // --- Logic ---
3
+ import { cn } from '../../../utils/classname';
4
+ import type { Props } from '..';
5
+ import { onMount } from 'svelte';
6
+
7
+ import Cookie from "js-cookie";
8
+
9
+ // === State ===
10
+ import { theme, build, applyScheme, saveTheme } from '../..';
11
+
12
+ const {
13
+ defaults = {
14
+ defaultMode: 'dark',
15
+ defaultVariant: 'vibrant',
16
+ defaultSeedColor: '#f8b518'
17
+ }
18
+ }: Props = $props();
19
+
20
+ $effect.pre(() => {
21
+ let mode = Cookie.get("theme.mode") || defaults.defaultMode
22
+ let variant = Cookie.get("theme.variant") || defaults.defaultVariant
23
+ let color = Cookie.get("theme.color") || defaults.defaultSeedColor
24
+
25
+ theme.seedColor = color
26
+ theme.mode = mode
27
+ theme.variant = variant
28
+ })
29
+
30
+ $effect(() => {Cookie.set("theme.mode", theme.mode)})
31
+ $effect(() => {Cookie.set("theme.variant", theme.variant)})
32
+ $effect(() => {Cookie.set("theme.color", theme.seedColor)})
33
+
34
+ // Whenever any state changes, refresh theme
35
+ $effect(() => {
36
+ // Build the theme with material utilities
37
+ const built = build(theme.seedColor, theme.mode, theme.variant);
38
+
39
+ // Create css variables object and save to body
40
+ let applied = applyScheme(built, theme.seedColor, theme.mode, theme.variant);
41
+
42
+ // Save the theme to the user's cookies
43
+ saveTheme(applied);
44
+ });
45
+ </script>
46
+
47
+ <svelte:head>
48
+ <!-- ============== Theme Script ============== -->
49
+ <script>
50
+ /**
51
+ * Attempts to get the current theme stored in the user's cookies, returns it, otherwise undefined
52
+ * @return {Object|undefined} The theme or undefined
53
+ */
54
+ function getTheme() {
55
+ const match = document.cookie.match(/(?:^|;\s*)md-theme=([^;]*)/);
56
+ return match ? JSON.parse(decodeURIComponent(match[1])) : undefined;
57
+ }
58
+
59
+ /**
60
+ * Attempts to apply a given theme
61
+ * @param {Object|undefined} theme - The theme to be applied, if undefined, this method does nothing
62
+ */
63
+ function applyTheme(theme) {
64
+ if (theme === undefined) {
65
+ return;
66
+ }
67
+
68
+ for (const [name, hex] of Object.entries(theme)) {
69
+ document.documentElement.style.setProperty(name, hex);
70
+ }
71
+ }
72
+
73
+ applyTheme(getTheme());
74
+ </script>
75
+ </svelte:head>
76
+
77
+ <!--@component
78
+ ---
79
+ name: ThemeInit
80
+ props:
81
+ defaultSeed (undefined|string) = undefine Default color seed for the theme.
82
+ ---
83
+
84
+ Used to initialize the theme within your projects
85
+ -->
@@ -0,0 +1,13 @@
1
+ import type { Props } from '..';
2
+ /**
3
+ * ---
4
+ * name: ThemeInit
5
+ * props:
6
+ * defaultSeed (undefined|string) = undefine Default color seed for the theme.
7
+ * ---
8
+ *
9
+ * Used to initialize the theme within your projects
10
+ */
11
+ declare const ThemeInit: import("svelte").Component<Props, {}, "">;
12
+ type ThemeInit = ReturnType<typeof ThemeInit>;
13
+ export default ThemeInit;
@@ -0,0 +1,2 @@
1
+ export { default as _, default as Root } from "./components/theme-init.svelte";
2
+ export type { tThemeInitProps as Props, } from "./types";
@@ -0,0 +1 @@
1
+ export { default as _, default as Root } from "./components/theme-init.svelte";
@@ -0,0 +1,15 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ /**
3
+ * Possible default types, object contains
4
+ * `defaultMode`,
5
+ * `defaultVariant`,
6
+ * `defaultSeedColor`
7
+ */
8
+ export type tDefaults = {
9
+ defaultMode: 'dark' | 'light' | undefined;
10
+ defaultVariant: 'content' | 'expressive' | 'fidelity' | 'fruit-salad' | 'monochrome' | 'neutral' | 'rainbow' | 'tonal-spot' | 'vibrant' | undefined;
11
+ defaultSeedColor: string | undefined;
12
+ };
13
+ export type tThemeInitProps = HTMLAttributes<HTMLDivElement> & {
14
+ defaults?: tDefaults;
15
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -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
+ }
@@ -0,0 +1,4 @@
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];
@@ -0,0 +1,12 @@
1
+ export const MODES = ['light', 'dark'];
2
+ export const VARIANTS = [
3
+ 'content',
4
+ 'expressive',
5
+ 'fidelity',
6
+ 'fruit-salad',
7
+ 'monochrome',
8
+ 'neutral',
9
+ 'rainbow',
10
+ 'tonal-spot',
11
+ 'vibrant'
12
+ ];
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ // --- Logic ---
3
+ import { cn } from '../../../utils/classname';
4
+ import type { Props } from '..';
5
+
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();
7
+
8
+ // Setup Button's Default Class
9
+ let buttonCls = $state(cn(buttonClass, className));
10
+ $effect(() => {
11
+ buttonCls = cn(buttonClass, className);
12
+ });
13
+ </script>
14
+
15
+ asd
16
+
17
+ {#if href}
18
+ <a {href} class={cn(buttonCls)} {...(rest as any)} tabindex="0">
19
+ {@render children?.()}
20
+ </a>
21
+ {:else}
22
+ <button class={cn(buttonCls)} {...(rest as any)} tabindex="0">
23
+ {@render children?.()}
24
+ </button>
25
+ {/if}
26
+
27
+ <!--@component
28
+ Generated by SvelteForge🔥
29
+
30
+ # Button Component
31
+ Simple button component for easy customization and easy onclick functionality
32
+ Button is easily configured, colored, and will also abide to WCAG standards.
33
+ -->
@@ -0,0 +1,11 @@
1
+ import type { Props } from '..';
2
+ /**
3
+ * Generated by SvelteForge🔥
4
+ *
5
+ * # Button Component
6
+ * Simple button component for easy customization and easy onclick functionality
7
+ * Button is easily configured, colored, and will also abide to WCAG standards.
8
+ */
9
+ declare const Button: import("svelte").Component<Props, {}, "class" | "buttonClass">;
10
+ type Button = ReturnType<typeof Button>;
11
+ export default Button;
@@ -0,0 +1,2 @@
1
+ export { default as _, default as Root } from "./components/button.svelte";
2
+ export type { tButtonProps as Props, } from "./types";
@@ -0,0 +1 @@
1
+ export { default as _, default as Root } from "./components/button.svelte";
@@ -0,0 +1,5 @@
1
+ import type { ClassValue, HTMLButtonAttributes } from "svelte/elements";
2
+ export type tButtonProps = HTMLButtonAttributes & {
3
+ buttonClass?: ClassValue;
4
+ href?: string;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+
3
+ // --- Components ---
4
+ import { Frame } from "../.."
5
+
6
+ // --- Logic ---
7
+ import { cn } from '../../../utils/classname';
8
+ import type { Props } from ".."
9
+
10
+ let {
11
+ children,
12
+ class: className = $bindable(undefined),
13
+ ...rest
14
+ }: Props = $props();
15
+
16
+ </script>
17
+
18
+ <Frame class={ cn(className) } {...rest} flex>
19
+ {@render children?.()}
20
+ </Frame>
21
+
22
+ <!--@component
23
+ Generated by SvelteForge🔥
24
+
25
+ # Flex Component
26
+ Wrapper component for Frame with the flex attribute passed
27
+ -->
28
+
@@ -0,0 +1,10 @@
1
+ import type { Props } from "..";
2
+ /**
3
+ * Generated by SvelteForge🔥
4
+ *
5
+ * # Flex Component
6
+ * Wrapper component for Frame with the flex attribute passed
7
+ */
8
+ declare const Flex: import("svelte").Component<Props, {}, "class">;
9
+ type Flex = ReturnType<typeof Flex>;
10
+ export default Flex;
@@ -0,0 +1,2 @@
1
+ export { default as _, default as Root } from "./components/flex.svelte";
2
+ export type { tFlexProps as Props, } from "./types";
@@ -0,0 +1 @@
1
+ export { default as _, default as Root } from "./components/flex.svelte";
@@ -0,0 +1,2 @@
1
+ import type { tFrameProps } from "../frame/types.js";
2
+ export type tFlexProps = tFrameProps & {};
@@ -0,0 +1 @@
1
+ export {};