@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.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/babel.js +1 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +21 -0
- package/dist/doctor.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/metro/common.d.ts +4 -0
- package/dist/metro/common.js +8 -0
- package/dist/metro/common.js.map +1 -0
- package/dist/metro/index.d.ts +15 -0
- package/dist/metro/index.js +47 -0
- package/dist/metro/index.js.map +1 -0
- package/dist/metro/picocolors.d.ts +26 -0
- package/dist/metro/picocolors.js +53 -0
- package/dist/metro/picocolors.js.map +1 -0
- package/dist/metro/tailwind/index.d.ts +5 -0
- package/dist/metro/tailwind/index.js +25 -0
- package/dist/metro/tailwind/index.js.map +1 -0
- package/dist/metro/tailwind/types.d.ts +8 -0
- package/dist/metro/tailwind/types.js +3 -0
- package/dist/metro/tailwind/types.js.map +1 -0
- package/dist/metro/tailwind/v3/child.d.ts +0 -0
- package/dist/metro/tailwind/v3/child.js +45 -0
- package/dist/metro/tailwind/v3/child.js.map +1 -0
- package/dist/metro/tailwind/v3/index.d.ts +6 -0
- package/dist/metro/tailwind/v3/index.js +81 -0
- package/dist/metro/tailwind/v3/index.js.map +1 -0
- package/dist/metro/typescript.d.ts +1 -0
- package/dist/metro/typescript.js +46 -0
- package/dist/metro/typescript.js.map +1 -0
- package/dist/stylesheet.d.ts +5 -0
- package/dist/stylesheet.js +25 -0
- package/dist/stylesheet.js.map +1 -0
- package/dist/tailwind/color.d.ts +4 -0
- package/dist/tailwind/color.js +25 -0
- package/dist/tailwind/color.js.map +1 -0
- package/dist/tailwind/common.d.ts +2 -0
- package/dist/tailwind/common.js +24 -0
- package/dist/tailwind/common.js.map +1 -0
- package/dist/tailwind/dark-mode.d.ts +4 -0
- package/dist/tailwind/dark-mode.js +48 -0
- package/dist/tailwind/dark-mode.js.map +1 -0
- package/dist/tailwind/index.d.ts +0 -0
- package/dist/tailwind/index.js +13 -0
- package/dist/tailwind/index.js.map +1 -0
- package/dist/tailwind/native.d.ts +3 -0
- package/dist/tailwind/native.js +265 -0
- package/dist/tailwind/native.js.map +1 -0
- package/dist/tailwind/prop-modifier.d.ts +4 -0
- package/dist/tailwind/prop-modifier.js +13 -0
- package/dist/tailwind/prop-modifier.js.map +1 -0
- package/dist/tailwind/safe-area.d.ts +4 -0
- package/dist/tailwind/safe-area.js +216 -0
- package/dist/tailwind/safe-area.js.map +1 -0
- package/dist/tailwind/shadows.d.ts +4 -0
- package/dist/tailwind/shadows.js +79 -0
- package/dist/tailwind/shadows.js.map +1 -0
- package/dist/tailwind/switch.d.ts +8 -0
- package/dist/tailwind/switch.js +51 -0
- package/dist/tailwind/switch.js.map +1 -0
- package/dist/tailwind/translate.d.ts +2 -0
- package/dist/tailwind/translate.js +40 -0
- package/dist/tailwind/translate.js.map +1 -0
- package/dist/tailwind/verify.d.ts +4 -0
- package/dist/tailwind/verify.js +22 -0
- package/dist/tailwind/verify.js.map +1 -0
- package/dist/tailwind/web.d.ts +3 -0
- package/dist/tailwind/web.js +40 -0
- package/dist/tailwind/web.js.map +1 -0
- package/dist/test.d.ts +373 -0
- package/dist/test.js +161 -0
- package/dist/test.js.map +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.js +9 -0
- package/dist/theme.js.map +1 -0
- package/expo-snack.js +71 -0
- package/jsx-dev-runtime/index.d.ts +1 -0
- package/jsx-dev-runtime/index.js +1 -0
- package/jsx-runtime/index.d.ts +1 -0
- package/jsx-runtime/index.js +1 -0
- package/metro/package.json +1 -0
- package/package.json +75 -0
- package/preset/package.json +3 -0
- package/src/__tests__/README.md +3 -0
- package/src/__tests__/accessibility.tsx +41 -0
- package/src/__tests__/backgrounds.tsx +239 -0
- package/src/__tests__/borders.tsx +355 -0
- package/src/__tests__/container-queries.tsx +59 -0
- package/src/__tests__/custom-theme.tsx +45 -0
- package/src/__tests__/custom.tsx +17 -0
- package/src/__tests__/dark-mode.ios.tsx +251 -0
- package/src/__tests__/doctor.tsx +13 -0
- package/src/__tests__/effects.ios.tsx +230 -0
- package/src/__tests__/elevation.tsx +22 -0
- package/src/__tests__/filters.tsx +201 -0
- package/src/__tests__/flexbox-grid.tsx +670 -0
- package/src/__tests__/groups.tsx +134 -0
- package/src/__tests__/interactivity.tsx +547 -0
- package/src/__tests__/layout.tsx +854 -0
- package/src/__tests__/modifier-{}.tsx +71 -0
- package/src/__tests__/platform-modifiers-test.ios.tsx +34 -0
- package/src/__tests__/preset.tsx +9 -0
- package/src/__tests__/reusing-styles.tsx +44 -0
- package/src/__tests__/safe-area.test.ios.tsx +427 -0
- package/src/__tests__/sizing.tsx +241 -0
- package/src/__tests__/spacing.tsx +106 -0
- package/src/__tests__/states.tsx +145 -0
- package/src/__tests__/svg.tsx +25 -0
- package/src/__tests__/tables.tsx +103 -0
- package/src/__tests__/theme.tsx +245 -0
- package/src/__tests__/transforms.tsx +509 -0
- package/src/__tests__/transition-animations.tsx +254 -0
- package/src/__tests__/typography.tsx +657 -0
- package/src/__tests__/unofficial-plugins.test.ios.tsx +171 -0
- package/src/doctor.ts +28 -0
- package/src/index.tsx +16 -0
- package/src/metro/common.ts +11 -0
- package/src/metro/index.ts +77 -0
- package/src/metro/picocolors.ts +76 -0
- package/src/metro/tailwind/index.ts +22 -0
- package/src/metro/tailwind/types.ts +9 -0
- package/src/metro/tailwind/v3/child.ts +61 -0
- package/src/metro/tailwind/v3/index.ts +103 -0
- package/src/metro/typescript.ts +69 -0
- package/src/stylesheet.ts +31 -0
- package/src/tailwind/color.ts +23 -0
- package/src/tailwind/common.ts +26 -0
- package/src/tailwind/dark-mode.ts +46 -0
- package/src/tailwind/index.ts +15 -0
- package/src/tailwind/native.ts +374 -0
- package/src/tailwind/prop-modifier.ts +7 -0
- package/src/tailwind/safe-area.ts +262 -0
- package/src/tailwind/shadows.ts +100 -0
- package/src/tailwind/switch.ts +59 -0
- package/src/tailwind/translate.ts +51 -0
- package/src/tailwind/verify.ts +16 -0
- package/src/tailwind/web.ts +38 -0
- package/src/tailwindcss-internals.d.ts +7 -0
- package/src/test.tsx +224 -0
- package/src/theme.ts +15 -0
- package/test/package.json +4 -0
- package/theme/package.json +3 -0
- package/types.d.ts +1 -0
|
@@ -0,0 +1,23 @@
|
|
|
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 color = plugin(function ({ matchUtilities, corePlugins, theme }) {
|
|
7
|
+
matchUtilities(
|
|
8
|
+
{
|
|
9
|
+
color: (value) => {
|
|
10
|
+
if (!corePlugins("textOpacity")) {
|
|
11
|
+
return { color: toColorValue(value) };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return withAlphaVariable({
|
|
15
|
+
color: value,
|
|
16
|
+
property: "color",
|
|
17
|
+
variable: "--tw-text-opacity",
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{ values: flattenColorPalette(theme("textColor")), type: ["color", "any"] },
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const denyColors = new Set([
|
|
2
|
+
"lightBlue",
|
|
3
|
+
"warmGray",
|
|
4
|
+
"trueGray",
|
|
5
|
+
"coolGray",
|
|
6
|
+
"blueGray",
|
|
7
|
+
]);
|
|
8
|
+
/**
|
|
9
|
+
* Tailwind shows a deprecated warning if you use colors directly.
|
|
10
|
+
* So we need to filter out the colors that are not allowed.
|
|
11
|
+
* The warning is shown on property access, so we need to filter using this method
|
|
12
|
+
*/
|
|
13
|
+
export const allowedColors = ({ colors }: any) => {
|
|
14
|
+
const _colors: Record<string, unknown> = {};
|
|
15
|
+
for (const color of Object.keys(colors)) {
|
|
16
|
+
if (denyColors.has(color)) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
_colors[color] = colors[color];
|
|
20
|
+
}
|
|
21
|
+
return _colors;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const isWeb =
|
|
25
|
+
process.env.NATIVEWIND_OS === undefined ||
|
|
26
|
+
process.env.NATIVEWIND_OS === "web";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Config } from "tailwindcss";
|
|
2
|
+
import plugin from "tailwindcss/plugin";
|
|
3
|
+
|
|
4
|
+
import { isWeb } from "./common";
|
|
5
|
+
|
|
6
|
+
export const darkModeAtRule = plugin(function ({ config, addBase }) {
|
|
7
|
+
const darkMode = config<Config["darkMode"]>("darkMode");
|
|
8
|
+
|
|
9
|
+
let type: string | undefined = "media";
|
|
10
|
+
let value: string | undefined;
|
|
11
|
+
|
|
12
|
+
if (darkMode === "media" || !darkMode) {
|
|
13
|
+
type = "media";
|
|
14
|
+
} else if (darkMode === "class") {
|
|
15
|
+
type = "class";
|
|
16
|
+
value = "dark";
|
|
17
|
+
} else if (darkMode[0] === "class") {
|
|
18
|
+
type = "class";
|
|
19
|
+
value = darkMode[1];
|
|
20
|
+
|
|
21
|
+
if (!value) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (value.startsWith("[") && value.endsWith("]")) {
|
|
26
|
+
type = "attribute";
|
|
27
|
+
value = value.slice(1, -1);
|
|
28
|
+
} else if (value.startsWith(".")) {
|
|
29
|
+
value = value.slice(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (isWeb) {
|
|
34
|
+
addBase({
|
|
35
|
+
":root": {
|
|
36
|
+
"--css-interop-darkMode": [type, value].filter(Boolean).join(" "),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
const atRule = ["@cssInterop set darkMode", type, value]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(" ");
|
|
43
|
+
|
|
44
|
+
addBase({ [atRule]: "" });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = Object.assign(
|
|
2
|
+
() => {
|
|
3
|
+
// Check if this file is being loaded by an editor with Tailwind CSS IntelliSense (e.g., VS Code).
|
|
4
|
+
// If so, load the `native` part so that features implemented in `native` (like `p-safe`) can be auto-completed in the editor.
|
|
5
|
+
const isTailwindCSSIntelliSenseMode = "TAILWIND_MODE" in process.env;
|
|
6
|
+
if (isTailwindCSSIntelliSenseMode) return require("./native").default;
|
|
7
|
+
return process.env.NATIVEWIND_OS === undefined ||
|
|
8
|
+
process.env.NATIVEWIND_OS === "web"
|
|
9
|
+
? require("./web").default
|
|
10
|
+
: require("./native").default;
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
nativewind: true,
|
|
14
|
+
},
|
|
15
|
+
);
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
// cSpell:ignore borderless
|
|
2
|
+
import { AtRule } from "postcss";
|
|
3
|
+
import { Config } from "tailwindcss";
|
|
4
|
+
import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette";
|
|
5
|
+
import toColorValue from "tailwindcss/lib/util/toColorValue";
|
|
6
|
+
import plugin from "tailwindcss/plugin";
|
|
7
|
+
import { PluginUtils } from "tailwindcss/types/config";
|
|
8
|
+
|
|
9
|
+
import { hairlineWidth, platformSelect } from "../theme";
|
|
10
|
+
import { color } from "./color";
|
|
11
|
+
import { allowedColors } from "./common";
|
|
12
|
+
import { darkModeAtRule } from "./dark-mode";
|
|
13
|
+
import { safeArea } from "./safe-area";
|
|
14
|
+
import { shadows } from "./shadows";
|
|
15
|
+
import { nativeSwitch } from "./switch";
|
|
16
|
+
import { translateX, translateY } from "./translate";
|
|
17
|
+
import { verify } from "./verify";
|
|
18
|
+
|
|
19
|
+
const kebabCase = (str: string) => {
|
|
20
|
+
return str.replace(
|
|
21
|
+
/[A-Z]+(?![a-z])|[A-Z]/g,
|
|
22
|
+
($, ofs) => (ofs ? "-" : "") + $.toLowerCase(),
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const nativePlugins = plugin(function ({
|
|
27
|
+
addBase,
|
|
28
|
+
addUtilities,
|
|
29
|
+
addVariant,
|
|
30
|
+
config,
|
|
31
|
+
matchUtilities,
|
|
32
|
+
matchVariant,
|
|
33
|
+
theme,
|
|
34
|
+
...other
|
|
35
|
+
}) {
|
|
36
|
+
const nativePlatforms = ["android", "ios", "windows", "macos", "harmony"];
|
|
37
|
+
|
|
38
|
+
// RN requires the unit, so reset the defaults
|
|
39
|
+
// This is an undocumented feature of Tailwind that allows you to modify the @default layer
|
|
40
|
+
(other as any).addDefaults("transform", {
|
|
41
|
+
"--tw-rotate": "0deg",
|
|
42
|
+
"--tw-skew-x": "0deg",
|
|
43
|
+
"--tw-skew-y": "0deg",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* `display-mode` is a valid media query, but the ${platform} values are not.
|
|
48
|
+
*
|
|
49
|
+
* We need to either add a new Media Condition or hijack an existing one,
|
|
50
|
+
* display-mode seems good enough?
|
|
51
|
+
*
|
|
52
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/@media/display-mode
|
|
53
|
+
*/
|
|
54
|
+
for (const platform of nativePlatforms) {
|
|
55
|
+
addVariant(platform, `@media (display-mode: ${platform})`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
addVariant(
|
|
59
|
+
"native",
|
|
60
|
+
nativePlatforms.map((platform) => `@media (display-mode: ${platform})`),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The native module requires the `.dark` selector to pickup darkMode variables
|
|
65
|
+
* when using darkMode: 'class'
|
|
66
|
+
*
|
|
67
|
+
* If the user never uses the word 'dark' the selector will never be processed
|
|
68
|
+
* This is an edge case, but one we often encounter in testing (where .dark)
|
|
69
|
+
* will only contain CSS variables and never referenced directly
|
|
70
|
+
*/
|
|
71
|
+
config("safelist").push("dark");
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Change the visible/invisible classes
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
addUtilities({
|
|
78
|
+
".visible": { opacity: 1 },
|
|
79
|
+
".invisible": { opacity: 0 },
|
|
80
|
+
} as any);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* move-[]:
|
|
84
|
+
*/
|
|
85
|
+
matchVariant(
|
|
86
|
+
"{}",
|
|
87
|
+
(value = "", { modifier, container }: any) => {
|
|
88
|
+
value = kebabCase(value.replace(/&/, "\\&").replaceAll(".", "\\."));
|
|
89
|
+
|
|
90
|
+
if (modifier) {
|
|
91
|
+
modifier = modifier.replace(/&/, "\\&").replaceAll(".", "\\.");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (modifier && !value) {
|
|
95
|
+
value = modifier;
|
|
96
|
+
modifier = undefined;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
container.walkRules((rule: any) => {
|
|
100
|
+
rule.append(
|
|
101
|
+
new AtRule({
|
|
102
|
+
name: "rn-move",
|
|
103
|
+
params: `${modifier ?? "\\*"} ${value}`,
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
return `&`;
|
|
108
|
+
},
|
|
109
|
+
{ values: { DEFAULT: undefined } },
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Native Prop remapping
|
|
114
|
+
*/
|
|
115
|
+
addVariant("selection", (({ container }: any) => {
|
|
116
|
+
container.walkRules((rule: any) => {
|
|
117
|
+
rule.append(
|
|
118
|
+
new AtRule({ name: "rn-move", params: "color selectionColor" }),
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
return "&";
|
|
122
|
+
}) as any);
|
|
123
|
+
|
|
124
|
+
addVariant("placeholder", (({ container }: any) => {
|
|
125
|
+
container.walkRules((rule: any) => {
|
|
126
|
+
rule.append(
|
|
127
|
+
new AtRule({ name: "rn-move", params: "color placeholderTextColor" }),
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
return "&";
|
|
131
|
+
}) as any);
|
|
132
|
+
|
|
133
|
+
// https://github.com/tailwindlabs/tailwindcss/blob/eb2fe9494b638c3b67194f3ddf3c040f064e060d/src/corePlugins.js#L624-L629
|
|
134
|
+
addUtilities({
|
|
135
|
+
".pointer-events-none": { "pointer-events": "none" },
|
|
136
|
+
".pointer-events-auto": { "pointer-events": "auto" },
|
|
137
|
+
".pointer-events-box-none": { "pointer-events": "box-none" },
|
|
138
|
+
".pointer-events-box-only": { "pointer-events": "box-only" },
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// https://github.com/tailwindlabs/tailwindcss/blob/eb2fe9494b638c3b67194f3ddf3c040f064e060d/src/corePlugins.js#L729C3-L750C5
|
|
142
|
+
matchUtilities(
|
|
143
|
+
{
|
|
144
|
+
"line-clamp": (value) => ({
|
|
145
|
+
"&": {
|
|
146
|
+
"@rn-move -rn-number-of-lines number-of-lines": "true",
|
|
147
|
+
overflow: "hidden",
|
|
148
|
+
"-rn-number-of-lines": value,
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
{ values: theme("lineClamp") },
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
matchUtilities(
|
|
156
|
+
{
|
|
157
|
+
elevation: (value) => ({
|
|
158
|
+
"-rn-elevation": value,
|
|
159
|
+
}),
|
|
160
|
+
},
|
|
161
|
+
{ values: theme("elevation") },
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
addUtilities({
|
|
165
|
+
".line-clamp-none": {
|
|
166
|
+
"&": {
|
|
167
|
+
"@rn-move -rn-number-of-lines number-of-lines": "true",
|
|
168
|
+
overflow: "visible",
|
|
169
|
+
"-rn-number-of-lines": "0",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* https://reactnative.dev/docs/pressable#rippleconfig
|
|
176
|
+
*/
|
|
177
|
+
matchUtilities(
|
|
178
|
+
{
|
|
179
|
+
ripple: (value) => {
|
|
180
|
+
return {
|
|
181
|
+
"&": {
|
|
182
|
+
"@rn-move color android_ripple\\.color": "true",
|
|
183
|
+
color: toColorValue(value),
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
values: flattenColorPalette(theme("rippleColor")),
|
|
190
|
+
type: ["color", "any"],
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
matchUtilities(
|
|
194
|
+
{
|
|
195
|
+
ripple: (value) => {
|
|
196
|
+
return {
|
|
197
|
+
"&": {
|
|
198
|
+
"@rn-move -rn-borderless android_ripple\\.borderless": "true",
|
|
199
|
+
"-rn-borderless": value,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
values: {
|
|
206
|
+
borderless: "true",
|
|
207
|
+
bordered: "false",
|
|
208
|
+
},
|
|
209
|
+
type: "any",
|
|
210
|
+
},
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
matchUtilities(
|
|
214
|
+
{
|
|
215
|
+
caret: (value) => {
|
|
216
|
+
return {
|
|
217
|
+
"&": {
|
|
218
|
+
"@rn-move caret-color cursor-color": "true",
|
|
219
|
+
"caret-color": toColorValue(value),
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
values: flattenColorPalette(theme("caretColor")),
|
|
226
|
+
type: ["color", "any"],
|
|
227
|
+
},
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* SVG Prop remapping
|
|
232
|
+
*/
|
|
233
|
+
matchUtilities(
|
|
234
|
+
{
|
|
235
|
+
fill: (value) => {
|
|
236
|
+
return {
|
|
237
|
+
"&": {
|
|
238
|
+
"@rn-move fill": "true",
|
|
239
|
+
fill: `${toColorValue(value)}`,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{ values: flattenColorPalette(theme("fill")), type: ["color", "any"] },
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
matchUtilities(
|
|
248
|
+
{
|
|
249
|
+
stroke: (value) => ({
|
|
250
|
+
"&": {
|
|
251
|
+
"@rn-move stroke": "true",
|
|
252
|
+
stroke: toColorValue(value),
|
|
253
|
+
},
|
|
254
|
+
}),
|
|
255
|
+
},
|
|
256
|
+
{ values: flattenColorPalette(theme("stroke")), type: ["color", "any"] },
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
matchUtilities(
|
|
260
|
+
{
|
|
261
|
+
stroke: (value) => ({
|
|
262
|
+
"&": {
|
|
263
|
+
"@rn-move stroke-width": "true",
|
|
264
|
+
strokeWidth: toColorValue(value),
|
|
265
|
+
},
|
|
266
|
+
}),
|
|
267
|
+
},
|
|
268
|
+
{ values: theme("strokeWidth"), type: ["length", "number", "percentage"] },
|
|
269
|
+
);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const preset: Config = {
|
|
273
|
+
content: [],
|
|
274
|
+
theme: {
|
|
275
|
+
extend: {
|
|
276
|
+
fontFamily: {
|
|
277
|
+
sans: platformSelect({ android: "san-serif", ios: "'system font'", harmony: "san-serif" }),
|
|
278
|
+
serif: platformSelect({ android: "serif", ios: "Georgia", harmony: "serif" }),
|
|
279
|
+
mono: platformSelect({ android: "mono", ios: "'Courier New'", harmony: "mono" }),
|
|
280
|
+
},
|
|
281
|
+
elevation: {
|
|
282
|
+
sm: "1",
|
|
283
|
+
DEFAULT: "3",
|
|
284
|
+
md: "6",
|
|
285
|
+
lg: "8",
|
|
286
|
+
xl: "13",
|
|
287
|
+
"2xl": "24",
|
|
288
|
+
none: "0",
|
|
289
|
+
},
|
|
290
|
+
boxShadow: {
|
|
291
|
+
sm: " 0px 1px 1px rgba(0, 0, 0, 0.35)",
|
|
292
|
+
DEFAULT: "0px 1px 4px rgba(0, 0, 0, 0.35)",
|
|
293
|
+
md: "0px 3px 10px rgba(0, 0, 0, 0.35)",
|
|
294
|
+
lg: "0px 4px 10px rgba(0, 0, 0, 0.35)",
|
|
295
|
+
xl: "0px 6px 19px rgba(0, 0, 0, 0.35)",
|
|
296
|
+
"2xl": "0px 12px 38px rgba(0, 0, 0, 0.35) ",
|
|
297
|
+
none: "0 0 #0000",
|
|
298
|
+
},
|
|
299
|
+
translateX: ({ theme }: PluginUtils) => ({
|
|
300
|
+
...theme("spacing"),
|
|
301
|
+
"1/2": "50rnw",
|
|
302
|
+
"1/3": "33.333333rnw",
|
|
303
|
+
"2/3": "66.666667rnw",
|
|
304
|
+
"1/4": "25rnw",
|
|
305
|
+
"2/4": "50rnw",
|
|
306
|
+
"3/4": "75rnw",
|
|
307
|
+
full: "100rnw",
|
|
308
|
+
}),
|
|
309
|
+
translateY: ({ theme }: PluginUtils) => ({
|
|
310
|
+
...theme("spacing"),
|
|
311
|
+
"1/2": "50rnh",
|
|
312
|
+
"1/3": "33.333333rnh",
|
|
313
|
+
"2/3": "66.666667rnh",
|
|
314
|
+
"1/4": "25rnh",
|
|
315
|
+
"2/4": "50rnh",
|
|
316
|
+
"3/4": "75rnh",
|
|
317
|
+
full: "100rnh",
|
|
318
|
+
}),
|
|
319
|
+
borderWidth: {
|
|
320
|
+
hairline: hairlineWidth(),
|
|
321
|
+
},
|
|
322
|
+
letterSpacing: {
|
|
323
|
+
tighter: "-0.5px",
|
|
324
|
+
tight: "-0.25px",
|
|
325
|
+
normal: "0px",
|
|
326
|
+
wide: "0.25px",
|
|
327
|
+
wider: "0.5px",
|
|
328
|
+
widest: "1px",
|
|
329
|
+
},
|
|
330
|
+
transitionProperty: {
|
|
331
|
+
DEFAULT:
|
|
332
|
+
"color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, perspective, rotate, rotateX, rotateY, rotateZ, scale, scaleX, scaleY, translateX, translateY, skewX, skewY, filter, backdrop-filter",
|
|
333
|
+
all: "background-color, border-bottom-color, border-bottom-left-radius, border-bottom-right-radius, border-bottom-width, border-color, border-left-color, border-left-width, border-radius, border-right-color, border-right-width, border-top-color, border-top-width, border-width, color, fill, font-size, font-weight, gap, letter-spacing, line-height, margin, margin-bottom, margin-left, margin-right, margin-top, object-position, opacity, order, padding, padding-bottom, padding-left, padding-right, padding-top, rotate, scale, stroke, text-decoration, text-decoration-color, perspective, rotate, rotateX, rotateY, rotateZ, scale, scaleX, scaleY, translateX, translateY, skewX, skewY, transform-origin, translate, vertical-align, visibility, word-spacing, z-index",
|
|
334
|
+
transform:
|
|
335
|
+
"perspective, rotate, rotateX, rotateY, rotateZ, scale, scaleX, scaleY, translateX, translateY, skewX, skewY",
|
|
336
|
+
},
|
|
337
|
+
trackColor: allowedColors,
|
|
338
|
+
thumbColor: allowedColors,
|
|
339
|
+
rippleColor: allowedColors,
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
plugins: [
|
|
343
|
+
safeArea,
|
|
344
|
+
color,
|
|
345
|
+
darkModeAtRule,
|
|
346
|
+
shadows,
|
|
347
|
+
translateX,
|
|
348
|
+
translateY,
|
|
349
|
+
verify,
|
|
350
|
+
nativePlugins,
|
|
351
|
+
nativeSwitch,
|
|
352
|
+
],
|
|
353
|
+
corePlugins: {
|
|
354
|
+
preflight: false,
|
|
355
|
+
backgroundOpacity: false,
|
|
356
|
+
borderOpacity: false,
|
|
357
|
+
boxShadow: false,
|
|
358
|
+
caretColor: false,
|
|
359
|
+
divideOpacity: false,
|
|
360
|
+
fill: false,
|
|
361
|
+
placeholderColor: false,
|
|
362
|
+
placeholderOpacity: false,
|
|
363
|
+
lineClamp: false,
|
|
364
|
+
ringOpacity: false,
|
|
365
|
+
stroke: false,
|
|
366
|
+
strokeWidth: false,
|
|
367
|
+
textOpacity: false,
|
|
368
|
+
translate: false,
|
|
369
|
+
pointerEvents: false,
|
|
370
|
+
visibility: false,
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
export default preset;
|