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.
- package/README.md +12 -32
- package/dist/index.d.ts +0 -0
- package/dist/index.js +2 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +4 -0
- package/dist/theme/logic.d.ts +24 -0
- package/dist/theme/logic.js +80 -0
- package/dist/theme/state.svelte.d.ts +24 -0
- package/dist/theme/state.svelte.js +33 -0
- package/dist/theme/theme-init/components/theme-init.svelte +85 -0
- package/dist/theme/theme-init/components/theme-init.svelte.d.ts +13 -0
- package/dist/theme/theme-init/index.d.ts +2 -0
- package/dist/theme/theme-init/index.js +1 -0
- package/dist/theme/theme-init/types.d.ts +15 -0
- package/dist/theme/theme-init/types.js +1 -0
- package/dist/theme/theme.css +162 -0
- package/dist/theme/types.d.ts +4 -0
- package/dist/theme/types.js +12 -0
- package/dist/ui/button/components/button.svelte +33 -0
- package/dist/ui/button/components/button.svelte.d.ts +11 -0
- package/dist/ui/button/index.d.ts +2 -0
- package/dist/ui/button/index.js +1 -0
- package/dist/ui/button/types.d.ts +5 -0
- package/dist/ui/button/types.js +1 -0
- package/dist/ui/flex/components/flex.svelte +28 -0
- package/dist/ui/flex/components/flex.svelte.d.ts +10 -0
- package/dist/ui/flex/index.d.ts +2 -0
- package/dist/ui/flex/index.js +1 -0
- package/dist/ui/flex/types.d.ts +2 -0
- package/dist/ui/flex/types.js +1 -0
- package/dist/ui/frame/components/frame.svelte +133 -0
- package/dist/ui/frame/components/frame.svelte.d.ts +22 -0
- package/dist/ui/frame/index.d.ts +2 -0
- package/dist/ui/frame/index.js +1 -0
- package/dist/ui/frame/types.d.ts +33 -0
- package/dist/ui/frame/types.js +1 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/input/components/input.svelte +75 -0
- package/dist/ui/input/components/input.svelte.d.ts +10 -0
- package/dist/ui/input/index.d.ts +2 -0
- package/dist/ui/input/index.js +1 -0
- package/dist/ui/input/types.d.ts +6 -0
- package/dist/ui/input/types.js +1 -0
- package/dist/ui/spacer/components/spacer.svelte +50 -0
- package/dist/ui/spacer/components/spacer.svelte.d.ts +17 -0
- package/dist/ui/spacer/index.d.ts +2 -0
- package/dist/ui/spacer/index.js +1 -0
- package/dist/ui/spacer/types.d.ts +7 -0
- package/dist/ui/spacer/types.js +1 -0
- package/dist/ui/text/components/text.svelte +90 -0
- package/dist/ui/text/components/text.svelte.d.ts +5 -0
- package/dist/ui/text/index.d.ts +2 -0
- package/dist/ui/text/index.js +1 -0
- package/dist/ui/text/types.d.ts +34 -0
- package/dist/ui/text/types.js +25 -0
- package/dist/utils/classname.d.ts +72 -0
- package/dist/utils/classname.js +107 -0
- 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 +32 -38
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// --- Logic ---
|
|
3
|
+
import { cn, Tokenizer } from '../../../utils/classname';
|
|
4
|
+
import type { Props } from '..';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
class: className = $bindable(undefined),
|
|
9
|
+
|
|
10
|
+
// Flex Box
|
|
11
|
+
flex = $bindable(undefined),
|
|
12
|
+
row = $bindable(undefined),
|
|
13
|
+
col = $bindable(undefined),
|
|
14
|
+
|
|
15
|
+
// Positioning
|
|
16
|
+
center = $bindable(undefined),
|
|
17
|
+
centerx = $bindable(undefined),
|
|
18
|
+
centery = $bindable(undefined),
|
|
19
|
+
|
|
20
|
+
// Size Fillings
|
|
21
|
+
fill = $bindable(undefined),
|
|
22
|
+
fillw = $bindable(undefined),
|
|
23
|
+
fillh = $bindable(undefined),
|
|
24
|
+
|
|
25
|
+
// Flex Config
|
|
26
|
+
noshrink = $bindable(undefined),
|
|
27
|
+
|
|
28
|
+
// Aspect Ratios
|
|
29
|
+
aspectSquare = $bindable(undefined),
|
|
30
|
+
|
|
31
|
+
// Cursor options
|
|
32
|
+
cursorAuto = $bindable(undefined),
|
|
33
|
+
cursorDefault = $bindable(undefined),
|
|
34
|
+
cursorPointer = $bindable(undefined),
|
|
35
|
+
|
|
36
|
+
// Theme Colors
|
|
37
|
+
background = $bindable(undefined),
|
|
38
|
+
primary = $bindable(undefined),
|
|
39
|
+
primaryContainer = $bindable(undefined),
|
|
40
|
+
secondary = $bindable(undefined),
|
|
41
|
+
secondaryContainer = $bindable(undefined),
|
|
42
|
+
tertiary = $bindable(undefined),
|
|
43
|
+
tertiaryContainer = $bindable(undefined),
|
|
44
|
+
error = $bindable(undefined),
|
|
45
|
+
surface = $bindable(undefined),
|
|
46
|
+
surfaceVariant = $bindable(undefined),
|
|
47
|
+
outline = $bindable(undefined),
|
|
48
|
+
outlineVariant = $bindable(undefined),
|
|
49
|
+
shadow = $bindable(undefined),
|
|
50
|
+
scrim = $bindable(undefined),
|
|
51
|
+
inverseSurface = $bindable(undefined),
|
|
52
|
+
inversePrimary = $bindable(undefined),
|
|
53
|
+
|
|
54
|
+
...rest
|
|
55
|
+
}: Props = $props();
|
|
56
|
+
|
|
57
|
+
const tokenInstance = new Tokenizer(className);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
function addTokenIf(statement: any, token: string) {
|
|
61
|
+
if (statement === true) {
|
|
62
|
+
className += ` ${token}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Flex Box
|
|
67
|
+
tokenInstance.addTokenIf(flex, 'flex');
|
|
68
|
+
tokenInstance.addTokenIf(row, 'flex-row');
|
|
69
|
+
tokenInstance.addTokenIf(col, 'flex-col');
|
|
70
|
+
|
|
71
|
+
// Positioning
|
|
72
|
+
tokenInstance.addTokenIf(center, 'items-center justify-center');
|
|
73
|
+
tokenInstance.addTokenIf(centerx, 'items-center');
|
|
74
|
+
tokenInstance.addTokenIf(centery, 'justify-center');
|
|
75
|
+
|
|
76
|
+
// Size Fillings
|
|
77
|
+
tokenInstance.addTokenIf(fill, 'size-full');
|
|
78
|
+
tokenInstance.addTokenIf(fillw, 'w-full');
|
|
79
|
+
tokenInstance.addTokenIf(fillh, 'h-full');
|
|
80
|
+
|
|
81
|
+
// Flex Config
|
|
82
|
+
tokenInstance.addTokenIf(noshrink, 'shrink-0');
|
|
83
|
+
|
|
84
|
+
// Aspect Ratios
|
|
85
|
+
tokenInstance.addTokenIf(aspectSquare, 'aspect-square');
|
|
86
|
+
|
|
87
|
+
// Cursor Options
|
|
88
|
+
tokenInstance.addTokenIf(cursorAuto, 'cursor-auto');
|
|
89
|
+
tokenInstance.addTokenIf(cursorDefault, 'cursor-default');
|
|
90
|
+
tokenInstance.addTokenIf(cursorPointer, 'cursor-pointer');
|
|
91
|
+
|
|
92
|
+
// Background Options
|
|
93
|
+
tokenInstance.addTokenIf(background, 'bg-background');
|
|
94
|
+
tokenInstance.addTokenIf(primary, 'bg-primary');
|
|
95
|
+
tokenInstance.addTokenIf(primaryContainer, 'bg-primary-container');
|
|
96
|
+
tokenInstance.addTokenIf(secondary, 'bg-secondary');
|
|
97
|
+
tokenInstance.addTokenIf(secondaryContainer, 'bg-secondary-container');
|
|
98
|
+
tokenInstance.addTokenIf(tertiary, 'bg-tertiary');
|
|
99
|
+
tokenInstance.addTokenIf(tertiaryContainer, 'bg-tertiary-container');
|
|
100
|
+
tokenInstance.addTokenIf(error, 'bg-error');
|
|
101
|
+
tokenInstance.addTokenIf(surface, 'bg-surface');
|
|
102
|
+
tokenInstance.addTokenIf(surfaceVariant, 'bg-surface-variant');
|
|
103
|
+
tokenInstance.addTokenIf(outline, 'bg-outline');
|
|
104
|
+
tokenInstance.addTokenIf(outlineVariant, 'bg-outline-variant');
|
|
105
|
+
tokenInstance.addTokenIf(shadow, 'bg-shadow');
|
|
106
|
+
tokenInstance.addTokenIf(scrim, 'bg-scrim');
|
|
107
|
+
tokenInstance.addTokenIf(inverseSurface, 'bg-inverse-surface');
|
|
108
|
+
tokenInstance.addTokenIf(inversePrimary, 'bg-inverse-primary');
|
|
109
|
+
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<div class={cn(tokenInstance.className)} {...rest}>
|
|
113
|
+
{@render children?.()}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
<!--@component
|
|
117
|
+
Generated by SvelteForge🔥 [Component Template]
|
|
118
|
+
|
|
119
|
+
# Frame Component
|
|
120
|
+
A simple wrapper for flexbox and other layout options.
|
|
121
|
+
This component is a wrapper for the `div` element, with additional classes and properties to control layout and styling.
|
|
122
|
+
It is designed to be used in conjunction with other components to create complex layouts.
|
|
123
|
+
|
|
124
|
+
## Usage
|
|
125
|
+
```svelte
|
|
126
|
+
<Frame class="my-frame" flex row center fill>
|
|
127
|
+
<ChildComponent />
|
|
128
|
+
</Frame>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This will create a flex container that is a row, centered, and fills the available space.
|
|
132
|
+
The `class` prop can be used to add additional classes to the frame, and the `children` prop can be used to pass in child components.
|
|
133
|
+
-->
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Props } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Generated by SvelteForge🔥 [Component Template]
|
|
4
|
+
*
|
|
5
|
+
* # Frame Component
|
|
6
|
+
* A simple wrapper for flexbox and other layout options.
|
|
7
|
+
* This component is a wrapper for the `div` element, with additional classes and properties to control layout and styling.
|
|
8
|
+
* It is designed to be used in conjunction with other components to create complex layouts.
|
|
9
|
+
*
|
|
10
|
+
* ## Usage
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <Frame class="my-frame" flex row center fill>
|
|
13
|
+
* <ChildComponent />
|
|
14
|
+
* </Frame>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* This will create a flex container that is a row, centered, and fills the available space.
|
|
18
|
+
* The `class` prop can be used to add additional classes to the frame, and the `children` prop can be used to pass in child components.
|
|
19
|
+
*/
|
|
20
|
+
declare const Frame: import("svelte").Component<Props, {}, "shadow" | "scrim" | "surfaceVariant" | "background" | "surface" | "inverseSurface" | "outline" | "outlineVariant" | "primary" | "primaryContainer" | "inversePrimary" | "secondary" | "secondaryContainer" | "tertiary" | "tertiaryContainer" | "error" | "fill" | "class" | "flex" | "row" | "col" | "centerx" | "centery" | "center" | "fillw" | "fillh" | "noshrink" | "aspectSquare" | "cursorAuto" | "cursorDefault" | "cursorPointer">;
|
|
21
|
+
type Frame = ReturnType<typeof Frame>;
|
|
22
|
+
export default Frame;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as _, default as Root } from "./components/frame.svelte";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
export type tFrameProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
flex?: boolean;
|
|
4
|
+
row?: boolean;
|
|
5
|
+
col?: boolean;
|
|
6
|
+
centerx?: boolean;
|
|
7
|
+
centery?: boolean;
|
|
8
|
+
center?: boolean;
|
|
9
|
+
fill?: boolean;
|
|
10
|
+
fillw?: boolean;
|
|
11
|
+
fillh?: boolean;
|
|
12
|
+
noshrink?: boolean;
|
|
13
|
+
aspectSquare?: boolean;
|
|
14
|
+
cursorAuto?: boolean;
|
|
15
|
+
cursorDefault?: boolean;
|
|
16
|
+
cursorPointer?: boolean;
|
|
17
|
+
background?: boolean;
|
|
18
|
+
primary?: boolean;
|
|
19
|
+
primaryContainer?: boolean;
|
|
20
|
+
secondary?: boolean;
|
|
21
|
+
secondaryContainer?: boolean;
|
|
22
|
+
tertiary?: boolean;
|
|
23
|
+
tertiaryContainer?: boolean;
|
|
24
|
+
error?: boolean;
|
|
25
|
+
surface?: boolean;
|
|
26
|
+
surfaceVariant?: boolean;
|
|
27
|
+
outline?: boolean;
|
|
28
|
+
outlineVariant?: boolean;
|
|
29
|
+
shadow?: boolean;
|
|
30
|
+
scrim?: boolean;
|
|
31
|
+
inverseSurface?: boolean;
|
|
32
|
+
inversePrimary?: boolean;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Button } from './button/components/button.svelte';
|
|
2
|
+
export { default as Flex } from './flex/components/flex.svelte';
|
|
3
|
+
export { default as Frame } from './frame/components/frame.svelte';
|
|
4
|
+
export { default as Input } from './input/components/input.svelte';
|
|
5
|
+
export { default as Spacer } from './spacer/components/spacer.svelte';
|
|
6
|
+
export { default as Text } from './text/components/text.svelte';
|
|
7
|
+
export type { tButtonProps } from './button/types';
|
|
8
|
+
export type { tFlexProps } from './flex/types';
|
|
9
|
+
export type { tFrameProps } from './frame/types';
|
|
10
|
+
export type { tInputProps } from './input/types';
|
|
11
|
+
export type { tSpacerProps } from './spacer/types';
|
|
12
|
+
export type { tTextProps } from './text/types';
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// Reexport your entry components here
|
|
4
|
+
export { default as Button } from './button/components/button.svelte';
|
|
5
|
+
export { default as Flex } from './flex/components/flex.svelte';
|
|
6
|
+
export { default as Frame } from './frame/components/frame.svelte';
|
|
7
|
+
export { default as Input } from './input/components/input.svelte';
|
|
8
|
+
export { default as Spacer } from './spacer/components/spacer.svelte';
|
|
9
|
+
export { default as Text } from './text/components/text.svelte';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// --- Logic ---
|
|
3
|
+
import { cn } from '../../../utils/classname';
|
|
4
|
+
import { uuidv4 } from '../../../utils/crypto';
|
|
5
|
+
import type { Props } from '..';
|
|
6
|
+
import { Frame } from '../..';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
|
|
11
|
+
// Classes
|
|
12
|
+
classFrame = $bindable(undefined),
|
|
13
|
+
class: className = $bindable(undefined),
|
|
14
|
+
classLabel,
|
|
15
|
+
|
|
16
|
+
// Properties
|
|
17
|
+
type = $bindable(undefined),
|
|
18
|
+
name = $bindable(undefined),
|
|
19
|
+
id = $bindable(undefined),
|
|
20
|
+
|
|
21
|
+
// Frame Passdown
|
|
22
|
+
flex = $bindable(undefined),
|
|
23
|
+
row = $bindable(undefined),
|
|
24
|
+
col = $bindable(undefined),
|
|
25
|
+
center = $bindable(undefined),
|
|
26
|
+
centerx = $bindable(undefined),
|
|
27
|
+
centery = $bindable(undefined),
|
|
28
|
+
fill = $bindable(undefined),
|
|
29
|
+
fillw = $bindable(undefined),
|
|
30
|
+
fillh = $bindable(undefined),
|
|
31
|
+
noshrink = $bindable(undefined),
|
|
32
|
+
aspectSquare = $bindable(undefined),
|
|
33
|
+
cursorAuto = $bindable(undefined),
|
|
34
|
+
cursorDefault = $bindable(undefined),
|
|
35
|
+
cursorPointer = $bindable(undefined),
|
|
36
|
+
|
|
37
|
+
...rest
|
|
38
|
+
}: Props = $props();
|
|
39
|
+
|
|
40
|
+
// Set id if not specified
|
|
41
|
+
if (!id) {
|
|
42
|
+
id = uuidv4();
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<Frame
|
|
47
|
+
{flex}
|
|
48
|
+
{row}
|
|
49
|
+
{col}
|
|
50
|
+
{center}
|
|
51
|
+
{centerx}
|
|
52
|
+
{centery}
|
|
53
|
+
{fill}
|
|
54
|
+
{fillw}
|
|
55
|
+
{fillh}
|
|
56
|
+
{noshrink}
|
|
57
|
+
{aspectSquare}
|
|
58
|
+
{cursorAuto}
|
|
59
|
+
{cursorDefault}
|
|
60
|
+
{cursorPointer}
|
|
61
|
+
class={cn(classFrame)}
|
|
62
|
+
>
|
|
63
|
+
<input class={cn(className)} {type} {name} {id} {...rest} />
|
|
64
|
+
|
|
65
|
+
{#if children}
|
|
66
|
+
<label for={id} class={cn(classLabel)}>{@render children?.()}</label>
|
|
67
|
+
{/if}
|
|
68
|
+
</Frame>
|
|
69
|
+
|
|
70
|
+
<!--@component
|
|
71
|
+
Generated by SvelteForge🔥
|
|
72
|
+
|
|
73
|
+
# Input Component
|
|
74
|
+
Wrapper for input element that renders children within a label tag
|
|
75
|
+
-->
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Props } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Generated by SvelteForge🔥
|
|
4
|
+
*
|
|
5
|
+
* # Input Component
|
|
6
|
+
* Wrapper for input element that renders children within a label tag
|
|
7
|
+
*/
|
|
8
|
+
declare const Input: import("svelte").Component<Props, {}, "fill" | "class" | "name" | "type" | "id" | "flex" | "row" | "col" | "centerx" | "centery" | "center" | "fillw" | "fillh" | "noshrink" | "aspectSquare" | "cursorAuto" | "cursorDefault" | "cursorPointer" | "classFrame">;
|
|
9
|
+
type Input = ReturnType<typeof Input>;
|
|
10
|
+
export default Input;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as _, default as Root } from "./components/input.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// --- Logic ---
|
|
3
|
+
import { cn, Tokenizer } from '../../../utils/classname';
|
|
4
|
+
import type { Props } from '..';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
class: className = $bindable(undefined),
|
|
9
|
+
|
|
10
|
+
// Horizontal / Vertical
|
|
11
|
+
horizontal = $bindable(undefined),
|
|
12
|
+
vertical = $bindable(undefined),
|
|
13
|
+
|
|
14
|
+
// Width / Height
|
|
15
|
+
width = $bindable(undefined),
|
|
16
|
+
height = $bindable(undefined),
|
|
17
|
+
|
|
18
|
+
// Catch-alls
|
|
19
|
+
...rest
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
const tokenInstance = new Tokenizer(className);
|
|
23
|
+
|
|
24
|
+
// Horizontal / Vertical
|
|
25
|
+
tokenInstance.addTokenIf(horizontal || width, 'w-full');
|
|
26
|
+
tokenInstance.addTokenIf(vertical || height, 'h-full');
|
|
27
|
+
|
|
28
|
+
if ([horizontal, vertical, width, height].every((val) => val === undefined)) {
|
|
29
|
+
tokenInstance.addTokenIf(true, 'size-full');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div class={cn(tokenInstance.className)} {...rest}>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!--@component
|
|
39
|
+
---
|
|
40
|
+
name: Spacer
|
|
41
|
+
props:
|
|
42
|
+
horizontal (undefined|boolean) = undefined: Expands the component to the most width it can occupy
|
|
43
|
+
vertical (undefined|boolean) = undefined: Expands the component to the most height it can occupy
|
|
44
|
+
width (undefined|boolean) = undefined: Expands the component to the most width it can occupy
|
|
45
|
+
height (undefined|boolean) = undefined: Expands the component to the most height it can occupy
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
Element that is soley made to fill in space. If nothing is passed, assumes 'size-full',
|
|
49
|
+
otherwise, it fills the direction you tell it to.
|
|
50
|
+
-->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Props } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* ---
|
|
4
|
+
* name: Spacer
|
|
5
|
+
* props:
|
|
6
|
+
* horizontal (undefined|boolean) = undefined: Expands the component to the most width it can occupy
|
|
7
|
+
* vertical (undefined|boolean) = undefined: Expands the component to the most height it can occupy
|
|
8
|
+
* width (undefined|boolean) = undefined: Expands the component to the most width it can occupy
|
|
9
|
+
* height (undefined|boolean) = undefined: Expands the component to the most height it can occupy
|
|
10
|
+
* ---
|
|
11
|
+
*
|
|
12
|
+
* Element that is soley made to fill in space. If nothing is passed, assumes 'size-full',
|
|
13
|
+
* otherwise, it fills the direction you tell it to.
|
|
14
|
+
*/
|
|
15
|
+
declare const Spacer: import("svelte").Component<Props, {}, "class" | "height" | "width" | "horizontal" | "vertical">;
|
|
16
|
+
type Spacer = ReturnType<typeof Spacer>;
|
|
17
|
+
export default Spacer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as _, default as Root } from "./components/spacer.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
|
|
3
|
+
// --- Logic ---
|
|
4
|
+
import { cn, Tokenizer } from '../../../utils/classname';
|
|
5
|
+
import type { Props } from ".."
|
|
6
|
+
|
|
7
|
+
// Size Class Lookup Table
|
|
8
|
+
const sizeClasses = {
|
|
9
|
+
xxl: 'text-lg',
|
|
10
|
+
xl: 'text-base',
|
|
11
|
+
lg: 'text-sm',
|
|
12
|
+
md: 'text-xs',
|
|
13
|
+
sm: 'text-xxs'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Weight Classes Lookup Table
|
|
17
|
+
const weightClasses = {
|
|
18
|
+
extrabold: 'font-extrabold',
|
|
19
|
+
bold: 'font-bold',
|
|
20
|
+
semibold: 'font-semibold',
|
|
21
|
+
regular: 'font-normal',
|
|
22
|
+
light: 'font-light'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
children,
|
|
27
|
+
class: className,
|
|
28
|
+
|
|
29
|
+
// Sizing
|
|
30
|
+
size = 'md', // Catch All
|
|
31
|
+
xxl,
|
|
32
|
+
xl,
|
|
33
|
+
lg,
|
|
34
|
+
md,
|
|
35
|
+
sm,
|
|
36
|
+
|
|
37
|
+
// Weights
|
|
38
|
+
weight = 'regular', // Catch All
|
|
39
|
+
extrabold,
|
|
40
|
+
bold,
|
|
41
|
+
semibold,
|
|
42
|
+
regular,
|
|
43
|
+
light,
|
|
44
|
+
|
|
45
|
+
// Semantic Element
|
|
46
|
+
as = "span", // Catchall
|
|
47
|
+
|
|
48
|
+
// Italics
|
|
49
|
+
em,
|
|
50
|
+
|
|
51
|
+
// Other Catchall
|
|
52
|
+
...rest
|
|
53
|
+
}: Props = $props();
|
|
54
|
+
|
|
55
|
+
const tokenInstance = new Tokenizer(className);
|
|
56
|
+
|
|
57
|
+
// === Catch All statements should be applied first ===
|
|
58
|
+
|
|
59
|
+
// Apply Size Class
|
|
60
|
+
tokenInstance.addTokenIf(true, sizeClasses[size] ?? 'text-base');
|
|
61
|
+
|
|
62
|
+
// Apply Weight Class
|
|
63
|
+
tokenInstance.addTokenIf(true, weightClasses[weight] ?? 'font-normal');
|
|
64
|
+
|
|
65
|
+
// Sizing Tokens
|
|
66
|
+
tokenInstance.addTokenIf(xxl, sizeClasses['xxl']);
|
|
67
|
+
tokenInstance.addTokenIf(xl, sizeClasses['xl']);
|
|
68
|
+
tokenInstance.addTokenIf(lg, sizeClasses['lg']);
|
|
69
|
+
tokenInstance.addTokenIf(md, sizeClasses['md']);
|
|
70
|
+
tokenInstance.addTokenIf(sm, sizeClasses['sm']);
|
|
71
|
+
|
|
72
|
+
// Weight Tokens
|
|
73
|
+
tokenInstance.addTokenIf(extrabold, weightClasses['extrabold']);
|
|
74
|
+
tokenInstance.addTokenIf(bold, weightClasses['bold']);
|
|
75
|
+
tokenInstance.addTokenIf(semibold, weightClasses['semibold']);
|
|
76
|
+
tokenInstance.addTokenIf(regular, weightClasses['regular']);
|
|
77
|
+
tokenInstance.addTokenIf(light, weightClasses['light']);
|
|
78
|
+
|
|
79
|
+
// Italic Token
|
|
80
|
+
tokenInstance.addTokenIf(em, 'italic')
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<svelte:element this={as} class={cn(tokenInstance.className)} {...rest}>
|
|
84
|
+
{@render children?.()}
|
|
85
|
+
</svelte:element>
|
|
86
|
+
|
|
87
|
+
<!--@component
|
|
88
|
+
Generated by SvelteForge🔥
|
|
89
|
+
-->
|
|
90
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as _, default as Root } from "./components/text.svelte";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { tHeaderWeights } from '../header/types';
|
|
3
|
+
export type tTextSizes = {
|
|
4
|
+
xxl: 'h1';
|
|
5
|
+
xl: 'h2';
|
|
6
|
+
lg: 'h3';
|
|
7
|
+
md: 'h4';
|
|
8
|
+
sm: 'h5';
|
|
9
|
+
};
|
|
10
|
+
export declare const tags: readonly ["p", "blockquote", "q", "cite", "abbr", "dfn", "time", "address", "code", "pre", "samp", "kbd", "var", "strong", "em", "mark", "small", "sub", "sup", "b", "i", "u", "span"];
|
|
11
|
+
export type tTextTypes = (typeof tags)[number];
|
|
12
|
+
export type tTextWeights = {
|
|
13
|
+
light: 'font-light';
|
|
14
|
+
regular: 'font-normal';
|
|
15
|
+
semibold: 'font-semibold';
|
|
16
|
+
bold: 'font-bold';
|
|
17
|
+
extrabold: 'font-extrabold';
|
|
18
|
+
};
|
|
19
|
+
export type tTextProps = HTMLAttributes<HTMLDivElement> & {
|
|
20
|
+
as?: tTextTypes;
|
|
21
|
+
size?: keyof tTextSizes;
|
|
22
|
+
xxl?: boolean;
|
|
23
|
+
xl?: boolean;
|
|
24
|
+
lg?: boolean;
|
|
25
|
+
md?: boolean;
|
|
26
|
+
sm?: boolean;
|
|
27
|
+
weight?: keyof tHeaderWeights;
|
|
28
|
+
extrabold?: boolean;
|
|
29
|
+
bold?: boolean;
|
|
30
|
+
semibold?: boolean;
|
|
31
|
+
regular?: boolean;
|
|
32
|
+
light?: boolean;
|
|
33
|
+
em?: boolean;
|
|
34
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const tags = [
|
|
2
|
+
'p',
|
|
3
|
+
'blockquote',
|
|
4
|
+
'q',
|
|
5
|
+
'cite',
|
|
6
|
+
'abbr',
|
|
7
|
+
'dfn',
|
|
8
|
+
'time',
|
|
9
|
+
'address',
|
|
10
|
+
'code',
|
|
11
|
+
'pre',
|
|
12
|
+
'samp',
|
|
13
|
+
'kbd',
|
|
14
|
+
'var',
|
|
15
|
+
'strong',
|
|
16
|
+
'em',
|
|
17
|
+
'mark',
|
|
18
|
+
'small',
|
|
19
|
+
'sub',
|
|
20
|
+
'sup',
|
|
21
|
+
'b',
|
|
22
|
+
'i',
|
|
23
|
+
'u',
|
|
24
|
+
'span'
|
|
25
|
+
];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
/**
|
|
3
|
+
* Fix class naming conflicts by utilizing both :function:`twMerge` and :function:`clsx`
|
|
4
|
+
* clsx allows very precise boolean specific class loading and twMerge removes all the conflicting but unused classes.
|
|
5
|
+
* @param inputs All base classes
|
|
6
|
+
* @returns Merged classes
|
|
7
|
+
*/
|
|
8
|
+
export declare function cn(...inputs: (ClassValue | unknown)[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Allows for easy creation of data attribute specific classes in tailwind.
|
|
11
|
+
* First, you create the builder while specifying the root selector. then you can call
|
|
12
|
+
* `cn_a.build('bg-black')`.
|
|
13
|
+
*
|
|
14
|
+
* ## Usage
|
|
15
|
+
* ```ts
|
|
16
|
+
* const builder = new cn_a("state=toggled")
|
|
17
|
+
* builder.build("bg-black text-white") // >> "data-[state=toggled]:bg-black data-[state=toggled]:text-white"
|
|
18
|
+
*
|
|
19
|
+
* // Or
|
|
20
|
+
* cn_a.buildx("state=toggled", "bg-black text-white") // >> "data-[state=toggled]:bg-black data-[state=toggled]:text-white"
|
|
21
|
+
*
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class cn_a {
|
|
25
|
+
selector: string | undefined;
|
|
26
|
+
constructor(selector: string);
|
|
27
|
+
/**
|
|
28
|
+
* Returns a string of all the classes with the attribute selector attached
|
|
29
|
+
* @param {string} classes tailwind/css classes string
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
build(classes: string): string;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param selector some sort of boolean expression like state=toggled...
|
|
36
|
+
* @returns `data-[${selector}]`
|
|
37
|
+
*/
|
|
38
|
+
static wrap_selector(selector: string): string;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param selector data attribute selector like state=toggled
|
|
42
|
+
* @param classes
|
|
43
|
+
*/
|
|
44
|
+
static buildx(selector: string, classes: string): string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A utility class for dynamically building class names based on conditional logic.
|
|
48
|
+
* This class is particularly useful for managing conditional class tokens in a structured way.
|
|
49
|
+
*
|
|
50
|
+
* ## Example Usage
|
|
51
|
+
* ```typescript
|
|
52
|
+
* let sm: undefined | boolean = true;
|
|
53
|
+
* const tokenInstance = new Tokenizer();
|
|
54
|
+
* tokenInstance.addTokenIf(sm, 'text-small');
|
|
55
|
+
*
|
|
56
|
+
* <element class={cn(tokenInstance.className)}/>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare class Tokenizer {
|
|
60
|
+
className: string | ClassValue;
|
|
61
|
+
/**
|
|
62
|
+
* Initializes a new instance of the `Tokenizer` class with an optional initial class name.
|
|
63
|
+
* @param className The initial class name to start with. Defaults to an empty string.
|
|
64
|
+
*/
|
|
65
|
+
constructor(className?: string | null | undefined | ClassValue);
|
|
66
|
+
/**
|
|
67
|
+
* Adds a class token to the `className` property if the provided statement evaluates to `true`.
|
|
68
|
+
* @param statement A condition that determines whether the token should be added.
|
|
69
|
+
* @param token The class token to add if the condition is met.
|
|
70
|
+
*/
|
|
71
|
+
addTokenIf(statement: any, token: string): void;
|
|
72
|
+
}
|