react-native-unistyles 3.0.0-beta.2 → 3.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/components/native/ActivityIndicator/package.json +4 -0
  2. package/components/native/FlatList/package.json +4 -0
  3. package/components/native/Image/package.json +4 -0
  4. package/components/native/ImageBackground/package.json +4 -0
  5. package/components/native/KeyboardAvoidingView/package.json +4 -0
  6. package/components/native/Pressable/package.json +5 -0
  7. package/components/native/RefreshControl/package.json +4 -0
  8. package/components/native/ScrollView/package.json +4 -0
  9. package/components/native/SectionList/package.json +4 -0
  10. package/components/native/Switch/package.json +4 -0
  11. package/components/native/Text/package.json +4 -0
  12. package/components/native/TextInput/package.json +4 -0
  13. package/components/native/TouchableHighlight/package.json +4 -0
  14. package/components/native/TouchableOpacity/package.json +4 -0
  15. package/components/native/View/package.json +4 -0
  16. package/components/native/VirtualizedList/package.json +4 -0
  17. package/cxx/core/HostStyle.cpp +6 -1
  18. package/cxx/core/UnistyleWrapper.h +2 -2
  19. package/cxx/hybridObjects/HybridShadowRegistry.cpp +9 -0
  20. package/cxx/hybridObjects/HybridShadowRegistry.h +9 -4
  21. package/cxx/parser/Parser.cpp +5 -3
  22. package/lib/commonjs/components/Variants.js +4 -1
  23. package/lib/commonjs/components/Variants.js.map +1 -1
  24. package/lib/commonjs/components/native/Pressable.native.js +10 -7
  25. package/lib/commonjs/components/native/Pressable.native.js.map +1 -1
  26. package/lib/commonjs/core/withUnistyles/useDependencies.js +5 -1
  27. package/lib/commonjs/core/withUnistyles/useDependencies.js.map +1 -1
  28. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js +2 -1
  29. package/lib/commonjs/core/withUnistyles/withUnistyles.native.js.map +1 -1
  30. package/lib/commonjs/index.js +24 -20
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/web/create.js +1 -4
  33. package/lib/commonjs/web/create.js.map +1 -1
  34. package/lib/commonjs/web/index.js +15 -16
  35. package/lib/commonjs/web/index.js.map +1 -1
  36. package/lib/commonjs/web/shadowRegistry.js +1 -6
  37. package/lib/commonjs/web/shadowRegistry.js.map +1 -1
  38. package/lib/commonjs/web/utils/unistyle.js +1 -1
  39. package/lib/commonjs/web/utils/unistyle.js.map +1 -1
  40. package/lib/module/components/Variants.js +4 -1
  41. package/lib/module/components/Variants.js.map +1 -1
  42. package/lib/module/components/native/Pressable.native.js +10 -7
  43. package/lib/module/components/native/Pressable.native.js.map +1 -1
  44. package/lib/module/core/withUnistyles/useDependencies.js +5 -1
  45. package/lib/module/core/withUnistyles/useDependencies.js.map +1 -1
  46. package/lib/module/core/withUnistyles/withUnistyles.native.js +2 -1
  47. package/lib/module/core/withUnistyles/withUnistyles.native.js.map +1 -1
  48. package/lib/module/index.js +1 -1
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/web/create.js +1 -4
  51. package/lib/module/web/create.js.map +1 -1
  52. package/lib/module/web/index.js +3 -2
  53. package/lib/module/web/index.js.map +1 -1
  54. package/lib/module/web/shadowRegistry.js +2 -7
  55. package/lib/module/web/shadowRegistry.js.map +1 -1
  56. package/lib/module/web/utils/unistyle.js +1 -1
  57. package/lib/module/web/utils/unistyle.js.map +1 -1
  58. package/lib/typescript/src/components/Variants.d.ts.map +1 -1
  59. package/lib/typescript/src/components/native/Pressable.native.d.ts.map +1 -1
  60. package/lib/typescript/src/core/withUnistyles/useDependencies.d.ts.map +1 -1
  61. package/lib/typescript/src/core/withUnistyles/withUnistyles.native.d.ts.map +1 -1
  62. package/lib/typescript/src/index.d.ts +1 -1
  63. package/lib/typescript/src/index.d.ts.map +1 -1
  64. package/lib/typescript/src/web/create.d.ts.map +1 -1
  65. package/lib/typescript/src/web/index.d.ts +5 -24
  66. package/lib/typescript/src/web/index.d.ts.map +1 -1
  67. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
  68. package/package.json +17 -1
  69. package/plugin/import.js +2 -2
  70. package/plugin/variants.js +16 -10
  71. package/src/components/Variants.tsx +2 -1
  72. package/src/components/native/Pressable.native.tsx +10 -8
  73. package/src/core/withUnistyles/useDependencies.ts +6 -1
  74. package/src/core/withUnistyles/withUnistyles.native.tsx +2 -1
  75. package/src/index.ts +1 -1
  76. package/src/web/create.ts +1 -4
  77. package/src/web/index.ts +9 -6
  78. package/src/web/shadowRegistry.ts +2 -8
  79. package/src/web/utils/unistyle.ts +1 -1
package/src/web/create.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  import type { StyleSheetWithSuperPowers, StyleSheet } from '../types/stylesheet'
2
2
  import { assignSecrets, error, removeInlineStyles } from './utils'
3
3
  import { UnistylesRuntime } from './runtime'
4
- import { UnistylesShadowRegistry } from '../specs'
5
4
 
6
- const useVariants = ['useVariants', (variants: Record<string, string | boolean>) => {
7
- UnistylesShadowRegistry.selectVariants(variants)
8
- }]
5
+ const useVariants = ['useVariants', () => {}]
9
6
 
10
7
  export const create = (stylesheet: StyleSheetWithSuperPowers<StyleSheet>, id?: string) => {
11
8
  if (!id) {
package/src/web/index.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  import { create } from './create'
2
2
  import { UnistylesState } from './state'
3
3
  import { deepMergeObjects } from '../utils'
4
- import type { CreateUnistylesStyleSheet } from '../types'
4
+ import type { StyleSheet as NativeStyleSheet } from '../specs/StyleSheet'
5
+ import { UnistylesRuntime as UnistylesRuntimeWeb } from './runtime'
6
+ import type { Runtime as NativeUnistylesRuntime } from '../specs/UnistylesRuntime'
5
7
 
6
8
  export const StyleSheet = {
7
9
  configure: UnistylesState.init,
8
- create: create as CreateUnistylesStyleSheet,
10
+ create: create,
9
11
  absoluteFill: {
10
12
  position: 'absolute',
11
13
  left: 0,
@@ -22,9 +24,10 @@ export const StyleSheet = {
22
24
  },
23
25
  compose: (a: object, b: object) => deepMergeObjects(a, b),
24
26
  flatten: (...styles: Array<object>) => deepMergeObjects(...styles),
25
- hairlineWidth: 1 as number
26
- }
27
+ hairlineWidth: 1
28
+ } as unknown as typeof NativeStyleSheet
29
+
30
+ export const UnistylesRuntime = UnistylesRuntimeWeb as unknown as typeof NativeUnistylesRuntime
27
31
 
28
- export { UnistylesRuntime } from './runtime'
29
- export { UnistylesShadowRegistry } from './shadowRegistry'
30
32
  export * from './mock'
33
+ export * from './shadowRegistry'
@@ -2,7 +2,7 @@ import type { UnistylesTheme, UnistylesValues } from '../types'
2
2
  import { UnistylesListener } from './listener'
3
3
  import { UnistylesRegistry } from './registry'
4
4
  import { deepMergeObjects } from '../utils'
5
- import { equal, extractSecrets, extractUnistyleDependencies, isInDocument, keyInObject } from './utils'
5
+ import { equal, extractSecrets, extractUnistyleDependencies, isInDocument } from './utils'
6
6
  import { getVariants } from './variants'
7
7
 
8
8
  type Style = UnistylesValues | ((...args: Array<any>) => UnistylesValues)
@@ -67,13 +67,6 @@ class UnistylesShadowRegistryBuilder {
67
67
 
68
68
  // Regular style
69
69
  if (!secrets) {
70
- Object.keys(unistyleStyle).forEach(key => {
71
- if (keyInObject(ref.style, key)) {
72
- // @ts-expect-error - Styles won't have read only properties
73
- ref.style[key] = ''
74
- }
75
- })
76
-
77
70
  return unistyleStyle as UnistylesValues
78
71
  }
79
72
 
@@ -133,6 +126,7 @@ class UnistylesShadowRegistryBuilder {
133
126
  this.classNamesMap.set(ref, newClassNames)
134
127
  // Add new classnames to the ref
135
128
  ref.classList.add(...newClassNames)
129
+ ref.removeAttribute('styles')
136
130
 
137
131
  return newClassNames
138
132
  }
@@ -30,7 +30,7 @@ export const assignSecrets = <T>(object: T, secrets: UnistyleSecrets) => {
30
30
  }
31
31
 
32
32
  export const extractSecrets = (object: any) => {
33
- return keyInObject(object, '__uni__secrets__') ? object.__uni__secrets__ as UnistyleSecrets : undefined
33
+ return object && keyInObject(object, '__uni__secrets__') ? object.__uni__secrets__ as UnistyleSecrets : undefined
34
34
  }
35
35
 
36
36
  export const removeInlineStyles = (values: UnistylesValues) => {