react-native-unistyles 3.0.0-alpha.13 → 3.0.0-alpha.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/cxx/core/UnistyleWrapper.h +1 -1
  2. package/cxx/core/UnistylesCommitHook.cpp +5 -2
  3. package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -3
  4. package/cxx/hybridObjects/HybridStyleSheet.h +1 -1
  5. package/lib/commonjs/index.js +4 -0
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/specs/ShadowRegistry/index.js +7 -1
  8. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  9. package/lib/commonjs/web/convert/index.js +1 -1
  10. package/lib/commonjs/web/convert/index.js.map +1 -1
  11. package/lib/commonjs/web/create.js +25 -63
  12. package/lib/commonjs/web/create.js.map +1 -1
  13. package/lib/commonjs/web/createUnistylesComponent.js +61 -0
  14. package/lib/commonjs/web/createUnistylesComponent.js.map +1 -0
  15. package/lib/commonjs/web/index.js +12 -3
  16. package/lib/commonjs/web/index.js.map +1 -1
  17. package/lib/commonjs/web/listener/index.js +7 -0
  18. package/lib/commonjs/web/listener/index.js.map +1 -1
  19. package/lib/commonjs/web/listener/listenToDependencies.js +39 -0
  20. package/lib/commonjs/web/listener/listenToDependencies.js.map +1 -0
  21. package/lib/commonjs/web/listener/listener.js +1 -2
  22. package/lib/commonjs/web/listener/listener.js.map +1 -1
  23. package/lib/commonjs/web/mock.js +1 -10
  24. package/lib/commonjs/web/mock.js.map +1 -1
  25. package/lib/commonjs/web/pseudo.js +2 -3
  26. package/lib/commonjs/web/pseudo.js.map +1 -1
  27. package/lib/commonjs/web/registry.js +2 -4
  28. package/lib/commonjs/web/registry.js.map +1 -1
  29. package/lib/commonjs/web/runtime.js +0 -1
  30. package/lib/commonjs/web/runtime.js.map +1 -1
  31. package/lib/commonjs/web/shadowRegistry.js +120 -0
  32. package/lib/commonjs/web/shadowRegistry.js.map +1 -0
  33. package/lib/commonjs/web/state.js +0 -40
  34. package/lib/commonjs/web/state.js.map +1 -1
  35. package/lib/commonjs/web/utils.js +66 -14
  36. package/lib/commonjs/web/utils.js.map +1 -1
  37. package/lib/commonjs/web/variants/useVariants.js +1 -34
  38. package/lib/commonjs/web/variants/useVariants.js.map +1 -1
  39. package/lib/module/index.js +4 -0
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/specs/ShadowRegistry/index.js +7 -1
  42. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  43. package/lib/module/web/convert/index.js +1 -1
  44. package/lib/module/web/convert/index.js.map +1 -1
  45. package/lib/module/web/create.js +26 -64
  46. package/lib/module/web/create.js.map +1 -1
  47. package/lib/module/web/createUnistylesComponent.js +54 -0
  48. package/lib/module/web/createUnistylesComponent.js.map +1 -0
  49. package/lib/module/web/index.js +4 -2
  50. package/lib/module/web/index.js.map +1 -1
  51. package/lib/module/web/listener/index.js +1 -0
  52. package/lib/module/web/listener/index.js.map +1 -1
  53. package/lib/module/web/listener/listenToDependencies.js +34 -0
  54. package/lib/module/web/listener/listenToDependencies.js.map +1 -0
  55. package/lib/module/web/listener/listener.js +1 -1
  56. package/lib/module/web/listener/listener.js.map +1 -1
  57. package/lib/module/web/mock.js +0 -9
  58. package/lib/module/web/mock.js.map +1 -1
  59. package/lib/module/web/pseudo.js +2 -3
  60. package/lib/module/web/pseudo.js.map +1 -1
  61. package/lib/module/web/registry.js +2 -4
  62. package/lib/module/web/registry.js.map +1 -1
  63. package/lib/module/web/runtime.js +0 -1
  64. package/lib/module/web/runtime.js.map +1 -1
  65. package/lib/module/web/shadowRegistry.js +116 -0
  66. package/lib/module/web/shadowRegistry.js.map +1 -0
  67. package/lib/module/web/state.js +0 -40
  68. package/lib/module/web/state.js.map +1 -1
  69. package/lib/module/web/utils.js +59 -12
  70. package/lib/module/web/utils.js.map +1 -1
  71. package/lib/module/web/variants/useVariants.js +1 -34
  72. package/lib/module/web/variants/useVariants.js.map +1 -1
  73. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  74. package/lib/typescript/src/web/create.d.ts.map +1 -1
  75. package/lib/typescript/src/web/createUnistylesComponent.d.ts +3 -0
  76. package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +1 -0
  77. package/lib/typescript/src/web/index.d.ts +2 -1
  78. package/lib/typescript/src/web/index.d.ts.map +1 -1
  79. package/lib/typescript/src/web/listener/index.d.ts +1 -0
  80. package/lib/typescript/src/web/listener/index.d.ts.map +1 -1
  81. package/lib/typescript/src/web/listener/listenToDependencies.d.ts +12 -0
  82. package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +1 -0
  83. package/lib/typescript/src/web/listener/listener.d.ts +2 -1
  84. package/lib/typescript/src/web/listener/listener.d.ts.map +1 -1
  85. package/lib/typescript/src/web/mock.d.ts +0 -9
  86. package/lib/typescript/src/web/mock.d.ts.map +1 -1
  87. package/lib/typescript/src/web/pseudo.d.ts +4 -2
  88. package/lib/typescript/src/web/pseudo.d.ts.map +1 -1
  89. package/lib/typescript/src/web/registry.d.ts +1 -1
  90. package/lib/typescript/src/web/registry.d.ts.map +1 -1
  91. package/lib/typescript/src/web/runtime.d.ts +0 -1
  92. package/lib/typescript/src/web/runtime.d.ts.map +1 -1
  93. package/lib/typescript/src/web/shadowRegistry.d.ts +17 -0
  94. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -0
  95. package/lib/typescript/src/web/state.d.ts +0 -5
  96. package/lib/typescript/src/web/state.d.ts.map +1 -1
  97. package/lib/typescript/src/web/utils.d.ts +22 -7
  98. package/lib/typescript/src/web/utils.d.ts.map +1 -1
  99. package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -1
  100. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -3
  101. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +8 -3
  102. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +1 -1
  103. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +1 -1
  104. package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +14 -2
  105. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +3 -0
  106. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +3 -0
  107. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +3 -0
  108. package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +3 -0
  109. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +3 -0
  110. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
  111. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +4 -1
  112. package/package.json +3 -3
  113. package/src/index.ts +3 -0
  114. package/src/specs/ShadowRegistry/index.ts +7 -1
  115. package/src/web/convert/index.ts +1 -1
  116. package/src/web/create.ts +24 -79
  117. package/src/web/createUnistylesComponent.tsx +56 -0
  118. package/src/web/index.ts +3 -2
  119. package/src/web/listener/index.ts +1 -0
  120. package/src/web/listener/listenToDependencies.ts +50 -0
  121. package/src/web/listener/listener.ts +1 -1
  122. package/src/web/mock.ts +0 -10
  123. package/src/web/pseudo.ts +131 -5
  124. package/src/web/registry.ts +3 -5
  125. package/src/web/runtime.ts +0 -2
  126. package/src/web/shadowRegistry.ts +121 -0
  127. package/src/web/state.ts +0 -44
  128. package/src/web/utils.ts +90 -16
  129. package/src/web/variants/useVariants.ts +1 -37
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesRegistry","keyInObject","reduceObject","toReactNativeClassName","UnistylesRuntime","createUseVariants","getVariants","UnistylesListener","create","stylesheet","computedStylesheet","theme","miniRuntime","lastlySelectedVariants","listenToDependencies","key","className","unistyles","value","args","dependencies","length","addListeners","newComputedStylesheet","result","updateStyles","styles","webUnistyleByRef","Map","disposeByRef","ref","slice","variants","Object","fromEntries","resultWithVariants","HTMLElement","storedWebUnistyle","get","webUnistyle","createStyles","set","classList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AC;UACHW,GAAG,CAACY,SAAS,CAACC,GAAG,CAACJ,WAAW,CAACvB,SAAS,CAAC;UAExC,IAAIqB,iBAAiB,EAAE;YACnBrC,iBAAiB,CAACyB,YAAY,CAACc,WAAW,CAACtB,SAAS,EAAEkB,kBAAkB,EAAEI,WAAW,CAACvB,SAAS,CAAC;UACpG;UAGA;QACJ;QAEA,OAAOb,sBAAsB,CAAC,IAAI,EAAEgC,kBAAkB,CAAC;MAC3D,CAAC;IACL;IAEA,MAAM;MAAEnB,SAAS;MAAEC;IAAU,CAAC,GAAGjB,iBAAiB,CAACwC,YAAY,CAACtB,KAAK,EAAEH,GAAG,CAAC;IAE3ED,oBAAoB,CAAC;MAAEC,GAAG;MAAEG,KAAK;MAAED,SAAS;MAAED;IAAU,CAAC,CAAC;IAE1D,OAAOb,sBAAsB,CAACa,SAAS,EAAEE,KAAK,CAAC;EACnD,CAAC,CAAsC;EAEvCb,iBAAiB,CAACqB,MAAM,EAAEkB,WAAW,IAAI;IACrC/B,sBAAsB,GAAG+B,WAAW;EACxC,CAAC,CAAC;EAEF,OAAOlB,MAAM;AACjB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["assignSecrets","reduceObject","getStyles","UnistylesRuntime","createUseVariants","getVariants","create","stylesheet","computedStylesheet","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","_key","String","dynamicStyle","result","variants","resultWithVariants","newVariants","forEach","set"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AAEA,SAASA,aAAa,EAAEC,YAAY,EAAEC,SAAS,QAAQ,SAAS;AAChE,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,iBAAiB,EAAEC,WAAW,QAAQ,YAAY;AAE3D,OAAO,MAAMC,MAAM,GAAIC,UAAiD,IAAK;EACzE,MAAMC,kBAAkB,GAAG,OAAOD,UAAU,KAAK,UAAU,GAC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F,UAAU,CAACf,SAAS,CAACgB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACAf,iBAAiB,CAACuB,MAAM,EAAEO,WAAW,IAAIpB,MAAM,CAACE,OAAO,CAACkB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAAChB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAACyB,GAAG,CAACjB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOS,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ import React, { useEffect, useState } from 'react';
4
+ import { extractHiddenProperties, extractSecrets } from './utils';
5
+ import { UnistylesRuntime } from './runtime';
6
+ import { getVariants } from './variants';
7
+ import { UnistylesListener } from './listener';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const getStyles = value => {
10
+ const secrets = extractSecrets(value);
11
+ if (secrets.length === 0) {
12
+ return undefined;
13
+ }
14
+ return secrets.reduce((acc, {
15
+ __uni__stylesheet,
16
+ __uni__key,
17
+ __uni__args = [],
18
+ __uni__variants
19
+ }) => {
20
+ const newComputedStylesheet = typeof __uni__stylesheet === 'function' ? __uni__stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : __uni__stylesheet;
21
+ const style = newComputedStylesheet[__uni__key];
22
+ const resultHidden = typeof style === 'function' ? style(...__uni__args) : style;
23
+ const result = extractHiddenProperties(resultHidden);
24
+ const {
25
+ variants
26
+ } = Object.fromEntries(getVariants({
27
+ variants: result
28
+ }, __uni__variants));
29
+ const resultWithVariants = {
30
+ ...result,
31
+ ...variants
32
+ };
33
+ return {
34
+ ...acc,
35
+ ...resultWithVariants
36
+ };
37
+ }, {});
38
+ };
39
+ export const createUnistylesComponent = Component => props => {
40
+ const passedStyles = props.style ?? {};
41
+ const [style, setStyle] = useState(getStyles(passedStyles));
42
+ useEffect(() => {
43
+ const newStyles = getStyles(passedStyles);
44
+ const dependencies = newStyles?.['uni__dependencies'] ?? [];
45
+ const dispose = UnistylesListener.addListeners(dependencies, () => setStyle(getStyles(passedStyles)));
46
+ setStyle(newStyles);
47
+ return dispose;
48
+ }, [passedStyles]);
49
+ return /*#__PURE__*/_jsx(Component, {
50
+ ...props,
51
+ style: style
52
+ });
53
+ };
54
+ //# sourceMappingURL=createUnistylesComponent.js.map
@@ -0,0 +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,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,CAChB,CAAC;AAEV,CAAC","ignoreList":[]}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import { create } from './create';
4
- import { UnistylesRuntime } from './runtime';
5
4
  import { UnistylesState } from './state';
6
5
  import { deepMergeObjects } from './utils';
7
6
  export const StyleSheet = {
@@ -19,6 +18,9 @@ export const StyleSheet = {
19
18
  hairlineWidth: 1
20
19
  };
21
20
  export { UnistylesRuntime } from './runtime';
21
+ export { UnistylesShadowRegistry } from './shadowRegistry';
22
22
  export * from './mock';
23
- export const getSSRUnistyles = () => UnistylesRuntime.getSSRUnistyles();
23
+
24
+ // TODO: Work on SSR
25
+ export const getSSRUnistyles = () => [];
24
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["create","UnistylesRuntime","UnistylesState","deepMergeObjects","StyleSheet","configure","init","absoluteFill","position","left","top","right","bottom","compose","a","b","flatten","styles","hairlineWidth","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,gBAAgB,QAAQ,SAAS;AAE1C,OAAO,MAAMC,UAAU,GAAG;EACtBC,SAAS,EAAEH,cAAc,CAACI,IAAI;EAC9BN,MAAM;EACNO,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAS,EAAEC,CAAS,KAAKZ,gBAAgB,CAACW,CAAC,EAAEC,CAAC,CAAC;EACzDC,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAKd,gBAAgB,CAAC,GAAGc,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC;AAED,SAASjB,gBAAgB,QAAQ,WAAW;AAC5C,cAAc,QAAQ;AAEtB,OAAO,MAAMkB,eAAe,GAAGA,CAAA,KAAMlB,gBAAgB,CAACkB,eAAe,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["create","UnistylesState","deepMergeObjects","StyleSheet","configure","init","absoluteFill","position","left","top","right","bottom","compose","a","b","flatten","styles","hairlineWidth","UnistylesRuntime","UnistylesShadowRegistry","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,gBAAgB,QAAQ,SAAS;AAE1C,OAAO,MAAMC,UAAU,GAAG;EACtBC,SAAS,EAAEH,cAAc,CAACI,IAAI;EAC9BL,MAAM;EACNM,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAS,EAAEC,CAAS,KAAKZ,gBAAgB,CAACW,CAAC,EAAEC,CAAC,CAAC;EACzDC,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAKd,gBAAgB,CAAC,GAAGc,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC;AAED,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,cAAc,QAAQ;;AAEtB;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAAM,EAAE","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  export { UnistylesListener } from './listener';
4
+ export { listenToDependencies } from './listenToDependencies';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesListener"],"sourceRoot":"../../../../src","sources":["web/listener/index.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesListener","listenToDependencies"],"sourceRoot":"../../../../src","sources":["web/listener/index.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,oBAAoB,QAAQ,wBAAwB","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { UnistylesListener } from './listener';
4
+ import { UnistylesRuntime } from '../runtime';
5
+ import { keyInObject } from '../utils';
6
+ import { UnistylesRegistry } from '../registry';
7
+ export const listenToDependencies = ({
8
+ key,
9
+ className,
10
+ unistyles,
11
+ args = [],
12
+ stylesheet
13
+ }) => {
14
+ const newComputedStylesheet = typeof stylesheet === 'function' ? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : stylesheet;
15
+ const _value = keyInObject(newComputedStylesheet, key) ? newComputedStylesheet[key] : undefined;
16
+ if (!_value) {
17
+ return;
18
+ }
19
+ const value = typeof _value === 'function' ? _value(...args) : _value;
20
+ const dependencies = 'uni__dependencies' in value ? value['uni__dependencies'] : [];
21
+ if (dependencies.length === 0) {
22
+ return;
23
+ }
24
+ return UnistylesListener.addListeners(dependencies, () => {
25
+ const newComputedStylesheet = typeof stylesheet === 'function' ? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : stylesheet;
26
+ if (!keyInObject(newComputedStylesheet, key)) {
27
+ return;
28
+ }
29
+ const value = newComputedStylesheet[key];
30
+ const result = typeof value === 'function' ? value(...args) : value;
31
+ UnistylesRegistry.updateStyles(unistyles, result, className);
32
+ });
33
+ };
34
+ //# sourceMappingURL=listenToDependencies.js.map
@@ -0,0 +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,S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AC,GACdO,KAAK;IAEXZ,iBAAiB,CAACiB,YAAY,CAACb,SAAS,EAAEY,MAAM,EAAEb,SAAS,CAAC;EAChE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { UnistyleDependency } from '../../specs/NativePlatform';
4
4
  import { UnistylesRuntime } from '../runtime';
5
- export class UnistylesListenerBuilder {
5
+ class UnistylesListenerBuilder {
6
6
  isInitialized = false;
7
7
  listeners = Array.from({
8
8
  length: Object.keys(UnistyleDependency).length / 2
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","UnistylesListener"],"sourceRoot":"../../../../src","sources":["web/listener/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAO,MAAMC,wBAAwB,CAAC;EAC1BC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;EAErHC,UAAU,GAAIC,UAA8B,IAAK;IAC7C,IAAI,CAACR,SAAS,CAACQ,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;EAC/D,CAAC;EAEDC,aAAa,GAAGA,CAAA,KAAM;IAClB,IAAI,IAAI,CAACZ,aAAa,EAAE;MACpB;IACJ;IAEA,IAAI,CAACA,aAAa,GAAG,IAAI;IACzBF,gBAAgB,CAACe,SAAS,EAAEC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACkB,WAAW,CAAC,CAAC;IAC7GjB,gBAAgB,CAACkB,UAAU,EAAEF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACkB,WAAW,CAAC,CAAC;IAC9GE,MAAM,CAACH,gBAAgB,CAAC,mBAAmB,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACqB,WAAW,CAAC,CAAC;IACnGD,MAAM,CAACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACsB,UAAU,CAAC,CAAC;EAC3F,CAAC;EAEDC,YAAY,GAAGA,CAACC,YAAuC,EAAEV,QAAsB,KAAK;IAChFU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACR,SAAS,CAACQ,UAAU,CAAC,EAAEa,GAAG,CAACX,QAAQ,CAAC,CAAC;IAE7E,OAAO,MAAM;MACTU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACR,SAAS,CAACQ,UAAU,CAAC,EAAEc,MAAM,CAACZ,QAAQ,CAAC,CAAC;IACpF,CAAC;EACL,CAAC;AACL;AAEA,OAAO,MAAMa,iBAAiB,GAAG,IAAIzB,wBAAwB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","UnistylesListener"],"sourceRoot":"../../../../src","sources":["web/listener/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,MAAMC,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,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C;AACL;AAEA,OAAO,MAAMa,iBAAiB,GAAG,IAAIzB,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -21,13 +21,4 @@ export const NavigationBar = {
21
21
  __type: 'web',
22
22
  name: 'NavigationBar'
23
23
  };
24
- export const UnistylesShadowRegistry = {
25
- name: 'UnistylesShadowRegistry',
26
- __type: 'web',
27
- equals: () => true,
28
- toString: () => 'UnistylesShadowRegistry',
29
- dispose: () => {},
30
- add: () => {},
31
- remove: () => {}
32
- };
33
24
  //# sourceMappingURL=mock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["StatusBar","width","height","setStyle","setHidden","setBackgroundColor","equals","toString","__type","name","NavigationBar","UnistylesShadowRegistry","dispose","add","remove"],"sourceRoot":"../../../src","sources":["web/mock.ts"],"mappings":";;AAGA,OAAO,MAAMA,SAAwB,GAAG;EACpCC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,WAAW;EAC3BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAED,OAAO,MAAMC,aAAgC,GAAG;EAC5CT,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTE,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,eAAe;EAC/BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAED,OAAO,MAAME,uBAAuB,GAAG;EACnCF,IAAI,EAAE,yBAAyB;EAC/BD,MAAM,EAAE,KAAK;EACbF,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,yBAAyB;EACzCK,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,GAAG,EAAEA,CAAA,KAAM,CAAC,CAAC;EACbC,MAAM,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["StatusBar","width","height","setStyle","setHidden","setBackgroundColor","equals","toString","__type","name","NavigationBar"],"sourceRoot":"../../../src","sources":["web/mock.ts"],"mappings":";;AAGA,OAAO,MAAMA,SAAwB,GAAG;EACpCC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,WAAW;EAC3BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAED,OAAO,MAAMC,aAAgC,GAAG;EAC5CT,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTE,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,eAAe;EAC/BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC","ignoreList":[]}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- // TODO: Add complete list of pseudo selectors
4
- export const pseudos = ['_hover', '_css', '_before', '_after'];
5
- export const isPseudo = selector => pseudos.includes(selector);
3
+ export const pseudos = ['_-moz-broken', '_-moz-drag-over', '_-moz-first-node', '_-moz-handler-blocked', '_-moz-handler-crashed', '_-moz-handler-disabled', '_-moz-last-node', '_-moz-loading', '_-moz-locale-dir(ltr)', '_-moz-locale-dir(rtl)', '_-moz-only-whitespace', '_-moz-submit-invalid', '_-moz-suppressed', '_-moz-user-disabled', '_-moz-window-inactive', '_active', '_any-link', '_autofill', '_blank', '_buffering', '_checked', '_current', '_default', '_defined', '_dir(', '_disabled', '_empty', '_enabled', '_first', '_first-child', '_first-of-type', '_focus', '_focus-visible', '_focus-within', '_fullscreen', '_future', '_has(', '_host', '_host-context(', '_host(', '_hover', '_in-range', '_indeterminate', '_invalid', '_is(', '_lang(', '_last-child', '_last-of-type', '_left', '_link', '_local-link', '_modal', '_muted', '_not(', '_nth-child(', '_nth-last-child(', '_nth-last-of-type(', '_nth-of-type(', '_only-child', '_only-of-type', '_optional', '_out-of-range', '_past', '_paused', '_picture-in-picture', '_placeholder-shown', '_playing', '_popover-open', '_read-only', '_read-write', '_required', '_right', '_scope', '_seeking', '_stalled', '_state(', '_target', '_target-within', '_user-invalid', '_user-valid', '_valid', '_visited', '_volume-locked', '_where(', '_-moz-color-swatch', '_-moz-focus-inner', '_-moz-list-bullet', '_-moz-list-number', '_-moz-meter-bar', '_-moz-progress-bar', '_-moz-range-progress', '_-moz-range-thumb', '_-moz-range-track', '_-webkit-inner-spin-button', '_-webkit-meter-barDeprecated', '_-webkit-meter-even-less-good-value', '_-webkit-meter-inner-element', '_-webkit-meter-optimum-value', '_-webkit-meter-suboptimum-value', '_-webkit-progress-bar', '_-webkit-progress-inner-element', '_-webkit-progress-value', '_-webkit-scrollbar', '_-webkit-search-cancel-button', '_-webkit-search-results-button', '_-webkit-slider-runnable-track', '_-webkit-slider-thumb', '_after', '_backdrop', '_before', '_cue', '_file-selector-button', '_first-letter', '_first-line', '_grammar-error', '_highlight(', '_marker', '_part(', '_placeholder', '_selection', '_slotted(', '_spelling-error', '_target-text', '_view-transition', '_view-transition-group', '_view-transition-image-pair', '_view-transition-new', '_view-transition-old'];
4
+ export const isPseudo = selector => pseudos.some(pseudo => selector.startsWith(pseudo));
6
5
  //# sourceMappingURL=pseudo.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["pseudos","isPseudo","selector","includes"],"sourceRoot":"../../../src","sources":["web/pseudo.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,CACnB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,CACF;AAEV,OAAO,MAAMC,QAAQ,GAAIC,QAAgB,IAAKF,OAAO,CAACG,QAAQ,CAACD,QAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["pseudos","isPseudo","selector","some","pseudo","startsWith"],"sourceRoot":"../../../src","sources":["web/pseudo.ts"],"mappings":";;AAAA,OAAO,MAAMA,OAAO,GAAG,CACnB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,WAAW,EACX,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,SAAS,EACT,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,QAAQ,EACR,aAAa,EACb,eAAe,EACf,OAAO,EACP,OAAO,EACP,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,OAAO,EACP,SAAS,EACT,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,4BAA4B,EAC5B,8BAA8B,EAC9B,qCAAqC,EACrC,8BAA8B,EAC9B,8BAA8B,EAC9B,iCAAiC,EACjC,uBAAuB,EACvB,iCAAiC,EACjC,yBAAyB,EACzB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,gCAAgC,EAChC,uBAAuB,EACvB,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,CAChB;AAEV,OAAO,MAAMC,QAAQ,GAAIC,QAAgB,IAAKF,OAAO,CAACG,IAAI,CAACC,MAAM,IAAIF,QAAQ,CAACG,UAAU,CAACD,MAAM,CAAC,CAAC","ignoreList":[]}
@@ -2,14 +2,12 @@
2
2
 
3
3
  import { createTypeStyle } from 'typestyle';
4
4
  import { convertToTypeStyle } from './convert';
5
- import { UnistylesState } from './state';
6
5
  class UnistylesRegistryBuilder {
7
6
  createStyles = (stylesheet, key) => {
8
- const stylesTag = UnistylesState.createTag();
9
- const unistyles = createTypeStyle(stylesTag);
7
+ const unistyles = createTypeStyle();
10
8
  const typestyleStylesheet = convertToTypeStyle(stylesheet);
11
9
  const className = unistyles.style({
12
- $debugName: String(key)
10
+ $debugName: `${key}-${Math.random().toString(16).slice(10)}`
13
11
  }, typestyleStylesheet);
14
12
  if (stylesheet._web?._css) {
15
13
  const customClassName = Array.isArray(stylesheet._web._css) ? stylesheet._web._css.join(' ') : stylesheet._web._css;
@@ -1 +1 @@
1
- {"version":3,"names":["createTypeStyle","convertToTypeStyle","UnistylesState","UnistylesRegistryBuilder","createStyles","stylesheet","key","stylesTag","createTag","unistyles","typestyleStylesheet","className","style","$debugName","String","_web","_css","customClassName","Array","isArray","join","updateStyles","reinit","cssRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAmB,WAAW;AAEtD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,wBAAwB,CAAC;EAC3BC,YAAY,GAAGA,CAACC,UAA2B,EAAEC,GAAoB,KAAK;IAClE,MAAMC,SAAS,GAAGL,cAAc,CAACM,SAAS,CAAC,CAAC;IAC5C,MAAMC,SAAS,GAAGT,eAAe,CAACO,SAAS,CAAC;IAC5C,MAAMG,mBAAmB,GAAGT,kBAAkB,CAACI,UAAU,CAAC;IAE1D,MAAMM,SAAS,GAAGF,SAAS,CAACG,KAAK,CAAC;MAC9BC,UAAU,EAAEC,MAAM,CAACR,GAAG;IAC1B,CAAC,EAAEI,mBAAmB,CAAC;IAEvB,IAAIL,UAAU,CAACU,IAAI,EAAEC,IAAI,EAAE;MACvB,MAAMC,eAAe,GAAGC,KAAK,CAACC,OAAO,CAACd,UAAU,CAACU,IAAI,CAACC,IAAI,CAAC,GACrDX,UAAU,CAACU,IAAI,CAACC,IAAI,CAACI,IAAI,CAAC,GAAG,CAAC,GAC9Bf,UAAU,CAACU,IAAI,CAACC,IAAI;MAE1B,OAAO;QACHL,SAAS,EAAE,GAAGA,SAAS,IAAIM,eAAe,EAAE;QAC5CR;MACJ,CAAC;IACL;IAEA,OAAO;MACHE,SAAS;MACTF;IACJ,CAAC;EACL,CAAC;EAEDY,YAAY,GAAGA,CAACZ,SAAoB,EAAEJ,UAA2B,EAAEM,SAAiB,KAAK;IACrF,MAAMD,mBAAmB,GAAGT,kBAAkB,CAACI,UAAU,CAAC;IAE1DI,SAAS,CAACa,MAAM,CAAC,CAAC;IAClBb,SAAS,CAACc,OAAO,CAAC,IAAIZ,SAAS,EAAE,EAAED,mBAAmB,CAAC;EAC3D,CAAC;AACL;AAEA,OAAO,MAAMc,iBAAiB,GAAG,IAAIrB,wBAAwB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createTypeStyle","convertToTypeStyle","UnistylesRegistryBuilder","createStyles","stylesheet","key","unistyles","typestyleStylesheet","className","style","$debugName","Math","random","toString","slice","_web","_css","customClassName","Array","isArray","join","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,IAAIH,UAAU,CAACW,IAAI,EAAEC,IAAI,EAAE;MACvB,MAAMC,eAAe,GAAGC,KAAK,CAACC,OAAO,CAACf,UAAU,CAACW,IAAI,CAACC,IAAI,CAAC,GACrDZ,UAAU,CAACW,IAAI,CAACC,IAAI,CAACI,IAAI,CAAC,GAAG,CAAC,GAC9BhB,UAAU,CAACW,IAAI,CAACC,IAAI;MAE1B,OAAO;QACHR,SAAS,EAAE,GAAGA,SAAS,IAAIS,eAAe,EAAE;QAC5CX;MACJ,CAAC;IACL;IAEA,OAAO;MACHE,SAAS;MACTF;IACJ,CAAC;EACL,CAAC;EAEDe,YAAY,GAAGA,CAACf,SAAoB,EAAEF,UAA2B,EAAEI,SAAiB,KAAK;IACrF,MAAMD,mBAAmB,GAAGN,kBAAkB,CAACG,UAAU,CAAC;IAE1DE,SAAS,CAACgB,MAAM,CAAC,CAAC;IAClBhB,SAAS,CAACiB,OAAO,CAAC,IAAIf,SAAS,EAAE,EAAED,mBAAmB,CAAC;EAC3D,CAAC;AACL;AAEA,OAAO,MAAMiB,iBAAiB,GAAG,IAAItB,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -154,7 +154,6 @@ class UnistylesRuntimeBuilder {
154
154
  }
155
155
  UnistylesState.themes.set(themeName, updater(oldTheme));
156
156
  };
157
- getSSRUnistyles = () => UnistylesState.tags;
158
157
  }
159
158
  export const UnistylesRuntime = new UnistylesRuntimeBuilder();
160
159
  //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleDependency","ColorScheme","Orientation","WebContentSizeCategory","UnistylesListener","NavigationBar","StatusBar","UnistylesState","hexToRGBA","isServer","schemeToTheme","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","window","matchMedia","colorScheme","matches","Light","Dark","Unspecified","themeName","contentSizeCategory","breakpoint","orientation","Portrait","screen","type","includes","Landscape","theme","Error","themes","get","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","rtl","document","documentElement","dir","hasAdaptiveThemes","navigationBar","miniRuntime","setTheme","UnistylesRuntime","emitChange","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","hex","alpha","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","set","getSSRUnistyles","tags"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,WAAW,EAAEC,WAAW,QAA0C,gBAAgB;AAE3F,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,aAAa,EAAEC,SAAS,QAAQ,QAAQ;AACjD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AAE5D,MAAMC,uBAAuB,CAAC;EAC1BC,UAAU,GAAG,IAAI,CAACC,aAAa,CAAC,CAAC;EACjCC,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;EAEvBF,aAAaA,CAAA,EAA0B;IAC3C,IAAIJ,QAAQ,CAAC,CAAC,EAAE;MACZ,OAAO,IAAI;IACf;IAEA,IAAI,CAAC,IAAI,CAACG,UAAU,EAAE;MAClB,IAAI,CAACA,UAAU,GAAGI,MAAM,CAACC,UAAU,CAAC,+BAA+B,CAAC;IACxE;IAEA,OAAO,IAAI,CAACL,UAAU;EAC1B;EAEQG,YAAYA,CAAA,EAA0B;IAC1C,IAAIN,QAAQ,CAAC,CAAC,EAAE;MACZ,OAAO,IAAI;IACf;IAEA,IAAI,CAAC,IAAI,CAACK,SAAS,EAAE;MACjB,IAAI,CAACA,SAAS,GAAGE,MAAM,CAACC,UAAU,CAAC,8BAA8B,CAAC;IACtE;IAEA,OAAO,IAAI,CAACH,SAAS;EACzB;EAEA,IAAII,WAAWA,CAAA,EAAG;IACd,QAAQ,IAAI;MACR,KAAK,IAAI,CAACL,aAAa,CAAC,CAAC,EAAEM,OAAO;QAC9B,OAAOlB,WAAW,CAACmB,KAAK;MAC5B,KAAK,IAAI,CAACL,YAAY,CAAC,CAAC,EAAEI,OAAO;QAC7B,O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;EAEDE,eAAe,GAAGA,CAAA,KAAMnE,cAAc,CAACoE,IAAI;AAC/C;AAEA,OAAO,MAAMjB,gBAAgB,GAAG,IAAI/C,uBAAuB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistyleDependency","ColorScheme","Orientation","WebContentSizeCategory","UnistylesListener","NavigationBar","StatusBar","UnistylesState","hexToRGBA","isServer","schemeToTheme","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","window","matchMedia","colorScheme","matches","Light","Dark","Unspecified","themeName","contentSizeCategory","breakpoint","orientation","Portrait","screen","type","includes","Landscape","theme","Error","themes","get","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","rtl","document","documentElement","dir","hasAdaptiveThemes","navigationBar","miniRuntime","setTheme","UnistylesRuntime","emitChange","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","hex","alpha","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","set"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,WAAW,EAAEC,WAAW,QAA0C,gBAAgB;AAE3F,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,aAAa,EAAEC,SAAS,QAAQ,QAAQ;AACjD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AAE5D,MAAMC,uBAAuB,CAAC;EAC1BC,UAAU,GAAG,IAAI,CAACC,aAAa,CAAC,CAAC;EACjCC,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;EAEvBF,aAAaA,CAAA,EAA0B;IAC3C,IAAIJ,QAAQ,CAAC,CAAC,EAAE;MACZ,OAAO,IAAI;IACf;IAEA,IAAI,CAAC,IAAI,CAACG,UAAU,E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QAAQ,CAAC,CAAC,EAAE;MACZ;IACJ;IAEA0C,QAAQ,CAACC,eAAe,CAACe,KAAK,CAACC,eAAe,GAAGF,KAAK,GAAG1D,SAAS,CAACyD,GAAG,EAAEC,KAAK,CAAC,GAAGD,GAAG;EACxF,CAAC;EAEDI,gBAAgB,GAAGA,CAAA,KAAM,CAAC,CAAC;EAE3BC,WAAW,GAAGA,CAAC/C,SAAuB,EAAEgD,OAA6C,KAAK;IACtF,MAAMC,QAAQ,GAAGjE,cAAc,CAAC2B,MAAM,CAACC,GAAG,CAACZ,SAAS,CAAC;IAErD,IAAI,CAACiD,QAAQ,EAAE;MACX,MAAM,IAAIvC,KAAK,CAAC,aAAaV,SAAS,sBAAsB,CAAC;IACjE;IAEAhB,cAAc,CAAC2B,MAAM,CAACuC,GAAG,CAAClD,SAAS,EAAEgD,OAAO,CAACC,QAAQ,CAAC,CAAC;EAC3D,CAAC;AACL;AAEA,OAAO,MAAMd,gBAAgB,GAAG,IAAI/C,uBAAuB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ import { listenToDependencies } from './listener';
4
+ import { UnistylesRegistry } from './registry';
5
+ import { UnistylesRuntime } from './runtime';
6
+ import { createDoubleMap, extractHiddenProperties, extractSecrets, isInDocument } from './utils';
7
+ import { getVariants } from './variants';
8
+ class UnistylesShadowRegistryBuilder {
9
+ // MOCKS
10
+ name = 'UnistylesShadowRegistry';
11
+ __type = 'web';
12
+ equals = () => true;
13
+ toString = () => 'UnistylesShadowRegistry';
14
+ dispose = () => {};
15
+ // END MOCKS
16
+
17
+ webUnistylesMap = createDoubleMap();
18
+ disposeMap = createDoubleMap();
19
+ stylesMap = createDoubleMap();
20
+ add = (ref, _style, _variants, _args) => {
21
+ // Style is not provided
22
+ if (!_style) {
23
+ return;
24
+ }
25
+
26
+ // Array of styles
27
+ if (Array.isArray(_style)) {
28
+ _style.forEach(style => this.add(ref, style, _variants, _args));
29
+ return;
30
+ }
31
+
32
+ // Not a unistyle
33
+ if (!Object.keys(_style).some(key => key.startsWith('__uni__'))) {
34
+ return;
35
+ }
36
+
37
+ // Ref is unmounted, remove style tags from the document
38
+ if (ref === null) {
39
+ const secrets = extractSecrets(_style);
40
+ secrets.forEach(({
41
+ __uni__refs
42
+ }) => {
43
+ __uni__refs.forEach(ref => {
44
+ if (isInDocument(ref)) {
45
+ return;
46
+ }
47
+ this.remove(ref, _style);
48
+ });
49
+ });
50
+ return;
51
+ }
52
+
53
+ // Ref is not an HTMLElement
54
+ if (!(ref instanceof HTMLElement)) {
55
+ return;
56
+ }
57
+ extractSecrets(_style).forEach(secret => {
58
+ const {
59
+ __uni__key,
60
+ __uni__stylesheet,
61
+ __uni__refs,
62
+ __uni__variants,
63
+ __uni__args = []
64
+ } = secret;
65
+ const newComputedStylesheet = typeof __uni__stylesheet === 'function' ? __uni__stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : __uni__stylesheet;
66
+ const style = newComputedStylesheet[__uni__key];
67
+ const args = _args ?? __uni__args;
68
+ const resultHidden = typeof style === 'function' ? style(...args) : style;
69
+ const result = extractHiddenProperties(resultHidden);
70
+ const {
71
+ variants
72
+ } = Object.fromEntries(getVariants({
73
+ variants: result
74
+ }, _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants));
75
+ const resultWithVariants = {
76
+ ...result,
77
+ ...variants
78
+ };
79
+ const storedWebUnistyle = this.webUnistylesMap.get(ref, __uni__key);
80
+ const webUnistyle = storedWebUnistyle ?? UnistylesRegistry.createStyles(resultWithVariants, __uni__key);
81
+ this.webUnistylesMap.set(ref, __uni__key, webUnistyle);
82
+ this.disposeMap.get(ref, __uni__key)?.();
83
+ this.disposeMap.set(ref, __uni__key, listenToDependencies({
84
+ key: __uni__key,
85
+ stylesheet: __uni__stylesheet,
86
+ args,
87
+ className: webUnistyle.className,
88
+ unistyles: webUnistyle.unistyles
89
+ }));
90
+ if (!storedWebUnistyle) {
91
+ const styleTag = document.createElement('style');
92
+ ref.classList.add(webUnistyle.className);
93
+ webUnistyle.unistyles.setStylesTarget(styleTag);
94
+ document.head.appendChild(styleTag);
95
+ __uni__refs.add(ref);
96
+ this.stylesMap.set(ref, __uni__key, styleTag);
97
+ }
98
+ if (storedWebUnistyle) {
99
+ UnistylesRegistry.updateStyles(webUnistyle.unistyles, resultWithVariants, webUnistyle.className);
100
+ }
101
+ });
102
+ };
103
+ remove = (ref, style) => {
104
+ extractSecrets(style).forEach(({
105
+ __uni__key
106
+ }) => {
107
+ this.webUnistylesMap.delete(ref, __uni__key);
108
+ this.disposeMap.get(ref, __uni__key)?.();
109
+ this.disposeMap.delete(ref, __uni__key);
110
+ this.stylesMap.get(ref, __uni__key)?.remove();
111
+ this.stylesMap.delete(ref, __uni__key);
112
+ });
113
+ };
114
+ }
115
+ export const UnistylesShadowRegistry = new UnistylesShadowRegistryBuilder();
116
+ //# sourceMappingURL=shadowRegistry.js.map
@@ -0,0 +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","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,cAA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AG,EAAEkB,UAAU,CAAC,GAAG,CAAC;MACxC,IAAI,CAACrB,UAAU,CAACmD,MAAM,CAAChD,GAAG,EAAEkB,UAAU,CAAC;MACvC,IAAI,CAACpB,SAAS,CAACmC,GAAG,CAACjC,GAAG,EAAEkB,UAAU,CAAC,EAAEH,MAAM,CAAC,CAAC;MAC7C,IAAI,CAACjB,SAAS,CAACkD,MAAM,CAAChD,GAAG,EAAEkB,UAAU,CAAC;IAC1C,CAAC,CAAC;EACN,CAAC;AACL;AAEA,OAAO,MAAM+B,uBAAuB,GAAG,IAAI3D,8BAA8B,CAAC,CAAC","ignoreList":[]}
@@ -1,13 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import { createElement, createRef } from 'react';
4
3
  import { UnistylesRuntime } from './runtime';
5
4
  import { isServer, schemeToTheme } from './utils';
6
5
  import { UnistylesListener } from './listener';
7
6
  import { UnistyleDependency } from '../specs/NativePlatform';
8
7
  class UnistylesStateBuilder {
9
8
  isSSR = isServer();
10
- tags = [];
11
9
  themes = new Map();
12
10
  hasAdaptiveThemes = false;
13
11
  init = config => {
@@ -74,44 +72,6 @@ class UnistylesStateBuilder {
74
72
  });
75
73
  });
76
74
  };
77
- createTag() {
78
- if (!this.isSSR) {
79
- const tag = document.createElement('style');
80
- document.head.appendChild(tag);
81
- return tag;
82
- }
83
- const tagRef = new Proxy(/*#__PURE__*/createRef(), {
84
- set: (target, prop, value) => {
85
- // When ref is assigned
86
- if ('textContent' in value) {
87
- value.textContent = tag.textContent;
88
- }
89
- return Reflect.set(target, prop, value);
90
- }
91
- });
92
- const tagElement = /*#__PURE__*/createElement('style', {
93
- ref: tagRef,
94
- key: this.tags.length
95
- }, '');
96
- const tag = new Proxy({
97
- textContent: ''
98
- }, {
99
- set: (target, prop, value) => {
100
- if (prop !== 'textContent') {
101
- return false;
102
- }
103
-
104
- // When css is updated
105
- target.textContent = value;
106
- if (tagRef.current) {
107
- tagRef.current.textContent = value;
108
- }
109
- return true;
110
- }
111
- });
112
- this.tags.push(tagElement);
113
- return tag;
114
- }
115
75
  }
116
76
  export const UnistylesState = new UnistylesStateBuilder();
117
77
  //# sourceMappingURL=state.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createElement","createRef","UnistylesRuntime","isServer","schemeToTheme","UnistylesListener","UnistyleDependency","UnistylesStateBuilder","isSSR","tags","themes","Map","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","initSettings","settings","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","themeNames","Array","from","keys","initialTheme","length","Error","colorScheme","breakpointsMap","sort","a","b","breakpoint","value","mediaQuery","window","matchMedia","matches","addEventListener","event","currentBreakpoint","find","mq","emitChange","Breakpoints","createTag","tag","document","head","appendChild","tagRef","Proxy","target","prop","textContent","Reflect","tagElement","ref","key","current","push","UnistylesState"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;AAAA,SAA4BA,aAAa,EAAEC,SAAS,QAAQ,OAAO;AAKnE,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,qBAAqB,CAAC;EACPC,KAAK,GAAGL,QAAQ,CAAC,CAAC;EAC1BM,IAAI,GAAG,EAAE;EAElBC,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAM1CC,iBAAiB,GAAG,KAAK;EAEzBC,IAAI,GAAIC,MAAuB,IAAK;IAChC,IAAI,CAACC,UAAU,CAACD,MAAM,CAACJ,MAAM,CAAC;IAC9B,IAAI,CAACM,eAAe,CAACF,MAAM,CAACG,WAAW,CAAC;IACxC,IAAI,CAACC,YAAY,CAACJ,MAAM,CAACK,QAAQ,CAAC;IAElC,IAAI,IAAI,CAACX,KAAK,EAAE;MACZ;IACJ;IAEAH,iBAAiB,CAACe,aAAa,CAAC,CAAC;EACrC,CAAC;EAEOL,UA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G,CAAC;MAE9B,OAAOA,GAAG;IACd;IAEA,MAAMI,MAAM,GAAG,IAAIC,KAAK,cAAC1D,SAAS,CAAmB,CAAC,EAAE;MACpDyB,GAAG,EAAEA,CAACkC,MAAM,EAAEC,IAAI,EAAEpB,KAAK,KAAK;QAC1B;QACA,IAAI,aAAa,IAAIA,KAAK,EAAE;UACxBA,KAAK,CAACqB,WAAW,GAAGR,GAAG,CAACQ,WAAW;QACvC;QAEA,OAAOC,OAAO,CAACrC,GAAG,CAACkC,MAAM,EAAEC,IAAI,EAAEpB,KAAK,CAAC;MAC3C;IACJ,CAAC,CAAC;IACF,MAAMuB,UAAU,gBAAGhE,aAAa,CAAC,OAAO,EAAE;MAAEiE,GAAG,EAAEP,MAAM;MAAEQ,GAAG,EAAE,IAAI,CAACzD,IAAI,CAACwB;IAAO,CAAC,EAAE,EAAE,CAAC;IACrF,MAAMqB,GAAG,GAAG,IAAIK,KAAK,CAAC;MAAEG,WAAW,EAAE;IAAG,CAAC,EAAE;MACvCpC,GAAG,EAAEA,CAACkC,MAAM,EAAEC,IAAI,EAAEpB,KAAK,KAAK;QAC1B,IAAIoB,IAAI,KAAK,aAAa,EAAE;UACxB,OAAO,KAAK;QAChB;;QAEA;QACAD,MAAM,CAACE,WAAW,GAAGrB,KAAK;QAE1B,IAAIiB,MAAM,CAACS,OAAO,EAAE;UAChBT,MAAM,CAACS,OAAO,CAACL,WAAW,GAAGrB,KAAK;QACtC;QAEA,OAAO,IAAI;MACf;IACJ,CAAC,CAAC;IAEF,IAAI,CAAChC,IAAI,CAAC2D,IAAI,CAACJ,UAAU,CAAC;IAE1B,OAAOV,GAAG;EACd;AACJ;AAEA,OAAO,MAAMe,cAAc,GAAG,IAAI9D,qBAAqB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["UnistylesRuntime","isServer","schemeToTheme","UnistylesListener","UnistyleDependency","UnistylesStateBuilder","isSSR","themes","Map","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","initSettings","settings","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","themeNames","Array","from","keys","initialTheme","length","Error","colorScheme","breakpointsMap","sort","a","b","breakpoint","value","mediaQuery","window","matchMedia","matches","addEventListener","event","currentBreakpoint","find","mq","emitChange","Breakpoints","UnistylesState"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;AAIA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,kBAAkB,QAAQ,yBAAyB;AAE5D,MAAMC,qBAAqB,CAAC;EACPC,KAAK,GAAGL,QAAQ,CAAC,CAAC;EAEnCM,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAM1CC,iBAAiB,GAAG,KAAK;EAEzBC,IAAI,GAAIC,MAAuB,IAAK;IAChC,IAAI,CAACC,UAAU,CAACD,MAAM,CAACJ,MAAM,CAAC;IAC9B,IAAI,CAACM,eAAe,CAACF,MAAM,CAACG,WAAW,CAAC;IACxC,IAAI,CAACC,YAAY,CAACJ,MAAM,CAACK,QAAQ,CAAC;IAElC,IAAI,IAAI,CAACV,KAAK,EAAE;MACZ;IACJ;IAEAH,iBAAiB,CAACc,aAAa,CAAC,CAAC;EACrC,CAAC;EAEOL,UAAU,GAAGA,CAACL,MAAM,GAAG,CAAC,CAAoB,KAAK;IACrDW,MAAM,CAACC,OAAO,CAACZ,MAAM,CAAC,CAACa,OAAO,CAAC,CAAC,CAACC,SAAS,EAAEC,KAAK,CAAC,KAAK;MACnD,IAAI,CAACf,MAAM,CAACgB,GAAG,CAACF,SAAS,EAAEC,KAAK,CAAC;IACrC,CAAC,CAAC;EACN,CAAC;EAEOP,YAAY,GAAIC,QAAqC,IAAK;IAC9D,IAAI,CAACP,iBAAiB,GAAGO,QAAQ,EAAEQ,cAAc,IAAI,KAAK;IAC1D,MAAMC,UAAU,GAAGC,KAAK,CAACC,IAAI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AIA,UAAU,CAACG,OAAO,EAAE;QACpB,IAAI,CAACL,UAAU,GAAGA,UAA2B;MACjD;MAEAE,UAAU,CAACI,gBAAgB,CAAC,QAAQ,EAAEC,KAAK,IAAI;QAC3C,IAAI,CAACA,KAAK,CAACF,OAAO,EAAE;UAChB,MAAM,CAACG,iBAAiB,CAAC,GAAGnB,KAAK,CAACC,IAAI,CAACM,cAAc,CAAC,CAACa,IAAI,CAAC,CAAC,GAAEC,EAAE,CAAC,KAAKA,EAAE,CAACL,OAAO,CAAC,IAAI,EAAE;UAExF,IAAIG,iBAAiB,EAAE;YACnB,IAAI,CAACR,UAAU,GAAGQ,iBAAkC;YACpD1C,iBAAiB,CAAC6C,UAAU,CAAC5C,kBAAkB,CAAC6C,WAAW,CAAC;UAChE;UAEA;QACJ;QAEA,IAAI,CAACZ,UAAU,GAAGA,UAA2B;QAC7ClC,iBAAiB,CAAC6C,UAAU,CAAC5C,kBAAkB,CAAC6C,WAAW,CAAC;MAChE,CAAC,CAAC;IACN,CAAC,CAAC;EACV,CAAC;AACL;AAEA,OAAO,MAAMC,cAAc,GAAG,IAAI7C,qBAAqB,CAAC,CAAC","ignoreList":[]}
@@ -2,18 +2,6 @@
2
2
 
3
3
  import { ColorScheme } from '../specs/types';
4
4
  export const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
5
- export const toReactNativeClassName = (className, values) => {
6
- const returnValue = className ? {
7
- $$css: true,
8
- [className]: className
9
- } : {};
10
- Object.defineProperties(returnValue, reduceObject(values, value => ({
11
- value,
12
- enumerable: false,
13
- configurable: true
14
- })));
15
- return returnValue;
16
- };
17
5
  export const keyInObject = (obj, key) => key in obj;
18
6
  export const schemeToTheme = scheme => {
19
7
  switch (scheme) {
@@ -62,4 +50,63 @@ export const equal = (a, b) => {
62
50
  }
63
51
  return keysA.every(key => Object.is(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
64
52
  };
53
+ export const assignSecrets = (object, secrets) => {
54
+ // @ts-expect-error - assign secrets to object
55
+ object[`__uni__secrets__${Math.random().toString(16).slice(2)}`] = secrets;
56
+ return object;
57
+ };
58
+ export const extractSecrets = object => {
59
+ const secrets = Object.entries(object).reduce((acc, [key, value]) => {
60
+ if (key.startsWith('__uni__secrets__')) {
61
+ acc.push(value);
62
+ }
63
+ return acc;
64
+ }, []);
65
+ return secrets;
66
+ };
67
+ export const getStyles = values => {
68
+ const returnValue = {};
69
+ Object.defineProperties(returnValue, reduceObject(values, value => ({
70
+ value,
71
+ enumerable: false,
72
+ configurable: true
73
+ })));
74
+ return returnValue;
75
+ };
76
+ export const createDoubleMap = () => {
77
+ const map = new Map();
78
+ return {
79
+ get: (key, secondKey) => {
80
+ const mapForKey = map.get(key);
81
+ if (!mapForKey) {
82
+ return undefined;
83
+ }
84
+ return mapForKey.get(secondKey);
85
+ },
86
+ set: (key, secondKey, value) => {
87
+ const mapForKey = map.get(key) ?? new Map();
88
+ map.set(key, mapForKey);
89
+ mapForKey.set(secondKey, value);
90
+ },
91
+ delete: (key, secondKey) => {
92
+ const mapForKey = map.get(key);
93
+ if (!mapForKey) {
94
+ return;
95
+ }
96
+ mapForKey.delete(secondKey);
97
+ },
98
+ forEach: callback => {
99
+ map.forEach((mapForKey, key) => {
100
+ mapForKey.forEach((value, secondKey) => {
101
+ callback(key, secondKey, value);
102
+ });
103
+ });
104
+ }
105
+ };
106
+ };
107
+ export const extractHiddenProperties = object => {
108
+ const hiddenProperties = Object.getOwnPropertyNames(object);
109
+ return Object.fromEntries(hiddenProperties.filter(key => !key.startsWith('__uni__')).map(key => [key, object[key]]));
110
+ };
111
+ export const isInDocument = element => document.body.contains(element);
65
112
  //# sourceMappingURL=utils.js.map