uisv 0.0.13 → 0.0.15
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/components/alert.svelte +8 -2
- package/dist/components/alert.svelte.d.ts +2 -2
- package/dist/components/badge.svelte +18 -18
- package/dist/components/badge.svelte.d.ts +2 -2
- package/dist/components/banner.svelte +8 -2
- package/dist/components/banner.svelte.d.ts +2 -2
- package/dist/components/breadcrumb.svelte +75 -0
- package/dist/components/breadcrumb.svelte.d.ts +38 -0
- package/dist/components/button.svelte +415 -0
- package/dist/components/{button/index.d.ts → button.svelte.d.ts} +9 -4
- package/dist/components/calendar.svelte +99 -0
- package/dist/components/calendar.svelte.d.ts +16 -0
- package/dist/components/card.svelte +11 -10
- package/dist/components/card.svelte.d.ts +2 -1
- package/dist/components/collapsible.svelte +76 -0
- package/dist/components/collapsible.svelte.d.ts +15 -0
- package/dist/components/icon.svelte +58 -0
- package/dist/components/icon.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +18 -3
- package/dist/components/index.js +18 -3
- package/dist/components/input-number.svelte +175 -0
- package/dist/components/input-number.svelte.d.ts +38 -0
- package/dist/components/input-time.svelte +233 -0
- package/dist/components/input-time.svelte.d.ts +53 -0
- package/dist/components/input.svelte +285 -0
- package/dist/components/{input/index.d.ts → input.svelte.d.ts} +6 -5
- package/dist/components/kbd.svelte +35 -35
- package/dist/components/kbd.svelte.d.ts +2 -2
- package/dist/components/pin-input.svelte +20 -20
- package/dist/components/pin-input.svelte.d.ts +2 -2
- package/dist/components/placeholder.svelte +1 -1
- package/dist/components/select.svelte +2 -2
- package/dist/components/select.svelte.d.ts +2 -2
- package/dist/components/seperator.svelte +212 -0
- package/dist/components/seperator.svelte.d.ts +22 -0
- package/dist/components/tabs.svelte +1 -2
- package/dist/date.d.ts +1 -0
- package/dist/date.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/utilities.svelte.d.ts +7 -0
- package/dist/utilities.svelte.js +20 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +24 -39
- package/package.json +41 -49
- package/dist/components/button/button.svelte +0 -105
- package/dist/components/button/button.svelte.d.ts +0 -4
- package/dist/components/button/index.js +0 -4
- package/dist/components/button/style.d.ts +0 -148
- package/dist/components/button/style.js +0 -248
- package/dist/components/input/index.js +0 -2
- package/dist/components/input/input.svelte +0 -103
- package/dist/components/input/input.svelte.d.ts +0 -4
- package/dist/components/input/style.d.ts +0 -316
- package/dist/components/input/style.js +0 -128
- package/dist/components/input-time/index.d.ts +0 -375
- package/dist/components/input-time/index.js +0 -144
- package/dist/components/input-time/input-time.svelte +0 -39
- package/dist/components/input-time/input-time.svelte.d.ts +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropColor } from '../index.js';
|
|
1
|
+
import type { PropColor, PropVariant } from '../index.js';
|
|
2
2
|
import { Select } from 'bits-ui';
|
|
3
3
|
import type { Component, Snippet } from 'svelte';
|
|
4
4
|
export type SelectItem<T> = T | {
|
|
@@ -14,7 +14,7 @@ export type SelectProps<T> = {
|
|
|
14
14
|
}]>;
|
|
15
15
|
color?: PropColor;
|
|
16
16
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
17
|
-
variant?:
|
|
17
|
+
variant?: Exclude<PropVariant, 'solid'>;
|
|
18
18
|
highlight?: boolean;
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
} & ({
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { Icon, type PropColor, isComponent, isSnippet } from '../index.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
+
import { tv } from 'tailwind-variants';
|
|
6
|
+
import type { Component } from 'svelte';
|
|
7
|
+
|
|
8
|
+
export type SeperatorProps = {
|
|
9
|
+
label?: string | Snippet<[ClassNameValue]> | Component;
|
|
10
|
+
icon?: string | Component;
|
|
11
|
+
color?: PropColor;
|
|
12
|
+
type?: 'dashed' | 'solid' | 'dotted';
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
orientation?: 'horizontal' | 'vertical';
|
|
16
|
+
ui?: {
|
|
17
|
+
root?: ClassNameValue;
|
|
18
|
+
border?: ClassNameValue;
|
|
19
|
+
icon?: ClassNameValue;
|
|
20
|
+
label?: ClassNameValue;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
let {
|
|
27
|
+
label,
|
|
28
|
+
icon,
|
|
29
|
+
children,
|
|
30
|
+
color = 'primary',
|
|
31
|
+
type = 'solid',
|
|
32
|
+
size = 'xs',
|
|
33
|
+
orientation = 'horizontal',
|
|
34
|
+
ui = {},
|
|
35
|
+
}: SeperatorProps = $props();
|
|
36
|
+
|
|
37
|
+
const variants = $derived(
|
|
38
|
+
tv({
|
|
39
|
+
slots: {
|
|
40
|
+
root: 'flex items-center justify-center text-center',
|
|
41
|
+
border: '',
|
|
42
|
+
icon: 'shrink-0 size-5',
|
|
43
|
+
label: 'text-sm',
|
|
44
|
+
},
|
|
45
|
+
variants: {
|
|
46
|
+
type: {
|
|
47
|
+
solid: {
|
|
48
|
+
border: 'border-solid',
|
|
49
|
+
},
|
|
50
|
+
dashed: {
|
|
51
|
+
border: 'border-dashed',
|
|
52
|
+
},
|
|
53
|
+
dotted: {
|
|
54
|
+
border: 'border-dotted',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
size: {
|
|
58
|
+
xs: {
|
|
59
|
+
root: 'gap-3',
|
|
60
|
+
},
|
|
61
|
+
sm: {
|
|
62
|
+
root: 'gap-3',
|
|
63
|
+
},
|
|
64
|
+
md: {
|
|
65
|
+
root: 'gap-4',
|
|
66
|
+
},
|
|
67
|
+
lg: {
|
|
68
|
+
root: 'gap-5',
|
|
69
|
+
},
|
|
70
|
+
xl: {
|
|
71
|
+
root: 'gap-5',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
color: {
|
|
75
|
+
primary: {
|
|
76
|
+
border: 'border-primary',
|
|
77
|
+
label: 'text-primary',
|
|
78
|
+
icon: 'text-primary',
|
|
79
|
+
},
|
|
80
|
+
surface: {
|
|
81
|
+
border: 'border-surface',
|
|
82
|
+
label: 'text-surface',
|
|
83
|
+
icon: 'text-surface',
|
|
84
|
+
},
|
|
85
|
+
info: {
|
|
86
|
+
border: 'border-info',
|
|
87
|
+
label: 'text-info',
|
|
88
|
+
icon: 'text-info',
|
|
89
|
+
},
|
|
90
|
+
success: {
|
|
91
|
+
border: 'border-success',
|
|
92
|
+
label: 'text-success',
|
|
93
|
+
icon: 'text-success',
|
|
94
|
+
},
|
|
95
|
+
warning: {
|
|
96
|
+
border: 'border-warning',
|
|
97
|
+
label: 'text-warning',
|
|
98
|
+
icon: 'text-warning',
|
|
99
|
+
},
|
|
100
|
+
error: {
|
|
101
|
+
border: 'border-error',
|
|
102
|
+
label: 'text-error',
|
|
103
|
+
icon: 'text-error',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
orientation: {
|
|
107
|
+
horizontal: {
|
|
108
|
+
root: 'w-full flex-row',
|
|
109
|
+
border: 'w-full',
|
|
110
|
+
},
|
|
111
|
+
vertical: {
|
|
112
|
+
root: 'h-full flex-col',
|
|
113
|
+
border: 'h-full',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
compoundVariants: [
|
|
118
|
+
{
|
|
119
|
+
orientation: 'horizontal',
|
|
120
|
+
size: 'xs',
|
|
121
|
+
class: {
|
|
122
|
+
border: 'border-t',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
orientation: 'horizontal',
|
|
127
|
+
size: 'sm',
|
|
128
|
+
class: {
|
|
129
|
+
border: 'border-t-2',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
orientation: 'horizontal',
|
|
134
|
+
size: 'md',
|
|
135
|
+
class: {
|
|
136
|
+
border: 'border-t-3',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
orientation: 'horizontal',
|
|
141
|
+
size: 'lg',
|
|
142
|
+
class: {
|
|
143
|
+
border: 'border-t-4',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
orientation: 'horizontal',
|
|
148
|
+
size: 'xl',
|
|
149
|
+
class: {
|
|
150
|
+
border: 'border-t-5',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
orientation: 'vertical',
|
|
155
|
+
size: 'xs',
|
|
156
|
+
class: {
|
|
157
|
+
border: 'border-s',
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
orientation: 'vertical',
|
|
162
|
+
size: 'sm',
|
|
163
|
+
class: {
|
|
164
|
+
border: 'border-s-2',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
orientation: 'vertical',
|
|
169
|
+
size: 'md',
|
|
170
|
+
class: {
|
|
171
|
+
border: 'border-s-3',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
orientation: 'vertical',
|
|
176
|
+
size: 'lg',
|
|
177
|
+
class: {
|
|
178
|
+
border: 'border-s-4',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
orientation: 'vertical',
|
|
183
|
+
size: 'xl',
|
|
184
|
+
class: {
|
|
185
|
+
border: 'border-s-5',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
})({ size, type, color, orientation }),
|
|
190
|
+
);
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<div class={variants.root({ class: ui.root })}>
|
|
194
|
+
<span class={variants.border({ class: ui.border })}></span>
|
|
195
|
+
|
|
196
|
+
{#if icon || label || children}
|
|
197
|
+
{#if icon}
|
|
198
|
+
<Icon name={icon} class={variants.icon({})} />
|
|
199
|
+
{:else if typeof label === 'string' && label.length > 0}
|
|
200
|
+
<span class={variants.label({ class: ui.label })}>{label}</span>
|
|
201
|
+
{:else if isSnippet(label)}
|
|
202
|
+
{@render label()}
|
|
203
|
+
{:else if isComponent(label)}
|
|
204
|
+
{@const Label = label}
|
|
205
|
+
<Label class={variants.label({ class: ui.label })} />
|
|
206
|
+
{:else}
|
|
207
|
+
{@render children?.()}
|
|
208
|
+
{/if}
|
|
209
|
+
|
|
210
|
+
<span class={variants.border({ class: ui.border })}></span>
|
|
211
|
+
{/if}
|
|
212
|
+
</div>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type PropColor } from '../index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
+
import type { Component } from 'svelte';
|
|
5
|
+
export type SeperatorProps = {
|
|
6
|
+
label?: string | Snippet<[ClassNameValue]> | Component;
|
|
7
|
+
icon?: string | Component;
|
|
8
|
+
color?: PropColor;
|
|
9
|
+
type?: 'dashed' | 'solid' | 'dotted';
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
orientation?: 'horizontal' | 'vertical';
|
|
13
|
+
ui?: {
|
|
14
|
+
root?: ClassNameValue;
|
|
15
|
+
border?: ClassNameValue;
|
|
16
|
+
icon?: ClassNameValue;
|
|
17
|
+
label?: ClassNameValue;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const Seperator: Component<SeperatorProps, {}, "">;
|
|
21
|
+
type Seperator = ReturnType<typeof Seperator>;
|
|
22
|
+
export default Seperator;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
6
6
|
import { type Component, type Snippet } from 'svelte';
|
|
7
|
-
import Icon from '@iconify/svelte';
|
|
8
7
|
import { ElementRect } from 'runed';
|
|
9
8
|
|
|
10
9
|
export type TabItem =
|
|
@@ -241,6 +240,6 @@
|
|
|
241
240
|
{:else if isComponent(IconProp)}
|
|
242
241
|
<IconProp class={classes.icon({ class: ui.icon })} />
|
|
243
242
|
{:else if typeof IconProp === 'string'}
|
|
244
|
-
<
|
|
243
|
+
<div class={classes.icon({ class: [IconProp, ui.icon] })}></div>
|
|
245
244
|
{/if}
|
|
246
245
|
{/snippet}
|
package/dist/date.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@internationalized/date';
|
package/dist/date.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@internationalized/date';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export * from './components/index.js';
|
|
|
2
2
|
export * from './utilities.svelte.js';
|
|
3
3
|
export type PropColor = 'primary' | 'surface' | 'info' | 'success' | 'warning' | 'error';
|
|
4
4
|
export declare const COLORS: PropColor[];
|
|
5
|
+
export type PropVariant = 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
6
|
+
export type PropSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -22,3 +22,10 @@ export declare const isSnippet: (v: unknown) => v is Snippet;
|
|
|
22
22
|
* @returns an array of dom rects.
|
|
23
23
|
*/
|
|
24
24
|
export declare function useElementRects(nodes: MaybeGetter<HTMLElement[]>, options?: ElementSizeOptions): DOMRect[];
|
|
25
|
+
/**
|
|
26
|
+
* Inject reactive style element in head.
|
|
27
|
+
* @param css string
|
|
28
|
+
*/
|
|
29
|
+
export declare function useStyle(css: MaybeGetter<string>): {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
package/dist/utilities.svelte.js
CHANGED
|
@@ -45,3 +45,23 @@ export function useElementRects(nodes, options = {}) {
|
|
|
45
45
|
});
|
|
46
46
|
return rects;
|
|
47
47
|
}
|
|
48
|
+
let uisv_usestyle_id = 0;
|
|
49
|
+
/**
|
|
50
|
+
* Inject reactive style element in head.
|
|
51
|
+
* @param css string
|
|
52
|
+
*/
|
|
53
|
+
export function useStyle(css) {
|
|
54
|
+
const id = `uisv_styletag_${++uisv_usestyle_id}`;
|
|
55
|
+
let el = $state();
|
|
56
|
+
$effect(() => {
|
|
57
|
+
if (!el) {
|
|
58
|
+
el = (document.getElementById(id) || document.createElement('style'));
|
|
59
|
+
if (!el.isConnected) {
|
|
60
|
+
el.id = id;
|
|
61
|
+
document.head.appendChild(el);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
el.textContent = extract(css);
|
|
65
|
+
});
|
|
66
|
+
return { id };
|
|
67
|
+
}
|
package/dist/vite.d.ts
CHANGED
package/dist/vite.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import uno_plugin from 'unocss/vite';
|
|
2
|
-
import { transformerVariantGroup, transformerCompileClass, transformerDirectives, presetWebFonts, presetIcons, presetWind4,
|
|
2
|
+
import { transformerVariantGroup, transformerCompileClass, transformerDirectives, presetWebFonts, presetIcons, presetWind4, } from 'unocss';
|
|
3
3
|
import {} from '@unocss/preset-web-fonts';
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import { getColors } from 'theme-colors';
|
|
6
|
-
import { presetTheme } from 'unocss-preset-theme';
|
|
7
|
-
import { evaluatePath } from 'doc-path';
|
|
8
6
|
export function uisv(options) {
|
|
9
7
|
const _opts = defu(options, {
|
|
10
8
|
colors: {
|
|
11
|
-
primary:
|
|
9
|
+
primary: {
|
|
10
|
+
DEFAULT: '#FF3E00',
|
|
11
|
+
50: '#FFECE5',
|
|
12
|
+
100: '#FFD8CC',
|
|
13
|
+
200: '#FFB299',
|
|
14
|
+
300: '#FF8B66',
|
|
15
|
+
400: '#FF6533',
|
|
16
|
+
500: '#FF3E00',
|
|
17
|
+
600: '#CC3200',
|
|
18
|
+
700: '#992500',
|
|
19
|
+
800: '#661900',
|
|
20
|
+
900: '#330C00',
|
|
21
|
+
950: '#1A0600',
|
|
22
|
+
},
|
|
12
23
|
surface: 'neutral',
|
|
13
24
|
info: 'blue',
|
|
14
25
|
success: 'green',
|
|
@@ -27,39 +38,17 @@ export function uisv(options) {
|
|
|
27
38
|
},
|
|
28
39
|
},
|
|
29
40
|
});
|
|
30
|
-
// const
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// toned: 'surface.600',
|
|
37
|
-
// highlighted: 'surface.900',
|
|
38
|
-
// inverted: 'white',
|
|
39
|
-
// surface: {
|
|
40
|
-
// base: 'white',
|
|
41
|
-
// muted: 'surface.50',
|
|
42
|
-
// elevated: 'surface.100',
|
|
43
|
-
// accented: 'surface.200',
|
|
44
|
-
// inverted: 'surface.900',
|
|
45
|
-
// },
|
|
41
|
+
// const theme_plugin: Plugin = {
|
|
42
|
+
// name: 'vite-plugin-uisv',
|
|
43
|
+
// enforce: 'pre',
|
|
44
|
+
// async configResolved() {
|
|
45
|
+
// const path = resolve('node_modules/uisv/theme.js');
|
|
46
|
+
// console.log(await write(path, `export const button = {}`));
|
|
46
47
|
// },
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// dimmed: 'surface.400',
|
|
50
|
-
// muted: 'surface.500',
|
|
51
|
-
// toned: 'surface.600',
|
|
52
|
-
// highlighted: 'surface.900',
|
|
53
|
-
// inverted: 'white',
|
|
54
|
-
// surface: {
|
|
55
|
-
// base: 'surface.900',
|
|
56
|
-
// muted: 'surface.800',
|
|
57
|
-
// elevated: 'surface.800',
|
|
58
|
-
// accented: 'surface.700',
|
|
59
|
-
// inverted: 'white',
|
|
60
|
-
// },
|
|
48
|
+
// resolveId(source, importer, options) {
|
|
49
|
+
// if (source === '$build') return resolve('node_modules/uisv/theme.js');
|
|
61
50
|
// },
|
|
62
|
-
// }
|
|
51
|
+
// };
|
|
63
52
|
return [
|
|
64
53
|
uno_plugin({
|
|
65
54
|
content: {
|
|
@@ -100,8 +89,6 @@ export function uisv(options) {
|
|
|
100
89
|
background-color: var(--colors-inverted);
|
|
101
90
|
}
|
|
102
91
|
|
|
103
|
-
|
|
104
|
-
|
|
105
92
|
.dark {
|
|
106
93
|
${variables}
|
|
107
94
|
}
|
|
@@ -118,8 +105,6 @@ export function uisv(options) {
|
|
|
118
105
|
}),
|
|
119
106
|
presetWebFonts(_opts.fonts),
|
|
120
107
|
presetIcons(_opts.icons),
|
|
121
|
-
// semantics_preset,
|
|
122
|
-
// theme_preset,
|
|
123
108
|
],
|
|
124
109
|
transformers: [transformerVariantGroup(), transformerCompileClass(), transformerDirectives()],
|
|
125
110
|
extendTheme: (theme) => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uisv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "ui library for the rest of us",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "ui-sv/uisv",
|
|
7
7
|
"homepage": "https://uisv.pages.dev",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"dev": "vite dev",
|
|
10
|
-
"build": "vite build && prepack",
|
|
10
|
+
"build": "vite build && npm run prepack",
|
|
11
11
|
"preview": "vite preview",
|
|
12
12
|
"prepare": "svelte-kit sync || echo ''",
|
|
13
13
|
"prepack": "svelte-kit sync && svelte-package && publint",
|
|
@@ -32,74 +32,66 @@
|
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
|
-
"svelte": "./dist/index.js"
|
|
35
|
+
"svelte": "./dist/index.js",
|
|
36
|
+
"default": "./dist/index.js"
|
|
36
37
|
},
|
|
37
38
|
"./vite": {
|
|
38
39
|
"types": "./dist/vite.d.ts",
|
|
39
|
-
"svelte": "./dist/vite.js"
|
|
40
|
+
"svelte": "./dist/vite.js",
|
|
41
|
+
"default": "./dist/vite.js"
|
|
42
|
+
},
|
|
43
|
+
"./date": {
|
|
44
|
+
"types": "./dist/date.d.ts",
|
|
45
|
+
"svelte": "./dist/date.js",
|
|
46
|
+
"default": "./dist/date.js"
|
|
40
47
|
}
|
|
41
48
|
},
|
|
42
49
|
"peerDependencies": {
|
|
43
50
|
"svelte": "^5.0.0"
|
|
44
51
|
},
|
|
45
52
|
"devDependencies": {
|
|
46
|
-
"@eslint/compat": "^2.0.
|
|
47
|
-
"@eslint/js": "^
|
|
48
|
-
"@iconify-json/
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@iconify/svelte": "^5.2.1",
|
|
52
|
-
"@internationalized/date": "^3.10.1",
|
|
53
|
-
"@sveltejs/adapter-auto": "^7.0.0",
|
|
54
|
-
"@sveltejs/kit": "^2.49.4",
|
|
53
|
+
"@eslint/compat": "^2.0.2",
|
|
54
|
+
"@eslint/js": "^10.0.1",
|
|
55
|
+
"@iconify-json/lucide": "^1.2.90",
|
|
56
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
57
|
+
"@sveltejs/kit": "^2.52.0",
|
|
55
58
|
"@sveltejs/package": "^2.5.7",
|
|
56
59
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
60
|
+
"@types/node": "^25.2.3",
|
|
61
|
+
"@vitest/browser": "^4.0.18",
|
|
62
|
+
"eslint": "^10.0.0",
|
|
63
|
+
"eslint-config-prettier": "^10.1.8",
|
|
64
|
+
"eslint-plugin-svelte": "^3.15.0",
|
|
65
|
+
"globals": "^17.3.0",
|
|
66
|
+
"playwright": "^1.58.2",
|
|
67
|
+
"prettier": "^3.8.1",
|
|
68
|
+
"prettier-plugin-svelte": "^3.4.1",
|
|
69
|
+
"publint": "^0.3.17",
|
|
70
|
+
"svelte": "^5.51.2",
|
|
71
|
+
"svelte-check": "^4.4.0",
|
|
72
|
+
"typescript": "^5.9.3",
|
|
73
|
+
"typescript-eslint": "^8.55.0",
|
|
74
|
+
"vite": "^7.3.1",
|
|
75
|
+
"vitest": "^4.0.18",
|
|
76
|
+
"vitest-browser-svelte": "^2.0.2"
|
|
77
|
+
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@internationalized/date": "^3.11.0",
|
|
80
|
+
"@unocss/preset-web-fonts": "^66.6.0",
|
|
81
|
+
"bits-ui": "^2.16.2",
|
|
64
82
|
"colortranslator": "^5.0.0",
|
|
65
83
|
"defu": "^6.1.4",
|
|
66
|
-
"doc-path": "^4.1.3",
|
|
67
|
-
"eslint": "^9.39.2",
|
|
68
|
-
"eslint-config-prettier": "^10.1.8",
|
|
69
|
-
"eslint-plugin-svelte": "^3.14.0",
|
|
70
|
-
"files": "^3.0.2",
|
|
71
|
-
"globals": "^16.5.0",
|
|
72
84
|
"maska": "^3.2.0",
|
|
73
|
-
"mdsvex": "^0.12.6",
|
|
74
85
|
"mode-watcher": "^1.1.0",
|
|
75
|
-
"playwright": "^1.57.0",
|
|
76
|
-
"prettier": "^3.7.4",
|
|
77
|
-
"prettier-plugin-svelte": "^3.4.1",
|
|
78
|
-
"publint": "^0.3.16",
|
|
79
86
|
"runed": "^0.37.1",
|
|
80
87
|
"scule": "^1.3.0",
|
|
81
|
-
"
|
|
82
|
-
"svelte-check": "^4.3.5",
|
|
83
|
-
"svelte-exmarkdown": "^5.0.2",
|
|
84
|
-
"tailwind-merge": "^3.4.0",
|
|
88
|
+
"tailwind-merge": "^3.5.0",
|
|
85
89
|
"tailwind-variants": "^3.2.2",
|
|
86
90
|
"theme-colors": "^0.1.0",
|
|
87
|
-
"
|
|
88
|
-
"typescript-eslint": "^8.53.0",
|
|
89
|
-
"unocss": "^66.5.12",
|
|
90
|
-
"unocss-preset-theme": "^0.14.1",
|
|
91
|
-
"unplugin-icons": "^22.5.0",
|
|
92
|
-
"vite": "^7.3.1",
|
|
93
|
-
"vitest": "^4.0.17",
|
|
94
|
-
"vitest-browser-svelte": "^2.0.1"
|
|
91
|
+
"unocss": "^66.6.0"
|
|
95
92
|
},
|
|
96
93
|
"keywords": [
|
|
97
94
|
"svelte",
|
|
98
95
|
"ui"
|
|
99
|
-
]
|
|
100
|
-
"pnpm": {
|
|
101
|
-
"onlyBuiltDependencies": [
|
|
102
|
-
"esbuild"
|
|
103
|
-
]
|
|
104
|
-
}
|
|
96
|
+
]
|
|
105
97
|
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// import { FORM_LOADING_CONTEXT_KEY } from '../../utils/keys.js';
|
|
3
|
-
import { isSnippet, type ButtonProps, BUTTON_VARIANTS } from '../../index.js';
|
|
4
|
-
|
|
5
|
-
// let form_loading = getContext<{ value: boolean } | undefined>(FORM_LOADING_CONTEXT_KEY);
|
|
6
|
-
let {
|
|
7
|
-
ref = $bindable(),
|
|
8
|
-
size = 'md',
|
|
9
|
-
variant = 'solid',
|
|
10
|
-
color = 'primary',
|
|
11
|
-
iconposition = 'left',
|
|
12
|
-
children,
|
|
13
|
-
// active,
|
|
14
|
-
// activecolor,
|
|
15
|
-
// activevariant,
|
|
16
|
-
block,
|
|
17
|
-
label,
|
|
18
|
-
loadingauto,
|
|
19
|
-
onclick,
|
|
20
|
-
ui = {},
|
|
21
|
-
disabled,
|
|
22
|
-
href,
|
|
23
|
-
icon,
|
|
24
|
-
loading,
|
|
25
|
-
loadingicon,
|
|
26
|
-
target,
|
|
27
|
-
type,
|
|
28
|
-
}: ButtonProps = $props();
|
|
29
|
-
|
|
30
|
-
let internal_loading = $state(false);
|
|
31
|
-
const is_loading = $derived.by(() => {
|
|
32
|
-
if (loading) return true;
|
|
33
|
-
if (loadingauto) return internal_loading;
|
|
34
|
-
return false;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const classes = $derived(
|
|
38
|
-
BUTTON_VARIANTS({ variant, color, size, block, disabled: disabled || is_loading }),
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const only_icon = $derived(!(children || label) && !!icon);
|
|
42
|
-
|
|
43
|
-
async function onClickWrapper(event: MouseEvent) {
|
|
44
|
-
if (!onclick) return;
|
|
45
|
-
internal_loading = true;
|
|
46
|
-
|
|
47
|
-
await onclick(event);
|
|
48
|
-
|
|
49
|
-
internal_loading = false;
|
|
50
|
-
}
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
{#if href}
|
|
54
|
-
<a
|
|
55
|
-
{href}
|
|
56
|
-
{target}
|
|
57
|
-
class={classes.base({
|
|
58
|
-
class: [only_icon ? 'px-0 aspect-square justify-center' : '', 'cursor-pointer', ui.base],
|
|
59
|
-
})}
|
|
60
|
-
onclick={onClickWrapper}
|
|
61
|
-
>
|
|
62
|
-
{@render Content()}
|
|
63
|
-
</a>
|
|
64
|
-
{:else}
|
|
65
|
-
<button
|
|
66
|
-
{type}
|
|
67
|
-
disabled={disabled || is_loading}
|
|
68
|
-
class={classes.base({
|
|
69
|
-
class: [only_icon ? 'px-0 aspect-square justify-center' : '', ui.base],
|
|
70
|
-
})}
|
|
71
|
-
onclick={onClickWrapper}
|
|
72
|
-
>
|
|
73
|
-
{@render Content()}
|
|
74
|
-
</button>
|
|
75
|
-
{/if}
|
|
76
|
-
|
|
77
|
-
{#snippet Content()}
|
|
78
|
-
{#if iconposition === 'left'}
|
|
79
|
-
{@render Icon()}
|
|
80
|
-
{/if}
|
|
81
|
-
|
|
82
|
-
{#if label}
|
|
83
|
-
{label}
|
|
84
|
-
{:else}
|
|
85
|
-
{@render children?.()}
|
|
86
|
-
{/if}
|
|
87
|
-
|
|
88
|
-
{#if iconposition !== 'left'}
|
|
89
|
-
{@render Icon()}
|
|
90
|
-
{/if}
|
|
91
|
-
{/snippet}
|
|
92
|
-
|
|
93
|
-
{#snippet Icon()}
|
|
94
|
-
{@const IconCom = is_loading ? loadingicon || '-ph-lucide-loader-circle' : icon}
|
|
95
|
-
|
|
96
|
-
{#if IconCom}
|
|
97
|
-
{#if typeof IconCom === 'string'}
|
|
98
|
-
<div class={classes.icon({ class: [is_loading && 'animate-spin', IconCom, ui.icon] })}></div>
|
|
99
|
-
{:else if isSnippet(IconCom)}
|
|
100
|
-
{@render IconCom()}
|
|
101
|
-
{:else}
|
|
102
|
-
<IconCom />
|
|
103
|
-
{/if}
|
|
104
|
-
{/if}
|
|
105
|
-
{/snippet}
|