@valerius_petrini/corekit-ui 0.1.34 → 0.1.35

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Valerius Petrini
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Valerius Petrini
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,65 +1,65 @@
1
- # Svelte library
2
-
3
- Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4
-
5
- Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
-
7
- ## Creating a project
8
-
9
- If you're seeing this, you've probably already done this step. Congrats!
10
-
11
- ```sh
12
- # create a new project in the current directory
13
- npx sv create
14
-
15
- # create a new project in my-app
16
- npx sv create my-app
17
- ```
18
-
19
- To recreate this project with the same configuration:
20
-
21
- ```sh
22
- # recreate this project
23
- npx sv@0.12.5 create --template library --types ts --add tailwindcss="plugins:typography,forms" --install npm ./
24
- ```
25
-
26
- ## Developing
27
-
28
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
29
-
30
- ```sh
31
- npm run dev
32
-
33
- # or start the server and open the app in a new browser tab
34
- npm run dev -- --open
35
- ```
36
-
37
- Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
38
-
39
- ## Building
40
-
41
- To build your library:
42
-
43
- ```sh
44
- npm pack
45
- ```
46
-
47
- To create a production version of your showcase app:
48
-
49
- ```sh
50
- npm run build
51
- ```
52
-
53
- You can preview the production build with `npm run preview`.
54
-
55
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
56
-
57
- ## Publishing
58
-
59
- Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
60
-
61
- To publish your library to [npm](https://www.npmjs.com):
62
-
63
- ```sh
64
- npm publish
65
- ```
1
+ # Svelte library
2
+
3
+ Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4
+
5
+ Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
+
7
+ ## Creating a project
8
+
9
+ If you're seeing this, you've probably already done this step. Congrats!
10
+
11
+ ```sh
12
+ # create a new project in the current directory
13
+ npx sv create
14
+
15
+ # create a new project in my-app
16
+ npx sv create my-app
17
+ ```
18
+
19
+ To recreate this project with the same configuration:
20
+
21
+ ```sh
22
+ # recreate this project
23
+ npx sv@0.12.5 create --template library --types ts --add tailwindcss="plugins:typography,forms" --install npm ./
24
+ ```
25
+
26
+ ## Developing
27
+
28
+ Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
29
+
30
+ ```sh
31
+ npm run dev
32
+
33
+ # or start the server and open the app in a new browser tab
34
+ npm run dev -- --open
35
+ ```
36
+
37
+ Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
38
+
39
+ ## Building
40
+
41
+ To build your library:
42
+
43
+ ```sh
44
+ npm pack
45
+ ```
46
+
47
+ To create a production version of your showcase app:
48
+
49
+ ```sh
50
+ npm run build
51
+ ```
52
+
53
+ You can preview the production build with `npm run preview`.
54
+
55
+ > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
56
+
57
+ ## Publishing
58
+
59
+ Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
60
+
61
+ To publish your library to [npm](https://www.npmjs.com):
62
+
63
+ ```sh
64
+ npm publish
65
+ ```
@@ -1,72 +1,72 @@
1
- const FBM_VERTEX_SHADER_SOURCE = `
2
- attribute vec4 aVertexPosition;
3
-
4
- void main() {
5
- gl_Position = aVertexPosition;
1
+ const FBM_VERTEX_SHADER_SOURCE = `
2
+ attribute vec4 aVertexPosition;
3
+
4
+ void main() {
5
+ gl_Position = aVertexPosition;
6
6
  }`;
7
- const FBM_FRAGMENT_SHADER_SOURCE = `
8
- precision mediump float;
9
-
10
- uniform vec2 u_resolution;
11
- uniform float u_seed;
12
- uniform float u_scale;
13
- uniform int u_octaves;
14
- uniform int u_warp;
15
-
16
- const int maxOctaves = 20;
17
- const int maxWarps = 5;
18
-
19
- float rand(vec2 n) {
20
- return fract(sin(dot(n.xy + u_seed, vec2(12.9898, 78.233))) * 43758.5453);
21
- }
22
-
23
- float noise(vec2 p){
24
- vec2 i = floor(p);
25
- vec2 f = fract(p);
26
-
27
- // Four corners in 2D of a tile
28
- float a = rand(i);
29
- float b = rand(i + vec2(1.0, 0.0));
30
- float c = rand(i + vec2(0.0, 1.0));
31
- float d = rand(i + vec2(1.0, 1.0));
32
-
33
- vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);
34
-
35
- return mix(a, b, u.x) +
36
- (c - a)* u.y * (1.0 - u.x) +
37
- (d - b) * u.x * u.y;
38
- }
39
-
40
- float fbm( in vec2 x, in float H ) {
41
- float v = 00.0000;
42
- float a = 0.5;
43
- vec2 shift = vec2(100);
44
- // Rotate to reduce axial bias
45
- mat2 rot = mat2(0.877, 0.479, -0.479, 0.877);
46
- for (int i = 0; i < maxOctaves; ++i) {
47
- v += a * noise(x);
48
- x = rot * x * 2.0 + shift;
49
- a *= 0.5;
50
- if (i > u_octaves) break;
51
- }
52
- return v;
53
- }
54
-
55
- void main() {
56
- vec2 uv = gl_FragCoord.xy / u_resolution.xy;
57
- uv.x *= u_resolution.x / u_resolution.y;
58
-
59
- float baseNoise = fbm(uv * u_scale, 1.2);
60
-
61
- vec2 warp = uv;
62
- for (int i = 0; i < maxWarps; ++i) {
63
- warp += vec2(fbm(warp * 2.0, 1.0), fbm(warp * 4.0 + vec2(10.2), 1.0));
64
- if (i > u_warp) break;
65
- }
66
-
67
- baseNoise = fbm(warp * u_scale, 1.2);
68
-
69
- gl_FragColor = vec4(vec3(baseNoise), 1.0);
7
+ const FBM_FRAGMENT_SHADER_SOURCE = `
8
+ precision mediump float;
9
+
10
+ uniform vec2 u_resolution;
11
+ uniform float u_seed;
12
+ uniform float u_scale;
13
+ uniform int u_octaves;
14
+ uniform int u_warp;
15
+
16
+ const int maxOctaves = 20;
17
+ const int maxWarps = 5;
18
+
19
+ float rand(vec2 n) {
20
+ return fract(sin(dot(n.xy + u_seed, vec2(12.9898, 78.233))) * 43758.5453);
21
+ }
22
+
23
+ float noise(vec2 p){
24
+ vec2 i = floor(p);
25
+ vec2 f = fract(p);
26
+
27
+ // Four corners in 2D of a tile
28
+ float a = rand(i);
29
+ float b = rand(i + vec2(1.0, 0.0));
30
+ float c = rand(i + vec2(0.0, 1.0));
31
+ float d = rand(i + vec2(1.0, 1.0));
32
+
33
+ vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);
34
+
35
+ return mix(a, b, u.x) +
36
+ (c - a)* u.y * (1.0 - u.x) +
37
+ (d - b) * u.x * u.y;
38
+ }
39
+
40
+ float fbm( in vec2 x, in float H ) {
41
+ float v = 00.0000;
42
+ float a = 0.5;
43
+ vec2 shift = vec2(100);
44
+ // Rotate to reduce axial bias
45
+ mat2 rot = mat2(0.877, 0.479, -0.479, 0.877);
46
+ for (int i = 0; i < maxOctaves; ++i) {
47
+ v += a * noise(x);
48
+ x = rot * x * 2.0 + shift;
49
+ a *= 0.5;
50
+ if (i > u_octaves) break;
51
+ }
52
+ return v;
53
+ }
54
+
55
+ void main() {
56
+ vec2 uv = gl_FragCoord.xy / u_resolution.xy;
57
+ uv.x *= u_resolution.x / u_resolution.y;
58
+
59
+ float baseNoise = fbm(uv * u_scale, 1.2);
60
+
61
+ vec2 warp = uv;
62
+ for (int i = 0; i < maxWarps; ++i) {
63
+ warp += vec2(fbm(warp * 2.0, 1.0), fbm(warp * 4.0 + vec2(10.2), 1.0));
64
+ if (i > u_warp) break;
65
+ }
66
+
67
+ baseNoise = fbm(warp * u_scale, 1.2);
68
+
69
+ gl_FragColor = vec4(vec3(baseNoise), 1.0);
70
70
  }`;
71
71
  function loadShaders(gl, type, source) {
72
72
  const shader = gl.createShader(type);
@@ -1,28 +1,28 @@
1
- <script lang="ts">
2
- import { page } from '$app/state'
3
- import type { AnalyticsProps } from '../types/Analytics.js';
4
-
5
- let { measurementId }: AnalyticsProps = $props();
6
-
7
- const ANALYTICS_URL = $derived(`https://www.googletagmanager.com/gtag/js?id=${measurementId}`);
8
-
9
- $effect(() => {
10
- if (typeof gtag !== 'undefined') {
11
- gtag('config', measurementId, {
12
- page_title: document.title,
13
- page_path: page.url.pathname,
14
- })
15
- }
16
- })
17
- </script>
18
-
19
- <svelte:head>
20
- {#if measurementId}
21
- <script async src={ANALYTICS_URL}></script>
22
- <script>
23
- window.dataLayer = window.dataLayer || [];
24
- function gtag() { dataLayer.push(arguments); }
25
- gtag('js', new Date());
26
- </script>
27
- {/if}
1
+ <script lang="ts">
2
+ import { page } from '$app/state'
3
+ import type { AnalyticsProps } from '../types/Analytics.js';
4
+
5
+ let { measurementId }: AnalyticsProps = $props();
6
+
7
+ const ANALYTICS_URL = $derived(`https://www.googletagmanager.com/gtag/js?id=${measurementId}`);
8
+
9
+ $effect(() => {
10
+ if (typeof gtag !== 'undefined') {
11
+ gtag('config', measurementId, {
12
+ page_title: document.title,
13
+ page_path: page.url.pathname,
14
+ })
15
+ }
16
+ })
17
+ </script>
18
+
19
+ <svelte:head>
20
+ {#if measurementId}
21
+ <script async src={ANALYTICS_URL}></script>
22
+ <script>
23
+ window.dataLayer = window.dataLayer || [];
24
+ function gtag() { dataLayer.push(arguments); }
25
+ gtag('js', new Date());
26
+ </script>
27
+ {/if}
28
28
  </svelte:head>
@@ -1,40 +1,40 @@
1
- <script lang="ts">
2
- import { colorStyles } from "../styles/color.js";
3
- import type { ButtonProps } from "../types/Button.js";
4
- import { twMerge } from "tailwind-merge";
5
-
6
- let {
7
- children = undefined,
8
- class: className = "",
9
- pill = false,
10
- icon = false,
11
- href = undefined,
12
- color = undefined,
13
- size = undefined,
14
- ...restProps
15
- }: ButtonProps = $props();
16
-
17
- function getSizeStyles(size?: number | string) {
18
- if (typeof size === "number")
19
- return `w-${size} h-${size}`;
20
- return "";
21
- }
22
-
23
- let pillClass = "rounded-full";
24
- let iconClass = "rounded-full p-2 flex-center";
25
- let defaultClass = $derived(twMerge(
26
- "text-white cursor-pointer px-2 py-1 transition-colors duration-300 rounded-md",
27
- (pill ? pillClass : ""), (icon ? iconClass : ""), color ? colorStyles[color] : "", getSizeStyles(size)));
28
-
29
- let combinedClass = $derived(twMerge(defaultClass, className));
30
- </script>
31
-
32
- {#if href}
33
- <a class={combinedClass} {href} {...restProps}>
34
- {@render children?.()}
35
- </a>
36
- {:else}
37
- <button class={combinedClass} {...restProps}>
38
- {@render children?.()}
39
- </button>
1
+ <script lang="ts">
2
+ import { colorStyles } from "../styles/color.js";
3
+ import type { ButtonProps } from "../types/Button.js";
4
+ import { twMerge } from "tailwind-merge";
5
+
6
+ let {
7
+ children = undefined,
8
+ class: className = "",
9
+ pill = false,
10
+ icon = false,
11
+ href = undefined,
12
+ color = undefined,
13
+ size = undefined,
14
+ ...restProps
15
+ }: ButtonProps = $props();
16
+
17
+ function getSizeStyles(size?: number | string) {
18
+ if (typeof size === "number")
19
+ return `w-${size} h-${size}`;
20
+ return "";
21
+ }
22
+
23
+ let pillClass = "rounded-full";
24
+ let iconClass = "rounded-full p-2 flex-center";
25
+ let defaultClass = $derived(twMerge(
26
+ "text-white cursor-pointer px-2 py-1 transition-colors duration-300 rounded-md",
27
+ (pill ? pillClass : ""), (icon ? iconClass : ""), color ? colorStyles[color] : "", getSizeStyles(size)));
28
+
29
+ let combinedClass = $derived(twMerge(defaultClass, className));
30
+ </script>
31
+
32
+ {#if href}
33
+ <a class={combinedClass} {href} {...restProps}>
34
+ {@render children?.()}
35
+ </a>
36
+ {:else}
37
+ <button class={combinedClass} {...restProps}>
38
+ {@render children?.()}
39
+ </button>
40
40
  {/if}
@@ -1,61 +1,61 @@
1
- <script lang="ts">
2
- import type { FloatingInputProps } from "../types/FloatingInput.js";
3
- import { twMerge } from "tailwind-merge";
4
-
5
- let {
6
- children = undefined,
7
- class: className = "",
8
- labelClass = "",
9
- divClass = "",
10
- value = $bindable(),
11
- onfocus = undefined,
12
- onblur = undefined,
13
- validInputRegex = undefined,
14
- id = crypto.randomUUID(),
15
- ...restProps
16
- }: FloatingInputProps = $props();
17
-
18
- let isFocused = $state(false);
19
- let touched = $state(false);
20
-
21
- let hasContent = $derived(value !== undefined && value !== null && value.toString().length > 0);
22
- let isValid = $derived(!touched || !validInputRegex || validInputRegex.test(value || ""));
23
-
24
- let defaultClass = "z-20 w-full border rounded px-3 py-2 outline-none focus:ring-2 focus:ring-blue-500 transition-all";
25
- let defaultLabelClass = "block text-sm font-medium text-gray-700 mb-1 absolute transition-all duration-100 pointer-events-none";
26
- let defaultDivClass = "relative";
27
-
28
- let originalLabelClass = "left-3 top-1/2 transform -translate-y-1/2 z-0";
29
- let selectedLabelClass = "left-2 z-30 bg-white px-1 top-0 transform -translate-y-1/2 text-xs";
30
-
31
- let invalidClass = "border-red-500 focus:ring-red-500";
32
-
33
- let combinedLabelClass = $derived(twMerge(defaultLabelClass, isFocused || hasContent ? selectedLabelClass : originalLabelClass, labelClass));
34
- let combinedClass = $derived(twMerge(defaultClass, className, isValid ? "" : invalidClass));
35
- let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
36
-
37
- function handleFocus(e: FocusEvent) {
38
- isFocused = true;
39
- onfocus?.(e);
40
- }
41
-
42
- function handleBlur(e: FocusEvent) {
43
- isFocused = false;
44
- touched = true;
45
- onblur?.(e);
46
- }
47
- </script>
48
-
49
- <div class={combinedDivClass}>
50
- <label for={id} class={combinedLabelClass}>
51
- {@render children?.()}
52
- </label>
53
- <input
54
- {id}
55
- bind:value={value}
56
- onfocus={handleFocus}
57
- onblur={handleBlur}
58
- class={combinedClass}
59
- {...restProps}
60
- />
1
+ <script lang="ts">
2
+ import type { FloatingInputProps } from "../types/FloatingInput.js";
3
+ import { twMerge } from "tailwind-merge";
4
+
5
+ let {
6
+ children = undefined,
7
+ class: className = "",
8
+ labelClass = "",
9
+ divClass = "",
10
+ value = $bindable(),
11
+ onfocus = undefined,
12
+ onblur = undefined,
13
+ validInputRegex = undefined,
14
+ id = crypto.randomUUID(),
15
+ ...restProps
16
+ }: FloatingInputProps = $props();
17
+
18
+ let isFocused = $state(false);
19
+ let touched = $state(false);
20
+
21
+ let hasContent = $derived(value !== undefined && value !== null && value.toString().length > 0);
22
+ let isValid = $derived(!touched || !validInputRegex || validInputRegex.test(value || ""));
23
+
24
+ let defaultClass = "z-20 bg-form-input-background text-main-text w-full border rounded px-2 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
25
+ let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
26
+ let defaultDivClass = "relative";
27
+
28
+ let originalLabelClass = "left-2 top-1/2 transform -translate-y-1/2 z-0";
29
+ let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]";
30
+
31
+ let invalidClass = "border-red-500 focus:ring-red-500";
32
+
33
+ let combinedLabelClass = $derived(twMerge(defaultLabelClass, isFocused || hasContent ? selectedLabelClass : originalLabelClass, labelClass));
34
+ let combinedClass = $derived(twMerge(defaultClass, className, isValid ? "" : invalidClass));
35
+ let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
36
+
37
+ function handleFocus(e: FocusEvent) {
38
+ isFocused = true;
39
+ onfocus?.(e);
40
+ }
41
+
42
+ function handleBlur(e: FocusEvent) {
43
+ isFocused = false;
44
+ touched = true;
45
+ onblur?.(e);
46
+ }
47
+ </script>
48
+
49
+ <div class={combinedDivClass}>
50
+ <label for={id} class={combinedLabelClass}>
51
+ {@render children?.()}
52
+ </label>
53
+ <input
54
+ {id}
55
+ bind:value={value}
56
+ onfocus={handleFocus}
57
+ onblur={handleBlur}
58
+ class={combinedClass}
59
+ {...restProps}
60
+ />
61
61
  </div>
@@ -1,37 +1,37 @@
1
- <script lang="ts">
2
- import type { NavbarProps } from "../types/Navbar.js";
3
- import { onMount } from "svelte";
4
- import { twMerge } from "tailwind-merge";
5
-
6
- let {
7
- children = undefined,
8
- class: className = "",
9
- classTop = "",
10
- ...restProps
11
- }: NavbarProps = $props();
12
-
13
- let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center";
14
-
15
- let scrollY = $state(0);
16
-
17
- let combinedClass = $derived(scrollY === 0
18
- ? twMerge(defaultClass, className, classTop)
19
- : twMerge(defaultClass, className));
20
-
21
- function onScroll() {
22
- scrollY = window.scrollY;
23
- }
24
-
25
- onMount(() => {
26
- window.addEventListener('scroll', onScroll);
27
- onScroll();
28
-
29
- return () => {
30
- window.removeEventListener('scroll', onScroll);
31
- };
32
- });
33
- </script>
34
-
35
- <nav class={combinedClass} {...restProps}>
36
- {@render children?.()}
1
+ <script lang="ts">
2
+ import type { NavbarProps } from "../types/Navbar.js";
3
+ import { onMount } from "svelte";
4
+ import { twMerge } from "tailwind-merge";
5
+
6
+ let {
7
+ children = undefined,
8
+ class: className = "",
9
+ classTop = "",
10
+ ...restProps
11
+ }: NavbarProps = $props();
12
+
13
+ let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-main-background border-b-sub-background border-b";
14
+
15
+ let scrollY = $state(0);
16
+
17
+ let combinedClass = $derived(scrollY === 0
18
+ ? twMerge(defaultClass, className, classTop)
19
+ : twMerge(defaultClass, className));
20
+
21
+ function onScroll() {
22
+ scrollY = window.scrollY;
23
+ }
24
+
25
+ onMount(() => {
26
+ window.addEventListener('scroll', onScroll);
27
+ onScroll();
28
+
29
+ return () => {
30
+ window.removeEventListener('scroll', onScroll);
31
+ };
32
+ });
33
+ </script>
34
+
35
+ <nav class={combinedClass} {...restProps}>
36
+ {@render children?.()}
37
37
  </nav>
@@ -1,39 +1,39 @@
1
- <script lang="ts">
2
- import { twMerge } from "tailwind-merge";
3
- import Button from "./Button.svelte";
4
- import { onMount } from "svelte";
5
- import type { NavbarElementProps } from "../types/Navbar.js";
6
-
7
- let {
8
- children = undefined,
9
- class: className = "",
10
- classTop = "",
11
- href = undefined,
12
- ...restProps
13
- }: NavbarElementProps = $props();
14
-
15
- let defaultClass = "navbar-element w-fit h-full flex items-center px-5 py-0";
16
-
17
- let scrollY = $state(0);
18
-
19
- let combinedClass = $derived(scrollY === 0
20
- ? twMerge(defaultClass, className, classTop)
21
- : twMerge(defaultClass, className));
22
-
23
- function onScroll() {
24
- scrollY = window.scrollY;
25
- }
26
-
27
- onMount(() => {
28
- window.addEventListener('scroll', onScroll);
29
- onScroll();
30
-
31
- return () => {
32
- window.removeEventListener('scroll', onScroll);
33
- };
34
- });
35
- </script>
36
-
37
- <Button {href} class={combinedClass} {...restProps}>
38
- {@render children?.()}
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+ import Button from "./Button.svelte";
4
+ import { onMount } from "svelte";
5
+ import type { NavbarElementProps } from "../types/Navbar.js";
6
+
7
+ let {
8
+ children = undefined,
9
+ class: className = "",
10
+ classTop = "",
11
+ href = undefined,
12
+ ...restProps
13
+ }: NavbarElementProps = $props();
14
+
15
+ let defaultClass = "navbar-element w-fit h-full flex items-center px-5 py-0 text-main-text hover:bg-navbar-element-hover-background rounded-none";
16
+
17
+ let scrollY = $state(0);
18
+
19
+ let combinedClass = $derived(scrollY === 0
20
+ ? twMerge(defaultClass, className, classTop)
21
+ : twMerge(defaultClass, className));
22
+
23
+ function onScroll() {
24
+ scrollY = window.scrollY;
25
+ }
26
+
27
+ onMount(() => {
28
+ window.addEventListener('scroll', onScroll);
29
+ onScroll();
30
+
31
+ return () => {
32
+ window.removeEventListener('scroll', onScroll);
33
+ };
34
+ });
35
+ </script>
36
+
37
+ <Button {href} class={combinedClass} {...restProps}>
38
+ {@render children?.()}
39
39
  </Button>
@@ -1,43 +1,43 @@
1
- <script lang="ts">
2
- import { page } from '$app/state';
3
- import type { SEOProps } from '../types/SEO.js';
4
-
5
- const DEFAULT_TITLE = "My SvelteKit App";
6
- const DEFAULT_DESCRIPTION = "Description of your website.";
7
- const DEFAULT_IMAGE = "/favicon.png";
8
-
9
- let {
10
- websiteName,
11
- title = DEFAULT_TITLE,
12
- description = DEFAULT_DESCRIPTION,
13
- image = DEFAULT_IMAGE
14
- }: SEOProps = $props();
15
-
16
- let fullUrl = $derived(`${websiteName}${page.url.pathname.toString()}`);
17
- </script>
18
-
19
- <svelte:head>
20
- <title>{title}</title>
21
- <meta name="description" content={description}>
22
- <meta property="og_site_name" content={websiteName}>
23
- <meta property="og:url" content={fullUrl}>
24
- <meta property="og:type" content="website">
25
- <meta property="og:title" content="{title}">
26
- <meta property="og:description" content={description}>
27
- <meta property="og:image" content={websiteName + image}>
28
-
29
- <meta name="twitter:card" content="summary_large_image">
30
- <meta property="twitter:domain" content={websiteName}>
31
- <meta property="twitter:url" content={fullUrl}>
32
- <meta name="twitter:title" content="{title}">
33
- <meta name="twitter:description" content={description}>
34
- <meta name="twitter:image" content={websiteName + image}>
35
- {@html ` <script type="application/ld+json">{
36
- "@context": "https://schema.org",
37
- "@type": "Website",
38
- "name": "${title}",
39
- "url": "${fullUrl}",
40
- "logo": "${websiteName}${image}" }</script>`}
41
-
42
- <meta name="google-site-verification" content="F6vDzwDyZfebc9kWIZlhzpsAm5zhanaPkOArdCZdDSU" />
1
+ <script lang="ts">
2
+ import { page } from '$app/state';
3
+ import type { SEOProps } from '../types/SEO.js';
4
+
5
+ const DEFAULT_TITLE = "My SvelteKit App";
6
+ const DEFAULT_DESCRIPTION = "Description of your website.";
7
+ const DEFAULT_IMAGE = "/favicon.png";
8
+
9
+ let {
10
+ websiteName,
11
+ title = DEFAULT_TITLE,
12
+ description = DEFAULT_DESCRIPTION,
13
+ image = DEFAULT_IMAGE
14
+ }: SEOProps = $props();
15
+
16
+ let fullUrl = $derived(`${websiteName}${page.url.pathname.toString()}`);
17
+ </script>
18
+
19
+ <svelte:head>
20
+ <title>{title}</title>
21
+ <meta name="description" content={description}>
22
+ <meta property="og_site_name" content={websiteName}>
23
+ <meta property="og:url" content={fullUrl}>
24
+ <meta property="og:type" content="website">
25
+ <meta property="og:title" content="{title}">
26
+ <meta property="og:description" content={description}>
27
+ <meta property="og:image" content={websiteName + image}>
28
+
29
+ <meta name="twitter:card" content="summary_large_image">
30
+ <meta property="twitter:domain" content={websiteName}>
31
+ <meta property="twitter:url" content={fullUrl}>
32
+ <meta name="twitter:title" content="{title}">
33
+ <meta name="twitter:description" content={description}>
34
+ <meta name="twitter:image" content={websiteName + image}>
35
+ {@html ` <script type="application/ld+json">{
36
+ "@context": "https://schema.org",
37
+ "@type": "Website",
38
+ "name": "${title}",
39
+ "url": "${fullUrl}",
40
+ "logo": "${websiteName}${image}" }</script>`}
41
+
42
+ <meta name="google-site-verification" content="F6vDzwDyZfebc9kWIZlhzpsAm5zhanaPkOArdCZdDSU" />
43
43
  </svelte:head>
@@ -1,84 +1,84 @@
1
- <script lang="ts">
2
- import { twMerge } from "tailwind-merge";
3
- import { onMount } from "svelte";
4
-
5
- import type { DisplaySegment, TypewriterProps } from "../types/Typewriter.d.js";
6
-
7
- let {
8
- actions,
9
- class: className = "",
10
- ...restProps
11
- }: TypewriterProps = $props();
12
-
13
- let displaySegments = $state<DisplaySegment[]>([]);
14
-
15
- async function execute() {
16
- for (let i = 0; i < actions.length; i++) {
17
- const action = actions[i];
18
- switch (action.type) {
19
- case "write":
20
- const segment = { text: "", color: "", label: action.label };
21
- displaySegments.push(segment);
22
-
23
- const segmentProxy = displaySegments[displaySegments.length - 1];
24
-
25
- const resolvedValue = typeof action.value === "function" ? action.value() : action.value;
26
- const resolvedColor = typeof action.color === "function" ? action.color() : action.color;
27
- segmentProxy.color = resolvedColor;
28
- for (const char of resolvedValue) {
29
- segmentProxy.text += char;
30
- const speed = Math.random() * ((action.maxspeed || 100) - (action.minspeed || 50)) + (action.minspeed || 50);
31
- await new Promise(resolve => setTimeout(resolve, speed));
32
- }
33
- break;
34
- case "delete":
35
- const index = displaySegments.findIndex(s => s.label === action.to);
36
- if (index === -1) break;
37
- for (let j = displaySegments.length - 1; j >= index; j--) {
38
- const deleteSegment = displaySegments[j];
39
- while (deleteSegment.text.length > 0) {
40
- deleteSegment.text = deleteSegment.text.slice(0, -1);
41
- const speed = Math.random() * ((action.maxspeed || 100) - (action.minspeed || 50)) + (action.minspeed || 50);
42
- await new Promise(resolve => setTimeout(resolve, speed));
43
- }
44
- }
45
- displaySegments.splice(index, 1);
46
- break;
47
- case "pause":
48
- await new Promise(resolve => setTimeout(resolve, action.duration || 1000));
49
- break;
50
- case "jump":
51
- const position = actions.findIndex(a => a.label === action.position);
52
- if (position !== -1)
53
- i = position - 1;
54
- break;
55
- }
56
- }
57
- }
58
-
59
- onMount(() => {
60
- execute();
61
- });
62
-
63
- let combinedClass = $derived(twMerge("typewriter w-fit", className));
64
- </script>
65
-
66
- <div class={combinedClass} {...restProps}>
67
- {#each displaySegments as segment}
68
- {#key segment}
69
- <span style="color: {segment.color}">{segment.text}</span>
70
- {/key}
71
- {/each}
72
- </div>
73
-
74
- <style>
75
- .typewriter::after {
76
- content: "\00a0";
77
- animation: blink .7s step-start infinite;
78
- text-decoration: underline;
79
- }
80
-
81
- @keyframes blink {
82
- 50% { opacity: 0; }
83
- }
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+ import { onMount } from "svelte";
4
+
5
+ import type { DisplaySegment, TypewriterProps } from "../types/Typewriter.d.js";
6
+
7
+ let {
8
+ actions,
9
+ class: className = "",
10
+ ...restProps
11
+ }: TypewriterProps = $props();
12
+
13
+ let displaySegments = $state<DisplaySegment[]>([]);
14
+
15
+ async function execute() {
16
+ for (let i = 0; i < actions.length; i++) {
17
+ const action = actions[i];
18
+ switch (action.type) {
19
+ case "write":
20
+ const segment = { text: "", color: "", label: action.label };
21
+ displaySegments.push(segment);
22
+
23
+ const segmentProxy = displaySegments[displaySegments.length - 1];
24
+
25
+ const resolvedValue = typeof action.value === "function" ? action.value() : action.value;
26
+ const resolvedColor = typeof action.color === "function" ? action.color() : action.color;
27
+ segmentProxy.color = resolvedColor;
28
+ for (const char of resolvedValue) {
29
+ segmentProxy.text += char;
30
+ const speed = Math.random() * ((action.maxspeed || 100) - (action.minspeed || 50)) + (action.minspeed || 50);
31
+ await new Promise(resolve => setTimeout(resolve, speed));
32
+ }
33
+ break;
34
+ case "delete":
35
+ const index = displaySegments.findIndex(s => s.label === action.to);
36
+ if (index === -1) break;
37
+ for (let j = displaySegments.length - 1; j >= index; j--) {
38
+ const deleteSegment = displaySegments[j];
39
+ while (deleteSegment.text.length > 0) {
40
+ deleteSegment.text = deleteSegment.text.slice(0, -1);
41
+ const speed = Math.random() * ((action.maxspeed || 100) - (action.minspeed || 50)) + (action.minspeed || 50);
42
+ await new Promise(resolve => setTimeout(resolve, speed));
43
+ }
44
+ }
45
+ displaySegments.splice(index, 1);
46
+ break;
47
+ case "pause":
48
+ await new Promise(resolve => setTimeout(resolve, action.duration || 1000));
49
+ break;
50
+ case "jump":
51
+ const position = actions.findIndex(a => a.label === action.position);
52
+ if (position !== -1)
53
+ i = position - 1;
54
+ break;
55
+ }
56
+ }
57
+ }
58
+
59
+ onMount(() => {
60
+ execute();
61
+ });
62
+
63
+ let combinedClass = $derived(twMerge("typewriter w-fit text-main-text", className));
64
+ </script>
65
+
66
+ <div class={combinedClass} {...restProps}>
67
+ {#each displaySegments as segment}
68
+ {#key segment}
69
+ <span style="color: {segment.color}">{segment.text}</span>
70
+ {/key}
71
+ {/each}
72
+ </div>
73
+
74
+ <style>
75
+ .typewriter::after {
76
+ content: "\00a0";
77
+ animation: blink .7s step-start infinite;
78
+ text-decoration: underline;
79
+ }
80
+
81
+ @keyframes blink {
82
+ 50% { opacity: 0; }
83
+ }
84
84
  </style>
@@ -1,9 +1,9 @@
1
1
  export const colorStyles = {
2
- red: "bg-red-500 hover:bg-red-600 focus:ring-red-300",
3
- yellow: "bg-yellow-500 hover:bg-yellow-600 focus:ring-yellow-300",
4
- lightgreen: "bg-green-500 hover:bg-green-600 focus:ring-green-300",
5
- blue: "bg-blue-500 hover:bg-blue-600 focus:ring-blue-300",
6
- pink: "bg-pink-500 hover:bg-pink-600 focus:ring-pink-300",
7
- purple: "bg-purple-500 hover:bg-purple-600 focus:ring-purple-300",
8
- gray: "bg-gray-500 hover:bg-gray-600 focus:ring-gray-300",
2
+ red: "bg-red-500 hover:bg-red-600",
3
+ yellow: "bg-yellow-500 hover:bg-yellow-600",
4
+ lightgreen: "bg-green-500 hover:bg-green-600",
5
+ blue: "bg-blue-500 hover:bg-blue-600",
6
+ pink: "bg-pink-500 hover:bg-pink-600",
7
+ purple: "bg-purple-500 hover:bg-purple-600",
8
+ gray: "bg-gray-500 hover:bg-gray-600",
9
9
  };
@@ -1,3 +1,3 @@
1
- export interface AnalyticsProps {
2
- measurementId: string;
1
+ export interface AnalyticsProps {
2
+ measurementId: string;
3
3
  }
@@ -1,12 +1,12 @@
1
- import type { ColorStyle } from "../styles/color.ts";
2
-
3
- export interface ButtonProps {
4
- children?: any;
5
- class?: string;
6
- pill?: boolean;
7
- icon?: boolean;
8
- href?: string;
9
- color?: ColorStyle;
10
- size?: number | string;
11
- [key: string]: any;
1
+ import type { ColorStyle } from "../styles/color.ts";
2
+
3
+ export interface ButtonProps {
4
+ children?: any;
5
+ class?: string;
6
+ pill?: boolean;
7
+ icon?: boolean;
8
+ href?: string;
9
+ color?: ColorStyle;
10
+ size?: number | string;
11
+ [key: string]: any;
12
12
  }
@@ -1,12 +1,12 @@
1
- export interface FloatingInputProps {
2
- children?: any;
3
- class?: string;
4
- labelClass?: string;
5
- divClass?: string;
6
- value?: string;
7
- onfocus?: (e?: FocusEvent) => void;
8
- onblur?: (e?: FocusEvent) => void;
9
- validInputRegex?: RegExp;
10
- id?: `${string}-${string}-${string}-${string}-${string}`;
11
- [key: string]: any;
1
+ export interface FloatingInputProps {
2
+ children?: any;
3
+ class?: string;
4
+ labelClass?: string;
5
+ divClass?: string;
6
+ value?: string;
7
+ onfocus?: (e?: FocusEvent) => void;
8
+ onblur?: (e?: FocusEvent) => void;
9
+ validInputRegex?: RegExp;
10
+ id?: `${string}-${string}-${string}-${string}-${string}`;
11
+ [key: string]: any;
12
12
  };
@@ -1,14 +1,14 @@
1
- export interface NavbarProps {
2
- children?: any;
3
- class?: string;
4
- classTop?: string;
5
- [key: string]: any;
6
- };
7
-
8
- export interface NavbarElementProps {
9
- children?: any;
10
- class?: string;
11
- classTop?: string;
12
- href?: string;
13
- [key: string]: any;
1
+ export interface NavbarProps {
2
+ children?: any;
3
+ class?: string;
4
+ classTop?: string;
5
+ [key: string]: any;
6
+ };
7
+
8
+ export interface NavbarElementProps {
9
+ children?: any;
10
+ class?: string;
11
+ classTop?: string;
12
+ href?: string;
13
+ [key: string]: any;
14
14
  }
@@ -1,6 +1,6 @@
1
- export interface SEOProps {
2
- websiteName: string;
3
- title?: string;
4
- description?: string;
5
- image?: any;
1
+ export interface SEOProps {
2
+ websiteName: string;
3
+ title?: string;
4
+ description?: string;
5
+ image?: any;
6
6
  }
@@ -1,17 +1,17 @@
1
- export type TypewriterAction =
2
- | { type: "write", value: string | (() => string), color?: string | (() => string), minspeed?: number, maxspeed?: number, label?: string }
3
- | { type: "delete", to: string, minspeed?: number, maxspeed?: number, label?: string }
4
- | { type: "pause", duration: number, label?: string }
5
- | { type: "jump", position: string, label?: string };
6
-
7
- export interface DisplaySegment {
8
- text: string;
9
- color?: string;
10
- label?: string;
11
- };
12
-
13
- export interface TypewriterProps {
14
- actions: TypewriterAction[];
15
- class?: string;
16
- [key: string]: any;
1
+ export type TypewriterAction =
2
+ | { type: "write", value: string | (() => string), color?: string | (() => string), minspeed?: number, maxspeed?: number, label?: string }
3
+ | { type: "delete", to: string, minspeed?: number, maxspeed?: number, label?: string }
4
+ | { type: "pause", duration: number, label?: string }
5
+ | { type: "jump", position: string, label?: string };
6
+
7
+ export interface DisplaySegment {
8
+ text: string;
9
+ color?: string;
10
+ label?: string;
11
+ };
12
+
13
+ export interface TypewriterProps {
14
+ actions: TypewriterAction[];
15
+ class?: string;
16
+ [key: string]: any;
17
17
  }
package/package.json CHANGED
@@ -1,58 +1,58 @@
1
- {
2
- "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.34",
4
- "description": "Component Library used across all my projects",
5
- "author": "Valerius Petrini Jr.",
6
- "license": "MIT",
7
- "scripts": {
8
- "dev": "vite dev",
9
- "build": "vite build && npm run prepack",
10
- "preview": "vite preview",
11
- "prepare": "svelte-kit sync || echo ''",
12
- "prepack": "svelte-kit sync && svelte-package && publint",
13
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
14
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
15
- },
16
- "files": [
17
- "dist",
18
- "!dist/**/*.test.*",
19
- "!dist/**/*.spec.*"
20
- ],
21
- "sideEffects": [
22
- "**/*.css"
23
- ],
24
- "svelte": "./dist/index.js",
25
- "types": "./dist/index.d.ts",
26
- "type": "module",
27
- "exports": {
28
- ".": {
29
- "types": "./dist/index.d.ts",
30
- "svelte": "./dist/index.js"
31
- }
32
- },
33
- "peerDependencies": {
34
- "svelte": "^5.0.0"
35
- },
36
- "devDependencies": {
37
- "@sveltejs/adapter-auto": "^7.0.0",
38
- "@sveltejs/kit": "^2.50.2",
39
- "@sveltejs/package": "^2.5.7",
40
- "@sveltejs/vite-plugin-svelte": "^6.2.4",
41
- "@tailwindcss/forms": "^0.5.11",
42
- "@tailwindcss/typography": "^0.5.19",
43
- "@tailwindcss/vite": "^4.1.18",
44
- "publint": "^0.3.17",
45
- "svelte": "^5.51.0",
46
- "svelte-check": "^4.4.2",
47
- "tailwindcss": "^4.1.18",
48
- "typescript": "^5.9.3",
49
- "vite": "^7.3.1"
50
- },
51
- "keywords": [
52
- "components",
53
- "svelte"
54
- ],
55
- "dependencies": {
56
- "tailwind-merge": "^3.5.0"
57
- }
58
- }
1
+ {
2
+ "name": "@valerius_petrini/corekit-ui",
3
+ "version": "0.1.35",
4
+ "description": "Component Library used across all my projects",
5
+ "author": "Valerius Petrini Jr.",
6
+ "license": "MIT",
7
+ "scripts": {
8
+ "dev": "vite dev",
9
+ "build": "vite build && npm run prepack",
10
+ "preview": "vite preview",
11
+ "prepare": "svelte-kit sync || echo ''",
12
+ "prepack": "svelte-kit sync && svelte-package && publint",
13
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
14
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "!dist/**/*.test.*",
19
+ "!dist/**/*.spec.*"
20
+ ],
21
+ "sideEffects": [
22
+ "**/*.css"
23
+ ],
24
+ "svelte": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "svelte": "./dist/index.js"
31
+ }
32
+ },
33
+ "peerDependencies": {
34
+ "svelte": "^5.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "@sveltejs/adapter-auto": "^7.0.0",
38
+ "@sveltejs/kit": "^2.50.2",
39
+ "@sveltejs/package": "^2.5.7",
40
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
41
+ "@tailwindcss/forms": "^0.5.11",
42
+ "@tailwindcss/typography": "^0.5.19",
43
+ "@tailwindcss/vite": "^4.1.18",
44
+ "publint": "^0.3.17",
45
+ "svelte": "^5.51.0",
46
+ "svelte-check": "^4.4.2",
47
+ "tailwindcss": "^4.1.18",
48
+ "typescript": "^5.9.3",
49
+ "vite": "^7.3.1"
50
+ },
51
+ "keywords": [
52
+ "components",
53
+ "svelte"
54
+ ],
55
+ "dependencies": {
56
+ "tailwind-merge": "^3.5.0"
57
+ }
58
+ }