From 3c6b3c7970c8fbf89e415c6ce70fb6a21cdefdf2 Mon Sep 17 00:00:00 2001 From: Hubert Bieszczad Date: Mon, 16 Dec 2024 08:32:20 +0100 Subject: [PATCH 1/2] fix: module exports --- components/native/ActivityIndicator/package.json | 3 ++- components/native/FlatList/package.json | 3 ++- components/native/Image/package.json | 3 ++- components/native/ImageBackground/package.json | 3 ++- components/native/KeyboardAvoidingView/package.json | 3 ++- components/native/Pressable/package.json | 1 + components/native/RefreshControl/package.json | 3 ++- components/native/ScrollView/package.json | 3 ++- components/native/SectionList/package.json | 3 ++- components/native/Switch/package.json | 3 ++- components/native/Text/package.json | 3 ++- components/native/TextInput/package.json | 3 ++- components/native/TouchableHighlight/package.json | 3 ++- components/native/TouchableOpacity/package.json | 3 ++- components/native/View/package.json | 3 ++- components/native/VirtualizedList/package.json | 3 ++- 16 files changed, 31 insertions(+), 15 deletions(-) diff --git a/components/native/ActivityIndicator/package.json b/components/native/ActivityIndicator/package.json index 6332ae02..c120c13c 100644 --- a/components/native/ActivityIndicator/package.json +++ b/components/native/ActivityIndicator/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/ActivityIndicator.js" + "main": "../../../lib/commonjs/components/native/ActivityIndicator.js", + "module": "../../../lib/module/components/native/ActivityIndicator.js" } diff --git a/components/native/FlatList/package.json b/components/native/FlatList/package.json index 979742ab..5320f2b8 100644 --- a/components/native/FlatList/package.json +++ b/components/native/FlatList/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/FlatList.js" + "main": "../../../lib/commonjs/components/native/FlatList.js", + "module": "../../../lib/module/components/native/FlatList.js" } diff --git a/components/native/Image/package.json b/components/native/Image/package.json index 01372443..5052384e 100644 --- a/components/native/Image/package.json +++ b/components/native/Image/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/Image.js" + "main": "../../../lib/commonjs/components/native/Image.js", + "module": "../../../lib/module/components/native/Image.js" } diff --git a/components/native/ImageBackground/package.json b/components/native/ImageBackground/package.json index 579856bd..0a82c59b 100644 --- a/components/native/ImageBackground/package.json +++ b/components/native/ImageBackground/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/ImageBackground.js" + "main": "../../../lib/commonjs/components/native/ImageBackground.js", + "module": "../../../lib/module/components/native/ImageBackground.js" } diff --git a/components/native/KeyboardAvoidingView/package.json b/components/native/KeyboardAvoidingView/package.json index 0a8a0e6d..044a62e3 100644 --- a/components/native/KeyboardAvoidingView/package.json +++ b/components/native/KeyboardAvoidingView/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/KeyboardAvoidingView.js" + "main": "../../../lib/commonjs/components/native/KeyboardAvoidingView.js", + "module": "../../../lib/module/components/native/KeyboardAvoidingView.js" } diff --git a/components/native/Pressable/package.json b/components/native/Pressable/package.json index 267eb0c7..45ff0f70 100644 --- a/components/native/Pressable/package.json +++ b/components/native/Pressable/package.json @@ -1,4 +1,5 @@ { "main": "../../../lib/commonjs/components/native/Pressable.js", + "module": "../../../lib/module/components/native/Pressable.js", "react-native": "../../../lib/commonjs/components/native/Pressable.native.js" } diff --git a/components/native/RefreshControl/package.json b/components/native/RefreshControl/package.json index 96b801de..5138f48a 100644 --- a/components/native/RefreshControl/package.json +++ b/components/native/RefreshControl/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/RefreshControl.js" + "main": "../../../lib/commonjs/components/native/RefreshControl.js", + "module": "../../../lib/module/components/native/RefreshControl.js" } diff --git a/components/native/ScrollView/package.json b/components/native/ScrollView/package.json index dfa2d0fa..ac6c5bf6 100644 --- a/components/native/ScrollView/package.json +++ b/components/native/ScrollView/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/ScrollView.js" + "main": "../../../lib/commonjs/components/native/ScrollView.js", + "module": "../../../lib/module/components/native/ScrollView.js" } diff --git a/components/native/SectionList/package.json b/components/native/SectionList/package.json index 1ca9202b..c8c80ec1 100644 --- a/components/native/SectionList/package.json +++ b/components/native/SectionList/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/SectionList.js" + "main": "../../../lib/commonjs/components/native/SectionList.js", + "module": "../../../lib/module/components/native/SectionList.js" } diff --git a/components/native/Switch/package.json b/components/native/Switch/package.json index 1df72bfa..fcb0d895 100644 --- a/components/native/Switch/package.json +++ b/components/native/Switch/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/Switch.js" + "main": "../../../lib/commonjs/components/native/Switch.js", + "module": "../../../lib/module/components/native/Switch.js" } diff --git a/components/native/Text/package.json b/components/native/Text/package.json index 542aca43..4536cd41 100644 --- a/components/native/Text/package.json +++ b/components/native/Text/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/Text.js" + "main": "../../../lib/commonjs/components/native/Text.js", + "module": "../../../lib/module/components/native/Text.js" } diff --git a/components/native/TextInput/package.json b/components/native/TextInput/package.json index a86e4d21..aa720daa 100644 --- a/components/native/TextInput/package.json +++ b/components/native/TextInput/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/TextInput.js" + "main": "../../../lib/commonjs/components/native/TextInput.js", + "module": "../../../lib/module/components/native/TextInput.js" } diff --git a/components/native/TouchableHighlight/package.json b/components/native/TouchableHighlight/package.json index cb13b793..cf342106 100644 --- a/components/native/TouchableHighlight/package.json +++ b/components/native/TouchableHighlight/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/TouchableHighlight.js" + "main": "../../../lib/commonjs/components/native/TouchableHighlight.js", + "module": "../../../lib/module/components/native/TouchableHighlight.js" } diff --git a/components/native/TouchableOpacity/package.json b/components/native/TouchableOpacity/package.json index fc89d804..9576a871 100644 --- a/components/native/TouchableOpacity/package.json +++ b/components/native/TouchableOpacity/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/TouchableOpacity.js" + "main": "../../../lib/commonjs/components/native/TouchableOpacity.js", + "module": "../../../lib/module/components/native/TouchableOpacity.js" } diff --git a/components/native/View/package.json b/components/native/View/package.json index 6ec13a8a..b16fa6f9 100644 --- a/components/native/View/package.json +++ b/components/native/View/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/View.js" + "main": "../../../lib/commonjs/components/native/View.js", + "module": "../../../lib/module/components/native/View.js" } diff --git a/components/native/VirtualizedList/package.json b/components/native/VirtualizedList/package.json index 7032d796..1dfdac0c 100644 --- a/components/native/VirtualizedList/package.json +++ b/components/native/VirtualizedList/package.json @@ -1,3 +1,4 @@ { - "main": "../../../lib/commonjs/components/native/VirtualizedList.js" + "main": "../../../lib/commonjs/components/native/VirtualizedList.js", + "module": "../../../lib/module/components/native/VirtualizedList.js" } From 42c4cc7605ec14a062bf8b98f8be41839fdf8415 Mon Sep 17 00:00:00 2001 From: Hubert Bieszczad Date: Mon, 16 Dec 2024 09:11:47 +0100 Subject: [PATCH 2/2] fix: add check for secrets --- src/web/shadowRegistry.ts | 10 ++-------- src/web/utils/unistyle.ts | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/web/shadowRegistry.ts b/src/web/shadowRegistry.ts index f2041499..74340a56 100644 --- a/src/web/shadowRegistry.ts +++ b/src/web/shadowRegistry.ts @@ -2,7 +2,7 @@ import type { UnistylesTheme, UnistylesValues } from '../types' import { UnistylesListener } from './listener' import { UnistylesRegistry } from './registry' import { deepMergeObjects } from '../utils' -import { equal, extractSecrets, extractUnistyleDependencies, isInDocument, keyInObject } from './utils' +import { equal, extractSecrets, extractUnistyleDependencies, isInDocument } from './utils' import { getVariants } from './variants' type Style = UnistylesValues | ((...args: Array) => UnistylesValues) @@ -67,13 +67,6 @@ class UnistylesShadowRegistryBuilder { // Regular style if (!secrets) { - Object.keys(unistyleStyle).forEach(key => { - if (keyInObject(ref.style, key)) { - // @ts-expect-error - Styles won't have read only properties - ref.style[key] = '' - } - }) - return unistyleStyle as UnistylesValues } @@ -133,6 +126,7 @@ class UnistylesShadowRegistryBuilder { this.classNamesMap.set(ref, newClassNames) // Add new classnames to the ref ref.classList.add(...newClassNames) + ref.removeAttribute('styles') return newClassNames } diff --git a/src/web/utils/unistyle.ts b/src/web/utils/unistyle.ts index 6ce0d3d4..ddecfa66 100644 --- a/src/web/utils/unistyle.ts +++ b/src/web/utils/unistyle.ts @@ -30,7 +30,7 @@ export const assignSecrets = (object: T, secrets: UnistyleSecrets) => { } export const extractSecrets = (object: any) => { - return keyInObject(object, '__uni__secrets__') ? object.__uni__secrets__ as UnistyleSecrets : undefined + return object && keyInObject(object, '__uni__secrets__') ? object.__uni__secrets__ as UnistyleSecrets : undefined } export const removeInlineStyles = (values: UnistylesValues) => {