@ogxjs/core 0.1.1 → 0.2.0-alpha.1
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/builder.d.ts +5 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +11 -1
- package/dist/cache/hash.d.ts +66 -0
- package/dist/cache/hash.d.ts.map +1 -0
- package/dist/cache/hash.js +161 -0
- package/dist/cache/index.d.ts +10 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +12 -0
- package/dist/cache/lru.d.ts +122 -0
- package/dist/cache/lru.d.ts.map +1 -0
- package/dist/cache/lru.js +269 -0
- package/dist/cache/snapshot.d.ts +116 -0
- package/dist/cache/snapshot.d.ts.map +1 -0
- package/dist/cache/snapshot.js +204 -0
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +2 -2
- package/dist/css.d.ts +19 -6
- package/dist/css.d.ts.map +1 -1
- package/dist/index.d.ts +18 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -10
- package/dist/ogx.js +2 -2
- package/dist/perf/index.d.ts +8 -0
- package/dist/perf/index.d.ts.map +1 -0
- package/dist/perf/index.js +7 -0
- package/dist/perf/timing.d.ts +160 -0
- package/dist/perf/timing.d.ts.map +1 -0
- package/dist/perf/timing.js +305 -0
- package/dist/presets/blog.js +1 -1
- package/dist/presets/docs.d.ts +2 -0
- package/dist/presets/docs.d.ts.map +1 -1
- package/dist/presets/docs.js +26 -23
- package/dist/presets/minimal.d.ts +2 -0
- package/dist/presets/minimal.d.ts.map +1 -1
- package/dist/presets/minimal.js +8 -16
- package/dist/presets/social.d.ts +2 -0
- package/dist/presets/social.d.ts.map +1 -1
- package/dist/presets/social.js +28 -18
- package/dist/render-png.d.ts.map +1 -1
- package/dist/render-png.js +9 -1
- package/dist/render-svg.d.ts.map +1 -1
- package/dist/render-svg.js +11 -1
- package/dist/tailwind/class-cache.d.ts +141 -0
- package/dist/tailwind/class-cache.d.ts.map +1 -0
- package/dist/tailwind/class-cache.js +212 -0
- package/dist/tailwind/index.d.ts +14 -1
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +15 -1
- package/dist/tailwind/lookup-tables.d.ts +30 -0
- package/dist/tailwind/lookup-tables.d.ts.map +1 -0
- package/dist/tailwind/lookup-tables.js +427 -0
- package/dist/tailwind/parser-v2.d.ts +54 -0
- package/dist/tailwind/parser-v2.d.ts.map +1 -0
- package/dist/tailwind/parser-v2.js +250 -0
- package/dist/tailwind/parser.d.ts +1 -0
- package/dist/tailwind/parser.d.ts.map +1 -1
- package/dist/tailwind/parser.js +1 -0
- package/dist/tailwind/prefix-handlers.d.ts +68 -0
- package/dist/tailwind/prefix-handlers.d.ts.map +1 -0
- package/dist/tailwind/prefix-handlers.js +931 -0
- package/package.json +17 -2
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ogxjs/core - Tailwind Lookup Tables
|
|
3
|
+
* O(1) lookup for static classes (no dynamic values)
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* This module provides instant lookup for ~200+ static Tailwind classes.
|
|
7
|
+
* Instead of iterating through if/else chains, we use Map for O(1) access.
|
|
8
|
+
*
|
|
9
|
+
* @performance
|
|
10
|
+
* - Before: O(n) where n = number of if/else conditions (~100)
|
|
11
|
+
* - After: O(1) constant time lookup
|
|
12
|
+
*
|
|
13
|
+
* @version 0.2.0 "Turbo"
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Static classes that map directly to CSS properties
|
|
17
|
+
* No parsing needed - just lookup and return
|
|
18
|
+
*/
|
|
19
|
+
export const STATIC_CLASSES = new Map([
|
|
20
|
+
// DISPLAY
|
|
21
|
+
["flex", { display: "flex" }],
|
|
22
|
+
["hidden", { display: "none" }],
|
|
23
|
+
["block", { display: "block" }],
|
|
24
|
+
["inline", { display: "inline" }],
|
|
25
|
+
["inline-flex", { display: "inline-flex" }],
|
|
26
|
+
["inline-block", { display: "inline-block" }],
|
|
27
|
+
// FLEX DIRECTION
|
|
28
|
+
["flex-row", { flexDirection: "row" }],
|
|
29
|
+
["flex-col", { flexDirection: "column" }],
|
|
30
|
+
["flex-row-reverse", { flexDirection: "row-reverse" }],
|
|
31
|
+
["flex-col-reverse", { flexDirection: "column-reverse" }],
|
|
32
|
+
// FLEX WRAP
|
|
33
|
+
["flex-wrap", { flexWrap: "wrap" }],
|
|
34
|
+
["flex-nowrap", { flexWrap: "nowrap" }],
|
|
35
|
+
["flex-wrap-reverse", { flexWrap: "wrap-reverse" }],
|
|
36
|
+
// FLEX GROW / SHRINK / BASIS
|
|
37
|
+
["flex-1", { flexGrow: 1, flexShrink: 1, flexBasis: "0%" }],
|
|
38
|
+
["flex-auto", { flexGrow: 1, flexShrink: 1, flexBasis: "auto" }],
|
|
39
|
+
["flex-initial", { flexGrow: 0, flexShrink: 1, flexBasis: "auto" }],
|
|
40
|
+
["flex-none", { flexGrow: 0, flexShrink: 0, flexBasis: "auto" }],
|
|
41
|
+
["grow", { flexGrow: 1 }],
|
|
42
|
+
["grow-0", { flexGrow: 0 }],
|
|
43
|
+
["shrink", { flexShrink: 1 }],
|
|
44
|
+
["shrink-0", { flexShrink: 0 }],
|
|
45
|
+
// ALIGN ITEMS
|
|
46
|
+
["items-start", { alignItems: "flex-start" }],
|
|
47
|
+
["items-end", { alignItems: "flex-end" }],
|
|
48
|
+
["items-center", { alignItems: "center" }],
|
|
49
|
+
["items-baseline", { alignItems: "baseline" }],
|
|
50
|
+
["items-stretch", { alignItems: "stretch" }],
|
|
51
|
+
// ALIGN SELF
|
|
52
|
+
["self-auto", { alignSelf: "auto" }],
|
|
53
|
+
["self-start", { alignSelf: "flex-start" }],
|
|
54
|
+
["self-end", { alignSelf: "flex-end" }],
|
|
55
|
+
["self-center", { alignSelf: "center" }],
|
|
56
|
+
["self-stretch", { alignSelf: "stretch" }],
|
|
57
|
+
["self-baseline", { alignSelf: "baseline" }],
|
|
58
|
+
// JUSTIFY CONTENT
|
|
59
|
+
["justify-start", { justifyContent: "flex-start" }],
|
|
60
|
+
["justify-end", { justifyContent: "flex-end" }],
|
|
61
|
+
["justify-center", { justifyContent: "center" }],
|
|
62
|
+
["justify-between", { justifyContent: "space-between" }],
|
|
63
|
+
["justify-around", { justifyContent: "space-around" }],
|
|
64
|
+
["justify-evenly", { justifyContent: "space-evenly" }],
|
|
65
|
+
["justify-items-start", { justifyItems: "start" }],
|
|
66
|
+
["justify-items-end", { justifyItems: "end" }],
|
|
67
|
+
["justify-items-center", { justifyItems: "center" }],
|
|
68
|
+
["justify-items-stretch", { justifyItems: "stretch" }],
|
|
69
|
+
// JUSTIFY SELF
|
|
70
|
+
["justify-self-auto", { justifySelf: "auto" }],
|
|
71
|
+
["justify-self-start", { justifySelf: "start" }],
|
|
72
|
+
["justify-self-end", { justifySelf: "end" }],
|
|
73
|
+
["justify-self-center", { justifySelf: "center" }],
|
|
74
|
+
["justify-self-stretch", { justifySelf: "stretch" }],
|
|
75
|
+
// ALIGN CONTENT
|
|
76
|
+
["content-start", { alignContent: "flex-start" }],
|
|
77
|
+
["content-end", { alignContent: "flex-end" }],
|
|
78
|
+
["content-center", { alignContent: "center" }],
|
|
79
|
+
["content-between", { alignContent: "space-between" }],
|
|
80
|
+
["content-around", { alignContent: "space-around" }],
|
|
81
|
+
["content-evenly", { alignContent: "space-evenly" }],
|
|
82
|
+
["content-stretch", { alignContent: "stretch" }],
|
|
83
|
+
// POSITION
|
|
84
|
+
["relative", { position: "relative" }],
|
|
85
|
+
["absolute", { position: "absolute" }],
|
|
86
|
+
["fixed", { position: "fixed" }],
|
|
87
|
+
["sticky", { position: "sticky" }],
|
|
88
|
+
["static", { position: "static" }],
|
|
89
|
+
// INSET (Static values)
|
|
90
|
+
["inset-0", { top: 0, right: 0, bottom: 0, left: 0 }],
|
|
91
|
+
["inset-auto", { top: "auto", right: "auto", bottom: "auto", left: "auto" }],
|
|
92
|
+
["inset-x-0", { left: 0, right: 0 }],
|
|
93
|
+
["inset-y-0", { top: 0, bottom: 0 }],
|
|
94
|
+
["top-0", { top: 0 }],
|
|
95
|
+
["right-0", { right: 0 }],
|
|
96
|
+
["bottom-0", { bottom: 0 }],
|
|
97
|
+
["left-0", { left: 0 }],
|
|
98
|
+
["top-auto", { top: "auto" }],
|
|
99
|
+
["right-auto", { right: "auto" }],
|
|
100
|
+
["bottom-auto", { bottom: "auto" }],
|
|
101
|
+
["left-auto", { left: "auto" }],
|
|
102
|
+
// WIDTH (Static values)
|
|
103
|
+
["w-full", { width: "100%" }],
|
|
104
|
+
["w-screen", { width: "100vw" }],
|
|
105
|
+
["w-auto", { width: "auto" }],
|
|
106
|
+
["w-fit", { width: "fit-content" }],
|
|
107
|
+
["w-min", { width: "min-content" }],
|
|
108
|
+
["w-max", { width: "max-content" }],
|
|
109
|
+
["w-0", { width: 0 }],
|
|
110
|
+
["w-px", { width: 1 }],
|
|
111
|
+
["w-1/2", { width: "50%" }],
|
|
112
|
+
["w-1/3", { width: "33.333333%" }],
|
|
113
|
+
["w-2/3", { width: "66.666667%" }],
|
|
114
|
+
["w-1/4", { width: "25%" }],
|
|
115
|
+
["w-3/4", { width: "75%" }],
|
|
116
|
+
["w-1/5", { width: "20%" }],
|
|
117
|
+
["w-2/5", { width: "40%" }],
|
|
118
|
+
["w-3/5", { width: "60%" }],
|
|
119
|
+
["w-4/5", { width: "80%" }],
|
|
120
|
+
// HEIGHT (Static values)
|
|
121
|
+
["h-full", { height: "100%" }],
|
|
122
|
+
["h-screen", { height: "100vh" }],
|
|
123
|
+
["h-auto", { height: "auto" }],
|
|
124
|
+
["h-fit", { height: "fit-content" }],
|
|
125
|
+
["h-min", { height: "min-content" }],
|
|
126
|
+
["h-max", { height: "max-content" }],
|
|
127
|
+
["h-0", { height: 0 }],
|
|
128
|
+
["h-px", { height: 1 }],
|
|
129
|
+
["h-1/2", { height: "50%" }],
|
|
130
|
+
["h-1/3", { height: "33.333333%" }],
|
|
131
|
+
["h-2/3", { height: "66.666667%" }],
|
|
132
|
+
["h-1/4", { height: "25%" }],
|
|
133
|
+
["h-3/4", { height: "75%" }],
|
|
134
|
+
["h-1/5", { height: "20%" }],
|
|
135
|
+
["h-2/5", { height: "40%" }],
|
|
136
|
+
["h-3/5", { height: "60%" }],
|
|
137
|
+
["h-4/5", { height: "80%" }],
|
|
138
|
+
// MIN/MAX WIDTH/HEIGHT
|
|
139
|
+
["min-w-0", { minWidth: 0 }],
|
|
140
|
+
["min-w-full", { minWidth: "100%" }],
|
|
141
|
+
["min-w-min", { minWidth: "min-content" }],
|
|
142
|
+
["min-w-max", { minWidth: "max-content" }],
|
|
143
|
+
["min-w-fit", { minWidth: "fit-content" }],
|
|
144
|
+
["max-w-full", { maxWidth: "100%" }],
|
|
145
|
+
["max-w-none", { maxWidth: "none" }],
|
|
146
|
+
["max-w-min", { maxWidth: "min-content" }],
|
|
147
|
+
["max-w-max", { maxWidth: "max-content" }],
|
|
148
|
+
["max-w-fit", { maxWidth: "fit-content" }],
|
|
149
|
+
["min-h-0", { minHeight: 0 }],
|
|
150
|
+
["min-h-full", { minHeight: "100%" }],
|
|
151
|
+
["min-h-screen", { minHeight: "100vh" }],
|
|
152
|
+
["min-h-min", { minHeight: "min-content" }],
|
|
153
|
+
["min-h-max", { minHeight: "max-content" }],
|
|
154
|
+
["min-h-fit", { minHeight: "fit-content" }],
|
|
155
|
+
["max-h-full", { maxHeight: "100%" }],
|
|
156
|
+
["max-h-screen", { maxHeight: "100vh" }],
|
|
157
|
+
["max-h-none", { maxHeight: "none" }],
|
|
158
|
+
["max-h-min", { maxHeight: "min-content" }],
|
|
159
|
+
["max-h-max", { maxHeight: "max-content" }],
|
|
160
|
+
["max-h-fit", { maxHeight: "fit-content" }],
|
|
161
|
+
// MARGIN (Static values)
|
|
162
|
+
["m-0", { margin: 0 }],
|
|
163
|
+
["m-auto", { margin: "auto" }],
|
|
164
|
+
["m-px", { margin: 1 }],
|
|
165
|
+
["mx-0", { marginLeft: 0, marginRight: 0 }],
|
|
166
|
+
["mx-auto", { marginLeft: "auto", marginRight: "auto" }],
|
|
167
|
+
["mx-px", { marginLeft: 1, marginRight: 1 }],
|
|
168
|
+
["my-0", { marginTop: 0, marginBottom: 0 }],
|
|
169
|
+
["my-auto", { marginTop: "auto", marginBottom: "auto" }],
|
|
170
|
+
["my-px", { marginTop: 1, marginBottom: 1 }],
|
|
171
|
+
["mt-0", { marginTop: 0 }],
|
|
172
|
+
["mt-auto", { marginTop: "auto" }],
|
|
173
|
+
["mt-px", { marginTop: 1 }],
|
|
174
|
+
["mr-0", { marginRight: 0 }],
|
|
175
|
+
["mr-auto", { marginRight: "auto" }],
|
|
176
|
+
["mr-px", { marginRight: 1 }],
|
|
177
|
+
["mb-0", { marginBottom: 0 }],
|
|
178
|
+
["mb-auto", { marginBottom: "auto" }],
|
|
179
|
+
["mb-px", { marginBottom: 1 }],
|
|
180
|
+
["ml-0", { marginLeft: 0 }],
|
|
181
|
+
["ml-auto", { marginLeft: "auto" }],
|
|
182
|
+
["ml-px", { marginLeft: 1 }],
|
|
183
|
+
// PADDING (Static values)
|
|
184
|
+
["p-0", { padding: 0 }],
|
|
185
|
+
["p-px", { padding: 1 }],
|
|
186
|
+
["px-0", { paddingLeft: 0, paddingRight: 0 }],
|
|
187
|
+
["px-px", { paddingLeft: 1, paddingRight: 1 }],
|
|
188
|
+
["py-0", { paddingTop: 0, paddingBottom: 0 }],
|
|
189
|
+
["py-px", { paddingTop: 1, paddingBottom: 1 }],
|
|
190
|
+
["pt-0", { paddingTop: 0 }],
|
|
191
|
+
["pt-px", { paddingTop: 1 }],
|
|
192
|
+
["pr-0", { paddingRight: 0 }],
|
|
193
|
+
["pr-px", { paddingRight: 1 }],
|
|
194
|
+
["pb-0", { paddingBottom: 0 }],
|
|
195
|
+
["pb-px", { paddingBottom: 1 }],
|
|
196
|
+
["pl-0", { paddingLeft: 0 }],
|
|
197
|
+
["pl-px", { paddingLeft: 1 }],
|
|
198
|
+
// GAP (Static values)
|
|
199
|
+
["gap-0", { gap: 0 }],
|
|
200
|
+
["gap-px", { gap: 1 }],
|
|
201
|
+
["gap-x-0", { columnGap: 0 }],
|
|
202
|
+
["gap-x-px", { columnGap: 1 }],
|
|
203
|
+
["gap-y-0", { rowGap: 0 }],
|
|
204
|
+
["gap-y-px", { rowGap: 1 }],
|
|
205
|
+
// BORDER RADIUS
|
|
206
|
+
["rounded-none", { borderRadius: 0 }],
|
|
207
|
+
["rounded-sm", { borderRadius: 2 }],
|
|
208
|
+
["rounded", { borderRadius: 4 }],
|
|
209
|
+
["rounded-md", { borderRadius: 6 }],
|
|
210
|
+
["rounded-lg", { borderRadius: 8 }],
|
|
211
|
+
["rounded-xl", { borderRadius: 12 }],
|
|
212
|
+
["rounded-2xl", { borderRadius: 16 }],
|
|
213
|
+
["rounded-3xl", { borderRadius: 24 }],
|
|
214
|
+
["rounded-full", { borderRadius: 9999 }],
|
|
215
|
+
// BORDER WIDTH
|
|
216
|
+
["border", { borderWidth: 1, borderStyle: "solid" }],
|
|
217
|
+
["border-0", { borderWidth: 0 }],
|
|
218
|
+
["border-2", { borderWidth: 2, borderStyle: "solid" }],
|
|
219
|
+
["border-4", { borderWidth: 4, borderStyle: "solid" }],
|
|
220
|
+
["border-8", { borderWidth: 8, borderStyle: "solid" }],
|
|
221
|
+
["border-t", { borderTopWidth: 1, borderStyle: "solid" }],
|
|
222
|
+
["border-r", { borderRightWidth: 1, borderStyle: "solid" }],
|
|
223
|
+
["border-b", { borderBottomWidth: 1, borderStyle: "solid" }],
|
|
224
|
+
["border-l", { borderLeftWidth: 1, borderStyle: "solid" }],
|
|
225
|
+
["border-t-0", { borderTopWidth: 0 }],
|
|
226
|
+
["border-r-0", { borderRightWidth: 0 }],
|
|
227
|
+
["border-b-0", { borderBottomWidth: 0 }],
|
|
228
|
+
["border-l-0", { borderLeftWidth: 0 }],
|
|
229
|
+
["border-t-2", { borderTopWidth: 2, borderStyle: "solid" }],
|
|
230
|
+
["border-r-2", { borderRightWidth: 2, borderStyle: "solid" }],
|
|
231
|
+
["border-b-2", { borderBottomWidth: 2, borderStyle: "solid" }],
|
|
232
|
+
["border-l-2", { borderLeftWidth: 2, borderStyle: "solid" }],
|
|
233
|
+
// BORDER STYLE
|
|
234
|
+
["border-solid", { borderStyle: "solid" }],
|
|
235
|
+
["border-dashed", { borderStyle: "dashed" }],
|
|
236
|
+
["border-dotted", { borderStyle: "dotted" }],
|
|
237
|
+
["border-double", { borderStyle: "double" }],
|
|
238
|
+
["border-none", { borderStyle: "none" }],
|
|
239
|
+
// SHADOWS
|
|
240
|
+
["shadow-none", { boxShadow: "none" }],
|
|
241
|
+
["shadow-sm", { boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)" }],
|
|
242
|
+
[
|
|
243
|
+
"shadow",
|
|
244
|
+
{
|
|
245
|
+
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
[
|
|
249
|
+
"shadow-md",
|
|
250
|
+
{
|
|
251
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
[
|
|
255
|
+
"shadow-lg",
|
|
256
|
+
{
|
|
257
|
+
boxShadow: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
[
|
|
261
|
+
"shadow-xl",
|
|
262
|
+
{
|
|
263
|
+
boxShadow: "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
["shadow-2xl", { boxShadow: "0 25px 50px -12px rgb(0 0 0 / 0.25)" }],
|
|
267
|
+
["shadow-inner", { boxShadow: "inset 0 2px 4px 0 rgb(0 0 0 / 0.05)" }],
|
|
268
|
+
[
|
|
269
|
+
"shadow-premium",
|
|
270
|
+
{
|
|
271
|
+
boxShadow: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 40px 60px -15px rgba(0, 0, 0, 0.25)",
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
// OPACITY
|
|
275
|
+
["opacity-0", { opacity: 0 }],
|
|
276
|
+
["opacity-5", { opacity: 0.05 }],
|
|
277
|
+
["opacity-10", { opacity: 0.1 }],
|
|
278
|
+
["opacity-20", { opacity: 0.2 }],
|
|
279
|
+
["opacity-25", { opacity: 0.25 }],
|
|
280
|
+
["opacity-30", { opacity: 0.3 }],
|
|
281
|
+
["opacity-40", { opacity: 0.4 }],
|
|
282
|
+
["opacity-50", { opacity: 0.5 }],
|
|
283
|
+
["opacity-60", { opacity: 0.6 }],
|
|
284
|
+
["opacity-70", { opacity: 0.7 }],
|
|
285
|
+
["opacity-75", { opacity: 0.75 }],
|
|
286
|
+
["opacity-80", { opacity: 0.8 }],
|
|
287
|
+
["opacity-90", { opacity: 0.9 }],
|
|
288
|
+
["opacity-95", { opacity: 0.95 }],
|
|
289
|
+
["opacity-100", { opacity: 1 }],
|
|
290
|
+
// OVERFLOW
|
|
291
|
+
["overflow-auto", { overflow: "auto" }],
|
|
292
|
+
["overflow-hidden", { overflow: "hidden" }],
|
|
293
|
+
["overflow-visible", { overflow: "visible" }],
|
|
294
|
+
["overflow-scroll", { overflow: "scroll" }],
|
|
295
|
+
["overflow-x-auto", { overflowX: "auto" }],
|
|
296
|
+
["overflow-x-hidden", { overflowX: "hidden" }],
|
|
297
|
+
["overflow-x-visible", { overflowX: "visible" }],
|
|
298
|
+
["overflow-x-scroll", { overflowX: "scroll" }],
|
|
299
|
+
["overflow-y-auto", { overflowY: "auto" }],
|
|
300
|
+
["overflow-y-hidden", { overflowY: "hidden" }],
|
|
301
|
+
["overflow-y-visible", { overflowY: "visible" }],
|
|
302
|
+
["overflow-y-scroll", { overflowY: "scroll" }],
|
|
303
|
+
// TEXT ALIGN
|
|
304
|
+
["text-left", { textAlign: "left" }],
|
|
305
|
+
["text-center", { textAlign: "center" }],
|
|
306
|
+
["text-right", { textAlign: "right" }],
|
|
307
|
+
["text-justify", { textAlign: "justify" }],
|
|
308
|
+
// TEXT DECORATION
|
|
309
|
+
["underline", { textDecoration: "underline" }],
|
|
310
|
+
["line-through", { textDecoration: "line-through" }],
|
|
311
|
+
["no-underline", { textDecoration: "none" }],
|
|
312
|
+
["overline", { textDecoration: "overline" }],
|
|
313
|
+
// TEXT TRANSFORM
|
|
314
|
+
["uppercase", { textTransform: "uppercase" }],
|
|
315
|
+
["lowercase", { textTransform: "lowercase" }],
|
|
316
|
+
["capitalize", { textTransform: "capitalize" }],
|
|
317
|
+
["normal-case", { textTransform: "none" }],
|
|
318
|
+
// TEXT OVERFLOW
|
|
319
|
+
[
|
|
320
|
+
"truncate",
|
|
321
|
+
{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
322
|
+
],
|
|
323
|
+
["text-ellipsis", { textOverflow: "ellipsis" }],
|
|
324
|
+
["text-clip", { textOverflow: "clip" }],
|
|
325
|
+
// WHITESPACE
|
|
326
|
+
["whitespace-normal", { whiteSpace: "normal" }],
|
|
327
|
+
["whitespace-nowrap", { whiteSpace: "nowrap" }],
|
|
328
|
+
["whitespace-pre", { whiteSpace: "pre" }],
|
|
329
|
+
["whitespace-pre-line", { whiteSpace: "pre-line" }],
|
|
330
|
+
["whitespace-pre-wrap", { whiteSpace: "pre-wrap" }],
|
|
331
|
+
// WORD BREAK
|
|
332
|
+
["break-normal", { wordBreak: "normal", overflowWrap: "normal" }],
|
|
333
|
+
["break-words", { overflowWrap: "break-word" }],
|
|
334
|
+
["break-all", { wordBreak: "break-all" }],
|
|
335
|
+
// FONT WEIGHT
|
|
336
|
+
["font-thin", { fontWeight: 100 }],
|
|
337
|
+
["font-extralight", { fontWeight: 200 }],
|
|
338
|
+
["font-light", { fontWeight: 300 }],
|
|
339
|
+
["font-normal", { fontWeight: 400 }],
|
|
340
|
+
["font-medium", { fontWeight: 500 }],
|
|
341
|
+
["font-semibold", { fontWeight: 600 }],
|
|
342
|
+
["font-bold", { fontWeight: 700 }],
|
|
343
|
+
["font-extrabold", { fontWeight: 800 }],
|
|
344
|
+
["font-black", { fontWeight: 900 }],
|
|
345
|
+
// FONT STYLE
|
|
346
|
+
["italic", { fontStyle: "italic" }],
|
|
347
|
+
["not-italic", { fontStyle: "normal" }],
|
|
348
|
+
// FONT SIZE (with line-height)
|
|
349
|
+
["text-xs", { fontSize: "12px", lineHeight: "16px" }],
|
|
350
|
+
["text-sm", { fontSize: "14px", lineHeight: "20px" }],
|
|
351
|
+
["text-base", { fontSize: "16px", lineHeight: "24px" }],
|
|
352
|
+
["text-lg", { fontSize: "18px", lineHeight: "28px" }],
|
|
353
|
+
["text-xl", { fontSize: "20px", lineHeight: "28px" }],
|
|
354
|
+
["text-2xl", { fontSize: "24px", lineHeight: "32px" }],
|
|
355
|
+
["text-3xl", { fontSize: "30px", lineHeight: "36px" }],
|
|
356
|
+
["text-4xl", { fontSize: "36px", lineHeight: "40px" }],
|
|
357
|
+
["text-5xl", { fontSize: "48px", lineHeight: "48px" }],
|
|
358
|
+
["text-6xl", { fontSize: "60px", lineHeight: "60px" }],
|
|
359
|
+
["text-7xl", { fontSize: "72px", lineHeight: "72px" }],
|
|
360
|
+
["text-8xl", { fontSize: "96px", lineHeight: "96px" }],
|
|
361
|
+
["text-9xl", { fontSize: "128px", lineHeight: "128px" }],
|
|
362
|
+
// LINE HEIGHT
|
|
363
|
+
["leading-none", { lineHeight: 1 }],
|
|
364
|
+
["leading-tight", { lineHeight: 1.25 }],
|
|
365
|
+
["leading-snug", { lineHeight: 1.375 }],
|
|
366
|
+
["leading-normal", { lineHeight: 1.5 }],
|
|
367
|
+
["leading-relaxed", { lineHeight: 1.625 }],
|
|
368
|
+
["leading-loose", { lineHeight: 2 }],
|
|
369
|
+
// LETTER SPACING
|
|
370
|
+
["tracking-tighter", { letterSpacing: "-0.05em" }],
|
|
371
|
+
["tracking-tight", { letterSpacing: "-0.025em" }],
|
|
372
|
+
["tracking-normal", { letterSpacing: "0" }],
|
|
373
|
+
["tracking-wide", { letterSpacing: "0.025em" }],
|
|
374
|
+
["tracking-wider", { letterSpacing: "0.05em" }],
|
|
375
|
+
["tracking-widest", { letterSpacing: "0.1em" }],
|
|
376
|
+
// Custom OGX tracking
|
|
377
|
+
["tracking-tightest", { letterSpacing: "-0.075em" }],
|
|
378
|
+
// OBJECT FIT
|
|
379
|
+
["object-contain", { objectFit: "contain" }],
|
|
380
|
+
["object-cover", { objectFit: "cover" }],
|
|
381
|
+
["object-fill", { objectFit: "fill" }],
|
|
382
|
+
["object-none", { objectFit: "none" }],
|
|
383
|
+
["object-scale-down", { objectFit: "scale-down" }],
|
|
384
|
+
// OBJECT POSITION
|
|
385
|
+
["object-bottom", { objectPosition: "bottom" }],
|
|
386
|
+
["object-center", { objectPosition: "center" }],
|
|
387
|
+
["object-left", { objectPosition: "left" }],
|
|
388
|
+
["object-left-bottom", { objectPosition: "left bottom" }],
|
|
389
|
+
["object-left-top", { objectPosition: "left top" }],
|
|
390
|
+
["object-right", { objectPosition: "right" }],
|
|
391
|
+
["object-right-bottom", { objectPosition: "right bottom" }],
|
|
392
|
+
["object-right-top", { objectPosition: "right top" }],
|
|
393
|
+
["object-top", { objectPosition: "top" }],
|
|
394
|
+
// Z-INDEX
|
|
395
|
+
["z-0", { zIndex: 0 }],
|
|
396
|
+
["z-10", { zIndex: 10 }],
|
|
397
|
+
["z-20", { zIndex: 20 }],
|
|
398
|
+
["z-30", { zIndex: 30 }],
|
|
399
|
+
["z-40", { zIndex: 40 }],
|
|
400
|
+
["z-50", { zIndex: 50 }],
|
|
401
|
+
["z-auto", { zIndex: "auto" }],
|
|
402
|
+
// POINTER EVENTS (útil para overlays)
|
|
403
|
+
["pointer-events-none", { pointerEvents: "none" }],
|
|
404
|
+
["pointer-events-auto", { pointerEvents: "auto" }],
|
|
405
|
+
// USER SELECT
|
|
406
|
+
["select-none", { userSelect: "none" }],
|
|
407
|
+
["select-text", { userSelect: "text" }],
|
|
408
|
+
["select-all", { userSelect: "all" }],
|
|
409
|
+
["select-auto", { userSelect: "auto" }],
|
|
410
|
+
// ASPECT RATIO (Satori support)
|
|
411
|
+
["aspect-auto", { aspectRatio: "auto" }],
|
|
412
|
+
["aspect-square", { aspectRatio: "1 / 1" }],
|
|
413
|
+
["aspect-video", { aspectRatio: "16 / 9" }],
|
|
414
|
+
]);
|
|
415
|
+
/**
|
|
416
|
+
* Check if a class is static (can be looked up directly)
|
|
417
|
+
*/
|
|
418
|
+
export function isStaticClass(cls) {
|
|
419
|
+
return STATIC_CLASSES.has(cls);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Get CSS properties for a static class
|
|
423
|
+
* Returns undefined if not a static class
|
|
424
|
+
*/
|
|
425
|
+
export function getStaticClass(cls) {
|
|
426
|
+
return STATIC_CLASSES.get(cls);
|
|
427
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ogxjs/core - Tailwind Parser v2 "Turbo"
|
|
3
|
+
* High-performance Tailwind CSS parser with O(1) lookups
|
|
4
|
+
*
|
|
5
|
+
* @description
|
|
6
|
+
* Complete rewrite of the parser for maximum performance:
|
|
7
|
+
* - O(1) static class lookup via Map
|
|
8
|
+
* - Efficient prefix matching via ordered prefix list
|
|
9
|
+
* - Multi-level caching (class + string level)
|
|
10
|
+
* - Minimal allocations
|
|
11
|
+
*
|
|
12
|
+
* @performance
|
|
13
|
+
* v0.1.x: ~5ms for 100 classes (O(n) if/else chain)
|
|
14
|
+
* v0.2.0: ~0.5ms for 100 classes (O(1) lookups + cache)
|
|
15
|
+
*
|
|
16
|
+
* @version 0.2.0 "Turbo"
|
|
17
|
+
*/
|
|
18
|
+
import type { CSSProperties } from "../css";
|
|
19
|
+
import type { ThemeConfig } from "../types";
|
|
20
|
+
/**
|
|
21
|
+
* Parse Tailwind classes to CSS properties
|
|
22
|
+
*
|
|
23
|
+
* @param tw - Tailwind class string or array
|
|
24
|
+
* @param theme - Optional theme config for custom colors
|
|
25
|
+
* @param colorScheme - Optional color scheme for dark: variants
|
|
26
|
+
* @returns CSS properties object
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* parseTailwind("flex bg-blue-500 p-4")
|
|
31
|
+
* // → { display: "flex", backgroundColor: "#3b82f6", padding: 16 }
|
|
32
|
+
*
|
|
33
|
+
* parseTailwind(["flex", "items-center", "gap-4"])
|
|
34
|
+
* // → { display: "flex", alignItems: "center", gap: 16 }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseTailwind(tw: string | string[], theme?: ThemeConfig, colorScheme?: "light" | "dark"): CSSProperties;
|
|
38
|
+
/**
|
|
39
|
+
* Parse multiple class strings in batch
|
|
40
|
+
* More efficient than calling parseTailwind multiple times
|
|
41
|
+
*
|
|
42
|
+
* @param items - Array of class strings
|
|
43
|
+
* @param theme - Optional theme config
|
|
44
|
+
* @param colorScheme - Optional color scheme
|
|
45
|
+
* @returns Array of CSS properties in same order
|
|
46
|
+
*/
|
|
47
|
+
export declare function parseTailwindBatch(items: (string | string[])[], theme?: ThemeConfig, colorScheme?: "light" | "dark"): CSSProperties[];
|
|
48
|
+
export { clearAllCaches, getCacheStats } from "./class-cache";
|
|
49
|
+
export { colors } from "./colors";
|
|
50
|
+
export { getStaticClass, isStaticClass, STATIC_CLASSES } from "./lookup-tables";
|
|
51
|
+
export type { GradientState, ParseContext } from "./prefix-handlers";
|
|
52
|
+
export { ORDERED_PREFIXES, PREFIX_HANDLERS, parseSpacingValue, resolveColorValue, } from "./prefix-handlers";
|
|
53
|
+
export { borderRadius, fontSize, fontWeight, opacity, spacing } from "./scales";
|
|
54
|
+
//# sourceMappingURL=parser-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-v2.d.ts","sourceRoot":"","sources":["../../src/tailwind/parser-v2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAY5C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,EACrB,KAAK,CAAC,EAAE,WAAW,EACnB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAC5B,aAAa,CAyDf;AAqKD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,EAC5B,KAAK,CAAC,EAAE,WAAW,EACnB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAC5B,aAAa,EAAE,CAEjB;AAID,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|