uisv 0.0.7 → 0.0.9
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/package.json +38 -37
- package/dist/components/accordion.svelte +0 -108
- package/dist/components/accordion.svelte.d.ts +0 -58
- package/dist/components/alert.svelte +0 -272
- package/dist/components/alert.svelte.d.ts +0 -24
- package/dist/components/badge.svelte +0 -227
- package/dist/components/badge.svelte.d.ts +0 -19
- package/dist/components/banner.svelte +0 -255
- package/dist/components/banner.svelte.d.ts +0 -24
- package/dist/components/button.svelte +0 -384
- package/dist/components/button.svelte.d.ts +0 -49
- package/dist/components/card.svelte +0 -70
- package/dist/components/card.svelte.d.ts +0 -17
- package/dist/components/checkbox.svelte +0 -175
- package/dist/components/checkbox.svelte.d.ts +0 -27
- package/dist/components/checkboxgroup.svelte +0 -259
- package/dist/components/checkboxgroup.svelte.d.ts +0 -26
- package/dist/components/chip.svelte +0 -82
- package/dist/components/chip.svelte.d.ts +0 -17
- package/dist/components/h1.svelte +0 -28
- package/dist/components/h1.svelte.d.ts +0 -11
- package/dist/components/h2.svelte +0 -30
- package/dist/components/h2.svelte.d.ts +0 -11
- package/dist/components/index.d.ts +0 -34
- package/dist/components/index.js +0 -34
- package/dist/components/kbd.svelte +0 -239
- package/dist/components/kbd.svelte.d.ts +0 -40
- package/dist/components/p.svelte +0 -22
- package/dist/components/p.svelte.d.ts +0 -11
- package/dist/components/pin-input.svelte +0 -162
- package/dist/components/pin-input.svelte.d.ts +0 -25
- package/dist/components/placeholder.svelte +0 -32
- package/dist/components/placeholder.svelte.d.ts +0 -7
- package/dist/components/progress.svelte +0 -124
- package/dist/components/progress.svelte.d.ts +0 -21
- package/dist/components/slider.svelte +0 -172
- package/dist/components/slider.svelte.d.ts +0 -44
- package/dist/components/switch.svelte +0 -180
- package/dist/components/switch.svelte.d.ts +0 -27
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/utils/common.d.ts +0 -13
- package/dist/utils/common.js +0 -16
- package/dist/vite.d.ts +0 -38
- package/dist/vite.js +0 -57
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { Slider } from 'bits-ui';
|
|
3
|
-
import type { PropColor } from '../index.js';
|
|
4
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
6
|
-
|
|
7
|
-
export type SliderProps<T> = {
|
|
8
|
-
value?: T;
|
|
9
|
-
default?: number | number[];
|
|
10
|
-
color?: PropColor;
|
|
11
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
thumblabel?: boolean;
|
|
14
|
-
orientation?: 'vertical' | 'horizontal';
|
|
15
|
-
step?: number;
|
|
16
|
-
min?: number;
|
|
17
|
-
max?: number;
|
|
18
|
-
ui?: {
|
|
19
|
-
root?: ClassNameValue;
|
|
20
|
-
range?: ClassNameValue;
|
|
21
|
-
thumb?: ClassNameValue;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<script lang="ts" generics="T extends number | number[]">
|
|
27
|
-
let {
|
|
28
|
-
value = $bindable(),
|
|
29
|
-
default: def_value = 0,
|
|
30
|
-
color = 'primary',
|
|
31
|
-
size = 'md',
|
|
32
|
-
disabled,
|
|
33
|
-
thumblabel,
|
|
34
|
-
orientation = 'horizontal',
|
|
35
|
-
step,
|
|
36
|
-
min,
|
|
37
|
-
max,
|
|
38
|
-
ui = {}
|
|
39
|
-
}: SliderProps<T> = $props();
|
|
40
|
-
|
|
41
|
-
const default_value = $derived.by(() => {
|
|
42
|
-
if (typeof def_value === 'number') return [def_value];
|
|
43
|
-
|
|
44
|
-
return def_value;
|
|
45
|
-
});
|
|
46
|
-
let slider_value = $derived({
|
|
47
|
-
get() {
|
|
48
|
-
if (typeof value === 'number') return [value];
|
|
49
|
-
|
|
50
|
-
return (value as number[]) ?? default_value;
|
|
51
|
-
},
|
|
52
|
-
set(v: number[]) {
|
|
53
|
-
value = (v?.length !== 1 ? v : v[0]) as T;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
const thumbs = $derived(slider_value.get()?.length ?? 1);
|
|
57
|
-
const classes = $derived.by(() =>
|
|
58
|
-
tv({
|
|
59
|
-
slots: {
|
|
60
|
-
root: [
|
|
61
|
-
'relative w-full flex rounded-full bg-neutral-300',
|
|
62
|
-
orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1'
|
|
63
|
-
],
|
|
64
|
-
range: [
|
|
65
|
-
'rounded-full bg-neutral-200 p-0.5 relative transition',
|
|
66
|
-
orientation === 'horizontal' ? 'h-full' : 'w-full'
|
|
67
|
-
],
|
|
68
|
-
thumb: 'bg-white rounded-full border-2 outline-none transition',
|
|
69
|
-
tick: ''
|
|
70
|
-
},
|
|
71
|
-
variants: {
|
|
72
|
-
color: {
|
|
73
|
-
primary: {
|
|
74
|
-
root: '',
|
|
75
|
-
range: 'bg-primary-500',
|
|
76
|
-
thumb: 'border-primary-500'
|
|
77
|
-
},
|
|
78
|
-
secondary: {
|
|
79
|
-
range: ['bg-neutral-900'],
|
|
80
|
-
thumb: 'border-neutral-900'
|
|
81
|
-
},
|
|
82
|
-
info: {
|
|
83
|
-
range: ['bg-info-500'],
|
|
84
|
-
thumb: 'border-info-500'
|
|
85
|
-
},
|
|
86
|
-
success: {
|
|
87
|
-
range: ['bg-success-500'],
|
|
88
|
-
thumb: 'border-success-500'
|
|
89
|
-
},
|
|
90
|
-
warning: {
|
|
91
|
-
range: ['bg-warning-500'],
|
|
92
|
-
thumb: 'border-warning-500'
|
|
93
|
-
},
|
|
94
|
-
error: {
|
|
95
|
-
range: ['bg-error-500'],
|
|
96
|
-
thumb: 'border-error-500'
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
size: {
|
|
100
|
-
xs: {
|
|
101
|
-
root: [orientation === 'horizontal' ? 'h-1.5' : ''],
|
|
102
|
-
thumb: 'size-4',
|
|
103
|
-
tick: 'size-2.5'
|
|
104
|
-
},
|
|
105
|
-
sm: {
|
|
106
|
-
root: [orientation === 'horizontal' ? 'h-1.75' : ''],
|
|
107
|
-
thumb: 'size-4.5',
|
|
108
|
-
tick: 'size-3'
|
|
109
|
-
},
|
|
110
|
-
md: {
|
|
111
|
-
root: [orientation === 'horizontal' ? 'h-2' : 'w-2 h-48'],
|
|
112
|
-
thumb: 'size-5',
|
|
113
|
-
tick: 'size-3.5'
|
|
114
|
-
},
|
|
115
|
-
lg: {
|
|
116
|
-
root: [orientation === 'horizontal' ? 'h-2.5' : ''],
|
|
117
|
-
thumb: 'size-5.5',
|
|
118
|
-
tick: 'size-4'
|
|
119
|
-
},
|
|
120
|
-
xl: {
|
|
121
|
-
root: [orientation === 'horizontal' ? 'h-3' : 'w-3'],
|
|
122
|
-
thumb: 'size-6',
|
|
123
|
-
tick: 'size-4.5'
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
orientation: {
|
|
127
|
-
horizontal: {
|
|
128
|
-
root: '',
|
|
129
|
-
thumb: '',
|
|
130
|
-
tick: ''
|
|
131
|
-
},
|
|
132
|
-
vertical: {
|
|
133
|
-
root: '',
|
|
134
|
-
thumb: '',
|
|
135
|
-
tick: ''
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
compoundVariants: []
|
|
140
|
-
})({ color, size, orientation })
|
|
141
|
-
);
|
|
142
|
-
</script>
|
|
143
|
-
|
|
144
|
-
<Slider.Root
|
|
145
|
-
type="multiple"
|
|
146
|
-
bind:value={slider_value.get, slider_value.set}
|
|
147
|
-
{min}
|
|
148
|
-
{max}
|
|
149
|
-
{step}
|
|
150
|
-
{orientation}
|
|
151
|
-
{disabled}
|
|
152
|
-
class={classes.root({ class: [disabled ? 'opacity-75 cursor-not-allowed' : '', ui.root] })}
|
|
153
|
-
>
|
|
154
|
-
<Slider.Range class={classes.range({ class: [ui.range] })} />
|
|
155
|
-
|
|
156
|
-
{#each { length: thumbs }, index (index)}
|
|
157
|
-
<Slider.Thumb {index} class={classes.thumb({ class: ['group', ui.thumb] })}>
|
|
158
|
-
{#if thumblabel}
|
|
159
|
-
<Slider.ThumbLabel
|
|
160
|
-
{index}
|
|
161
|
-
position="bottom"
|
|
162
|
-
class={[
|
|
163
|
-
'opacity-0 transition pointer-events-none text-sm shadow-md px-2 h-6 flex items-center rounded-md mt-1 border border-secondary-200',
|
|
164
|
-
'data-[active=""]:(opacity-100) group-hover:(opacity-100)'
|
|
165
|
-
]}
|
|
166
|
-
>
|
|
167
|
-
{slider_value.get()[index]}
|
|
168
|
-
</Slider.ThumbLabel>
|
|
169
|
-
{/if}
|
|
170
|
-
</Slider.Thumb>
|
|
171
|
-
{/each}
|
|
172
|
-
</Slider.Root>
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Slider } from 'bits-ui';
|
|
2
|
-
import type { PropColor } from '../index.js';
|
|
3
|
-
import type { ClassNameValue } from 'tailwind-merge';
|
|
4
|
-
export type SliderProps<T> = {
|
|
5
|
-
value?: T;
|
|
6
|
-
default?: number | number[];
|
|
7
|
-
color?: PropColor;
|
|
8
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
thumblabel?: boolean;
|
|
11
|
-
orientation?: 'vertical' | 'horizontal';
|
|
12
|
-
step?: number;
|
|
13
|
-
min?: number;
|
|
14
|
-
max?: number;
|
|
15
|
-
ui?: {
|
|
16
|
-
root?: ClassNameValue;
|
|
17
|
-
range?: ClassNameValue;
|
|
18
|
-
thumb?: ClassNameValue;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
declare function $$render<T extends number | number[]>(): {
|
|
22
|
-
props: SliderProps<T>;
|
|
23
|
-
exports: {};
|
|
24
|
-
bindings: "value";
|
|
25
|
-
slots: {};
|
|
26
|
-
events: {};
|
|
27
|
-
};
|
|
28
|
-
declare class __sveltets_Render<T extends number | number[]> {
|
|
29
|
-
props(): ReturnType<typeof $$render<T>>['props'];
|
|
30
|
-
events(): ReturnType<typeof $$render<T>>['events'];
|
|
31
|
-
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
32
|
-
bindings(): "value";
|
|
33
|
-
exports(): {};
|
|
34
|
-
}
|
|
35
|
-
interface $$IsomorphicComponent {
|
|
36
|
-
new <T extends number | number[]>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
37
|
-
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
38
|
-
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
39
|
-
<T extends number | number[]>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
40
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
41
|
-
}
|
|
42
|
-
declare const Slider: $$IsomorphicComponent;
|
|
43
|
-
type Slider<T extends number | number[]> = InstanceType<typeof Slider<T>>;
|
|
44
|
-
export default Slider;
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import { 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 'vitest-browser-svelte';
|
|
7
|
-
|
|
8
|
-
export type SwitchProps = {
|
|
9
|
-
value?: boolean;
|
|
10
|
-
color?: PropColor;
|
|
11
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
loading?: boolean;
|
|
14
|
-
loadingicon?: string | Snippet | Component;
|
|
15
|
-
uncheckedicon?: string | Snippet | Component;
|
|
16
|
-
checkedicon?: string | Snippet | Component;
|
|
17
|
-
label?: string | Snippet;
|
|
18
|
-
description?: string | Snippet;
|
|
19
|
-
required?: boolean;
|
|
20
|
-
ui?: {
|
|
21
|
-
root?: ClassNameValue;
|
|
22
|
-
container?: ClassNameValue;
|
|
23
|
-
thumb?: ClassNameValue;
|
|
24
|
-
label?: ClassNameValue;
|
|
25
|
-
description?: ClassNameValue;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<script lang="ts">
|
|
31
|
-
let {
|
|
32
|
-
value = $bindable(false),
|
|
33
|
-
color = 'primary',
|
|
34
|
-
size = 'md',
|
|
35
|
-
disabled,
|
|
36
|
-
loading,
|
|
37
|
-
loadingicon = 'i-lucide-loader-circle',
|
|
38
|
-
uncheckedicon,
|
|
39
|
-
checkedicon,
|
|
40
|
-
label,
|
|
41
|
-
description,
|
|
42
|
-
required,
|
|
43
|
-
ui = {}
|
|
44
|
-
}: SwitchProps = $props();
|
|
45
|
-
|
|
46
|
-
const classes = $derived.by(() =>
|
|
47
|
-
tv({
|
|
48
|
-
slots: {
|
|
49
|
-
root: 'flex-inline gap-2',
|
|
50
|
-
container: 'rounded-full bg-neutral-200 p-0.5 relative transition',
|
|
51
|
-
thumb: [
|
|
52
|
-
'bg-white block rounded-full absolute top-0.5 transition grid place-items-center',
|
|
53
|
-
value ? 'translate-x-full' : 'text-neutral-500'
|
|
54
|
-
],
|
|
55
|
-
icon: 'pi',
|
|
56
|
-
label: 'text-sm',
|
|
57
|
-
description: 'text-sm text-neutral-500'
|
|
58
|
-
},
|
|
59
|
-
variants: {
|
|
60
|
-
color: {
|
|
61
|
-
primary: {
|
|
62
|
-
container: ['', value && 'bg-primary-500 text-primary-500']
|
|
63
|
-
},
|
|
64
|
-
secondary: {
|
|
65
|
-
container: ['', value && 'bg-neutral-900 text-neutral-900']
|
|
66
|
-
},
|
|
67
|
-
info: {
|
|
68
|
-
container: ['', value && 'bg-info-500 text-info-500']
|
|
69
|
-
},
|
|
70
|
-
success: {
|
|
71
|
-
container: ['', value && 'bg-success-500 text-success-500']
|
|
72
|
-
},
|
|
73
|
-
warning: {
|
|
74
|
-
container: ['', value && 'bg-warning-500 text-warning-500']
|
|
75
|
-
},
|
|
76
|
-
error: {
|
|
77
|
-
container: ['', value && 'bg-error-500 text-error-500']
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
size: {
|
|
81
|
-
xs: {
|
|
82
|
-
container: 'w-7 min-w-7 h-4',
|
|
83
|
-
thumb: 'size-3',
|
|
84
|
-
icon: 'size-2.5'
|
|
85
|
-
},
|
|
86
|
-
sm: {
|
|
87
|
-
container: 'w-8 min-w-8 h-4.5',
|
|
88
|
-
thumb: 'size-3.5',
|
|
89
|
-
icon: 'size-3'
|
|
90
|
-
},
|
|
91
|
-
md: {
|
|
92
|
-
container: 'w-9 min-w-9 h-5',
|
|
93
|
-
thumb: 'size-4',
|
|
94
|
-
icon: 'size-3.5'
|
|
95
|
-
},
|
|
96
|
-
lg: {
|
|
97
|
-
container: 'w-10 min-w-10 h-5.5',
|
|
98
|
-
thumb: 'size-4.5',
|
|
99
|
-
icon: 'size-4'
|
|
100
|
-
},
|
|
101
|
-
xl: {
|
|
102
|
-
container: 'w-11 min-w-11 h-6',
|
|
103
|
-
thumb: 'size-5',
|
|
104
|
-
icon: 'size-4.5'
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
compoundVariants: []
|
|
109
|
-
})({ color, size })
|
|
110
|
-
);
|
|
111
|
-
</script>
|
|
112
|
-
|
|
113
|
-
<div
|
|
114
|
-
data-state={value ? 'checked' : 'unchecked'}
|
|
115
|
-
class={classes.root({
|
|
116
|
-
class: [(loading || disabled) && 'opacity-50', ui.thumb]
|
|
117
|
-
})}
|
|
118
|
-
>
|
|
119
|
-
<button
|
|
120
|
-
aria-label="switch"
|
|
121
|
-
data-state={value ? 'checked' : 'unchecked'}
|
|
122
|
-
class={classes.container({ class: [loading && 'cursor-not-allowed', ui.thumb] })}
|
|
123
|
-
onclick={() => {
|
|
124
|
-
console.log('click');
|
|
125
|
-
if (loading) return;
|
|
126
|
-
value = !value;
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
<span data-state={value ? 'checked' : 'unchecked'} class={classes.thumb({ class: ui.thumb })}>
|
|
130
|
-
{@render Icon(uncheckedicon, [(loading || value) && 'opacity-0'])}
|
|
131
|
-
{@render Icon(checkedicon, [(loading || !value) && 'opacity-0'])}
|
|
132
|
-
{@render Icon(loadingicon || 'i-lucide-loader-circle', [
|
|
133
|
-
'animate-spin',
|
|
134
|
-
!loading && 'opacity-0'
|
|
135
|
-
])}
|
|
136
|
-
</span>
|
|
137
|
-
</button>
|
|
138
|
-
|
|
139
|
-
{#if label}
|
|
140
|
-
<span>
|
|
141
|
-
<div
|
|
142
|
-
class={classes.label({
|
|
143
|
-
class: [required ? 'after:content-["*"] after:text-error-500' : '', ui.thumb]
|
|
144
|
-
})}
|
|
145
|
-
>
|
|
146
|
-
{#if typeof label === 'string'}
|
|
147
|
-
{label}
|
|
148
|
-
{:else}
|
|
149
|
-
{@render label()}
|
|
150
|
-
{/if}
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
{#if description}
|
|
154
|
-
<div class={classes.description({ class: ui.thumb })}>
|
|
155
|
-
{#if typeof description === 'string'}
|
|
156
|
-
{description}
|
|
157
|
-
{:else}
|
|
158
|
-
{@render description()}
|
|
159
|
-
{/if}
|
|
160
|
-
</div>
|
|
161
|
-
{/if}
|
|
162
|
-
</span>
|
|
163
|
-
{/if}
|
|
164
|
-
</div>
|
|
165
|
-
|
|
166
|
-
{#snippet Icon(ico?: SwitchProps['checkedicon'], icon_class?: ClassNameValue)}
|
|
167
|
-
<div class={['absolute', icon_class]}>
|
|
168
|
-
{#if typeof ico === 'string'}
|
|
169
|
-
<div
|
|
170
|
-
data-state={value ? 'checked' : 'unchecked'}
|
|
171
|
-
class={classes.icon({ class: [ico] })}
|
|
172
|
-
></div>
|
|
173
|
-
{:else if isSnippet(ico)}
|
|
174
|
-
{@render ico()}
|
|
175
|
-
{:else if isComponent(ico)}
|
|
176
|
-
{@const Iconn = ico}
|
|
177
|
-
<Iconn />
|
|
178
|
-
{/if}
|
|
179
|
-
</div>
|
|
180
|
-
{/snippet}
|
|
@@ -1,27 +0,0 @@
|
|
|
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 'vitest-browser-svelte';
|
|
5
|
-
export type SwitchProps = {
|
|
6
|
-
value?: boolean;
|
|
7
|
-
color?: PropColor;
|
|
8
|
-
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
loading?: boolean;
|
|
11
|
-
loadingicon?: string | Snippet | Component;
|
|
12
|
-
uncheckedicon?: string | Snippet | Component;
|
|
13
|
-
checkedicon?: string | Snippet | Component;
|
|
14
|
-
label?: string | Snippet;
|
|
15
|
-
description?: string | Snippet;
|
|
16
|
-
required?: boolean;
|
|
17
|
-
ui?: {
|
|
18
|
-
root?: ClassNameValue;
|
|
19
|
-
container?: ClassNameValue;
|
|
20
|
-
thumb?: ClassNameValue;
|
|
21
|
-
label?: ClassNameValue;
|
|
22
|
-
description?: ClassNameValue;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
declare const Switch: import("svelte").Component<SwitchProps, {}, "value">;
|
|
26
|
-
type Switch = ReturnType<typeof Switch>;
|
|
27
|
-
export default Switch;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
package/dist/utils/common.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Snippet, Component } from 'svelte';
|
|
2
|
-
/**
|
|
3
|
-
* Checks if a value is a Svelte snippet
|
|
4
|
-
* @param v - The value to check (should be Snippet | Component)
|
|
5
|
-
* @returns true if the value is a snippet, false otherwise
|
|
6
|
-
*/
|
|
7
|
-
export declare const isSnippet: (v: unknown) => v is Snippet;
|
|
8
|
-
/**
|
|
9
|
-
* Checks if a value is a Svelte component
|
|
10
|
-
* @param v - The value to check (should be Snippet | Component)
|
|
11
|
-
* @returns true if the value is a component, false otherwise
|
|
12
|
-
*/
|
|
13
|
-
export declare const isComponent: (v: unknown) => v is Component;
|
package/dist/utils/common.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if a value is a Svelte snippet
|
|
3
|
-
* @param v - The value to check (should be Snippet | Component)
|
|
4
|
-
* @returns true if the value is a snippet, false otherwise
|
|
5
|
-
*/
|
|
6
|
-
export const isSnippet = (v) => {
|
|
7
|
-
return typeof v === 'object' && v !== null && '$$render' in v;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Checks if a value is a Svelte component
|
|
11
|
-
* @param v - The value to check (should be Snippet | Component)
|
|
12
|
-
* @returns true if the value is a component, false otherwise
|
|
13
|
-
*/
|
|
14
|
-
export const isComponent = (v) => {
|
|
15
|
-
return typeof v === 'function' || (typeof v === 'object' && v !== null && !('$$render' in v));
|
|
16
|
-
};
|
package/dist/vite.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type WebFontsOptions } from '@unocss/preset-web-fonts';
|
|
2
|
-
import type { PropColor } from './types.js';
|
|
3
|
-
export type PluginOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* Colors as UnoCSS color name, hex color, or UnoCSS theme color object
|
|
6
|
-
* @example
|
|
7
|
-
* {
|
|
8
|
-
* primary: 'orange',
|
|
9
|
-
* secondary: 'neutral',
|
|
10
|
-
* info: '#00F',
|
|
11
|
-
* success: '#0F0',
|
|
12
|
-
* warning: 'FF0',
|
|
13
|
-
* error: {
|
|
14
|
-
* 50: '#fef2f2';
|
|
15
|
-
* 100: '#fee2e2';
|
|
16
|
-
* 200: '#fecaca';
|
|
17
|
-
* 300: '#fca5a5';
|
|
18
|
-
* 400: '#f87171';
|
|
19
|
-
* 500: '#ef4444';
|
|
20
|
-
* 600: '#dc2626';
|
|
21
|
-
* 700: '#b91c1c';
|
|
22
|
-
* 800: '#991b1b';
|
|
23
|
-
* 900: '#7f1d1d';
|
|
24
|
-
* 950: '#450a0a';
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
*/
|
|
28
|
-
colors?: Partial<Record<PropColor, string | Record<number, string>>>;
|
|
29
|
-
/**
|
|
30
|
-
* Options for the UnoCSS web fonts plugin
|
|
31
|
-
*/
|
|
32
|
-
fonts?: WebFontsOptions;
|
|
33
|
-
/**
|
|
34
|
-
* Corner radius for every* component
|
|
35
|
-
*/
|
|
36
|
-
radius?: number;
|
|
37
|
-
};
|
|
38
|
-
export declare function uisv(options: Required<PluginOptions>): import("vite").Plugin<any>[][];
|
package/dist/vite.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import uno_plugin from 'unocss/vite';
|
|
2
|
-
import { transformerVariantGroup, transformerCompileClass, transformerDirectives, presetWind4, presetWebFonts } from 'unocss';
|
|
3
|
-
import {} from '@unocss/preset-web-fonts';
|
|
4
|
-
import { presetIcons } from 'unocss';
|
|
5
|
-
import { defu } from 'defu';
|
|
6
|
-
import { getColors } from 'theme-colors';
|
|
7
|
-
export function uisv(options) {
|
|
8
|
-
const _opts = defu(options, {
|
|
9
|
-
colors: {
|
|
10
|
-
primary: 'orange',
|
|
11
|
-
secondary: 'neutral',
|
|
12
|
-
info: 'blue',
|
|
13
|
-
success: 'green',
|
|
14
|
-
warning: 'yellow',
|
|
15
|
-
error: 'red'
|
|
16
|
-
},
|
|
17
|
-
fonts: {
|
|
18
|
-
fonts: {
|
|
19
|
-
sans: 'Public Sans:400,500,600'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return [
|
|
24
|
-
uno_plugin({
|
|
25
|
-
theme: {
|
|
26
|
-
radius: {
|
|
27
|
-
base: `${_opts.radius || 0.375}rem`
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
preflights: [
|
|
31
|
-
{
|
|
32
|
-
getCSS: () => 'body { font-size: var(--font-sans);}'
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
presets: [
|
|
36
|
-
presetWind4({
|
|
37
|
-
preflights: {
|
|
38
|
-
reset: true
|
|
39
|
-
}
|
|
40
|
-
}),
|
|
41
|
-
presetWebFonts(_opts.fonts),
|
|
42
|
-
presetIcons()
|
|
43
|
-
],
|
|
44
|
-
transformers: [transformerVariantGroup(), transformerCompileClass(), transformerDirectives()],
|
|
45
|
-
extendTheme: (theme) => {
|
|
46
|
-
for (const [color, value] of Object.entries(_opts.colors)) {
|
|
47
|
-
if (typeof value !== 'string') {
|
|
48
|
-
theme.colors[color] = value;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
const in_theme = theme.colors[value];
|
|
52
|
-
theme.colors[color] = in_theme ? in_theme : getColors(value);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
];
|
|
57
|
-
}
|