styledwind-native 0.0.2 → 0.0.4
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/index.d.ts.map +1 -1
- package/dist/index.js +1 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +0 -228
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,cAAc,CAAC;AAC9B,OAAc,EAAoB,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,OAAO,CAAC;AA4B7E,UAAU,UAAW,SAAQ,EAAE,CAAC,UAAU;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAQD,KAAK,kBAAkB,GAAG,UAAU,GAAG;IACrC,iBAAiB,EAAE,CAAC,CAAC,GAAG,EAAE,EACxB,MAAM,EAAE,oBAAoB,EAC5B,GAAG,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC,EAAE,KAC3D,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC;IAC7C,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,EACvB,MAAM,EAAE,oBAAoB,EAC5B,GAAG,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC,EAAE,KAC3D,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC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S,CAAC,EAAE,KAC3D,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,EACX,MAAM,EAAE,oBAAoB,EAC5B,GAAG,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC,EAAE,KAC3D,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;CACjC,CAAC;AA8EF,QAAA,MAAM,EAAE,oBAAqC,CAAC;AAE9C,cAAc,OAAO,CAAC;AACtB,eAAe,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import RN from 'react-native';
|
|
3
|
-
import { useDeviceContext
|
|
3
|
+
import twrnc, { useDeviceContext } from 'twrnc';
|
|
4
4
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
let tailwindConfig;
|
|
8
|
-
const configPaths = [
|
|
9
|
-
path.resolve(process.cwd(), 'tailwind.config.js'),
|
|
10
|
-
path.resolve(process.cwd(), 'tailwind.config.ts'),
|
|
11
|
-
path.resolve(process.cwd(), 'tailwind.config.mjs'),
|
|
12
|
-
];
|
|
13
|
-
const configPath = configPaths.find(fs.existsSync);
|
|
14
|
-
if (configPath) {
|
|
15
|
-
tailwindConfig = require(configPath);
|
|
16
|
-
}
|
|
17
|
-
const twrnc = create(tailwindConfig);
|
|
18
5
|
const allowedComponents = [
|
|
19
6
|
'ActivityIndicator',
|
|
20
7
|
'AnimatedFlatList',
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAA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,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACpC,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,SAAS,GAAG,qBAAqB;YACrC,CAAC,CAAE,EAAE,CAAC,QAAgB,CAAC,qBAAiD,CAAC;YACzE,CAAC,CAAC,EAAE,CAAC,aAAgC,CAAC,CAAC;QAExC,GAA2B,CAAC,aAAa,CAAC,GAAG,CAC5C,MAA4B,EAC5B,GAAG,cAA6D,EAChE,EAAE,CAAC,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC;QAEnE,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,KAA2B,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,EAAE,GAAG,gCAAgC,EAAE,CAAC;AAE9C,cAAc,OAAO,CAAC;AACtB,eAAe,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/index.tsx
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import RN from 'react-native';
|
|
3
|
-
import { useDeviceContext, create, type TailwindFn, type Style } from 'twrnc';
|
|
4
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
|
|
8
|
-
let tailwindConfig;
|
|
9
|
-
const configPaths = [
|
|
10
|
-
path.resolve(process.cwd(), 'tailwind.config.js'),
|
|
11
|
-
path.resolve(process.cwd(), 'tailwind.config.ts'),
|
|
12
|
-
path.resolve(process.cwd(), 'tailwind.config.mjs'),
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
const configPath = configPaths.find(fs.existsSync);
|
|
16
|
-
|
|
17
|
-
if (configPath) {
|
|
18
|
-
tailwindConfig = require(configPath);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const twrnc = create(tailwindConfig);
|
|
22
|
-
|
|
23
|
-
const allowedComponents = [
|
|
24
|
-
'ActivityIndicator',
|
|
25
|
-
'AnimatedFlatList',
|
|
26
|
-
'AnimatedImage',
|
|
27
|
-
'AnimatedScrollView',
|
|
28
|
-
'AnimatedSectionList',
|
|
29
|
-
'AnimatedText',
|
|
30
|
-
'AnimatedView',
|
|
31
|
-
'Button',
|
|
32
|
-
'FlatList',
|
|
33
|
-
'Image',
|
|
34
|
-
'Modal',
|
|
35
|
-
'SafeAreaView',
|
|
36
|
-
'ScrollView',
|
|
37
|
-
'SectionList',
|
|
38
|
-
'StatusBar',
|
|
39
|
-
'Switch',
|
|
40
|
-
'Text',
|
|
41
|
-
'TextInput',
|
|
42
|
-
'TouchableHighlight',
|
|
43
|
-
'TouchableNativeFeedback',
|
|
44
|
-
'TouchableOpacity',
|
|
45
|
-
'View',
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
interface ImageProps extends RN.ImageProps {
|
|
49
|
-
tintColor?: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface TailwindComponentProps {
|
|
53
|
-
children?: React.ReactNode;
|
|
54
|
-
component?: React.FC<any>;
|
|
55
|
-
[key: string]: any;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type TailwindComponents = TailwindFn & {
|
|
59
|
-
ActivityIndicator: <T = {}>(
|
|
60
|
-
styles: TemplateStringsArray,
|
|
61
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
62
|
-
) => React.FC<RN.ActivityIndicatorProps & T>;
|
|
63
|
-
AnimatedFlatList: <T = {}>(
|
|
64
|
-
styles: TemplateStringsArray,
|
|
65
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
66
|
-
) => React.FC<RN.Animated.AnimatedProps<RN.FlatListProps<any>> & T>;
|
|
67
|
-
AnimatedImage: <T = {}>(
|
|
68
|
-
styles: TemplateStringsArray,
|
|
69
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
70
|
-
) => React.FC<RN.Animated.AnimatedProps<ImageProps> & T>;
|
|
71
|
-
AnimatedScrollView: <T = {}>(
|
|
72
|
-
styles: TemplateStringsArray,
|
|
73
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
74
|
-
) => React.FC<RN.Animated.AnimatedProps<RN.ScrollViewProps> & T>;
|
|
75
|
-
AnimatedSectionList: <T = {}>(
|
|
76
|
-
styles: TemplateStringsArray,
|
|
77
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
78
|
-
) => React.FC<RN.Animated.AnimatedProps<RN.SectionListProps<any>> & T>;
|
|
79
|
-
AnimatedText: <T = {}>(
|
|
80
|
-
styles: TemplateStringsArray,
|
|
81
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
82
|
-
) => React.FC<RN.Animated.AnimatedProps<RN.TextProps> & T>;
|
|
83
|
-
AnimatedView: <T = {}>(
|
|
84
|
-
styles: TemplateStringsArray,
|
|
85
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
86
|
-
) => React.FC<RN.Animated.AnimatedProps<RN.ViewProps> & T>;
|
|
87
|
-
Button: <T = {}>(
|
|
88
|
-
styles: TemplateStringsArray,
|
|
89
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
90
|
-
) => React.FC<RN.ButtonProps & T>;
|
|
91
|
-
FlatList: <T = {}>(
|
|
92
|
-
styles: TemplateStringsArray,
|
|
93
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
94
|
-
) => React.FC<RN.FlatListProps<any> & T>;
|
|
95
|
-
Image: <T = {}>(
|
|
96
|
-
styles: TemplateStringsArray,
|
|
97
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
98
|
-
) => React.FC<ImageProps & T>;
|
|
99
|
-
Modal: <T = {}>(
|
|
100
|
-
styles: TemplateStringsArray,
|
|
101
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
102
|
-
) => React.FC<RN.ModalProps & T>;
|
|
103
|
-
SafeAreaView: <T = {}>(
|
|
104
|
-
styles: TemplateStringsArray,
|
|
105
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
106
|
-
) => React.FC<RN.ViewProps & T>;
|
|
107
|
-
ScrollView: <T = {}>(
|
|
108
|
-
styles: TemplateStringsArray,
|
|
109
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
110
|
-
) => React.FC<RN.ScrollViewProps & T>;
|
|
111
|
-
SectionList: <T = {}>(
|
|
112
|
-
styles: TemplateStringsArray,
|
|
113
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
114
|
-
) => React.FC<RN.SectionListProps<any> & T>;
|
|
115
|
-
StatusBar: <T = {}>(
|
|
116
|
-
styles: TemplateStringsArray,
|
|
117
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
118
|
-
) => React.FC<RN.StatusBarProps & T>;
|
|
119
|
-
Switch: <T = {}>(
|
|
120
|
-
styles: TemplateStringsArray,
|
|
121
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
122
|
-
) => React.FC<RN.SwitchProps & T>;
|
|
123
|
-
Text: <T = {}>(
|
|
124
|
-
styles: TemplateStringsArray,
|
|
125
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
126
|
-
) => React.FC<RN.TextProps & T>;
|
|
127
|
-
TextInput: <T = {}>(
|
|
128
|
-
styles: TemplateStringsArray,
|
|
129
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
130
|
-
) => React.FC<RN.TextInputProps & T>;
|
|
131
|
-
TouchableHighlight: <T = {}>(
|
|
132
|
-
styles: TemplateStringsArray,
|
|
133
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
134
|
-
) => React.FC<RN.TouchableHighlightProps & T>;
|
|
135
|
-
TouchableNativeFeedback: <T = {}>(
|
|
136
|
-
styles: TemplateStringsArray,
|
|
137
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
138
|
-
) => React.FC<RN.TouchableNativeFeedbackProps & T>;
|
|
139
|
-
TouchableOpacity: <T = {}>(
|
|
140
|
-
styles: TemplateStringsArray,
|
|
141
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
142
|
-
) => React.FC<RN.TouchableOpacityProps & T>;
|
|
143
|
-
View: <T = {}>(
|
|
144
|
-
styles: TemplateStringsArray,
|
|
145
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
146
|
-
) => React.FC<RN.ViewProps & T>;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
function createTailwindComponent<T = {}>(
|
|
150
|
-
Component: React.FC<any>,
|
|
151
|
-
styles: TemplateStringsArray,
|
|
152
|
-
...interpolations: ((props: T) => false | Style | undefined)[]
|
|
153
|
-
) {
|
|
154
|
-
const classNames = styles.filter(style => !['', ','].includes(style.trim())).join();
|
|
155
|
-
|
|
156
|
-
return function TailwindComponent({ children, component, ...props }: TailwindComponentProps) {
|
|
157
|
-
useDeviceContext(twrnc);
|
|
158
|
-
|
|
159
|
-
let BaseComponent = Component;
|
|
160
|
-
let baseStyle = null;
|
|
161
|
-
|
|
162
|
-
if (typeof component === 'function') {
|
|
163
|
-
const CustomComponent = component;
|
|
164
|
-
baseStyle = (CustomComponent.defaultProps as React.ComponentProps<typeof BaseComponent>)
|
|
165
|
-
?.style;
|
|
166
|
-
BaseComponent = CustomComponent;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const insets = useSafeAreaInsets();
|
|
170
|
-
let style = twrnc`${classNames}`;
|
|
171
|
-
|
|
172
|
-
interpolations.forEach(interpolation => {
|
|
173
|
-
const interpolatedStyle = interpolation(props as T);
|
|
174
|
-
if (interpolatedStyle) {
|
|
175
|
-
style = { ...style, ...interpolatedStyle };
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (classNames.includes('safe:pt')) style.paddingTop = insets.top;
|
|
180
|
-
if (classNames.includes('safe:pb')) style.paddingBottom = insets.bottom;
|
|
181
|
-
if (classNames.includes('safe:pl')) style.paddingLeft = insets.left;
|
|
182
|
-
if (classNames.includes('safe:pr')) style.paddingRight = insets.right;
|
|
183
|
-
|
|
184
|
-
if (classNames.includes('safe:mt')) style.marginTop = insets.top;
|
|
185
|
-
if (classNames.includes('safe:mb')) style.marginBottom = insets.bottom;
|
|
186
|
-
if (classNames.includes('safe:ml')) style.marginLeft = insets.left;
|
|
187
|
-
if (classNames.includes('safe:mr')) style.marginRight = insets.right;
|
|
188
|
-
|
|
189
|
-
if (classNames.includes('safe:top')) style.top = insets.top;
|
|
190
|
-
if (classNames.includes('safe:bottom')) style.bottom = insets.bottom;
|
|
191
|
-
if (classNames.includes('safe:left')) style.left = insets.left;
|
|
192
|
-
if (classNames.includes('safe:right')) style.right = insets.right;
|
|
193
|
-
|
|
194
|
-
if (classNames.includes('safe:h-top')) style.height = insets.top;
|
|
195
|
-
if (classNames.includes('safe:h-bottom')) style.height = insets.bottom;
|
|
196
|
-
if (classNames.includes('safe:w-left')) style.width = insets.left;
|
|
197
|
-
if (classNames.includes('safe:w-right')) style.width = insets.right;
|
|
198
|
-
|
|
199
|
-
return (
|
|
200
|
-
<BaseComponent {...props} style={[baseStyle, style, props.style]}>
|
|
201
|
-
{children}
|
|
202
|
-
</BaseComponent>
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function generateTailwindStyledComponents(): TailwindComponents {
|
|
208
|
-
return allowedComponents.reduce<TailwindComponents>((acc, componentName) => {
|
|
209
|
-
const animatedComponentName = componentName.startsWith('Animated')
|
|
210
|
-
? componentName.split('Animated')[1]
|
|
211
|
-
: null;
|
|
212
|
-
const Component = animatedComponentName
|
|
213
|
-
? (RN.Animated as any)[animatedComponentName as keyof typeof RN.Animated]
|
|
214
|
-
: RN[componentName as keyof typeof RN];
|
|
215
|
-
|
|
216
|
-
(acc as Record<string, any>)[componentName] = (
|
|
217
|
-
styles: TemplateStringsArray,
|
|
218
|
-
...interpolations: ((props: any) => false | Style | undefined)[]
|
|
219
|
-
) => createTailwindComponent(Component, styles, ...interpolations);
|
|
220
|
-
|
|
221
|
-
return acc;
|
|
222
|
-
}, twrnc as TailwindComponents);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const tw = generateTailwindStyledComponents();
|
|
226
|
-
|
|
227
|
-
export * from 'twrnc';
|
|
228
|
-
export default tw;
|