onejs-core 3.0.3 → 3.0.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.
- package/.gitattributes +2 -2
- package/.prettierrc +5 -5
- package/.vscode/settings.json +5 -5
- package/LICENSE +20 -20
- package/README.md +102 -102
- package/bin/oj.js +252 -252
- package/definitions/Assemblies/OneJS.Runtime.Ext.d.ts +6 -6
- package/definitions/Assemblies/OneJS.Runtime.d.ts +826 -826
- package/definitions/Assemblies/OneJS.Samples.d.ts +20 -20
- package/definitions/Assemblies/Unity.Mathematics.d.ts +9221 -9221
- package/definitions/Assemblies/UnityEditor.CoreModule.d.ts +32614 -32614
- package/definitions/Assemblies/UnityEngine.AIModule.d.ts +998 -998
- package/definitions/Assemblies/UnityEngine.AnimationModule.d.ts +3308 -3308
- package/definitions/Assemblies/UnityEngine.AssetBundleModule.d.ts +337 -337
- package/definitions/Assemblies/UnityEngine.AudioModule.d.ts +1154 -1154
- package/definitions/Assemblies/UnityEngine.CoreModule.d.ts +29587 -29587
- package/definitions/Assemblies/UnityEngine.PhysicsModule.d.ts +3137 -3137
- package/definitions/Assemblies/UnityEngine.TerrainModule.d.ts +1270 -1270
- package/definitions/Assemblies/UnityEngine.UIElementsModule.d.ts +32718 -32718
- package/definitions/Assemblies/UnityEngine.UnityAnalyticsCommonModule.d.ts +274 -274
- package/definitions/Assemblies/index.d.ts +16 -16
- package/definitions/Assemblies/mscorlib.d.ts +19416 -19416
- package/definitions/augments.d.ts +66 -66
- package/definitions/globals.d.ts +53 -53
- package/definitions/index.d.ts +11 -11
- package/definitions/jsx.d.ts +570 -570
- package/definitions/modules.d.ts +32 -32
- package/definitions/onejs.d.ts +171 -171
- package/definitions/preact.jsx.d.ts +6 -6
- package/definitions/proto-overrides.d.ts +41 -41
- package/definitions/puerts.d.ts +30 -30
- package/definitions/unity-engine.d.ts +22 -22
- package/dist/dom/document.d.ts +30 -0
- package/dist/dom/document.js +89 -0
- package/dist/dom/dom-style.d.ts +9 -0
- package/dist/dom/dom-style.js +27 -0
- package/dist/dom/dom.d.ts +83 -0
- package/dist/dom/dom.js +313 -0
- package/dist/dom/index.d.ts +4 -0
- package/dist/dom/index.js +4 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +45 -0
- package/dist/math/index.d.ts +86 -0
- package/dist/math/index.js +361 -0
- package/dist/preloads/inject.d.ts +3 -0
- package/dist/preloads/inject.js +36 -0
- package/dist/styling/index.d.ts +10 -0
- package/dist/styling/index.js +28 -0
- package/dist/styling/utils/generateAlphabeticName.d.ts +1 -0
- package/dist/styling/utils/generateAlphabeticName.js +16 -0
- package/dist/styling/utils/generateComponentId.d.ts +1 -0
- package/dist/styling/utils/generateComponentId.js +5 -0
- package/dist/styling/utils/hash.d.ts +5 -0
- package/dist/styling/utils/hash.js +34 -0
- package/dist/utils/arrays.d.ts +1 -0
- package/dist/utils/arrays.js +10 -0
- package/dist/utils/color-palettes.d.ts +2 -0
- package/dist/utils/color-palettes.js +2 -0
- package/dist/utils/color-parser.d.ts +161 -0
- package/dist/utils/color-parser.js +241 -0
- package/dist/utils/float-parser.d.ts +7 -0
- package/dist/utils/float-parser.js +23 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.js +15 -0
- package/dist/utils/subscribe.d.ts +4 -0
- package/dist/utils/subscribe.js +10 -0
- package/dist/utils/system.d.ts +1 -0
- package/dist/utils/system.js +16 -0
- package/dom/document.ts +115 -115
- package/dom/dom-style.ts +36 -36
- package/dom/dom.ts +376 -376
- package/dom/index.ts +3 -3
- package/index.ts +59 -59
- package/jsr.json +9 -9
- package/math/README.md +212 -212
- package/math/index.ts +487 -487
- package/package.json +34 -33
- package/preloads/inject.ts +43 -43
- package/scripts/esbuild/copy-assets.mjs +94 -94
- package/scripts/esbuild/decorator-fix.mjs +17 -17
- package/scripts/esbuild/import-transform.mjs +100 -100
- package/scripts/esbuild/index.mjs +3 -3
- package/scripts/esbuild/watch-output.mjs +38 -38
- package/scripts/postcss/cleanup-plugin.cjs +89 -89
- package/scripts/postcss/onejs-tw-config.cjs +252 -252
- package/scripts/postcss/optional-import-plugin.cjs +26 -26
- package/scripts/postcss/tailwind-logging-plugin.cjs +11 -11
- package/scripts/postcss/unwrap-is-plugin.cjs +16 -16
- package/scripts/postcss/uss-transform-plugin.cjs +92 -92
- package/scripts/switch.cjs +321 -290
- package/styling/index.tsx +32 -32
- package/styling/utils/generateAlphabeticName.ts +20 -20
- package/styling/utils/generateComponentId.ts +5 -5
- package/styling/utils/hash.ts +46 -46
- package/tsconfig.json +24 -24
- package/typings.d.ts +5 -5
- package/utils/arrays.ts +10 -10
- package/utils/color-palettes.ts +2 -2
- package/utils/color-parser.ts +248 -248
- package/utils/float-parser.ts +30 -30
- package/utils/index.ts +15 -15
- package/utils/subscribe.ts +16 -16
- package/utils/system.ts +16 -16
|
@@ -1,252 +1,252 @@
|
|
|
1
|
-
const defaultTheme = require("tailwindcss/defaultTheme")
|
|
2
|
-
const plugin = require("tailwindcss/plugin")
|
|
3
|
-
|
|
4
|
-
let theme = rem2px(defaultTheme)
|
|
5
|
-
theme.extend = {
|
|
6
|
-
transitionTimingFunction: {
|
|
7
|
-
DEFAULT: "ease-in-out",
|
|
8
|
-
"in-out": "ease-in-out",
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.theme = theme
|
|
12
|
-
|
|
13
|
-
exports.paths = []
|
|
14
|
-
|
|
15
|
-
exports.plugins = [
|
|
16
|
-
plugin(function ({ addUtilities, matchUtilities, theme }) {
|
|
17
|
-
addUtilities({
|
|
18
|
-
".bg-crop": {
|
|
19
|
-
"-unity-background-scale-mode": "scale-and-crop",
|
|
20
|
-
},
|
|
21
|
-
".bg-fit": {
|
|
22
|
-
"-unity-background-scale-mode": "scale-to-fit",
|
|
23
|
-
},
|
|
24
|
-
".bg-fill": {
|
|
25
|
-
"-unity-background-scale-mode": "scale-to-fill",
|
|
26
|
-
},
|
|
27
|
-
".font-normal": {
|
|
28
|
-
"-unity-font-style": "normal",
|
|
29
|
-
},
|
|
30
|
-
".wrap": {
|
|
31
|
-
"white-space": "normal",
|
|
32
|
-
},
|
|
33
|
-
".font-bold": {
|
|
34
|
-
"-unity-font-style": "bold",
|
|
35
|
-
},
|
|
36
|
-
".bold": {
|
|
37
|
-
"-unity-font-style": "bold",
|
|
38
|
-
},
|
|
39
|
-
".italic": {
|
|
40
|
-
"-unity-font-style": "italic",
|
|
41
|
-
},
|
|
42
|
-
".bold-italic": {
|
|
43
|
-
"-unity-font-style": "bold-and-italic",
|
|
44
|
-
},
|
|
45
|
-
".transition-none": { "transition-property": "none" },
|
|
46
|
-
".transition-all": {
|
|
47
|
-
"transition-property": "all",
|
|
48
|
-
"transition-duration": "150ms",
|
|
49
|
-
},
|
|
50
|
-
".transition": {
|
|
51
|
-
"transition-property": "color, background-color, border-color, opacity",
|
|
52
|
-
"transition-duration": "150ms",
|
|
53
|
-
},
|
|
54
|
-
".transition-colors": {
|
|
55
|
-
"transition-property": "color, background-color, border-color",
|
|
56
|
-
"transition-duration": "150ms",
|
|
57
|
-
},
|
|
58
|
-
".transition-opacity": {
|
|
59
|
-
"transition-property": "opacity",
|
|
60
|
-
"transition-duration": "150ms",
|
|
61
|
-
},
|
|
62
|
-
".duration-0": { "transition-duration": "0s" },
|
|
63
|
-
".duration-75": { "transition-duration": "75ms" },
|
|
64
|
-
".duration-100": { "transition-duration": "100ms" },
|
|
65
|
-
".duration-150": { "transition-duration": "150ms" },
|
|
66
|
-
".duration-200": { "transition-duration": "200ms" },
|
|
67
|
-
".duration-300": { "transition-duration": "300ms" },
|
|
68
|
-
".duration-500": { "transition-duration": "500ms" },
|
|
69
|
-
".duration-700": { "transition-duration": "700ms" },
|
|
70
|
-
".duration-1000": { "transition-duration": "1000ms" },
|
|
71
|
-
".ease-in": { "transition-timing-function": "ease-in" },
|
|
72
|
-
".ease-out": { "transition-timing-function": "ease-out" },
|
|
73
|
-
".ease-in-out": { "transition-timing-function": "ease-in-out" },
|
|
74
|
-
".ease-linear": { "transition-timing-function": "linear" },
|
|
75
|
-
".ease-in-sine": { "transition-timing-function": "ease-in-sine" },
|
|
76
|
-
".ease-out-sine": { "transition-timing-function": "ease-out-sine" },
|
|
77
|
-
".ease-in-out-sine": { "transition-timing-function": "ease-in-out-sine" },
|
|
78
|
-
".ease-in-cubic": { "transition-timing-function": "ease-in-cubic" },
|
|
79
|
-
".ease-out-cubic": { "transition-timing-function": "ease-out-cubic" },
|
|
80
|
-
".ease-in-out-cubic": { "transition-timing-function": "ease-in-out-cubic" },
|
|
81
|
-
".ease-in-circ": { "transition-timing-function": "ease-in-circ" },
|
|
82
|
-
".ease-out-circ": { "transition-timing-function": "ease-out-circ" },
|
|
83
|
-
".ease-in-out-circ": { "transition-timing-function": "ease-in-out-circ" },
|
|
84
|
-
".ease-in-elastic": { "transition-timing-function": "ease-in-elastic" },
|
|
85
|
-
".ease-out-elastic": { "transition-timing-function": "ease-out-elastic" },
|
|
86
|
-
".ease-in-out-elastic": { "transition-timing-function": "ease-in-out-elastic" },
|
|
87
|
-
".ease-in-back": { "transition-timing-function": "ease-in-back" },
|
|
88
|
-
".ease-out-back": { "transition-timing-function": "ease-out-back" },
|
|
89
|
-
".ease-in-out-back": { "transition-timing-function": "ease-in-out-back" },
|
|
90
|
-
".ease-in-bounce": { "transition-timing-function": "ease-in-bounce" },
|
|
91
|
-
".ease-out-bounce": { "transition-timing-function": "ease-out-bounce" },
|
|
92
|
-
".ease-in-out-bounce": { "transition-timing-function": "ease-in-out-bounce" },
|
|
93
|
-
".delay-0": { "transition-delay": "0s" },
|
|
94
|
-
".delay-75": { "transition-delay": "75ms" },
|
|
95
|
-
".delay-100": { "transition-delay": "100ms" },
|
|
96
|
-
".delay-150": { "transition-delay": "150ms" },
|
|
97
|
-
".delay-200": { "transition-delay": "200ms" },
|
|
98
|
-
".delay-300": { "transition-delay": "300ms" },
|
|
99
|
-
".delay-500": { "transition-delay": "500ms" },
|
|
100
|
-
".delay-700": { "transition-delay": "700ms" },
|
|
101
|
-
".delay-1000": { "transition-delay": "1000ms" },
|
|
102
|
-
".scale-none": { scale: "none" },
|
|
103
|
-
".rotate-none": { rotate: "none" },
|
|
104
|
-
".text-left": { "-unity-text-align": "middle-left" },
|
|
105
|
-
".text-center": { "-unity-text-align": "middle-center" },
|
|
106
|
-
".text-right": { "-unity-text-align": "middle-right" },
|
|
107
|
-
".text-upper-left": { "-unity-text-align": "upper-left" },
|
|
108
|
-
".text-upper-center": { "-unity-text-align": "upper-center" },
|
|
109
|
-
".text-upper-right": { "-unity-text-align": "upper-right" },
|
|
110
|
-
".text-lower-left": { "-unity-text-align": "lower-left" },
|
|
111
|
-
".text-lower-center": { "-unity-text-align": "lower-center" },
|
|
112
|
-
".text-lower-right": { "-unity-text-align": "lower-right" },
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
matchUtilities({
|
|
116
|
-
fontdef: (value) => ({ "-unity-font-definition": `url("${value}")` }),
|
|
117
|
-
}, {})
|
|
118
|
-
|
|
119
|
-
// matchUtilities(
|
|
120
|
-
// {
|
|
121
|
-
// text: (value) => ({ "-unity-text-align": value }), // This will conflict with text colors, etc
|
|
122
|
-
// },
|
|
123
|
-
// {
|
|
124
|
-
// values: {
|
|
125
|
-
// left: "middle-left",
|
|
126
|
-
// center: "middle-center",
|
|
127
|
-
// right: "middle-right",
|
|
128
|
-
// "upper-left": "upper-left",
|
|
129
|
-
// "upper-center": "upper-center",
|
|
130
|
-
// "upper-right": "upper-right",
|
|
131
|
-
// "lower-left": "lower-left",
|
|
132
|
-
// "lower-center": "lower-center",
|
|
133
|
-
// "lower-right": "lower-right",
|
|
134
|
-
// },
|
|
135
|
-
// }
|
|
136
|
-
// )
|
|
137
|
-
|
|
138
|
-
matchUtilities(
|
|
139
|
-
{
|
|
140
|
-
duration: (value) => ({ "transition-duration": value }),
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
supportsNegativeValues: false,
|
|
144
|
-
values: theme("duration"),
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
matchUtilities(
|
|
149
|
-
{
|
|
150
|
-
delay: (value) => ({ "transition-delay": value }),
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
supportsNegativeValues: false,
|
|
154
|
-
values: theme("delay"),
|
|
155
|
-
}
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
matchUtilities(
|
|
159
|
-
{
|
|
160
|
-
translate: (value) => ({ translate: value }),
|
|
161
|
-
"translate-x": (value) => ({ translate: `${value} 0` }),
|
|
162
|
-
"translate-y": (value) => ({ translate: `0 ${value}` }),
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
supportsNegativeValues: true,
|
|
166
|
-
values: theme("translate"),
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
matchUtilities(
|
|
171
|
-
{
|
|
172
|
-
scale: (value) => ({ scale: value }),
|
|
173
|
-
"scale-x": (value) => ({ scale: `${value} 1` }),
|
|
174
|
-
"scale-y": (value) => ({ scale: `1 ${value}` }),
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
supportsNegativeValues: true,
|
|
178
|
-
values: theme("scale"),
|
|
179
|
-
}
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
matchUtilities(
|
|
183
|
-
{
|
|
184
|
-
rotate: (value) => ({ rotate: value }),
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
supportsNegativeValues: true,
|
|
188
|
-
values: theme("rotate"),
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
matchUtilities(
|
|
193
|
-
{
|
|
194
|
-
inset: (value) => ({
|
|
195
|
-
top: value,
|
|
196
|
-
bottom: value,
|
|
197
|
-
left: value,
|
|
198
|
-
right: value,
|
|
199
|
-
}),
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
supportsNegativeValues: true,
|
|
203
|
-
values: theme("inset"),
|
|
204
|
-
}
|
|
205
|
-
)
|
|
206
|
-
}),
|
|
207
|
-
]
|
|
208
|
-
|
|
209
|
-
// USS cannot support dynamic custom properties within rgb()
|
|
210
|
-
// which is what is used by Tailwind for opacity scales
|
|
211
|
-
// Ref: https://tailwindcss.com/docs/configuration#core-plugins
|
|
212
|
-
exports.corePlugins = [
|
|
213
|
-
"alignContent", "alignItems", "alignSelf",
|
|
214
|
-
"justifyContent",
|
|
215
|
-
"backgroundColor", "backgroundImage", "backgroundPosition", "backgroundRepeat", "backgroundSize",
|
|
216
|
-
"borderColor", "borderRadius", "borderWidth",
|
|
217
|
-
"colors", "textColor", "cursor",
|
|
218
|
-
"flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap",
|
|
219
|
-
"fontFamily", "fontSize", "fontStyle",
|
|
220
|
-
"width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight",
|
|
221
|
-
"margin", "padding",
|
|
222
|
-
"opacity", "overflow", "display", "visibility",
|
|
223
|
-
"position", "inset"
|
|
224
|
-
]
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Utilities
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
|
-
// rem is not supported in USS
|
|
231
|
-
function rem2px(input, fontSize = 16) {
|
|
232
|
-
if (input == null) {
|
|
233
|
-
return input
|
|
234
|
-
}
|
|
235
|
-
switch (typeof input) {
|
|
236
|
-
case "object":
|
|
237
|
-
if (Array.isArray(input)) {
|
|
238
|
-
return input.map((val) => rem2px(val, fontSize))
|
|
239
|
-
}
|
|
240
|
-
const ret = {}
|
|
241
|
-
for (const key in input) {
|
|
242
|
-
ret[key] = rem2px(input[key], fontSize)
|
|
243
|
-
}
|
|
244
|
-
return ret
|
|
245
|
-
case "string":
|
|
246
|
-
return input.replace(/(\d*\.?\d+)rem$/, (_, val) => `${parseFloat(val) * fontSize}px`)
|
|
247
|
-
case "function":
|
|
248
|
-
return eval(input.toString().replace(/(\d*\.?\d+)rem/g, (_, val) => `${parseFloat(val) * fontSize}px`))
|
|
249
|
-
default:
|
|
250
|
-
return input
|
|
251
|
-
}
|
|
252
|
-
}
|
|
1
|
+
const defaultTheme = require("tailwindcss/defaultTheme")
|
|
2
|
+
const plugin = require("tailwindcss/plugin")
|
|
3
|
+
|
|
4
|
+
let theme = rem2px(defaultTheme)
|
|
5
|
+
theme.extend = {
|
|
6
|
+
transitionTimingFunction: {
|
|
7
|
+
DEFAULT: "ease-in-out",
|
|
8
|
+
"in-out": "ease-in-out",
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.theme = theme
|
|
12
|
+
|
|
13
|
+
exports.paths = []
|
|
14
|
+
|
|
15
|
+
exports.plugins = [
|
|
16
|
+
plugin(function ({ addUtilities, matchUtilities, theme }) {
|
|
17
|
+
addUtilities({
|
|
18
|
+
".bg-crop": {
|
|
19
|
+
"-unity-background-scale-mode": "scale-and-crop",
|
|
20
|
+
},
|
|
21
|
+
".bg-fit": {
|
|
22
|
+
"-unity-background-scale-mode": "scale-to-fit",
|
|
23
|
+
},
|
|
24
|
+
".bg-fill": {
|
|
25
|
+
"-unity-background-scale-mode": "scale-to-fill",
|
|
26
|
+
},
|
|
27
|
+
".font-normal": {
|
|
28
|
+
"-unity-font-style": "normal",
|
|
29
|
+
},
|
|
30
|
+
".wrap": {
|
|
31
|
+
"white-space": "normal",
|
|
32
|
+
},
|
|
33
|
+
".font-bold": {
|
|
34
|
+
"-unity-font-style": "bold",
|
|
35
|
+
},
|
|
36
|
+
".bold": {
|
|
37
|
+
"-unity-font-style": "bold",
|
|
38
|
+
},
|
|
39
|
+
".italic": {
|
|
40
|
+
"-unity-font-style": "italic",
|
|
41
|
+
},
|
|
42
|
+
".bold-italic": {
|
|
43
|
+
"-unity-font-style": "bold-and-italic",
|
|
44
|
+
},
|
|
45
|
+
".transition-none": { "transition-property": "none" },
|
|
46
|
+
".transition-all": {
|
|
47
|
+
"transition-property": "all",
|
|
48
|
+
"transition-duration": "150ms",
|
|
49
|
+
},
|
|
50
|
+
".transition": {
|
|
51
|
+
"transition-property": "color, background-color, border-color, opacity",
|
|
52
|
+
"transition-duration": "150ms",
|
|
53
|
+
},
|
|
54
|
+
".transition-colors": {
|
|
55
|
+
"transition-property": "color, background-color, border-color",
|
|
56
|
+
"transition-duration": "150ms",
|
|
57
|
+
},
|
|
58
|
+
".transition-opacity": {
|
|
59
|
+
"transition-property": "opacity",
|
|
60
|
+
"transition-duration": "150ms",
|
|
61
|
+
},
|
|
62
|
+
".duration-0": { "transition-duration": "0s" },
|
|
63
|
+
".duration-75": { "transition-duration": "75ms" },
|
|
64
|
+
".duration-100": { "transition-duration": "100ms" },
|
|
65
|
+
".duration-150": { "transition-duration": "150ms" },
|
|
66
|
+
".duration-200": { "transition-duration": "200ms" },
|
|
67
|
+
".duration-300": { "transition-duration": "300ms" },
|
|
68
|
+
".duration-500": { "transition-duration": "500ms" },
|
|
69
|
+
".duration-700": { "transition-duration": "700ms" },
|
|
70
|
+
".duration-1000": { "transition-duration": "1000ms" },
|
|
71
|
+
".ease-in": { "transition-timing-function": "ease-in" },
|
|
72
|
+
".ease-out": { "transition-timing-function": "ease-out" },
|
|
73
|
+
".ease-in-out": { "transition-timing-function": "ease-in-out" },
|
|
74
|
+
".ease-linear": { "transition-timing-function": "linear" },
|
|
75
|
+
".ease-in-sine": { "transition-timing-function": "ease-in-sine" },
|
|
76
|
+
".ease-out-sine": { "transition-timing-function": "ease-out-sine" },
|
|
77
|
+
".ease-in-out-sine": { "transition-timing-function": "ease-in-out-sine" },
|
|
78
|
+
".ease-in-cubic": { "transition-timing-function": "ease-in-cubic" },
|
|
79
|
+
".ease-out-cubic": { "transition-timing-function": "ease-out-cubic" },
|
|
80
|
+
".ease-in-out-cubic": { "transition-timing-function": "ease-in-out-cubic" },
|
|
81
|
+
".ease-in-circ": { "transition-timing-function": "ease-in-circ" },
|
|
82
|
+
".ease-out-circ": { "transition-timing-function": "ease-out-circ" },
|
|
83
|
+
".ease-in-out-circ": { "transition-timing-function": "ease-in-out-circ" },
|
|
84
|
+
".ease-in-elastic": { "transition-timing-function": "ease-in-elastic" },
|
|
85
|
+
".ease-out-elastic": { "transition-timing-function": "ease-out-elastic" },
|
|
86
|
+
".ease-in-out-elastic": { "transition-timing-function": "ease-in-out-elastic" },
|
|
87
|
+
".ease-in-back": { "transition-timing-function": "ease-in-back" },
|
|
88
|
+
".ease-out-back": { "transition-timing-function": "ease-out-back" },
|
|
89
|
+
".ease-in-out-back": { "transition-timing-function": "ease-in-out-back" },
|
|
90
|
+
".ease-in-bounce": { "transition-timing-function": "ease-in-bounce" },
|
|
91
|
+
".ease-out-bounce": { "transition-timing-function": "ease-out-bounce" },
|
|
92
|
+
".ease-in-out-bounce": { "transition-timing-function": "ease-in-out-bounce" },
|
|
93
|
+
".delay-0": { "transition-delay": "0s" },
|
|
94
|
+
".delay-75": { "transition-delay": "75ms" },
|
|
95
|
+
".delay-100": { "transition-delay": "100ms" },
|
|
96
|
+
".delay-150": { "transition-delay": "150ms" },
|
|
97
|
+
".delay-200": { "transition-delay": "200ms" },
|
|
98
|
+
".delay-300": { "transition-delay": "300ms" },
|
|
99
|
+
".delay-500": { "transition-delay": "500ms" },
|
|
100
|
+
".delay-700": { "transition-delay": "700ms" },
|
|
101
|
+
".delay-1000": { "transition-delay": "1000ms" },
|
|
102
|
+
".scale-none": { scale: "none" },
|
|
103
|
+
".rotate-none": { rotate: "none" },
|
|
104
|
+
".text-left": { "-unity-text-align": "middle-left" },
|
|
105
|
+
".text-center": { "-unity-text-align": "middle-center" },
|
|
106
|
+
".text-right": { "-unity-text-align": "middle-right" },
|
|
107
|
+
".text-upper-left": { "-unity-text-align": "upper-left" },
|
|
108
|
+
".text-upper-center": { "-unity-text-align": "upper-center" },
|
|
109
|
+
".text-upper-right": { "-unity-text-align": "upper-right" },
|
|
110
|
+
".text-lower-left": { "-unity-text-align": "lower-left" },
|
|
111
|
+
".text-lower-center": { "-unity-text-align": "lower-center" },
|
|
112
|
+
".text-lower-right": { "-unity-text-align": "lower-right" },
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
matchUtilities({
|
|
116
|
+
fontdef: (value) => ({ "-unity-font-definition": `url("${value}")` }),
|
|
117
|
+
}, {})
|
|
118
|
+
|
|
119
|
+
// matchUtilities(
|
|
120
|
+
// {
|
|
121
|
+
// text: (value) => ({ "-unity-text-align": value }), // This will conflict with text colors, etc
|
|
122
|
+
// },
|
|
123
|
+
// {
|
|
124
|
+
// values: {
|
|
125
|
+
// left: "middle-left",
|
|
126
|
+
// center: "middle-center",
|
|
127
|
+
// right: "middle-right",
|
|
128
|
+
// "upper-left": "upper-left",
|
|
129
|
+
// "upper-center": "upper-center",
|
|
130
|
+
// "upper-right": "upper-right",
|
|
131
|
+
// "lower-left": "lower-left",
|
|
132
|
+
// "lower-center": "lower-center",
|
|
133
|
+
// "lower-right": "lower-right",
|
|
134
|
+
// },
|
|
135
|
+
// }
|
|
136
|
+
// )
|
|
137
|
+
|
|
138
|
+
matchUtilities(
|
|
139
|
+
{
|
|
140
|
+
duration: (value) => ({ "transition-duration": value }),
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
supportsNegativeValues: false,
|
|
144
|
+
values: theme("duration"),
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
matchUtilities(
|
|
149
|
+
{
|
|
150
|
+
delay: (value) => ({ "transition-delay": value }),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
supportsNegativeValues: false,
|
|
154
|
+
values: theme("delay"),
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
matchUtilities(
|
|
159
|
+
{
|
|
160
|
+
translate: (value) => ({ translate: value }),
|
|
161
|
+
"translate-x": (value) => ({ translate: `${value} 0` }),
|
|
162
|
+
"translate-y": (value) => ({ translate: `0 ${value}` }),
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
supportsNegativeValues: true,
|
|
166
|
+
values: theme("translate"),
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
matchUtilities(
|
|
171
|
+
{
|
|
172
|
+
scale: (value) => ({ scale: value }),
|
|
173
|
+
"scale-x": (value) => ({ scale: `${value} 1` }),
|
|
174
|
+
"scale-y": (value) => ({ scale: `1 ${value}` }),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
supportsNegativeValues: true,
|
|
178
|
+
values: theme("scale"),
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
matchUtilities(
|
|
183
|
+
{
|
|
184
|
+
rotate: (value) => ({ rotate: value }),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
supportsNegativeValues: true,
|
|
188
|
+
values: theme("rotate"),
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
matchUtilities(
|
|
193
|
+
{
|
|
194
|
+
inset: (value) => ({
|
|
195
|
+
top: value,
|
|
196
|
+
bottom: value,
|
|
197
|
+
left: value,
|
|
198
|
+
right: value,
|
|
199
|
+
}),
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
supportsNegativeValues: true,
|
|
203
|
+
values: theme("inset"),
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
}),
|
|
207
|
+
]
|
|
208
|
+
|
|
209
|
+
// USS cannot support dynamic custom properties within rgb()
|
|
210
|
+
// which is what is used by Tailwind for opacity scales
|
|
211
|
+
// Ref: https://tailwindcss.com/docs/configuration#core-plugins
|
|
212
|
+
exports.corePlugins = [
|
|
213
|
+
"alignContent", "alignItems", "alignSelf",
|
|
214
|
+
"justifyContent",
|
|
215
|
+
"backgroundColor", "backgroundImage", "backgroundPosition", "backgroundRepeat", "backgroundSize",
|
|
216
|
+
"borderColor", "borderRadius", "borderWidth",
|
|
217
|
+
"colors", "textColor", "cursor",
|
|
218
|
+
"flex", "flexBasis", "flexDirection", "flexGrow", "flexShrink", "flexWrap",
|
|
219
|
+
"fontFamily", "fontSize", "fontStyle",
|
|
220
|
+
"width", "height", "maxWidth", "maxHeight", "minWidth", "minHeight",
|
|
221
|
+
"margin", "padding",
|
|
222
|
+
"opacity", "overflow", "display", "visibility",
|
|
223
|
+
"position", "inset"
|
|
224
|
+
]
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Utilities
|
|
228
|
+
*/
|
|
229
|
+
|
|
230
|
+
// rem is not supported in USS
|
|
231
|
+
function rem2px(input, fontSize = 16) {
|
|
232
|
+
if (input == null) {
|
|
233
|
+
return input
|
|
234
|
+
}
|
|
235
|
+
switch (typeof input) {
|
|
236
|
+
case "object":
|
|
237
|
+
if (Array.isArray(input)) {
|
|
238
|
+
return input.map((val) => rem2px(val, fontSize))
|
|
239
|
+
}
|
|
240
|
+
const ret = {}
|
|
241
|
+
for (const key in input) {
|
|
242
|
+
ret[key] = rem2px(input[key], fontSize)
|
|
243
|
+
}
|
|
244
|
+
return ret
|
|
245
|
+
case "string":
|
|
246
|
+
return input.replace(/(\d*\.?\d+)rem$/, (_, val) => `${parseFloat(val) * fontSize}px`)
|
|
247
|
+
case "function":
|
|
248
|
+
return eval(input.toString().replace(/(\d*\.?\d+)rem/g, (_, val) => `${parseFloat(val) * fontSize}px`))
|
|
249
|
+
default:
|
|
250
|
+
return input
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
const fs = require("fs")
|
|
2
|
-
const path = require("path")
|
|
3
|
-
const postcssImport = require("postcss-import")
|
|
4
|
-
|
|
5
|
-
module.exports = function optionalImportPlugin() {
|
|
6
|
-
const optionalImportMap = new Map()
|
|
7
|
-
|
|
8
|
-
return postcssImport({
|
|
9
|
-
resolve(id, basedir) {
|
|
10
|
-
const fullPath = path.resolve(basedir, id)
|
|
11
|
-
if (!fs.existsSync(fullPath)) {
|
|
12
|
-
const fakePath = path.resolve(".optional-imports", id.replace(/[\\/]/g, "_") + ".css")
|
|
13
|
-
optionalImportMap.set(fakePath, "")
|
|
14
|
-
console.warn(`[postcss-import] Skipping: ${id}`)
|
|
15
|
-
return fakePath
|
|
16
|
-
}
|
|
17
|
-
return fullPath
|
|
18
|
-
},
|
|
19
|
-
load(filename) {
|
|
20
|
-
if (optionalImportMap.has(filename)) {
|
|
21
|
-
return "/* optional import skipped */"
|
|
22
|
-
}
|
|
23
|
-
return fs.readFileSync(filename, "utf8")
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}
|
|
1
|
+
const fs = require("fs")
|
|
2
|
+
const path = require("path")
|
|
3
|
+
const postcssImport = require("postcss-import")
|
|
4
|
+
|
|
5
|
+
module.exports = function optionalImportPlugin() {
|
|
6
|
+
const optionalImportMap = new Map()
|
|
7
|
+
|
|
8
|
+
return postcssImport({
|
|
9
|
+
resolve(id, basedir) {
|
|
10
|
+
const fullPath = path.resolve(basedir, id)
|
|
11
|
+
if (!fs.existsSync(fullPath)) {
|
|
12
|
+
const fakePath = path.resolve(".optional-imports", id.replace(/[\\/]/g, "_") + ".css")
|
|
13
|
+
optionalImportMap.set(fakePath, "")
|
|
14
|
+
console.warn(`[postcss-import] Skipping: ${id}`)
|
|
15
|
+
return fakePath
|
|
16
|
+
}
|
|
17
|
+
return fullPath
|
|
18
|
+
},
|
|
19
|
+
load(filename) {
|
|
20
|
+
if (optionalImportMap.has(filename)) {
|
|
21
|
+
return "/* optional import skipped */"
|
|
22
|
+
}
|
|
23
|
+
return fs.readFileSync(filename, "utf8")
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module.exports = () => {
|
|
2
|
-
return {
|
|
3
|
-
postcssPlugin: 'postcss-logging-plugin',
|
|
4
|
-
Once(root, { result }) {
|
|
5
|
-
process.stdout.write('\x1Bc')
|
|
6
|
-
console.log('[tailwindcss] compiler started...')
|
|
7
|
-
},
|
|
8
|
-
OnceExit(root, { result }) {
|
|
9
|
-
console.log('[tailwindcss] watching...')
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
module.exports = () => {
|
|
2
|
+
return {
|
|
3
|
+
postcssPlugin: 'postcss-logging-plugin',
|
|
4
|
+
Once(root, { result }) {
|
|
5
|
+
process.stdout.write('\x1Bc')
|
|
6
|
+
console.log('[tailwindcss] compiler started...')
|
|
7
|
+
},
|
|
8
|
+
OnceExit(root, { result }) {
|
|
9
|
+
console.log('[tailwindcss] watching...')
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
12
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const postcss = require('postcss')
|
|
2
|
-
const selectorParser = require('postcss-selector-parser')
|
|
3
|
-
|
|
4
|
-
module.exports = postcss.plugin('postcss-unwrap-is', () => {
|
|
5
|
-
return (root) => {
|
|
6
|
-
root.walkRules(rule => {
|
|
7
|
-
rule.selector = selectorParser(selectors => {
|
|
8
|
-
selectors.walkPseudos(pseudo => {
|
|
9
|
-
if (pseudo.value === ':is') {
|
|
10
|
-
// replace the entire :is(...) with its contents
|
|
11
|
-
pseudo.replaceWith(...pseudo.nodes)
|
|
12
|
-
}
|
|
13
|
-
})
|
|
14
|
-
}).processSync(rule.selector)
|
|
15
|
-
})
|
|
16
|
-
}
|
|
1
|
+
const postcss = require('postcss')
|
|
2
|
+
const selectorParser = require('postcss-selector-parser')
|
|
3
|
+
|
|
4
|
+
module.exports = postcss.plugin('postcss-unwrap-is', () => {
|
|
5
|
+
return (root) => {
|
|
6
|
+
root.walkRules(rule => {
|
|
7
|
+
rule.selector = selectorParser(selectors => {
|
|
8
|
+
selectors.walkPseudos(pseudo => {
|
|
9
|
+
if (pseudo.value === ':is') {
|
|
10
|
+
// replace the entire :is(...) with its contents
|
|
11
|
+
pseudo.replaceWith(...pseudo.nodes)
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
}).processSync(rule.selector)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
17
|
})
|