react-native-unistyles 2.0.0-alpha.2 → 2.0.0-alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- package/ios/UnistylesHelpers.h +4 -0
- package/ios/UnistylesHelpers.mm +20 -0
- package/ios/UnistylesModule.h +2 -2
- package/ios/UnistylesModule.mm +83 -38
- package/lib/commonjs/UnistyleRegistry.js +15 -7
- package/lib/commonjs/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/UnistylesRuntime.js +29 -15
- package/lib/commonjs/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/hooks/useDimensions.web.js +7 -5
- package/lib/commonjs/hooks/useDimensions.web.js.map +1 -1
- package/lib/commonjs/index.js +4 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/cxx.js +9 -5
- package/lib/commonjs/types/cxx.js.map +1 -1
- package/lib/commonjs/useInitialTheme.js +1 -1
- package/lib/commonjs/useInitialTheme.js.map +1 -1
- package/lib/commonjs/useUnistyles.js +5 -7
- package/lib/commonjs/useUnistyles.js.map +1 -1
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/module/UnistyleRegistry.js +15 -7
- package/lib/module/UnistyleRegistry.js.map +1 -1
- package/lib/module/UnistylesRuntime.js +30 -16
- package/lib/module/UnistylesRuntime.js.map +1 -1
- package/lib/module/hooks/useDimensions.web.js +8 -6
- package/lib/module/hooks/useDimensions.web.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/cxx.js +8 -4
- package/lib/module/types/cxx.js.map +1 -1
- package/lib/module/useInitialTheme.js +2 -2
- package/lib/module/useInitialTheme.js.map +1 -1
- package/lib/module/useUnistyles.js +5 -7
- package/lib/module/useUnistyles.js.map +1 -1
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/typescript/src/UnistyleRegistry.d.ts +3 -2
- package/lib/typescript/src/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/UnistylesRuntime.d.ts +14 -46
- package/lib/typescript/src/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/global.d.ts +1 -0
- package/lib/typescript/src/global.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/cxx.d.ts +21 -13
- package/lib/typescript/src/types/cxx.d.ts.map +1 -1
- package/lib/typescript/src/useStyles.d.ts +3 -39
- package/lib/typescript/src/useStyles.d.ts.map +1 -1
- package/lib/typescript/src/useUnistyles.d.ts +2 -38
- package/lib/typescript/src/useUnistyles.d.ts.map +1 -1
- package/package.json +12 -13
- package/react-native-unistyles.podspec +2 -1
- package/src/UnistyleRegistry.ts +19 -8
- package/src/UnistylesRuntime.ts +31 -16
- package/src/global.ts +3 -1
- package/src/hooks/useDimensions.web.ts +9 -6
- package/src/index.ts +4 -2
- package/src/types/cxx.ts +25 -14
- package/src/useInitialTheme.ts +2 -2
- package/src/useUnistyles.ts +5 -6
- package/src/utils/breakpoints.ts +1 -1
- package/ios/UnistylesRuntime.h +0 -30
- package/ios/UnistylesRuntime.mm +0 -191
- package/lib/typescript/examples/expo/src/App.d.ts +0 -3
- package/lib/typescript/examples/expo/src/App.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/Cxx.d.ts +0 -3
- package/lib/typescript/examples/expo/src/examples/Cxx.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/examples/index.d.ts +0 -2
- package/lib/typescript/examples/expo/src/examples/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/index.d.ts +0 -2
- package/lib/typescript/examples/expo/src/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +0 -8
- package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/index.d.ts +0 -16
- package/lib/typescript/examples/expo/src/styles/index.d.ts.map +0 -1
- package/lib/typescript/examples/expo/src/styles/theme.d.ts +0 -40
- package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +0 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import { UnistylesError } from './types';
|
1
|
+
import { ScreenOrientation, UnistylesError } from './types';
|
2
2
|
export class UnistylesRuntime {
|
3
3
|
constructor(unistylesBridge, registry) {
|
4
4
|
this.unistylesBridge = unistylesBridge;
|
@@ -7,39 +7,53 @@ export class UnistylesRuntime {
|
|
7
7
|
get colorScheme() {
|
8
8
|
return this.unistylesBridge.colorScheme;
|
9
9
|
}
|
10
|
-
get
|
11
|
-
return this.
|
10
|
+
get hasAdaptiveThemes() {
|
11
|
+
return this.unistylesBridge.hasAdaptiveThemes;
|
12
12
|
}
|
13
13
|
get sortedBreakpoints() {
|
14
14
|
return this.registry.sortedBreakpointPairs;
|
15
15
|
}
|
16
|
-
get
|
17
|
-
return this.
|
16
|
+
get themeName() {
|
17
|
+
return this.unistylesBridge.themeName;
|
18
18
|
}
|
19
|
-
get
|
20
|
-
return this.unistylesBridge.theme;
|
21
|
-
}
|
22
|
-
get currentBreakpoint() {
|
19
|
+
get breakpoint() {
|
23
20
|
return this.unistylesBridge.breakpoint;
|
24
21
|
}
|
25
|
-
|
26
|
-
|
27
|
-
this.unistylesBridge.
|
22
|
+
get screen() {
|
23
|
+
return {
|
24
|
+
width: this.unistylesBridge.screenWidth,
|
25
|
+
height: this.unistylesBridge.screenHeight
|
26
|
+
};
|
27
|
+
}
|
28
|
+
get orientation() {
|
29
|
+
const {
|
30
|
+
width,
|
31
|
+
height
|
32
|
+
} = this.screen;
|
33
|
+
if (width > height) {
|
34
|
+
return ScreenOrientation.Landscape;
|
28
35
|
}
|
29
|
-
|
36
|
+
return ScreenOrientation.Portrait;
|
37
|
+
}
|
30
38
|
setTheme = name => {
|
31
|
-
if (name !== this.
|
39
|
+
if (name !== this.themeName && this.hasTheme(name)) {
|
32
40
|
this.unistylesBridge.useTheme(name);
|
33
41
|
return true;
|
34
42
|
}
|
35
|
-
|
43
|
+
throw new Error(UnistylesError.ThemeNotRegistered);
|
36
44
|
};
|
37
|
-
hasTheme = name => name in this.registry.themes;
|
38
45
|
getTheme = forName => {
|
46
|
+
if (this.registry.themeNames.length === 0) {
|
47
|
+
return {};
|
48
|
+
}
|
39
49
|
if (!this.hasTheme(forName)) {
|
40
50
|
throw new Error(UnistylesError.ThemeNotFound);
|
41
51
|
}
|
42
52
|
return this.registry.themes[forName];
|
43
53
|
};
|
54
|
+
setAdaptiveThemes = enable => {
|
55
|
+
this.unistylesBridge.useAdaptiveThemes(enable);
|
56
|
+
};
|
57
|
+
hasTheme = name => name in this.registry.themes;
|
44
58
|
}
|
45
59
|
//# sourceMappingURL=UnistylesRuntime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistylesError","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","
|
1
|
+
{"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","hasAdaptiveThemes","sortedBreakpoints","sortedBreakpointPairs","themeName","breakpoint","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","getTheme","forName","themeNames","length","ThemeNotFound","themes","setAdaptiveThemes","enable","useAdaptiveThemes"],"sourceRoot":"../../src","sources":["UnistylesRuntime.ts"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,SAAS;AAG3D,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,QAA0B,EAAE;IAAA,KAAtED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,QAA0B,GAA1BA,QAA0B;EAAG;EAE3F,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA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CAAC;EACxC,CAAC;EAEMK,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAC7B,eAAe,CAAC8B,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEOX,QAAQ,GAAID,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChB,QAAQ,CAAC0B,MAAM;AACpF"}
|
@@ -1,11 +1,13 @@
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
2
|
-
import { isServer } from '../utils';
|
1
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
3
2
|
export const useDimensions = () => {
|
4
3
|
const timerRef = useRef();
|
5
|
-
const [screenSize, setScreenSize] = useState({
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
const [screenSize, setScreenSize] = useState({});
|
5
|
+
useLayoutEffect(() => {
|
6
|
+
setScreenSize({
|
7
|
+
width: window.innerWidth,
|
8
|
+
height: window.innerHeight
|
9
|
+
});
|
10
|
+
}, []);
|
9
11
|
useEffect(() => {
|
10
12
|
const handleResize = () => {
|
11
13
|
clearTimeout(timerRef.current);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useEffect","
|
1
|
+
{"version":3,"names":["useEffect","useLayoutEffect","useRef","useState","useDimensions","timerRef","screenSize","setScreenSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGpE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGH,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACI,UAAU,EAAEC,aAAa,CAAC,GAAGJ,QAAQ,CAAa,CAAC,CAAe,CAAC;EAE1EF,eAAe,CAAC,MAAM;IAClBM,aAAa,CAAC;MACVC,KAAK,EAAEC,MAAM,CAACC,UAAU;MACxBC,MAAM,EAAEF,MAAM,CAACG;IACnB,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAENZ,SAAS,CAAC,MAAM;IACZ,MAAMa,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;MAE9BV,QAAQ,CAACU,OAAO,GAAGC,UAAU,CAAC,MAAMT,aAAa,CAAC;QAC9CC,KAAK,EAAEC,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTJ,MAAM,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOT,UAAU;AACrB,CAAC"}
|
package/lib/module/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { unistyles } from './Unistyles';
|
2
|
-
import {
|
2
|
+
import { ScreenOrientation } from './types';
|
3
3
|
export { useInitialTheme } from './useInitialTheme';
|
4
4
|
export { useStyles } from './useStyles';
|
5
5
|
export { createStyleSheet } from './createStyleSheet';
|
@@ -14,6 +14,7 @@ const UnistylesRegistry = {
|
|
14
14
|
addBreakpoints,
|
15
15
|
addConfig
|
16
16
|
};
|
17
|
+
export const __dangerouslyUnregister = unistyles.registry.dangerouslyUnregister;
|
17
18
|
export { UnistylesRuntime, UnistylesRegistry };
|
18
|
-
export {
|
19
|
+
export { ScreenOrientation };
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["unistyles","
|
1
|
+
{"version":3,"names":["unistyles","ScreenOrientation","useInitialTheme","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry","__dangerouslyUnregister","dangerouslyUnregister"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGP,SAAS,CAACQ,QAAQ;AACpE,MAAMC,gBAAgB,GAAGT,SAAS,CAACU,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,OAAO,MAAMK,uBAAuB,GAAGZ,SAAS,CAACQ,QAAQ,CAACK,qBAAqB;AAE/E,SACIJ,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIV,iBAAiB"}
|
package/lib/module/types/cxx.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
export let
|
2
|
-
|
3
|
-
|
4
|
-
return
|
1
|
+
export let ScreenOrientation = /*#__PURE__*/function (ScreenOrientation) {
|
2
|
+
ScreenOrientation[ScreenOrientation["Portrait"] = 1] = "Portrait";
|
3
|
+
ScreenOrientation[ScreenOrientation["Landscape"] = 2] = "Landscape";
|
4
|
+
return ScreenOrientation;
|
5
5
|
}({});
|
6
6
|
export let CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
|
7
7
|
CxxUnistylesEventTypes["Theme"] = "theme";
|
@@ -12,6 +12,10 @@ export let CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventType
|
|
12
12
|
export let UnistylesError = /*#__PURE__*/function (UnistylesError) {
|
13
13
|
UnistylesError["RuntimeUnavailable"] = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE";
|
14
14
|
UnistylesError["ThemeNotFound"] = "UNISTYLES_ERROR_THEME_NOT_FOUND";
|
15
|
+
UnistylesError["ThemeNotRegistered"] = "UNISTYLES_ERROR_THEME_NOT_REGISTERED";
|
16
|
+
UnistylesError["ThemesCannotBeEmpty"] = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY";
|
17
|
+
UnistylesError["BreakpointsCannotBeEmpty"] = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY";
|
18
|
+
UnistylesError["BreakpointsMustStartFromZero"] = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO";
|
15
19
|
return UnistylesError;
|
16
20
|
}({});
|
17
21
|
//# sourceMappingURL=cxx.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["ScreenOrientation","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":"AASA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAyB7B,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AA8BlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { useMemo } from 'react';
|
2
2
|
import { unistyles } from './Unistyles';
|
3
3
|
export const useInitialTheme = forName => {
|
4
|
-
|
4
|
+
useMemo(() => unistyles.runtime.setTheme(forName), []);
|
5
5
|
};
|
6
6
|
//# sourceMappingURL=useInitialTheme.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["useMemo","unistyles","useInitialTheme","forName","runtime","setTheme"],"sourceRoot":"../../src","sources":["useInitialTheme.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,SAAS,QAAQ,aAAa;AAGvC,OAAO,MAAMC,eAAe,GAAIC,OAA8B,IAAK;EAC/DH,OAAO,CAAC,MAAMC,SAAS,CAACG,OAAO,CAACC,QAAQ,CAACF,OAAO,CAAC,EAAE,EAAE,CAAC;AAC1D,CAAC"}
|
@@ -4,8 +4,8 @@ import { CxxUnistylesEventTypes } from './types';
|
|
4
4
|
import { unistyles } from './Unistyles';
|
5
5
|
const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
|
6
6
|
export const useUnistyles = () => {
|
7
|
-
const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.
|
8
|
-
const [breakpoint, setBreakpoint] = useState(unistyles.runtime.
|
7
|
+
const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName));
|
8
|
+
const [breakpoint, setBreakpoint] = useState(unistyles.runtime.breakpoint);
|
9
9
|
const [screenSize, setScreenSize] = useState({
|
10
10
|
width: 0,
|
11
11
|
height: 0
|
@@ -16,9 +16,10 @@ export const useUnistyles = () => {
|
|
16
16
|
case CxxUnistylesEventTypes.Theme:
|
17
17
|
{
|
18
18
|
const themeEvent = event;
|
19
|
-
setTheme(unistyles.runtime.getTheme(themeEvent.payload.
|
19
|
+
setTheme(unistyles.runtime.getTheme(themeEvent.payload.themeName));
|
20
20
|
return;
|
21
21
|
}
|
22
|
+
// this event is not available on mobile
|
22
23
|
case CxxUnistylesEventTypes.Size:
|
23
24
|
{
|
24
25
|
const sizeEvent = event;
|
@@ -26,15 +27,12 @@ export const useUnistyles = () => {
|
|
26
27
|
width: sizeEvent.payload.width,
|
27
28
|
height: sizeEvent.payload.height
|
28
29
|
});
|
29
|
-
// todo
|
30
|
-
// setBreakpoint(unistyles.runtime.currentBreakpoint)
|
31
|
-
|
32
30
|
return;
|
33
31
|
}
|
34
32
|
case CxxUnistylesEventTypes.Breakpoint:
|
35
33
|
{
|
36
34
|
const breakpointEvent = event;
|
37
|
-
setBreakpoint(breakpointEvent.payload.
|
35
|
+
setBreakpoint(breakpointEvent.payload.breakpoint);
|
38
36
|
return;
|
39
37
|
}
|
40
38
|
default:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","CxxUnistylesEventTypes","unistyles","unistylesEvents","Unistyles","useUnistyles","theme","setTheme","runtime","getTheme","
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","CxxUnistylesEventTypes","unistyles","unistylesEvents","Unistyles","useUnistyles","theme","setTheme","runtime","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","height","subscription","addListener","event","type","Theme","themeEvent","payload","Size","sizeEvent","Breakpoint","breakpointEvent","remove"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAO3C,SAASC,sBAAsB,QAAQ,SAAS;AAChD,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACC,QAAQ,CAACP,SAAS,CAACM,OAAO,CAACE,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGZ,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACG,UAAU,CAAC;EAC1E,MAAM,CAACE,UAAU,EAAEC,aAAa,CAAC,GAAGd,QAAQ,CAAC;IACzCe,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC,CAAC;EAEFjB,SAAS,CAAC,MAAM;IACZ,MAAMkB,YAAY,GAAGd,eAAe,CAACe,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKnB,sBAAsB,CAACoB,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGH,KAA+B;YAElDZ,QAAQ,CAACL,SAAS,CAACM,OAAO,CAACC,QAAQ,CAACa,UAAU,CAACC,OAAO,CAACb,SAAS,CAAC,CAAC;YAElE;UACJ;QACA;QACA,KAAKT,sBAAsB,CAACuB,IAAI;UAAE;YAC9B,MAAMC,SAAS,GAAGN,KAA8B;YAEhDL,aAAa,CAAC;cACVC,KAAK,EAAEU,SAAS,CAACF,OAAO,CAACR,KAAK;cAC9BC,MAAM,EAAES,SAAS,CAACF,OAAO,CAACP;YAC9B,CAAC,CAAC;YAEF;UACJ;QACA,KAAKf,sBAAsB,CAACyB,UAAU;UAAE;YACpC,MAAMC,eAAe,GAAGR,KAAoC;YAE5DP,aAAa,CAACe,eAAe,CAACJ,OAAO,CAACZ,UAAU,CAAC;YAEjD;UACJ;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOM,YAAY,CAACW,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHtB,KAAK;IACLK,UAAU;IACVE;EACJ,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["unistyles","throwError","getKeyForCustomMediaQuery","isMediaQuery","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","customMediaQueryKey","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","runtime","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,UAAU,QAAQ,UAAU;AAErC,SAASC,yBAAyB,EAAEC,YAAY,QAAQ,gBAAgB;AAGxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAIC,WAAiC,IAA2B;EACnG,MAAMC,WAAW,GAAGC,MAAM,CACrBC,OAAO,CAACH,WAAW,CAAC,CACpBI,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;IAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;IAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;IAE9B,OAAQC,MAAM,GAAeC,MAAiB;EAClD,CAAC,CAAC;EAEN,MAAMC,iBAAiB,GAAIP,MAAM,CAACQ,MAAM,CAACR,MAAM,CAACS,WAAW,CAACV,WAAW,CAAC,CAAyB;EACjG,MAAMW,gBAAgB,GAAGV,MAAM,CAACW,MAAM,CAACJ,iBAAiB,CAAC;EACzD,MAAM,CAACK,eAAe,CAAC,GAAGF,gBAAgB;EAE1C,IAAIE,eAAe,KAAK,CAAC,EAAE;IACvBlB,UAAU,CAAC,oCAAoC,CAAC;EACpD;EAEA,IAAIgB,gBAAgB,CAACG,MAAM,KAAK,IAAIC,GAAG,CAACJ,gBAAgB,CAAC,CAACK,IAAI,EAAE;IAC5DrB,UAAU,CAAC,kCAAkC,CAAC;EAClD;EAEA,OAAOa,iBAAiB;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,4BAA4B,GAAGA,CAACC,KAAa,EAAEC,iBAAwG,KAA0C;EAC1M,MAAM,CAACC,GAAG,CAAC,GAAGD,iBAAiB,CAC1BE,IAAI,CAAC,CAAAC,IAAA,EAAYC,KAAK,EAAEC,gBAAgB,KAAK;IAAA,IAAvC,GAAGC,KAAK,CAAC,GAAAH,IAAA;IACZ,MAAMI,MAAM,GAAGD,
|
1
|
+
{"version":3,"names":["unistyles","throwError","getKeyForCustomMediaQuery","isMediaQuery","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","customMediaQueryKey","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","runtime","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,UAAU,QAAQ,UAAU;AAErC,SAASC,yBAAyB,EAAEC,YAAY,QAAQ,gBAAgB;AAGxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAIC,WAAiC,IAA2B;EACnG,MAAMC,WAAW,GAAGC,MAAM,CACrBC,OAAO,CAACH,WAAW,CAAC,CACpBI,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;IAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;IAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;IAE9B,OAAQC,MAAM,GAAeC,MAAiB;EAClD,CAAC,CAAC;EAEN,MAAMC,iBAAiB,GAAIP,MAAM,CAACQ,MAAM,CAACR,MAAM,CA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nB,CAAC"}
|
@@ -2,14 +2,15 @@ import type { UnistylesBridge, UnistylesConfig } from './types';
|
|
2
2
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
3
3
|
export declare class UnistyleRegistry {
|
4
4
|
private unistylesBridge;
|
5
|
-
|
5
|
+
config: UnistylesConfig;
|
6
|
+
themeNames: Array<keyof UnistylesThemes>;
|
6
7
|
themes: UnistylesThemes;
|
7
8
|
breakpoints: UnistylesBreakpoints;
|
8
9
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
9
|
-
config: UnistylesConfig;
|
10
10
|
constructor(unistylesBridge: UnistylesBridge);
|
11
11
|
addThemes: (themes: UnistylesThemes) => this;
|
12
12
|
addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
|
13
13
|
addConfig: (config: UnistylesConfig) => this;
|
14
|
+
dangerouslyUnregister: () => void;
|
14
15
|
}
|
15
16
|
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../src/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAErE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../src/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAErE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,MAAM,EAAE,eAAe,CAAK;IAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAS1C;IAEM,cAAc,gBAAiB,oBAAoB,UAKzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;IAEM,qBAAqB,aAQ3B;CACJ"}
|
@@ -1,56 +1,24 @@
|
|
1
1
|
import type { UnistylesBridge } from './types';
|
2
2
|
import type { UnistyleRegistry } from './UnistyleRegistry';
|
3
|
-
import {
|
3
|
+
import { ScreenOrientation } from './types';
|
4
4
|
import type { UnistylesThemes } from './global';
|
5
5
|
export declare class UnistylesRuntime {
|
6
6
|
private unistylesBridge;
|
7
7
|
private registry;
|
8
8
|
constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
|
9
|
-
get colorScheme():
|
10
|
-
get
|
11
|
-
get sortedBreakpoints(): [
|
12
|
-
get
|
13
|
-
get
|
14
|
-
get
|
15
|
-
|
16
|
-
|
17
|
-
hasTheme: (name: keyof UnistylesThemes) => boolean;
|
18
|
-
getTheme: (forName: keyof UnistylesThemes) => {
|
19
|
-
colors: {
|
20
|
-
backgroundColor: string;
|
21
|
-
typography: string;
|
22
|
-
accent: string;
|
23
|
-
barbie: string;
|
24
|
-
oak: string;
|
25
|
-
sky: string;
|
26
|
-
fog: string;
|
27
|
-
aloes: string;
|
28
|
-
blood: string;
|
29
|
-
};
|
30
|
-
} | {
|
31
|
-
colors: {
|
32
|
-
backgroundColor: string;
|
33
|
-
typography: string;
|
34
|
-
accent: string;
|
35
|
-
barbie: string;
|
36
|
-
oak: string;
|
37
|
-
sky: string;
|
38
|
-
fog: string;
|
39
|
-
aloes: string;
|
40
|
-
blood: string;
|
41
|
-
};
|
42
|
-
} | {
|
43
|
-
colors: {
|
44
|
-
backgroundColor: string;
|
45
|
-
typography: string;
|
46
|
-
accent: string;
|
47
|
-
barbie: string;
|
48
|
-
oak: string;
|
49
|
-
sky: string;
|
50
|
-
fog: string;
|
51
|
-
aloes: string;
|
52
|
-
blood: string;
|
53
|
-
};
|
9
|
+
get colorScheme(): import("./types").ColorSchemeName;
|
10
|
+
get hasAdaptiveThemes(): boolean;
|
11
|
+
get sortedBreakpoints(): ["default", 0 | undefined][];
|
12
|
+
get themeName(): never;
|
13
|
+
get breakpoint(): "default";
|
14
|
+
get screen(): {
|
15
|
+
width: number;
|
16
|
+
height: number;
|
54
17
|
};
|
18
|
+
get orientation(): ScreenOrientation;
|
19
|
+
setTheme: (name: keyof UnistylesThemes) => boolean;
|
20
|
+
getTheme: (forName: keyof UnistylesThemes) => never;
|
21
|
+
setAdaptiveThemes: (enable: boolean) => void;
|
22
|
+
private hasTheme;
|
55
23
|
}
|
56
24
|
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../src/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../src/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,sCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,iCAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,cAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAUhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IACjC,OAAO,CAAC,EAAE,CAAC,CAAA;CACd"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;
|
1
|
+
{"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,aAAa,QAAO,UA8BhC,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
2
|
-
import {
|
2
|
+
import { ScreenOrientation } from './types';
|
3
3
|
export { useInitialTheme } from './useInitialTheme';
|
4
4
|
export { useStyles } from './useStyles';
|
5
5
|
export { createStyleSheet } from './createStyleSheet';
|
@@ -9,7 +9,8 @@ declare const UnistylesRegistry: {
|
|
9
9
|
addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./UnistyleRegistry").UnistyleRegistry;
|
10
10
|
addConfig: (config: import("./types").UnistylesConfig) => import("./UnistyleRegistry").UnistyleRegistry;
|
11
11
|
};
|
12
|
+
export declare const __dangerouslyUnregister: () => void;
|
12
13
|
export { UnistylesRuntime, UnistylesRegistry };
|
13
|
-
export {
|
14
|
+
export { ScreenOrientation };
|
14
15
|
export type { UnistylesThemes, UnistylesBreakpoints };
|
15
16
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,QAAA,MAAM,gBAAgB,+CAAoB,CAAA;AAC1C,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,eAAO,MAAM,uBAAuB,YAA2C,CAAA;AAE/E,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACpB,CAAA;AAED,OAAO,EACH,iBAAiB,EACpB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
|
@@ -1,22 +1,26 @@
|
|
1
1
|
import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
|
2
2
|
export type Nullable<T> = T | null;
|
3
|
-
export
|
4
|
-
System = "system",
|
5
|
-
Manual = "manual"
|
6
|
-
}
|
3
|
+
export type ColorSchemeName = 'light' | 'dark' | undefined;
|
7
4
|
export type UnistylesConfig = {
|
8
|
-
|
9
|
-
featureFlags?: Array<string>;
|
5
|
+
adaptiveThemes?: boolean;
|
10
6
|
};
|
7
|
+
export declare enum ScreenOrientation {
|
8
|
+
Portrait = 1,
|
9
|
+
Landscape = 2
|
10
|
+
}
|
11
11
|
export type UnistylesBridge = {
|
12
|
-
|
12
|
+
screenWidth: number;
|
13
|
+
screenHeight: number;
|
14
|
+
hasAdaptiveThemes: boolean;
|
15
|
+
themeName: keyof UnistylesThemes;
|
13
16
|
breakpoint: keyof UnistylesBreakpoints;
|
14
|
-
colorScheme:
|
17
|
+
colorScheme: ColorSchemeName;
|
15
18
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
19
|
+
themes: Array<keyof UnistylesThemes>;
|
16
20
|
useBreakpoints(breakpoints: UnistylesBreakpoints): void;
|
17
21
|
useTheme(name: keyof UnistylesThemes): void;
|
18
|
-
|
19
|
-
|
22
|
+
useAdaptiveThemes(enable: boolean): void;
|
23
|
+
unregister(): void;
|
20
24
|
};
|
21
25
|
export declare enum CxxUnistylesEventTypes {
|
22
26
|
Theme = "theme",
|
@@ -26,7 +30,7 @@ export declare enum CxxUnistylesEventTypes {
|
|
26
30
|
export type CxxUnistylesThemeEvent = {
|
27
31
|
type: CxxUnistylesEventTypes.Theme;
|
28
32
|
payload: {
|
29
|
-
|
33
|
+
themeName: keyof UnistylesThemes;
|
30
34
|
};
|
31
35
|
};
|
32
36
|
export type CxxUnistylesSizeEvent = {
|
@@ -39,12 +43,16 @@ export type CxxUnistylesSizeEvent = {
|
|
39
43
|
export type CxxUnistylesBreakpointEvent = {
|
40
44
|
type: CxxUnistylesEventTypes.Breakpoint;
|
41
45
|
payload: {
|
42
|
-
|
46
|
+
breakpoint: keyof UnistylesBreakpoints;
|
43
47
|
};
|
44
48
|
};
|
45
49
|
export type UnistylesEvents = CxxUnistylesThemeEvent | CxxUnistylesSizeEvent | CxxUnistylesBreakpointEvent;
|
46
50
|
export declare enum UnistylesError {
|
47
51
|
RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
|
48
|
-
ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND"
|
52
|
+
ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
|
53
|
+
ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
|
54
|
+
ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
|
55
|
+
BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
|
56
|
+
BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
|
49
57
|
}
|
50
58
|
//# sourceMappingURL=cxx.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cxx.d.ts","sourceRoot":"","sources":["../../../../src/types/cxx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEtE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAClC,
|
1
|
+
{"version":3,"file":"cxx.d.ts","sourceRoot":"","sources":["../../../../src/types/cxx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEtE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,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ACjB,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACtC,IAAI,EAAE,sBAAsB,CAAC,UAAU,CAAC;IACxC,OAAO,EAAE;QACL,UAAU,EAAE,MAAM,oBAAoB,CAAA;KACzC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG,qBAAqB,GAAG,2BAA2B,CAAA;AAE1G,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF"}
|
@@ -1,45 +1,9 @@
|
|
1
1
|
import type { CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
|
2
2
|
import type { UnistylesThemes } from './global';
|
3
3
|
type T = UnistylesThemes[keyof UnistylesThemes];
|
4
|
-
export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST,
|
5
|
-
theme:
|
6
|
-
|
7
|
-
backgroundColor: string;
|
8
|
-
typography: string;
|
9
|
-
accent: string;
|
10
|
-
barbie: string;
|
11
|
-
oak: string;
|
12
|
-
sky: string;
|
13
|
-
fog: string;
|
14
|
-
aloes: string;
|
15
|
-
blood: string;
|
16
|
-
};
|
17
|
-
} | {
|
18
|
-
colors: {
|
19
|
-
backgroundColor: string;
|
20
|
-
typography: string;
|
21
|
-
accent: string;
|
22
|
-
barbie: string;
|
23
|
-
oak: string;
|
24
|
-
sky: string;
|
25
|
-
fog: string;
|
26
|
-
aloes: string;
|
27
|
-
blood: string;
|
28
|
-
};
|
29
|
-
} | {
|
30
|
-
colors: {
|
31
|
-
backgroundColor: string;
|
32
|
-
typography: string;
|
33
|
-
accent: string;
|
34
|
-
barbie: string;
|
35
|
-
oak: string;
|
36
|
-
sky: string;
|
37
|
-
fog: string;
|
38
|
-
aloes: string;
|
39
|
-
blood: string;
|
40
|
-
};
|
41
|
-
};
|
42
|
-
breakpoint: "xs" | "sm" | "md" | "lg" | "xl";
|
4
|
+
export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined) => {
|
5
|
+
theme: never;
|
6
|
+
breakpoint: "default";
|
43
7
|
styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST>>;
|
44
8
|
};
|
45
9
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AAE/C,eAAO,MAAM,SAAS
|
1
|
+
{"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAE/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AAE/C,eAAO,MAAM,SAAS;;;;CAsCrB,CAAA"}
|
@@ -1,42 +1,6 @@
|
|
1
1
|
export declare const useUnistyles: () => {
|
2
|
-
theme:
|
3
|
-
|
4
|
-
backgroundColor: string;
|
5
|
-
typography: string;
|
6
|
-
accent: string;
|
7
|
-
barbie: string;
|
8
|
-
oak: string;
|
9
|
-
sky: string;
|
10
|
-
fog: string;
|
11
|
-
aloes: string;
|
12
|
-
blood: string;
|
13
|
-
};
|
14
|
-
} | {
|
15
|
-
colors: {
|
16
|
-
backgroundColor: string;
|
17
|
-
typography: string;
|
18
|
-
accent: string;
|
19
|
-
barbie: string;
|
20
|
-
oak: string;
|
21
|
-
sky: string;
|
22
|
-
fog: string;
|
23
|
-
aloes: string;
|
24
|
-
blood: string;
|
25
|
-
};
|
26
|
-
} | {
|
27
|
-
colors: {
|
28
|
-
backgroundColor: string;
|
29
|
-
typography: string;
|
30
|
-
accent: string;
|
31
|
-
barbie: string;
|
32
|
-
oak: string;
|
33
|
-
sky: string;
|
34
|
-
fog: string;
|
35
|
-
aloes: string;
|
36
|
-
blood: string;
|
37
|
-
};
|
38
|
-
};
|
39
|
-
breakpoint: "xs" | "sm" | "md" | "lg" | "xl";
|
2
|
+
theme: never;
|
3
|
+
breakpoint: "default";
|
40
4
|
screenSize: {
|
41
5
|
width: number;
|
42
6
|
height: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../src/useUnistyles.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../src/useUnistyles.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;CAoDxB,CAAA"}
|