@colimuca123/nativewind 4.2.2-rc.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.
Files changed (146) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/babel.js +1 -0
  4. package/dist/doctor.d.ts +1 -0
  5. package/dist/doctor.js +21 -0
  6. package/dist/doctor.js.map +1 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.js +20 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/metro/common.d.ts +4 -0
  11. package/dist/metro/common.js +8 -0
  12. package/dist/metro/common.js.map +1 -0
  13. package/dist/metro/index.d.ts +15 -0
  14. package/dist/metro/index.js +47 -0
  15. package/dist/metro/index.js.map +1 -0
  16. package/dist/metro/picocolors.d.ts +26 -0
  17. package/dist/metro/picocolors.js +53 -0
  18. package/dist/metro/picocolors.js.map +1 -0
  19. package/dist/metro/tailwind/index.d.ts +5 -0
  20. package/dist/metro/tailwind/index.js +25 -0
  21. package/dist/metro/tailwind/index.js.map +1 -0
  22. package/dist/metro/tailwind/types.d.ts +8 -0
  23. package/dist/metro/tailwind/types.js +3 -0
  24. package/dist/metro/tailwind/types.js.map +1 -0
  25. package/dist/metro/tailwind/v3/child.d.ts +0 -0
  26. package/dist/metro/tailwind/v3/child.js +45 -0
  27. package/dist/metro/tailwind/v3/child.js.map +1 -0
  28. package/dist/metro/tailwind/v3/index.d.ts +6 -0
  29. package/dist/metro/tailwind/v3/index.js +81 -0
  30. package/dist/metro/tailwind/v3/index.js.map +1 -0
  31. package/dist/metro/typescript.d.ts +1 -0
  32. package/dist/metro/typescript.js +46 -0
  33. package/dist/metro/typescript.js.map +1 -0
  34. package/dist/stylesheet.d.ts +5 -0
  35. package/dist/stylesheet.js +25 -0
  36. package/dist/stylesheet.js.map +1 -0
  37. package/dist/tailwind/color.d.ts +4 -0
  38. package/dist/tailwind/color.js +25 -0
  39. package/dist/tailwind/color.js.map +1 -0
  40. package/dist/tailwind/common.d.ts +2 -0
  41. package/dist/tailwind/common.js +24 -0
  42. package/dist/tailwind/common.js.map +1 -0
  43. package/dist/tailwind/dark-mode.d.ts +4 -0
  44. package/dist/tailwind/dark-mode.js +48 -0
  45. package/dist/tailwind/dark-mode.js.map +1 -0
  46. package/dist/tailwind/index.d.ts +0 -0
  47. package/dist/tailwind/index.js +13 -0
  48. package/dist/tailwind/index.js.map +1 -0
  49. package/dist/tailwind/native.d.ts +3 -0
  50. package/dist/tailwind/native.js +265 -0
  51. package/dist/tailwind/native.js.map +1 -0
  52. package/dist/tailwind/prop-modifier.d.ts +4 -0
  53. package/dist/tailwind/prop-modifier.js +13 -0
  54. package/dist/tailwind/prop-modifier.js.map +1 -0
  55. package/dist/tailwind/safe-area.d.ts +4 -0
  56. package/dist/tailwind/safe-area.js +216 -0
  57. package/dist/tailwind/safe-area.js.map +1 -0
  58. package/dist/tailwind/shadows.d.ts +4 -0
  59. package/dist/tailwind/shadows.js +79 -0
  60. package/dist/tailwind/shadows.js.map +1 -0
  61. package/dist/tailwind/switch.d.ts +8 -0
  62. package/dist/tailwind/switch.js +51 -0
  63. package/dist/tailwind/switch.js.map +1 -0
  64. package/dist/tailwind/translate.d.ts +2 -0
  65. package/dist/tailwind/translate.js +40 -0
  66. package/dist/tailwind/translate.js.map +1 -0
  67. package/dist/tailwind/verify.d.ts +4 -0
  68. package/dist/tailwind/verify.js +22 -0
  69. package/dist/tailwind/verify.js.map +1 -0
  70. package/dist/tailwind/web.d.ts +3 -0
  71. package/dist/tailwind/web.js +40 -0
  72. package/dist/tailwind/web.js.map +1 -0
  73. package/dist/test.d.ts +373 -0
  74. package/dist/test.js +161 -0
  75. package/dist/test.js.map +1 -0
  76. package/dist/theme.d.ts +1 -0
  77. package/dist/theme.js +9 -0
  78. package/dist/theme.js.map +1 -0
  79. package/expo-snack.js +71 -0
  80. package/jsx-dev-runtime/index.d.ts +1 -0
  81. package/jsx-dev-runtime/index.js +1 -0
  82. package/jsx-runtime/index.d.ts +1 -0
  83. package/jsx-runtime/index.js +1 -0
  84. package/metro/package.json +1 -0
  85. package/package.json +75 -0
  86. package/preset/package.json +3 -0
  87. package/src/__tests__/README.md +3 -0
  88. package/src/__tests__/accessibility.tsx +41 -0
  89. package/src/__tests__/backgrounds.tsx +239 -0
  90. package/src/__tests__/borders.tsx +355 -0
  91. package/src/__tests__/container-queries.tsx +59 -0
  92. package/src/__tests__/custom-theme.tsx +45 -0
  93. package/src/__tests__/custom.tsx +17 -0
  94. package/src/__tests__/dark-mode.ios.tsx +251 -0
  95. package/src/__tests__/doctor.tsx +13 -0
  96. package/src/__tests__/effects.ios.tsx +230 -0
  97. package/src/__tests__/elevation.tsx +22 -0
  98. package/src/__tests__/filters.tsx +201 -0
  99. package/src/__tests__/flexbox-grid.tsx +670 -0
  100. package/src/__tests__/groups.tsx +134 -0
  101. package/src/__tests__/interactivity.tsx +547 -0
  102. package/src/__tests__/layout.tsx +854 -0
  103. package/src/__tests__/modifier-{}.tsx +71 -0
  104. package/src/__tests__/platform-modifiers-test.ios.tsx +34 -0
  105. package/src/__tests__/preset.tsx +9 -0
  106. package/src/__tests__/reusing-styles.tsx +44 -0
  107. package/src/__tests__/safe-area.test.ios.tsx +427 -0
  108. package/src/__tests__/sizing.tsx +241 -0
  109. package/src/__tests__/spacing.tsx +106 -0
  110. package/src/__tests__/states.tsx +145 -0
  111. package/src/__tests__/svg.tsx +25 -0
  112. package/src/__tests__/tables.tsx +103 -0
  113. package/src/__tests__/theme.tsx +245 -0
  114. package/src/__tests__/transforms.tsx +509 -0
  115. package/src/__tests__/transition-animations.tsx +254 -0
  116. package/src/__tests__/typography.tsx +657 -0
  117. package/src/__tests__/unofficial-plugins.test.ios.tsx +171 -0
  118. package/src/doctor.ts +28 -0
  119. package/src/index.tsx +16 -0
  120. package/src/metro/common.ts +11 -0
  121. package/src/metro/index.ts +77 -0
  122. package/src/metro/picocolors.ts +76 -0
  123. package/src/metro/tailwind/index.ts +22 -0
  124. package/src/metro/tailwind/types.ts +9 -0
  125. package/src/metro/tailwind/v3/child.ts +61 -0
  126. package/src/metro/tailwind/v3/index.ts +103 -0
  127. package/src/metro/typescript.ts +69 -0
  128. package/src/stylesheet.ts +31 -0
  129. package/src/tailwind/color.ts +23 -0
  130. package/src/tailwind/common.ts +26 -0
  131. package/src/tailwind/dark-mode.ts +46 -0
  132. package/src/tailwind/index.ts +15 -0
  133. package/src/tailwind/native.ts +374 -0
  134. package/src/tailwind/prop-modifier.ts +7 -0
  135. package/src/tailwind/safe-area.ts +262 -0
  136. package/src/tailwind/shadows.ts +100 -0
  137. package/src/tailwind/switch.ts +59 -0
  138. package/src/tailwind/translate.ts +51 -0
  139. package/src/tailwind/verify.ts +16 -0
  140. package/src/tailwind/web.ts +38 -0
  141. package/src/tailwindcss-internals.d.ts +7 -0
  142. package/src/test.tsx +224 -0
  143. package/src/theme.ts +15 -0
  144. package/test/package.json +4 -0
  145. package/theme/package.json +3 -0
  146. package/types.d.ts +1 -0
@@ -0,0 +1,262 @@
1
+ /*
2
+ Modified from: https://github.com/mvllow/tailwindcss-safe-area
3
+ Original License:
4
+ ===============================================================================
5
+ MIT License
6
+
7
+ Copyright (c) 2021 mvllow
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ ===============================================================================
27
+ */
28
+
29
+ import plugin from "tailwindcss/plugin";
30
+
31
+ function generateVariantUtilities(
32
+ utilities: typeof baseUtilities,
33
+ variant: string,
34
+ generateValue: (v: string, x: string) => string,
35
+ ) {
36
+ return Object.entries(utilities).reduce(
37
+ (acc, [selector, propertyValue]) => {
38
+ const className = selector.slice(1);
39
+ acc[`${className}-${variant}`] = (x: string) =>
40
+ Object.entries(propertyValue).reduce(
41
+ (result, [property, value]) => {
42
+ if (Array.isArray(value)) {
43
+ result[property] = value.map((v) =>
44
+ v === "-webkit-fill-available" ? v : generateValue(v, x),
45
+ );
46
+ } else {
47
+ result[property] = generateValue(value, x);
48
+ }
49
+ return result;
50
+ },
51
+ {} as Record<string, string | string[]>,
52
+ );
53
+ return acc;
54
+ },
55
+ {} as Record<string, (x: string) => Record<string, string | string[]>>,
56
+ );
57
+ }
58
+
59
+ const baseUtilities = {
60
+ ".m-safe": {
61
+ marginTop: "env(safe-area-inset-top)",
62
+ marginRight: "env(safe-area-inset-right)",
63
+ marginBottom: "env(safe-area-inset-bottom)",
64
+ marginLeft: "env(safe-area-inset-left)",
65
+ },
66
+ ".mx-safe": {
67
+ marginRight: "env(safe-area-inset-right)",
68
+ marginLeft: "env(safe-area-inset-left)",
69
+ },
70
+ ".my-safe": {
71
+ marginTop: "env(safe-area-inset-top)",
72
+ marginBottom: "env(safe-area-inset-bottom)",
73
+ },
74
+ ".ms-safe": {
75
+ marginInlineStart: "env(safe-area-inset-left)",
76
+ },
77
+ ".me-safe": {
78
+ marginInlineEnd: "env(safe-area-inset-left)",
79
+ },
80
+ ".mt-safe": {
81
+ marginTop: "env(safe-area-inset-top)",
82
+ },
83
+ ".mr-safe": {
84
+ marginRight: "env(safe-area-inset-right)",
85
+ },
86
+ ".mb-safe": {
87
+ marginBottom: "env(safe-area-inset-bottom)",
88
+ },
89
+ ".ml-safe": {
90
+ marginLeft: "env(safe-area-inset-left)",
91
+ },
92
+ ".p-safe": {
93
+ paddingTop: "env(safe-area-inset-top)",
94
+ paddingRight: "env(safe-area-inset-right)",
95
+ paddingBottom: "env(safe-area-inset-bottom)",
96
+ paddingLeft: "env(safe-area-inset-left)",
97
+ },
98
+ ".px-safe": {
99
+ paddingRight: "env(safe-area-inset-right)",
100
+ paddingLeft: "env(safe-area-inset-left)",
101
+ },
102
+ ".py-safe": {
103
+ paddingTop: "env(safe-area-inset-top)",
104
+ paddingBottom: "env(safe-area-inset-bottom)",
105
+ },
106
+ ".ps-safe": {
107
+ paddingInlineStart: "env(safe-area-inset-left)",
108
+ },
109
+ ".pe-safe": {
110
+ paddingInlineEnd: "env(safe-area-inset-left)",
111
+ },
112
+ ".pt-safe": {
113
+ paddingTop: "env(safe-area-inset-top)",
114
+ },
115
+ ".pr-safe": {
116
+ paddingRight: "env(safe-area-inset-right)",
117
+ },
118
+ ".pb-safe": {
119
+ paddingBottom: "env(safe-area-inset-bottom)",
120
+ },
121
+ ".pl-safe": {
122
+ paddingLeft: "env(safe-area-inset-left)",
123
+ },
124
+ ".scroll-m-safe": {
125
+ scrollMarginTop: "env(safe-area-inset-top)",
126
+ scrollMarginRight: "env(safe-area-inset-right)",
127
+ scrollMarginBottom: "env(safe-area-inset-bottom)",
128
+ scrollMarginLeft: "env(safe-area-inset-left)",
129
+ },
130
+ ".scroll-mx-safe": {
131
+ scrollMarginRight: "env(safe-area-inset-right)",
132
+ scrollMarginLeft: "env(safe-area-inset-left)",
133
+ },
134
+ ".scroll-my-safe": {
135
+ scrollMarginTop: "env(safe-area-inset-top)",
136
+ scrollMarginBottom: "env(safe-area-inset-bottom)",
137
+ },
138
+ ".scroll-ms-safe": {
139
+ scrollMarginInlineStart: "env(safe-area-inset-left)",
140
+ },
141
+ ".scroll-me-safe": {
142
+ scrollMarginInlineEnd: "env(safe-area-inset-left)",
143
+ },
144
+ ".scroll-mt-safe": {
145
+ scrollMarginTop: "env(safe-area-inset-top)",
146
+ },
147
+ ".scroll-mr-safe": {
148
+ scrollMarginRight: "env(safe-area-inset-right)",
149
+ },
150
+ ".scroll-mb-safe": {
151
+ scrollMarginBottom: "env(safe-area-inset-bottom)",
152
+ },
153
+ ".scroll-ml-safe": {
154
+ scrollMarginLeft: "env(safe-area-inset-left)",
155
+ },
156
+ ".scroll-p-safe": {
157
+ scrollPaddingTop: "env(safe-area-inset-top)",
158
+ scrollPaddingRight: "env(safe-area-inset-right)",
159
+ scrollPaddingBottom: "env(safe-area-inset-bottom)",
160
+ scrollPaddingLeft: "env(safe-area-inset-left)",
161
+ },
162
+ ".scroll-px-safe": {
163
+ scrollPaddingRight: "env(safe-area-inset-right)",
164
+ scrollPaddingLeft: "env(safe-area-inset-left)",
165
+ },
166
+ ".scroll-py-safe": {
167
+ scrollPaddingTop: "env(safe-area-inset-top)",
168
+ scrollPaddingBottom: "env(safe-area-inset-bottom)",
169
+ },
170
+ ".scroll-ps-safe": {
171
+ scrollPaddingInlineStart: "env(safe-area-inset-left)",
172
+ },
173
+ ".scroll-pe-safe": {
174
+ scrollPaddingInlineEnd: "env(safe-area-inset-left)",
175
+ },
176
+ ".scroll-pt-safe": {
177
+ scrollPaddingTop: "env(safe-area-inset-top)",
178
+ },
179
+ ".scroll-pr-safe": {
180
+ scrollPaddingRight: "env(safe-area-inset-right)",
181
+ },
182
+ ".scroll-pb-safe": {
183
+ scrollPaddingBottom: "env(safe-area-inset-bottom)",
184
+ },
185
+ ".scroll-pl-safe": {
186
+ scrollPaddingLeft: "env(safe-area-inset-left)",
187
+ },
188
+ ".inset-safe": {
189
+ top: "env(safe-area-inset-top)",
190
+ right: "env(safe-area-inset-right)",
191
+ bottom: "env(safe-area-inset-bottom)",
192
+ left: "env(safe-area-inset-left)",
193
+ },
194
+ ".inset-x-safe": {
195
+ right: "env(safe-area-inset-right)",
196
+ left: "env(safe-area-inset-left)",
197
+ },
198
+ ".inset-y-safe": {
199
+ top: "env(safe-area-inset-top)",
200
+ bottom: "env(safe-area-inset-bottom)",
201
+ },
202
+ ".start-safe": {
203
+ insetInlineStart: "env(safe-area-inset-left)",
204
+ },
205
+ ".end-safe": {
206
+ insetInlineEnd: "env(safe-area-inset-left)",
207
+ },
208
+ ".top-safe": {
209
+ top: "env(safe-area-inset-top)",
210
+ },
211
+ ".right-safe": {
212
+ right: "env(safe-area-inset-right)",
213
+ },
214
+ ".bottom-safe": {
215
+ bottom: "env(safe-area-inset-bottom)",
216
+ },
217
+ ".left-safe": {
218
+ left: "env(safe-area-inset-left)",
219
+ },
220
+ ".min-h-screen-safe": {
221
+ minHeight: [
222
+ "calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)))",
223
+ "-webkit-fill-available",
224
+ ],
225
+ },
226
+ ".max-h-screen-safe": {
227
+ maxHeight: [
228
+ "calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)))",
229
+ "-webkit-fill-available",
230
+ ],
231
+ },
232
+ ".h-screen-safe": {
233
+ height: [
234
+ "calc(100vh - (env(safe-area-inset-top) + env(safe-area-inset-bottom)))",
235
+ "-webkit-fill-available",
236
+ ],
237
+ },
238
+ };
239
+
240
+ export const safeArea = plugin(({ addUtilities, matchUtilities, theme }) => {
241
+ addUtilities(baseUtilities);
242
+
243
+ const offsetUtilities = generateVariantUtilities(
244
+ baseUtilities,
245
+ "offset",
246
+ (v, x) => `calc(${v} + ${x})`,
247
+ );
248
+ matchUtilities(offsetUtilities, {
249
+ values: theme("spacing"),
250
+ supportsNegativeValues: true,
251
+ });
252
+
253
+ const orUtilities = generateVariantUtilities(
254
+ baseUtilities,
255
+ "or",
256
+ (v, x) => `max(${v}, ${x})`,
257
+ );
258
+ matchUtilities(orUtilities, {
259
+ values: theme("spacing"),
260
+ supportsNegativeValues: true,
261
+ });
262
+ });
@@ -0,0 +1,100 @@
1
+ import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette";
2
+ import { parseBoxShadowValue } from "tailwindcss/lib/util/parseBoxShadowValue";
3
+ import toColorValue from "tailwindcss/lib/util/toColorValue";
4
+ import transformThemeValue from "tailwindcss/lib/util/transformThemeValue";
5
+ import plugin from "tailwindcss/plugin";
6
+
7
+ export const shadows = plugin(({ matchUtilities, theme, ...rest }) => {
8
+ const { addDefaults } = rest as any;
9
+ const boxShadowEntries = Object.entries(theme("boxShadow") ?? {});
10
+
11
+ function getElevation(value: any) {
12
+ let elevationKey: any = boxShadowEntries.find(
13
+ (entry) => entry[1] === value,
14
+ )?.[0];
15
+
16
+ let elevation = theme("elevation")?.[elevationKey];
17
+
18
+ if (elevation === undefined) {
19
+ elevation = Number.parseFloat(value.split(" ")[2]);
20
+ }
21
+
22
+ if (elevation === undefined || Number.isNaN(elevation)) {
23
+ elevation = 0;
24
+ }
25
+
26
+ return elevation;
27
+ }
28
+
29
+ addDefaults("box-shadow", {
30
+ "--tw-ring-offset-shadow": "0 0 #0000",
31
+ "--tw-ring-shadow": "0 0 #0000",
32
+ "--tw-shadow": "0 0 #0000",
33
+ "--tw-shadow-colored": "0 0 #0000",
34
+ });
35
+
36
+ if (process.env.NATIVEWIND_OS === "android") {
37
+ matchUtilities(
38
+ {
39
+ elevation: (value) => {
40
+ return {
41
+ "-rn-elevation": value,
42
+ } as any;
43
+ },
44
+ },
45
+ { values: theme("elevation") },
46
+ );
47
+ }
48
+
49
+ matchUtilities(
50
+ {
51
+ shadow: (value) => {
52
+ const elevation = getElevation(value);
53
+
54
+ let transformValue = transformThemeValue("boxShadow");
55
+ value = transformValue(value);
56
+ let ast = parseBoxShadowValue(value);
57
+
58
+ const firstValid = ast.find((shadow: any) => shadow.valid);
59
+
60
+ if (!firstValid) {
61
+ return;
62
+ }
63
+
64
+ const { x, y, blur, color } = firstValid;
65
+
66
+ const shadow = {
67
+ "--tw-shadow-color": value === "none" ? "#0000" : color,
68
+ "-rn-shadow-color": "var(--tw-shadow-color)",
69
+ "@rn-move -rn-shadow-offset-width \\&shadow-offset\\.width": "true",
70
+ "-rn-shadow-offset-width": x,
71
+ "@rn-move -rn-shadow-offset-height \\&shadow-offset\\.height": "true",
72
+ "-rn-shadow-offset-height": y,
73
+ "-rn-shadow-radius": blur ?? 0,
74
+ "-rn-shadow-opacity": 1,
75
+ } as any;
76
+
77
+ if (process.env.NATIVEWIND_OS === "android") {
78
+ shadow["-rn-elevation"] = elevation;
79
+ }
80
+
81
+ return shadow;
82
+ },
83
+ },
84
+ { values: theme("boxShadow"), type: ["shadow"] },
85
+ );
86
+
87
+ matchUtilities(
88
+ {
89
+ shadow: (value) => {
90
+ return {
91
+ "--tw-shadow-color": toColorValue(value),
92
+ };
93
+ },
94
+ },
95
+ {
96
+ values: flattenColorPalette(theme("boxShadowColor")),
97
+ type: ["color", "any"],
98
+ },
99
+ );
100
+ });
@@ -0,0 +1,59 @@
1
+ import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette";
2
+ import toColorValue from "tailwindcss/lib/util/toColorValue";
3
+ import withAlphaVariable from "tailwindcss/lib/util/withAlphaVariable";
4
+ import plugin from "tailwindcss/plugin";
5
+
6
+ export const nativeSwitch = plugin(function ({ matchUtilities, theme }) {
7
+ matchUtilities(
8
+ {
9
+ thumb: (value) => {
10
+ return {
11
+ "&": {
12
+ "@rn-move caret-color thumbColor": "true",
13
+ "caret-color": toColorValue(value),
14
+ },
15
+ };
16
+ },
17
+ },
18
+ {
19
+ values: flattenColorPalette(theme("thumbColor")),
20
+ type: ["color", "any"],
21
+ },
22
+ );
23
+ });
24
+
25
+ export const webSwitch = plugin(function ({
26
+ matchUtilities,
27
+ theme,
28
+ corePlugins,
29
+ }) {
30
+ matchUtilities(
31
+ {
32
+ thumb: (value) => {
33
+ if (!corePlugins("backgroundOpacity")) {
34
+ return {
35
+ "& > div:nth-child(2)": {
36
+ backgroundColor: toColorValue(value) + " !important",
37
+ },
38
+ };
39
+ }
40
+
41
+ const output = withAlphaVariable({
42
+ color: value,
43
+ property: "background-color",
44
+ variable: "--tw-bg-opacity",
45
+ });
46
+
47
+ output["background-color"] += " !important";
48
+
49
+ return {
50
+ "& > div:nth-child(2)": output,
51
+ };
52
+ },
53
+ },
54
+ {
55
+ values: flattenColorPalette(theme("thumbColor")),
56
+ type: ["color", "any"],
57
+ },
58
+ );
59
+ });
@@ -0,0 +1,51 @@
1
+ import createUtilityPlugin from "tailwindcss/lib/util/createUtilityPlugin";
2
+
3
+ let cssTransformValue = [
4
+ "translate(var(--tw-translate-x), var(--tw-translate-y))",
5
+ "rotate(var(--tw-rotate))",
6
+ "skewX(var(--tw-skew-x))",
7
+ "skewY(var(--tw-skew-y))",
8
+ "scaleX(var(--tw-scale-x))",
9
+ "scaleY(var(--tw-scale-y))",
10
+ ].join(" ");
11
+
12
+ /**
13
+ * React Native doesn't support % values for translate styles.
14
+ * We need to change Tailwindcss to use the `react-native-css-interop` ch and cw units
15
+ */
16
+
17
+ // This is identical to the core plugin, except it uses the theme value `translateX` instead of `translate`
18
+ export const translateX = createUtilityPlugin(
19
+ "translateX",
20
+ [
21
+ [
22
+ [
23
+ "translate-x",
24
+ [
25
+ ["@defaults transform", {}],
26
+ "--tw-translate-x",
27
+ ["transform", cssTransformValue],
28
+ ],
29
+ ],
30
+ ],
31
+ ],
32
+ { supportsNegativeValues: true },
33
+ );
34
+
35
+ // This is identical to the core plugin, except it uses the theme value `translateY` instead of `translate`
36
+ export const translateY = createUtilityPlugin(
37
+ "translateY",
38
+ [
39
+ [
40
+ [
41
+ "translate-y",
42
+ [
43
+ ["@defaults transform", {}],
44
+ "--tw-translate-y",
45
+ ["transform", cssTransformValue],
46
+ ],
47
+ ],
48
+ ],
49
+ ],
50
+ { supportsNegativeValues: true },
51
+ );
@@ -0,0 +1,16 @@
1
+ import plugin from "tailwindcss/plugin";
2
+
3
+ import { isWeb } from "./common";
4
+
5
+ export const verify = plugin(function ({ addBase }) {
6
+ if (isWeb) {
7
+ addBase({
8
+ ":root": {
9
+ "--css-interop": "true",
10
+ "--css-interop-nativewind": "true",
11
+ },
12
+ });
13
+ } else {
14
+ addBase({ "@cssInterop set nativewind": "true" });
15
+ }
16
+ });
@@ -0,0 +1,38 @@
1
+ import { Config } from "tailwindcss";
2
+ import plugin from "tailwindcss/plugin";
3
+
4
+ import { color } from "./color";
5
+ import { allowedColors } from "./common";
6
+ import { darkModeAtRule } from "./dark-mode";
7
+ import { webPropModifierPlugin } from "./prop-modifier";
8
+ import { webSwitch } from "./switch";
9
+ import { verify } from "./verify";
10
+
11
+ const preset: Config = {
12
+ content: [],
13
+ theme: {
14
+ boxShadow: {
15
+ sm: " 0px 1px 1px rgba(0, 0, 0, 0.35)",
16
+ DEFAULT: "0px 1px 4px rgba(0, 0, 0, 0.35)",
17
+ md: "0px 3px 10px rgba(0, 0, 0, 0.35)",
18
+ lg: "0px 4px 10px rgba(0, 0, 0, 0.35)",
19
+ xl: "0px 6px 19px rgba(0, 0, 0, 0.35)",
20
+ "2xl": "0px 12px 38px rgba(0, 0, 0, 0.35) ",
21
+ none: "0 0 #0000",
22
+ },
23
+ extend: {
24
+ trackColor: allowedColors,
25
+ thumbColor: allowedColors,
26
+ },
27
+ },
28
+ plugins: [
29
+ plugin(({ addVariant }) => addVariant("web", "&")),
30
+ color,
31
+ darkModeAtRule,
32
+ verify,
33
+ webPropModifierPlugin,
34
+ webSwitch,
35
+ ],
36
+ };
37
+
38
+ export default preset;
@@ -0,0 +1,7 @@
1
+ declare module "tailwindcss/lib/cli/build";
2
+ declare module "tailwindcss/lib/util/createUtilityPlugin";
3
+ declare module "tailwindcss/lib/util/flattenColorPalette";
4
+ declare module "tailwindcss/lib/util/toColorValue";
5
+ declare module "tailwindcss/lib/util/withAlphaVariable";
6
+ declare module "tailwindcss/lib/util/transformThemeValue";
7
+ declare module "tailwindcss/lib/util/parseBoxShadowValue";