react-native-unistyles 3.0.0-alpha.33 → 3.0.0-alpha.35
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Helpers.h +24 -2
- package/cxx/core/HostStyle.cpp +1 -1
- package/cxx/core/UnistyleWrapper.h +31 -1
- package/cxx/core/UnistylesMountHook.cpp +1 -1
- package/cxx/core/UnistylesMountHook.h +4 -2
- package/cxx/core/UnistylesRegistry.cpp +7 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +1 -2
- package/cxx/hybridObjects/HybridShadowRegistry.h +1 -3
- package/cxx/hybridObjects/HybridStyleSheet.cpp +4 -1
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +12 -0
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
- package/cxx/parser/Parser.cpp +6 -6
- package/cxx/parser/Parser.h +1 -1
- package/cxx/shadowTree/ShadowTrafficController.h +2 -0
- package/lib/commonjs/components/Display.js +18 -0
- package/lib/commonjs/components/Display.js.map +1 -0
- package/lib/commonjs/components/Hide.js +18 -0
- package/lib/commonjs/components/Hide.js.map +1 -0
- package/lib/commonjs/components/index.js +20 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/components/useMedia.js +59 -0
- package/lib/commonjs/components/useMedia.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +2 -1
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.native.js +40 -2
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/commonjs/core/index.js +0 -14
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/global.js +0 -4
- package/lib/commonjs/global.js.map +1 -1
- package/lib/commonjs/index.js +12 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +27 -11
- package/lib/commonjs/mq.js.map +1 -2
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -2
- package/lib/commonjs/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +5 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -2
- package/lib/commonjs/specs/ShadowRegistry/types.js +0 -4
- package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -2
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +4 -2
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +3 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -2
- package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
- package/lib/commonjs/specs/index.web.js.map +1 -2
- package/lib/commonjs/specs/types.js +10 -10
- package/lib/commonjs/specs/types.js.map +1 -1
- package/lib/commonjs/types/accessibility.js +9 -9
- package/lib/commonjs/types/accessibility.js.map +1 -1
- package/lib/commonjs/types/breakpoints.js.map +1 -1
- package/lib/commonjs/types/common.js +0 -4
- package/lib/commonjs/types/common.js.map +1 -1
- package/lib/commonjs/types/core.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -2
- package/lib/commonjs/types/stylesheet.js +2 -1
- package/lib/commonjs/types/stylesheet.js.map +1 -2
- package/lib/commonjs/web/convert/index.js +7 -1
- package/lib/commonjs/web/convert/index.js.map +1 -2
- package/lib/commonjs/web/convert/pseudo.js.map +1 -2
- package/lib/commonjs/web/convert/shadow.js +5 -1
- package/lib/commonjs/web/convert/shadow.js.map +1 -2
- package/lib/commonjs/web/convert/style.js.map +1 -2
- package/lib/commonjs/web/convert/textShadow.js.map +1 -2
- package/lib/commonjs/web/convert/transform.js.map +1 -2
- package/lib/commonjs/web/convert/types.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js +2 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -2
- package/lib/commonjs/web/index.js.map +1 -2
- package/lib/commonjs/web/listener.js.map +1 -2
- package/lib/commonjs/web/mock.js.map +1 -2
- package/lib/commonjs/web/runtime.js.map +1 -2
- package/lib/commonjs/web/shadowRegistry.js +9 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -2
- package/lib/commonjs/web/state.js +5 -1
- package/lib/commonjs/web/utils/common.js +3 -1
- package/lib/commonjs/web/utils/common.js.map +1 -2
- package/lib/commonjs/web/utils/index.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +1 -1
- package/lib/commonjs/web/variants/index.js.map +1 -1
- package/lib/module/common.js.map +1 -1
- package/lib/module/components/Display.js +13 -0
- package/lib/module/components/Display.js.map +1 -0
- package/lib/module/components/Hide.js +13 -0
- package/lib/module/components/Hide.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/components/useMedia.js +54 -0
- package/lib/module/components/useMedia.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +2 -1
- package/lib/module/core/createUnistylesComponent.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.native.js +41 -3
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/module/core/index.js +0 -2
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/global.js +1 -1
- package/lib/module/global.js.map +0 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +21 -11
- package/lib/module/mq.js.map +1 -1
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
- package/lib/module/specs/NativePlatform/index.js.map +1 -1
- package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +0 -1
- package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +0 -1
- package/lib/module/specs/ShadowRegistry/index.js +5 -0
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/types.js +0 -2
- package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
- package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +0 -1
- package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +0 -1
- package/lib/module/specs/index.web.js.map +1 -2
- package/lib/module/specs/types.js.map +0 -1
- package/lib/module/types/accessibility.js +1 -1
- package/lib/module/types/accessibility.js.map +0 -1
- package/lib/module/types/breakpoints.js.map +0 -1
- package/lib/module/types/common.js +1 -1
- package/lib/module/types/common.js.map +0 -1
- package/lib/module/types/core.js.map +0 -1
- package/lib/module/types/index.js.map +1 -2
- package/lib/module/types/stylesheet.js +2 -2
- package/lib/module/types/stylesheet.js.map +1 -2
- package/lib/module/types/variants.js.map +0 -1
- package/lib/module/web/convert/boxShadow.js +4 -1
- package/lib/module/web/convert/boxShadow.js.map +1 -2
- package/lib/module/web/convert/index.js +7 -1
- package/lib/module/web/convert/shadow.js +5 -1
- package/lib/module/web/convert/shadow.js.map +1 -2
- package/lib/module/web/convert/textShadow.js +4 -1
- package/lib/module/web/convert/utils.js +2 -1
- package/lib/module/web/convert/utils.js.map +1 -2
- package/lib/module/web/create.js +5 -1
- package/lib/module/web/create.js.map +1 -2
- package/lib/module/web/index.js +2 -1
- package/lib/module/web/index.js.map +1 -2
- package/lib/module/web/listener.js.map +1 -2
- package/lib/module/web/registry.js +3 -1
- package/lib/module/web/shadowRegistry.js +9 -1
- package/lib/module/web/shadowRegistry.js.map +1 -2
- package/lib/module/web/state.js +5 -1
- package/lib/module/web/state.js.map +1 -2
- package/lib/module/web/utils/common.js +3 -1
- package/lib/module/web/utils/common.js.map +1 -2
- package/lib/module/web/utils/unistyle.js +1 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/variants/getVariants.js.map +1 -2
- package/lib/module/web/variants/index.js.map +1 -1
- package/lib/typescript/src/components/Display.d.ts +7 -0
- package/lib/typescript/src/components/Display.d.ts.map +1 -0
- package/lib/typescript/src/components/Hide.d.ts +7 -0
- package/lib/typescript/src/components/Hide.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +3 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/useMedia.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +3 -2
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +3 -2
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +0 -2
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts +8 -0
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -0
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +2 -0
- package/package.json +1 -1
- package/plugin/ref.js +4 -4
- package/plugin/style.js +15 -3
- package/src/components/Display.tsx +12 -0
- package/src/components/Hide.tsx +12 -0
- package/src/components/index.ts +2 -0
- package/src/components/useMedia.ts +64 -0
- package/src/core/createUnistylesComponent.native.tsx +48 -4
- package/src/core/createUnistylesComponent.tsx +4 -2
- package/src/core/index.ts +0 -2
- package/src/index.ts +2 -1
- package/src/mq.ts +27 -9
- package/src/specs/ShadowRegistry/index.ts +5 -0
- package/src/specs/ShadowRegistry/types.ts +4 -1
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -0
- package/src/web/utils/unistyle.ts +1 -1
- package/lib/commonjs/core/useBreakpoint.js +0 -22
- package/lib/commonjs/core/useBreakpoint.js.map +0 -1
- package/lib/commonjs/core/useBreakpoint.native.js +0 -24
- package/lib/commonjs/core/useBreakpoint.native.js.map +0 -1
- package/lib/commonjs/core/useTheme.js +0 -22
- package/lib/commonjs/core/useTheme.js.map +0 -2
- package/lib/commonjs/core/useTheme.native.js +0 -24
- package/lib/commonjs/core/useTheme.native.js.map +0 -1
- package/lib/commonjs/web/mq.js +0 -23
- package/lib/commonjs/web/mq.js.map +0 -1
- package/lib/module/core/useBreakpoint.js +0 -17
- package/lib/module/core/useBreakpoint.js.map +0 -1
- package/lib/module/core/useBreakpoint.native.js +0 -19
- package/lib/module/core/useBreakpoint.native.js.map +0 -2
- package/lib/module/core/useTheme.js +0 -17
- package/lib/module/core/useTheme.js.map +0 -2
- package/lib/module/core/useTheme.native.js +0 -19
- package/lib/module/core/useTheme.native.js.map +0 -1
- package/lib/module/web/mq.js +0 -17
- package/lib/module/web/mq.js.map +0 -1
- package/lib/typescript/src/core/useBreakpoint.d.ts +0 -2
- package/lib/typescript/src/core/useBreakpoint.d.ts.map +0 -1
- package/lib/typescript/src/core/useBreakpoint.native.d.ts +0 -2
- package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +0 -1
- package/lib/typescript/src/core/useTheme.d.ts +0 -3
- package/lib/typescript/src/core/useTheme.d.ts.map +0 -1
- package/lib/typescript/src/core/useTheme.native.d.ts +0 -3
- package/lib/typescript/src/core/useTheme.native.d.ts.map +0 -1
- package/lib/typescript/src/web/mq.d.ts +0 -8
- package/lib/typescript/src/web/mq.d.ts.map +0 -1
- package/src/common.js +0 -4
- package/src/core/createUnistylesComponent.js +0 -6
- package/src/core/createUnistylesComponent.native.js +0 -31
- package/src/core/index.js +0 -3
- package/src/core/useBreakpoint.js +0 -14
- package/src/core/useBreakpoint.native.js +0 -16
- package/src/core/useBreakpoint.native.ts +0 -21
- package/src/core/useBreakpoint.ts +0 -18
- package/src/core/useTheme.js +0 -14
- package/src/core/useTheme.native.js +0 -16
- package/src/core/useTheme.native.ts +0 -22
- package/src/core/useTheme.ts +0 -19
- package/src/global.js +0 -1
- package/src/index.js +0 -3
- package/src/mq.js +0 -38
- package/src/specs/NativePlatform/NativePlatform.nitro.js +0 -19
- package/src/specs/NativePlatform/index.js +0 -1
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +0 -1
- package/src/specs/NavigtionBar/index.js +0 -9
- package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +0 -1
- package/src/specs/ShadowRegistry/index.js +0 -26
- package/src/specs/ShadowRegistry/types.js +0 -1
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +0 -1
- package/src/specs/StatusBar/index.js +0 -25
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +0 -1
- package/src/specs/StyleSheet/index.js +0 -13
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +0 -2
- package/src/specs/TurboUnistyles/index.js +0 -1
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +0 -1
- package/src/specs/UnistylesRuntime/index.js +0 -20
- package/src/specs/index.js +0 -8
- package/src/specs/index.web.js +0 -2
- package/src/specs/types.js +0 -17
- package/src/types/accessibility.js +0 -30
- package/src/types/breakpoints.js +0 -1
- package/src/types/common.js +0 -1
- package/src/types/core.js +0 -1
- package/src/types/index.js +0 -1
- package/src/types/stylesheet.js +0 -2
- package/src/types/variants.js +0 -1
- package/src/web/convert/boxShadow.js +0 -59
- package/src/web/convert/index.js +0 -56
- package/src/web/convert/pseudo.js +0 -131
- package/src/web/convert/shadow.js +0 -50
- package/src/web/convert/style.js +0 -137
- package/src/web/convert/textShadow.js +0 -56
- package/src/web/convert/transform.js +0 -65
- package/src/web/convert/types.js +0 -2
- package/src/web/convert/utils.js +0 -39
- package/src/web/create.js +0 -36
- package/src/web/index.js +0 -22
- package/src/web/listener.js +0 -26
- package/src/web/mock.js +0 -21
- package/src/web/mq.js +0 -14
- package/src/web/mq.ts +0 -17
- package/src/web/registry.js +0 -165
- package/src/web/runtime.js +0 -160
- package/src/web/shadowRegistry.js +0 -96
- package/src/web/state.js +0 -68
- package/src/web/utils/common.js +0 -79
- package/src/web/utils/index.js +0 -2
- package/src/web/utils/unistyle.js +0 -72
- package/src/web/variants/getVariants.js +0 -26
- package/src/web/variants/index.js +0 -2
- package/src/web/variants/useVariants.js +0 -50
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { UnistyleDependency } from '../../specs/NativePlatform'
|
2
2
|
import { ColorScheme, Orientation } from '../../specs/types'
|
3
3
|
import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../../types/stylesheet'
|
4
|
-
import { isUnistylesMq, parseMq } from '
|
4
|
+
import { isUnistylesMq, parseMq } from '../../mq'
|
5
5
|
import { UnistylesState } from '../state'
|
6
6
|
import { keyInObject, reduceObject } from './common'
|
7
7
|
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useBreakpoint = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _web = require("../web");
|
9
|
-
var _listener = require("../web/listener");
|
10
|
-
var _NativePlatform = require("../specs/NativePlatform");
|
11
|
-
const useBreakpoint = () => {
|
12
|
-
const [breakpoint, setBreakpoint] = (0, _react.useState)(_web.UnistylesRuntime.breakpoint);
|
13
|
-
(0, _react.useEffect)(() => {
|
14
|
-
const removeChangeListener = _listener.UnistylesListener.addListeners([_NativePlatform.UnistyleDependency.Breakpoints], () => setBreakpoint(_web.UnistylesRuntime.breakpoint));
|
15
|
-
return () => {
|
16
|
-
removeChangeListener();
|
17
|
-
};
|
18
|
-
}, []);
|
19
|
-
return breakpoint;
|
20
|
-
};
|
21
|
-
exports.useBreakpoint = useBreakpoint;
|
22
|
-
//# sourceMappingURL=useBreakpoint.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_web","_listener","_NativePlatform","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","UnistylesListener","addListeners","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACO,MAAMI,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACC,qBAAgB,CAACH,UAAU,CAAC;EACzE,IAAAI,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAGC,2BAAiB,CAACC,YAAY,CAAC,CAACC,kCAAkB,CAACC,WAAW,CAAC,EAAE,MAAMR,aAAa,CAACE,qBAAgB,CAACH,UAAU,CAAC,CAAC;IAC/I,OAAO,MAAM;MACTK,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOL,UAAU;AACrB,CAAC;AAACU,OAAA,CAAAX,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useBreakpoint = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _specs = require("../specs");
|
9
|
-
const useBreakpoint = () => {
|
10
|
-
const [breakpoint, setBreakpoint] = (0, _react.useState)(_specs.UnistylesRuntime.breakpoint);
|
11
|
-
(0, _react.useEffect)(() => {
|
12
|
-
const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
|
13
|
-
if (dependencies.includes(_specs.UnistyleDependency.Breakpoints)) {
|
14
|
-
setBreakpoint(_specs.UnistylesRuntime.breakpoint);
|
15
|
-
}
|
16
|
-
});
|
17
|
-
return () => {
|
18
|
-
removeChangeListener();
|
19
|
-
};
|
20
|
-
}, []);
|
21
|
-
return breakpoint;
|
22
|
-
};
|
23
|
-
exports.useBreakpoint = useBreakpoint;
|
24
|
-
//# sourceMappingURL=useBreakpoint.native.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_specs","useBreakpoint","breakpoint","setBreakpoint","useState","UnistylesRuntime","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Breakpoints","exports"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.native.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGO,MAAME,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACC,uBAAgB,CAACH,UAAU,CAAC;EAEzE,IAAAI,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,WAAW,CAAC,EAAE;QACvDV,aAAa,CAACE,uBAAgB,CAACH,UAAU,CAAC;MAC9C;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTK,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,UAAU;AACrB,CAAC;AAAAY,OAAA,CAAAb,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useTheme = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _web = require("../web");
|
9
|
-
var _listener = require("../web/listener");
|
10
|
-
var _NativePlatform = require("../specs/NativePlatform");
|
11
|
-
const useTheme = () => {
|
12
|
-
const [theme, setTheme] = (0, _react.useState)(_web.UnistylesRuntime.getTheme());
|
13
|
-
(0, _react.useEffect)(() => {
|
14
|
-
const removeChangeListener = _listener.UnistylesListener.addListeners([_NativePlatform.UnistyleDependency.Theme], () => setTheme(_web.UnistylesRuntime.getTheme()));
|
15
|
-
return () => {
|
16
|
-
removeChangeListener();
|
17
|
-
};
|
18
|
-
}, []);
|
19
|
-
return theme;
|
20
|
-
};
|
21
|
-
exports.useTheme = useTheme;
|
22
|
-
//# sourceMappingURL=useTheme.js.map
|
@@ -1,2 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_web","_listener","_NativePlatform","useTheme","theme","setTheme","useState","UnistylesRuntime","getTheme","useEffect","removeChangeListener","UnistylesListener","addListeners","UnistyleDependency","Theme","exports"],"sourceRoot":"../../../src","sources":["core/useTheme.js"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACO,MAAMI,QAAQ,GAAGA,CAAA,KAAM;EAC1B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,qBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC;EAC/D,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAGC,2BAAiB,CAACC,YAAY,CAAC,CAACC,kCAAkB,CAACC,KAAK,CAAC,EAAE,MAAMT,QAAQ,CAACE,qBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpI,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAON,KAAK;AAChB,CAAC;AAACW,OAAA,CAAAZ,QAAA,GAAAA,QAAA","ignoreList":[]}
|
2
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.useTheme = void 0;
|
7
|
-
var _react = require("react");
|
8
|
-
var _specs = require("../specs");
|
9
|
-
const useTheme = () => {
|
10
|
-
const [theme, setTheme] = (0, _react.useState)(_specs.UnistylesRuntime.getTheme());
|
11
|
-
(0, _react.useEffect)(() => {
|
12
|
-
const removeChangeListener = _specs.StyleSheet.addChangeListener(dependencies => {
|
13
|
-
if (dependencies.includes(_specs.UnistyleDependency.Theme)) {
|
14
|
-
setTheme(_specs.UnistylesRuntime.getTheme());
|
15
|
-
}
|
16
|
-
});
|
17
|
-
return () => {
|
18
|
-
removeChangeListener();
|
19
|
-
};
|
20
|
-
}, []);
|
21
|
-
return theme;
|
22
|
-
};
|
23
|
-
exports.useTheme = useTheme;
|
24
|
-
//# sourceMappingURL=useTheme.native.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["_react","require","_specs","useTheme","theme","setTheme","useState","UnistylesRuntime","getTheme","useEffect","removeChangeListener","StyleSheet","addChangeListener","dependencies","includes","UnistyleDependency","Theme","exports"],"sourceRoot":"../../../src","sources":["core/useTheme.native.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAIO,MAAME,QAAQ,GAAGA,CAAA,KAAsB;EAC1C,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,uBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC;EAE/D,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,oBAAoB,GAAIC,iBAAU,CAAyBC,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACC,yBAAkB,CAACC,KAAK,CAAC,EAAE;QACjDX,QAAQ,CAACE,uBAAgB,CAACC,QAAQ,CAAC,CAAC,CAAC;MACzC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAON,KAAK;AAChB,CAAC;AAAAa,OAAA,CAAAd,QAAA,GAAAA,QAAA","ignoreList":[]}
|
package/lib/commonjs/web/mq.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.parseMq = exports.isUnistylesMq = void 0;
|
7
|
-
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
8
|
-
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
9
|
-
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
10
|
-
const parseMq = mq => {
|
11
|
-
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
12
|
-
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
13
|
-
return {
|
14
|
-
minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
|
15
|
-
maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
|
16
|
-
minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
|
17
|
-
maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
|
18
|
-
};
|
19
|
-
};
|
20
|
-
exports.parseMq = parseMq;
|
21
|
-
const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
22
|
-
exports.isUnistylesMq = isUnistylesMq;
|
23
|
-
//# sourceMappingURL=mq.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","exports","isUnistylesMq","test"],"sourceRoot":"../../../src","sources":["web/mq.js"],"mappings":";;;;;;AAAA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAC7D,MAAMC,OAAO,GAAIC,EAAE,IAAK;EAC3B,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EACpE,OAAO;IACHQ,QAAQ,EAAE,CAACP,KAAK,IAAIC,KAAK,KAAK,UAAU,GAAGO,SAAS,GAAGC,MAAM,CAACR,KAAK,CAAC;IACpES,QAAQ,EAAE,CAACV,KAAK,IAAIE,GAAG,KAAK,UAAU,GAAGM,SAAS,GAAGC,MAAM,CAACP,GAAG,CAAC;IAChES,SAAS,EAAE,CAACP,MAAM,IAAIC,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACR,MAAM,IAAIE,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAACO,OAAA,CAAAf,OAAA,GAAAA,OAAA;AACK,MAAMgB,aAAa,GAAIf,EAAE,IAAKJ,kBAAkB,CAACoB,IAAI,CAAChB,EAAE,CAAC;AAACc,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
import { useEffect, useState } from 'react';
|
4
|
-
import { UnistylesRuntime } from '../web';
|
5
|
-
import { UnistylesListener } from '../web/listener';
|
6
|
-
import { UnistyleDependency } from '../specs/NativePlatform';
|
7
|
-
export const useBreakpoint = () => {
|
8
|
-
const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
|
9
|
-
useEffect(() => {
|
10
|
-
const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Breakpoints], () => setBreakpoint(UnistylesRuntime.breakpoint));
|
11
|
-
return () => {
|
12
|
-
removeChangeListener();
|
13
|
-
};
|
14
|
-
}, []);
|
15
|
-
return breakpoint;
|
16
|
-
};
|
17
|
-
//# sourceMappingURL=useBreakpoint.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useState","UnistylesRuntime","UnistylesListener","UnistyleDependency","useBreakpoint","breakpoint","setBreakpoint","removeChangeListener","addListeners","Breakpoints"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,QAAQ;AACzC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGN,QAAQ,CAACC,gBAAgB,CAACI,UAAU,CAAC;EAEzEN,SAAS,CAAC,MAAM;IACZ,MAAMQ,oBAAoB,GAAGL,iBAAiB,CAACM,YAAY,CAAC,CAACL,kBAAkB,CAACM,WAAW,CAAC,EAAE,MAAMH,aAAa,CAACL,gBAAgB,CAACI,UAAU,CAAC,CAAC;IAE/I,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOF,UAAU;AACrB,CAAC","ignoreList":[]}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
import { useEffect, useState } from 'react';
|
4
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
5
|
-
export const useBreakpoint = () => {
|
6
|
-
const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
|
7
|
-
useEffect(() => {
|
8
|
-
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
9
|
-
if (dependencies.includes(UnistyleDependency.Breakpoints)) {
|
10
|
-
setBreakpoint(UnistylesRuntime.breakpoint);
|
11
|
-
}
|
12
|
-
});
|
13
|
-
return () => {
|
14
|
-
removeChangeListener();
|
15
|
-
};
|
16
|
-
}, []);
|
17
|
-
return breakpoint;
|
18
|
-
};
|
19
|
-
//# sourceMappingURL=useBreakpoint.native.js.map
|
@@ -1,2 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","useBreakpoint","breakpoint","setBreakpoint","removeChangeListener","addChangeListener","dependencies","includes","Breakpoints"],"sourceRoot":"../../../src","sources":["core/useBreakpoint.native.js"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,UAAU;AAC3E,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC/B,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGN,QAAQ,CAACG,gBAAgB,CAACE,UAAU,CAAC;EACzEN,SAAS,CAAC,MAAM;IACZ,MAAMQ,oBAAoB,GAAGN,UAAU,CAACO,iBAAiB,CAACC,YAAY,IAAI;MACtE,IAAIA,YAAY,CAACC,QAAQ,CAACR,kBAAkB,CAACS,WAAW,CAAC,EAAE;QACvDL,aAAa,CAACH,gBAAgB,CAACE,UAAU,CAAC;MAC9C;IACJ,CAAC,CAAC;IACF,OAAO,MAAM;MACTE,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOF,UAAU;AACrB,CAAC","ignoreList":[]}
|
2
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
import { useEffect, useState } from 'react';
|
4
|
-
import { UnistylesRuntime } from '../web';
|
5
|
-
import { UnistylesListener } from '../web/listener';
|
6
|
-
import { UnistyleDependency } from '../specs/NativePlatform';
|
7
|
-
export const useTheme = () => {
|
8
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
9
|
-
useEffect(() => {
|
10
|
-
const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Theme], () => setTheme(UnistylesRuntime.getTheme()));
|
11
|
-
return () => {
|
12
|
-
removeChangeListener();
|
13
|
-
};
|
14
|
-
}, []);
|
15
|
-
return theme;
|
16
|
-
};
|
17
|
-
//# sourceMappingURL=useTheme.js.map
|
@@ -1,2 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useState","UnistylesRuntime","UnistylesListener","UnistyleDependency","useTheme","theme","setTheme","getTheme","removeChangeListener","addListeners","Theme"],"sourceRoot":"../../../src","sources":["core/useTheme.js"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,gBAAgB,QAAQ,QAAQ;AACzC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EAC1B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,QAAQ,CAACC,gBAAgB,CAACM,QAAQ,CAAC,CAAC,CAAC;EAC/DR,SAAS,CAAC,MAAM;IACZ,MAAMS,oBAAoB,GAAGN,iBAAiB,CAACO,YAAY,CAAC,CAACN,kBAAkB,CAACO,KAAK,CAAC,EAAE,MAAMJ,QAAQ,CAACL,gBAAgB,CAACM,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpI,OAAO,MAAM;MACTC,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
|
2
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
import { useEffect, useState } from 'react';
|
4
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
5
|
-
export const useTheme = () => {
|
6
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
7
|
-
useEffect(() => {
|
8
|
-
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
9
|
-
if (dependencies.includes(UnistyleDependency.Theme)) {
|
10
|
-
setTheme(UnistylesRuntime.getTheme());
|
11
|
-
}
|
12
|
-
});
|
13
|
-
return () => {
|
14
|
-
removeChangeListener();
|
15
|
-
};
|
16
|
-
}, []);
|
17
|
-
return theme;
|
18
|
-
};
|
19
|
-
//# sourceMappingURL=useTheme.native.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["useEffect","useState","StyleSheet","UnistyleDependency","UnistylesRuntime","useTheme","theme","setTheme","getTheme","removeChangeListener","addChangeListener","dependencies","includes","Theme"],"sourceRoot":"../../../src","sources":["core/useTheme.native.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,UAAU,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ,UAAU;AAI3E,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAsB;EAC1C,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,QAAQ,CAACG,gBAAgB,CAACI,QAAQ,CAAC,CAAC,CAAC;EAE/DR,SAAS,CAAC,MAAM;IACZ,MAAMS,oBAAoB,GAAIP,UAAU,CAAyBQ,iBAAiB,CAACC,YAAY,IAAI;MAC/F,IAAIA,YAAY,CAACC,QAAQ,CAACT,kBAAkB,CAACU,KAAK,CAAC,EAAE;QACjDN,QAAQ,CAACH,gBAAgB,CAACI,QAAQ,CAAC,CAAC,CAAC;MACzC;IACJ,CAAC,CAAC;IAEF,OAAO,MAAM;MACTC,oBAAoB,CAAC,CAAC;IAC1B,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
|
package/lib/module/web/mq.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
4
|
-
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
5
|
-
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
6
|
-
export const parseMq = mq => {
|
7
|
-
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
8
|
-
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
9
|
-
return {
|
10
|
-
minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
|
11
|
-
maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
|
12
|
-
minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
|
13
|
-
maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
|
14
|
-
};
|
15
|
-
};
|
16
|
-
export const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
17
|
-
//# sourceMappingURL=mq.js.map
|
package/lib/module/web/mq.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","isUnistylesMq","test"],"sourceRoot":"../../../src","sources":["web/mq.ts"],"mappings":";;AAAA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAEpE,OAAO,MAAMC,OAAO,GAAIC,EAAU,IAAK;EACnC,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHQ,QAAQ,EAAE,CAACP,KAAK,IAAIC,KAAK,KAAK,UAAU,GAAGO,SAAS,GAAGC,MAAM,CAACR,KAAK,CAAC;IACpES,QAAQ,EAAE,CAACV,KAAK,IAAIE,GAAG,KAAK,UAAU,GAAGM,SAAS,GAAGC,MAAM,CAACP,GAAG,CAAC;IAChES,SAAS,EAAE,CAACP,MAAM,IAAIC,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACR,MAAM,IAAIE,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAED,OAAO,MAAMO,aAAa,GAAId,EAAU,IAAKJ,kBAAkB,CAACmB,IAAI,CAACf,EAAE,CAAC","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../../../src/core/useBreakpoint.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,4CAYzB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useBreakpoint.native.d.ts","sourceRoot":"","sources":["../../../../src/core/useBreakpoint.native.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,4CAgBzB,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../src/core/useTheme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,eAAO,MAAM,QAAQ,QAAO,cAY3B,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useTheme.native.d.ts","sourceRoot":"","sources":["../../../../src/core/useTheme.native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,eAAO,MAAM,QAAQ,QAAO,cAgB3B,CAAA"}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare const parseMq: (mq: string) => {
|
2
|
-
minWidth: number | undefined;
|
3
|
-
maxWidth: number | undefined;
|
4
|
-
minHeight: number | undefined;
|
5
|
-
maxHeight: number | undefined;
|
6
|
-
};
|
7
|
-
export declare const isUnistylesMq: (mq: string) => boolean;
|
8
|
-
//# sourceMappingURL=mq.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/web/mq.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,OAAQ,MAAM;;;;;CAUjC,CAAA;AAED,eAAO,MAAM,aAAa,OAAQ,MAAM,YAAgC,CAAA"}
|
package/src/common.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
2
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
3
|
-
export const createUnistylesComponent = (Component, mappings) => {
|
4
|
-
return (props) => {
|
5
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
6
|
-
const [, setRt] = useState(0);
|
7
|
-
useEffect(() => {
|
8
|
-
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
9
|
-
const componentDependencies = (props.style?.uni__dependencies || mappings(theme).style?.uni__dependencies);
|
10
|
-
if (dependencies.includes(UnistyleDependency.Theme) && (!componentDependencies || componentDependencies.includes(UnistyleDependency.Theme))) {
|
11
|
-
setTheme(UnistylesRuntime.getTheme());
|
12
|
-
}
|
13
|
-
if (dependencies.some(dependency => dependency >= 2) && (!componentDependencies || componentDependencies.some(dependency => dependency >= 2))) {
|
14
|
-
setRt(prevState => prevState + 1);
|
15
|
-
}
|
16
|
-
});
|
17
|
-
return () => {
|
18
|
-
removeChangeListener();
|
19
|
-
};
|
20
|
-
}, []);
|
21
|
-
const mergedProps = { ...mappings(theme) };
|
22
|
-
Object.keys(props).forEach(key => {
|
23
|
-
if (key in mergedProps) {
|
24
|
-
mergedProps[key] = Object.assign(props[key], mergedProps[key]);
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
mergedProps[key] = props[key];
|
28
|
-
});
|
29
|
-
return React.createElement(Component, { ...mergedProps });
|
30
|
-
};
|
31
|
-
};
|
package/src/core/index.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import { UnistylesRuntime } from '../web';
|
3
|
-
import { UnistylesListener } from '../web/listener';
|
4
|
-
import { UnistyleDependency } from '../specs/NativePlatform';
|
5
|
-
export const useBreakpoint = () => {
|
6
|
-
const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
|
7
|
-
useEffect(() => {
|
8
|
-
const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Breakpoints], () => setBreakpoint(UnistylesRuntime.breakpoint));
|
9
|
-
return () => {
|
10
|
-
removeChangeListener();
|
11
|
-
};
|
12
|
-
}, []);
|
13
|
-
return breakpoint;
|
14
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
3
|
-
export const useBreakpoint = () => {
|
4
|
-
const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint);
|
5
|
-
useEffect(() => {
|
6
|
-
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
7
|
-
if (dependencies.includes(UnistyleDependency.Breakpoints)) {
|
8
|
-
setBreakpoint(UnistylesRuntime.breakpoint);
|
9
|
-
}
|
10
|
-
});
|
11
|
-
return () => {
|
12
|
-
removeChangeListener();
|
13
|
-
};
|
14
|
-
}, []);
|
15
|
-
return breakpoint;
|
16
|
-
};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react'
|
2
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
|
3
|
-
import type { UnistylesStyleSheet } from '../specs'
|
4
|
-
|
5
|
-
export const useBreakpoint = () => {
|
6
|
-
const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint)
|
7
|
-
|
8
|
-
useEffect(() => {
|
9
|
-
const removeChangeListener = (StyleSheet as UnistylesStyleSheet).addChangeListener(dependencies => {
|
10
|
-
if (dependencies.includes(UnistyleDependency.Breakpoints)) {
|
11
|
-
setBreakpoint(UnistylesRuntime.breakpoint)
|
12
|
-
}
|
13
|
-
})
|
14
|
-
|
15
|
-
return () => {
|
16
|
-
removeChangeListener()
|
17
|
-
}
|
18
|
-
}, [])
|
19
|
-
|
20
|
-
return breakpoint
|
21
|
-
}
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react'
|
2
|
-
import { UnistylesRuntime } from '../web'
|
3
|
-
import { UnistylesListener } from '../web/listener'
|
4
|
-
import { UnistyleDependency } from '../specs/NativePlatform'
|
5
|
-
|
6
|
-
export const useBreakpoint = () => {
|
7
|
-
const [breakpoint, setBreakpoint] = useState(UnistylesRuntime.breakpoint)
|
8
|
-
|
9
|
-
useEffect(() => {
|
10
|
-
const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Breakpoints], () => setBreakpoint(UnistylesRuntime.breakpoint))
|
11
|
-
|
12
|
-
return () => {
|
13
|
-
removeChangeListener()
|
14
|
-
}
|
15
|
-
}, [])
|
16
|
-
|
17
|
-
return breakpoint
|
18
|
-
}
|
package/src/core/useTheme.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import { UnistylesRuntime } from '../web';
|
3
|
-
import { UnistylesListener } from '../web/listener';
|
4
|
-
import { UnistyleDependency } from '../specs/NativePlatform';
|
5
|
-
export const useTheme = () => {
|
6
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
7
|
-
useEffect(() => {
|
8
|
-
const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Theme], () => setTheme(UnistylesRuntime.getTheme()));
|
9
|
-
return () => {
|
10
|
-
removeChangeListener();
|
11
|
-
};
|
12
|
-
}, []);
|
13
|
-
return theme;
|
14
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react';
|
2
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs';
|
3
|
-
export const useTheme = () => {
|
4
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme());
|
5
|
-
useEffect(() => {
|
6
|
-
const removeChangeListener = StyleSheet.addChangeListener(dependencies => {
|
7
|
-
if (dependencies.includes(UnistyleDependency.Theme)) {
|
8
|
-
setTheme(UnistylesRuntime.getTheme());
|
9
|
-
}
|
10
|
-
});
|
11
|
-
return () => {
|
12
|
-
removeChangeListener();
|
13
|
-
};
|
14
|
-
}, []);
|
15
|
-
return theme;
|
16
|
-
};
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react'
|
2
|
-
import { StyleSheet, UnistyleDependency, UnistylesRuntime } from '../specs'
|
3
|
-
import type { UnistylesStyleSheet } from '../specs'
|
4
|
-
import type { UnistylesTheme } from '../types'
|
5
|
-
|
6
|
-
export const useTheme = (): UnistylesTheme => {
|
7
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme())
|
8
|
-
|
9
|
-
useEffect(() => {
|
10
|
-
const removeChangeListener = (StyleSheet as UnistylesStyleSheet).addChangeListener(dependencies => {
|
11
|
-
if (dependencies.includes(UnistyleDependency.Theme)) {
|
12
|
-
setTheme(UnistylesRuntime.getTheme())
|
13
|
-
}
|
14
|
-
})
|
15
|
-
|
16
|
-
return () => {
|
17
|
-
removeChangeListener()
|
18
|
-
}
|
19
|
-
}, [])
|
20
|
-
|
21
|
-
return theme
|
22
|
-
}
|
package/src/core/useTheme.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { useEffect, useState } from 'react'
|
2
|
-
import { UnistylesRuntime } from '../web'
|
3
|
-
import { UnistylesListener } from '../web/listener'
|
4
|
-
import { UnistyleDependency } from '../specs/NativePlatform'
|
5
|
-
import type { UnistylesTheme } from '../types'
|
6
|
-
|
7
|
-
export const useTheme = (): UnistylesTheme => {
|
8
|
-
const [theme, setTheme] = useState(UnistylesRuntime.getTheme())
|
9
|
-
|
10
|
-
useEffect(() => {
|
11
|
-
const removeChangeListener = UnistylesListener.addListeners([UnistyleDependency.Theme], () => setTheme(UnistylesRuntime.getTheme()))
|
12
|
-
|
13
|
-
return () => {
|
14
|
-
removeChangeListener()
|
15
|
-
}
|
16
|
-
}, [])
|
17
|
-
|
18
|
-
return theme
|
19
|
-
}
|
package/src/global.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/src/index.js
DELETED
package/src/mq.js
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
const getMQValue = (value) => {
|
2
|
-
if (typeof value === 'number') {
|
3
|
-
return value;
|
4
|
-
}
|
5
|
-
if (value === null) {
|
6
|
-
return 0;
|
7
|
-
}
|
8
|
-
// todo take it from js
|
9
|
-
const breakpoints = {
|
10
|
-
xs: 0,
|
11
|
-
sm: 300,
|
12
|
-
md: 500,
|
13
|
-
lg: 800,
|
14
|
-
xl: 1200
|
15
|
-
};
|
16
|
-
// @ts-ignore
|
17
|
-
return breakpoints[value] ?? 0;
|
18
|
-
};
|
19
|
-
/**
|
20
|
-
* Utility to create cross-platform media queries
|
21
|
-
* @returns - JavaScript symbol to be used in your stylesheet
|
22
|
-
*/
|
23
|
-
export const mq = {
|
24
|
-
only: {
|
25
|
-
width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`,
|
26
|
-
height: (hMin = 0, hMax = Infinity) => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
|
27
|
-
},
|
28
|
-
width: (wMin = 0, wMax = Infinity) => ({
|
29
|
-
and: {
|
30
|
-
height: (hMin = 0, hMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
|
31
|
-
}
|
32
|
-
}),
|
33
|
-
height: (hMin = 0, hMax = Infinity) => ({
|
34
|
-
and: {
|
35
|
-
width: (wMin = 0, wMax = Infinity) => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
|
36
|
-
}
|
37
|
-
})
|
38
|
-
};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import {} from '../types';
|
2
|
-
export var UnistyleDependency;
|
3
|
-
(function (UnistyleDependency) {
|
4
|
-
UnistyleDependency[UnistyleDependency["Theme"] = 0] = "Theme";
|
5
|
-
UnistyleDependency[UnistyleDependency["ThemeName"] = 1] = "ThemeName";
|
6
|
-
UnistyleDependency[UnistyleDependency["AdaptiveThemes"] = 2] = "AdaptiveThemes";
|
7
|
-
UnistyleDependency[UnistyleDependency["Breakpoints"] = 3] = "Breakpoints";
|
8
|
-
UnistyleDependency[UnistyleDependency["Variants"] = 4] = "Variants";
|
9
|
-
UnistyleDependency[UnistyleDependency["ColorScheme"] = 5] = "ColorScheme";
|
10
|
-
UnistyleDependency[UnistyleDependency["Dimensions"] = 6] = "Dimensions";
|
11
|
-
UnistyleDependency[UnistyleDependency["Orientation"] = 7] = "Orientation";
|
12
|
-
UnistyleDependency[UnistyleDependency["ContentSizeCategory"] = 8] = "ContentSizeCategory";
|
13
|
-
UnistyleDependency[UnistyleDependency["Insets"] = 9] = "Insets";
|
14
|
-
UnistyleDependency[UnistyleDependency["PixelRatio"] = 10] = "PixelRatio";
|
15
|
-
UnistyleDependency[UnistyleDependency["FontScale"] = 11] = "FontScale";
|
16
|
-
UnistyleDependency[UnistyleDependency["StatusBar"] = 12] = "StatusBar";
|
17
|
-
UnistyleDependency[UnistyleDependency["NavigationBar"] = 13] = "NavigationBar";
|
18
|
-
UnistyleDependency[UnistyleDependency["Ime"] = 14] = "Ime";
|
19
|
-
})(UnistyleDependency || (UnistyleDependency = {}));
|
@@ -1 +0,0 @@
|
|
1
|
-
export { UnistyleDependency } from './NativePlatform.nitro';
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { processColor } from 'react-native';
|
2
|
-
export const attachNavigationBarJSMethods = (hybridObject) => {
|
3
|
-
const privateHybrid = hybridObject;
|
4
|
-
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
|
5
|
-
hybridObject.setBackgroundColor = (color) => {
|
6
|
-
const parsedColor = processColor(color) ?? 0;
|
7
|
-
privateHybrid._setBackgroundColor(parsedColor);
|
8
|
-
};
|
9
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|