react-native-unistyles 3.0.0-alpha.19 → 3.0.0-alpha.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/cxx/common/Constants.h +1 -0
  2. package/cxx/common/Helpers.h +7 -7
  3. package/cxx/core/HostStyle.cpp +1 -1
  4. package/cxx/core/HostStyle.h +1 -0
  5. package/cxx/core/StyleSheet.h +0 -1
  6. package/cxx/core/UnistyleWrapper.h +77 -9
  7. package/cxx/core/UnistylesRegistry.cpp +14 -13
  8. package/cxx/core/UnistylesRegistry.h +3 -2
  9. package/cxx/hybridObjects/HybridShadowRegistry.cpp +4 -5
  10. package/cxx/parser/Parser.cpp +10 -2
  11. package/lib/commonjs/specs/ShadowRegistry/index.js +3 -35
  12. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  13. package/lib/commonjs/web/createUnistylesComponent.js +2 -2
  14. package/lib/commonjs/web/createUnistylesComponent.js.map +1 -1
  15. package/lib/commonjs/web/listener/listenToDependencies.js +2 -3
  16. package/lib/commonjs/web/listener/listenToDependencies.js.map +1 -1
  17. package/lib/commonjs/web/registry.js +22 -0
  18. package/lib/commonjs/web/registry.js.map +1 -1
  19. package/lib/commonjs/web/shadowRegistry.js +1 -2
  20. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  21. package/lib/module/specs/ShadowRegistry/index.js +3 -35
  22. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  23. package/lib/module/web/createUnistylesComponent.js +2 -2
  24. package/lib/module/web/createUnistylesComponent.js.map +1 -1
  25. package/lib/module/web/listener/listenToDependencies.js +2 -3
  26. package/lib/module/web/listener/listenToDependencies.js.map +1 -1
  27. package/lib/module/web/registry.js +22 -0
  28. package/lib/module/web/registry.js.map +1 -1
  29. package/lib/module/web/shadowRegistry.js +1 -2
  30. package/lib/module/web/shadowRegistry.js.map +1 -1
  31. package/lib/typescript/example/App.d.ts.map +1 -1
  32. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +1 -1
  33. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  34. package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +1 -1
  35. package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +1 -1
  36. package/lib/typescript/src/web/registry.d.ts +3 -0
  37. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  38. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/plugin/__tests__/dependencies.spec.js +5 -5
  41. package/plugin/__tests__/ref.spec.js +119 -41
  42. package/plugin/__tests__/stylesheet.spec.js +9 -9
  43. package/plugin/index.js +12 -1
  44. package/plugin/ref.js +20 -31
  45. package/plugin/style.js +33 -6
  46. package/src/specs/ShadowRegistry/index.ts +4 -38
  47. package/src/web/createUnistylesComponent.tsx +2 -4
  48. package/src/web/listener/listenToDependencies.ts +2 -7
  49. package/src/web/registry.ts +32 -0
  50. package/src/web/shadowRegistry.ts +1 -4
@@ -2,9 +2,9 @@
2
2
 
3
3
  import React, { useEffect, useState } from 'react';
4
4
  import { extractHiddenProperties, extractSecrets } from './utils';
5
- import { UnistylesRuntime } from './runtime';
6
5
  import { getVariants } from './variants';
7
6
  import { UnistylesListener } from './listener';
7
+ import { UnistylesRegistry } from './registry';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
9
  const getStyles = value => {
10
10
  const secrets = extractSecrets(value);
@@ -17,7 +17,7 @@ const getStyles = value => {
17
17
  __uni__args = [],
18
18
  __uni__variants
19
19
  }) => {
20
- const newComputedStylesheet = typeof __uni__stylesheet === 'function' ? __uni__stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : __uni__stylesheet;
20
+ const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
21
21
  const style = newComputedStylesheet[__uni__key];
22
22
  const resultHidden = typeof style === 'function' ? style(...__uni__args) : style;
23
23
  const result = extractHiddenProperties(resultHidden);
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","extractHiddenProperties","extractSecrets","UnistylesRuntime","getVariants","UnistylesListener","jsx","_jsx","getStyles","value","secrets","length","undefined","reduce","acc","__uni__stylesheet","__uni__key","__uni__args","__uni__variants","newComputedStylesheet","theme","miniRuntime","style","resultHidden","result","variants","Object","fromEntries","resultWithVariants","createUnistylesComponent","Component","props","passedStyles","setStyle","newStyles","dependencies","dispose","addListeners"],"sourceRoot":"../../../src","sources":["web/createUnistylesComponent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,uBAAuB,EAAEC,cAAc,QAAQ,SAAS;AACjE,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,YAAY;AACxC,SAASC,iBAAiB,QAAQ,YAAY;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAE9C,MAAMC,SAAS,GAAIC,KAA0B,IAAK;EAC9C,MAAMC,OAAO,GAAGR,cAAc,CAACO,KAAK,CAAC;EAErC,IAAIC,OAAO,CAACC,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOC,SAAS;EACpB;EAEA,OAAOF,OAAO,CAACG,MAAM,CAAC,CAACC,GAAG,EAAE;IAAEC,iBAAiB;IAAEC,UAAU;IAAEC,WAAW,GAAG,EAAE;IAAEC;EAAgB,CAAC,KAAK;IACjG,MAAMC,qBAAqB,GAAG,OAAOJ,iBAAiB,KAAK,UAAU,GAC/DA,iBAAiB,CAACZ,gBAAgB,CAACiB,KAAK,EAAEjB,gBAAgB,CAACkB,WAAW,CAAC,GACvEN,iBAAiB;IACvB,MAAMO,KAAK,GAAGH,qBAAqB,CAACH,UAAU,CAAC;IAC/C,MAAMO,YAAY,GAAG,OAAOD,KAAK,KAAK,UAAU,GAC1CA,KAAK,CAAC,GAAGL,WAAW,CAAC,GACrBK,KAAK;IACX,MAAME,MAAM,GAAGvB,uBAAuB,CAACsB,YAAY,CAAC;IACpD,MAAM;MAAEE;IAAS,CAAC,GAAGC,MAAM,CAACC,WAAW,CAACvB,WAAW,CAAC;MAAEqB,QAAQ,EAAED;IAAO,CAAC,EAAEN,eAAgB,CAAC,CAAC;IAC5F,MAAMU,kBAAkB,GAAG;MACvB,GAAGJ,MAAM;MACT,GAAGC;IACP,CAAC;IAED,OAAO;MACH,GAAGX,GAAG;MACN,GAAGc;IACP,CAAC;EACL,CAAC,EAAE,CAAC,CAAwB,CAAC;AACjC,CAAC;AAED,OAAO,MAAMC,wBAAwB,GAA2BC,SAAsC,IAAMC,KAAa,IAAK;EAC1H,MAAMC,YAAY,GAAID,KAAK,CAA6CT,KAAK,IAAI,CAAC,CAAC;EACnF,MAAM,CAACA,KAAK,EAAEW,QAAQ,CAAC,GAAGjC,QAAQ,CAACQ,SAAS,CAACwB,YAAY,CAAC,CAAC;EAE3DjC,SAAS,CAAC,MAAM;IACZ,MAAMmC,SAAS,GAAG1B,SAAS,CAACwB,YAAY,CAAC;IACzC,MAAMG,YAAY,GAAGD,SAAS,GAAG,mBAAmB,CAAC,IAAI,EAAE;IAC3D,MAAME,OAAO,GAAG/B,iBAAiB,CAACgC,YAAY,CAACF,YAAY,EAAE,MAAMF,QAAQ,CAACzB,SAAS,CAACwB,YAAY,CAAC,CAAC,CAAC;IAErGC,QAAQ,CAACC,SAAS,CAAC;IAEnB,OAAOE,OAAO;EAClB,CAAC,EAAE,CAACJ,YAAY,CAAC,CAAC;EAElB,oBACIzB,IAAA,CAACuB,SAAS;IAAA,GACFC,KAAK;IACTT,KAAK,EAAEA;EAAM,CAChB,CAAC;AAEV,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useState","extractHiddenProperties","extractSecrets","getVariants","UnistylesListener","UnistylesRegistry","jsx","_jsx","getStyles","value","secrets","length","undefined","reduce","acc","__uni__stylesheet","__uni__key","__uni__args","__uni__variants","newComputedStylesheet","getComputedStylesheet","style","resultHidden","result","variants","Object","fromEntries","resultWithVariants","createUnistylesComponent","Component","props","passedStyles","setStyle","newStyles","dependencies","dispose","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C,IAAMC,KAAa,IAAK;EAC1H,MAAMC,YAAY,GAAID,KAAK,CAA6CT,KAAK,IAAI,CAAC,CAAC;EACnF,MAAM,CAACA,KAAK,EAAEW,QAAQ,CAAC,GAAGhC,QAAQ,CAACQ,SAAS,CAACuB,YAAY,CAAC,CAAC;EAE3DhC,SAAS,CAAC,MAAM;IACZ,MAAMkC,SAAS,GAAGzB,SAAS,CAACuB,YAAY,CAAC;IACzC,MAAMG,YAAY,GAAGD,SAAS,GAAG,mBAAmB,CAAC,IAAI,EAAE;IAC3D,MAAME,OAAO,GAAG/B,iBAAiB,CAACgC,YAAY,CAACF,YAAY,EAAE,MAAMF,QAAQ,CAACxB,SAAS,CAACuB,YAAY,CAAC,CAAC,CAAC;IAErGC,QAAQ,CAACC,SAAS,CAAC;IAEnB,OAAOE,OAAO;EAClB,CAAC,EAAE,CAACJ,YAAY,CAAC,CAAC;EAElB,oBACIxB,IAAA,CAACsB,SAAS;IAAA,GACFC,KAAK;IACTT,KAAK,EAAEA;EAAM,CAChB,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import { UnistylesListener } from './listener';
4
- import { UnistylesRuntime } from '../runtime';
5
4
  import { keyInObject } from '../utils';
6
5
  import { UnistylesRegistry } from '../registry';
7
6
  export const listenToDependencies = ({
@@ -11,7 +10,7 @@ export const listenToDependencies = ({
11
10
  args = [],
12
11
  stylesheet
13
12
  }) => {
14
- const newComputedStylesheet = typeof stylesheet === 'function' ? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : stylesheet;
13
+ const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(stylesheet);
15
14
  const _value = keyInObject(newComputedStylesheet, key) ? newComputedStylesheet[key] : undefined;
16
15
  if (!_value) {
17
16
  return;
@@ -22,7 +21,7 @@ export const listenToDependencies = ({
22
21
  return;
23
22
  }
24
23
  return UnistylesListener.addListeners(dependencies, () => {
25
- const newComputedStylesheet = typeof stylesheet === 'function' ? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : stylesheet;
24
+ const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(stylesheet);
26
25
  if (!keyInObject(newComputedStylesheet, key)) {
27
26
  return;
28
27
  }
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesListener","UnistylesRuntime","keyInObject","UnistylesRegistry","listenToDependencies","key","className","unistyles","args","stylesheet","newComputedStylesheet","theme","miniRuntime","_value","undefined","value","dependencies","length","addListeners","result","updateStyles"],"sourceRoot":"../../../../src","sources":["web/listener/listenToDependencies.ts"],"mappings":";;AAGA,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,iBAAiB,QAAQ,aAAa;AAU/C,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EAAEC,GAAG;EAAEC,SAAS;EAAEC,SAAS;EAAEC,IAAI,GAAG,EAAE;EAAEC;AAAsC,CAAC,KAAK;EACrH,MAAMC,qBAAqB,GAAG,OAAOD,UAAU,KAAK,UAAU,GACxDA,UAAU,CAACR,gBAAgB,CAACU,KAAK,EAAEV,gBAAgB,CAACW,WAAW,CAAC,GAChEH,UAAU;EAChB,MAAMI,MAAM,GAAGX,WAAW,CAACQ,qBAAqB,EAAEL,GAAG,CAAC,GAAGK,qBAAqB,CAACL,GAAG,CAAC,GAAGS,SAAS;EAE/F,IAAI,CAACD,MAAM,EAAE;IACT;EACJ;EAEA,MAAME,KAAK,GAAG,OAAOF,MAAM,KAAK,UAAU,GAAGA,MAAM,CAAC,GAAGL,IAAI,CAAC,GAAGK,MAAM;EACrE,MAAMG,YAAY,GAAI,mBAAmB,IAAID,KAAK,GAAGA,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAgC;EAElH,IAAIC,YAAY,CAACC,MAAM,KAAK,CAAC,EAAE;IAC3B;EACJ;EAEA,OAAOjB,iBAAiB,CAACkB,YAAY,CAACF,YAAY,EAAE,MAAM;IACtD,MAAMN,qBAAqB,GAAG,OAAOD,UAAU,KAAK,UAAU,GACxDA,UAAU,CAACR,gBAAgB,CAACU,KAAK,EAAEV,gBAAgB,CAACW,WAAW,CAAC,GAChEH,UAAU;IAEhB,IAAI,CAACP,WAAW,CAACQ,qBAAqB,EAAEL,GAAG,CAAC,EAAE;MAC1C;IACJ;IAEA,MAAMU,KAAK,GAAGL,qBAAqB,CAACL,GAAG,CAAE;IACzC,MAAMc,MAAM,GAAG,OAAOJ,KAAK,KAAK,UAAU,GACpCA,KAAK,CAAC,GAAGP,IAAI,CAAC,GACdO,KAAK;IAEXZ,iBAAiB,CAACiB,YAAY,CAACb,SAAS,EAAEY,MAAM,EAAEb,SAAS,CAAC;EAChE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesListener","keyInObject","UnistylesRegistry","listenToDependencies","key","className","unistyles","args","stylesheet","newComputedStylesheet","getComputedStylesheet","_value","undefined","value","dependencies","length","addListeners","result","updateStyles"],"sourceRoot":"../../../../src","sources":["web/listener/listenToDependencies.ts"],"mappings":";;AAGA,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,iBAAiB,QAAQ,aAAa;AAU/C,OAAO,MAAMC,oBAAoB,GAAGA,CAAC;EAAEC,GAAG;EAAEC,SAAS;EAAEC,SAAS;EAAEC,IAAI,GAAG,EAAE;EAAEC;AAAsC,CAAC,KAAK;EACrH,MAAMC,qBAAqB,GAAGP,iBAAiB,CAACQ,qBAAqB,CAACF,UAAU,CAAC;EACjF,MAAMG,MAAM,GAAGV,WAAW,CAACQ,qBAAqB,EAAEL,GAAG,CAAC,GAAGK,qBAAqB,CAACL,GAAG,CAAC,GAAGQ,SAAS;EAE/F,IAAI,CAACD,MAAM,EAAE;IACT;EACJ;EAEA,MAAME,KAAK,GAAG,OAAOF,MAAM,KAAK,UAAU,GAAGA,MAAM,CAAC,GAAGJ,IAAI,CAAC,GAAGI,MAAM;EACrE,MAAMG,YAAY,GAAI,mBAAmB,IAAID,KAAK,GAAGA,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAgC;EAElH,IAAIC,YAAY,CAACC,MAAM,KAAK,CAAC,EAAE;IAC3B;EACJ;EAEA,OAAOf,iBAAiB,CAACgB,YAAY,CAACF,YAAY,EAAE,MAAM;IACtD,MAAML,qBAAqB,GAAGP,iBAAiB,CAACQ,qBAAqB,CAACF,UAAU,CAAC;IAEjF,IAAI,CAACP,WAAW,CAACQ,qBAAqB,EAAEL,GAAG,CAAC,EAAE;MAC1C;IACJ;IAEA,MAAMS,KAAK,GAAGJ,qBAAqB,CAACL,GAAG,CAAE;IACzC,MAAMa,MAAM,GAAG,OAAOJ,KAAK,KAAK,UAAU,GACpCA,KAAK,CAAC,GAAGN,IAAI,CAAC,GACdM,KAAK;IAEXX,iBAAiB,CAACgB,YAAY,CAACZ,SAAS,EAAEW,MAAM,EAAEZ,SAAS,CAAC;EAChE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -2,7 +2,29 @@
2
2
 
3
3
  import { createTypeStyle } from 'typestyle';
4
4
  import { convertToTypeStyle } from './convert';
5
+ import { UnistylesRuntime } from './runtime';
6
+ import { keyInObject } from './utils';
7
+ import { UnistylesListener } from './listener';
5
8
  class UnistylesRegistryBuilder {
9
+ stylesheets = new Map();
10
+ getComputedStylesheet = stylesheet => {
11
+ if (typeof stylesheet !== 'function') {
12
+ return stylesheet;
13
+ }
14
+ const computedStylesheet = this.stylesheets.get(stylesheet);
15
+ if (computedStylesheet) {
16
+ return computedStylesheet;
17
+ }
18
+ const createdStylesheet = stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime);
19
+ // @ts-expect-error uni__dependencies is hidden
20
+ const dependencies = Object.values(createdStylesheet).flatMap(value => keyInObject(value, 'uni__dependencies') ? value.uni__dependencies : []);
21
+ UnistylesListener.addListeners(dependencies, () => {
22
+ const newComputedStylesheet = stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime);
23
+ this.stylesheets.set(stylesheet, newComputedStylesheet);
24
+ });
25
+ this.stylesheets.set(stylesheet, createdStylesheet);
26
+ return createdStylesheet;
27
+ };
6
28
  createStyles = (stylesheet, key) => {
7
29
  const unistyles = createTypeStyle();
8
30
  const typestyleStylesheet = convertToTypeStyle(stylesheet);
@@ -1 +1 @@
1
- {"version":3,"names":["createTypeStyle","convertToTypeStyle","UnistylesRegistryBuilder","createStyles","stylesheet","key","unistyles","typestyleStylesheet","className","style","$debugName","Math","random","toString","slice","updateStyles","reinit","cssRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAmB,WAAW;AAEtD,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,MAAMC,wBAAwB,CAAC;EAC3BC,YAAY,GAAGA,CAACC,UAA2B,EAAEC,GAAW,KAAK;IACzD,MAAMC,SAAS,GAAGN,eAAe,CAAC,CAAC;IACnC,MAAMO,mBAAmB,GAAGN,kBAAkB,CAACG,UAAU,CAAC;IAE1D,MAAMI,SAAS,GAAGF,SAAS,CAACG,KAAK,CAAC;MAC9BC,UAAU,EAAE,GAAGL,GAAG,IAAIM,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,EAAE,CAAC;IAC9D,CAAC,EAAEP,mBAAmB,CAAC;IAEvB,OAAO;MACHC,SAAS;MACTF;IACJ,CAAC;EACL,CAAC;EAEDS,YAAY,GAAGA,CAACT,SAAoB,EAAEF,UAA2B,EAAEI,SAAiB,KAAK;IACrF,MAAMD,mBAAmB,GAAGN,kBAAkB,CAACG,UAAU,CAAC;IAE1DE,SAAS,CAACU,MAAM,CAAC,CAAC;IAClBV,SAAS,CAACW,OAAO,CAAC,IAAIT,SAAS,EAAE,EAAED,mBAAmB,CAAC;EAC3D,CAAC;AACL;AAEA,OAAO,MAAMW,iBAAiB,GAAG,IAAIhB,wBAAwB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createTypeStyle","convertToTypeStyle","UnistylesRuntime","keyInObject","UnistylesListener","UnistylesRegistryBuilder","stylesheets","Map","getComputedStylesheet","stylesheet","computedStylesheet","get","createdStylesheet","theme","miniRuntime","dependencies","Object","values","flatMap","value","uni__dependencies","addListeners","newComputedStylesheet","set","createStyles","key","unistyles","typestyleStylesheet","className","style","$debugName","Math","random","toString","slice","updateStyles","reinit","cssRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAmB,WAAW;AAEtD,SAASC,kBAAkB,QAAQ,WAAW;AAE9C,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,SAAS;AACrC,SAASC,iBAAiB,QAAQ,YAAY;AAE9C,MAAMC,wBAAwB,CAAC;EACnBC,WAAW,GAAG,IAAIC,GAAG,CAAoD,CAAC;EAElFC,qBAAqB,GAAIC,UAAiD,IAAK;IAC3E,IAAI,OAAOA,UAAU,KAAK,UAAU,EAAE;MAClC,OAAOA,UAAU;IACrB;IAEA,MAAMC,kBAAkB,GAAG,IAAI,CAACJ,WAAW,CAACK,GAAG,CAACF,UAAU,CAAC;IAE3D,IAAIC,kBAAkB,EAAE;MACpB,OAAOA,kBAAkB;IAC7B;IAEA,MAAME,iBAAiB,GAAGH,UAAU,CAACP,gBAAgB,CAACW,KAAK,EAAEX,gBAAgB,CAACY,WAAW,CAAC;IAC1F;IACA,MAAMC,YAAY,GAAGC,MAAM,CAACC,MAAM,CAACL,iBAAiB,CAAC,CAACM,OAAO,CAACC,KAAK,IAAIhB,WAAW,CAACgB,KAAK,EAAE,mBAAmB,CAAC,GAAGA,KAAK,CAACC,iBAAiB,GAAG,EAAE,CAAC;IAE9IhB,iBAAiB,CAACiB,YAAY,CAACN,YAAY,EAAE,MAAM;MAC/C,MAAMO,qBAAqB,GAAGb,UAAU,CAACP,gBAAgB,CAACW,KAAK,EAAEX,gBAAgB,CAACY,WAAW,CAAC;MAE9F,IAAI,CAACR,WAAW,CAACiB,GAAG,CAACd,UAAU,EAAEa,qBAAqB,CAAC;IAC3D,CAAC,CAAC;IAEF,IAAI,CAAChB,WAAW,CAACiB,GAAG,CAACd,UAAU,EAAEG,iBAAiB,CAAC;IAEnD,OAAOA,iBAAiB;EAC5B,CAAC;EAEDY,YAAY,GAAGA,CAACf,UAA2B,EAAEgB,GAAW,KAAK;IACzD,MAAMC,SAAS,GAAG1B,eAAe,CAAC,CAAC;IACnC,MAAM2B,mBAAmB,GAAG1B,kBAAkB,CAACQ,UAAU,CAAC;IAE1D,MAAMmB,SAAS,GAAGF,SAAS,CAACG,KAAK,CAAC;MAC9BC,UAAU,EAAE,GAAGL,GAAG,IAAIM,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,EAAE,CAAC;IAC9D,CAAC,EAAEP,mBAAmB,CAAC;IAEvB,OAAO;MACHC,SAAS;MACTF;IACJ,CAAC;EACL,CAAC;EAEDS,YAAY,GAAGA,CAACT,SAAoB,EAAEjB,UAA2B,EAAEmB,SAAiB,KAAK;IACrF,MAAMD,mBAAmB,GAAG1B,kBAAkB,CAACQ,UAAU,CAAC;IAE1DiB,SAAS,CAACU,MAAM,CAAC,CAAC;IAClBV,SAAS,CAACW,OAAO,CAAC,IAAIT,SAAS,EAAE,EAAED,mBAAmB,CAAC;EAC3D,CAAC;AACL;AAEA,OAAO,MAAMW,iBAAiB,GAAG,IAAIjC,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { listenToDependencies } from './listener';
4
4
  import { UnistylesRegistry } from './registry';
5
- import { UnistylesRuntime } from './runtime';
6
5
  import { createDoubleMap, extractHiddenProperties, extractSecrets, isInDocument } from './utils';
7
6
  import { getVariants } from './variants';
8
7
  class UnistylesShadowRegistryBuilder {
@@ -62,7 +61,7 @@ class UnistylesShadowRegistryBuilder {
62
61
  __uni__variants,
63
62
  __uni__args = []
64
63
  } = secret;
65
- const newComputedStylesheet = typeof __uni__stylesheet === 'function' ? __uni__stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : __uni__stylesheet;
64
+ const newComputedStylesheet = UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
66
65
  const style = newComputedStylesheet[__uni__key];
67
66
  const args = _args ?? __uni__args;
68
67
  const resultHidden = typeof style === 'function' ? style(...args) : style;
@@ -1 +1 @@
1
- {"version":3,"names":["listenToDependencies","UnistylesRegistry","UnistylesRuntime","createDoubleMap","extractHiddenProperties","extractSecrets","isInDocument","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","webUnistylesMap","disposeMap","stylesMap","add","ref","_style","_variants","_args","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","__uni__refs","remove","HTMLElement","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","theme","miniRuntime","args","resultHidden","result","variants","fromEntries","length","resultWithVariants","storedWebUnistyle","get","webUnistyle","createStyles","set","stylesheet","className","unistyles","styleTag","document","createElement","additionalClasses","_web","_classNames","classList","setStylesTarget","head","appendChild","updateStyles","delete","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,eAAe,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,YAAY,QAAQ,SAAS;AAChG,SAASC,WAAW,QAAQ,YAAY;AAMxC,MAAMC,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAA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CAACrB,UAAU,CAACoC,GAAG,CAACjC,GAAG,EAAEkB,UAAU,CAAC,GAAG,CAAC;MACxC,IAAI,CAACrB,UAAU,CAACsD,MAAM,CAACnD,GAAG,EAAEkB,UAAU,CAAC;MACvC,IAAI,CAACpB,SAAS,CAACmC,GAAG,CAACjC,GAAG,EAAEkB,UAAU,CAAC,EAAEH,MAAM,CAAC,CAAC;MAC7C,IAAI,CAACjB,SAAS,CAACqD,MAAM,CAACnD,GAAG,EAAEkB,UAAU,CAAC;IAC1C,CAAC,CAAC;EACN,CAAC;AACL;AAEA,OAAO,MAAMkC,uBAAuB,GAAG,IAAI9D,8BAA8B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["listenToDependencies","UnistylesRegistry","createDoubleMap","extractHiddenProperties","extractSecrets","isInDocument","getVariants","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","webUnistylesMap","disposeMap","stylesMap","add","ref","_style","_variants","_args","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","__uni__refs","remove","HTMLElement","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","resultHidden","result","variants","fromEntries","length","resultWithVariants","storedWebUnistyle","get","webUnistyle","createStyles","set","stylesheet","className","unistyles","styleTag","document","createElement","additionalClasses","_web","_classNames","classList","setStylesTarget","head","appendChild","updateStyles","delete","UnistylesShadowRegistry"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;AACA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,eAAe,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,YAAY,QAAQ,SAAS;AAChG,SAASC,WAAW,QAAQ,YAAY;AAMxC,MAAMC,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,G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AC;MACxC,IAAI,CAACrB,UAAU,CAACqD,MAAM,CAAClD,GAAG,EAAEkB,UAAU,CAAC;MACvC,IAAI,CAACpB,SAAS,CAACkC,GAAG,CAAChC,GAAG,EAAEkB,UAAU,CAAC,EAAEH,MAAM,CAAC,CAAC;MAC7C,IAAI,CAACjB,SAAS,CAACoD,MAAM,CAAClD,GAAG,EAAEkB,UAAU,CAAC;IAC1C,CAAC,CAAC;EACN,CAAC;AACL;AAEA,OAAO,MAAMiC,uBAAuB,GAAG,IAAI7D,8BAA8B,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../example/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,aAAa,CAAA;AAGpB,eAAO,MAAM,GAAG,yBAcf,CAAA"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../example/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,aAAa,CAAA;AAGpB,eAAO,MAAM,GAAG,yBAgBf,CAAA"}
@@ -4,7 +4,7 @@ interface ShadowRegistry extends UnistylesShadowRegistrySpec {
4
4
  add(handle?: ViewHandle, style?: Unistyle, variants?: Record<string, string | boolean>, args?: Array<any>): void;
5
5
  remove(handle?: ViewHandle, style?: Unistyle): void;
6
6
  link(node: ShadowNode, style?: Unistyle, variants?: Record<string, string | boolean>, args?: Array<any>): void;
7
- unlink(node: ShadowNode, style: Unistyle): void;
7
+ unlink(node: ShadowNode): void;
8
8
  }
9
9
  type PrivateMethods = 'add' | 'remove' | 'link' | 'unlink';
10
10
  export declare const UnistylesShadowRegistry: Omit<ShadowRegistry, PrivateMethods>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/specs/ShadowRegistry/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,IAAI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E,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACjH,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEpD,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAC/G,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;CACjC;AAkCD,KAAK,cAAc,GACb,KAAK,GACL,QAAQ,GACR,MAAM,GACN,QAAQ,CAAA;AAEd,eAAO,MAAM,uBAAuB,EAA2B,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"createUnistylesComponent.d.ts","sourceRoot":"","sources":["../../../../src/web/createUnistylesComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAmClD,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,MAAM,aAAa,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,aAAa,MAAM,sBAoBxH,CAAA"}
1
+ {"version":3,"file":"createUnistylesComponent.d.ts","sourceRoot":"","sources":["../../../../src/web/createUnistylesComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAiClD,eAAO,MAAM,wBAAwB,GAAI,MAAM,SAAS,MAAM,aAAa,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,aAAa,MAAM,sBAoBxH,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"listenToDependencies.d.ts","sourceRoot":"","sources":["../../../../../src/web/listener/listenToDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAOnF,KAAK,yBAAyB,GAAG;IAC7B,GAAG,EAAE,WAAW,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAA;IACjD,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,oDAA0D,yBAAyB,6BAiCnH,CAAA"}
1
+ {"version":3,"file":"listenToDependencies.d.ts","sourceRoot":"","sources":["../../../../../src/web/listener/listenToDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAMnF,KAAK,yBAAyB,GAAG;IAC7B,GAAG,EAAE,WAAW,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAA;IACjD,IAAI,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,oDAA0D,yBAAyB,6BA6BnH,CAAA"}
@@ -1,6 +1,9 @@
1
1
  import { TypeStyle } from 'typestyle';
2
2
  import type { UnistylesValues } from '../types';
3
+ import type { StyleSheet, StyleSheetWithSuperPowers } from '../types/stylesheet';
3
4
  declare class UnistylesRegistryBuilder {
5
+ private stylesheets;
6
+ getComputedStylesheet: (stylesheet: StyleSheetWithSuperPowers<StyleSheet>) => StyleSheet;
4
7
  createStyles: (stylesheet: UnistylesValues, key: string) => {
5
8
  className: string;
6
9
  unistyles: TypeStyle;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/web/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,cAAM,wBAAwB;IAC1B,YAAY,eAAgB,eAAe,OAAO,MAAM;;;MAYvD;IAED,YAAY,cAAe,SAAS,cAAc,eAAe,aAAa,MAAM,UAKnF;CACJ;AAED,eAAO,MAAM,iBAAiB,0BAAiC,CAAA"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/web/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AAKhF,cAAM,wBAAwB;IAC1B,OAAO,CAAC,WAAW,CAA+D;IAElF,qBAAqB,eAAgB,yBAAyB,CAAC,UAAU,CAAC,gBAwBzE;IAED,YAAY,eAAgB,eAAe,OAAO,MAAM;;;MAYvD;IAED,YAAY,cAAe,SAAS,cAAc,eAAe,aAAa,MAAM,UAKnF;CACJ;AAED,eAAO,MAAM,iBAAiB,0BAAiC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"shadowRegistry.d.ts","sourceRoot":"","sources":["../../../../src/web/shadowRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAS/C,KAAK,KAAK,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,CAAA;AAEzE,cAAM,8BAA8B;IAEhC,IAAI,SAA4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
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "3.0.0-alpha.19",
3
+ "version": "3.0.0-alpha.20",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -54,7 +54,7 @@ pluginTester({
54
54
  style={[styles.container]}
55
55
  ref={ref => {
56
56
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
57
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
57
+ return () => UnistylesShadowRegistry.remove(ref)
58
58
  }}
59
59
  >
60
60
  <Text>Hello world</Text>
@@ -117,7 +117,7 @@ pluginTester({
117
117
  style={[styles.container]}
118
118
  ref={ref => {
119
119
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
120
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
120
+ return () => UnistylesShadowRegistry.remove(ref)
121
121
  }}
122
122
  >
123
123
  <Text>Hello world</Text>
@@ -174,7 +174,7 @@ pluginTester({
174
174
  style={[styles.container]}
175
175
  ref={ref => {
176
176
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
177
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
177
+ return () => UnistylesShadowRegistry.remove(ref)
178
178
  }}
179
179
  >
180
180
  <Text>Hello world</Text>
@@ -289,7 +289,7 @@ pluginTester({
289
289
  style={[styles.container]}
290
290
  ref={ref => {
291
291
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
292
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
292
+ return () => UnistylesShadowRegistry.remove(ref)
293
293
  }}
294
294
  >
295
295
  <Text>Hello world</Text>
@@ -416,7 +416,7 @@ pluginTester({
416
416
  style={[styles.container]}
417
417
  ref={ref => {
418
418
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
419
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
419
+ return () => UnistylesShadowRegistry.remove(ref)
420
420
  }}
421
421
  >
422
422
  <Text>Hello world</Text>
@@ -79,7 +79,7 @@ pluginTester({
79
79
  style={[styles.container]}
80
80
  ref={ref => {
81
81
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
82
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
82
+ return () => UnistylesShadowRegistry.remove(ref)
83
83
  }}
84
84
  >
85
85
  <Text>Hello world</Text>
@@ -128,7 +128,7 @@ pluginTester({
128
128
  style={[styles.container]}
129
129
  ref={ref => {
130
130
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
131
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
131
+ return () => UnistylesShadowRegistry.remove(ref)
132
132
  }}
133
133
  >
134
134
  <Text style={styles.text}>Hello world</Text>
@@ -186,7 +186,7 @@ pluginTester({
186
186
  ref={_ref => {
187
187
  ref.current = _ref
188
188
  UnistylesShadowRegistry.add(_ref, styles.container, undefined, undefined)
189
- return () => UnistylesShadowRegistry.remove(_ref, styles.container)
189
+ return () => UnistylesShadowRegistry.remove(_ref)
190
190
  }}
191
191
  style={[styles.container]}
192
192
  >
@@ -250,7 +250,7 @@ pluginTester({
250
250
  myRef.current = ref
251
251
  UnistylesShadowRegistry.add(ref, styles.container, undefined, undefined)
252
252
  return () => {
253
- UnistylesShadowRegistry.remove(ref, styles.container)
253
+ UnistylesShadowRegistry.remove(ref)
254
254
  }
255
255
  }}
256
256
  style={[styles.container]}
@@ -322,7 +322,7 @@ pluginTester({
322
322
  ;(() => {
323
323
  customCleanup()
324
324
  })()
325
- UnistylesShadowRegistry.remove(ref, styles.container)
325
+ UnistylesShadowRegistry.remove(ref)
326
326
  }
327
327
  }}
328
328
  style={[styles.container]}
@@ -398,7 +398,7 @@ pluginTester({
398
398
  ;(() => {
399
399
  customCleanup2()
400
400
  })()
401
- UnistylesShadowRegistry.remove(_ref, styles.container)
401
+ UnistylesShadowRegistry.remove(_ref)
402
402
  }
403
403
  }}
404
404
  style={[styles.container]}
@@ -474,7 +474,7 @@ pluginTester({
474
474
  ;(() => {
475
475
  customCleanup2()
476
476
  })()
477
- UnistylesShadowRegistry.remove(_ref, styles.container)
477
+ UnistylesShadowRegistry.remove(_ref)
478
478
  }
479
479
  }}
480
480
  style={[styles.container]}
@@ -523,6 +523,7 @@ pluginTester({
523
523
  })
524
524
  `,
525
525
  output: `
526
+ import { UnistylesShadowRegistry } from 'react-native-unistyles'
526
527
  import { useRef } from 'react'
527
528
  import { View, Text } from 'react-native'
528
529
  import { StyleSheet } from 'react-native-unistyles'
@@ -532,10 +533,19 @@ pluginTester({
532
533
 
533
534
  return (
534
535
  <View
535
- ref={myRef}
536
- style={{
537
- backgroundColor: 'red'
536
+ ref={_ref => {
537
+ myRef.current = _ref
538
+ UnistylesShadowRegistry.add(
539
+ _ref,
540
+ {
541
+ backgroundColor: 'red'
542
+ },
543
+ undefined,
544
+ undefined
545
+ )
546
+ return () => UnistylesShadowRegistry.remove(_ref)
538
547
  }}
548
+ style={[{ backgroundColor: 'red' }]}
539
549
  >
540
550
  <Text>Hello world</Text>
541
551
  </View>
@@ -597,8 +607,8 @@ pluginTester({
597
607
  UnistylesShadowRegistry.add(_ref, obj1, undefined, undefined)
598
608
  UnistylesShadowRegistry.add(_ref, obj2, undefined, undefined)
599
609
  return () => {
600
- ;(() => UnistylesShadowRegistry.remove(_ref, obj1))()
601
- UnistylesShadowRegistry.remove(_ref, obj2)
610
+ ;(() => UnistylesShadowRegistry.remove(_ref))()
611
+ UnistylesShadowRegistry.remove(_ref)
602
612
  }
603
613
  }}
604
614
  style={[obj1, obj2]}
@@ -660,8 +670,8 @@ pluginTester({
660
670
  UnistylesShadowRegistry.add(_ref, obj1, undefined, undefined)
661
671
  UnistylesShadowRegistry.add(_ref, obj2, undefined, undefined)
662
672
  return () => {
663
- ;(() => UnistylesShadowRegistry.remove(_ref, obj1))()
664
- UnistylesShadowRegistry.remove(_ref, obj2)
673
+ ;(() => UnistylesShadowRegistry.remove(_ref))()
674
+ UnistylesShadowRegistry.remove(_ref)
665
675
  }
666
676
  }}
667
677
  style={[obj1, obj2]}
@@ -726,14 +736,20 @@ pluginTester({
726
736
  ref={_ref => {
727
737
  myRef.current = _ref
728
738
  UnistylesShadowRegistry.add(_ref, styles.container, undefined, undefined)
729
- return () => UnistylesShadowRegistry.remove(_ref, styles.container)
730
- }}
731
- style={[
732
- styles.container,
733
- {
734
- backgroundColor: 'red'
739
+ UnistylesShadowRegistry.add(
740
+ _ref,
741
+ {
742
+ backgroundColor: 'red'
743
+ },
744
+ undefined,
745
+ undefined
746
+ )
747
+ return () => {
748
+ ;(() => UnistylesShadowRegistry.remove(_ref))()
749
+ UnistylesShadowRegistry.remove(_ref)
735
750
  }
736
- ]}
751
+ }}
752
+ style={[styles.container, { backgroundColor: 'red' }]}
737
753
  >
738
754
  <Text>Hello world</Text>
739
755
  </View>
@@ -795,14 +811,20 @@ pluginTester({
795
811
  ref={_ref => {
796
812
  myRef.current = _ref
797
813
  UnistylesShadowRegistry.add(_ref, styles.container, undefined, undefined)
798
- return () => UnistylesShadowRegistry.remove(_ref, styles.container)
799
- }}
800
- style={[
801
- styles.container,
802
- {
803
- backgroundColor: 'red'
814
+ UnistylesShadowRegistry.add(
815
+ _ref,
816
+ {
817
+ backgroundColor: 'red'
818
+ },
819
+ undefined,
820
+ undefined
821
+ )
822
+ return () => {
823
+ ;(() => UnistylesShadowRegistry.remove(_ref))()
824
+ UnistylesShadowRegistry.remove(_ref)
804
825
  }
805
- ]}
826
+ }}
827
+ style={[styles.container, { backgroundColor: 'red' }]}
806
828
  >
807
829
  <Text>Hello world</Text>
808
830
  </View>
@@ -859,7 +881,7 @@ pluginTester({
859
881
  ref={_ref => {
860
882
  myRef.current = _ref
861
883
  UnistylesShadowRegistry.add(_ref, styles.container, undefined, undefined)
862
- return () => UnistylesShadowRegistry.remove(_ref, styles.container)
884
+ return () => UnistylesShadowRegistry.remove(_ref)
863
885
  }}
864
886
  style={[styles.container]}
865
887
  >
@@ -920,7 +942,7 @@ pluginTester({
920
942
  ref={_ref => {
921
943
  myRef.current = _ref
922
944
  UnistylesShadowRegistry.add(_ref, styles.container, undefined, [1, 2])
923
- return () => UnistylesShadowRegistry.remove(_ref, styles.container)
945
+ return () => UnistylesShadowRegistry.remove(_ref)
924
946
  }}
925
947
  style={[styles.container(1, 2)]}
926
948
  >
@@ -982,7 +1004,11 @@ pluginTester({
982
1004
  ref={_ref => {
983
1005
  myRef.current = _ref
984
1006
  UnistylesShadowRegistry.add(_ref, styles.container, undefined, [1, 2])
985
- return () => UnistylesShadowRegistry.remove(_ref, styles.container)
1007
+ UnistylesShadowRegistry.add(_ref, { backgroundColor: 'red' }, undefined, undefined)
1008
+ return () => {
1009
+ ;(() => UnistylesShadowRegistry.remove(_ref))()
1010
+ UnistylesShadowRegistry.remove(_ref)
1011
+ }
986
1012
  }}
987
1013
  style={[{ backgroundColor: 'red' }, styles.container(1, 2)]}
988
1014
  >
@@ -1059,7 +1085,7 @@ pluginTester({
1059
1085
  ref={_ref => {
1060
1086
  myRef.current = _ref
1061
1087
  UnistylesShadowRegistry.add(_ref, uhh.dkk, __uni__variants, [])
1062
- return () => UnistylesShadowRegistry.remove(_ref, uhh.dkk)
1088
+ return () => UnistylesShadowRegistry.remove(_ref)
1063
1089
  }}
1064
1090
  style={[uhh.dkk()]}
1065
1091
  >
@@ -1129,7 +1155,7 @@ pluginTester({
1129
1155
  ref={_ref => {
1130
1156
  myRef.current = _ref
1131
1157
  UnistylesShadowRegistry.add(_ref, uhh.dkk, undefined, [])
1132
- return () => UnistylesShadowRegistry.remove(_ref, uhh.dkk)
1158
+ return () => UnistylesShadowRegistry.remove(_ref)
1133
1159
  }}
1134
1160
  style={[uhh.dkk()]}
1135
1161
  >
@@ -1183,21 +1209,21 @@ pluginTester({
1183
1209
  style={[styles.container(1, 5)]}
1184
1210
  ref={ref => {
1185
1211
  UnistylesShadowRegistry.add(ref, styles.container, undefined, [1, 5])
1186
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
1212
+ return () => UnistylesShadowRegistry.remove(ref)
1187
1213
  }}
1188
1214
  />
1189
1215
  <View
1190
1216
  style={[styles.container(2, 6)]}
1191
1217
  ref={ref => {
1192
1218
  UnistylesShadowRegistry.add(ref, styles.container, undefined, [2, 6])
1193
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
1219
+ return () => UnistylesShadowRegistry.remove(ref)
1194
1220
  }}
1195
1221
  />
1196
1222
  <View
1197
1223
  style={[styles.container(5, 1)]}
1198
1224
  ref={ref => {
1199
1225
  UnistylesShadowRegistry.add(ref, styles.container, undefined, [5, 1])
1200
- return () => UnistylesShadowRegistry.remove(ref, styles.container)
1226
+ return () => UnistylesShadowRegistry.remove(ref)
1201
1227
  }}
1202
1228
  />
1203
1229
  </React.Fragment>
@@ -1250,8 +1276,8 @@ pluginTester({
1250
1276
  UnistylesShadowRegistry.add(ref, styles.container, undefined, [1, 5])
1251
1277
  UnistylesShadowRegistry.add(ref, styles.container2, undefined, [1, 6])
1252
1278
  return () => {
1253
- ;(() => UnistylesShadowRegistry.remove(ref, styles.container))()
1254
- UnistylesShadowRegistry.remove(ref, styles.container2)
1279
+ ;(() => UnistylesShadowRegistry.remove(ref))()
1280
+ UnistylesShadowRegistry.remove(ref)
1255
1281
  }
1256
1282
  }}
1257
1283
  />
@@ -1313,10 +1339,10 @@ pluginTester({
1313
1339
  UnistylesShadowRegistry.add(ref, styles.thirdProp, undefined, undefined)
1314
1340
  return () => {
1315
1341
  ;(() => {
1316
- ;(() => UnistylesShadowRegistry.remove(ref, styles.container))()
1317
- UnistylesShadowRegistry.remove(ref, styles.secondProp)
1342
+ ;(() => UnistylesShadowRegistry.remove(ref))()
1343
+ UnistylesShadowRegistry.remove(ref)
1318
1344
  })()
1319
- UnistylesShadowRegistry.remove(ref, styles.thirdProp)
1345
+ UnistylesShadowRegistry.remove(ref)
1320
1346
  }
1321
1347
  }}
1322
1348
  />
@@ -1344,6 +1370,58 @@ pluginTester({
1344
1370
  921918562
1345
1371
  )
1346
1372
  `
1373
+ },
1374
+ {
1375
+ title: 'Should support nested styles',
1376
+ code: `
1377
+ import { View } from 'react-native'
1378
+ import { StyleSheet } from 'react-native-unistyles'
1379
+
1380
+ export const Example = ({ styles }) => {
1381
+ return (
1382
+ <View style={styles.nested.prop} />
1383
+ )
1384
+ }
1385
+
1386
+ const styles = StyleSheet.create(theme => ({
1387
+ container: {
1388
+ flex: 1,
1389
+ alignItems: 'center',
1390
+ justifyContent: 'center',
1391
+ backgroundColor: theme.colors.backgroundColor
1392
+ }
1393
+ }))
1394
+ `,
1395
+ output: `
1396
+ import { UnistylesShadowRegistry } from 'react-native-unistyles'
1397
+ import { View } from 'react-native'
1398
+ import { StyleSheet } from 'react-native-unistyles'
1399
+
1400
+ export const Example = ({ styles }) => {
1401
+ return (
1402
+ <View
1403
+ style={[styles.nested.prop]}
1404
+ ref={ref => {
1405
+ UnistylesShadowRegistry.add(ref, styles.nested.prop, undefined, undefined)
1406
+ return () => UnistylesShadowRegistry.remove(ref)
1407
+ }}
1408
+ />
1409
+ )
1410
+ }
1411
+
1412
+ const styles = StyleSheet.create(
1413
+ theme => ({
1414
+ container: {
1415
+ flex: 1,
1416
+ alignItems: 'center',
1417
+ justifyContent: 'center',
1418
+ backgroundColor: theme.colors.backgroundColor,
1419
+ uni__dependencies: [0]
1420
+ }
1421
+ }),
1422
+ 921918562
1423
+ )
1424
+ `
1347
1425
  }
1348
1426
  ]
1349
1427
  })