@umber-style/react-native 0.1.0-rc.1 → 0.1.0-rc.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/dist/createStyle.cjs +2 -0
- package/dist/createStyle.mjs +2 -0
- package/dist/warnStyle.cjs +14 -0
- package/dist/warnStyle.mjs +14 -1
- package/package.json +2 -2
package/dist/createStyle.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_nativeTheme = require("./nativeTheme.cjs");
|
|
|
6
6
|
const require_styled = require("./styled.cjs");
|
|
7
7
|
const require_toNativeStyle = require("./toNativeStyle.cjs");
|
|
8
8
|
const require_windowState = require("./windowState.cjs");
|
|
9
|
+
const require_warnStyle = require("./warnStyle.cjs");
|
|
9
10
|
let react_native = require("react-native");
|
|
10
11
|
// src/createStyle.ts
|
|
11
12
|
const NO_QUERIES = [];
|
|
@@ -109,6 +110,7 @@ function useThemeClass() {}
|
|
|
109
110
|
*/
|
|
110
111
|
function bindHolder(holder, context, options = {}) {
|
|
111
112
|
const { remBase = 16, lengthKeys = require_nativeTheme.DEFAULT_LENGTH_KEYS } = options;
|
|
113
|
+
require_warnStyle.warnAboutIgnoredOptions(options);
|
|
112
114
|
const { ThemeContext, ThemeValueProvider, useTheme, useCondition } = require_ThemeValue.createThemeValue(holder, (theme) => require_nativeTheme.toNativeTheme(theme, lengthKeys, remBase), context);
|
|
113
115
|
function ThemeProvider({ theme, colorScheme, children }) {
|
|
114
116
|
return (0, react.createElement)(ThemeValueProvider, {
|
package/dist/createStyle.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { createStyled } from "./styled.mjs";
|
|
|
7
7
|
import { platformStyleSheet } from "./platform.mjs";
|
|
8
8
|
import { collectKeys, toNativeStyle } from "./toNativeStyle.mjs";
|
|
9
9
|
import { readMediaKey, readWindowState, useMediaKey } from "./windowState.mjs";
|
|
10
|
+
import { warnAboutIgnoredOptions } from "./warnStyle.mjs";
|
|
10
11
|
// src/createStyle.ts
|
|
11
12
|
const NO_QUERIES = [];
|
|
12
13
|
const NO_KEYS = {
|
|
@@ -109,6 +110,7 @@ function useThemeClass() {}
|
|
|
109
110
|
*/
|
|
110
111
|
function bindHolder(holder, context, options = {}) {
|
|
111
112
|
const { remBase = 16, lengthKeys = DEFAULT_LENGTH_KEYS } = options;
|
|
113
|
+
warnAboutIgnoredOptions(options);
|
|
112
114
|
const { ThemeContext, ThemeValueProvider, useTheme, useCondition } = createThemeValue(holder, (theme) => toNativeTheme(theme, lengthKeys, remBase), context);
|
|
113
115
|
function ThemeProvider({ theme, colorScheme, children }) {
|
|
114
116
|
return createElement(ThemeValueProvider, {
|
package/dist/warnStyle.cjs
CHANGED
|
@@ -92,6 +92,20 @@ function warnAboutQuery(query, problem) {
|
|
|
92
92
|
if (!isDevelopment()) return;
|
|
93
93
|
warnOnce(`useMediaQuery("${query}") is false: React Native does not evaluate ${problem}.`, void 0);
|
|
94
94
|
}
|
|
95
|
+
/** The options of `createStyle` and `configure` that React Native uses; every other option is for the web. */
|
|
96
|
+
const NATIVE_OPTIONS = /* @__PURE__ */ new Set([
|
|
97
|
+
"theme",
|
|
98
|
+
"remBase",
|
|
99
|
+
"lengthKeys"
|
|
100
|
+
]);
|
|
101
|
+
/** In development, warns (once) about the options of `createStyle` or `configure` that React Native does not use, by name. */
|
|
102
|
+
function warnAboutIgnoredOptions(options) {
|
|
103
|
+
if (!isDevelopment()) return;
|
|
104
|
+
const ignored = Object.entries(options).filter(([name, value]) => value !== void 0 && !NATIVE_OPTIONS.has(name)).map(([name]) => name);
|
|
105
|
+
if (ignored.length === 0) return;
|
|
106
|
+
warnOnce(`the options ${ignored.join(", ")} are for the web, and React Native does not use them: they are ignored. Only theme, remBase and lengthKeys are read.`, void 0);
|
|
107
|
+
}
|
|
95
108
|
exports.warnAboutDroppedKey = warnAboutDroppedKey;
|
|
109
|
+
exports.warnAboutIgnoredOptions = warnAboutIgnoredOptions;
|
|
96
110
|
exports.warnAboutQuery = warnAboutQuery;
|
|
97
111
|
exports.warnAboutValues = warnAboutValues;
|
package/dist/warnStyle.mjs
CHANGED
|
@@ -92,4 +92,17 @@ function warnAboutQuery(query, problem) {
|
|
|
92
92
|
if (!isDevelopment()) return;
|
|
93
93
|
warnOnce(`useMediaQuery("${query}") is false: React Native does not evaluate ${problem}.`, void 0);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
/** The options of `createStyle` and `configure` that React Native uses; every other option is for the web. */
|
|
96
|
+
const NATIVE_OPTIONS = /* @__PURE__ */ new Set([
|
|
97
|
+
"theme",
|
|
98
|
+
"remBase",
|
|
99
|
+
"lengthKeys"
|
|
100
|
+
]);
|
|
101
|
+
/** In development, warns (once) about the options of `createStyle` or `configure` that React Native does not use, by name. */
|
|
102
|
+
function warnAboutIgnoredOptions(options) {
|
|
103
|
+
if (!isDevelopment()) return;
|
|
104
|
+
const ignored = Object.entries(options).filter(([name, value]) => value !== void 0 && !NATIVE_OPTIONS.has(name)).map(([name]) => name);
|
|
105
|
+
if (ignored.length === 0) return;
|
|
106
|
+
warnOnce(`the options ${ignored.join(", ")} are for the web, and React Native does not use them: they are ignored. Only theme, remBase and lengthKeys are read.`, void 0);
|
|
107
|
+
}
|
|
108
|
+
export { warnAboutDroppedKey, warnAboutIgnoredOptions, warnAboutQuery, warnAboutValues };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umber-style/react-native",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.2",
|
|
4
4
|
"description": "UmberStyle for React Native: the same names as the React binding, over the real theme values.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"styling",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@umber-style/core": "0.1.0-rc.
|
|
44
|
+
"@umber-style/core": "0.1.0-rc.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^19.2.8",
|