unocss-preset-quasar 0.1.2 → 0.1.4
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/index.js +3 -14
- package/dist/styles/index.js +3 -3
- package/dist/styles/md2/components/QBanner.unocss.js +1 -1
- package/dist/styles/md3/components/QBanner.unocss.js +1 -1
- package/dist/styles/md3/components/QBtnToggle.unocss.js +3 -3
- package/dist/styles/md3/components/QDrawer.unocss.js +2 -2
- package/dist/styles/md3/components/QIcon.unocss.js +1 -1
- package/dist/styles/md3/components/QToggle.unocss.js +8 -8
- package/dist/theme.js +1 -1
- package/dist/types/index.d.ts +2 -6
- package/dist/types/styles/index.d.ts +3 -3
- package/dist/types/theme.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +129 -145
- package/src/styles/index.ts +14 -3
- package/src/styles/md2/components/QBanner.unocss.ts +1 -1
- package/src/styles/md3/components/QBanner.unocss.ts +1 -1
- package/src/styles/md3/components/QBtnToggle.unocss.ts +3 -3
- package/src/styles/md3/components/QDrawer.unocss.ts +2 -2
- package/src/styles/md3/components/QIcon.unocss.ts +1 -1
- package/src/styles/md3/components/QToggle.unocss.ts +8 -8
- package/src/styles/md3/index.ts +0 -1
- package/src/theme.ts +1 -3
package/dist/index.js
CHANGED
|
@@ -3,10 +3,6 @@ import presetWind3 from '@unocss/preset-wind3';
|
|
|
3
3
|
import { generateTheme } from './theme.js';
|
|
4
4
|
import { animatedUno } from 'animated-unocss';
|
|
5
5
|
import { preflights as corePreflights, rules as coreRules, shortcuts as coreShortcuts } from './core/index.js';
|
|
6
|
-
const QuasarStyles = {
|
|
7
|
-
md2: import('./styles/md2/index.js'),
|
|
8
|
-
md3: import('./styles/md3/index.js')
|
|
9
|
-
};
|
|
10
6
|
const extractKeys = (obj) => Object.values(obj).reduce((acc, cur) => {
|
|
11
7
|
if (typeof cur === 'string')
|
|
12
8
|
acc.push(cur);
|
|
@@ -1475,19 +1471,12 @@ const generateSafelist = ({ plugins, iconSet }) => {
|
|
|
1475
1471
|
}
|
|
1476
1472
|
return safelist;
|
|
1477
1473
|
};
|
|
1478
|
-
export const QuasarPreset = definePreset(
|
|
1479
|
-
if (!options)
|
|
1480
|
-
options = {
|
|
1481
|
-
style: 'md2',
|
|
1482
|
-
sourceColor: '#806cb0'
|
|
1483
|
-
};
|
|
1484
|
-
if (!Object.keys(QuasarStyles).includes(options.style))
|
|
1485
|
-
throw new Error('Unsupported Quasar style');
|
|
1474
|
+
export const QuasarPreset = definePreset((options) => {
|
|
1486
1475
|
if (!options.sourceColor) {
|
|
1487
1476
|
options.sourceColor = '#806cb0';
|
|
1488
1477
|
}
|
|
1489
|
-
const style =
|
|
1490
|
-
const theme =
|
|
1478
|
+
const style = options.style;
|
|
1479
|
+
const theme = generateTheme(options.sourceColor);
|
|
1491
1480
|
return [
|
|
1492
1481
|
presetWind3({
|
|
1493
1482
|
dark: {
|
package/dist/styles/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { setDefaultProps as setDefaultPropsMd2 } from './md2/index.js';
|
|
2
|
-
import { setDefaultProps as setDefaultPropsMd3 } from './md3/index.js';
|
|
3
|
-
export { setDefaultPropsMd2, setDefaultPropsMd3 };
|
|
1
|
+
import { default as MaterialDesign2, setDefaultProps as setDefaultPropsMd2 } from './md2/index.js';
|
|
2
|
+
import { default as MaterialDesign3, setDefaultProps as setDefaultPropsMd3 } from './md3/index.js';
|
|
3
|
+
export { MaterialDesign2, MaterialDesign3, setDefaultPropsMd2, setDefaultPropsMd3 };
|
|
@@ -8,7 +8,7 @@ const shortcuts = [
|
|
|
8
8
|
[
|
|
9
9
|
/^q-banner__avatar$/,
|
|
10
10
|
([, c], { theme }) => theme.quasar?.components?.['q-banner__avatar'] ??
|
|
11
|
-
`!min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
11
|
+
`!flex-initial !min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
12
12
|
],
|
|
13
13
|
[
|
|
14
14
|
/^q-banner__actions$/,
|
|
@@ -8,7 +8,7 @@ const shortcuts = [
|
|
|
8
8
|
[
|
|
9
9
|
/^q-banner__avatar$/,
|
|
10
10
|
([, c], { theme }) => theme.quasar?.components?.['q-banner__avatar'] ??
|
|
11
|
-
`!min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
11
|
+
`!flex-initial !min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
12
12
|
],
|
|
13
13
|
[
|
|
14
14
|
/^q-banner__actions$/,
|
|
@@ -7,15 +7,15 @@ const shortcuts = [
|
|
|
7
7
|
rounded-[3px]
|
|
8
8
|
[box-shadow:0_1px_5px_rgba(0,_0,_0,_0.2),_0_2px_2px_rgba(0,_0,_0,_0.14),_0_3px_1px_-2px_rgba(0,_0,_0,_0.12)]
|
|
9
9
|
align-middle
|
|
10
|
-
[&_>_.q-btn-item]:(
|
|
10
|
+
[&_>_.q-btn-item]:(text-light-on-surface dark:text-dark-on-surface self-stretch)
|
|
11
11
|
[&_>_.q-btn-item.bg-primary]:(!bg-light-primary !text-light-on-primary dark:!bg-dark-primary dark:!text-dark-on-primary)
|
|
12
12
|
[&_>_.q-btn-item:before]:([box-shadow:none])
|
|
13
13
|
[&_>_.q-btn-item_.q-badge--floating]:(right-0)
|
|
14
14
|
[&_>_.q-btn-group]:([box-shadow:none])
|
|
15
15
|
[&_>_.q-btn-group:first-child_>_.q-btn--active]:(!bg-light-secondary-container dark:!bg-dark-secondary-container)
|
|
16
16
|
[&_>_.q-btn-group:first-child_>_.q-btn:first-child]:([border-top-left-radius:inherit] [border-bottom-left-radius:inherit])
|
|
17
|
-
[&_>_.q-btn-group:last-child_>_.q-btn:last-child]:(
|
|
18
|
-
[&_>_.q-btn-group:not(:first-child)_>_.q-btn:first-child
|
|
17
|
+
[&_>_.q-btn-group:last-child_>_.q-btn:last-child]:()
|
|
18
|
+
[&_>_.q-btn-group:not(:first-child)_>_.q-btn:first-child]:(border-rd-l-0)
|
|
19
19
|
[&_>_.q-btn-group:not(:last-child)_>_.q-btn:last-child:before]:([border-right:0])
|
|
20
20
|
[&_>_.q-btn-item:not(:last-child)]:(rounded-tr-none rounded-br-none)
|
|
21
21
|
[&_>_.q-btn-item:not(:first-child)]:(rounded-tl-none rounded-bl-none)
|
|
@@ -59,8 +59,8 @@ const shortcuts = [
|
|
|
59
59
|
([, c], { theme }) => theme.quasar?.components?.['q-drawer__content'] ??
|
|
60
60
|
`[&_>_.q-list]:(px-28px)
|
|
61
61
|
[&_>_.q-list_>_.q-item]:(border-rd-16px)
|
|
62
|
-
[&_
|
|
63
|
-
[&_
|
|
62
|
+
[&_.q-list_>_.q-router-link--active]:(text-light-primary dark:text-dark-primary)
|
|
63
|
+
[&_.q-list_.q-router-link--exact-active]:(bg-light-secondary-container dark:bg-dark-secondary-container
|
|
64
64
|
)`
|
|
65
65
|
]
|
|
66
66
|
];
|
|
@@ -7,7 +7,7 @@ const shortcuts = [
|
|
|
7
7
|
[&>img]:(h-full w-full)
|
|
8
8
|
[&:before]:(w-full h-full flex! items-center justify-center)
|
|
9
9
|
[&:after]:(w-full h-full flex! items-center justify-center)
|
|
10
|
-
select-none cursor-inherit text-light-on-surface dark:text-dark-on-surface inline-flex items-center justify-center v-middle
|
|
10
|
+
select-none cursor-inherit layer-components:(text-light-on-surface dark:text-dark-on-surface) inline-flex items-center justify-center v-middle
|
|
11
11
|
`
|
|
12
12
|
],
|
|
13
13
|
// [
|
|
@@ -21,20 +21,20 @@ const shortcuts = [
|
|
|
21
21
|
[
|
|
22
22
|
/^q-toggle__track$/,
|
|
23
23
|
([, c], { theme }) => theme.quasar?.components?.['q-toggle__track'] ??
|
|
24
|
-
`outline-solid outline-2px outline-light-outline dark:outline-dark-outline !rounded-full h-[
|
|
24
|
+
`outline-solid outline-2px outline-light-outline dark:outline-dark-outline !rounded-full h-[1em] w-[1.6125em] bg-light-surface-container dark:bg-dark-surface-container`
|
|
25
25
|
],
|
|
26
26
|
[
|
|
27
27
|
/^q-toggle__thumb$/,
|
|
28
28
|
([, c], { theme }) => theme.quasar?.components?.['q-toggle__thumb'] ??
|
|
29
|
-
`
|
|
29
|
+
`layer-components:text-light-surface-container-highest layer-components:dark:text-dark-surface-container-highest
|
|
30
|
+
top-[0.125em] left-[0.5125em] w-[0.75em] h-[0.75em] [transition:left_0.22s_cubic-bezier(0.4,_0,_0.2,_1)] select-none z-0
|
|
30
31
|
[&:before]:()
|
|
31
|
-
[&:after]:(content-[''] bg-light-outline dark:bg-dark-outline absolute top-[0] right-[0] bottom-[0] left-[0] rounded-[50%] [box-shadow:0_3px_1px_-2px_rgba(0,_0,_0,_0.2),_0_2px_2px_0_rgba(0,_0,_0,_0.14),_0_1px_5px_0_rgba(0,_0,_0,_0.12)])
|
|
32
|
-
[&_.q-icon]:(layer-components:text-[0.
|
|
32
|
+
[&:after]:(content-[''] layer-components:bg-light-outline layer-components:dark:bg-dark-outline absolute top-[0] right-[0] bottom-[0] left-[0] rounded-[50%] [box-shadow:0_3px_1px_-2px_rgba(0,_0,_0,_0.2),_0_2px_2px_0_rgba(0,_0,_0,_0.14),_0_1px_5px_0_rgba(0,_0,_0,_0.12)])
|
|
33
|
+
[&_.q-icon]:(z-2 layer-components:text-[0.5em] layer-components:text-[#000] opacity-[0.54])`
|
|
33
34
|
],
|
|
34
35
|
[
|
|
35
36
|
/^q-toggle__inner$/,
|
|
36
|
-
([, c], { theme }) => theme.quasar?.components?.['q-toggle__inner'] ??
|
|
37
|
-
`text-[1.25em] w-[1.4em] min-w-[1.4em] max-h-[1em] px-[0.3em] py-[0.325em]`
|
|
37
|
+
([, c], { theme }) => theme.quasar?.components?.['q-toggle__inner'] ?? `px-0.325em`
|
|
38
38
|
],
|
|
39
39
|
[
|
|
40
40
|
/^q-toggle__inner--indet$/,
|
|
@@ -45,8 +45,8 @@ const shortcuts = [
|
|
|
45
45
|
/^q-toggle__inner--truthy$/,
|
|
46
46
|
([, c], { theme }) => theme.quasar?.components?.['q-toggle__inner--truthy'] ??
|
|
47
47
|
`[&_.q-toggle\\_\\_track]:(bg-light-primary dark:bg-dark-primary)
|
|
48
|
-
[&_.q-toggle\\_\\_thumb]:(left-[
|
|
49
|
-
[&_.q-toggle\\_\\_thumb:after]:(
|
|
48
|
+
[&_.q-toggle\\_\\_thumb]:(text-light-on-primary-container dark:text-light-on-primary-container left-[0.95em] top-[0.0625em] w-[0.875em] h-[0.875em])
|
|
49
|
+
[&_.q-toggle\\_\\_thumb:after]:(layer-components:!bg-light-on-primary dark:!bg-dark-on-primary)
|
|
50
50
|
[&_.q-toggle\\_\\_thumb_.q-icon]:(layer-components:text-[#fff] opacity-100)
|
|
51
51
|
[&:not(.disabled):focus_.q-toggle\\_\\_thumb:before]:(scale-200)
|
|
52
52
|
[&:not(.disabled):hover_.q-toggle\\_\\_thumb:before]:(scale-200)`
|
package/dist/theme.js
CHANGED
|
@@ -409,7 +409,7 @@ const defaultTheme = {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
};
|
|
412
|
-
export const generateTheme =
|
|
412
|
+
export const generateTheme = (sourceColor) => {
|
|
413
413
|
const materialTheme = themeFromSourceColor(argbFromHex(sourceColor));
|
|
414
414
|
return {
|
|
415
415
|
...defaultTheme,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { type Preset } from 'unocss';
|
|
2
2
|
import { type QuasarIconSet, type QuasarPlugins } from 'quasar';
|
|
3
|
+
import { type QuasarStyle } from './styles/index.js';
|
|
3
4
|
import { WebFontsOptions } from '@unocss/preset-web-fonts/index.js';
|
|
4
5
|
export interface QuasarPresetOptions {
|
|
5
|
-
style:
|
|
6
|
+
style: QuasarStyle;
|
|
6
7
|
sourceColor?: string;
|
|
7
8
|
plugins?: (keyof QuasarPlugins)[];
|
|
8
9
|
iconSet?: QuasarIconSet;
|
|
9
10
|
presetWebFonts?: WebFontsOptions;
|
|
10
11
|
}
|
|
11
|
-
declare const QuasarStyles: {
|
|
12
|
-
md2: Promise<typeof import("./styles/md2/index.js")>;
|
|
13
|
-
md3: Promise<typeof import("./styles/md3/index.js")>;
|
|
14
|
-
};
|
|
15
12
|
export declare const QuasarPreset: Preset<object>;
|
|
16
13
|
export declare const defaultSplitRE: RegExp;
|
|
17
14
|
export declare const splitWithVariantGroupRE: RegExp;
|
|
18
15
|
export declare function splitCode(code: string): string[];
|
|
19
|
-
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Preflight, Rule, UserShortcuts, Variant } from '@unocss/core';
|
|
2
2
|
import { QuasarTheme } from '../theme.js';
|
|
3
|
-
import { setDefaultProps as setDefaultPropsMd2 } from './md2/index.js';
|
|
4
|
-
import { setDefaultProps as setDefaultPropsMd3 } from './md3/index.js';
|
|
3
|
+
import { default as MaterialDesign2, setDefaultProps as setDefaultPropsMd2 } from './md2/index.js';
|
|
4
|
+
import { default as MaterialDesign3, setDefaultProps as setDefaultPropsMd3 } from './md3/index.js';
|
|
5
5
|
export interface QuasarStyle {
|
|
6
6
|
rules: Rule<QuasarTheme>[];
|
|
7
7
|
variants: Variant<QuasarTheme>[];
|
|
8
8
|
preflights: Preflight<QuasarTheme>[];
|
|
9
9
|
shortcuts: UserShortcuts<QuasarTheme>[];
|
|
10
10
|
}
|
|
11
|
-
export { setDefaultPropsMd2, setDefaultPropsMd3 };
|
|
11
|
+
export { MaterialDesign2, MaterialDesign3, setDefaultPropsMd2, setDefaultPropsMd3 };
|
package/dist/types/theme.d.ts
CHANGED
|
@@ -1187,5 +1187,5 @@ export interface QuasarTheme {
|
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
1189
1189
|
declare const defaultTheme: QuasarTheme;
|
|
1190
|
-
export declare const generateTheme: (sourceColor: string) =>
|
|
1190
|
+
export declare const generateTheme: (sourceColor: string) => QuasarTheme;
|
|
1191
1191
|
export { defaultTheme };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -24,18 +24,13 @@ import {
|
|
|
24
24
|
import { WebFontsOptions } from '@unocss/preset-web-fonts/index.js'
|
|
25
25
|
|
|
26
26
|
export interface QuasarPresetOptions {
|
|
27
|
-
style:
|
|
27
|
+
style: QuasarStyle
|
|
28
28
|
sourceColor?: string
|
|
29
29
|
plugins?: (keyof QuasarPlugins)[]
|
|
30
30
|
iconSet?: QuasarIconSet
|
|
31
31
|
presetWebFonts?: WebFontsOptions
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const QuasarStyles = {
|
|
35
|
-
md2: import('./styles/md2/index.js'),
|
|
36
|
-
md3: import('./styles/md3/index.js')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
34
|
const extractKeys = (obj: Record<string, any>) =>
|
|
40
35
|
Object.values(obj).reduce((acc, cur) => {
|
|
41
36
|
if (typeof cur === 'string') acc.push(cur)
|
|
@@ -1520,153 +1515,142 @@ const generateSafelist = ({
|
|
|
1520
1515
|
return safelist
|
|
1521
1516
|
}
|
|
1522
1517
|
|
|
1523
|
-
export const QuasarPreset = definePreset(
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
style: 'md2',
|
|
1528
|
-
sourceColor: '#806cb0'
|
|
1529
|
-
}
|
|
1530
|
-
if (!Object.keys(QuasarStyles).includes(options.style))
|
|
1531
|
-
throw new Error('Unsupported Quasar style')
|
|
1532
|
-
|
|
1533
|
-
if (!options.sourceColor) {
|
|
1534
|
-
options.sourceColor = '#806cb0'
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
const style: QuasarStyle = (await QuasarStyles[options.style]).default
|
|
1518
|
+
export const QuasarPreset = definePreset((options: QuasarPresetOptions) => {
|
|
1519
|
+
if (!options.sourceColor) {
|
|
1520
|
+
options.sourceColor = '#806cb0'
|
|
1521
|
+
}
|
|
1538
1522
|
|
|
1539
|
-
|
|
1523
|
+
const style = options.style
|
|
1524
|
+
const theme = generateTheme(options.sourceColor)
|
|
1540
1525
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
}
|
|
1526
|
+
return [
|
|
1527
|
+
presetWind3({
|
|
1528
|
+
dark: {
|
|
1529
|
+
light: '.body--light',
|
|
1530
|
+
dark: '.body--dark'
|
|
1531
|
+
}
|
|
1532
|
+
}),
|
|
1533
|
+
animatedUno(),
|
|
1534
|
+
presetIcons({}),
|
|
1535
|
+
presetWebFonts(
|
|
1536
|
+
options.presetWebFonts || {
|
|
1537
|
+
provider: 'bunny',
|
|
1538
|
+
fonts: {
|
|
1539
|
+
roboto: 'Roboto'
|
|
1556
1540
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
)
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
const pascalComponentsMatch: string[] = []
|
|
1585
|
-
const matches: string[] = []
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
{
|
|
1544
|
+
name: 'quasar',
|
|
1545
|
+
safelist: generateSafelist(options),
|
|
1546
|
+
preflights: corePreflights.concat(style.preflights),
|
|
1547
|
+
rules: coreRules.concat(style.rules),
|
|
1548
|
+
variants: style.variants,
|
|
1549
|
+
shortcuts: coreShortcuts.concat(style.shortcuts),
|
|
1550
|
+
theme,
|
|
1551
|
+
outputToCssLayers: true,
|
|
1552
|
+
layers: {
|
|
1553
|
+
components: -1,
|
|
1554
|
+
default: 1,
|
|
1555
|
+
utilities: 2
|
|
1556
|
+
},
|
|
1557
|
+
extractors: [
|
|
1558
|
+
{
|
|
1559
|
+
name: 'quasar-extractor',
|
|
1560
|
+
order: 0,
|
|
1561
|
+
extract({ code }) {
|
|
1562
|
+
const kebabMatch = code.matchAll(/q-(\w)([\w-]*)/g)
|
|
1563
|
+
const pascalMatch = code.matchAll(/Q([A-Z][a-z0-9]+)+/g)
|
|
1564
|
+
const transitionMatch = code.matchAll(
|
|
1565
|
+
/(transition|transition-show|transition-hide|transition-prev|transition-next)="(\S*)"/g
|
|
1566
|
+
)
|
|
1567
|
+
const colorMatch = code.matchAll(/color[=|:]"(.*?)"/g)
|
|
1586
1568
|
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
pascalComponentsMatch.push(toPascalCase(match[0]))
|
|
1590
|
-
}
|
|
1591
|
-
for (const match of pascalMatch) {
|
|
1592
|
-
pascalComponentsMatch.push(match[0])
|
|
1593
|
-
matches.push(toKebabCase(match[0]))
|
|
1594
|
-
}
|
|
1595
|
-
const transitionClasses = []
|
|
1596
|
-
for (const match of transitionMatch) {
|
|
1597
|
-
transitionClasses.push(
|
|
1598
|
-
...[
|
|
1599
|
-
'enter-from',
|
|
1600
|
-
'enter-active',
|
|
1601
|
-
'enter-to',
|
|
1602
|
-
'leave-from',
|
|
1603
|
-
'leave-active',
|
|
1604
|
-
'leave-to'
|
|
1605
|
-
].map((v) => `q-transition--${match[2]}-${v}`)
|
|
1606
|
-
)
|
|
1607
|
-
}
|
|
1608
|
-
const colorClasses = []
|
|
1609
|
-
for (const match of colorMatch) {
|
|
1610
|
-
colorClasses.push(`text-${match[1]}`, `bg-${match[1]}`)
|
|
1611
|
-
}
|
|
1569
|
+
const pascalComponentsMatch: string[] = []
|
|
1570
|
+
const matches: string[] = []
|
|
1612
1571
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
...(componentsSafelistMap as Record<string, string>)[
|
|
1633
|
-
component
|
|
1634
|
-
]
|
|
1635
|
-
)
|
|
1636
|
-
}
|
|
1637
|
-
return acc
|
|
1638
|
-
}, [] as string[])
|
|
1639
|
-
]
|
|
1640
|
-
classes.push(
|
|
1641
|
-
...transitionClasses,
|
|
1642
|
-
...colorClasses,
|
|
1643
|
-
...componentClasses
|
|
1572
|
+
for (const match of kebabMatch) {
|
|
1573
|
+
matches.push(match[0])
|
|
1574
|
+
pascalComponentsMatch.push(toPascalCase(match[0]))
|
|
1575
|
+
}
|
|
1576
|
+
for (const match of pascalMatch) {
|
|
1577
|
+
pascalComponentsMatch.push(match[0])
|
|
1578
|
+
matches.push(toKebabCase(match[0]))
|
|
1579
|
+
}
|
|
1580
|
+
const transitionClasses = []
|
|
1581
|
+
for (const match of transitionMatch) {
|
|
1582
|
+
transitionClasses.push(
|
|
1583
|
+
...[
|
|
1584
|
+
'enter-from',
|
|
1585
|
+
'enter-active',
|
|
1586
|
+
'enter-to',
|
|
1587
|
+
'leave-from',
|
|
1588
|
+
'leave-active',
|
|
1589
|
+
'leave-to'
|
|
1590
|
+
].map((v) => `q-transition--${match[2]}-${v}`)
|
|
1644
1591
|
)
|
|
1645
|
-
return classes
|
|
1646
1592
|
}
|
|
1593
|
+
const colorClasses = []
|
|
1594
|
+
for (const match of colorMatch) {
|
|
1595
|
+
colorClasses.push(`text-${match[1]}`, `bg-${match[1]}`)
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
// const classes = qClasses.filter((c) =>
|
|
1599
|
+
// matches.some((component) => {
|
|
1600
|
+
// component = component.replaceAll(
|
|
1601
|
+
// 'q-chat-message',
|
|
1602
|
+
// 'q-message'
|
|
1603
|
+
// )
|
|
1604
|
+
// component = component.replaceAll(
|
|
1605
|
+
// 'q-scroll-area',
|
|
1606
|
+
// 'q-scrollarea'
|
|
1607
|
+
// )
|
|
1608
|
+
// return c.includes(component)
|
|
1609
|
+
// })
|
|
1610
|
+
// )
|
|
1611
|
+
const classes = []
|
|
1612
|
+
const componentClasses = [
|
|
1613
|
+
...matches,
|
|
1614
|
+
...pascalComponentsMatch.reduce((acc, component) => {
|
|
1615
|
+
if (component in componentsSafelistMap) {
|
|
1616
|
+
acc.push(
|
|
1617
|
+
...(componentsSafelistMap as Record<string, string>)[
|
|
1618
|
+
component
|
|
1619
|
+
]
|
|
1620
|
+
)
|
|
1621
|
+
}
|
|
1622
|
+
return acc
|
|
1623
|
+
}, [] as string[])
|
|
1624
|
+
]
|
|
1625
|
+
classes.push(
|
|
1626
|
+
...transitionClasses,
|
|
1627
|
+
...colorClasses,
|
|
1628
|
+
...componentClasses
|
|
1629
|
+
)
|
|
1630
|
+
return classes
|
|
1647
1631
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
)
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
1634
|
+
transformers: [
|
|
1635
|
+
transformerVariantGroup()
|
|
1636
|
+
// {
|
|
1637
|
+
// name: 'find-classes-in-quasar-src',
|
|
1638
|
+
// enforce: 'pre', // enforce before other transformers
|
|
1639
|
+
// idFilter(id) {
|
|
1640
|
+
// return id.match(/quasar\/src\/.*\.js/)
|
|
1641
|
+
// },
|
|
1642
|
+
// async transform(code, id, { uno }) {
|
|
1643
|
+
// for (const c of baseSafelist) {
|
|
1644
|
+
// if (code.toString().includes(c)) console.log(c)
|
|
1645
|
+
// }
|
|
1646
|
+
// return code
|
|
1647
|
+
// // code is a MagicString instance
|
|
1648
|
+
// }
|
|
1649
|
+
// }
|
|
1650
|
+
]
|
|
1651
|
+
} as Preset
|
|
1652
|
+
]
|
|
1653
|
+
})
|
|
1670
1654
|
|
|
1671
1655
|
export const defaultSplitRE = /[\\:]?[\s'"`;{}]+/g
|
|
1672
1656
|
export const splitWithVariantGroupRE = /([\\:]?[\s"'`;<>]|:\(|\)"|\)\s)/g
|
package/src/styles/index.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Preflight, Rule, UserShortcuts, Variant } from '@unocss/core'
|
|
2
2
|
import { QuasarTheme } from '../theme.js'
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
default as MaterialDesign2,
|
|
5
|
+
setDefaultProps as setDefaultPropsMd2
|
|
6
|
+
} from './md2/index.js'
|
|
7
|
+
import {
|
|
8
|
+
default as MaterialDesign3,
|
|
9
|
+
setDefaultProps as setDefaultPropsMd3
|
|
10
|
+
} from './md3/index.js'
|
|
5
11
|
|
|
6
12
|
export interface QuasarStyle {
|
|
7
13
|
rules: Rule<QuasarTheme>[]
|
|
@@ -10,4 +16,9 @@ export interface QuasarStyle {
|
|
|
10
16
|
shortcuts: UserShortcuts<QuasarTheme>[]
|
|
11
17
|
}
|
|
12
18
|
|
|
13
|
-
export {
|
|
19
|
+
export {
|
|
20
|
+
MaterialDesign2,
|
|
21
|
+
MaterialDesign3,
|
|
22
|
+
setDefaultPropsMd2,
|
|
23
|
+
setDefaultPropsMd3
|
|
24
|
+
}
|
|
@@ -15,7 +15,7 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
15
15
|
/^q-banner__avatar$/,
|
|
16
16
|
([, c], { theme }) =>
|
|
17
17
|
theme.quasar?.components?.['q-banner__avatar'] ??
|
|
18
|
-
`!min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
18
|
+
`!flex-initial !min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
19
19
|
],
|
|
20
20
|
|
|
21
21
|
[
|
|
@@ -15,7 +15,7 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
15
15
|
/^q-banner__avatar$/,
|
|
16
16
|
([, c], { theme }) =>
|
|
17
17
|
theme.quasar?.components?.['q-banner__avatar'] ??
|
|
18
|
-
`!min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
18
|
+
`!flex-initial !min-w-[1px] [&_>_.q-avatar]:(text-[46px]) [&_>_.q-icon]:(text-[40px]) [&:not(:empty)_+_.q-banner\\_\\_content]:(pl-[16px])`
|
|
19
19
|
],
|
|
20
20
|
|
|
21
21
|
[
|
|
@@ -12,15 +12,15 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
12
12
|
rounded-[3px]
|
|
13
13
|
[box-shadow:0_1px_5px_rgba(0,_0,_0,_0.2),_0_2px_2px_rgba(0,_0,_0,_0.14),_0_3px_1px_-2px_rgba(0,_0,_0,_0.12)]
|
|
14
14
|
align-middle
|
|
15
|
-
[&_>_.q-btn-item]:(
|
|
15
|
+
[&_>_.q-btn-item]:(text-light-on-surface dark:text-dark-on-surface self-stretch)
|
|
16
16
|
[&_>_.q-btn-item.bg-primary]:(!bg-light-primary !text-light-on-primary dark:!bg-dark-primary dark:!text-dark-on-primary)
|
|
17
17
|
[&_>_.q-btn-item:before]:([box-shadow:none])
|
|
18
18
|
[&_>_.q-btn-item_.q-badge--floating]:(right-0)
|
|
19
19
|
[&_>_.q-btn-group]:([box-shadow:none])
|
|
20
20
|
[&_>_.q-btn-group:first-child_>_.q-btn--active]:(!bg-light-secondary-container dark:!bg-dark-secondary-container)
|
|
21
21
|
[&_>_.q-btn-group:first-child_>_.q-btn:first-child]:([border-top-left-radius:inherit] [border-bottom-left-radius:inherit])
|
|
22
|
-
[&_>_.q-btn-group:last-child_>_.q-btn:last-child]:(
|
|
23
|
-
[&_>_.q-btn-group:not(:first-child)_>_.q-btn:first-child
|
|
22
|
+
[&_>_.q-btn-group:last-child_>_.q-btn:last-child]:()
|
|
23
|
+
[&_>_.q-btn-group:not(:first-child)_>_.q-btn:first-child]:(border-rd-l-0)
|
|
24
24
|
[&_>_.q-btn-group:not(:last-child)_>_.q-btn:last-child:before]:([border-right:0])
|
|
25
25
|
[&_>_.q-btn-item:not(:last-child)]:(rounded-tr-none rounded-br-none)
|
|
26
26
|
[&_>_.q-btn-item:not(:first-child)]:(rounded-tl-none rounded-bl-none)
|
|
@@ -85,8 +85,8 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
85
85
|
theme.quasar?.components?.['q-drawer__content'] ??
|
|
86
86
|
`[&_>_.q-list]:(px-28px)
|
|
87
87
|
[&_>_.q-list_>_.q-item]:(border-rd-16px)
|
|
88
|
-
[&_
|
|
89
|
-
[&_
|
|
88
|
+
[&_.q-list_>_.q-router-link--active]:(text-light-primary dark:text-dark-primary)
|
|
89
|
+
[&_.q-list_.q-router-link--exact-active]:(bg-light-secondary-container dark:bg-dark-secondary-container
|
|
90
90
|
)`
|
|
91
91
|
]
|
|
92
92
|
]
|
|
@@ -13,7 +13,7 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
13
13
|
[&>img]:(h-full w-full)
|
|
14
14
|
[&:before]:(w-full h-full flex! items-center justify-center)
|
|
15
15
|
[&:after]:(w-full h-full flex! items-center justify-center)
|
|
16
|
-
select-none cursor-inherit text-light-on-surface dark:text-dark-on-surface inline-flex items-center justify-center v-middle
|
|
16
|
+
select-none cursor-inherit layer-components:(text-light-on-surface dark:text-dark-on-surface) inline-flex items-center justify-center v-middle
|
|
17
17
|
`
|
|
18
18
|
],
|
|
19
19
|
// [
|
|
@@ -29,24 +29,24 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
29
29
|
/^q-toggle__track$/,
|
|
30
30
|
([, c], { theme }) =>
|
|
31
31
|
theme.quasar?.components?.['q-toggle__track'] ??
|
|
32
|
-
`outline-solid outline-2px outline-light-outline dark:outline-dark-outline !rounded-full h-[
|
|
32
|
+
`outline-solid outline-2px outline-light-outline dark:outline-dark-outline !rounded-full h-[1em] w-[1.6125em] bg-light-surface-container dark:bg-dark-surface-container`
|
|
33
33
|
],
|
|
34
34
|
|
|
35
35
|
[
|
|
36
36
|
/^q-toggle__thumb$/,
|
|
37
37
|
([, c], { theme }) =>
|
|
38
38
|
theme.quasar?.components?.['q-toggle__thumb'] ??
|
|
39
|
-
`
|
|
39
|
+
`layer-components:text-light-surface-container-highest layer-components:dark:text-dark-surface-container-highest
|
|
40
|
+
top-[0.125em] left-[0.5125em] w-[0.75em] h-[0.75em] [transition:left_0.22s_cubic-bezier(0.4,_0,_0.2,_1)] select-none z-0
|
|
40
41
|
[&:before]:()
|
|
41
|
-
[&:after]:(content-[''] bg-light-outline dark:bg-dark-outline absolute top-[0] right-[0] bottom-[0] left-[0] rounded-[50%] [box-shadow:0_3px_1px_-2px_rgba(0,_0,_0,_0.2),_0_2px_2px_0_rgba(0,_0,_0,_0.14),_0_1px_5px_0_rgba(0,_0,_0,_0.12)])
|
|
42
|
-
[&_.q-icon]:(layer-components:text-[0.
|
|
42
|
+
[&:after]:(content-[''] layer-components:bg-light-outline layer-components:dark:bg-dark-outline absolute top-[0] right-[0] bottom-[0] left-[0] rounded-[50%] [box-shadow:0_3px_1px_-2px_rgba(0,_0,_0,_0.2),_0_2px_2px_0_rgba(0,_0,_0,_0.14),_0_1px_5px_0_rgba(0,_0,_0,_0.12)])
|
|
43
|
+
[&_.q-icon]:(z-2 layer-components:text-[0.5em] layer-components:text-[#000] opacity-[0.54])`
|
|
43
44
|
],
|
|
44
45
|
|
|
45
46
|
[
|
|
46
47
|
/^q-toggle__inner$/,
|
|
47
48
|
([, c], { theme }) =>
|
|
48
|
-
theme.quasar?.components?.['q-toggle__inner'] ??
|
|
49
|
-
`text-[1.25em] w-[1.4em] min-w-[1.4em] max-h-[1em] px-[0.3em] py-[0.325em]`
|
|
49
|
+
theme.quasar?.components?.['q-toggle__inner'] ?? `px-0.325em`
|
|
50
50
|
],
|
|
51
51
|
|
|
52
52
|
[
|
|
@@ -61,8 +61,8 @@ const shortcuts: UserShortcuts<QuasarTheme> = [
|
|
|
61
61
|
([, c], { theme }) =>
|
|
62
62
|
theme.quasar?.components?.['q-toggle__inner--truthy'] ??
|
|
63
63
|
`[&_.q-toggle\\_\\_track]:(bg-light-primary dark:bg-dark-primary)
|
|
64
|
-
[&_.q-toggle\\_\\_thumb]:(left-[
|
|
65
|
-
[&_.q-toggle\\_\\_thumb:after]:(
|
|
64
|
+
[&_.q-toggle\\_\\_thumb]:(text-light-on-primary-container dark:text-light-on-primary-container left-[0.95em] top-[0.0625em] w-[0.875em] h-[0.875em])
|
|
65
|
+
[&_.q-toggle\\_\\_thumb:after]:(layer-components:!bg-light-on-primary dark:!bg-dark-on-primary)
|
|
66
66
|
[&_.q-toggle\\_\\_thumb_.q-icon]:(layer-components:text-[#fff] opacity-100)
|
|
67
67
|
[&:not(.disabled):focus_.q-toggle\\_\\_thumb:before]:(scale-200)
|
|
68
68
|
[&:not(.disabled):hover_.q-toggle\\_\\_thumb:before]:(scale-200)`
|
package/src/styles/md3/index.ts
CHANGED
|
@@ -127,7 +127,6 @@ import { shortcuts as QFooterShortcuts } from './components/QFooter.unocss.js'
|
|
|
127
127
|
import { shortcuts as QDrawerShortcuts } from './components/QDrawer.unocss.js'
|
|
128
128
|
import { QuasarStyle } from '../index.js'
|
|
129
129
|
|
|
130
|
-
import { QBtn as QuasarButton } from 'quasar'
|
|
131
130
|
const style: QuasarStyle = {
|
|
132
131
|
variants: [],
|
|
133
132
|
preflights: ([] as Preflight<QuasarTheme>[]).concat(
|
package/src/theme.ts
CHANGED
|
@@ -1621,9 +1621,7 @@ const defaultTheme: QuasarTheme = {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
}
|
|
1623
1623
|
|
|
1624
|
-
export const generateTheme =
|
|
1625
|
-
sourceColor: string
|
|
1626
|
-
): Promise<QuasarTheme> => {
|
|
1624
|
+
export const generateTheme = (sourceColor: string): QuasarTheme => {
|
|
1627
1625
|
const materialTheme = themeFromSourceColor(argbFromHex(sourceColor))
|
|
1628
1626
|
|
|
1629
1627
|
return {
|