@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.
Files changed (138) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/common/common/utils.js +8 -0
  3. package/dist/common/components/native/ActivityIndicator.js +2 -1
  4. package/dist/common/components/native/Button.js +2 -2
  5. package/dist/common/components/native/FlatList.js +2 -1
  6. package/dist/common/components/native/Image.js +2 -1
  7. package/dist/common/components/native/ImageBackground.js +2 -1
  8. package/dist/common/components/native/InputAccessoryView.js +2 -1
  9. package/dist/common/components/native/Modal.js +2 -1
  10. package/dist/common/components/native/RefreshControl.js +5 -4
  11. package/dist/common/components/native/ScrollView.js +2 -1
  12. package/dist/common/components/native/SectionList.js +2 -1
  13. package/dist/common/components/native/Switch.js +5 -4
  14. package/dist/common/components/native/Text.js +2 -1
  15. package/dist/common/components/native/TextInput.js +6 -5
  16. package/dist/common/components/native/TouchableHighlight.js +2 -1
  17. package/dist/common/components/native/VirtualizedList.js +2 -1
  18. package/dist/common/components/native/useAccentColor.js +19 -0
  19. package/dist/common/components/react-native-gesture-handler/native/FlatList.js +2 -1
  20. package/dist/common/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
  21. package/dist/common/components/react-native-gesture-handler/native/Text.js +2 -1
  22. package/dist/common/components/react-native-gesture-handler/native/TextInput.js +5 -4
  23. package/dist/common/components/web/ActivityIndicator.js +2 -2
  24. package/dist/common/components/web/Button.js +2 -2
  25. package/dist/common/components/web/Image.js +2 -1
  26. package/dist/common/components/web/ImageBackground.js +2 -2
  27. package/dist/common/components/web/Switch.js +4 -4
  28. package/dist/common/components/web/TextInput.js +2 -2
  29. package/dist/common/components/web/TouchableHighlight.js +2 -2
  30. package/dist/common/components/web/generateDataSet.js +2 -1
  31. package/dist/common/components/web/useUniwindAccent.js +20 -0
  32. package/dist/common/core/web/getWebStyles.js +12 -1
  33. package/dist/common/hoc/withUniwind.js +14 -4
  34. package/dist/common/hoc/withUniwind.native.js +11 -4
  35. package/dist/common/hooks/index.js +0 -11
  36. package/dist/common/hooks/useResolveClassNames.js +1 -1
  37. package/dist/metro/index.cjs +1 -1
  38. package/dist/metro/index.mjs +1 -1
  39. package/dist/metro/metro-transformer.cjs +14 -11
  40. package/dist/metro/metro-transformer.mjs +8 -5
  41. package/dist/module/common/utils.d.ts +1 -0
  42. package/dist/module/common/utils.js +1 -0
  43. package/dist/module/components/native/ActivityIndicator.js +2 -1
  44. package/dist/module/components/native/Button.js +2 -2
  45. package/dist/module/components/native/FlatList.js +2 -1
  46. package/dist/module/components/native/Image.js +2 -1
  47. package/dist/module/components/native/ImageBackground.js +2 -1
  48. package/dist/module/components/native/InputAccessoryView.js +2 -1
  49. package/dist/module/components/native/Modal.js +2 -1
  50. package/dist/module/components/native/RefreshControl.js +5 -4
  51. package/dist/module/components/native/ScrollView.js +2 -1
  52. package/dist/module/components/native/SectionList.js +2 -1
  53. package/dist/module/components/native/Switch.js +5 -4
  54. package/dist/module/components/native/Text.js +2 -1
  55. package/dist/module/components/native/TextInput.js +6 -5
  56. package/dist/module/components/native/TouchableHighlight.js +2 -1
  57. package/dist/module/components/native/VirtualizedList.js +2 -1
  58. package/dist/module/components/native/useAccentColor.d.ts +2 -0
  59. package/dist/module/components/native/useAccentColor.js +14 -0
  60. package/dist/module/components/react-native-gesture-handler/native/FlatList.js +2 -1
  61. package/dist/module/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
  62. package/dist/module/components/react-native-gesture-handler/native/Text.js +2 -1
  63. package/dist/module/components/react-native-gesture-handler/native/TextInput.js +5 -4
  64. package/dist/module/components/web/ActivityIndicator.js +1 -1
  65. package/dist/module/components/web/Button.js +1 -1
  66. package/dist/module/components/web/Image.js +2 -1
  67. package/dist/module/components/web/ImageBackground.js +1 -1
  68. package/dist/module/components/web/Switch.js +1 -1
  69. package/dist/module/components/web/TextInput.js +1 -1
  70. package/dist/module/components/web/TouchableHighlight.js +1 -1
  71. package/dist/module/components/web/generateDataSet.d.ts +1 -1
  72. package/dist/module/components/web/generateDataSet.js +2 -1
  73. package/dist/module/components/web/useUniwindAccent.js +15 -0
  74. package/dist/module/core/web/getWebStyles.d.ts +1 -1
  75. package/dist/module/core/web/getWebStyles.js +12 -1
  76. package/dist/module/hoc/withUniwind.js +16 -4
  77. package/dist/module/hoc/withUniwind.native.js +13 -4
  78. package/dist/module/hooks/index.d.ts +0 -1
  79. package/dist/module/hooks/index.js +0 -1
  80. package/dist/module/hooks/useResolveClassNames.js +2 -2
  81. package/dist/module/hooks/useUniwind.d.ts +2 -1
  82. package/dist/shared/{uniwind.C-rHhHOg.mjs → uniwind.BGiqYvxb.mjs} +1 -1
  83. package/dist/shared/{uniwind.nl8746mK.cjs → uniwind.Cv73KtI-.cjs} +0 -2
  84. package/dist/shared/{uniwind.F-0-Rr--.mjs → uniwind.PtWWxxnh.mjs} +1 -2
  85. package/dist/shared/{uniwind.BZyFsest.cjs → uniwind.r2i22V6d.cjs} +1 -1
  86. package/dist/vite/index.cjs +2 -2
  87. package/dist/vite/index.mjs +2 -2
  88. package/package.json +2 -1
  89. package/src/common/utils.ts +1 -0
  90. package/src/components/native/ActivityIndicator.tsx +2 -1
  91. package/src/components/native/Button.tsx +2 -2
  92. package/src/components/native/FlatList.tsx +2 -1
  93. package/src/components/native/Image.tsx +2 -1
  94. package/src/components/native/ImageBackground.tsx +2 -1
  95. package/src/components/native/InputAccessoryView.tsx +2 -1
  96. package/src/components/native/Modal.tsx +2 -1
  97. package/src/components/native/RefreshControl.tsx +5 -4
  98. package/src/components/native/ScrollView.tsx +2 -1
  99. package/src/components/native/SectionList.tsx +2 -1
  100. package/src/components/native/Switch.tsx +5 -4
  101. package/src/components/native/Text.tsx +2 -1
  102. package/src/components/native/TextInput.tsx +6 -5
  103. package/src/components/native/TouchableHighlight.tsx +2 -1
  104. package/src/components/native/VirtualizedList.tsx +2 -1
  105. package/src/components/native/useAccentColor.ts +19 -0
  106. package/src/components/react-native-gesture-handler/native/FlatList.tsx +2 -1
  107. package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +5 -4
  108. package/src/components/react-native-gesture-handler/native/Text.tsx +2 -1
  109. package/src/components/react-native-gesture-handler/native/TextInput.tsx +5 -4
  110. package/src/components/web/ActivityIndicator.tsx +1 -1
  111. package/src/components/web/Button.tsx +1 -1
  112. package/src/components/web/Image.tsx +2 -1
  113. package/src/components/web/ImageBackground.tsx +1 -1
  114. package/src/components/web/Switch.tsx +1 -1
  115. package/src/components/web/TextInput.tsx +1 -1
  116. package/src/components/web/TouchableHighlight.tsx +1 -1
  117. package/src/components/web/generateDataSet.ts +4 -2
  118. package/src/components/web/useUniwindAccent.ts +21 -0
  119. package/src/core/web/getWebStyles.ts +20 -1
  120. package/src/hoc/withUniwind.native.tsx +15 -4
  121. package/src/hoc/withUniwind.tsx +16 -2
  122. package/src/hooks/index.ts +0 -1
  123. package/src/hooks/useResolveClassNames.ts +2 -2
  124. package/src/hooks/useUniwind.ts +2 -2
  125. package/src/metro/addMetaToStylesTemplate.ts +2 -1
  126. package/src/metro/metro-transformer.ts +2 -2
  127. package/src/metro/processor/color.ts +2 -1
  128. package/src/metro/processor/css.ts +3 -1
  129. package/src/metro/processor/rn.ts +2 -1
  130. package/src/metro/utils/common.ts +0 -2
  131. package/dist/common/components/native/TextInput.android.js +0 -52
  132. package/dist/common/hooks/useUniwindAccent.js +0 -13
  133. package/dist/module/components/native/TextInput.android.d.ts +0 -3
  134. package/dist/module/components/native/TextInput.android.js +0 -49
  135. package/dist/module/hooks/useUniwindAccent.js +0 -6
  136. package/src/components/native/TextInput.android.tsx +0 -51
  137. package/src/hooks/useUniwindAccent.ts +0 -10
  138. /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,3 +0,0 @@
1
- import { TextInput as RNTextInput } from 'react-native';
2
- export declare const TextInput: typeof RNTextInput;
3
- export default TextInput;
@@ -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
- }