@niibase/uniwind 1.6.1 → 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 (124) hide show
  1. package/CHANGELOG.md +24 -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/useUniwindAccent.js +20 -0
  31. package/dist/common/hoc/withUniwind.js +7 -0
  32. package/dist/common/hoc/withUniwind.native.js +7 -0
  33. package/dist/common/hooks/index.js +0 -11
  34. package/dist/metro/index.cjs +1 -1
  35. package/dist/metro/index.mjs +1 -1
  36. package/dist/metro/metro-transformer.cjs +12 -10
  37. package/dist/metro/metro-transformer.mjs +6 -4
  38. package/dist/module/common/utils.d.ts +1 -0
  39. package/dist/module/common/utils.js +1 -0
  40. package/dist/module/components/native/ActivityIndicator.js +2 -1
  41. package/dist/module/components/native/Button.js +2 -2
  42. package/dist/module/components/native/FlatList.js +2 -1
  43. package/dist/module/components/native/Image.js +2 -1
  44. package/dist/module/components/native/ImageBackground.js +2 -1
  45. package/dist/module/components/native/InputAccessoryView.js +2 -1
  46. package/dist/module/components/native/Modal.js +2 -1
  47. package/dist/module/components/native/RefreshControl.js +5 -4
  48. package/dist/module/components/native/ScrollView.js +2 -1
  49. package/dist/module/components/native/SectionList.js +2 -1
  50. package/dist/module/components/native/Switch.js +5 -4
  51. package/dist/module/components/native/Text.js +2 -1
  52. package/dist/module/components/native/TextInput.js +6 -5
  53. package/dist/module/components/native/TouchableHighlight.js +2 -1
  54. package/dist/module/components/native/VirtualizedList.js +2 -1
  55. package/dist/module/components/native/useAccentColor.d.ts +2 -0
  56. package/dist/module/components/native/useAccentColor.js +14 -0
  57. package/dist/module/components/react-native-gesture-handler/native/FlatList.js +2 -1
  58. package/dist/module/components/react-native-gesture-handler/native/RefreshControl.js +5 -4
  59. package/dist/module/components/react-native-gesture-handler/native/Text.js +2 -1
  60. package/dist/module/components/react-native-gesture-handler/native/TextInput.js +5 -4
  61. package/dist/module/components/web/ActivityIndicator.js +1 -1
  62. package/dist/module/components/web/Button.js +1 -1
  63. package/dist/module/components/web/Image.js +2 -1
  64. package/dist/module/components/web/ImageBackground.js +1 -1
  65. package/dist/module/components/web/Switch.js +1 -1
  66. package/dist/module/components/web/TextInput.js +1 -1
  67. package/dist/module/components/web/TouchableHighlight.js +1 -1
  68. package/dist/module/components/web/useUniwindAccent.js +15 -0
  69. package/dist/module/hoc/withUniwind.js +9 -0
  70. package/dist/module/hoc/withUniwind.native.js +9 -0
  71. package/dist/module/hooks/index.d.ts +0 -1
  72. package/dist/module/hooks/index.js +0 -1
  73. package/dist/shared/{uniwind.C-rHhHOg.mjs → uniwind.BGiqYvxb.mjs} +1 -1
  74. package/dist/shared/{uniwind.nl8746mK.cjs → uniwind.Cv73KtI-.cjs} +0 -2
  75. package/dist/shared/{uniwind.F-0-Rr--.mjs → uniwind.PtWWxxnh.mjs} +1 -2
  76. package/dist/shared/{uniwind.BZyFsest.cjs → uniwind.r2i22V6d.cjs} +1 -1
  77. package/dist/vite/index.cjs +2 -2
  78. package/dist/vite/index.mjs +2 -2
  79. package/package.json +1 -1
  80. package/src/common/utils.ts +1 -0
  81. package/src/components/native/ActivityIndicator.tsx +2 -1
  82. package/src/components/native/Button.tsx +2 -2
  83. package/src/components/native/FlatList.tsx +2 -1
  84. package/src/components/native/Image.tsx +2 -1
  85. package/src/components/native/ImageBackground.tsx +2 -1
  86. package/src/components/native/InputAccessoryView.tsx +2 -1
  87. package/src/components/native/Modal.tsx +2 -1
  88. package/src/components/native/RefreshControl.tsx +5 -4
  89. package/src/components/native/ScrollView.tsx +2 -1
  90. package/src/components/native/SectionList.tsx +2 -1
  91. package/src/components/native/Switch.tsx +5 -4
  92. package/src/components/native/Text.tsx +2 -1
  93. package/src/components/native/TextInput.tsx +6 -5
  94. package/src/components/native/TouchableHighlight.tsx +2 -1
  95. package/src/components/native/VirtualizedList.tsx +2 -1
  96. package/src/components/native/useAccentColor.ts +19 -0
  97. package/src/components/react-native-gesture-handler/native/FlatList.tsx +2 -1
  98. package/src/components/react-native-gesture-handler/native/RefreshControl.tsx +5 -4
  99. package/src/components/react-native-gesture-handler/native/Text.tsx +2 -1
  100. package/src/components/react-native-gesture-handler/native/TextInput.tsx +5 -4
  101. package/src/components/web/ActivityIndicator.tsx +1 -1
  102. package/src/components/web/Button.tsx +1 -1
  103. package/src/components/web/Image.tsx +2 -1
  104. package/src/components/web/ImageBackground.tsx +1 -1
  105. package/src/components/web/Switch.tsx +1 -1
  106. package/src/components/web/TextInput.tsx +1 -1
  107. package/src/components/web/TouchableHighlight.tsx +1 -1
  108. package/src/components/web/useUniwindAccent.ts +21 -0
  109. package/src/hoc/withUniwind.native.tsx +11 -0
  110. package/src/hoc/withUniwind.tsx +11 -0
  111. package/src/hooks/index.ts +0 -1
  112. package/src/metro/addMetaToStylesTemplate.ts +2 -1
  113. package/src/metro/metro-transformer.ts +2 -2
  114. package/src/metro/processor/css.ts +3 -1
  115. package/src/metro/processor/rn.ts +2 -1
  116. package/src/metro/utils/common.ts +0 -2
  117. package/dist/common/components/native/TextInput.android.js +0 -52
  118. package/dist/common/hooks/useUniwindAccent.js +0 -13
  119. package/dist/module/components/native/TextInput.android.d.ts +0 -3
  120. package/dist/module/components/native/TextInput.android.js +0 -49
  121. package/dist/module/hooks/useUniwindAccent.js +0 -6
  122. package/src/components/native/TextInput.android.tsx +0 -51
  123. package/src/hooks/useUniwindAccent.ts +0 -10
  124. /package/dist/module/{hooks → components/web}/useUniwindAccent.d.ts +0 -0
@@ -35,15 +35,4 @@ Object.keys(_useUniwind).forEach(function (key) {
35
35
  return _useUniwind[key];
36
36
  }
37
37
  });
38
- });
39
- var _useUniwindAccent = require("./useUniwindAccent");
40
- Object.keys(_useUniwindAccent).forEach(function (key) {
41
- if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _useUniwindAccent[key]) return;
43
- Object.defineProperty(exports, key, {
44
- enumerable: true,
45
- get: function () {
46
- return _useUniwindAccent[key];
47
- }
48
- });
49
38
  });
@@ -5,7 +5,7 @@ const FileStoreBase = require('metro-cache/private/stores/FileStore');
5
5
  const os = require('os');
6
6
  const path = require('path');
7
7
  const node_path = require('node:path');
8
- const common = require('../shared/uniwind.nl8746mK.cjs');
8
+ const common = require('../shared/uniwind.Cv73KtI-.cjs');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
11
 
@@ -3,7 +3,7 @@ import FileStoreBase from 'metro-cache/private/stores/FileStore';
3
3
  import os from 'os';
4
4
  import path from 'path';
5
5
  import { join, dirname, sep, basename } from 'node:path';
6
- import { n as name, u as uniq } from '../shared/uniwind.F-0-Rr--.mjs';
6
+ import { n as name, u as uniq } from '../shared/uniwind.PtWWxxnh.mjs';
7
7
 
8
8
  class FileStore extends FileStoreBase {
9
9
  async set(key, value) {
@@ -2,12 +2,12 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
- const common = require('../shared/uniwind.nl8746mK.cjs');
5
+ const common = require('../shared/uniwind.Cv73KtI-.cjs');
6
6
  const consts = require('../shared/uniwind.B5q8hBGv.cjs');
7
7
  const node = require('@tailwindcss/node');
8
8
  const oxide = require('@tailwindcss/oxide');
9
9
  const lightningcss = require('lightningcss');
10
- const stringifyThemes = require('../shared/uniwind.BZyFsest.cjs');
10
+ const stringifyThemes = require('../shared/uniwind.r2i22V6d.cjs');
11
11
  const culori = require('culori');
12
12
 
13
13
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -114,6 +114,8 @@ const serializeJSObject = (obj, serializer) => {
114
114
  return serializedObject;
115
115
  };
116
116
 
117
+ const isDefined = (value) => value !== void 0 && value !== null;
118
+
117
119
  var StyleDependency = /* @__PURE__ */ ((StyleDependency2) => {
118
120
  StyleDependency2[StyleDependency2["ColorScheme"] = 1] = "ColorScheme";
119
121
  StyleDependency2[StyleDependency2["Theme"] = 2] = "Theme";
@@ -236,7 +238,7 @@ const addMetaToStylesTemplate = (Processor, currentPlatform) => {
236
238
  ].filter(Boolean).length
237
239
  };
238
240
  });
239
- const filteredStyles = styles.filter(common.isDefined);
241
+ const filteredStyles = styles.filter(isDefined);
240
242
  if (filteredStyles.length === 0) {
241
243
  return null;
242
244
  }
@@ -244,7 +246,7 @@ const addMetaToStylesTemplate = (Processor, currentPlatform) => {
244
246
  className,
245
247
  filteredStyles
246
248
  ];
247
- }).filter(common.isDefined);
249
+ }).filter(isDefined);
248
250
  const stylesheets = Object.fromEntries(stylesheetsEntries);
249
251
  return stylesheets;
250
252
  };
@@ -543,7 +545,7 @@ class CSS {
543
545
  this.processValue(filter.value.yOffset),
544
546
  this.processValue(filter.value.blur),
545
547
  this.processValue(filter.value.color)
546
- ].filter(common.isDefined);
548
+ ].filter(isDefined);
547
549
  return `drop-shadow(${parts.join(" ")})`;
548
550
  }
549
551
  const value = this.processValue(filter.value);
@@ -776,7 +778,7 @@ class CSS {
776
778
  return [
777
779
  this.Processor.Color.processColor(declarationValue.color),
778
780
  declarationValue.position ? this.processValue(declarationValue.position) : null
779
- ].filter(common.isDefined).join(" ");
781
+ ].filter(isDefined).join(" ");
780
782
  case "side":
781
783
  return declarationValue.side;
782
784
  case "absolute":
@@ -911,7 +913,7 @@ class CSS {
911
913
  this.processValue(declarationValue.blur),
912
914
  this.processValue(declarationValue.spread),
913
915
  this.processValue(declarationValue.color)
914
- ].filter(common.isDefined).join(" ");
916
+ ].filter(isDefined).join(" ");
915
917
  }
916
918
  if ("blockStart" in declarationValue) {
917
919
  const startValue = this.processValue(declarationValue.blockStart);
@@ -1504,7 +1506,7 @@ class RN {
1504
1506
  typeof value === "string" ? common.addMissingSpaces(value) : value
1505
1507
  );
1506
1508
  const joinedStyles = this.joinStyles(rn);
1507
- return Object.entries(joinedStyles).filter(([, value2]) => common.isDefined(value2));
1509
+ return Object.entries(joinedStyles).filter(([, value2]) => isDefined(value2));
1508
1510
  }
1509
1511
  transformProperty(property, value) {
1510
1512
  if (property in cssToRNMap) {
@@ -2072,7 +2074,7 @@ try {
2072
2074
  worker = require("metro-transform-worker");
2073
2075
  }
2074
2076
  const transform = async (config, projectRoot, filePath, data, options) => {
2075
- const isCss = options.type !== "asset" && path__default.join(process.cwd(), config.uniwind.cssEntryFile) === path__default.join(process.cwd(), filePath);
2077
+ const isCss = options.type !== "asset" && path__default.join(process.cwd(), config.uniwind.cssEntryFile) === path__default.join(projectRoot, filePath);
2076
2078
  if (filePath.endsWith("/components/web/metro-injected.js")) {
2077
2079
  const cssPath2 = path__default.join(process.cwd(), config.uniwind.cssEntryFile);
2078
2080
  const injectedThemesCode2 = await injectThemes({
@@ -2109,7 +2111,7 @@ const transform = async (config, projectRoot, filePath, data, options) => {
2109
2111
  themes: config.uniwind.themes,
2110
2112
  dtsPath: config.uniwind.dtsFile
2111
2113
  });
2112
- const css = fs__default.readFileSync(filePath, "utf-8");
2114
+ const css = fs__default.readFileSync(cssPath, "utf-8");
2113
2115
  const platform = getPlatform();
2114
2116
  const virtualCode = await compileVirtual({
2115
2117
  css,
@@ -1,11 +1,11 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
- import { p as pipe, r as roundToPrecision, i as isNumber, a as isValidJSValue, s as smartSplit, b as addMissingSpaces, t as toCamelCase, c as isDefined, d as deepEqual, e as shouldBeSerialized, f as removeKeys, n as name } from '../shared/uniwind.F-0-Rr--.mjs';
3
+ import { p as pipe, r as roundToPrecision, i as isNumber, a as isValidJSValue, s as smartSplit, b as addMissingSpaces, t as toCamelCase, d as deepEqual, c as shouldBeSerialized, e as removeKeys, n as name } from '../shared/uniwind.PtWWxxnh.mjs';
4
4
  import { P as Platform, U as UNIWIND_PLATFORM_VARIABLES, a as UNIWIND_THEME_VARIABLES } from '../shared/uniwind.JSWK3vHl.mjs';
5
5
  import { compile } from '@tailwindcss/node';
6
6
  import { Scanner } from '@tailwindcss/oxide';
7
7
  import { transform as transform$1 } from 'lightningcss';
8
- import { L as Logger, U as UniwindCSSVisitor, s as stringifyThemes, b as buildDtsFile, a as buildCSS } from '../shared/uniwind.C-rHhHOg.mjs';
8
+ import { L as Logger, U as UniwindCSSVisitor, s as stringifyThemes, b as buildDtsFile, a as buildCSS } from '../shared/uniwind.BGiqYvxb.mjs';
9
9
  import { converter, parse, formatHex, formatHex8 } from 'culori';
10
10
 
11
11
  const parseStringValue = (value) => {
@@ -107,6 +107,8 @@ const serializeJSObject = (obj, serializer) => {
107
107
  return serializedObject;
108
108
  };
109
109
 
110
+ const isDefined = (value) => value !== void 0 && value !== null;
111
+
110
112
  var StyleDependency = /* @__PURE__ */ ((StyleDependency2) => {
111
113
  StyleDependency2[StyleDependency2["ColorScheme"] = 1] = "ColorScheme";
112
114
  StyleDependency2[StyleDependency2["Theme"] = 2] = "Theme";
@@ -2065,7 +2067,7 @@ try {
2065
2067
  worker = require("metro-transform-worker");
2066
2068
  }
2067
2069
  const transform = async (config, projectRoot, filePath, data, options) => {
2068
- const isCss = options.type !== "asset" && path.join(process.cwd(), config.uniwind.cssEntryFile) === path.join(process.cwd(), filePath);
2070
+ const isCss = options.type !== "asset" && path.join(process.cwd(), config.uniwind.cssEntryFile) === path.join(projectRoot, filePath);
2069
2071
  if (filePath.endsWith("/components/web/metro-injected.js")) {
2070
2072
  const cssPath2 = path.join(process.cwd(), config.uniwind.cssEntryFile);
2071
2073
  const injectedThemesCode2 = await injectThemes({
@@ -2102,7 +2104,7 @@ const transform = async (config, projectRoot, filePath, data, options) => {
2102
2104
  themes: config.uniwind.themes,
2103
2105
  dtsPath: config.uniwind.dtsFile
2104
2106
  });
2105
- const css = fs.readFileSync(filePath, "utf-8");
2107
+ const css = fs.readFileSync(cssPath, "utf-8");
2106
2108
  const platform = getPlatform();
2107
2109
  const virtualCode = await compileVirtual({
2108
2110
  css,
@@ -0,0 +1 @@
1
+ export declare const isDefined: <T>(value: T) => value is NonNullable<T>;
@@ -0,0 +1 @@
1
+ export const isDefined = (value) => value !== void 0 && value !== null;
@@ -1,10 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { ActivityIndicator as RNActivityIndicator } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const ActivityIndicator = copyComponentProperties(RNActivityIndicator, (props) => {
6
7
  const { Component, style } = useStyle(RNActivityIndicator, props.className, props, { isPressed: Boolean(props.animating) });
7
- const color = useStyle(props.colorClassName, props).accentColor;
8
+ const color = useAccentColor(props.colorClassName, props);
8
9
  return /* @__PURE__ */ jsx(
9
10
  Component,
10
11
  {
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Button as RNButton } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
- import { useStyle } from "./useStyle.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
5
5
  export const Button = copyComponentProperties(RNButton, (props) => {
6
- const color = useStyle(props.colorClassName, props).accentColor;
6
+ const color = useAccentColor(props.colorClassName, props);
7
7
  return /* @__PURE__ */ jsx(
8
8
  RNButton,
9
9
  {
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { FlatList as RNFlatList } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const FlatList = copyComponentProperties(RNFlatList, (props) => {
6
7
  const { Component, style } = useStyle(RNFlatList, props.className, props);
@@ -8,7 +9,7 @@ export const FlatList = copyComponentProperties(RNFlatList, (props) => {
8
9
  const styleContentContainer = useStyle(props.contentContainerClassName, props);
9
10
  const styleListFooterComponent = useStyle(props.ListFooterComponentClassName, props);
10
11
  const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName, props);
11
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor;
12
+ const endFillColor = useAccentColor(props.endFillColorClassName, props);
12
13
  const hasSingleColumn = !("numColumns" in props) || props.numColumns === 1;
13
14
  return /* @__PURE__ */ jsx(
14
15
  Component,
@@ -1,10 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Image as RNImage } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const Image = copyComponentProperties(RNImage, (props) => {
6
7
  const { Component, style } = useStyle(RNImage, props.className, props);
7
- const tintColor = useStyle(props.tintColorClassName, props).accentColor;
8
+ const tintColor = useAccentColor(props.tintColorClassName, props);
8
9
  return /* @__PURE__ */ jsx(
9
10
  Component,
10
11
  {
@@ -1,11 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { ImageBackground as RNImageBackground } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const ImageBackground = copyComponentProperties(RNImageBackground, (props) => {
6
7
  const { Component, style } = useStyle(RNImageBackground, props.className, props);
7
8
  const imageStyle = useStyle(props.imageClassName, props);
8
- const tintColor = useStyle(props.tintColorClassName, props).accentColor;
9
+ const tintColor = useAccentColor(props.tintColorClassName, props);
9
10
  return /* @__PURE__ */ jsx(
10
11
  Component,
11
12
  {
@@ -1,12 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { InputAccessoryView as RNInputAccessoryView } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const InputAccessoryView = copyComponentProperties(
6
7
  RNInputAccessoryView,
7
8
  (props) => {
8
9
  const { Component, style } = useStyle(RNInputAccessoryView, props.className, props);
9
- const backgroundColor = useStyle(props.backgroundColorClassName, props).accentColor;
10
+ const backgroundColor = useAccentColor(props.backgroundColorClassName, props);
10
11
  return /* @__PURE__ */ jsx(
11
12
  Component,
12
13
  {
@@ -1,10 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Modal as RNModal } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const Modal = copyComponentProperties(RNModal, (props) => {
6
7
  const { Component, style } = useStyle(RNModal, props.className, props);
7
- const backdropColor = useStyle(props.backdropColorClassName, props).accentColor;
8
+ const backdropColor = useAccentColor(props.backdropColorClassName, props);
8
9
  return /* @__PURE__ */ jsx(
9
10
  Component,
10
11
  {
@@ -1,15 +1,16 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { RefreshControl as RNRefreshControl } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const RefreshControl = copyComponentProperties(RNRefreshControl, (props) => {
6
7
  const { Component, style } = useStyle(RNRefreshControl, props.className, props, {
7
8
  isPressed: Boolean(props.refreshing)
8
9
  });
9
- const color = useStyle(props.colorsClassName, props).accentColor;
10
- const tintColor = useStyle(props.tintColorClassName, props).accentColor;
11
- const titleColor = useStyle(props.titleColorClassName, props).accentColor;
12
- const progressBackgroundColor = useStyle(props.progressBackgroundColorClassName, props).accentColor;
10
+ const color = useAccentColor(props.colorsClassName, props);
11
+ const tintColor = useAccentColor(props.tintColorClassName, props);
12
+ const titleColor = useAccentColor(props.titleColorClassName, props);
13
+ const progressBackgroundColor = useAccentColor(props.progressBackgroundColorClassName, props);
13
14
  return /* @__PURE__ */ jsx(
14
15
  Component,
15
16
  {
@@ -1,11 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { ScrollView as RNScrollView } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const ScrollView = copyComponentProperties(RNScrollView, (props) => {
6
7
  const { Component, style } = useStyle(RNScrollView, props.className, props);
7
8
  const contentContainerStyle = useStyle(props.contentContainerClassName, props);
8
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor;
9
+ const endFillColor = useAccentColor(props.endFillColorClassName, props);
9
10
  return /* @__PURE__ */ jsx(
10
11
  Component,
11
12
  {
@@ -1,13 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { SectionList as RNSectionList } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const SectionList = copyComponentProperties(RNSectionList, (props) => {
6
7
  const { Component, style } = useStyle(RNSectionList, props.className, props);
7
8
  const contentContainerStyle = useStyle(props.contentContainerClassName, props);
8
9
  const listFooterComponentStyle = useStyle(props.ListFooterComponentClassName, props);
9
10
  const listHeaderComponentStyle = useStyle(props.ListHeaderComponentClassName, props);
10
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor;
11
+ const endFillColor = useAccentColor(props.endFillColorClassName, props);
11
12
  return /* @__PURE__ */ jsx(
12
13
  Component,
13
14
  {
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Switch as RNSwitch } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const Switch = copyComponentProperties(RNSwitch, (props) => {
6
7
  const state = {
@@ -8,10 +9,10 @@ export const Switch = copyComponentProperties(RNSwitch, (props) => {
8
9
  isPressed: Boolean(props.value)
9
10
  };
10
11
  const { Component, style } = useStyle(RNSwitch, props.className, props, state);
11
- const trackColorOn = useStyle(props.trackColorOnClassName, props, state).accentColor;
12
- const trackColorOff = useStyle(props.trackColorOffClassName, props, state).accentColor;
13
- const thumbColor = useStyle(props.thumbColorClassName, props, state).accentColor;
14
- const ios_backgroundColor = useStyle(props.ios_backgroundColorClassName, props, state).accentColor;
12
+ const trackColorOn = useAccentColor(props.trackColorOnClassName, props, state);
13
+ const trackColorOff = useAccentColor(props.trackColorOffClassName, props, state);
14
+ const thumbColor = useAccentColor(props.thumbColorClassName, props, state);
15
+ const ios_backgroundColor = useAccentColor(props.ios_backgroundColorClassName, props, state);
15
16
  return /* @__PURE__ */ jsx(
16
17
  Component,
17
18
  {
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { Text as RNText } from "react-native";
4
4
  import { copyComponentProperties } from "../utils.js";
5
+ import { useAccentColor } from "./useAccentColor.js";
5
6
  import { useStyle } from "./useStyle.js";
6
7
  export const Text = copyComponentProperties(RNText, (props) => {
7
8
  const [isPressed, setIsPressed] = useState(false);
@@ -10,7 +11,7 @@ export const Text = copyComponentProperties(RNText, (props) => {
10
11
  isDisabled: Boolean(props.disabled)
11
12
  };
12
13
  const { Component, style } = useStyle(RNText, props.className, props, state);
13
- const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor;
14
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state);
14
15
  return /* @__PURE__ */ jsx(
15
16
  Component,
16
17
  {
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { TextInput as RNTextInput } from "react-native";
4
4
  import { copyComponentProperties } from "../utils.js";
5
+ import { useAccentColor } from "./useAccentColor.js";
5
6
  import { useStyle } from "./useStyle.js";
6
7
  export const TextInput = copyComponentProperties(RNTextInput, (props) => {
7
8
  const [isFocused, setIsFocused] = useState(false);
@@ -12,11 +13,11 @@ export const TextInput = copyComponentProperties(RNTextInput, (props) => {
12
13
  isPressed
13
14
  };
14
15
  const { Component, style } = useStyle(RNTextInput, 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;
16
+ const cursorColor = useAccentColor(props.cursorColorClassName, props, state);
17
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state);
18
+ const placeholderTextColor = useAccentColor(props.placeholderTextColorClassName, props, state);
19
+ const selectionHandleColor = useAccentColor(props.selectionHandleColorClassName, props, state);
20
+ const underlineColorAndroid = useAccentColor(props.underlineColorAndroidClassName, props, state);
20
21
  return /* @__PURE__ */ jsx(
21
22
  Component,
22
23
  {
@@ -2,6 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { TouchableHighlight as RNTouchableHighlight } from "react-native";
4
4
  import { copyComponentProperties } from "../utils.js";
5
+ import { useAccentColor } from "./useAccentColor.js";
5
6
  import { useStyle } from "./useStyle.js";
6
7
  export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight, (props) => {
7
8
  const [isPressed, setIsPressed] = useState(false);
@@ -12,7 +13,7 @@ export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight,
12
13
  isFocused
13
14
  };
14
15
  const { Component, style } = useStyle(RNTouchableHighlight, props.className, props, state);
15
- const underlayColor = useStyle(props.underlayColorClassName, props, state).accentColor;
16
+ const underlayColor = useAccentColor(props.underlayColorClassName, props, state);
16
17
  return /* @__PURE__ */ jsx(
17
18
  Component,
18
19
  {
@@ -1,13 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { VirtualizedList as RNVirtualizedList } from "react-native";
3
3
  import { copyComponentProperties } from "../utils.js";
4
+ import { useAccentColor } from "./useAccentColor.js";
4
5
  import { useStyle } from "./useStyle.js";
5
6
  export const VirtualizedList = copyComponentProperties(RNVirtualizedList, (props) => {
6
7
  const { Component, style } = useStyle(RNVirtualizedList, props.className, props);
7
8
  const contentContainerStyle = useStyle(props.contentContainerClassName, props);
8
9
  const listFooterComponentStyle = useStyle(props.ListFooterComponentClassName, props);
9
10
  const listHeaderComponentStyle = useStyle(props.ListHeaderComponentClassName, props);
10
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor;
11
+ const endFillColor = useAccentColor(props.endFillColorClassName, props);
11
12
  return /* @__PURE__ */ jsx(
12
13
  Component,
13
14
  {
@@ -0,0 +1,2 @@
1
+ import { ComponentState } from '../../core/types';
2
+ export declare const useAccentColor: (className: string | undefined, componentProps: Record<string, any>, state?: ComponentState) => string | undefined;
@@ -0,0 +1,14 @@
1
+ import { isDefined } from "../../common/utils.js";
2
+ import { Logger } from "../../core/logger.js";
3
+ import { useStyle } from "./useStyle.js";
4
+ let warnedOnce = false;
5
+ export const useAccentColor = (className, componentProps, state) => {
6
+ const styles = useStyle(className, componentProps, state);
7
+ if (__DEV__ && !warnedOnce && isDefined(className) && className.trim() !== "" && styles.accentColor === void 0) {
8
+ warnedOnce = true;
9
+ Logger.warn(
10
+ `className '${className}' was provided to extract accentColor but no color was found. Make sure the className includes a color utility (e.g., 'accent-red-500', 'accent-blue-600'). See https://docs.uniwind.dev/class-names#the-accent-prefix`
11
+ );
12
+ }
13
+ return styles.accentColor;
14
+ };
@@ -1,5 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { FlatList as RNGHFlatList } from "react-native-gesture-handler";
3
+ import { useAccentColor } from "../../native/useAccentColor.js";
3
4
  import { useStyle } from "../../native/useStyle.js";
4
5
  import { copyComponentProperties } from "../../utils.js";
5
6
  export const FlatList = copyComponentProperties(RNGHFlatList, (props) => {
@@ -8,7 +9,7 @@ export const FlatList = copyComponentProperties(RNGHFlatList, (props) => {
8
9
  const styleContentContainer = useStyle(props.contentContainerClassName, props);
9
10
  const styleListFooterComponent = useStyle(props.ListFooterComponentClassName, props);
10
11
  const styleListHeaderComponent = useStyle(props.ListHeaderComponentClassName, props);
11
- const endFillColor = useStyle(props.endFillColorClassName, props).accentColor;
12
+ const endFillColor = useAccentColor(props.endFillColorClassName, props);
12
13
  const hasSingleColumn = !("numColumns" in props) || props.numColumns === 1;
13
14
  return /* @__PURE__ */ jsx(
14
15
  RNGHFlatList,
@@ -1,13 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { RefreshControl as RNGHRefreshControl } from "react-native-gesture-handler";
3
+ import { useAccentColor } from "../../native/useAccentColor.js";
3
4
  import { useStyle } from "../../native/useStyle.js";
4
5
  import { copyComponentProperties } from "../../utils.js";
5
6
  export const RefreshControl = copyComponentProperties(RNGHRefreshControl, (props) => {
6
7
  const style = useStyle(props.className, props);
7
- const color = useStyle(props.colorsClassName, props).accentColor;
8
- const tintColor = useStyle(props.tintColorClassName, props).accentColor;
9
- const titleColor = useStyle(props.titleColorClassName, props).accentColor;
10
- const progressBackgroundColor = useStyle(props.progressBackgroundColorClassName, props).accentColor;
8
+ const color = useAccentColor(props.colorsClassName, props);
9
+ const tintColor = useAccentColor(props.tintColorClassName, props);
10
+ const titleColor = useAccentColor(props.titleColorClassName, props);
11
+ const progressBackgroundColor = useAccentColor(props.progressBackgroundColorClassName, props);
11
12
  return /* @__PURE__ */ jsx(
12
13
  RNGHRefreshControl,
13
14
  {
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { Text as RNGHText } from "react-native-gesture-handler";
4
+ import { useAccentColor } from "../../native/useAccentColor.js";
4
5
  import { useStyle } from "../../native/useStyle.js";
5
6
  import { copyComponentProperties } from "../../utils.js";
6
7
  export const Text = copyComponentProperties(RNGHText, (props) => {
@@ -10,7 +11,7 @@ export const Text = copyComponentProperties(RNGHText, (props) => {
10
11
  isDisabled: Boolean(props.disabled)
11
12
  };
12
13
  const style = useStyle(props.className, props, state);
13
- const selectionColor = useStyle(props.selectionColorClassName, props, state).accentColor;
14
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state);
14
15
  return /* @__PURE__ */ jsx(
15
16
  RNGHText,
16
17
  {
@@ -1,6 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import { TextInput as RNGHTextInput } from "react-native-gesture-handler";
4
+ import { useAccentColor } from "../../native/useAccentColor.js";
4
5
  import { useStyle } from "../../native/useStyle.js";
5
6
  import { copyComponentProperties } from "../../utils.js";
6
7
  export const TextInput = copyComponentProperties(RNGHTextInput, (props) => {
@@ -13,10 +14,10 @@ export const TextInput = copyComponentProperties(RNGHTextInput, (props) => {
13
14
  };
14
15
  const style = useStyle(props.className, props, state);
15
16
  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;
17
+ const selectionColor = useAccentColor(props.selectionColorClassName, props, state);
18
+ const placeholderTextColor = useAccentColor(props.placeholderTextColorClassName, props, state);
19
+ const selectionHandleColor = useAccentColor(props.selectionHandleColorClassName, props, state);
20
+ const underlineColorAndroid = useAccentColor(props.underlineColorAndroidClassName, props, state);
20
21
  return /* @__PURE__ */ jsx(
21
22
  RNGHTextInput,
22
23
  {
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { ActivityIndicator as RNActivityIndicator } from "react-native";
3
- import { useUniwindAccent } from "../../hooks/index.js";
4
3
  import { copyComponentProperties } from "../utils.js";
5
4
  import { generateDataSet } from "./generateDataSet.js";
6
5
  import { toRNWClassName } from "./rnw.js";
6
+ import { useUniwindAccent } from "./useUniwindAccent.js";
7
7
  export const ActivityIndicator = copyComponentProperties(RNActivityIndicator, (props) => {
8
8
  const color = useUniwindAccent(props.colorClassName);
9
9
  return /* @__PURE__ */ jsx(
@@ -1,8 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Button as RNButton } from "react-native";
3
- import { useUniwindAccent } from "../../hooks/index.js";
4
3
  import { copyComponentProperties } from "../utils.js";
5
4
  import { generateDataSet } from "./generateDataSet.js";
5
+ import { useUniwindAccent } from "./useUniwindAccent.js";
6
6
  export const Button = copyComponentProperties(RNButton, (props) => {
7
7
  const color = useUniwindAccent(props.colorClassName);
8
8
  return /* @__PURE__ */ jsx(
@@ -1,9 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Image as RNImage } from "react-native";
3
- import { useResolveClassNames, useUniwindAccent } from "../../hooks/index.js";
3
+ import { useResolveClassNames } from "../../hooks/index.js";
4
4
  import { copyComponentProperties } from "../utils.js";
5
5
  import { generateDataSet } from "./generateDataSet.js";
6
6
  import { toRNWClassName } from "./rnw.js";
7
+ import { useUniwindAccent } from "./useUniwindAccent.js";
7
8
  export const Image = copyComponentProperties(RNImage, (props) => {
8
9
  const tintColor = useUniwindAccent(props.tintColorClassName);
9
10
  const styles = useResolveClassNames(props.className ?? "");
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { ImageBackground as RNImageBackground } from "react-native";
3
- import { useUniwindAccent } from "../../hooks/index.js";
4
3
  import { copyComponentProperties } from "../utils.js";
5
4
  import { generateDataSet } from "./generateDataSet.js";
6
5
  import { toRNWClassName } from "./rnw.js";
6
+ import { useUniwindAccent } from "./useUniwindAccent.js";
7
7
  export const ImageBackground = copyComponentProperties(RNImageBackground, (props) => {
8
8
  const tintColor = useUniwindAccent(props.tintColorClassName);
9
9
  return /* @__PURE__ */ jsx(
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Switch as RNSwitch } from "react-native";
3
- import { useUniwindAccent } from "../../hooks/index.js";
4
3
  import { copyComponentProperties } from "../utils.js";
5
4
  import { generateDataSet } from "./generateDataSet.js";
6
5
  import { toRNWClassName } from "./rnw.js";
6
+ import { useUniwindAccent } from "./useUniwindAccent.js";
7
7
  export const Switch = copyComponentProperties(RNSwitch, (props) => {
8
8
  const trackColorOn = useUniwindAccent(props.trackColorOnClassName);
9
9
  const trackColorOff = useUniwindAccent(props.trackColorOffClassName);
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { TextInput as RNTextInput } from "react-native";
3
- import { useUniwindAccent } from "../../hooks/index.js";
4
3
  import { copyComponentProperties } from "../utils.js";
5
4
  import { generateDataSet } from "./generateDataSet.js";
6
5
  import { toRNWClassName } from "./rnw.js";
6
+ import { useUniwindAccent } from "./useUniwindAccent.js";
7
7
  export const TextInput = copyComponentProperties(RNTextInput, (props) => {
8
8
  const placeholderTextColor = useUniwindAccent(props.placeholderTextColorClassName);
9
9
  return /* @__PURE__ */ jsx(
@@ -1,9 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { TouchableHighlight as RNTouchableHighlight } from "react-native";
3
- import { useUniwindAccent } from "../../hooks/index.js";
4
3
  import { copyComponentProperties } from "../utils.js";
5
4
  import { generateDataSet } from "./generateDataSet.js";
6
5
  import { toRNWClassName } from "./rnw.js";
6
+ import { useUniwindAccent } from "./useUniwindAccent.js";
7
7
  export const TouchableHighlight = copyComponentProperties(RNTouchableHighlight, (props) => {
8
8
  const underlayColor = useUniwindAccent(props.underlayColorClassName);
9
9
  return /* @__PURE__ */ jsx(