vitrify 0.17.4 → 0.17.5

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.
@@ -1,6 +1,6 @@
1
1
  // Import normalize and animate css
2
2
  import { definePreset, transformerVariantGroup } from 'unocss';
3
- import presetWind from '@unocss/preset-wind';
3
+ import presetUno from '@unocss/preset-uno';
4
4
  import theme from './theme.js';
5
5
  import { animatedUno } from 'animated-unocss';
6
6
  import { shortcuts as QIconShortcuts } from './components/QIcon.unocss.js';
@@ -97,7 +97,136 @@ const toKebabCase = (str) => str
97
97
  .match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
98
98
  ?.map((x) => x.toLowerCase())
99
99
  .join('-') ?? '';
100
- const safelist = [
100
+ const pluginSafelistMap = {
101
+ BottomSheet: [
102
+ 'q-bottom-sheet',
103
+ 'q-bottom-sheet__avatar',
104
+ 'q-bottom-sheet--list',
105
+ 'q-bottom-sheet--grid',
106
+ 'q-bottom-sheet__item'
107
+ ],
108
+ Dialog: [
109
+ 'q-dialog__title',
110
+ 'q-dialog__progress',
111
+ 'q-dialog__inner',
112
+ 'q-dialog__inner--square',
113
+ 'q-dialog__inner--minimized',
114
+ 'q-dialog__inner--maximized',
115
+ 'q-dialog__inner--top',
116
+ 'q-dialog__inner--bottom',
117
+ 'q-dialog__inner--right',
118
+ 'q-dialog__inner--left',
119
+ 'q-dialog__inner--fullwidth',
120
+ 'q-dialog__inner--fullheight',
121
+ 'q-dialog__backdrop',
122
+ 'q-btn',
123
+ 'q-btn--actionable',
124
+ 'q-btn--no-uppercase',
125
+ 'q-btn--rectangle',
126
+ 'q-btn--outline',
127
+ 'q-btn--push',
128
+ 'q-btn--rounded',
129
+ 'q-btn--round',
130
+ 'q-btn--square',
131
+ 'q-btn--flat',
132
+ 'q-btn--unelevated',
133
+ 'q-btn--dense',
134
+ 'q-btn--fab',
135
+ 'q-btn--fab-mini',
136
+ 'q-btn__content',
137
+ 'q-btn__content--hidden',
138
+ 'q-btn__progress',
139
+ 'q-btn__progress-indicator',
140
+ 'q-btn__progress--dark',
141
+ 'q-card',
142
+ 'q-card--bordered',
143
+ 'q-card--dark',
144
+ 'q-card__section',
145
+ 'q-card__section--vert',
146
+ 'q-card__section--horiz',
147
+ 'q-card__actions',
148
+ 'q-card__actions--horiz',
149
+ 'q-card__actions--vert',
150
+ 'q-separator--spaced',
151
+ 'q-textarea',
152
+ 'q-textarea--autogrow',
153
+ 'q-field',
154
+ 'q-field--with-bottom',
155
+ 'q-field__marginal',
156
+ 'q-field__before',
157
+ 'q-field__prepend',
158
+ 'q-field__after',
159
+ 'q-field__append',
160
+ 'q-field__inner',
161
+ 'q-field__bottom',
162
+ 'q-field__bottom--animated',
163
+ 'q-field__messages',
164
+ 'q-field__counter',
165
+ 'q-field--item-aligned',
166
+ 'q-field__control-container',
167
+ 'q-field__control',
168
+ 'q-field__shadow',
169
+ 'q-field__native',
170
+ 'q-field__prefix',
171
+ 'q-field__suffix',
172
+ 'q-field__input',
173
+ 'q-field--readonly',
174
+ 'q-field--disabled',
175
+ 'q-field__label',
176
+ 'q-field--float',
177
+ 'q-field--highlighted',
178
+ 'q-field--filled',
179
+ 'q-field--outlined',
180
+ 'q-field--standard',
181
+ 'q-field--dark',
182
+ 'q-field--standout',
183
+ 'q-field--labeled',
184
+ 'q-field--dense',
185
+ 'q-field--borderless',
186
+ 'q-field--error',
187
+ 'q-field__focusable-action',
188
+ 'q-field--auto-height',
189
+ 'q-field--square',
190
+ 'q-option-group--inline',
191
+ 'q-spinner',
192
+ 'q-spinner-mat'
193
+ ],
194
+ LoadingBar: [
195
+ 'q-loading-bar',
196
+ 'q-loading-bar--top',
197
+ 'q-loading-bar--bottom',
198
+ 'q-loading-bar--right',
199
+ 'q-loading-bar--left'
200
+ ],
201
+ Notify: [
202
+ 'q-avatar',
203
+ 'q-avatar__content',
204
+ 'q-avatar--square',
205
+ 'q-icon',
206
+ 'q-btn',
207
+ 'q-btn--actionable',
208
+ 'q-btn--no-uppercase',
209
+ 'q-btn--rectangle',
210
+ 'q-btn--outline',
211
+ 'q-btn--push',
212
+ 'q-btn--rounded',
213
+ 'q-btn--round',
214
+ 'q-btn--square',
215
+ 'q-btn--flat',
216
+ 'q-btn--unelevated',
217
+ 'q-btn--dense',
218
+ 'q-btn--fab',
219
+ 'q-btn--fab-mini',
220
+ 'q-btn__content',
221
+ 'q-btn__content--hidden',
222
+ 'q-btn__progress',
223
+ 'q-btn__progress-indicator',
224
+ 'q-btn__progress--dark',
225
+ 'q-spinner',
226
+ 'q-spinner-mat'
227
+ ]
228
+ };
229
+ const baseSafelist = [
101
230
  'material-icons',
102
231
  'material-icons-outlined',
103
232
  'material-icons-round',
@@ -1203,11 +1332,22 @@ const qClasses = [
1203
1332
  'q-notification--bottom-leave-active',
1204
1333
  'q-notification--bottom-right-leave-active'
1205
1334
  ];
1206
- export default definePreset((options) => {
1335
+ const generateSafelist = (plugins) => {
1336
+ let safelist = baseSafelist;
1337
+ if (plugins) {
1338
+ for (const plugin of plugins) {
1339
+ const pluginSafelist = pluginSafelistMap[plugin];
1340
+ if (pluginSafelist)
1341
+ safelist = safelist.concat(pluginSafelist);
1342
+ }
1343
+ }
1344
+ return safelist;
1345
+ };
1346
+ export default definePreset((options = {}) => {
1207
1347
  return {
1208
1348
  name: 'quasar',
1209
- presets: [presetWind(), animatedUno()],
1210
- safelist,
1349
+ presets: [presetUno(), animatedUno()],
1350
+ safelist: generateSafelist(options?.plugins),
1211
1351
  preflights: [
1212
1352
  {
1213
1353
  getCSS: ({ theme }) => `/* beasties:include start */
@@ -1,4 +1,6 @@
1
+ import { type QuasarPlugins } from 'quasar';
1
2
  export interface QuasarPresetOptions {
3
+ plugins?: (keyof QuasarPlugins)[];
2
4
  theme?: {
3
5
  shadowColor?: string;
4
6
  darkShadowColor?: string;
@@ -1,16 +1,14 @@
1
1
  import type { VitrifyPlugin } from './index.js';
2
+ import { type QuasarFonts, type QuasarComponents, type QuasarDirectives, type QuasarIconSets, type QuasarPlugins } from 'quasar';
2
3
  export interface QuasarConf {
3
- ctx?: Record<string, any>;
4
- css?: string[];
5
- boot?: string[];
6
4
  framework: {
7
- components?: string[];
8
- directives?: string[];
9
- plugins?: string[];
5
+ components?: (keyof QuasarComponents)[];
6
+ directives?: (keyof QuasarDirectives)[];
7
+ plugins?: (keyof QuasarPlugins)[];
10
8
  lang?: string;
11
- iconSet?: string;
9
+ iconSet?: QuasarIconSets;
12
10
  };
13
- extras?: string[];
11
+ extras?: (QuasarIconSets | QuasarFonts)[];
14
12
  disableSass?: boolean;
15
13
  }
16
14
  export declare const injectSsrContext: (html: string, ssrContext: Record<string, any>) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitrify",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "license": "MIT",
5
5
  "author": "Stefan van Herwijnen",
6
6
  "description": "Vite as your Full Stack development tool",
@@ -6,7 +6,7 @@ import {
6
6
  transformerVariantGroup,
7
7
  type UserShortcuts
8
8
  } from 'unocss'
9
- import presetWind from '@unocss/preset-wind'
9
+ import presetUno from '@unocss/preset-uno'
10
10
  import theme, { type QuasarTheme } from './theme.js'
11
11
  import { animatedUno } from 'animated-unocss'
12
12
 
@@ -166,8 +166,10 @@ import {
166
166
  import { shortcuts as QHeaderShortcuts } from './components/QHeader.unocss.js'
167
167
  import { shortcuts as QFooterShortcuts } from './components/QFooter.unocss.js'
168
168
  import { shortcuts as QDrawerShortcuts } from './components/QDrawer.unocss.js'
169
+ import { type QuasarPlugins } from 'quasar'
169
170
 
170
171
  export interface QuasarPresetOptions {
172
+ plugins?: (keyof QuasarPlugins)[]
171
173
  theme?: {
172
174
  shadowColor?: string
173
175
  darkShadowColor?: string
@@ -180,7 +182,137 @@ const toKebabCase = (str: string) =>
180
182
  ?.map((x) => x.toLowerCase())
181
183
  .join('-') ?? ''
182
184
 
183
- const safelist = [
185
+ const pluginSafelistMap: Partial<Record<keyof QuasarPlugins, string[]>> = {
186
+ BottomSheet: [
187
+ 'q-bottom-sheet',
188
+ 'q-bottom-sheet__avatar',
189
+ 'q-bottom-sheet--list',
190
+ 'q-bottom-sheet--grid',
191
+ 'q-bottom-sheet__item'
192
+ ],
193
+ Dialog: [
194
+ 'q-dialog__title',
195
+ 'q-dialog__progress',
196
+ 'q-dialog__inner',
197
+ 'q-dialog__inner--square',
198
+ 'q-dialog__inner--minimized',
199
+ 'q-dialog__inner--maximized',
200
+ 'q-dialog__inner--top',
201
+ 'q-dialog__inner--bottom',
202
+ 'q-dialog__inner--right',
203
+ 'q-dialog__inner--left',
204
+ 'q-dialog__inner--fullwidth',
205
+ 'q-dialog__inner--fullheight',
206
+ 'q-dialog__backdrop',
207
+ 'q-btn',
208
+ 'q-btn--actionable',
209
+ 'q-btn--no-uppercase',
210
+ 'q-btn--rectangle',
211
+ 'q-btn--outline',
212
+ 'q-btn--push',
213
+ 'q-btn--rounded',
214
+ 'q-btn--round',
215
+ 'q-btn--square',
216
+ 'q-btn--flat',
217
+ 'q-btn--unelevated',
218
+ 'q-btn--dense',
219
+ 'q-btn--fab',
220
+ 'q-btn--fab-mini',
221
+ 'q-btn__content',
222
+ 'q-btn__content--hidden',
223
+ 'q-btn__progress',
224
+ 'q-btn__progress-indicator',
225
+ 'q-btn__progress--dark',
226
+ 'q-card',
227
+ 'q-card--bordered',
228
+ 'q-card--dark',
229
+ 'q-card__section',
230
+ 'q-card__section--vert',
231
+ 'q-card__section--horiz',
232
+ 'q-card__actions',
233
+ 'q-card__actions--horiz',
234
+ 'q-card__actions--vert',
235
+ 'q-separator--spaced',
236
+ 'q-textarea',
237
+ 'q-textarea--autogrow',
238
+ 'q-field',
239
+ 'q-field--with-bottom',
240
+ 'q-field__marginal',
241
+ 'q-field__before',
242
+ 'q-field__prepend',
243
+ 'q-field__after',
244
+ 'q-field__append',
245
+ 'q-field__inner',
246
+ 'q-field__bottom',
247
+ 'q-field__bottom--animated',
248
+ 'q-field__messages',
249
+ 'q-field__counter',
250
+ 'q-field--item-aligned',
251
+ 'q-field__control-container',
252
+ 'q-field__control',
253
+ 'q-field__shadow',
254
+ 'q-field__native',
255
+ 'q-field__prefix',
256
+ 'q-field__suffix',
257
+ 'q-field__input',
258
+ 'q-field--readonly',
259
+ 'q-field--disabled',
260
+ 'q-field__label',
261
+ 'q-field--float',
262
+ 'q-field--highlighted',
263
+ 'q-field--filled',
264
+ 'q-field--outlined',
265
+ 'q-field--standard',
266
+ 'q-field--dark',
267
+ 'q-field--standout',
268
+ 'q-field--labeled',
269
+ 'q-field--dense',
270
+ 'q-field--borderless',
271
+ 'q-field--error',
272
+ 'q-field__focusable-action',
273
+ 'q-field--auto-height',
274
+ 'q-field--square',
275
+ 'q-option-group--inline',
276
+ 'q-spinner',
277
+ 'q-spinner-mat'
278
+ ],
279
+ LoadingBar: [
280
+ 'q-loading-bar',
281
+ 'q-loading-bar--top',
282
+ 'q-loading-bar--bottom',
283
+ 'q-loading-bar--right',
284
+ 'q-loading-bar--left'
285
+ ],
286
+ Notify: [
287
+ 'q-avatar',
288
+ 'q-avatar__content',
289
+ 'q-avatar--square',
290
+ 'q-icon',
291
+ 'q-btn',
292
+ 'q-btn--actionable',
293
+ 'q-btn--no-uppercase',
294
+ 'q-btn--rectangle',
295
+ 'q-btn--outline',
296
+ 'q-btn--push',
297
+ 'q-btn--rounded',
298
+ 'q-btn--round',
299
+ 'q-btn--square',
300
+ 'q-btn--flat',
301
+ 'q-btn--unelevated',
302
+ 'q-btn--dense',
303
+ 'q-btn--fab',
304
+ 'q-btn--fab-mini',
305
+ 'q-btn__content',
306
+ 'q-btn__content--hidden',
307
+ 'q-btn__progress',
308
+ 'q-btn__progress-indicator',
309
+ 'q-btn__progress--dark',
310
+ 'q-spinner',
311
+ 'q-spinner-mat'
312
+ ]
313
+ }
314
+
315
+ const baseSafelist = [
184
316
  'material-icons',
185
317
  'material-icons-outlined',
186
318
  'material-icons-round',
@@ -1288,11 +1420,22 @@ const qClasses = [
1288
1420
  'q-notification--bottom-right-leave-active'
1289
1421
  ]
1290
1422
 
1291
- export default definePreset((options?: QuasarPresetOptions) => {
1423
+ const generateSafelist = (plugins?: (keyof QuasarPlugins)[]) => {
1424
+ let safelist = baseSafelist
1425
+ if (plugins) {
1426
+ for (const plugin of plugins) {
1427
+ const pluginSafelist = pluginSafelistMap[plugin]
1428
+ if (pluginSafelist) safelist = safelist.concat(pluginSafelist)
1429
+ }
1430
+ }
1431
+ return safelist
1432
+ }
1433
+
1434
+ export default definePreset((options: QuasarPresetOptions = {}) => {
1292
1435
  return {
1293
1436
  name: 'quasar',
1294
- presets: [presetWind(), animatedUno()],
1295
- safelist,
1437
+ presets: [presetUno(), animatedUno()],
1438
+ safelist: generateSafelist(options?.plugins),
1296
1439
  preflights: (
1297
1440
  [
1298
1441
  {
@@ -7,20 +7,23 @@ import type {
7
7
  } from '../vitrify-config.js'
8
8
  import type { VitrifyPlugin } from './index.js'
9
9
  import { findDepPkgJsonPath } from 'vitefu'
10
+ import {
11
+ type QuasarFonts,
12
+ type QuasarComponents,
13
+ type QuasarDirectives,
14
+ type QuasarIconSets,
15
+ type QuasarPlugins
16
+ } from 'quasar'
10
17
 
11
18
  export interface QuasarConf {
12
- ctx?: Record<string, any>
13
- css?: string[]
14
- boot?: string[]
15
19
  framework: {
16
- components?: string[]
17
- directives?: string[]
18
- plugins?: string[]
20
+ components?: (keyof QuasarComponents)[]
21
+ directives?: (keyof QuasarDirectives)[]
22
+ plugins?: (keyof QuasarPlugins)[]
19
23
  lang?: string
20
- iconSet?: string
24
+ iconSet?: QuasarIconSets
21
25
  }
22
- // animations: string[]
23
- extras?: string[]
26
+ extras?: (QuasarIconSets | QuasarFonts)[]
24
27
  disableSass?: boolean
25
28
  }
26
29