uisv 0.0.13 → 0.0.14

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.
@@ -0,0 +1,54 @@
1
+ import { type PropColor } from '../index.js';
2
+ import type { Component, Snippet } from 'svelte';
3
+ import type { ClassNameValue } from 'tailwind-merge';
4
+ import { Time } from '@internationalized/date';
5
+ export { Time };
6
+ export { default as InputTime } from './input-time.svelte';
7
+ export type InputTimeProps = {
8
+ id?: string;
9
+ name?: string;
10
+ hourcycle?: 12 | 24;
11
+ max?: Time;
12
+ min?: Time;
13
+ /**
14
+ * The placeholder text when the input is empty.
15
+ */
16
+ placeholder?: string;
17
+ /**
18
+ * @default primary
19
+ */
20
+ color?: PropColor;
21
+ /**
22
+ * @default outline
23
+ */
24
+ variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
25
+ /**
26
+ * @default md
27
+ */
28
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
29
+ /**
30
+ * @default off
31
+ */
32
+ autocomplete?: 'on' | 'off';
33
+ /**
34
+ * @default false
35
+ */
36
+ autofocus?: boolean | number;
37
+ disabled?: boolean;
38
+ /**
39
+ * Highlight the ring color like a focus state.
40
+ */
41
+ highlight?: boolean;
42
+ value?: Time;
43
+ icon?: string | Snippet | Component;
44
+ ui?: {
45
+ root?: ClassNameValue;
46
+ leading?: ClassNameValue;
47
+ icon?: ClassNameValue;
48
+ trailing?: ClassNameValue;
49
+ segment?: ClassNameValue;
50
+ };
51
+ };
52
+ declare const InputTime: Component<InputTimeProps, {}, "value">;
53
+ type InputTime = ReturnType<typeof InputTime>;
54
+ export default InputTime;
@@ -0,0 +1,285 @@
1
+ <script module lang="ts">
2
+ import { type PropColor, isComponent, isSnippet } from '../index.js';
3
+ import type { Component, Snippet } from 'svelte';
4
+ import type { SvelteHTMLElements } from 'svelte/elements';
5
+ import type { ClassNameValue } from 'tailwind-merge';
6
+ import { maska } from 'maska/svelte';
7
+ import { type MaskInputOptions } from 'maska';
8
+ import { tv } from 'tailwind-variants';
9
+
10
+ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
11
+ name?: string;
12
+ /**
13
+ * The placeholder text when the input is empty.
14
+ */
15
+ placeholder?: string;
16
+ /**
17
+ * @default primary
18
+ */
19
+ color?: PropColor;
20
+ /**
21
+ * @default outline
22
+ */
23
+ variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
24
+ /**
25
+ * @default md
26
+ */
27
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
28
+ /**
29
+ * @default off
30
+ */
31
+ autocomplete?: 'on' | 'off';
32
+ /**
33
+ * @default false
34
+ */
35
+ autofocus?: boolean | number;
36
+ disabled?: boolean;
37
+ /**
38
+ * Highlight the ring color like a focus state.
39
+ */
40
+ highlight?: boolean;
41
+ value?: string;
42
+ icon?: string | Snippet | Component;
43
+ iconposition?: 'leading' | 'trailing';
44
+ leading?: string | Snippet | Component;
45
+ trailing?: string | Snippet | Component;
46
+ loading?: boolean;
47
+ loadingicon?: string | Snippet | Component;
48
+ mask?: string | MaskInputOptions;
49
+ ui?: {
50
+ root?: ClassNameValue;
51
+ base?: ClassNameValue;
52
+ leading?: ClassNameValue;
53
+ icon?: ClassNameValue;
54
+ trailing?: ClassNameValue;
55
+ };
56
+ };
57
+ </script>
58
+
59
+ <script lang="ts">
60
+ let {
61
+ type,
62
+ value = $bindable(),
63
+ color = 'primary',
64
+ variant = 'outline',
65
+ size = 'md',
66
+ icon,
67
+ iconposition,
68
+ disabled,
69
+ highlight,
70
+ leading,
71
+ loading,
72
+ loadingicon = 'i-lucide-loader-circle',
73
+ required,
74
+ trailing,
75
+ mask,
76
+ ui = {},
77
+ ...rest
78
+ }: InputProps = $props();
79
+ const id = $props.id();
80
+
81
+ const variants = $derived(
82
+ tv({
83
+ slots: {
84
+ root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
85
+ base: 'appearance-none outline-none placeholder:text-muted',
86
+ leading: 'text-muted',
87
+ trailing: 'text-muted',
88
+ icon: '',
89
+ },
90
+ variants: {
91
+ fieldGroup: {
92
+ horizontal: {
93
+ root: '',
94
+ base: '',
95
+ },
96
+ vertical: {
97
+ root: '',
98
+ base: '',
99
+ },
100
+ },
101
+ size: {
102
+ xs: {
103
+ base: 'px-2 py-1 text-xs gap-1',
104
+ leading: 'ps-2',
105
+ trailing: 'pe-2',
106
+ icon: 'size-4',
107
+ },
108
+ sm: {
109
+ base: 'px-2.5 py-1.5 text-xs gap-1.5',
110
+ leading: 'ps-2.5',
111
+ trailing: 'pe-2.5',
112
+ icon: 'size-4',
113
+ },
114
+ md: {
115
+ base: 'px-2.5 py-1.5 text-sm gap-1.5',
116
+ leading: 'ps-2.5',
117
+ trailing: 'pe-2.5',
118
+ icon: 'size-5',
119
+ },
120
+ lg: {
121
+ base: 'px-3 py-2 text-sm gap-2',
122
+ leading: 'ps-3',
123
+ trailing: 'pe-3',
124
+ icon: 'size-5',
125
+ },
126
+ xl: {
127
+ base: 'px-3 py-2 text-base gap-2',
128
+ leading: 'ps-3',
129
+ trailing: 'pe-3',
130
+ icon: 'size-6',
131
+ },
132
+ },
133
+ variant: {
134
+ outline: { root: 'ring ring-dimmed' },
135
+ soft: {
136
+ root: 'bg-surface-muted hover:bg-surface-elevated focus-within:bg-surface-elevated',
137
+ },
138
+ subtle: { root: 'ring ring-dimmed' },
139
+ ghost: { root: 'hover:bg-surface-elevated focus-within:bg-surface-elevated' },
140
+ none: { root: '' },
141
+ },
142
+ color: {
143
+ primary: { root: '' },
144
+ surface: { root: '' },
145
+ info: { root: '' },
146
+ success: { root: '' },
147
+ warning: { root: '' },
148
+ error: { root: '' },
149
+ },
150
+ leading: {
151
+ false: { leading: 'hidden' },
152
+ },
153
+ trailing: {
154
+ false: { trailing: 'hidden' },
155
+ },
156
+ loading: {
157
+ true: '',
158
+ },
159
+ highlight: {
160
+ true: '',
161
+ },
162
+ type: {
163
+ file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
164
+ },
165
+ },
166
+ compoundVariants: [
167
+ {
168
+ color: 'primary',
169
+ variant: ['outline', 'subtle'],
170
+ class: {
171
+ root: 'focus-within:(ring-primary-500 ring-2)',
172
+ },
173
+ },
174
+ {
175
+ color: 'surface',
176
+ variant: ['outline', 'subtle'],
177
+ class: {
178
+ root: 'focus-within:(ring-surface-800 ring-2)',
179
+ },
180
+ },
181
+ {
182
+ color: 'info',
183
+ variant: ['outline', 'subtle'],
184
+ class: {
185
+ root: 'focus-within:(ring-info-500 ring-2)',
186
+ },
187
+ },
188
+ {
189
+ color: 'success',
190
+ variant: ['outline', 'subtle'],
191
+ class: {
192
+ root: 'focus-within:(ring-success-500 ring-2)',
193
+ },
194
+ },
195
+ {
196
+ color: 'warning',
197
+ variant: ['outline', 'subtle'],
198
+ class: {
199
+ root: 'focus-within:(ring-warning-500 ring-2)',
200
+ },
201
+ },
202
+ {
203
+ color: 'error',
204
+ variant: ['outline', 'subtle'],
205
+ class: {
206
+ root: 'focus-within:(ring-error-500 ring-2)',
207
+ },
208
+ },
209
+ ],
210
+ })({
211
+ size,
212
+ color,
213
+ variant,
214
+ highlight,
215
+ loading,
216
+ leading: !!leading || (!!icon && iconposition === 'leading') || loading,
217
+ trailing: !!trailing || (!!icon && iconposition === 'trailing'),
218
+ type: type === 'file' ? 'file' : undefined,
219
+ }),
220
+ );
221
+ </script>
222
+
223
+ <div class={variants.root({ class: ui.root })}>
224
+ {#if leading || (icon && iconposition === 'leading') || loading}
225
+ {@const TrailingIcon = loading ? loadingicon : icon}
226
+
227
+ <span class={variants.leading({ class: ui.leading })}>
228
+ {#if !!leading && !loading}
229
+ {#if typeof leading === 'string'}
230
+ {leading}
231
+ {:else if isSnippet(leading)}
232
+ {@render leading()}
233
+ {:else if isComponent(leading)}
234
+ {@const Leading = leading}
235
+ <Leading />
236
+ {/if}
237
+ {:else if typeof TrailingIcon === 'string'}
238
+ <div
239
+ class={variants.icon({
240
+ class: [loading && 'animate-spin', TrailingIcon, ui.icon],
241
+ })}
242
+ ></div>
243
+ {:else if isSnippet(TrailingIcon)}
244
+ {@render TrailingIcon()}
245
+ {:else if isComponent(TrailingIcon)}
246
+ <TrailingIcon class={variants.icon({ class: [ui.icon] })} />
247
+ {/if}
248
+ </span>
249
+ {/if}
250
+
251
+ <input
252
+ {id}
253
+ {type}
254
+ {...rest}
255
+ class={variants.base({ class: [ui.base] })}
256
+ {...rest}
257
+ use:maska={mask}
258
+ />
259
+
260
+ {#if trailing || (icon && iconposition === 'trailing')}
261
+ <span class={variants.trailing({ class: ui.trailing })}>
262
+ {#if !!trailing}
263
+ {#if typeof trailing === 'string'}
264
+ {trailing}
265
+ {:else if isSnippet(trailing)}
266
+ {@render trailing()}
267
+ {:else if isComponent(trailing)}
268
+ {@const Trailing = trailing}
269
+ <Trailing />
270
+ {/if}
271
+ {:else if typeof icon === 'string'}
272
+ <div
273
+ class={variants.icon({
274
+ class: [icon, ui.icon],
275
+ })}
276
+ ></div>
277
+ {:else if isSnippet(icon)}
278
+ {@render icon()}
279
+ {:else if isComponent(icon)}
280
+ {@const Icon = icon}
281
+ <Icon class={variants.icon({ class: [ui.icon] })} />
282
+ {/if}
283
+ </span>
284
+ {/if}
285
+ </div>
@@ -1,10 +1,8 @@
1
- import type { PropColor } from '../../index.js';
1
+ import { type PropColor } from '../index.js';
2
2
  import type { Component, Snippet } from 'svelte';
3
3
  import type { SvelteHTMLElements } from 'svelte/elements';
4
4
  import type { ClassNameValue } from 'tailwind-merge';
5
- import type { MaskInputOptions } from 'maska';
6
- export { default as Input } from './input.svelte';
7
- export * from './style.js';
5
+ import { type MaskInputOptions } from 'maska';
8
6
  export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
9
7
  name?: string;
10
8
  /**
@@ -52,3 +50,6 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
52
50
  trailing?: ClassNameValue;
53
51
  };
54
52
  };
53
+ declare const Input: Component<InputProps, {}, "value">;
54
+ type Input = ReturnType<typeof Input>;
55
+ export default Input;
@@ -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
- <Icon icon={IconProp} class={classes.icon({ class: ui.icon })} />
243
+ <div class={classes.icon({ class: [IconProp, ui.icon] })}></div>
245
244
  {/if}
246
245
  {/snippet}
package/dist/vite.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { presetIcons } from 'unocss';
2
2
  import { type WebFontsOptions } from '@unocss/preset-web-fonts';
3
3
  import type { PropColor } from './index.js';
4
+ import type { Plugin } from 'vite';
4
5
  export type Colors = Record<string, string | Record<string, string>>;
5
6
  export type NestedObject<K extends string, V> = {
6
7
  [key in K]: NestedObject<K, V> | V;
@@ -48,4 +49,4 @@ export type PluginOptions = {
48
49
  */
49
50
  icons?: Parameters<typeof presetIcons>[0];
50
51
  };
51
- export declare function uisv(options: PluginOptions): import("vite").Plugin<any>[][];
52
+ export declare function uisv(options: PluginOptions): Plugin<any>[][];
package/dist/vite.js CHANGED
@@ -3,8 +3,8 @@ import { transformerVariantGroup, transformerCompileClass, transformerDirectives
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';
6
+ import { dir, exists, write } from 'files';
7
+ import { resolve } from 'node:path';
8
8
  export function uisv(options) {
9
9
  const _opts = defu(options, {
10
10
  colors: {
@@ -27,39 +27,18 @@ export function uisv(options) {
27
27
  },
28
28
  },
29
29
  });
30
- // const semantics_preset = semantics({
31
- // colors: _opts.colors,
32
- // light: {
33
- // base: 'surface.700',
34
- // dimmed: 'surface.400',
35
- // muted: 'surface.500',
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
- // },
46
- // },
47
- // dark: {
48
- // base: 'surface.700',
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
- // },
61
- // },
62
- // });
30
+ const theme_plugin = {
31
+ name: 'vite-plugin-uisv',
32
+ enforce: 'pre',
33
+ async configResolved() {
34
+ const path = resolve('node_modules/uisv/theme.js');
35
+ console.log(await write(path, `export const button = {}`));
36
+ },
37
+ resolveId(source, importer, options) {
38
+ if (source === '$build')
39
+ return resolve('node_modules/uisv/theme.js');
40
+ },
41
+ };
63
42
  return [
64
43
  uno_plugin({
65
44
  content: {
@@ -100,8 +79,6 @@ export function uisv(options) {
100
79
  background-color: var(--colors-inverted);
101
80
  }
102
81
 
103
-
104
-
105
82
  .dark {
106
83
  ${variables}
107
84
  }
@@ -118,8 +95,6 @@ export function uisv(options) {
118
95
  }),
119
96
  presetWebFonts(_opts.fonts),
120
97
  presetIcons(_opts.icons),
121
- // semantics_preset,
122
- // theme_preset,
123
98
  ],
124
99
  transformers: [transformerVariantGroup(), transformerCompileClass(), transformerDirectives()],
125
100
  extendTheme: (theme) => {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "uisv",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
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,71 @@
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"
40
42
  }
41
43
  },
42
44
  "peerDependencies": {
43
45
  "svelte": "^5.0.0"
44
46
  },
45
47
  "devDependencies": {
46
- "@eslint/compat": "^2.0.1",
47
- "@eslint/js": "^9.39.2",
48
+ "@eslint/compat": "^2.0.2",
49
+ "@eslint/js": "^10.0.1",
48
50
  "@iconify-json/logos": "^1.2.10",
49
- "@iconify-json/lucide": "^1.2.84",
51
+ "@iconify-json/lucide": "^1.2.90",
50
52
  "@iconify-json/solar": "^1.2.5",
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
+ "@internationalized/date": "^3.11.0",
54
+ "@sveltejs/adapter-auto": "^7.0.1",
55
+ "@sveltejs/kit": "^2.52.0",
55
56
  "@sveltejs/package": "^2.5.7",
56
57
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
57
58
  "@tailwindcss/vite": "^4.1.18",
58
- "@types/node": "^25.0.7",
59
- "@unocss/preset-web-fonts": "^66.5.12",
59
+ "@types/node": "^25.2.3",
60
+ "@unocss/preset-web-fonts": "^66.6.0",
60
61
  "@unocss/reset": "^66.6.0",
61
- "@vitest/browser": "^4.0.17",
62
- "bits-ui": "^2.15.4",
62
+ "@vitest/browser": "^4.0.18",
63
+ "bits-ui": "^2.15.5",
63
64
  "carta-md": "^4.11.1",
64
- "colortranslator": "^5.0.0",
65
65
  "defu": "^6.1.4",
66
66
  "doc-path": "^4.1.3",
67
- "eslint": "^9.39.2",
67
+ "eslint": "^10.0.0",
68
68
  "eslint-config-prettier": "^10.1.8",
69
- "eslint-plugin-svelte": "^3.14.0",
69
+ "eslint-plugin-svelte": "^3.15.0",
70
70
  "files": "^3.0.2",
71
- "globals": "^16.5.0",
72
- "maska": "^3.2.0",
73
- "mdsvex": "^0.12.6",
71
+ "globals": "^17.3.0",
74
72
  "mode-watcher": "^1.1.0",
75
- "playwright": "^1.57.0",
76
- "prettier": "^3.7.4",
73
+ "playwright": "^1.58.2",
74
+ "prettier": "^3.8.1",
77
75
  "prettier-plugin-svelte": "^3.4.1",
78
- "publint": "^0.3.16",
76
+ "publint": "^0.3.17",
79
77
  "runed": "^0.37.1",
80
78
  "scule": "^1.3.0",
81
- "svelte": "^5.46.3",
82
- "svelte-check": "^4.3.5",
79
+ "svelte": "^5.51.2",
80
+ "svelte-check": "^4.4.0",
83
81
  "svelte-exmarkdown": "^5.0.2",
84
- "tailwind-merge": "^3.4.0",
82
+ "tailwind-merge": "^3.4.1",
85
83
  "tailwind-variants": "^3.2.2",
86
84
  "theme-colors": "^0.1.0",
87
85
  "typescript": "^5.9.3",
88
- "typescript-eslint": "^8.53.0",
89
- "unocss": "^66.5.12",
86
+ "typescript-eslint": "^8.55.0",
87
+ "unocss": "^66.6.0",
90
88
  "unocss-preset-theme": "^0.14.1",
91
- "unplugin-icons": "^22.5.0",
89
+ "unplugin-icons": "^23.0.1",
92
90
  "vite": "^7.3.1",
93
- "vitest": "^4.0.17",
94
- "vitest-browser-svelte": "^2.0.1"
91
+ "vitest": "^4.0.18",
92
+ "vitest-browser-svelte": "^2.0.2"
93
+ },
94
+ "dependencies": {
95
+ "colortranslator": "^5.0.0",
96
+ "maska": "^3.2.0"
95
97
  },
96
98
  "keywords": [
97
99
  "svelte",
98
100
  "ui"
99
- ],
100
- "pnpm": {
101
- "onlyBuiltDependencies": [
102
- "esbuild"
103
- ]
104
- }
101
+ ]
105
102
  }