sk-clib 1.5.0 → 1.6.0
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 +47 -11
- package/dist/styles.css +0 -80
- package/dist/ui/button/components/button.svelte +26 -24
- package/dist/ui/button/components/button.svelte.d.ts +3 -2
- package/dist/ui/flex/components/flex.svelte +28 -28
- package/dist/ui/frame/components/frame.svelte +83 -83
- package/dist/ui/header/components/header.svelte +147 -147
- package/dist/ui/spacer/components/spacer.svelte +50 -50
- package/dist/ui/text/components/text.svelte +90 -90
- package/package.json +2 -3
- package/dist/docs/DocTree.svelte +0 -67
- package/dist/docs/DocTree.svelte.d.ts +0 -20
- package/dist/docs/_layouts/bare.svelte +0 -14
- package/dist/docs/_layouts/bare.svelte.d.ts +0 -15
- package/dist/docs/contributing/+page.svelte +0 -28
- package/dist/docs/contributing/documentation/+page.svelte +0 -12
- package/dist/docs/contributing/library/+page.svelte +0 -12
- package/dist/docs/getting_started/+page.svelte +0 -13
- package/dist/docs/getting_started/installation.svelte +0 -16
- package/dist/docs/getting_started/usage.svelte +0 -18
- package/dist/docs/handler/handler.d.ts +0 -49
- package/dist/docs/handler/handler.js +0 -74
- package/dist/docs/handler/index.d.ts +0 -1
- package/dist/docs/handler/index.js +0 -1
- package/dist/docs/index.d.ts +0 -0
- package/dist/docs/index.js +0 -1
- package/dist/prism.css +0 -143
- package/dist/prism.d.ts +0 -46
- package/dist/prism.js +0 -22
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// --- Logic ---
|
|
3
|
-
import { cn, Tokenizer } from '../../../utils';
|
|
4
|
-
import { type Props } from '..';
|
|
5
|
-
|
|
6
|
-
// Size Class Lookup Table
|
|
7
|
-
const sizeClasses = {
|
|
8
|
-
xxl: 'text-2xl',
|
|
9
|
-
xl: 'text-xl',
|
|
10
|
-
lg: 'text-lg',
|
|
11
|
-
md: 'text-base',
|
|
12
|
-
sm: 'text-sm'
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// Semantic Sizes Lookup Table
|
|
16
|
-
const semanticSizes = {
|
|
17
|
-
xxl: 'h1',
|
|
18
|
-
xl: 'h2',
|
|
19
|
-
lg: 'h3',
|
|
20
|
-
md: 'h4',
|
|
21
|
-
sm: 'h5'
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Weight Classes Lookup Table
|
|
25
|
-
const weightClasses = {
|
|
26
|
-
extrabold: 'font-extrabold',
|
|
27
|
-
bold: 'font-bold',
|
|
28
|
-
semibold: 'font-semibold',
|
|
29
|
-
regular: 'font-normal',
|
|
30
|
-
light: 'font-light'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
let {
|
|
34
|
-
children,
|
|
35
|
-
class: className,
|
|
36
|
-
|
|
37
|
-
// Sizing
|
|
38
|
-
size = 'md', // Catch All
|
|
39
|
-
xxl,
|
|
40
|
-
xl,
|
|
41
|
-
lg,
|
|
42
|
-
md,
|
|
43
|
-
sm,
|
|
44
|
-
|
|
45
|
-
// Weights
|
|
46
|
-
weight = 'regular', // Catch All
|
|
47
|
-
extrabold,
|
|
48
|
-
bold,
|
|
49
|
-
semibold,
|
|
50
|
-
regular,
|
|
51
|
-
light,
|
|
52
|
-
|
|
53
|
-
// Semantic Element
|
|
54
|
-
as = undefined, // Catchall
|
|
55
|
-
|
|
56
|
-
// Italics
|
|
57
|
-
em,
|
|
58
|
-
|
|
59
|
-
...rest
|
|
60
|
-
}: Props = $props();
|
|
61
|
-
|
|
62
|
-
const tokenInstance = new Tokenizer(className);
|
|
63
|
-
|
|
64
|
-
// === Catch All statements should be applied first ===
|
|
65
|
-
|
|
66
|
-
// Apply Size Class
|
|
67
|
-
tokenInstance.addTokenIf(true, sizeClasses[size] ?? 'text-base');
|
|
68
|
-
|
|
69
|
-
// Apply Weight Class
|
|
70
|
-
tokenInstance.addTokenIf(true, weightClasses[weight] ?? 'font-normal');
|
|
71
|
-
|
|
72
|
-
// Sizing Tokens
|
|
73
|
-
tokenInstance.addTokenIf(xxl, 'text-2xl');
|
|
74
|
-
tokenInstance.addTokenIf(xl, 'text-xl');
|
|
75
|
-
tokenInstance.addTokenIf(lg, 'text-lg');
|
|
76
|
-
tokenInstance.addTokenIf(md, 'text-base');
|
|
77
|
-
tokenInstance.addTokenIf(sm, 'text-sm');
|
|
78
|
-
|
|
79
|
-
function determineSemanticViaSize() {
|
|
80
|
-
// Go in order of importance, top-down
|
|
81
|
-
if (xxl) return 'h1';
|
|
82
|
-
if (xl) return 'h2';
|
|
83
|
-
if (lg) return 'h3';
|
|
84
|
-
if (md) return 'h4';
|
|
85
|
-
if (sm) return 'h5';
|
|
86
|
-
|
|
87
|
-
// Fallback to size prop
|
|
88
|
-
return semanticSizes[size] ?? 'span';
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Weight Tokens
|
|
92
|
-
tokenInstance.addTokenIf(extrabold, 'font-extrabold');
|
|
93
|
-
tokenInstance.addTokenIf(bold, 'font-bold');
|
|
94
|
-
tokenInstance.addTokenIf(semibold, 'font-semibold');
|
|
95
|
-
tokenInstance.addTokenIf(regular, 'font-normal');
|
|
96
|
-
tokenInstance.addTokenIf(light, 'font-light');
|
|
97
|
-
|
|
98
|
-
// Italic Token
|
|
99
|
-
tokenInstance.addTokenIf(em, 'italic');
|
|
100
|
-
|
|
101
|
-
// Determine Semantic Tag
|
|
102
|
-
let semanticTag = as ?? determineSemanticViaSize();
|
|
103
|
-
</script>
|
|
104
|
-
|
|
105
|
-
<svelte:element this={semanticTag} class={cn(tokenInstance.className)} {...rest}>
|
|
106
|
-
{@render children?.()}
|
|
107
|
-
</svelte:element>
|
|
108
|
-
|
|
109
|
-
<!--@component
|
|
110
|
-
Generated by SvelteForge🔥
|
|
111
|
-
|
|
112
|
-
# Header Component
|
|
113
|
-
A semantic and styled heading component that combines typography flexibility with accessible HTML.
|
|
114
|
-
|
|
115
|
-
This component maps `size` values to both Tailwind classes and semantic tags (`h1`–`h5`),
|
|
116
|
-
while also allowing direct override with the `as` prop for full control.
|
|
117
|
-
|
|
118
|
-
## Props
|
|
119
|
-
|
|
120
|
-
- `size`: `"xxl" | "xl" | "lg" | "md" | "sm"` — sets both font size and default semantic tag.
|
|
121
|
-
- `as`: `"h1" | "h2" | "h3" | "h4" | "h5" | "span"` — override the default semantic tag.
|
|
122
|
-
- `weight`: `"extrabold" | "bold" | "semibold" | "regular" | "light"` — font-weight control.
|
|
123
|
-
- `xxl`, `xl`, `lg`, `md`, `sm`: boolean shorthands to set font size via token (overrides `size`).
|
|
124
|
-
- `extrabold`, `bold`, `semibold`, `regular`, `light`: boolean shorthands to set weight (overrides `weight`).
|
|
125
|
-
- `em`: boolean — italicizes the text.
|
|
126
|
-
- `class`: Tailwind utility classes to append additional styling.
|
|
127
|
-
- `children`: Rendered content of the header.
|
|
128
|
-
|
|
129
|
-
## Example
|
|
130
|
-
|
|
131
|
-
```svelte
|
|
132
|
-
<Header size="xl" weight="semibold">
|
|
133
|
-
Dashboard
|
|
134
|
-
</Header>
|
|
135
|
-
|
|
136
|
-
<Header lg bold em>
|
|
137
|
-
Welcome Back!
|
|
138
|
-
</Header>
|
|
139
|
-
|
|
140
|
-
<Header size="md" as="h2">
|
|
141
|
-
Settings
|
|
142
|
-
</Header>
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Defaults to a `h4` tag (`md` size) with `regular` weight if not specified.
|
|
146
|
-
-->
|
|
147
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// --- Logic ---
|
|
3
|
+
import { cn, Tokenizer } from '../../../utils';
|
|
4
|
+
import { type Props } from '..';
|
|
5
|
+
|
|
6
|
+
// Size Class Lookup Table
|
|
7
|
+
const sizeClasses = {
|
|
8
|
+
xxl: 'text-2xl',
|
|
9
|
+
xl: 'text-xl',
|
|
10
|
+
lg: 'text-lg',
|
|
11
|
+
md: 'text-base',
|
|
12
|
+
sm: 'text-sm'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Semantic Sizes Lookup Table
|
|
16
|
+
const semanticSizes = {
|
|
17
|
+
xxl: 'h1',
|
|
18
|
+
xl: 'h2',
|
|
19
|
+
lg: 'h3',
|
|
20
|
+
md: 'h4',
|
|
21
|
+
sm: 'h5'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// Weight Classes Lookup Table
|
|
25
|
+
const weightClasses = {
|
|
26
|
+
extrabold: 'font-extrabold',
|
|
27
|
+
bold: 'font-bold',
|
|
28
|
+
semibold: 'font-semibold',
|
|
29
|
+
regular: 'font-normal',
|
|
30
|
+
light: 'font-light'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
let {
|
|
34
|
+
children,
|
|
35
|
+
class: className,
|
|
36
|
+
|
|
37
|
+
// Sizing
|
|
38
|
+
size = 'md', // Catch All
|
|
39
|
+
xxl,
|
|
40
|
+
xl,
|
|
41
|
+
lg,
|
|
42
|
+
md,
|
|
43
|
+
sm,
|
|
44
|
+
|
|
45
|
+
// Weights
|
|
46
|
+
weight = 'regular', // Catch All
|
|
47
|
+
extrabold,
|
|
48
|
+
bold,
|
|
49
|
+
semibold,
|
|
50
|
+
regular,
|
|
51
|
+
light,
|
|
52
|
+
|
|
53
|
+
// Semantic Element
|
|
54
|
+
as = undefined, // Catchall
|
|
55
|
+
|
|
56
|
+
// Italics
|
|
57
|
+
em,
|
|
58
|
+
|
|
59
|
+
...rest
|
|
60
|
+
}: Props = $props();
|
|
61
|
+
|
|
62
|
+
const tokenInstance = new Tokenizer(className);
|
|
63
|
+
|
|
64
|
+
// === Catch All statements should be applied first ===
|
|
65
|
+
|
|
66
|
+
// Apply Size Class
|
|
67
|
+
tokenInstance.addTokenIf(true, sizeClasses[size] ?? 'text-base');
|
|
68
|
+
|
|
69
|
+
// Apply Weight Class
|
|
70
|
+
tokenInstance.addTokenIf(true, weightClasses[weight] ?? 'font-normal');
|
|
71
|
+
|
|
72
|
+
// Sizing Tokens
|
|
73
|
+
tokenInstance.addTokenIf(xxl, 'text-2xl');
|
|
74
|
+
tokenInstance.addTokenIf(xl, 'text-xl');
|
|
75
|
+
tokenInstance.addTokenIf(lg, 'text-lg');
|
|
76
|
+
tokenInstance.addTokenIf(md, 'text-base');
|
|
77
|
+
tokenInstance.addTokenIf(sm, 'text-sm');
|
|
78
|
+
|
|
79
|
+
function determineSemanticViaSize() {
|
|
80
|
+
// Go in order of importance, top-down
|
|
81
|
+
if (xxl) return 'h1';
|
|
82
|
+
if (xl) return 'h2';
|
|
83
|
+
if (lg) return 'h3';
|
|
84
|
+
if (md) return 'h4';
|
|
85
|
+
if (sm) return 'h5';
|
|
86
|
+
|
|
87
|
+
// Fallback to size prop
|
|
88
|
+
return semanticSizes[size] ?? 'span';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Weight Tokens
|
|
92
|
+
tokenInstance.addTokenIf(extrabold, 'font-extrabold');
|
|
93
|
+
tokenInstance.addTokenIf(bold, 'font-bold');
|
|
94
|
+
tokenInstance.addTokenIf(semibold, 'font-semibold');
|
|
95
|
+
tokenInstance.addTokenIf(regular, 'font-normal');
|
|
96
|
+
tokenInstance.addTokenIf(light, 'font-light');
|
|
97
|
+
|
|
98
|
+
// Italic Token
|
|
99
|
+
tokenInstance.addTokenIf(em, 'italic');
|
|
100
|
+
|
|
101
|
+
// Determine Semantic Tag
|
|
102
|
+
let semanticTag = as ?? determineSemanticViaSize();
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<svelte:element this={semanticTag} class={cn(tokenInstance.className)} {...rest}>
|
|
106
|
+
{@render children?.()}
|
|
107
|
+
</svelte:element>
|
|
108
|
+
|
|
109
|
+
<!--@component
|
|
110
|
+
Generated by SvelteForge🔥
|
|
111
|
+
|
|
112
|
+
# Header Component
|
|
113
|
+
A semantic and styled heading component that combines typography flexibility with accessible HTML.
|
|
114
|
+
|
|
115
|
+
This component maps `size` values to both Tailwind classes and semantic tags (`h1`–`h5`),
|
|
116
|
+
while also allowing direct override with the `as` prop for full control.
|
|
117
|
+
|
|
118
|
+
## Props
|
|
119
|
+
|
|
120
|
+
- `size`: `"xxl" | "xl" | "lg" | "md" | "sm"` — sets both font size and default semantic tag.
|
|
121
|
+
- `as`: `"h1" | "h2" | "h3" | "h4" | "h5" | "span"` — override the default semantic tag.
|
|
122
|
+
- `weight`: `"extrabold" | "bold" | "semibold" | "regular" | "light"` — font-weight control.
|
|
123
|
+
- `xxl`, `xl`, `lg`, `md`, `sm`: boolean shorthands to set font size via token (overrides `size`).
|
|
124
|
+
- `extrabold`, `bold`, `semibold`, `regular`, `light`: boolean shorthands to set weight (overrides `weight`).
|
|
125
|
+
- `em`: boolean — italicizes the text.
|
|
126
|
+
- `class`: Tailwind utility classes to append additional styling.
|
|
127
|
+
- `children`: Rendered content of the header.
|
|
128
|
+
|
|
129
|
+
## Example
|
|
130
|
+
|
|
131
|
+
```svelte
|
|
132
|
+
<Header size="xl" weight="semibold">
|
|
133
|
+
Dashboard
|
|
134
|
+
</Header>
|
|
135
|
+
|
|
136
|
+
<Header lg bold em>
|
|
137
|
+
Welcome Back!
|
|
138
|
+
</Header>
|
|
139
|
+
|
|
140
|
+
<Header size="md" as="h2">
|
|
141
|
+
Settings
|
|
142
|
+
</Header>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Defaults to a `h4` tag (`md` size) with `regular` weight if not specified.
|
|
146
|
+
-->
|
|
147
|
+
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// --- Logic ---
|
|
3
|
-
import { cn, Tokenizer } from '../../../utils';
|
|
4
|
-
import type { Props } from '..';
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
children,
|
|
8
|
-
class: className,
|
|
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
|
-
-->
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// --- Logic ---
|
|
3
|
+
import { cn, Tokenizer } from '../../../utils';
|
|
4
|
+
import type { Props } from '..';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
class: className,
|
|
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
|
+
-->
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
// --- Logic ---
|
|
4
|
-
import { cn, Tokenizer } from '../../../utils';
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
|
|
3
|
+
// --- Logic ---
|
|
4
|
+
import { cn, Tokenizer } from '../../../utils';
|
|
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
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sk-clib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -30,8 +30,6 @@
|
|
|
30
30
|
"build": "svelte-package && npm run css_build",
|
|
31
31
|
"webbuild": "vite build",
|
|
32
32
|
"prepublishOnly": "npm run build && publint --skip-pack",
|
|
33
|
-
"dev": "vite dev",
|
|
34
|
-
"preview": "vite preview",
|
|
35
33
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
36
34
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
37
35
|
"format": "prettier --write .",
|
|
@@ -69,6 +67,7 @@
|
|
|
69
67
|
"@semantic-release/changelog": "^6.0.3",
|
|
70
68
|
"@semantic-release/git": "^10.0.1",
|
|
71
69
|
"@semantic-release/npm": "^12.0.1",
|
|
70
|
+
"@sveltejs/adapter-auto": "^6.0.1",
|
|
72
71
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
73
72
|
"@tailwindcss/cli": "^4.1.5",
|
|
74
73
|
"@tailwindcss/vite": "^4.1.7",
|
package/dist/docs/DocTree.svelte
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// --- Components ---
|
|
3
|
-
import { Header } from '..';
|
|
4
|
-
import DocTree from "./DocTree.svelte"
|
|
5
|
-
|
|
6
|
-
// --- Logic ---
|
|
7
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
8
|
-
|
|
9
|
-
export type DocNode = {
|
|
10
|
-
root?: {
|
|
11
|
-
metadata?: {
|
|
12
|
-
order?: number;
|
|
13
|
-
title?: string;
|
|
14
|
-
};
|
|
15
|
-
component?: typeof import('svelte').SvelteComponent;
|
|
16
|
-
};
|
|
17
|
-
component?: typeof import('svelte').SvelteComponent;
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Sorts the children of a documentation node by their `order` metadata.
|
|
23
|
-
*/
|
|
24
|
-
function getSortedDocs(obj: Record<string, any>) {
|
|
25
|
-
return Object.entries(obj)
|
|
26
|
-
.filter(([key]) => key !== 'root')
|
|
27
|
-
.sort(([, a], [, b]) => {
|
|
28
|
-
const orderA = a?.root?.metadata?.order ?? a?.metadata?.order ?? 9999;
|
|
29
|
-
const orderB = b?.root?.metadata?.order ?? b?.metadata?.order ?? 9999;
|
|
30
|
-
return orderA - orderB;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export type tProps = HTMLAttributes<HTMLDivElement> & {
|
|
36
|
-
node: DocNode,
|
|
37
|
-
prev?: string,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let { children, node, prev = $bindable(''), ...rest }: tProps | any = $props();
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
{#if node.root}
|
|
44
|
-
{@const Component = node.root.component as any}
|
|
45
|
-
<Component prev/>
|
|
46
|
-
{/if}
|
|
47
|
-
|
|
48
|
-
{#each getSortedDocs(node) as [key, value]}
|
|
49
|
-
{#if value.root?.component}
|
|
50
|
-
<value.root.component prev={`${prev}${key ? '/' : ''}${key}`}/>
|
|
51
|
-
{:else if value.component}
|
|
52
|
-
<value.component prev={`${prev}${key ? '/' : ''}${key}`}/>
|
|
53
|
-
{/if}
|
|
54
|
-
|
|
55
|
-
{#each Object.entries(value).filter(([k]) => k !== 'root') as [subKey, subValue]}
|
|
56
|
-
{#if typeof subValue === 'object' && subValue !== null && 'component' in subValue}
|
|
57
|
-
<!-- Render actual doc file -->
|
|
58
|
-
{@const SubComponent = subValue.component as any}
|
|
59
|
-
<SubComponent prev={`${prev}${subKey ? '/' : ''}${subKey}`}/>
|
|
60
|
-
{:else if typeof subValue === 'object' && !['metadata'].includes(subKey)}
|
|
61
|
-
<!-- Recurse into folder-like object -->
|
|
62
|
-
<DocTree prev={`${prev}${subKey ? '/' : ''}${subKey}`} node={subValue}/>
|
|
63
|
-
{:else}
|
|
64
|
-
<!-- Not valid doc node -->
|
|
65
|
-
{/if}
|
|
66
|
-
{/each}
|
|
67
|
-
{/each}
|