beercss 3.13.2 → 3.13.3
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/LICENSE +21 -21
- package/README.md +328 -328
- package/custom-element/index.d.ts +18 -18
- package/custom-element/index.js +7 -7
- package/dist/cdn/arch.svg +3 -3
- package/dist/cdn/arrow.svg +3 -3
- package/dist/cdn/beer.css +4792 -4792
- package/dist/cdn/beer.custom-element.js +38 -38
- package/dist/cdn/beer.custom-element.min.js +1 -1
- package/dist/cdn/beer.js +635 -635
- package/dist/cdn/beer.min.css +1 -1
- package/dist/cdn/beer.min.js +1 -1
- package/dist/cdn/beer.scoped.css +4793 -4793
- package/dist/cdn/beer.scoped.min.css +1 -1
- package/dist/cdn/boom.svg +3 -3
- package/dist/cdn/bun.svg +3 -3
- package/dist/cdn/burst.svg +3 -3
- package/dist/cdn/circle.svg +3 -3
- package/dist/cdn/clamshell.svg +3 -3
- package/dist/cdn/diamond.svg +3 -3
- package/dist/cdn/fan.svg +3 -3
- package/dist/cdn/flower.svg +3 -3
- package/dist/cdn/gem.svg +3 -3
- package/dist/cdn/ghost-ish.svg +3 -3
- package/dist/cdn/heart.svg +3 -3
- package/dist/cdn/leaf-clover4.svg +3 -3
- package/dist/cdn/leaf-clover8.svg +3 -3
- package/dist/cdn/loading-indicator.svg +18 -18
- package/dist/cdn/oval.svg +3 -3
- package/dist/cdn/pentagon.svg +3 -3
- package/dist/cdn/pill.svg +3 -3
- package/dist/cdn/pixel-circle.svg +3 -3
- package/dist/cdn/pixel-triangle.svg +3 -3
- package/dist/cdn/puffy-diamond.svg +3 -3
- package/dist/cdn/puffy.svg +3 -3
- package/dist/cdn/semicircle.svg +3 -3
- package/dist/cdn/sided-cookie12.svg +3 -3
- package/dist/cdn/sided-cookie4.svg +3 -3
- package/dist/cdn/sided-cookie6.svg +3 -3
- package/dist/cdn/sided-cookie7.svg +3 -3
- package/dist/cdn/sided-cookie9.svg +3 -3
- package/dist/cdn/slanted.svg +3 -3
- package/dist/cdn/soft-boom.svg +3 -3
- package/dist/cdn/soft-burst.svg +3 -3
- package/dist/cdn/square.svg +3 -3
- package/dist/cdn/sunny.svg +3 -3
- package/dist/cdn/triangle.svg +3 -3
- package/dist/cdn/very-sunny.svg +3 -3
- package/dist/cdn/wavy-circle.svg +3 -3
- package/dist/cdn/wavy.svg +4 -4
- package/index.d.ts +18 -18
- package/index.js +6 -6
- package/package.json +76 -76
- package/scoped/index.d.ts +18 -18
- package/scoped/index.js +6 -6
- package/src/cdn/beer.css +52 -52
- package/src/cdn/beer.ts +120 -120
- package/src/cdn/customElement.js +38 -38
- package/src/cdn/elements/badges.css +74 -74
- package/src/cdn/elements/bars.css +91 -91
- package/src/cdn/elements/buttons.css +106 -106
- package/src/cdn/elements/cards.css +26 -26
- package/src/cdn/elements/chips.css +38 -38
- package/src/cdn/elements/dialogs.css +151 -151
- package/src/cdn/elements/dialogs.ts +69 -69
- package/src/cdn/elements/dividers.css +48 -48
- package/src/cdn/elements/expansions.css +10 -10
- package/src/cdn/elements/fields.css +439 -439
- package/src/cdn/elements/fields.ts +165 -165
- package/src/cdn/elements/grids.css +171 -171
- package/src/cdn/elements/icons.css +77 -77
- package/src/cdn/elements/layouts.css +35 -35
- package/src/cdn/elements/lists.css +71 -71
- package/src/cdn/elements/mainLayouts.css +57 -57
- package/src/cdn/elements/media.css +112 -112
- package/src/cdn/elements/menus.css +294 -294
- package/src/cdn/elements/menus.ts +40 -40
- package/src/cdn/elements/navigations.css +462 -462
- package/src/cdn/elements/overlays.css +31 -31
- package/src/cdn/elements/pages.css +41 -41
- package/src/cdn/elements/pages.ts +6 -6
- package/src/cdn/elements/progress.css +207 -207
- package/src/cdn/elements/progress.ts +34 -34
- package/src/cdn/elements/selections.css +256 -256
- package/src/cdn/elements/shapes.css +258 -258
- package/src/cdn/elements/sliders.css +357 -357
- package/src/cdn/elements/sliders.ts +74 -74
- package/src/cdn/elements/snackbars.css +47 -47
- package/src/cdn/elements/snackbars.ts +26 -26
- package/src/cdn/elements/tables.css +65 -65
- package/src/cdn/elements/tabs.css +52 -52
- package/src/cdn/elements/tooltips.css +131 -131
- package/src/cdn/helpers/alignments.css +29 -29
- package/src/cdn/helpers/blurs.css +21 -21
- package/src/cdn/helpers/colors.css +930 -930
- package/src/cdn/helpers/directions.css +28 -28
- package/src/cdn/helpers/elevates.css +16 -16
- package/src/cdn/helpers/forms.css +75 -75
- package/src/cdn/helpers/margins.css +49 -49
- package/src/cdn/helpers/opacities.css +19 -19
- package/src/cdn/helpers/paddings.css +45 -45
- package/src/cdn/helpers/positions.css +45 -45
- package/src/cdn/helpers/reset.css +94 -94
- package/src/cdn/helpers/responsive.css +22 -22
- package/src/cdn/helpers/ripples.css +33 -33
- package/src/cdn/helpers/ripples.ts +30 -30
- package/src/cdn/helpers/scrolls.css +8 -8
- package/src/cdn/helpers/shadows.css +23 -23
- package/src/cdn/helpers/sizes.css +45 -45
- package/src/cdn/helpers/spaces.css +19 -19
- package/src/cdn/helpers/theme.css +186 -186
- package/src/cdn/helpers/theme.ts +83 -83
- package/src/cdn/helpers/typography.css +225 -225
- package/src/cdn/helpers/waves.css +43 -43
- package/src/cdn/helpers/zoom.css +19 -19
- package/src/cdn/interfaces.ts +3 -3
- package/src/cdn/settings/dark.css +38 -38
- package/src/cdn/settings/fonts.css +35 -35
- package/src/cdn/settings/globals.css +18 -18
- package/src/cdn/settings/light.css +39 -39
- package/src/cdn/shapes/arch.svg +3 -3
- package/src/cdn/shapes/arrow.svg +3 -3
- package/src/cdn/shapes/boom.svg +3 -3
- package/src/cdn/shapes/bun.svg +3 -3
- package/src/cdn/shapes/burst.svg +3 -3
- package/src/cdn/shapes/circle.svg +3 -3
- package/src/cdn/shapes/clamshell.svg +3 -3
- package/src/cdn/shapes/diamond.svg +3 -3
- package/src/cdn/shapes/fan.svg +3 -3
- package/src/cdn/shapes/flower.svg +3 -3
- package/src/cdn/shapes/gem.svg +3 -3
- package/src/cdn/shapes/ghost-ish.svg +3 -3
- package/src/cdn/shapes/heart.svg +3 -3
- package/src/cdn/shapes/leaf-clover4.svg +3 -3
- package/src/cdn/shapes/leaf-clover8.svg +3 -3
- package/src/cdn/shapes/loading-indicator.svg +18 -18
- package/src/cdn/shapes/oval.svg +3 -3
- package/src/cdn/shapes/pentagon.svg +3 -3
- package/src/cdn/shapes/pill.svg +3 -3
- package/src/cdn/shapes/pixel-circle.svg +3 -3
- package/src/cdn/shapes/pixel-triangle.svg +3 -3
- package/src/cdn/shapes/puffy-diamond.svg +3 -3
- package/src/cdn/shapes/puffy.svg +3 -3
- package/src/cdn/shapes/semicircle.svg +3 -3
- package/src/cdn/shapes/sided-cookie12.svg +3 -3
- package/src/cdn/shapes/sided-cookie4.svg +3 -3
- package/src/cdn/shapes/sided-cookie6.svg +3 -3
- package/src/cdn/shapes/sided-cookie7.svg +3 -3
- package/src/cdn/shapes/sided-cookie9.svg +3 -3
- package/src/cdn/shapes/slanted.svg +3 -3
- package/src/cdn/shapes/soft-boom.svg +3 -3
- package/src/cdn/shapes/soft-burst.svg +3 -3
- package/src/cdn/shapes/square.svg +3 -3
- package/src/cdn/shapes/sunny.svg +3 -3
- package/src/cdn/shapes/triangle.svg +3 -3
- package/src/cdn/shapes/very-sunny.svg +3 -3
- package/src/cdn/shapes/wavy-circle.svg +3 -3
- package/src/cdn/shapes/wavy.svg +4 -4
- package/src/cdn/utils.ts +154 -154
|
@@ -1,186 +1,186 @@
|
|
|
1
|
-
.transparent {
|
|
2
|
-
background-color: transparent !important;
|
|
3
|
-
box-shadow: none !important;
|
|
4
|
-
color: inherit !important;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.primary {
|
|
8
|
-
background-color: var(--primary) !important;
|
|
9
|
-
color: var(--on-primary) !important;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.primary-text {
|
|
13
|
-
color: var(--primary) !important;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.primary-border {
|
|
17
|
-
border-color: var(--primary) !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.primary-container {
|
|
21
|
-
background-color: var(--primary-container) !important;
|
|
22
|
-
color: var(--on-primary-container) !important;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.secondary {
|
|
26
|
-
background-color: var(--secondary) !important;
|
|
27
|
-
color: var(--on-secondary) !important;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.secondary-text {
|
|
31
|
-
color: var(--secondary) !important;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.secondary-border {
|
|
35
|
-
border-color: var(--secondary) !important;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.secondary-container {
|
|
39
|
-
background-color: var(--secondary-container) !important;
|
|
40
|
-
color: var(--on-secondary-container) !important;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.tertiary {
|
|
44
|
-
background-color: var(--tertiary) !important;
|
|
45
|
-
color: var(--on-tertiary) !important;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.tertiary-text {
|
|
49
|
-
color: var(--tertiary) !important;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.tertiary-border {
|
|
53
|
-
border-color: var(--tertiary) !important;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.tertiary-container {
|
|
57
|
-
background-color: var(--tertiary-container) !important;
|
|
58
|
-
color: var(--on-tertiary-container) !important;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.error {
|
|
62
|
-
background-color: var(--error) !important;
|
|
63
|
-
color: var(--on-error) !important;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.error-text {
|
|
67
|
-
color: var(--error) !important;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.error-border {
|
|
71
|
-
border-color: var(--error) !important;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.error-container {
|
|
75
|
-
background-color: var(--error-container) !important;
|
|
76
|
-
color: var(--on-error-container) !important;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.background {
|
|
80
|
-
background-color: var(--background) !important;
|
|
81
|
-
color: var(--on-background) !important;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.surface,
|
|
85
|
-
.surface-dim,
|
|
86
|
-
.surface-bright,
|
|
87
|
-
.surface-container-lowest,
|
|
88
|
-
.surface-container-low,
|
|
89
|
-
.surface-container,
|
|
90
|
-
.surface-container-high,
|
|
91
|
-
.surface-container-highest {
|
|
92
|
-
background-color: var(--surface) !important;
|
|
93
|
-
color: var(--on-surface) !important;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.surface-variant {
|
|
97
|
-
background-color: var(--surface-variant) !important;
|
|
98
|
-
color: var(--on-surface-variant) !important;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.inverse-surface {
|
|
102
|
-
background-color: var(--inverse-surface);
|
|
103
|
-
color: var(--inverse-on-surface);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.inverse-primary {
|
|
107
|
-
background-color: var(--inverse-primary);
|
|
108
|
-
color: var(--primary);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.inverse-primary-text {
|
|
112
|
-
color: var(--inverse-primary) !important;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.inverse-primary-border {
|
|
116
|
-
border-color: var(--inverse-primary) !important;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.surface-dim {
|
|
120
|
-
background-color: var(--surface-dim) !important;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.surface-bright {
|
|
124
|
-
background-color: var(--surface-bright) !important;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.surface-container-lowest {
|
|
128
|
-
background-color: var(--surface-container-lowest) !important;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.surface-container-low {
|
|
132
|
-
background-color: var(--surface-container-low) !important;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.surface-container {
|
|
136
|
-
background-color: var(--surface-container) !important;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.surface-container-high {
|
|
140
|
-
background-color: var(--surface-container-high) !important;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.surface-container-highest {
|
|
144
|
-
background-color: var(--surface-container-highest) !important;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.surface-container-low {
|
|
148
|
-
background-color: var(--surface-container-low) !important;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.black {
|
|
152
|
-
background-color: #000 !important;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.black-border {
|
|
156
|
-
border-color: #000 !important;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.black-text {
|
|
160
|
-
color: #000 !important;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.white {
|
|
164
|
-
background-color: #FFF !important;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.white-border {
|
|
168
|
-
border-color: #FFF !important;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.white-text {
|
|
172
|
-
color: #FFF !important;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.transparent-border {
|
|
176
|
-
border-color: transparent !important;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.transparent-text {
|
|
180
|
-
color: transparent !important;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.fill:not(i) {
|
|
184
|
-
background-color: var(--surface-variant) !important;
|
|
185
|
-
color: var(--on-surface-variant) !important;
|
|
186
|
-
}
|
|
1
|
+
.transparent {
|
|
2
|
+
background-color: transparent !important;
|
|
3
|
+
box-shadow: none !important;
|
|
4
|
+
color: inherit !important;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.primary {
|
|
8
|
+
background-color: var(--primary) !important;
|
|
9
|
+
color: var(--on-primary) !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.primary-text {
|
|
13
|
+
color: var(--primary) !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.primary-border {
|
|
17
|
+
border-color: var(--primary) !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.primary-container {
|
|
21
|
+
background-color: var(--primary-container) !important;
|
|
22
|
+
color: var(--on-primary-container) !important;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.secondary {
|
|
26
|
+
background-color: var(--secondary) !important;
|
|
27
|
+
color: var(--on-secondary) !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.secondary-text {
|
|
31
|
+
color: var(--secondary) !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.secondary-border {
|
|
35
|
+
border-color: var(--secondary) !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.secondary-container {
|
|
39
|
+
background-color: var(--secondary-container) !important;
|
|
40
|
+
color: var(--on-secondary-container) !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tertiary {
|
|
44
|
+
background-color: var(--tertiary) !important;
|
|
45
|
+
color: var(--on-tertiary) !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tertiary-text {
|
|
49
|
+
color: var(--tertiary) !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tertiary-border {
|
|
53
|
+
border-color: var(--tertiary) !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.tertiary-container {
|
|
57
|
+
background-color: var(--tertiary-container) !important;
|
|
58
|
+
color: var(--on-tertiary-container) !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.error {
|
|
62
|
+
background-color: var(--error) !important;
|
|
63
|
+
color: var(--on-error) !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.error-text {
|
|
67
|
+
color: var(--error) !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.error-border {
|
|
71
|
+
border-color: var(--error) !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.error-container {
|
|
75
|
+
background-color: var(--error-container) !important;
|
|
76
|
+
color: var(--on-error-container) !important;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.background {
|
|
80
|
+
background-color: var(--background) !important;
|
|
81
|
+
color: var(--on-background) !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.surface,
|
|
85
|
+
.surface-dim,
|
|
86
|
+
.surface-bright,
|
|
87
|
+
.surface-container-lowest,
|
|
88
|
+
.surface-container-low,
|
|
89
|
+
.surface-container,
|
|
90
|
+
.surface-container-high,
|
|
91
|
+
.surface-container-highest {
|
|
92
|
+
background-color: var(--surface) !important;
|
|
93
|
+
color: var(--on-surface) !important;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.surface-variant {
|
|
97
|
+
background-color: var(--surface-variant) !important;
|
|
98
|
+
color: var(--on-surface-variant) !important;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.inverse-surface {
|
|
102
|
+
background-color: var(--inverse-surface);
|
|
103
|
+
color: var(--inverse-on-surface);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.inverse-primary {
|
|
107
|
+
background-color: var(--inverse-primary);
|
|
108
|
+
color: var(--primary);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.inverse-primary-text {
|
|
112
|
+
color: var(--inverse-primary) !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.inverse-primary-border {
|
|
116
|
+
border-color: var(--inverse-primary) !important;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.surface-dim {
|
|
120
|
+
background-color: var(--surface-dim) !important;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.surface-bright {
|
|
124
|
+
background-color: var(--surface-bright) !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.surface-container-lowest {
|
|
128
|
+
background-color: var(--surface-container-lowest) !important;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.surface-container-low {
|
|
132
|
+
background-color: var(--surface-container-low) !important;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.surface-container {
|
|
136
|
+
background-color: var(--surface-container) !important;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.surface-container-high {
|
|
140
|
+
background-color: var(--surface-container-high) !important;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.surface-container-highest {
|
|
144
|
+
background-color: var(--surface-container-highest) !important;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.surface-container-low {
|
|
148
|
+
background-color: var(--surface-container-low) !important;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.black {
|
|
152
|
+
background-color: #000 !important;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.black-border {
|
|
156
|
+
border-color: #000 !important;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.black-text {
|
|
160
|
+
color: #000 !important;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.white {
|
|
164
|
+
background-color: #FFF !important;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.white-border {
|
|
168
|
+
border-color: #FFF !important;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.white-text {
|
|
172
|
+
color: #FFF !important;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.transparent-border {
|
|
176
|
+
border-color: transparent !important;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.transparent-text {
|
|
180
|
+
color: transparent !important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.fill:not(i) {
|
|
184
|
+
background-color: var(--surface-variant) !important;
|
|
185
|
+
color: var(--on-surface-variant) !important;
|
|
186
|
+
}
|
package/src/cdn/helpers/theme.ts
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { type IBeerCssTheme } from "../interfaces";
|
|
2
|
-
import { isDark } from "../utils";
|
|
3
|
-
|
|
4
|
-
const _lastTheme: IBeerCssTheme = {
|
|
5
|
-
light: "",
|
|
6
|
-
dark: "",
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
function getMode() {
|
|
10
|
-
return document?.body?.classList.contains("dark") ? "dark" : "light";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function lastTheme(): IBeerCssTheme {
|
|
14
|
-
if (_lastTheme.light && _lastTheme.dark) return _lastTheme;
|
|
15
|
-
const body = document.body;
|
|
16
|
-
|
|
17
|
-
const light = document.createElement("body");
|
|
18
|
-
light.className = "light";
|
|
19
|
-
body.appendChild(light);
|
|
20
|
-
|
|
21
|
-
const dark = document.createElement("body");
|
|
22
|
-
dark.className = "dark";
|
|
23
|
-
body.appendChild(dark);
|
|
24
|
-
|
|
25
|
-
const fromLight = getComputedStyle(light);
|
|
26
|
-
const fromDark = getComputedStyle(dark);
|
|
27
|
-
const variables = ["--primary", "--on-primary", "--primary-container", "--on-primary-container", "--secondary", "--on-secondary", "--secondary-container", "--on-secondary-container", "--tertiary", "--on-tertiary", "--tertiary-container", "--on-tertiary-container", "--error", "--on-error", "--error-container", "--on-error-container", "--background", "--on-background", "--surface", "--on-surface", "--surface-variant", "--on-surface-variant", "--outline", "--outline-variant", "--shadow", "--scrim", "--inverse-surface", "--inverse-on-surface", "--inverse-primary", "--surface-dim", "--surface-bright", "--surface-container-lowest", "--surface-container-low", "--surface-container", "--surface-container-high", "--surface-container-highest"];
|
|
28
|
-
for (let i = 0, n = variables.length; i < n; i++) {
|
|
29
|
-
_lastTheme.light += variables[i] + ":" + fromLight.getPropertyValue(variables[i]) + ";";
|
|
30
|
-
_lastTheme.dark += variables[i] + ":" + fromDark.getPropertyValue(variables[i]) + ";";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
body.removeChild(light);
|
|
34
|
-
body.removeChild(dark);
|
|
35
|
-
return _lastTheme;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function updateTheme(source?: IBeerCssTheme | any):
|
|
39
|
-
const context = globalThis as any;
|
|
40
|
-
const body = document.body;
|
|
41
|
-
if (!source || !context.materialDynamicColors) return lastTheme();
|
|
42
|
-
|
|
43
|
-
const mode = getMode();
|
|
44
|
-
if (source.light && source.dark) {
|
|
45
|
-
_lastTheme.light = source.light;
|
|
46
|
-
_lastTheme.dark = source.dark;
|
|
47
|
-
body.setAttribute("style", source[mode]);
|
|
48
|
-
return source;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return context.materialDynamicColors(source).then((theme: IBeerCssTheme) => {
|
|
52
|
-
const toCss = (data: any) => {
|
|
53
|
-
let style = "";
|
|
54
|
-
for (let i = 0, keys = Object.keys(data), n = keys.length; i < n; i++) {
|
|
55
|
-
const key = keys[i];
|
|
56
|
-
const value = data[key] as string;
|
|
57
|
-
const kebabCase = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
58
|
-
style += "--" + kebabCase + ":" + value + ";";
|
|
59
|
-
}
|
|
60
|
-
return style;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
_lastTheme.light = toCss(theme.light);
|
|
64
|
-
_lastTheme.dark = toCss(theme.dark);
|
|
65
|
-
body.setAttribute("style", _lastTheme[mode]);
|
|
66
|
-
return _lastTheme;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function updateMode(value: string): string {
|
|
71
|
-
const context = (globalThis as any);
|
|
72
|
-
const body = document.body;
|
|
73
|
-
|
|
74
|
-
if (!body) return value;
|
|
75
|
-
if (!value) return getMode();
|
|
76
|
-
if (value === "auto") value = isDark() ? "dark" : "light";
|
|
77
|
-
|
|
78
|
-
body.classList.remove("light", "dark");
|
|
79
|
-
body.classList.add(value);
|
|
80
|
-
|
|
81
|
-
const lastThemeStyle = value === "light" ? _lastTheme.light : _lastTheme.dark;
|
|
82
|
-
if (context.materialDynamicColors) body.setAttribute("style", lastThemeStyle);
|
|
83
|
-
return getMode();
|
|
1
|
+
import { type IBeerCssTheme } from "../interfaces";
|
|
2
|
+
import { isDark } from "../utils";
|
|
3
|
+
|
|
4
|
+
const _lastTheme: IBeerCssTheme = {
|
|
5
|
+
light: "",
|
|
6
|
+
dark: "",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function getMode() {
|
|
10
|
+
return document?.body?.classList.contains("dark") ? "dark" : "light";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function lastTheme(): IBeerCssTheme {
|
|
14
|
+
if (_lastTheme.light && _lastTheme.dark) return _lastTheme;
|
|
15
|
+
const body = document.body;
|
|
16
|
+
|
|
17
|
+
const light = document.createElement("body");
|
|
18
|
+
light.className = "light";
|
|
19
|
+
body.appendChild(light);
|
|
20
|
+
|
|
21
|
+
const dark = document.createElement("body");
|
|
22
|
+
dark.className = "dark";
|
|
23
|
+
body.appendChild(dark);
|
|
24
|
+
|
|
25
|
+
const fromLight = getComputedStyle(light);
|
|
26
|
+
const fromDark = getComputedStyle(dark);
|
|
27
|
+
const variables = ["--primary", "--on-primary", "--primary-container", "--on-primary-container", "--secondary", "--on-secondary", "--secondary-container", "--on-secondary-container", "--tertiary", "--on-tertiary", "--tertiary-container", "--on-tertiary-container", "--error", "--on-error", "--error-container", "--on-error-container", "--background", "--on-background", "--surface", "--on-surface", "--surface-variant", "--on-surface-variant", "--outline", "--outline-variant", "--shadow", "--scrim", "--inverse-surface", "--inverse-on-surface", "--inverse-primary", "--surface-dim", "--surface-bright", "--surface-container-lowest", "--surface-container-low", "--surface-container", "--surface-container-high", "--surface-container-highest"];
|
|
28
|
+
for (let i = 0, n = variables.length; i < n; i++) {
|
|
29
|
+
_lastTheme.light += variables[i] + ":" + fromLight.getPropertyValue(variables[i]) + ";";
|
|
30
|
+
_lastTheme.dark += variables[i] + ":" + fromDark.getPropertyValue(variables[i]) + ";";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
body.removeChild(light);
|
|
34
|
+
body.removeChild(dark);
|
|
35
|
+
return _lastTheme;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function updateTheme(source?: IBeerCssTheme | any): Promise<IBeerCssTheme> {
|
|
39
|
+
const context = globalThis as any;
|
|
40
|
+
const body = document.body;
|
|
41
|
+
if (!source || !context.materialDynamicColors) return lastTheme();
|
|
42
|
+
|
|
43
|
+
const mode = getMode();
|
|
44
|
+
if (source.light && source.dark) {
|
|
45
|
+
_lastTheme.light = source.light;
|
|
46
|
+
_lastTheme.dark = source.dark;
|
|
47
|
+
body.setAttribute("style", source[mode]);
|
|
48
|
+
return source;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return context.materialDynamicColors(source).then((theme: IBeerCssTheme) => {
|
|
52
|
+
const toCss = (data: any) => {
|
|
53
|
+
let style = "";
|
|
54
|
+
for (let i = 0, keys = Object.keys(data), n = keys.length; i < n; i++) {
|
|
55
|
+
const key = keys[i];
|
|
56
|
+
const value = data[key] as string;
|
|
57
|
+
const kebabCase = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
58
|
+
style += "--" + kebabCase + ":" + value + ";";
|
|
59
|
+
}
|
|
60
|
+
return style;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_lastTheme.light = toCss(theme.light);
|
|
64
|
+
_lastTheme.dark = toCss(theme.dark);
|
|
65
|
+
body.setAttribute("style", _lastTheme[mode]);
|
|
66
|
+
return _lastTheme;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function updateMode(value: string): string {
|
|
71
|
+
const context = (globalThis as any);
|
|
72
|
+
const body = document.body;
|
|
73
|
+
|
|
74
|
+
if (!body) return value;
|
|
75
|
+
if (!value) return getMode();
|
|
76
|
+
if (value === "auto") value = isDark() ? "dark" : "light";
|
|
77
|
+
|
|
78
|
+
body.classList.remove("light", "dark");
|
|
79
|
+
body.classList.add(value);
|
|
80
|
+
|
|
81
|
+
const lastThemeStyle = value === "light" ? _lastTheme.light : _lastTheme.dark;
|
|
82
|
+
if (context.materialDynamicColors) body.setAttribute("style", lastThemeStyle);
|
|
83
|
+
return getMode();
|
|
84
84
|
}
|