/
static.ts
132 lines (121 loc) · 4.68 KB
/
static.ts
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
import type { Rule } from '@unocss/core'
import { handler as h, positionMap } from '@unocss/preset-mini/utils'
export const textTransforms: Rule[] = [
// tailwind compat
['uppercase', { 'text-transform': 'uppercase' }],
['lowercase', { 'text-transform': 'lowercase' }],
['capitalize', { 'text-transform': 'capitalize' }],
['normal-case', { 'text-transform': 'none' }],
]
export const hyphens: Rule[] = [
['hyphens-manual', {
'-webkit-hyphens': 'manual',
'-ms-hyphens': 'manual',
'hyphens': 'manual',
}],
['hyphens-auto', {
'-webkit-hyphens': 'auto',
'-ms-hyphens': 'auto',
'hyphens': 'auto',
}],
['hyphens-none', {
'-webkit-hyphens': 'none',
'-ms-hyphens': 'none',
'hyphens': 'none',
}],
]
export const writingModes: Rule[] = [
['write-vertical-right', { 'writing-mode': 'vertical-rl' }],
['write-vertical-left', { 'writing-mode': 'vertical-lr' }],
['write-normal', { 'writing-mode': 'horizontal-tb' }],
]
export const writingOrientations: Rule[] = [
['write-orient-mixed', { 'text-orientation': 'mixed' }],
['write-orient-sideways', { 'text-orientation': 'sideways' }],
['write-orient-upright', { 'text-orientation': 'upright' }],
]
export const screenReadersAccess: Rule[] = [
[
'sr-only', {
'position': 'absolute',
'width': '1px',
'height': '1px',
'padding': '0',
'margin': '-1px',
'overflow': 'hidden',
'clip': 'rect(0,0,0,0)',
'white-space': 'nowrap',
'border-width': 0,
},
],
[
'not-sr-only',
{
'position': 'static',
'width': 'auto',
'height': 'auto',
'padding': '0',
'margin': '0',
'overflow': 'visible',
'clip': 'auto',
'white-space': 'normal',
},
],
]
export const isolations: Rule[] = [
['isolate', { isolation: 'isolate' }],
['isolate-auto', { isolation: 'auto' }],
['isolation-auto', { isolation: 'auto' }],
]
export const objectPositions: Rule[] = [
// object fit
['object-cover', { 'object-fit': 'cover' }],
['object-contain', { 'object-fit': 'contain' }],
['object-fill', { 'object-fit': 'fill' }],
['object-scale-down', { 'object-fit': 'scale-down' }],
['object-none', { 'object-fit': 'none' }],
// object position
[/^object-(.+)$/, ([, d]) => {
if (positionMap[d])
return { 'object-position': positionMap[d] }
if (h.bracketOfPosition(d) != null)
return { 'object-position': h.bracketOfPosition(d)!.split(' ').map(e => h.position.fraction.auto.px.cssvar(e)).join(' ') }
}, { autocomplete: `object-(${Object.keys(positionMap).join('|')})` }],
]
export const backgroundBlendModes: Rule[] = [
['bg-blend-multiply', { 'background-blend-mode': 'multiply' }],
['bg-blend-screen', { 'background-blend-mode': 'screen' }],
['bg-blend-overlay', { 'background-blend-mode': 'overlay' }],
['bg-blend-darken', { 'background-blend-mode': 'darken' }],
['bg-blend-lighten', { 'background-blend-mode': 'lighten' }],
['bg-blend-color-dodge', { 'background-blend-mode': 'color-dodge' }],
['bg-blend-color-burn', { 'background-blend-mode': 'color-burn' }],
['bg-blend-hard-light', { 'background-blend-mode': 'hard-light' }],
['bg-blend-soft-light', { 'background-blend-mode': 'soft-light' }],
['bg-blend-difference', { 'background-blend-mode': 'difference' }],
['bg-blend-exclusion', { 'background-blend-mode': 'exclusion' }],
['bg-blend-hue', { 'background-blend-mode': 'hue' }],
['bg-blend-saturation', { 'background-blend-mode': 'saturation' }],
['bg-blend-color', { 'background-blend-mode': 'color' }],
['bg-blend-luminosity', { 'background-blend-mode': 'luminosity' }],
['bg-blend-normal', { 'background-blend-mode': 'normal' }],
]
export const mixBlendModes: Rule[] = [
['mix-blend-multiply', { 'mix-blend-mode': 'multiply' }],
['mix-blend-screen', { 'mix-blend-mode': 'screen' }],
['mix-blend-overlay', { 'mix-blend-mode': 'overlay' }],
['mix-blend-darken', { 'mix-blend-mode': 'darken' }],
['mix-blend-lighten', { 'mix-blend-mode': 'lighten' }],
['mix-blend-color-dodge', { 'mix-blend-mode': 'color-dodge' }],
['mix-blend-color-burn', { 'mix-blend-mode': 'color-burn' }],
['mix-blend-hard-light', { 'mix-blend-mode': 'hard-light' }],
['mix-blend-soft-light', { 'mix-blend-mode': 'soft-light' }],
['mix-blend-difference', { 'mix-blend-mode': 'difference' }],
['mix-blend-exclusion', { 'mix-blend-mode': 'exclusion' }],
['mix-blend-hue', { 'mix-blend-mode': 'hue' }],
['mix-blend-saturation', { 'mix-blend-mode': 'saturation' }],
['mix-blend-color', { 'mix-blend-mode': 'color' }],
['mix-blend-luminosity', { 'mix-blend-mode': 'luminosity' }],
['mix-blend-plus-lighter', { 'mix-blend-mode': 'plus-lighter' }],
['mix-blend-normal', { 'mix-blend-mode': 'normal' }],
]