@niibase/uniwind 1.1.8 → 1.1.10
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/common/core/config/config.common.js +9 -0
- package/dist/metro/metro-transformer.cjs +4 -0
- package/dist/metro/metro-transformer.mjs +4 -0
- package/dist/module/core/config/config.common.d.ts +5 -0
- package/dist/module/core/config/config.common.js +6 -0
- package/package.json +2 -2
- package/src/core/config/config.common.ts +10 -0
- package/src/metro/processor/rn.ts +8 -0
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UniwindConfigBuilder = exports.Uniwind = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _withUniwind = require("../../hoc/withUniwind");
|
|
8
10
|
var _types = require("../../types");
|
|
9
11
|
var _listener = require("../listener");
|
|
10
12
|
const SYSTEM_THEME = "system";
|
|
@@ -38,6 +40,13 @@ class UniwindConfigBuilder {
|
|
|
38
40
|
}
|
|
39
41
|
return colorScheme ?? _types.ColorScheme.Light;
|
|
40
42
|
}
|
|
43
|
+
Wrapper({
|
|
44
|
+
as,
|
|
45
|
+
...props
|
|
46
|
+
}) {
|
|
47
|
+
const StyledComponent = (0, _react.useMemo)(() => (0, _withUniwind.withUniwind)(as), [as]);
|
|
48
|
+
return (0, _react.createElement)(StyledComponent, props);
|
|
49
|
+
}
|
|
41
50
|
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
42
51
|
setTheme(theme) {
|
|
43
52
|
const prevTheme = this.#currentTheme;
|
|
@@ -1492,6 +1492,10 @@ class RN {
|
|
|
1492
1492
|
};
|
|
1493
1493
|
}
|
|
1494
1494
|
if (properties.every((property2) => ["top", "right", "bottom", "left"].includes(property2))) {
|
|
1495
|
+
if (transformedProperty === "inset") {
|
|
1496
|
+
const isEverySideSame = properties.every((property2) => value[property2] === value.top);
|
|
1497
|
+
return isEverySideSame ? { inset: value.top } : value;
|
|
1498
|
+
}
|
|
1495
1499
|
return {
|
|
1496
1500
|
[wrapProperty("Top")]: value.top,
|
|
1497
1501
|
[wrapProperty("Right")]: value.right,
|
|
@@ -1485,6 +1485,10 @@ class RN {
|
|
|
1485
1485
|
};
|
|
1486
1486
|
}
|
|
1487
1487
|
if (properties.every((property2) => ["top", "right", "bottom", "left"].includes(property2))) {
|
|
1488
|
+
if (transformedProperty === "inset") {
|
|
1489
|
+
const isEverySideSame = properties.every((property2) => value[property2] === value.top);
|
|
1490
|
+
return isEverySideSame ? { inset: value.top } : value;
|
|
1491
|
+
}
|
|
1488
1492
|
return {
|
|
1489
1493
|
[wrapProperty("Top")]: value.top,
|
|
1490
1494
|
[wrapProperty("Right")]: value.right,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ElementType } from 'react';
|
|
1
2
|
import { Insets } from 'react-native';
|
|
3
|
+
import { ApplyUniwind } from '../../hoc/types';
|
|
2
4
|
import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types';
|
|
3
5
|
declare const SYSTEM_THEME: "system";
|
|
4
6
|
export declare class UniwindConfigBuilder {
|
|
@@ -8,6 +10,9 @@ export declare class UniwindConfigBuilder {
|
|
|
8
10
|
get hasAdaptiveThemes(): boolean;
|
|
9
11
|
get currentTheme(): ThemeName;
|
|
10
12
|
private get colorScheme();
|
|
13
|
+
Wrapper<T extends ElementType>({ as, ...props }: {
|
|
14
|
+
as: T;
|
|
15
|
+
} & ApplyUniwind<Omit<ComponentPropsWithRef<T>, 'as'>>): import("react").FunctionComponentElement<any>;
|
|
11
16
|
setTheme(theme: ThemeName | typeof SYSTEM_THEME): void;
|
|
12
17
|
updateCSSVariables(theme: ThemeName, variables: CSSVariables): void;
|
|
13
18
|
updateInsets(insets: Insets): void;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { createElement, useMemo } from "react";
|
|
1
2
|
import { Appearance, Platform } from "react-native";
|
|
3
|
+
import { withUniwind } from "../../hoc/withUniwind.js";
|
|
2
4
|
import { ColorScheme, StyleDependency } from "../../types.js";
|
|
3
5
|
import { UniwindListener } from "../listener.js";
|
|
4
6
|
const SYSTEM_THEME = "system";
|
|
@@ -32,6 +34,10 @@ export class UniwindConfigBuilder {
|
|
|
32
34
|
}
|
|
33
35
|
return colorScheme ?? ColorScheme.Light;
|
|
34
36
|
}
|
|
37
|
+
Wrapper({ as, ...props }) {
|
|
38
|
+
const StyledComponent = useMemo(() => withUniwind(as), [as]);
|
|
39
|
+
return createElement(StyledComponent, props);
|
|
40
|
+
}
|
|
35
41
|
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
36
42
|
setTheme(theme) {
|
|
37
43
|
const prevTheme = this.#currentTheme;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@niibase/uniwind",
|
|
4
|
-
"version": "1.1.
|
|
5
|
-
"description": "The fastest Tailwind bindings for React Native",
|
|
4
|
+
"version": "1.1.10",
|
|
5
|
+
"description": "The fastest Tailwind bindings for React Native with Reanimated 4 support",
|
|
6
6
|
"homepage": "https://uniwind.dev",
|
|
7
7
|
"author": "Unistack",
|
|
8
8
|
"type": "module",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, createElement, ElementType, useMemo } from 'react'
|
|
1
2
|
import { Appearance, Insets, Platform } from 'react-native'
|
|
3
|
+
import { ApplyUniwind } from '../../hoc/types'
|
|
4
|
+
import { withUniwind } from '../../hoc/withUniwind'
|
|
2
5
|
import { ColorScheme, StyleDependency } from '../../types'
|
|
3
6
|
import { UniwindListener } from '../listener'
|
|
4
7
|
import { CSSVariables, GenerateStyleSheetsCallback, ThemeName } from '../types'
|
|
@@ -49,6 +52,13 @@ export class UniwindConfigBuilder {
|
|
|
49
52
|
return colorScheme ?? ColorScheme.Light
|
|
50
53
|
}
|
|
51
54
|
|
|
55
|
+
Wrapper<T extends ElementType>({ as, ...props }: {
|
|
56
|
+
as: T
|
|
57
|
+
} & ApplyUniwind<Omit<ComponentPropsWithRef<T>, 'as'>>) {
|
|
58
|
+
const StyledComponent = useMemo(() => withUniwind(as as any), [as])
|
|
59
|
+
return createElement(StyledComponent, props)
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
53
63
|
setTheme(theme: ThemeName | typeof SYSTEM_THEME) {
|
|
54
64
|
const prevTheme = this.#currentTheme
|
|
@@ -306,6 +306,14 @@ export class RN {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
if (properties.every(property => ['top', 'right', 'bottom', 'left'].includes(property))) {
|
|
309
|
+
if (transformedProperty === 'inset') {
|
|
310
|
+
const isEverySideSame = properties.every(property => value[property] === value.top)
|
|
311
|
+
|
|
312
|
+
return isEverySideSame
|
|
313
|
+
? { inset: value.top }
|
|
314
|
+
: value
|
|
315
|
+
}
|
|
316
|
+
|
|
309
317
|
return {
|
|
310
318
|
[wrapProperty('Top')]: value.top,
|
|
311
319
|
[wrapProperty('Right')]: value.right,
|