@niibase/uniwind 1.6.0 → 1.6.2
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/CHANGELOG.md +45 -0
- package/dist/common/common/utils.js +8 -0
- package/dist/common/components/native/ActivityIndicator.js +2 -1
- package/dist/common/components/native/Button.js +2 -2
- package/dist/common/components/native/FlatList.js +2 -1
- package/dist/common/components/native/Image.js +2 -1
- package/dist/common/components/native/ImageBackground.js +2 -1
- package/dist/common/components/native/InputAccessoryView.js +2 -1
- package/dist/common/components/native/Modal.js +2 -1
- package/dist/common/components/native/RefreshControl.js +5 -4
- package/dist/common/components/native/ScrollView.js +2 -1
- package/dist/common/components/native/SectionList.js +2 -1
- package/dist/common/components/native/Switch.js +5 -4
- package/dist/common/components/native/Text.js +2 -1
- package/dist/common/components/native/TextInput.js +6 -5
- package/dist/common/components/native/TouchableHighlight.js +2 -1
- package/dist/common/components/native/VirtualizedList.js +2 -1
- package/dist/common/components/native/useAccentColor.js +19 -0
- package/dist/common/components/react-native-gesture-handler/native/FlatList.js +2 -1
- package/dist/common/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
- package/dist/common/components/react-native-gesture-handler/native/Text.js +2 -1
- package/dist/common/components/react-native-gesture-handler/native/TextInput.js +5 -4
- package/dist/common/components/web/ActivityIndicator.js +2 -2
- package/dist/common/components/web/Button.js +2 -2
- package/dist/common/components/web/Image.js +2 -1
- package/dist/common/components/web/ImageBackground.js +2 -2
- package/dist/common/components/web/Switch.js +4 -4
- package/dist/common/components/web/TextInput.js +2 -2
- package/dist/common/components/web/TouchableHighlight.js +2 -2
- package/dist/common/components/web/generateDataSet.js +2 -1
- package/dist/common/components/web/useUniwindAccent.js +20 -0
- package/dist/common/core/web/getWebStyles.js +12 -1
- package/dist/common/hoc/withUniwind.js +14 -4
- package/dist/common/hoc/withUniwind.native.js +11 -4
- package/dist/common/hooks/index.js +0 -11
- package/dist/common/hooks/useResolveClassNames.js +1 -1
- package/dist/metro/index.cjs +1 -1
- package/dist/metro/index.mjs +1 -1
- package/dist/metro/metro-transformer.cjs +14 -11
- package/dist/metro/metro-transformer.mjs +8 -5
- package/dist/module/common/utils.d.ts +1 -0
- package/dist/module/common/utils.js +1 -0
- package/dist/module/components/native/ActivityIndicator.js +2 -1
- package/dist/module/components/native/Button.js +2 -2
- package/dist/module/components/native/FlatList.js +2 -1
- package/dist/module/components/native/Image.js +2 -1
- package/dist/module/components/native/ImageBackground.js +2 -1
- package/dist/module/components/native/InputAccessoryView.js +2 -1
- package/dist/module/components/native/Modal.js +2 -1
- package/dist/module/components/native/RefreshControl.js +5 -4
- package/dist/module/components/native/ScrollView.js +2 -1
- package/dist/module/components/native/SectionList.js +2 -1
- package/dist/module/components/native/Switch.js +5 -4
- package/dist/module/components/native/Text.js +2 -1
- package/dist/module/components/native/TextInput.js +6 -5
- package/dist/module/components/native/TouchableHighlight.js +2 -1
- package/dist/module/components/native/VirtualizedList.js +2 -1
- package/dist/module/components/native/useAccentColor.d.ts +2 -0
- package/dist/module/components/native/useAccentColor.js +14 -0
- package/dist/module/components/react-native-gesture-handler/native/FlatList.js +2 -1
- package/dist/module/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
- package/dist/module/components/react-native-gesture-handler/native/Text.js +2 -1
- package/dist/module/components/react-native-gesture-handler/native/TextInput.js +5 -4
- package/dist/module/components/web/ActivityIndicator.js +1 -1
- package/dist/module/components/web/Button.js +1 -1
- package/dist/module/components/web/Image.js +2 -1
- package/dist/module/components/web/ImageBackground.js +1 -1
- package/dist/module/components/web/Switch.js +1 -1
- package/dist/module/components/web/TextInput.js +1 -1
- package/dist/module/components/web/TouchableHighlight.js +1 -1
- package/dist/module/components/web/generateDataSet.d.ts +1 -1
- package/dist/module/components/web/generateDataSet.js +2 -1
- package/dist/module/components/web/useUniwindAccent.js +15 -0
- package/dist/module/core/web/getWebStyles.d.ts +1 -1
- package/dist/module/core/web/getWebStyles.js +12 -1
- package/dist/module/hoc/withUniwind.js +16 -4
- package/dist/module/hoc/withUniwind.native.js +13 -4
- package/dist/module/hooks/index.d.ts +0 -1
- package/dist/module/hooks/index.js +0 -1
- package/dist/module/hooks/useResolveClassNames.js +2 -2
- package/dist/module/hooks/useUniwind.d.ts +2 -1
- package/dist/shared/{uniwind.C-rHhHOg.mjs → uniwind.BGiqYvxb.mjs} +1 -1
- package/dist/shared/{uniwind.nl8746mK.cjs → uniwind.Cv73KtI-.cjs} +0 -2
- package/dist/shared/{uniwind.F-0-Rr--.mjs → uniwind.PtWWxxnh.mjs} +1 -2
- package/dist/shared/{uniwind.BZyFsest.cjs → uniwind.r2i22V6d.cjs} +1 -1
- package/dist/vite/index.cjs +2 -2
- package/dist/vite/index.mjs +2 -2
- package/package.json +2 -1
- package/src/common/utils.ts +1 -0
- package/src/components/native/ActivityIndicator.tsx +2 -1
- package/src/components/native/Button.tsx +2 -2
- package/src/components/native/FlatList.tsx +2 -1
- package/src/components/native/Image.tsx +2 -1
- package/src/components/native/ImageBackground.tsx +2 -1
- package/src/components/native/InputAccessoryView.tsx +2 -1
- package/src/components/native/Modal.tsx +2 -1
- package/src/components/native/RefreshControl.tsx +5 -4
- package/src/components/native/ScrollView.tsx +2 -1
- package/src/components/native/SectionList.tsx +2 -1
- package/src/components/native/Switch.tsx +5 -4
- package/src/components/native/Text.tsx +2 -1
- package/src/components/native/TextInput.tsx +6 -5
- package/src/components/native/TouchableHighlight.tsx +2 -1
- package/src/components/native/VirtualizedList.tsx +2 -1
- package/src/components/native/useAccentColor.ts +19 -0
- package/src/components/react-native-gesture-handler/native/FlatList.tsx +2 -1
- package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +5 -4
- package/src/components/react-native-gesture-handler/native/Text.tsx +2 -1
- package/src/components/react-native-gesture-handler/native/TextInput.tsx +5 -4
- package/src/components/web/ActivityIndicator.tsx +1 -1
- package/src/components/web/Button.tsx +1 -1
- package/src/components/web/Image.tsx +2 -1
- package/src/components/web/ImageBackground.tsx +1 -1
- package/src/components/web/Switch.tsx +1 -1
- package/src/components/web/TextInput.tsx +1 -1
- package/src/components/web/TouchableHighlight.tsx +1 -1
- package/src/components/web/generateDataSet.ts +4 -2
- package/src/components/web/useUniwindAccent.ts +21 -0
- package/src/core/web/getWebStyles.ts +20 -1
- package/src/hoc/withUniwind.native.tsx +15 -4
- package/src/hoc/withUniwind.tsx +16 -2
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useResolveClassNames.ts +2 -2
- package/src/hooks/useUniwind.ts +2 -2
- package/src/metro/addMetaToStylesTemplate.ts +2 -1
- package/src/metro/metro-transformer.ts +2 -2
- package/src/metro/processor/color.ts +2 -1
- package/src/metro/processor/css.ts +3 -1
- package/src/metro/processor/rn.ts +2 -1
- package/src/metro/utils/common.ts +0 -2
- package/dist/common/components/native/TextInput.android.js +0 -52
- package/dist/common/hooks/useUniwindAccent.js +0 -13
- package/dist/module/components/native/TextInput.android.d.ts +0 -3
- package/dist/module/components/native/TextInput.android.js +0 -49
- package/dist/module/hooks/useUniwindAccent.js +0 -6
- package/src/components/native/TextInput.android.tsx +0 -51
- package/src/hooks/useUniwindAccent.ts +0 -10
- /package/dist/module/{hooks → components/web}/useUniwindAccent.d.ts +0 -0
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
module.exports = exports.TextInput = void 0;
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _utils = require("../utils");
|
|
11
|
-
var _useStyle = require("./useStyle");
|
|
12
|
-
const TextInput = exports.TextInput = (0, _utils.copyComponentProperties)(_reactNative.TextInput, props => {
|
|
13
|
-
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
14
|
-
const [isPressed, setIsPressed] = (0, _react.useState)(false);
|
|
15
|
-
const state = {
|
|
16
|
-
isDisabled: props.editable === false,
|
|
17
|
-
isFocused,
|
|
18
|
-
isPressed
|
|
19
|
-
};
|
|
20
|
-
const style = (0, _useStyle.useStyle)(props.className, props, state);
|
|
21
|
-
const cursorColor = (0, _useStyle.useStyle)(props.cursorColorClassName, props, state).accentColor;
|
|
22
|
-
const selectionColor = (0, _useStyle.useStyle)(props.selectionColorClassName, props, state).accentColor;
|
|
23
|
-
const placeholderTextColor = (0, _useStyle.useStyle)(props.placeholderTextColorClassName, props, state).accentColor;
|
|
24
|
-
const selectionHandleColor = (0, _useStyle.useStyle)(props.selectionHandleColorClassName, props, state).accentColor;
|
|
25
|
-
const underlineColorAndroid = (0, _useStyle.useStyle)(props.underlineColorAndroidClassName, props, state).accentColor;
|
|
26
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
27
|
-
...props,
|
|
28
|
-
style: [style, props.style],
|
|
29
|
-
cursorColor: props.cursorColor ?? cursorColor,
|
|
30
|
-
selectionColor: props.selectionColor ?? selectionColor,
|
|
31
|
-
placeholderTextColor: props.placeholderTextColor ?? placeholderTextColor,
|
|
32
|
-
selectionHandleColor: props.selectionHandleColor ?? selectionHandleColor,
|
|
33
|
-
underlineColorAndroid: props.underlineColorAndroid ?? underlineColorAndroid,
|
|
34
|
-
onFocus: event => {
|
|
35
|
-
setIsFocused(true);
|
|
36
|
-
props.onFocus?.(event);
|
|
37
|
-
},
|
|
38
|
-
onBlur: event => {
|
|
39
|
-
setIsFocused(false);
|
|
40
|
-
props.onBlur?.(event);
|
|
41
|
-
},
|
|
42
|
-
onPressIn: event => {
|
|
43
|
-
setIsPressed(true);
|
|
44
|
-
props.onPressIn?.(event);
|
|
45
|
-
},
|
|
46
|
-
onPressOut: event => {
|
|
47
|
-
setIsPressed(false);
|
|
48
|
-
props.onPressOut?.(event);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
module.exports = TextInput;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useUniwindAccent = void 0;
|
|
7
|
-
var _formatColor = require("../core/web/formatColor");
|
|
8
|
-
var _useResolveClassNames = require("./useResolveClassNames");
|
|
9
|
-
const useUniwindAccent = className => {
|
|
10
|
-
const styles = (0, _useResolveClassNames.useResolveClassNames)(className ?? "");
|
|
11
|
-
return styles.accentColor !== void 0 ? (0, _formatColor.formatColor)(styles.accentColor) : void 0;
|
|
12
|
-
};
|
|
13
|
-
exports.useUniwindAccent = useUniwindAccent;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { TextInput as RNTextInput } from "react-native";
|
|
4
|
-
import { copyComponentProperties } from "../utils.js";
|
|
5
|
-
import { useStyle } from "./useStyle.js";
|
|
6
|
-
export const TextInput = copyComponentProperties(RNTextInput, (props) => {
|
|
7
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
8
|
-
const [isPressed, setIsPressed] = useState(false);
|
|
9
|
-
const state = {
|
|
10
|
-
isDisabled: props.editable === false,
|
|
11
|
-
isFocused,
|
|
12
|
-
isPressed
|
|
13
|
-
};
|
|
14
|
-
const style = useStyle(props.className, props, state);
|
|
15
|
-
const cursorColor = useStyle(props.cursorColorClassName, props, state).accentColor;
|
|
16
|
-
const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor;
|
|
17
|
-
const placeholderTextColor = useStyle(props.placeholderTextColorClassName, props, state).accentColor;
|
|
18
|
-
const selectionHandleColor = useStyle(props.selectionHandleColorClassName, props, state).accentColor;
|
|
19
|
-
const underlineColorAndroid = useStyle(props.underlineColorAndroidClassName, props, state).accentColor;
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
RNTextInput,
|
|
22
|
-
{
|
|
23
|
-
...props,
|
|
24
|
-
style: [style, props.style],
|
|
25
|
-
cursorColor: props.cursorColor ?? cursorColor,
|
|
26
|
-
selectionColor: props.selectionColor ?? selectionColor,
|
|
27
|
-
placeholderTextColor: props.placeholderTextColor ?? placeholderTextColor,
|
|
28
|
-
selectionHandleColor: props.selectionHandleColor ?? selectionHandleColor,
|
|
29
|
-
underlineColorAndroid: props.underlineColorAndroid ?? underlineColorAndroid,
|
|
30
|
-
onFocus: (event) => {
|
|
31
|
-
setIsFocused(true);
|
|
32
|
-
props.onFocus?.(event);
|
|
33
|
-
},
|
|
34
|
-
onBlur: (event) => {
|
|
35
|
-
setIsFocused(false);
|
|
36
|
-
props.onBlur?.(event);
|
|
37
|
-
},
|
|
38
|
-
onPressIn: (event) => {
|
|
39
|
-
setIsPressed(true);
|
|
40
|
-
props.onPressIn?.(event);
|
|
41
|
-
},
|
|
42
|
-
onPressOut: (event) => {
|
|
43
|
-
setIsPressed(false);
|
|
44
|
-
props.onPressOut?.(event);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
export default TextInput;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { formatColor } from "../core/web/formatColor.js";
|
|
2
|
-
import { useResolveClassNames } from "./useResolveClassNames.js";
|
|
3
|
-
export const useUniwindAccent = (className) => {
|
|
4
|
-
const styles = useResolveClassNames(className ?? "");
|
|
5
|
-
return styles.accentColor !== void 0 ? formatColor(styles.accentColor) : void 0;
|
|
6
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
import { TextInput as RNTextInput, TextInputProps } from 'react-native'
|
|
3
|
-
import { ComponentState } from '../../core/types'
|
|
4
|
-
import { copyComponentProperties } from '../utils'
|
|
5
|
-
import { useStyle } from './useStyle'
|
|
6
|
-
|
|
7
|
-
export const TextInput = copyComponentProperties(RNTextInput, (props: TextInputProps) => {
|
|
8
|
-
const [isFocused, setIsFocused] = useState(false)
|
|
9
|
-
const [isPressed, setIsPressed] = useState(false)
|
|
10
|
-
const state = {
|
|
11
|
-
isDisabled: props.editable === false,
|
|
12
|
-
isFocused,
|
|
13
|
-
isPressed,
|
|
14
|
-
} satisfies ComponentState
|
|
15
|
-
const style = useStyle(props.className, props, state)
|
|
16
|
-
const cursorColor = useStyle(props.cursorColorClassName, props, state).accentColor
|
|
17
|
-
const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor
|
|
18
|
-
const placeholderTextColor = useStyle(props.placeholderTextColorClassName, props, state).accentColor
|
|
19
|
-
const selectionHandleColor = useStyle(props.selectionHandleColorClassName, props, state).accentColor
|
|
20
|
-
const underlineColorAndroid = useStyle(props.underlineColorAndroidClassName, props, state).accentColor
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<RNTextInput
|
|
24
|
-
{...props}
|
|
25
|
-
style={[style, props.style]}
|
|
26
|
-
cursorColor={props.cursorColor ?? cursorColor}
|
|
27
|
-
selectionColor={props.selectionColor ?? selectionColor}
|
|
28
|
-
placeholderTextColor={props.placeholderTextColor ?? placeholderTextColor}
|
|
29
|
-
selectionHandleColor={props.selectionHandleColor ?? selectionHandleColor}
|
|
30
|
-
underlineColorAndroid={props.underlineColorAndroid ?? underlineColorAndroid}
|
|
31
|
-
onFocus={event => {
|
|
32
|
-
setIsFocused(true)
|
|
33
|
-
props.onFocus?.(event)
|
|
34
|
-
}}
|
|
35
|
-
onBlur={event => {
|
|
36
|
-
setIsFocused(false)
|
|
37
|
-
props.onBlur?.(event)
|
|
38
|
-
}}
|
|
39
|
-
onPressIn={event => {
|
|
40
|
-
setIsPressed(true)
|
|
41
|
-
props.onPressIn?.(event)
|
|
42
|
-
}}
|
|
43
|
-
onPressOut={event => {
|
|
44
|
-
setIsPressed(false)
|
|
45
|
-
props.onPressOut?.(event)
|
|
46
|
-
}}
|
|
47
|
-
/>
|
|
48
|
-
)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
export default TextInput
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { formatColor } from '../core/web/formatColor'
|
|
2
|
-
import { useResolveClassNames } from './useResolveClassNames'
|
|
3
|
-
|
|
4
|
-
export const useUniwindAccent = (className: string | undefined) => {
|
|
5
|
-
const styles = useResolveClassNames(className ?? '')
|
|
6
|
-
|
|
7
|
-
return styles.accentColor !== undefined
|
|
8
|
-
? formatColor(styles.accentColor)
|
|
9
|
-
: undefined
|
|
10
|
-
}
|
|
File without changes
|