@valerius_petrini/corekit-ui 0.1.49 → 0.1.51
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/dist/index.d.ts +15 -14
- package/dist/index.js +14 -13
- package/package.json +3 -3
- package/dist/actions/fbm.d.ts +0 -10
- package/dist/actions/fbm.js +0 -199
- package/dist/components/Analytics.svelte +0 -28
- package/dist/components/Analytics.svelte.d.ts +0 -4
- package/dist/components/Button.svelte +0 -64
- package/dist/components/Button.svelte.d.ts +0 -4
- package/dist/components/Card.svelte +0 -24
- package/dist/components/Card.svelte.d.ts +0 -4
- package/dist/components/Checkbox.svelte +0 -35
- package/dist/components/Checkbox.svelte.d.ts +0 -4
- package/dist/components/FloatingInput.svelte +0 -78
- package/dist/components/FloatingInput.svelte.d.ts +0 -4
- package/dist/components/FloatingSelect.svelte +0 -39
- package/dist/components/FloatingSelect.svelte.d.ts +0 -4
- package/dist/components/Navbar.svelte +0 -30
- package/dist/components/Navbar.svelte.d.ts +0 -4
- package/dist/components/NavbarElement.svelte +0 -35
- package/dist/components/NavbarElement.svelte.d.ts +0 -4
- package/dist/components/NavbarSeparator.svelte +0 -1
- package/dist/components/NavbarSeparator.svelte.d.ts +0 -26
- package/dist/components/SEO.svelte +0 -43
- package/dist/components/SEO.svelte.d.ts +0 -4
- package/dist/components/Text.svelte +0 -65
- package/dist/components/Text.svelte.d.ts +0 -4
- package/dist/components/Typewriter.svelte +0 -86
- package/dist/components/Typewriter.svelte.d.ts +0 -4
- package/dist/styles/color.d.ts +0 -4
- package/dist/styles/color.js +0 -62
- package/dist/styles/layout.css +0 -44
- package/dist/styles/size.d.ts +0 -15
- package/dist/styles/size.js +0 -92
- package/dist/types/Analytics.d.ts +0 -3
- package/dist/types/Button.d.ts +0 -17
- package/dist/types/Card.d.ts +0 -6
- package/dist/types/Checkbox.d.ts +0 -9
- package/dist/types/FloatingInput.d.ts +0 -13
- package/dist/types/FloatingSelect.d.ts +0 -10
- package/dist/types/Navbar.d.ts +0 -17
- package/dist/types/SEO.d.ts +0 -6
- package/dist/types/Text.d.ts +0 -10
- package/dist/types/Typewriter.d.ts +0 -18
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { default as Button } from "
|
|
2
|
-
export { default as Typewriter } from "
|
|
3
|
-
export { default as Analytics } from "
|
|
4
|
-
export { default as SEO } from "
|
|
5
|
-
export { default as Navbar } from "
|
|
6
|
-
export { default as NavbarSeparator } from "
|
|
7
|
-
export { default as NavbarElement } from "
|
|
8
|
-
export { default as FloatingInput } from "
|
|
9
|
-
export { default as FloatingSelect } from "
|
|
10
|
-
export { default as Text } from "
|
|
11
|
-
export { default as Card } from "
|
|
12
|
-
export { default as Checkbox } from "
|
|
13
|
-
export {
|
|
14
|
-
export
|
|
1
|
+
export { default as Button } from "../components/Button.svelte";
|
|
2
|
+
export { default as Typewriter } from "../components/Typewriter.svelte";
|
|
3
|
+
export { default as Analytics } from "../components/Analytics.svelte";
|
|
4
|
+
export { default as SEO } from "../components/SEO.svelte";
|
|
5
|
+
export { default as Navbar } from "../components/Navbar.svelte";
|
|
6
|
+
export { default as NavbarSeparator } from "../components/NavbarSeparator.svelte";
|
|
7
|
+
export { default as NavbarElement } from "../components/NavbarElement.svelte";
|
|
8
|
+
export { default as FloatingInput } from "../components/FloatingInput.svelte";
|
|
9
|
+
export { default as FloatingSelect } from "../components/FloatingSelect.svelte";
|
|
10
|
+
export { default as Text } from "../components/Text.svelte";
|
|
11
|
+
export { default as Card } from "../components/Card.svelte";
|
|
12
|
+
export { default as Checkbox } from "../components/Checkbox.svelte";
|
|
13
|
+
export { default as Progress } from "../components/Progress.svelte";
|
|
14
|
+
export { fbmBackground } from "../actions/fbm.ts";
|
|
15
|
+
export type { TypewriterAction, DisplaySegment } from "../types/Typewriter.d.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export { default as Button } from "
|
|
2
|
-
export { default as Typewriter } from "
|
|
3
|
-
export { default as Analytics } from "
|
|
4
|
-
export { default as SEO } from "
|
|
5
|
-
export { default as Navbar } from "
|
|
6
|
-
export { default as NavbarSeparator } from "
|
|
7
|
-
export { default as NavbarElement } from "
|
|
8
|
-
export { default as FloatingInput } from "
|
|
9
|
-
export { default as FloatingSelect } from "
|
|
10
|
-
export { default as Text } from "
|
|
11
|
-
export { default as Card } from "
|
|
12
|
-
export { default as Checkbox } from "
|
|
13
|
-
export {
|
|
1
|
+
export { default as Button } from "../components/Button.svelte";
|
|
2
|
+
export { default as Typewriter } from "../components/Typewriter.svelte";
|
|
3
|
+
export { default as Analytics } from "../components/Analytics.svelte";
|
|
4
|
+
export { default as SEO } from "../components/SEO.svelte";
|
|
5
|
+
export { default as Navbar } from "../components/Navbar.svelte";
|
|
6
|
+
export { default as NavbarSeparator } from "../components/NavbarSeparator.svelte";
|
|
7
|
+
export { default as NavbarElement } from "../components/NavbarElement.svelte";
|
|
8
|
+
export { default as FloatingInput } from "../components/FloatingInput.svelte";
|
|
9
|
+
export { default as FloatingSelect } from "../components/FloatingSelect.svelte";
|
|
10
|
+
export { default as Text } from "../components/Text.svelte";
|
|
11
|
+
export { default as Card } from "../components/Card.svelte";
|
|
12
|
+
export { default as Checkbox } from "../components/Checkbox.svelte";
|
|
13
|
+
export { default as Progress } from "../components/Progress.svelte";
|
|
14
|
+
export { fbmBackground } from "../actions/fbm.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valerius_petrini/corekit-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.51",
|
|
4
4
|
"description": "Component Library used across all my projects",
|
|
5
5
|
"author": "Valerius Petrini Jr.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
".": {
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"svelte": "./dist/index.js"
|
|
31
|
-
}
|
|
32
|
-
"./layout.css": "./dist/styles/layout.css"
|
|
31
|
+
}
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
34
|
"svelte": "^5.0.0"
|
|
@@ -54,6 +53,7 @@
|
|
|
54
53
|
"svelte"
|
|
55
54
|
],
|
|
56
55
|
"dependencies": {
|
|
56
|
+
"@lucide/svelte": "^1.3.0",
|
|
57
57
|
"tailwind-merge": "^3.5.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/dist/actions/fbm.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface FBMBackgroundOptions {
|
|
2
|
-
octaves?: number;
|
|
3
|
-
warps?: number;
|
|
4
|
-
scale?: number;
|
|
5
|
-
seed?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function fbmBackground(canvas: HTMLCanvasElement, options?: FBMBackgroundOptions): {
|
|
8
|
-
update(newOptions: FBMBackgroundOptions): void;
|
|
9
|
-
destroy(): void;
|
|
10
|
-
} | undefined;
|
package/dist/actions/fbm.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
const FBM_VERTEX_SHADER_SOURCE = `
|
|
2
|
-
attribute vec4 aVertexPosition;
|
|
3
|
-
|
|
4
|
-
void main() {
|
|
5
|
-
gl_Position = aVertexPosition;
|
|
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);
|
|
70
|
-
}`;
|
|
71
|
-
function loadShaders(gl, type, source) {
|
|
72
|
-
const shader = gl.createShader(type);
|
|
73
|
-
if (!shader) {
|
|
74
|
-
console.error("Unable to create shader");
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
gl.shaderSource(shader, source);
|
|
78
|
-
gl.compileShader(shader);
|
|
79
|
-
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
80
|
-
console.error("An error occurred compiling the shaders: " + gl.getShaderInfoLog(shader));
|
|
81
|
-
gl.deleteShader(shader);
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
return shader;
|
|
85
|
-
}
|
|
86
|
-
function initializeShaders(gl, vertexSource, fragmentSource) {
|
|
87
|
-
const vertexShader = loadShaders(gl, gl.VERTEX_SHADER, vertexSource);
|
|
88
|
-
const fragmentShader = loadShaders(gl, gl.FRAGMENT_SHADER, fragmentSource);
|
|
89
|
-
if (!vertexShader || !fragmentShader)
|
|
90
|
-
return null;
|
|
91
|
-
const shaderProgram = gl.createProgram();
|
|
92
|
-
if (!shaderProgram) {
|
|
93
|
-
console.error("Unable to create shader program");
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
gl.attachShader(shaderProgram, vertexShader);
|
|
97
|
-
gl.attachShader(shaderProgram, fragmentShader);
|
|
98
|
-
gl.linkProgram(shaderProgram);
|
|
99
|
-
if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) {
|
|
100
|
-
console.error("Unable to initialize the shader program: " + gl.getProgramInfoLog(shaderProgram));
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
return shaderProgram;
|
|
104
|
-
}
|
|
105
|
-
function initBuffers(gl) {
|
|
106
|
-
const positionBuffer = gl.createBuffer();
|
|
107
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
|
|
108
|
-
const vertices = new Float32Array([
|
|
109
|
-
-1.0, -1.0,
|
|
110
|
-
1.0, -1.0,
|
|
111
|
-
-1.0, 1.0,
|
|
112
|
-
1.0, 1.0,
|
|
113
|
-
]);
|
|
114
|
-
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
|
115
|
-
return {
|
|
116
|
-
position: positionBuffer,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
export function fbmBackground(canvas, options = {}) {
|
|
120
|
-
let gl = canvas.getContext("webgl", { antialias: true, premultipliedAlpha: false, preserveDrawingBuffer: true });
|
|
121
|
-
if (!gl) {
|
|
122
|
-
console.error("WebGL not supported");
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
let currentOptions = { ...options };
|
|
126
|
-
let internalSeed = options.seed ?? Math.random() * 1000;
|
|
127
|
-
const shaderProgram = initializeShaders(gl, FBM_VERTEX_SHADER_SOURCE, FBM_FRAGMENT_SHADER_SOURCE);
|
|
128
|
-
if (!shaderProgram) {
|
|
129
|
-
console.error("Failed to initialize shaders");
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const programInfo = {
|
|
133
|
-
program: shaderProgram,
|
|
134
|
-
attribLocations: {
|
|
135
|
-
vertexPosition: gl.getAttribLocation(shaderProgram, "aVertexPosition"),
|
|
136
|
-
},
|
|
137
|
-
uniformLocations: {
|
|
138
|
-
resolution: gl.getUniformLocation(shaderProgram, "u_resolution"),
|
|
139
|
-
seed: gl.getUniformLocation(shaderProgram, "u_seed"),
|
|
140
|
-
scale: gl.getUniformLocation(shaderProgram, "u_scale"),
|
|
141
|
-
octaves: gl.getUniformLocation(shaderProgram, "u_octaves"),
|
|
142
|
-
warp: gl.getUniformLocation(shaderProgram, "u_warp"),
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const buffers = initBuffers(gl);
|
|
146
|
-
function updateCanvasSize() {
|
|
147
|
-
const DPR = window.devicePixelRatio || 1;
|
|
148
|
-
const newWidth = Math.floor(canvas.offsetWidth * DPR);
|
|
149
|
-
const newHeight = Math.floor(canvas.offsetHeight * DPR);
|
|
150
|
-
if (canvas.width !== newWidth || canvas.height !== newHeight) {
|
|
151
|
-
canvas.width = newWidth;
|
|
152
|
-
canvas.height = newHeight;
|
|
153
|
-
if (gl)
|
|
154
|
-
gl.viewport(0, 0, canvas.width, canvas.height);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function render() {
|
|
158
|
-
updateCanvasSize();
|
|
159
|
-
if (!gl)
|
|
160
|
-
return;
|
|
161
|
-
gl.viewport(0, 0, canvas.width, canvas.height);
|
|
162
|
-
gl.clearColor(0, 0, 0, 1);
|
|
163
|
-
gl.clearDepth(1.0);
|
|
164
|
-
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
165
|
-
gl.enable(gl.DEPTH_TEST);
|
|
166
|
-
gl.depthFunc(gl.LEQUAL);
|
|
167
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffers.position);
|
|
168
|
-
gl.vertexAttribPointer(programInfo.attribLocations.vertexPosition, 2, gl.FLOAT, false, 0, 0);
|
|
169
|
-
gl.enableVertexAttribArray(programInfo.attribLocations.vertexPosition);
|
|
170
|
-
gl.useProgram(programInfo.program);
|
|
171
|
-
gl.uniform2f(programInfo.uniformLocations.resolution, canvas.width, canvas.height);
|
|
172
|
-
gl.uniform1f(programInfo.uniformLocations.seed, currentOptions.seed ?? internalSeed);
|
|
173
|
-
gl.uniform1i(programInfo.uniformLocations.octaves, currentOptions.octaves ?? 4);
|
|
174
|
-
gl.uniform1i(programInfo.uniformLocations.warp, currentOptions.warps ?? 2);
|
|
175
|
-
gl.uniform1f(programInfo.uniformLocations.scale, currentOptions.scale ?? 2);
|
|
176
|
-
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
177
|
-
}
|
|
178
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
179
|
-
requestAnimationFrame(render);
|
|
180
|
-
});
|
|
181
|
-
resizeObserver.observe(canvas);
|
|
182
|
-
render();
|
|
183
|
-
return {
|
|
184
|
-
update(newOptions) {
|
|
185
|
-
const changed = JSON.stringify(currentOptions) !== JSON.stringify(newOptions);
|
|
186
|
-
if (changed) {
|
|
187
|
-
currentOptions = { ...newOptions };
|
|
188
|
-
render();
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
destroy() {
|
|
192
|
-
resizeObserver.disconnect();
|
|
193
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
194
|
-
gl.deleteBuffer(buffers.position);
|
|
195
|
-
gl.deleteProgram(shaderProgram);
|
|
196
|
-
gl.getExtension("WEBGL_lose_context")?.loseContext();
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
-
</svelte:head>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { generateColorStyle } from "../styles/color.js";
|
|
3
|
-
import { sizeStyleParts, type SizeStyle } from "../styles/size.js";
|
|
4
|
-
import type { ButtonProps } from "../types/Button.js";
|
|
5
|
-
import { twMerge } from "tailwind-merge";
|
|
6
|
-
|
|
7
|
-
let {
|
|
8
|
-
children = undefined,
|
|
9
|
-
class: className = "",
|
|
10
|
-
pill = false,
|
|
11
|
-
icon = false,
|
|
12
|
-
href = undefined,
|
|
13
|
-
color = "none",
|
|
14
|
-
variant = "full",
|
|
15
|
-
disabled = false,
|
|
16
|
-
external = false,
|
|
17
|
-
size = "md",
|
|
18
|
-
radius = "md",
|
|
19
|
-
...restProps
|
|
20
|
-
}: ButtonProps = $props();
|
|
21
|
-
|
|
22
|
-
const sizeClasses = $derived.by(() => {
|
|
23
|
-
if (typeof size === "string") {
|
|
24
|
-
const parts = sizeStyleParts[size as SizeStyle];
|
|
25
|
-
return icon ? parts.buttonIcon : parts.button;
|
|
26
|
-
}
|
|
27
|
-
return icon ? "p-0 flex-none" : "h-fit";
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const customStyle = $derived(
|
|
31
|
-
typeof size === "number"
|
|
32
|
-
? `width: ${size}px; height: ${size}px; flex: none;`
|
|
33
|
-
: ""
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const defaultClass = "inline-flex items-center justify-center gap-2 transition-colors duration-300 text-white whitespace-nowrap";
|
|
37
|
-
const radiusClass = $derived(pill || icon ? "rounded-full" : sizeStyleParts[radius as SizeStyle].radius);
|
|
38
|
-
const disabledClass = $derived(disabled ? "opacity-50 pointer-events-none" : "cursor-pointer");
|
|
39
|
-
|
|
40
|
-
const mergedClass = $derived(twMerge(
|
|
41
|
-
defaultClass,
|
|
42
|
-
generateColorStyle(color, variant),
|
|
43
|
-
disabledClass,
|
|
44
|
-
sizeClasses,
|
|
45
|
-
radiusClass,
|
|
46
|
-
className
|
|
47
|
-
));
|
|
48
|
-
|
|
49
|
-
const mergedStyle = $derived([customStyle, restProps.style].filter(Boolean).join("; "));
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<svelte:element
|
|
53
|
-
this={href ? "a" : "button"}
|
|
54
|
-
class={mergedClass}
|
|
55
|
-
{disabled}
|
|
56
|
-
aria-disabled={disabled}
|
|
57
|
-
type={href ? undefined : (restProps.type || "button")}
|
|
58
|
-
style={mergedStyle}
|
|
59
|
-
target={external ? "_blank" : undefined}
|
|
60
|
-
rel={external ? "noopener noreferrer" : undefined}
|
|
61
|
-
{...(href ? { href } : {})}
|
|
62
|
-
{...restProps}>
|
|
63
|
-
{@render children?.()}
|
|
64
|
-
</svelte:element>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { CardProps } from "../types/Card.js";
|
|
3
|
-
import type { SvelteComponent } from "svelte";
|
|
4
|
-
import { twMerge } from "tailwind-merge";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children = undefined,
|
|
8
|
-
class: className = "",
|
|
9
|
-
href = undefined,
|
|
10
|
-
...restProps
|
|
11
|
-
}: CardProps = $props();
|
|
12
|
-
|
|
13
|
-
let defaultClass = "text-main-text shadow-xl rounded-lg transition-colors bg-sub-background hover:bg-sub-background-hover p-4";
|
|
14
|
-
let combinedClass = $derived(twMerge(defaultClass, className));
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<svelte:element
|
|
18
|
-
this={href ? "a" : "div"}
|
|
19
|
-
class={combinedClass}
|
|
20
|
-
{...(href ? { href } : {})}
|
|
21
|
-
{...restProps}
|
|
22
|
-
>
|
|
23
|
-
{@render children?.()}
|
|
24
|
-
</svelte:element>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { twMerge } from "tailwind-merge";
|
|
3
|
-
import Text from "./Text.svelte";
|
|
4
|
-
import type { CheckboxProps } from "../types/Checkbox.js";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children = undefined,
|
|
8
|
-
class: className = "",
|
|
9
|
-
labelClass = "",
|
|
10
|
-
divClass = "",
|
|
11
|
-
checked = $bindable(),
|
|
12
|
-
id = crypto.randomUUID(),
|
|
13
|
-
...restProps
|
|
14
|
-
}: CheckboxProps = $props();
|
|
15
|
-
|
|
16
|
-
let defaultClass = "z-20 bg-form-input-background text-main-text rounded-lg outline-none focus:ring-2 focus:ring-blue-500 transition-all";
|
|
17
|
-
let defaultLabelClass = "block text-sub-text font-medium";
|
|
18
|
-
let defaultDivClass = "relative flex items-center gap-2";
|
|
19
|
-
|
|
20
|
-
let combinedLabelClass = $derived(twMerge(defaultLabelClass, labelClass));
|
|
21
|
-
let combinedClass = $derived(twMerge(defaultClass, className));
|
|
22
|
-
let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<div class={combinedDivClass}>
|
|
26
|
-
<input
|
|
27
|
-
type="checkbox"
|
|
28
|
-
id={id}
|
|
29
|
-
bind:checked={checked}
|
|
30
|
-
class={combinedClass}
|
|
31
|
-
{...restProps}/>
|
|
32
|
-
<Text tag="label" for={id} class={combinedLabelClass}>
|
|
33
|
-
{@render children?.()}
|
|
34
|
-
</Text>
|
|
35
|
-
</div>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { FloatingInputProps } from "../types/FloatingInput.js";
|
|
3
|
-
import { twMerge } from "tailwind-merge";
|
|
4
|
-
import Text from "./Text.svelte";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children = undefined,
|
|
8
|
-
class: className = "",
|
|
9
|
-
labelClass = "",
|
|
10
|
-
divClass = "",
|
|
11
|
-
value = $bindable(),
|
|
12
|
-
onfocus = undefined,
|
|
13
|
-
onblur = undefined,
|
|
14
|
-
isTextArea = false,
|
|
15
|
-
validInputRegex = undefined,
|
|
16
|
-
id = crypto.randomUUID(),
|
|
17
|
-
...restProps
|
|
18
|
-
}: FloatingInputProps = $props();
|
|
19
|
-
|
|
20
|
-
let isFocused = $state(false);
|
|
21
|
-
let touched = $state(false);
|
|
22
|
-
|
|
23
|
-
let hasContent = $derived(value !== undefined && value !== null && value.toString().length > 0);
|
|
24
|
-
let isValid = $derived(!touched || !validInputRegex || validInputRegex.test(value || ""));
|
|
25
|
-
|
|
26
|
-
let defaultClass = "z-20 bg-form-input-background text-main-text w-full rounded px-2 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
|
|
27
|
-
let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
|
|
28
|
-
let defaultDivClass = "relative";
|
|
29
|
-
|
|
30
|
-
let originalLabelClass = "left-2 z-0";
|
|
31
|
-
let originalLabelClassInput = "top-1/2 transform -translate-y-1/2";
|
|
32
|
-
let originalLabelClassTextArea = "top-2";
|
|
33
|
-
let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]!";
|
|
34
|
-
|
|
35
|
-
let invalidClass = "border border-red-500 focus:ring-red-500";
|
|
36
|
-
|
|
37
|
-
let labelClassFull = $derived(twMerge(isTextArea ? originalLabelClassTextArea : originalLabelClassInput, originalLabelClass));
|
|
38
|
-
|
|
39
|
-
let combinedLabelClass = $derived(twMerge(defaultLabelClass, isFocused || hasContent ? selectedLabelClass : labelClassFull, labelClass));
|
|
40
|
-
let combinedClass = $derived(twMerge(defaultClass, className, isValid ? "" : invalidClass));
|
|
41
|
-
let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
|
|
42
|
-
|
|
43
|
-
function handleFocus(e: FocusEvent) {
|
|
44
|
-
isFocused = true;
|
|
45
|
-
onfocus?.(e);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function handleBlur(e: FocusEvent) {
|
|
49
|
-
isFocused = false;
|
|
50
|
-
touched = true;
|
|
51
|
-
onblur?.(e);
|
|
52
|
-
}
|
|
53
|
-
</script>
|
|
54
|
-
|
|
55
|
-
<div class={combinedDivClass}>
|
|
56
|
-
<Text tag="label" for={id} class={combinedLabelClass}>
|
|
57
|
-
{@render children?.()}
|
|
58
|
-
</Text>
|
|
59
|
-
{#if isTextArea}
|
|
60
|
-
<textarea
|
|
61
|
-
{id}
|
|
62
|
-
bind:value={value}
|
|
63
|
-
onfocus={handleFocus}
|
|
64
|
-
onblur={handleBlur}
|
|
65
|
-
class={combinedClass}
|
|
66
|
-
{...restProps}
|
|
67
|
-
></textarea>
|
|
68
|
-
{:else}
|
|
69
|
-
<input
|
|
70
|
-
{id}
|
|
71
|
-
bind:value={value}
|
|
72
|
-
onfocus={handleFocus}
|
|
73
|
-
onblur={handleBlur}
|
|
74
|
-
class={combinedClass}
|
|
75
|
-
{...restProps}
|
|
76
|
-
/>
|
|
77
|
-
{/if}
|
|
78
|
-
</div>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { FloatingSelectProps } from "../types/FloatingSelect.js";
|
|
3
|
-
import { twMerge } from "tailwind-merge";
|
|
4
|
-
import Text from "./Text.svelte";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children = undefined,
|
|
8
|
-
class: className = "",
|
|
9
|
-
divClass = "",
|
|
10
|
-
optionClass = "",
|
|
11
|
-
value = $bindable(),
|
|
12
|
-
options = [],
|
|
13
|
-
id = crypto.randomUUID(),
|
|
14
|
-
...restProps
|
|
15
|
-
}: FloatingSelectProps = $props();
|
|
16
|
-
|
|
17
|
-
let defaultSelectClass = "cursor-pointer bg-form-input-background text-main-text z-20 w-full rounded px-1 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
|
|
18
|
-
let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
|
|
19
|
-
let defaultDivClass = "relative w-fit";
|
|
20
|
-
|
|
21
|
-
let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]!";
|
|
22
|
-
|
|
23
|
-
let combinedLabelClass = $derived(twMerge(defaultLabelClass, selectedLabelClass, className));
|
|
24
|
-
let combinedSelectClass = $derived(twMerge(defaultSelectClass, className));
|
|
25
|
-
let combinedDivClass = $derived(twMerge(defaultDivClass, divClass));
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<div class={combinedDivClass}>
|
|
29
|
-
<Text tag="label" for={id} class={combinedLabelClass}>
|
|
30
|
-
{@render children?.()}
|
|
31
|
-
</Text>
|
|
32
|
-
<select {id} class={combinedSelectClass} {...restProps} bind:value={value}>
|
|
33
|
-
{#each options as option}
|
|
34
|
-
<option value={option.value} class={optionClass}>
|
|
35
|
-
{option.label}
|
|
36
|
-
</option>
|
|
37
|
-
{/each}
|
|
38
|
-
</select>
|
|
39
|
-
</div>
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
threshold = 10,
|
|
11
|
-
...restProps
|
|
12
|
-
}: NavbarProps = $props();
|
|
13
|
-
|
|
14
|
-
let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-main-background/99 border-b-sub-background border-box border-b";
|
|
15
|
-
|
|
16
|
-
let scrollY = $state(0);
|
|
17
|
-
let isAtTop = $derived(scrollY <= threshold);
|
|
18
|
-
|
|
19
|
-
const combinedClass = $derived(twMerge(
|
|
20
|
-
defaultClass,
|
|
21
|
-
className,
|
|
22
|
-
isAtTop ? classTop : ""
|
|
23
|
-
));
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<svelte:window bind:scrollY={scrollY}/>
|
|
27
|
-
|
|
28
|
-
<nav class={combinedClass} {...restProps}>
|
|
29
|
-
{@render children?.()}
|
|
30
|
-
</nav>
|