-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
220 lines (217 loc) · 6.65 KB
/
Copy pathvite.config.ts
File metadata and controls
220 lines (217 loc) · 6.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import ui from '@nuxt/ui/vite'
import { mcpWebSocket } from './mcp/vite-plugin'
import pkg from './package.json' with { type: 'json' }
const __dirname = dirname(fileURLToPath(import.meta.url))
const tfVersion = pkg.dependencies['@polydera/trueform'].replace(/^[\^~]/, '')
// https://vite.dev/config/
export default defineConfig(({ mode }) => ({
plugins: [
vue(),
mcpWebSocket(),
// vueDevTools(),
ui({
router: false,
colorMode: false,
autoImport: {
imports: ['vue'],
dirs: ['./src/composables/**', './src/components/**'],
},
ui: {
colors: {
primary: 'teal',
secondary: 'orange',
neutral: 'neutral',
},
button: {
compoundVariants: [
{
color: 'neutral',
variant: 'ghost',
class: 'text-[var(--ln-selection-text)] hover:bg-[var(--ln-hover)] active:bg-[var(--ln-active)]',
},
{
color: 'neutral',
variant: 'solid',
class: 'text-white bg-primary/30 hover:bg-primary/40 active:bg-primary/50',
},
],
},
switch: {
slots: {
base: 'data-[state=unchecked]:bg-[var(--ui-border)]',
},
},
slider: {
slots: {
root: 'w-full',
track: 'bg-[var(--ln-accent-dim)]',
},
},
select: {
slots: {
base: 'w-full ring-0! focus:ring-0! ring-transparent! focus:ring-transparent!',
content: 'bg-[var(--ln-panel)] backdrop-blur-xl',
item: 'text-highlighted data-highlighted:not-data-disabled:before:bg-[var(--ln-selection)]',
},
variants: {
variant: {
outline:
'bg-[var(--ln-muted)] ring-0! hover:bg-[var(--ln-hover)]',
},
},
},
selectMenu: {
slots: {
base: 'w-full ring-0! focus:ring-0! ring-transparent! focus:ring-transparent!',
content: 'bg-[var(--ln-panel)] backdrop-blur-xl',
item: 'text-highlighted data-highlighted:not-data-disabled:before:bg-[var(--ln-selection)] items-center',
},
variants: {
variant: {
outline:
'bg-[var(--ln-muted)] ring-0! hover:bg-[var(--ln-hover)]',
},
},
},
modal: {
slots: {
content: 'bg-[var(--ln-panel)] backdrop-blur-xl divide-[var(--ln-panel-border)]',
},
variants: {
fullscreen: {
false: {
content: 'ring-default/50',
},
},
},
},
popover: {
slots: {
content: 'bg-[var(--ln-panel)] backdrop-blur-xl ring-[var(--ln-panel-border)]',
},
},
tooltip: {
slots: {
content: 'bg-[var(--ln-panel)] backdrop-blur-xl text-highlighted ring-[var(--ln-panel-border)]',
},
},
kbd: {
compoundVariants: [
{
color: 'neutral',
variant: 'outline',
class: 'bg-neutral/20',
},
],
},
tree: {
variants: {
selected: {
true: {
link: 'before:bg-[var(--ln-selection)]',
},
},
},
compoundVariants: [
{
color: 'primary',
selected: true,
class: {
link: 'text-[var(--ln-selection-text)]',
},
},
{
selected: false,
disabled: false,
class: {
link: ['hover:before:bg-[var(--ln-hover)]'],
},
},
],
},
commandPalette: {
slots: {
root: 'divide-[var(--ln-panel-border)]',
// Category header — "Inspect" / "Cut" / "Style" — pops in teal.
label: 'text-[var(--ln-accent)] uppercase tracking-wider font-bold',
itemLabel: 'text-highlighted',
itemLabelSuffix: 'text-default/70',
},
variants: {
active: {
false: {
// Highlighted row uses the brand teal selection background
// instead of the neutral hover tint — it's "where you are",
// not just "what you're over".
item: 'data-highlighted:not-data-disabled:before:bg-[var(--ln-selection)]',
// Leading icons wear teal at 60% opacity, brighten to 100%
// when the row is highlighted. Matches title bar / mode popup.
itemLeadingIcon:
'text-[var(--ln-accent)] opacity-60 group-data-highlighted:not-group-data-disabled:opacity-100',
},
},
virtualize: {
false: {
viewport: 'divide-[var(--ln-panel-border)]',
},
},
},
},
dropdownMenu: {
slots: {
content: 'bg-[var(--ln-panel)] backdrop-blur-xl divide-[var(--ln-panel-border)]',
},
variants: {
active: {
false: {
item: 'data-highlighted:before:bg-[var(--ln-hover)] data-[state=open]:before:bg-elevated/20',
itemLeadingIcon: 'text-default/70',
},
},
},
},
},
}),
],
resolve: {
alias: [
{ find: '@', replacement: resolve(__dirname, 'src') },
{ find: /^aria-hidden$/, replacement: resolve(__dirname, 'src/vendor/aria-hidden.ts') },
// In prod, route trueform through its manual-init entry so `main.ts`
// can call `tf.init({wasmUrl, workerUrl})` with a CDN-backed wasm.
// Dev keeps the auto-init entry for local-bundled iteration.
...(mode === 'production' ? [{ find: '@polydera/trueform', replacement: '@polydera/trueform/manual' }] : []),
],
},
define: {
__TF_VERSION__: JSON.stringify(tfVersion),
},
server: {
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin',
},
fs: {
allow: ['.'],
},
},
optimizeDeps: {
exclude: ['@polydera/trueform'],
entries: [],
},
worker: {
format: 'es',
},
build: {
target: 'esnext',
commonjsOptions: {
exclude: [/trueform/],
},
},
assetsInclude: ['**/*.wasm'],
}))