react-native-unistyles 2.4.0-rc.2 → 2.5.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/lib/commonjs/common.js +3 -1
  2. package/lib/commonjs/common.js.map +1 -1
  3. package/lib/commonjs/core/UnistyleRegistry.js +8 -4
  4. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  5. package/lib/commonjs/core/Unistyles.js +7 -0
  6. package/lib/commonjs/core/Unistyles.js.map +1 -1
  7. package/lib/commonjs/core/mocks/UnistylesMockedBridge.js +32 -0
  8. package/lib/commonjs/core/mocks/UnistylesMockedBridge.js.map +1 -0
  9. package/lib/commonjs/core/mocks/UnistylesMockedRegistry.js +46 -0
  10. package/lib/commonjs/core/mocks/UnistylesMockedRegistry.js.map +1 -0
  11. package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js +77 -0
  12. package/lib/commonjs/core/mocks/UnistylesMockedRuntime.js.map +1 -0
  13. package/lib/commonjs/core/mocks/index.js +27 -0
  14. package/lib/commonjs/core/mocks/index.js.map +1 -0
  15. package/lib/commonjs/hooks/useUnistyles.js +2 -2
  16. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  17. package/lib/commonjs/useStyles.js +1 -1
  18. package/lib/commonjs/useStyles.js.map +1 -1
  19. package/lib/module/common.js +2 -0
  20. package/lib/module/common.js.map +1 -1
  21. package/lib/module/core/UnistyleRegistry.js +9 -5
  22. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  23. package/lib/module/core/Unistyles.js +8 -1
  24. package/lib/module/core/Unistyles.js.map +1 -1
  25. package/lib/module/core/mocks/UnistylesMockedBridge.js +25 -0
  26. package/lib/module/core/mocks/UnistylesMockedBridge.js.map +1 -0
  27. package/lib/module/core/mocks/UnistylesMockedRegistry.js +39 -0
  28. package/lib/module/core/mocks/UnistylesMockedRegistry.js.map +1 -0
  29. package/lib/module/core/mocks/UnistylesMockedRuntime.js +69 -0
  30. package/lib/module/core/mocks/UnistylesMockedRuntime.js.map +1 -0
  31. package/lib/module/core/mocks/index.js +4 -0
  32. package/lib/module/core/mocks/index.js.map +1 -0
  33. package/lib/module/hooks/useUnistyles.js +2 -2
  34. package/lib/module/hooks/useUnistyles.js.map +1 -1
  35. package/lib/module/useStyles.js +1 -1
  36. package/lib/module/useStyles.js.map +1 -1
  37. package/lib/typescript/src/common.d.ts +2 -0
  38. package/lib/typescript/src/common.d.ts.map +1 -1
  39. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  40. package/lib/typescript/src/core/Unistyles.d.ts.map +1 -1
  41. package/lib/typescript/src/core/mocks/UnistylesMockedBridge.d.ts +24 -0
  42. package/lib/typescript/src/core/mocks/UnistylesMockedBridge.d.ts.map +1 -0
  43. package/lib/typescript/src/core/mocks/UnistylesMockedRegistry.d.ts +21 -0
  44. package/lib/typescript/src/core/mocks/UnistylesMockedRegistry.d.ts.map +1 -0
  45. package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts +41 -0
  46. package/lib/typescript/src/core/mocks/UnistylesMockedRuntime.d.ts.map +1 -0
  47. package/lib/typescript/src/core/mocks/index.d.ts +4 -0
  48. package/lib/typescript/src/core/mocks/index.d.ts.map +1 -0
  49. package/lib/typescript/src/hooks/useUnistyles.d.ts +1 -1
  50. package/lib/typescript/src/types/breakpoints.d.ts +2 -1
  51. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  52. package/lib/typescript/src/types/stylesheet.d.ts +2 -1
  53. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  54. package/package.json +1 -1
  55. package/src/common.ts +2 -0
  56. package/src/core/UnistyleRegistry.ts +11 -5
  57. package/src/core/Unistyles.ts +10 -1
  58. package/src/core/mocks/UnistylesMockedBridge.ts +26 -0
  59. package/src/core/mocks/UnistylesMockedRegistry.ts +47 -0
  60. package/src/core/mocks/UnistylesMockedRuntime.ts +92 -0
  61. package/src/core/mocks/index.ts +3 -0
  62. package/src/hooks/useUnistyles.ts +2 -2
  63. package/src/types/breakpoints.ts +2 -1
  64. package/src/types/stylesheet.ts +2 -1
  65. package/src/useStyles.ts +1 -1
  66. package/windows/ReactNativeUnistyles/ReactNativeUnistyles.h +33 -27
@@ -0,0 +1,69 @@
1
+ // @ts-nocheck
2
+ import { ScreenOrientation } from '../../common';
3
+ export class UnistylesMockedRuntime {
4
+ constructor(unistylesBridge, unistylesRegistry) {
5
+ this.unistylesBridge = unistylesBridge;
6
+ this.unistylesRegistry = unistylesRegistry;
7
+ this.unistylesRegistry = unistylesRegistry;
8
+ }
9
+ get colorScheme() {
10
+ return 'dark';
11
+ }
12
+ get hasAdaptiveThemes() {
13
+ return true;
14
+ }
15
+ get themeName() {
16
+ return this.unistylesRegistry.themeNames.length > 0 ? this.unistylesRegistry.themeNames.at(0) : undefined;
17
+ }
18
+ get contentSizeCategory() {
19
+ return 'unspecified';
20
+ }
21
+ get breakpoint() {
22
+ if (this.unistylesRegistry.sortedBreakpointPairs.length === 0) {
23
+ return undefined;
24
+ }
25
+ const firstBreakpoint = this.unistylesRegistry.sortedBreakpointPairs.at(0);
26
+ return firstBreakpoint ? firstBreakpoint.at(0) : undefined;
27
+ }
28
+ get breakpoints() {
29
+ return this.unistylesRegistry.breakpoints;
30
+ }
31
+ get enabledPlugins() {
32
+ return this.unistylesRegistry.plugins;
33
+ }
34
+ get screen() {
35
+ return {
36
+ width: 360,
37
+ height: 800
38
+ };
39
+ }
40
+ get insets() {
41
+ return {
42
+ top: 0,
43
+ right: 0,
44
+ bottom: 0,
45
+ left: 0
46
+ };
47
+ }
48
+ get statusBar() {
49
+ return {
50
+ height: 24,
51
+ width: 800
52
+ };
53
+ }
54
+ get navigationBar() {
55
+ return {
56
+ height: 0,
57
+ width: 0
58
+ };
59
+ }
60
+ get orientation() {
61
+ return ScreenOrientation.Portrait;
62
+ }
63
+ setTheme = name => true;
64
+ updateTheme = (name, theme) => {};
65
+ setAdaptiveThemes = enabled => {};
66
+ addPlugin = plugin => {};
67
+ removePlugin = plugin => {};
68
+ }
69
+ //# sourceMappingURL=UnistylesMockedRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ScreenOrientation","UnistylesMockedRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","themeNames","length","at","undefined","contentSizeCategory","breakpoint","sortedBreakpointPairs","firstBreakpoint","breakpoints","enabledPlugins","plugins","screen","width","height","insets","top","right","bottom","left","statusBar","navigationBar","orientation","Portrait","setTheme","name","updateTheme","theme","setAdaptiveThemes","enabled","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../../src","sources":["core/mocks/UnistylesMockedRuntime.ts"],"mappings":"AAAA;AACA,SAASA,iBAAiB,QAAQ,cAAc;AAMhD,OAAO,MAAMC,sBAAsB,CAAC;EAGhCC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;IAC7F,IAAI,CAACA,iBAAiB,GAAGA,iBAAuD;EACpF;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,MAAM;EACjB;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI;EACf;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACH,iBAAiB,CAACI,UAAU,CAACC,MAAM,GAAG,CAAC,GAC7C,IAAI,CAACL,iBAAiB,CAACI,UAAU,CAACE,EAAE,CAAC,CAAC,CAAC,GACvCC,SAAS;EACnB;EAEA,IAAWC,mBAAmBA,CAAA,EAAG;IAC7B,OAAO,aAAa;EACxB;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,IAAI,IAAI,CAACT,iBAAiB,CAACU,qBAAqB,CAACL,MAAM,KAAK,CAAC,EAAE;MAC3D,OAAOE,SAAS;IACpB;IAEA,MAAMI,eAAe,GAAG,IAAI,CAACX,iBAAiB,CAACU,qBAAqB,CAACJ,EAAE,CAAC,CAAC,CAAC;IAE1E,OAAOK,eAAe,GAChBA,eAAe,CAACL,EAAE,CAAC,CAAC,CAAC,GACrBC,SAAS;EACnB;EAEA,IAAWK,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACZ,iBAAiB,CAACY,WAAW;EAC7C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACb,iBAAiB,CAACc,OAAO;EACzC;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;EACL;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,GAAG,EAAE,CAAC;MACNC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,IAAI,EAAE;IACV,CAAC;EACL;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO;MACHN,MAAM,EAAE,EAAE;MACVD,KAAK,EAAE;IACX,CAAC;EACL;EAEA,IAAWQ,aAAaA,CAAA,EAAG;IACvB,OAAO;MACHP,MAAM,EAAE,CAAC;MACTD,KAAK,EAAE;IACX,CAAC;EACL;EAEA,IAAWS,WAAWA,CAAA,EAAG;IACrB,OAAO7B,iBAAiB,CAAC8B,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK,IAAI;EAChDC,WAAW,GAAGA,CAACD,IAA2B,EAAEE,KAA6C,KAAK,CAAC,CAAC;EAChGC,iBAAiB,GAAIC,OAAgB,IAAK,CAAC,CAAC;EAC5CC,SAAS,GAAIC,MAAuB,IAAK,CAAC,CAAC;EAC3CC,YAAY,GAAID,MAAuB,IAAK,CAAC,CAAC;AACzD"}
@@ -0,0 +1,4 @@
1
+ export { UnistylesMockedBridge } from './UnistylesMockedBridge';
2
+ export { UnistylesMockedRegistry } from './UnistylesMockedRegistry';
3
+ export { UnistylesMockedRuntime } from './UnistylesMockedRuntime';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesMockedBridge","UnistylesMockedRegistry","UnistylesMockedRuntime"],"sourceRoot":"../../../../src","sources":["core/mocks/index.ts"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,sBAAsB,QAAQ,0BAA0B"}
@@ -10,7 +10,7 @@ export const useUnistyles = () => {
10
10
  const [layout, setLayout] = useState({
11
11
  breakpoint: unistyles.runtime.breakpoint,
12
12
  orientation: unistyles.runtime.orientation,
13
- screenSize: {
13
+ screen: {
14
14
  width: unistyles.runtime.screen.width,
15
15
  height: unistyles.runtime.screen.height
16
16
  },
@@ -43,7 +43,7 @@ export const useUnistyles = () => {
43
43
  return setLayout({
44
44
  breakpoint: layoutEvent.payload.breakpoint,
45
45
  orientation: layoutEvent.payload.orientation,
46
- screenSize: layoutEvent.payload.screen,
46
+ screen: layoutEvent.payload.screen,
47
47
  statusBar: layoutEvent.payload.statusBar,
48
48
  insets: layoutEvent.payload.insets,
49
49
  navigationBar: layoutEvent.payload.navigationBar
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","UnistylesEventType","unistylesEvents","Unistyles","useUnistyles","plugins","setPlugins","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","contentSizeCategory","setContentSizeCategory","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","statusBar","navigationBar","insets","top","bottom","left","right","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","DynamicTypeSize","dynamicTypeSizeEvent","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,kBAAkB,QAAQ,WAAW;AAG9C,MAAMC,eAAe,GAAG,IAAIN,kBA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C9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHtC,OAAO;IACPI,KAAK;IACLO,MAAM;IACNF;EACJ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","UnistylesEventType","unistylesEvents","Unistyles","useUnistyles","plugins","setPlugins","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","contentSizeCategory","setContentSizeCategory","layout","setLayout","breakpoint","orientation","screen","width","height","statusBar","navigationBar","insets","top","bottom","left","right","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","DynamicTypeSize","dynamicTypeSizeEvent","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,kBAAkB,QAAQ,WAAW;AAG9C,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGP,QAAQ,CAACC,SAAS,CAACO,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGX,QAAQ,CAACC,SAAS,CAACW,QAAQ,CAACC,QAAQ,CAACZ,SAAS,CAACO,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAGhB,QAAQ,CAACC,SAAS,CAACO,OAAO,CAACO,mBAAmB,CAAC;EACrG,MAAM,CAACE,MAAM,EAAEC,SAAS,CAAC,GAAGlB,QAAQ,CAAC;IACjCmB,UAAU,EAAElB,SAAS,CAACO,OAAO,CAACW,UAAU;IACxCC,WAAW,EAAEnB,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U,EAAEoB,WAAW,CAACF,OAAO,CAAClB,UAAU;cAC1CC,WAAW,EAAEmB,WAAW,CAACF,OAAO,CAACjB,WAAW;cAC5CC,MAAM,EAAEkB,WAAW,CAACF,OAAO,CAAChB,MAAM;cAClCG,SAAS,EAAEe,WAAW,CAACF,OAAO,CAACb,SAAS;cACxCE,MAAM,EAAEa,WAAW,CAACF,OAAO,CAACX,MAAM;cAClCD,aAAa,EAAEc,WAAW,CAACF,OAAO,CAACZ;YACvC,CAAC,CAAC;UACN;QACA,KAAKvB,kBAAkB,CAACsC,MAAM;UAAE;YAC5B,OAAOjC,UAAU,CAACN,SAAS,CAACO,OAAO,CAACC,cAAc,CAAC;UACvD;QACA,KAAKP,kBAAkB,CAACuC,eAAe;UAAE;YACrC,MAAMC,oBAAoB,GAAGT,KAAsC;YAEnE,OAAOjB,sBAAsB,CAAC0B,oBAAoB,CAACL,OAAO,CAACtB,mBAAmB,CAAC;UACnF;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOgB,YAAY,CAACY,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHrC,OAAO;IACPI,KAAK;IACLO,MAAM;IACNF;EACJ,CAAC;AACL,CAAC"}
@@ -17,7 +17,7 @@ export const useStyles = (stylesheet, variantsMap) => {
17
17
  plugins
18
18
  } = useUnistyles();
19
19
  const variants = useVariants(variantsMap);
20
- const parsedStyles = useMemo(() => typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet, [theme, stylesheet, layout]);
20
+ const parsedStyles = useMemo(() => typeof stylesheet === 'function' ? stylesheet(theme, unistyles.runtime) : stylesheet, [theme, stylesheet, layout]);
21
21
  const dynamicStyleSheet = useMemo(() => Object.entries(parsedStyles || {}).reduce((acc, [key, value]) => {
22
22
  if (typeof value === 'function') {
23
23
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useCSS","useUnistyles","useVariants","unistyles","isWeb","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","key","value","create","registry","config","experimentalCSSMediaQueries","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,MAAM,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAG3D,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,KAAK,QAAQ,UAAU;AAQhC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGT,YAAY,CAAC,CAAC;EACjD,MAAMU,QAAQ,GAAGT,WAAW,CAACK,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGjB,OAAO,CAAC,MAAM,OAAOW,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMI,iBAAiB,GAAGlB,OAAO,CAAC,MAAMmB,MAAM,CACzCC,OAAO,CAACH,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BI,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAGpB,eAAe,CAACoB,GAAG,EAAEC,KAAK,EAAER,QAAQ;MAC/C,CAAC;IACL;IAEA,OAAOf,UAAU,CAACwB,MAAM,CAAC;MACrB,GAAGH,GAAG;MACN,CAACC,GAAG,GAAGnB,WAAW,CAACmB,GAAG,EAAErB,UAAU,CAC9BsB,KAAK,EACLR,QAAQ,EACR,CAACP,KAAK,IAAI,CAACD,SAAS,CAACkB,QAAQ,CAACC,MAAM,CAACC,2BAA2B,CACpE;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACX,YAAY,EAAED,QAAQ,EAAED,OAAO,EAAED,MAAM,CACpD,CAAC;EAEDT,MAAM,CAACa,iBAA8C,CAAC;EAEtD,OAAO;IACHL,KAAK;IACLgB,UAAU,EAAEf,MAAM,CAACe,UAAU;IAC7BC,MAAM,EAAEZ;EACZ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useCSS","useUnistyles","useVariants","unistyles","isWeb","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","runtime","dynamicStyleSheet","Object","entries","reduce","acc","key","value","create","registry","config","experimentalCSSMediaQueries","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,MAAM,EAAEC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAG3D,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,KAAK,QAAQ,UAAU;AAQhC;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGT,YAAY,CAAC,CAAC;EACjD,MAAMU,QAAQ,GAAGT,WAAW,CAACK,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGjB,OAAO,CAAC,MAAM,OAAOW,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,EAAEL,SAAS,CAACU,OAAO,CAAC,GACpCP,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMK,iBAAiB,GAAGnB,OAAO,CAAC,MAAMoB,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,MAAM,CAAC,CAACC,GAAG,EAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAC3B,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGF,GAAG;QACN,CAACC,GAAG,GAAGrB,eAAe,CAACqB,GAAG,EAAEC,KAAK,EAAET,QAAQ;MAC/C,CAAC;IACL;IAEA,OAAOf,UAAU,CAACyB,MAAM,CAAC;MACrB,GAAGH,GAAG;MACN,CAACC,GAAG,GAAGpB,WAAW,CAACoB,GAAG,EAAEtB,UAAU,CAC9BuB,KAAK,EACLT,QAAQ,EACR,CAACP,KAAK,IAAI,CAACD,SAAS,CAACmB,QAAQ,CAACC,MAAM,CAACC,2BAA2B,CACpE;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACZ,YAAY,EAAED,QAAQ,EAAED,OAAO,EAAED,MAAM,CACpD,CAAC;EAEDT,MAAM,CAACc,iBAA8C,CAAC;EAEtD,OAAO;IACHN,KAAK;IACLiB,UAAU,EAAEhB,MAAM,CAACgB,UAAU;IAC7BC,MAAM,EAAEZ;EACZ,CAAC;AACL,CAAC"}
@@ -4,6 +4,8 @@ export declare const isIOS: boolean;
4
4
  export declare const isAndroid: boolean;
5
5
  export declare const isMobile: boolean;
6
6
  export declare const isServer: boolean;
7
+ export declare const isDev: boolean;
8
+ export declare const isTest: boolean;
7
9
  export declare const ScreenOrientation: {
8
10
  readonly Landscape: "landscape";
9
11
  readonly Portrait: "portrait";
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[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,qBAEjB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
1
+ {"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../../src/core/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAKrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAwBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
@@ -0,0 +1,24 @@
1
+ import type { UnistylesThemes, UnistylesBreakpoints } from '../../global';
2
+ export declare class UnistylesMockedBridge {
3
+ constructor();
4
+ screenWidth(): void;
5
+ screenHeight(): void;
6
+ enabledPlugins(): void;
7
+ hasAdaptiveThemes(): void;
8
+ themeName(): void;
9
+ breakpoint(): void;
10
+ colorScheme(): void;
11
+ contentSizeCategory(): void;
12
+ sortedBreakpointPairs(): void;
13
+ insets(): void;
14
+ statusBar(): void;
15
+ navigationBar(): void;
16
+ themes(themes: Array<keyof UnistylesThemes>): void;
17
+ useBreakpoints(breakpoints: UnistylesBreakpoints): void;
18
+ useTheme(name: keyof UnistylesThemes): void;
19
+ updateTheme(name: keyof UnistylesThemes): void;
20
+ useAdaptiveThemes(enable: boolean): void;
21
+ addPlugin(pluginName: string, notify: boolean): void;
22
+ removePlugin(pluginName: string): void;
23
+ }
24
+ //# sourceMappingURL=UnistylesMockedBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnistylesMockedBridge.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedBridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEzE,qBAAa,qBAAqB;;IAGvB,WAAW;IACX,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,SAAS;IACT,UAAU;IACV,WAAW;IACX,mBAAmB;IACnB,qBAAqB;IACrB,MAAM;IACN,SAAS;IACT,aAAa;IACb,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC;IAC3C,cAAc,CAAC,WAAW,EAAE,oBAAoB;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,eAAe;IACpC,WAAW,CAAC,IAAI,EAAE,MAAM,eAAe;IACvC,iBAAiB,CAAC,MAAM,EAAE,OAAO;IACjC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO;IAC7C,YAAY,CAAC,UAAU,EAAE,MAAM;CACzC"}
@@ -0,0 +1,21 @@
1
+ import type { UnistylesBreakpoints, UnistylesThemes } from '../../global';
2
+ import type { UnistylesPlugin, UnistylesConfig, UnistylesBridge } from '../../types';
3
+ export declare class UnistylesMockedRegistry {
4
+ private unistylesBridge;
5
+ config: UnistylesConfig;
6
+ breakpoints: UnistylesBreakpoints;
7
+ sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
8
+ plugins: Array<UnistylesPlugin>;
9
+ themes: UnistylesThemes;
10
+ themeNames: Array<keyof UnistylesThemes>;
11
+ constructor(unistylesBridge: UnistylesBridge);
12
+ addThemes: (themes: UnistylesThemes) => this;
13
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
14
+ addConfig: (config: UnistylesConfig) => void;
15
+ getTheme: (forName: keyof UnistylesThemes) => never;
16
+ addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
17
+ removePlugin: (plugin: UnistylesPlugin) => void;
18
+ updateTheme: (name: keyof UnistylesThemes, theme: UnistylesThemes[keyof UnistylesThemes]) => void;
19
+ hasTheme: (name: keyof UnistylesThemes) => boolean;
20
+ }
21
+ //# sourceMappingURL=UnistylesMockedRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnistylesMockedRegistry.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRegistry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEpF,qBAAa,uBAAuB;IAQpB,OAAO,CAAC,eAAe;IAP5B,MAAM,EAAE,eAAe,CAAK;IAC5B,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;IACjH,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAAK;IACpC,MAAM,EAAE,eAAe,CAAwB;IAC/C,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;gBAEhC,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAK1C;IACM,cAAc,gBAAiB,oBAAoB,UAYzD;IACM,SAAS,WAAY,eAAe,UAAO;IAC3C,QAAQ,YAAa,MAAM,eAAe,WAMhD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAAc;IACnE,YAAY,WAAY,eAAe,UAAO;IAC9C,WAAW,SAAU,MAAM,eAAe,SAAS,eAAe,CAAC,MAAM,eAAe,CAAC,UAAO;IAChG,QAAQ,SAAU,MAAM,eAAe,aAAS;CAC1D"}
@@ -0,0 +1,41 @@
1
+ import type { UnistylesBridge, UnistylesPlugin } from '../../types';
2
+ import type { UnistylesThemes } from '../../global';
3
+ import type { UnistyleRegistry } from '../UnistyleRegistry';
4
+ export declare class UnistylesMockedRuntime {
5
+ private unistylesBridge;
6
+ private unistylesRegistry;
7
+ private unistylesRegistry;
8
+ constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
9
+ get colorScheme(): string;
10
+ get hasAdaptiveThemes(): boolean;
11
+ get themeName(): undefined;
12
+ get contentSizeCategory(): string;
13
+ get breakpoint(): number | keyof import("../../global").UnistylesBreakpoints | undefined;
14
+ get breakpoints(): import("../../global").UnistylesBreakpoints;
15
+ get enabledPlugins(): UnistylesPlugin[];
16
+ get screen(): {
17
+ width: number;
18
+ height: number;
19
+ };
20
+ get insets(): {
21
+ top: number;
22
+ right: number;
23
+ bottom: number;
24
+ left: number;
25
+ };
26
+ get statusBar(): {
27
+ height: number;
28
+ width: number;
29
+ };
30
+ get navigationBar(): {
31
+ height: number;
32
+ width: number;
33
+ };
34
+ get orientation(): "portrait";
35
+ setTheme: (name: keyof UnistylesThemes) => boolean;
36
+ updateTheme: (name: keyof UnistylesThemes, theme: UnistylesThemes[keyof UnistylesThemes]) => void;
37
+ setAdaptiveThemes: (enabled: boolean) => void;
38
+ addPlugin: (plugin: UnistylesPlugin) => void;
39
+ removePlugin: (plugin: UnistylesPlugin) => void;
40
+ }
41
+ //# sourceMappingURL=UnistylesMockedRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnistylesMockedRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/UnistylesMockedRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE3D,qBAAa,sBAAsB;IAGnB,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;IAF/E,OAAO,CAAC,iBAAiB,CAAyB;gBAE9B,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAIjG,IAAW,WAAW,WAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,cAInB;IAED,IAAW,mBAAmB,WAE7B;IAED,IAAW,UAAU,2EAUpB;IAED,IAAW,WAAW,gDAErB;IAED,IAAW,cAAc,sBAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,MAAM;;;;;MAOhB;IAED,IAAW,SAAS;;;MAKnB;IAED,IAAW,aAAa;;;MAKvB;IAED,IAAW,WAAW,eAErB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAS;IAChD,WAAW,SAAU,MAAM,eAAe,SAAS,eAAe,CAAC,MAAM,eAAe,CAAC,UAAO;IAChG,iBAAiB,YAAa,OAAO,UAAO;IAC5C,SAAS,WAAY,eAAe,UAAO;IAC3C,YAAY,WAAY,eAAe,UAAO;CACxD"}
@@ -0,0 +1,4 @@
1
+ export { UnistylesMockedBridge } from './UnistylesMockedBridge';
2
+ export { UnistylesMockedRegistry } from './UnistylesMockedRegistry';
3
+ export { UnistylesMockedRuntime } from './UnistylesMockedRuntime';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA"}
@@ -4,7 +4,7 @@ export declare const useUnistyles: () => {
4
4
  layout: {
5
5
  breakpoint: keyof import("..").UnistylesBreakpoints;
6
6
  orientation: "landscape" | "portrait";
7
- screenSize: {
7
+ screen: {
8
8
  width: number;
9
9
  height: number;
10
10
  };
@@ -2,6 +2,7 @@ import type { ColorValue, OpaqueColorValue } from 'react-native';
2
2
  import type { UnistylesTheme } from '../types';
3
3
  import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet';
4
4
  import type { TransformStyles } from './core';
5
+ import type { UnistylesRuntime } from '../core';
5
6
  type ExtractTransformArray<T> = T extends object ? {
6
7
  [K in keyof T]: ExtractBreakpoints<T[K]>;
7
8
  } : never;
@@ -23,6 +24,6 @@ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
23
24
  type ParseStyleKeys<T> = T extends object ? {
24
25
  [K in keyof T]: ParseNestedObject<T[K]>;
25
26
  } : never;
26
- export type ReactNativeStyleSheet<T> = T extends (theme: UnistylesTheme) => infer R ? ParseStyleKeys<R> : ParseStyleKeys<T>;
27
+ export type ReactNativeStyleSheet<T> = T extends (theme: UnistylesTheme, runtime: UnistylesRuntime) => infer R ? ParseStyleKeys<R> : ParseStyleKeys<T>;
27
28
  export {};
28
29
  //# sourceMappingURL=breakpoints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,KAAK,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC5C,KAAK,CAAA;AAEX,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACvC,MAAM,CAAC,SAAS,yBAAyB,GACrC,CAAC,CAAC,MAAM,CAAC,CAAC,GACV,CAAC,SAAS,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,GAC7C,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACvC;KAC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ACC,KAAK;CACd,GACC,KAAK,CAAA;AAEX,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAClC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,GACrB,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAC9C,CAAC,GACL,CAAC,CAAA;AAEP,KAAK,mBAAmB,CAAC,CAAC,IACtB,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEvF,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACnC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC3C,KAAK,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,KAAK,MAAM,CAAC,GACxG,cAAc,CAAC,CAAC,CAAC,GACjB,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
2
2
  import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core';
3
3
  import type { UnistylesBreakpoints } from '../global';
4
+ import type { UnistylesRuntime } from '../core';
4
5
  type NestedKeys = 'shadowOffset' | 'transform' | 'textShadowOffset';
5
6
  type UnistyleView = Omit<ViewStyle, NestedKeys>;
6
7
  type UnistyleText = Omit<TextStyle, NestedKeys>;
@@ -35,6 +36,6 @@ export type UnistylesValues = {
35
36
  export type StyleSheet = {
36
37
  [styleName: string]: UnistylesValues | ((...args: any) => UnistylesValues);
37
38
  };
38
- export type StyleSheetWithSuperPowers = ((theme: UnistylesTheme) => StyleSheet) | StyleSheet;
39
+ export type StyleSheetWithSuperPowers = ((theme: UnistylesTheme, runtime: UnistylesRuntime) => StyleSheet) | StyleSheet;
39
40
  export {};
40
41
  //# sourceMappingURL=stylesheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,KAAK,UAAU,GAAG,cAAc,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAEnE,KAAK,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;AAC/C,KAAK,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;AAC/C,KAAK,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;AAEjD,KAAK,oBAAoB,GAAG;IACxB,YAAY,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAA;CACtD,CAAA;AAED,KAAK,QAAQ,GAAG;IACZ,QAAQ,CAAC,EAAE;QACP,CAAC,WAAW,EAAE,MAAM,GAAG;YACnB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;SACvD,CAAA;KACJ,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CA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,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;SAC3D,GAAG,IAAI,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC;KACpE;CACJ,GAAG,QAAQ,GAAG;KACV,QAAQ,IAAI,UAAU,CAAC,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC;CAC5D,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,eAAe,CAAC,CAAA;CAC7E,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,KAAK,UAAU,CAAC,GAAG,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.4.0-rc.2",
3
+ "version": "2.5.0-rc.0",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/common.ts CHANGED
@@ -9,6 +9,8 @@ export const isIOS = Platform.OS === 'ios'
9
9
  export const isAndroid = Platform.OS === 'android'
10
10
  export const isMobile = isIOS || isAndroid
11
11
  export const isServer = typeof window === 'undefined'
12
+ export const isDev = process.env.NODE_ENV !== 'production'
13
+ export const isTest = process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID !== undefined || typeof jest !== 'undefined'
12
14
 
13
15
  export const ScreenOrientation = {
14
16
  Landscape: 'landscape',
@@ -1,6 +1,6 @@
1
1
  import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types'
2
2
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
3
- import { isWeb, UnistylesError } from '../common'
3
+ import { isDev, isWeb, UnistylesError } from '../common'
4
4
  import { cssMediaQueriesPlugin, normalizeWebStylesPlugin } from '../plugins'
5
5
 
6
6
  export class UnistyleRegistry {
@@ -87,12 +87,18 @@ export class UnistyleRegistry {
87
87
  throw new Error(UnistylesError.InvalidPluginName)
88
88
  }
89
89
 
90
- if (this.plugins.some(({ name }) => name === plugin.name)) {
91
- throw new Error(UnistylesError.DuplicatePluginName)
90
+ const isAlreadyRegistered = this.plugins.some(({ name }) => name === plugin.name)
91
+
92
+ if (!isAlreadyRegistered) {
93
+ this.plugins = [plugin].concat(this.plugins)
94
+ this.unistylesBridge.addPlugin(plugin.name, notify)
95
+
96
+ return
92
97
  }
93
98
 
94
- this.plugins = [plugin].concat(this.plugins)
95
- this.unistylesBridge.addPlugin(plugin.name, notify)
99
+ if (!isDev) {
100
+ throw new Error(UnistylesError.DuplicatePluginName)
101
+ }
96
102
  }
97
103
 
98
104
  public removePlugin = (plugin: UnistylesPlugin) => {
@@ -2,7 +2,8 @@ import { UnistylesModule } from './UnistylesModule'
2
2
  import { UnistylesRuntime } from './UnistylesRuntime'
3
3
  import { UnistyleRegistry } from './UnistyleRegistry'
4
4
  import type { UnistylesBridge } from '../types'
5
- import { UnistylesError, isWeb } from '../common'
5
+ import { UnistylesError, isTest, isWeb } from '../common'
6
+ import { UnistylesMockedBridge, UnistylesMockedRegistry, UnistylesMockedRuntime } from './mocks'
6
7
 
7
8
  class Unistyles {
8
9
  private _runtime: UnistylesRuntime
@@ -10,6 +11,14 @@ class Unistyles {
10
11
  private _bridge: UnistylesBridge
11
12
 
12
13
  constructor() {
14
+ if (isTest) {
15
+ this._bridge = new UnistylesMockedBridge() as unknown as UnistylesBridge
16
+ this._registry = new UnistylesMockedRegistry(this._bridge) as unknown as UnistyleRegistry
17
+ this._runtime = new UnistylesMockedRuntime(this._bridge, this._registry) as unknown as UnistylesRuntime
18
+
19
+ return
20
+ }
21
+
13
22
  const isInstalled = UnistylesModule?.install() ?? false
14
23
 
15
24
  if (!isInstalled) {
@@ -0,0 +1,26 @@
1
+ // @ts-nocheck
2
+ import type { UnistylesThemes, UnistylesBreakpoints } from '../../global'
3
+
4
+ export class UnistylesMockedBridge {
5
+ constructor() {}
6
+
7
+ public screenWidth() {}
8
+ public screenHeight() {}
9
+ public enabledPlugins() {}
10
+ public hasAdaptiveThemes() {}
11
+ public themeName() {}
12
+ public breakpoint() {}
13
+ public colorScheme() {}
14
+ public contentSizeCategory() {}
15
+ public sortedBreakpointPairs() {}
16
+ public insets() {}
17
+ public statusBar() {}
18
+ public navigationBar() {}
19
+ public themes(themes: Array<keyof UnistylesThemes>) {}
20
+ public useBreakpoints(breakpoints: UnistylesBreakpoints) {}
21
+ public useTheme(name: keyof UnistylesThemes) {}
22
+ public updateTheme(name: keyof UnistylesThemes) {}
23
+ public useAdaptiveThemes(enable: boolean) {}
24
+ public addPlugin(pluginName: string, notify: boolean) {}
25
+ public removePlugin(pluginName: string) {}
26
+ }
@@ -0,0 +1,47 @@
1
+ // @ts-nocheck
2
+ import type { UnistylesBreakpoints, UnistylesThemes } from '../../global'
3
+ import type { UnistylesPlugin, UnistylesConfig, UnistylesBridge } from '../../types'
4
+
5
+ export class UnistylesMockedRegistry {
6
+ public config: UnistylesConfig = {}
7
+ public breakpoints: UnistylesBreakpoints = {} as UnistylesBreakpoints
8
+ public sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]> = []
9
+ public plugins: Array<UnistylesPlugin> = []
10
+ public themes: UnistylesThemes = {} as UnistylesThemes
11
+ public themeNames: Array<keyof UnistylesThemes> = []
12
+
13
+ constructor(private unistylesBridge: UnistylesBridge) {}
14
+
15
+ public addThemes = (themes: UnistylesThemes) => {
16
+ this.themes = themes
17
+ this.themeNames = Object.keys(themes) as Array<keyof UnistylesThemes>
18
+
19
+ return this
20
+ }
21
+ public addBreakpoints = (breakpoints: UnistylesBreakpoints) => {
22
+ this.breakpoints = breakpoints
23
+ this.sortedBreakpointPairs = Object
24
+ .entries(breakpoints)
25
+ .sort((breakpoint1, breakpoint2) => {
26
+ const [, value1] = breakpoint1
27
+ const [, value2] = breakpoint2
28
+
29
+ return value1 - value2
30
+ }) as Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>
31
+
32
+ return this
33
+ }
34
+ public addConfig = (config: UnistylesConfig) => {}
35
+ public getTheme = (forName: keyof UnistylesThemes) => {
36
+ if (this.themeNames.length === 0) {
37
+ return {} as UnistylesThemes[keyof UnistylesThemes]
38
+ }
39
+
40
+ return this.themes[forName]
41
+ }
42
+
43
+ public addPlugin = (plugin: UnistylesPlugin, notify: boolean = true) => {}
44
+ public removePlugin = (plugin: UnistylesPlugin) => {}
45
+ public updateTheme = (name: keyof UnistylesThemes, theme: UnistylesThemes[keyof UnistylesThemes]) => {}
46
+ public hasTheme = (name: keyof UnistylesThemes) => true
47
+ }
@@ -0,0 +1,92 @@
1
+ // @ts-nocheck
2
+ import { ScreenOrientation } from '../../common'
3
+ import type { UnistylesBridge, UnistylesPlugin } from '../../types'
4
+ import type { UnistylesThemes } from '../../global'
5
+ import type { UnistylesMockedRegistry } from './UnistylesMockedRegistry'
6
+ import type { UnistyleRegistry } from '../UnistyleRegistry'
7
+
8
+ export class UnistylesMockedRuntime {
9
+ private unistylesRegistry: UnistylesMockedRegistry
10
+
11
+ constructor(private unistylesBridge: UnistylesBridge, private unistylesRegistry: UnistyleRegistry) {
12
+ this.unistylesRegistry = unistylesRegistry as unknown as UnistylesMockedRegistry
13
+ }
14
+
15
+ public get colorScheme() {
16
+ return 'dark'
17
+ }
18
+
19
+ public get hasAdaptiveThemes() {
20
+ return true
21
+ }
22
+
23
+ public get themeName() {
24
+ return this.unistylesRegistry.themeNames.length > 0
25
+ ? this.unistylesRegistry.themeNames.at(0)
26
+ : undefined
27
+ }
28
+
29
+ public get contentSizeCategory() {
30
+ return 'unspecified'
31
+ }
32
+
33
+ public get breakpoint() {
34
+ if (this.unistylesRegistry.sortedBreakpointPairs.length === 0) {
35
+ return undefined
36
+ }
37
+
38
+ const firstBreakpoint = this.unistylesRegistry.sortedBreakpointPairs.at(0)
39
+
40
+ return firstBreakpoint
41
+ ? firstBreakpoint.at(0)
42
+ : undefined
43
+ }
44
+
45
+ public get breakpoints() {
46
+ return this.unistylesRegistry.breakpoints
47
+ }
48
+
49
+ public get enabledPlugins() {
50
+ return this.unistylesRegistry.plugins
51
+ }
52
+
53
+ public get screen() {
54
+ return {
55
+ width: 360,
56
+ height: 800
57
+ }
58
+ }
59
+
60
+ public get insets() {
61
+ return {
62
+ top: 0,
63
+ right: 0,
64
+ bottom: 0,
65
+ left: 0
66
+ }
67
+ }
68
+
69
+ public get statusBar() {
70
+ return {
71
+ height: 24,
72
+ width: 800
73
+ }
74
+ }
75
+
76
+ public get navigationBar() {
77
+ return {
78
+ height: 0,
79
+ width: 0
80
+ }
81
+ }
82
+
83
+ public get orientation() {
84
+ return ScreenOrientation.Portrait
85
+ }
86
+
87
+ public setTheme = (name: keyof UnistylesThemes) => true
88
+ public updateTheme = (name: keyof UnistylesThemes, theme: UnistylesThemes[keyof UnistylesThemes]) => {}
89
+ public setAdaptiveThemes = (enabled: boolean) => {}
90
+ public addPlugin = (plugin: UnistylesPlugin) => {}
91
+ public removePlugin = (plugin: UnistylesPlugin) => {}
92
+ }
@@ -0,0 +1,3 @@
1
+ export { UnistylesMockedBridge } from './UnistylesMockedBridge'
2
+ export { UnistylesMockedRegistry } from './UnistylesMockedRegistry'
3
+ export { UnistylesMockedRuntime } from './UnistylesMockedRuntime'
@@ -13,7 +13,7 @@ export const useUnistyles = () => {
13
13
  const [layout, setLayout] = useState({
14
14
  breakpoint: unistyles.runtime.breakpoint,
15
15
  orientation: unistyles.runtime.orientation,
16
- screenSize: {
16
+ screen: {
17
17
  width: unistyles.runtime.screen.width,
18
18
  height: unistyles.runtime.screen.height
19
19
  },
@@ -49,7 +49,7 @@ export const useUnistyles = () => {
49
49
  return setLayout({
50
50
  breakpoint: layoutEvent.payload.breakpoint,
51
51
  orientation: layoutEvent.payload.orientation,
52
- screenSize: layoutEvent.payload.screen,
52
+ screen: layoutEvent.payload.screen,
53
53
  statusBar: layoutEvent.payload.statusBar,
54
54
  insets: layoutEvent.payload.insets,
55
55
  navigationBar: layoutEvent.payload.navigationBar