react-native-unistyles 3.0.0-alpha.2 → 3.0.0-alpha.21
Sign up to get free protection for your applications and to get access to all the features.
- package/Unistyles.podspec +3 -2
- package/cxx/common/Constants.h +3 -0
- package/cxx/common/Helpers.h +97 -5
- package/cxx/core/HostStyle.cpp +19 -13
- package/cxx/core/HostStyle.h +4 -0
- package/cxx/core/StyleSheet.h +0 -2
- package/cxx/core/StyleSheetRegistry.cpp +10 -13
- package/cxx/core/StyleSheetRegistry.h +4 -4
- package/cxx/core/Unistyle.h +7 -10
- package/cxx/core/UnistyleData.h +23 -0
- package/cxx/core/UnistyleWrapper.h +58 -10
- package/cxx/core/UnistylesCommitHook.cpp +22 -13
- package/cxx/core/UnistylesCommitHook.h +8 -1
- package/cxx/core/UnistylesCommitShadowNode.h +13 -0
- package/cxx/core/UnistylesMountHook.cpp +37 -0
- package/cxx/core/UnistylesMountHook.h +31 -0
- package/cxx/core/UnistylesRegistry.cpp +56 -81
- package/cxx/core/UnistylesRegistry.h +15 -13
- package/cxx/core/UnistylesState.cpp +14 -8
- package/cxx/core/UnistylesState.h +1 -0
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +15 -9
- package/cxx/hybridObjects/HybridStyleSheet.cpp +43 -38
- package/cxx/hybridObjects/HybridStyleSheet.h +10 -7
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +35 -16
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
- package/cxx/parser/Parser.cpp +105 -164
- package/cxx/parser/Parser.h +8 -14
- package/cxx/shadowTree/ShadowLeafUpdate.h +1 -1
- package/cxx/shadowTree/ShadowTrafficController.h +33 -0
- package/cxx/shadowTree/ShadowTreeManager.cpp +13 -11
- package/cxx/shadowTree/ShadowTreeManager.h +1 -0
- package/ios/Unistyles.h +1 -0
- package/ios/UnistylesModuleOnLoad.h +2 -0
- package/ios/UnistylesModuleOnLoad.mm +8 -1
- package/lib/commonjs/index.js +4 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js +1 -1
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +7 -6
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +77 -0
- package/lib/commonjs/web/convert/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/breakpoint.js +25 -0
- package/lib/commonjs/web/convert/breakpoint.js.map +1 -0
- package/lib/commonjs/web/convert/index.js +76 -0
- package/lib/commonjs/web/convert/index.js.map +1 -0
- package/lib/commonjs/web/convert/module.d.js +2 -0
- package/lib/commonjs/web/convert/module.d.js.map +1 -0
- package/lib/commonjs/web/convert/shadow.js +68 -0
- package/lib/commonjs/web/convert/shadow.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +89 -0
- package/lib/commonjs/web/convert/style.js.map +1 -0
- package/lib/commonjs/web/convert/textShadow.js +73 -0
- package/lib/commonjs/web/convert/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/transform.js +72 -0
- package/lib/commonjs/web/convert/transform.js.map +1 -0
- package/lib/commonjs/web/convert/types.js +9 -0
- package/lib/commonjs/web/convert/types.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +55 -0
- package/lib/commonjs/web/convert/utils.js.map +1 -0
- package/lib/commonjs/web/create.js +51 -0
- package/lib/commonjs/web/create.js.map +1 -0
- package/lib/commonjs/web/createUnistylesComponent.js +61 -0
- package/lib/commonjs/web/createUnistylesComponent.js.map +1 -0
- package/lib/commonjs/web/index.js +60 -0
- package/lib/commonjs/web/index.js.map +1 -0
- package/lib/commonjs/web/listener/index.js +20 -0
- package/lib/commonjs/web/listener/index.js.map +1 -0
- package/lib/commonjs/web/listener/listenToDependencies.js +38 -0
- package/lib/commonjs/web/listener/listenToDependencies.js.map +1 -0
- package/lib/commonjs/web/listener/listener.js +35 -0
- package/lib/commonjs/web/listener/listener.js.map +1 -0
- package/lib/commonjs/web/mock.js +28 -0
- package/lib/commonjs/web/mock.js.map +1 -0
- package/lib/commonjs/web/mq.js +23 -0
- package/lib/commonjs/web/mq.js.map +1 -0
- package/lib/commonjs/web/pseudo.js +10 -0
- package/lib/commonjs/web/pseudo.js.map +1 -0
- package/lib/commonjs/web/registry.js +50 -0
- package/lib/commonjs/web/registry.js.map +1 -0
- package/lib/commonjs/web/runtime.js +163 -0
- package/lib/commonjs/web/runtime.js.map +1 -0
- package/lib/commonjs/web/shadowRegistry.js +123 -0
- package/lib/commonjs/web/shadowRegistry.js.map +1 -0
- package/lib/commonjs/web/state.js +81 -0
- package/lib/commonjs/web/state.js.map +1 -0
- package/lib/commonjs/web/utils.js +130 -0
- package/lib/commonjs/web/utils.js.map +1 -0
- package/lib/commonjs/web/variants/getVariants.js +39 -0
- package/lib/commonjs/web/variants/getVariants.js.map +1 -0
- package/lib/commonjs/web/variants/index.js +28 -0
- package/lib/commonjs/web/variants/index.js.map +1 -0
- package/lib/commonjs/web/variants/useVariants.js +59 -0
- package/lib/commonjs/web/variants/useVariants.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NavigtionBar/index.js +1 -1
- package/lib/module/specs/NavigtionBar/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +7 -6
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StatusBar/index.js +1 -1
- package/lib/module/specs/StatusBar/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js +1 -1
- package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
- package/lib/module/specs/index.web.js +1 -1
- package/lib/module/specs/index.web.js.map +1 -1
- package/lib/module/web/convert/boxShadow.js +72 -0
- package/lib/module/web/convert/boxShadow.js.map +1 -0
- package/lib/module/web/convert/breakpoint.js +20 -0
- package/lib/module/web/convert/breakpoint.js.map +1 -0
- package/lib/module/web/convert/index.js +71 -0
- package/lib/module/web/convert/index.js.map +1 -0
- package/lib/module/web/convert/module.d.js +2 -0
- package/lib/module/web/convert/module.d.js.map +1 -0
- package/lib/module/web/convert/shadow.js +63 -0
- package/lib/module/web/convert/shadow.js.map +1 -0
- package/lib/module/web/convert/style.js +84 -0
- package/lib/module/web/convert/style.js.map +1 -0
- package/lib/module/web/convert/textShadow.js +68 -0
- package/lib/module/web/convert/textShadow.js.map +1 -0
- package/lib/module/web/convert/transform.js +67 -0
- package/lib/module/web/convert/transform.js.map +1 -0
- package/lib/module/web/convert/types.js +5 -0
- package/lib/module/web/convert/types.js.map +1 -0
- package/lib/module/web/convert/utils.js +43 -0
- package/lib/module/web/convert/utils.js.map +1 -0
- package/lib/module/web/create.js +46 -0
- package/lib/module/web/create.js.map +1 -0
- package/lib/module/web/createUnistylesComponent.js +54 -0
- package/lib/module/web/createUnistylesComponent.js.map +1 -0
- package/lib/module/web/index.js +26 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/listener/index.js +5 -0
- package/lib/module/web/listener/index.js.map +1 -0
- package/lib/module/web/listener/listenToDependencies.js +33 -0
- package/lib/module/web/listener/listenToDependencies.js.map +1 -0
- package/lib/module/web/listener/listener.js +31 -0
- package/lib/module/web/listener/listener.js.map +1 -0
- package/lib/module/web/mock.js +24 -0
- package/lib/module/web/mock.js.map +1 -0
- package/lib/module/web/mq.js +17 -0
- package/lib/module/web/mq.js.map +1 -0
- package/lib/module/web/pseudo.js +5 -0
- package/lib/module/web/pseudo.js.map +1 -0
- package/lib/module/web/registry.js +46 -0
- package/lib/module/web/registry.js.map +1 -0
- package/lib/module/web/runtime.js +159 -0
- package/lib/module/web/runtime.js.map +1 -0
- package/lib/module/web/shadowRegistry.js +119 -0
- package/lib/module/web/shadowRegistry.js.map +1 -0
- package/lib/module/web/state.js +77 -0
- package/lib/module/web/state.js.map +1 -0
- package/lib/module/web/utils.js +112 -0
- package/lib/module/web/utils.js.map +1 -0
- package/lib/module/web/variants/getVariants.js +34 -0
- package/lib/module/web/variants/getVariants.js.map +1 -0
- package/lib/module/web/variants/index.js +5 -0
- package/lib/module/web/variants/index.js.map +1 -0
- package/lib/module/web/variants/useVariants.js +54 -0
- package/lib/module/web/variants/useVariants.js.map +1 -0
- package/lib/typescript/example/App.d.ts.map +1 -1
- package/lib/typescript/example/Typography.d.ts +12 -0
- package/lib/typescript/example/Typography.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/(tabs)/_layout.d.ts +3 -0
- package/lib/typescript/expo-example/app/(tabs)/_layout.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/(tabs)/explore.d.ts +3 -0
- package/lib/typescript/expo-example/app/(tabs)/explore.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/(tabs)/index.d.ts +3 -0
- package/lib/typescript/expo-example/app/(tabs)/index.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/+html.d.ts +4 -0
- package/lib/typescript/expo-example/app/+html.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/+not-found.d.ts +3 -0
- package/lib/typescript/expo-example/app/+not-found.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/_layout.d.ts +3 -0
- package/lib/typescript/expo-example/app/_layout.d.ts.map +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +3 -3
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +1 -1
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +2 -2
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/index.d.ts +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/create.d.ts +11 -11
- package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
- package/lib/typescript/src/web/createUnistylesComponent.d.ts +3 -0
- package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/index.d.ts +14 -13
- package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener/index.d.ts +3 -0
- package/lib/typescript/src/web/listener/index.d.ts.map +1 -0
- package/lib/typescript/src/web/listener/listenToDependencies.d.ts +12 -0
- package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/listener/listener.d.ts +3 -2
- package/lib/typescript/src/web/listener/listener.d.ts.map +1 -0
- package/lib/typescript/src/web/mock.d.ts +5 -0
- package/lib/typescript/src/web/mock.d.ts.map +1 -0
- package/lib/typescript/src/web/mq.d.ts.map +1 -0
- package/lib/typescript/src/web/pseudo.d.ts +6 -0
- package/lib/typescript/src/web/pseudo.d.ts.map +1 -0
- package/lib/typescript/src/web/registry.d.ts +15 -0
- package/lib/typescript/src/web/registry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/runtime.d.ts +6 -7
- package/lib/typescript/src/web/runtime.d.ts.map +1 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts +17 -0
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -0
- package/lib/typescript/{web → src/web}/state.d.ts +4 -9
- package/lib/typescript/src/web/state.d.ts.map +1 -0
- package/lib/typescript/src/web/utils.d.ts +35 -0
- package/lib/typescript/src/web/utils.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/index.d.ts +3 -0
- package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
- package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +8 -3
- package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +14 -2
- package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +3 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +4 -1
- package/package.json +3 -3
- package/plugin/__tests__/dependencies.spec.js +199 -111
- package/plugin/__tests__/ref.spec.js +638 -202
- package/plugin/__tests__/stylesheet.spec.js +182 -71
- package/plugin/index.js +110 -23
- package/plugin/ref.js +64 -13
- package/plugin/style.js +82 -22
- package/plugin/stylesheet.js +44 -1
- package/plugin/variants.js +33 -0
- package/src/index.ts +3 -0
- package/src/specs/NavigtionBar/index.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +10 -9
- package/src/specs/StatusBar/index.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -1
- package/src/specs/UnistylesRuntime/index.ts +1 -1
- package/src/specs/index.web.ts +1 -1
- package/src/types/stylesheet.ts +2 -2
- package/{web → src/web}/convert/breakpoint.ts +1 -1
- package/{web → src/web}/convert/index.ts +2 -2
- package/{web → src/web}/convert/types.ts +1 -1
- package/src/web/create.ts +50 -0
- package/src/web/createUnistylesComponent.tsx +54 -0
- package/{web → src/web}/index.ts +3 -2
- package/src/web/listener/index.ts +2 -0
- package/src/web/listener/listenToDependencies.ts +45 -0
- package/{web → src/web}/listener/listener.ts +2 -2
- package/{web → src/web}/mock.ts +2 -12
- package/src/web/pseudo.ts +137 -0
- package/src/web/registry.ts +60 -0
- package/{web → src/web}/runtime.ts +4 -6
- package/src/web/shadowRegistry.ts +124 -0
- package/{web → src/web}/state.ts +5 -49
- package/{web → src/web}/utils.ts +91 -17
- package/src/web/variants/getVariants.ts +42 -0
- package/src/web/variants/index.ts +2 -0
- package/src/web/variants/useVariants.ts +65 -0
- package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/web/convert/index.d.ts.map +0 -1
- package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/style.d.ts.map +0 -1
- package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/web/convert/transform.d.ts.map +0 -1
- package/lib/typescript/web/convert/types.d.ts.map +0 -1
- package/lib/typescript/web/convert/utils.d.ts.map +0 -1
- package/lib/typescript/web/listener/index.d.ts +0 -2
- package/lib/typescript/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/web/mock.d.ts +0 -14
- package/lib/typescript/web/mock.d.ts.map +0 -1
- package/lib/typescript/web/mq.d.ts.map +0 -1
- package/lib/typescript/web/pseudo.d.ts +0 -4
- package/lib/typescript/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/web/registry.d.ts +0 -12
- package/lib/typescript/web/registry.d.ts.map +0 -1
- package/lib/typescript/web/runtime.d.ts.map +0 -1
- package/lib/typescript/web/state.d.ts.map +0 -1
- package/lib/typescript/web/useVariants.d.ts +0 -3
- package/lib/typescript/web/useVariants.d.ts.map +0 -1
- package/lib/typescript/web/utils.d.ts +0 -18
- package/lib/typescript/web/utils.d.ts.map +0 -1
- package/web/create.ts +0 -102
- package/web/listener/index.ts +0 -1
- package/web/pseudo.ts +0 -11
- package/web/registry.ts +0 -41
- package/web/useVariants.ts +0 -99
- /package/lib/typescript/{web → src/web}/convert/boxShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/breakpoint.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/shadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/style.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/textShadow.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/transform.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/convert/utils.d.ts +0 -0
- /package/lib/typescript/{web → src/web}/mq.d.ts +0 -0
- /package/{web → src/web}/convert/boxShadow.ts +0 -0
- /package/{web → src/web}/convert/module.d.ts +0 -0
- /package/{web → src/web}/convert/shadow.ts +0 -0
- /package/{web → src/web}/convert/style.ts +0 -0
- /package/{web → src/web}/convert/textShadow.ts +0 -0
- /package/{web → src/web}/convert/transform.ts +0 -0
- /package/{web → src/web}/convert/utils.ts +0 -0
- /package/{web → src/web}/mq.ts +0 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { UnistylesValues } from '../types';
|
2
|
+
type Style = UnistylesValues | ((...args: Array<any>) => UnistylesValues);
|
3
|
+
declare class UnistylesShadowRegistryBuilder {
|
4
|
+
name: string;
|
5
|
+
__type: string;
|
6
|
+
equals: () => boolean;
|
7
|
+
toString: () => string;
|
8
|
+
dispose: () => void;
|
9
|
+
private readonly webUnistylesMap;
|
10
|
+
private readonly disposeMap;
|
11
|
+
private readonly stylesMap;
|
12
|
+
add: (ref: any, _style?: Style | Array<Style>, _variants?: Record<string, any>, _args?: Array<any>) => void;
|
13
|
+
remove: (ref: HTMLElement, style: Style) => void;
|
14
|
+
}
|
15
|
+
export declare const UnistylesShadowRegistry: UnistylesShadowRegistryBuilder;
|
16
|
+
export {};
|
17
|
+
//# sourceMappingURL=shadowRegistry.d.ts.map
|
@@ -0,0 +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;AAQ/C,KAAK,KAAK,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,eAAe,CAAC,CAAA;AAEzE,cAAM,8BAA8B;IAEhC,IAAI,SAA4B;IAChC,MAAM,SAAQ;IACd,MAAM,gBAAa;IACnB,QAAQ,eAAkC;IAC1C,OAAO,aAAW;IAGlB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsD;IACtF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmE;IAC9F,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2D;IAErF,GAAG,QAAS,GAAG,WAAW,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,KAAK,CAAC,GAAG,CAAC,UAuFlG;IAED,MAAM,QAAS,WAAW,SAAS,KAAK,UAQvC;CACJ;AAED,eAAO,MAAM,uBAAuB,gCAAuC,CAAA"}
|
@@ -1,11 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import type {
|
3
|
-
import type {
|
4
|
-
import type {
|
5
|
-
import type { UnistylesBreakpoints } from '../src/global';
|
1
|
+
import type { UnistylesTheme } from '../types';
|
2
|
+
import type { UnistylesConfig } from '../specs/StyleSheet';
|
3
|
+
import type { AppBreakpoint, AppThemeName } from '../specs/types';
|
4
|
+
import type { UnistylesBreakpoints } from '../global';
|
6
5
|
declare class UnistylesStateBuilder {
|
7
6
|
private readonly isSSR;
|
8
|
-
readonly tags: Array<ReactElement>;
|
9
7
|
themes: Map<string, UnistylesTheme>;
|
10
8
|
themeName?: AppThemeName;
|
11
9
|
breakpoint?: AppBreakpoint;
|
@@ -15,9 +13,6 @@ declare class UnistylesStateBuilder {
|
|
15
13
|
private initThemes;
|
16
14
|
private initSettings;
|
17
15
|
private initBreakpoints;
|
18
|
-
createTag(): HTMLStyleElement | {
|
19
|
-
textContent: string;
|
20
|
-
};
|
21
16
|
}
|
22
17
|
export declare const UnistylesState: UnistylesStateBuilder;
|
23
18
|
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/web/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,WAAW,CAAA;AAMtE,cAAM,qBAAqB;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IAEnC,MAAM,8BAAoC;IAC1C,SAAS,CAAC,EAAE,YAAY,CAAA;IAExB,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,WAAW,CAAC,EAAE,oBAAoB,CAAA;IAElC,iBAAiB,UAAQ;IAEzB,IAAI,WAAY,eAAe,UAU9B;IAED,OAAO,CAAC,UAAU,CAIjB;IAED,OAAO,CAAC,YAAY,CAyBnB;IAED,OAAO,CAAC,eAAe,CAmCtB;CACJ;AAED,eAAO,MAAM,cAAc,uBAA8B,CAAA"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { ColorScheme, type AppThemeName } from '../specs/types';
|
2
|
+
import type { StyleSheet, StyleSheetWithSuperPowers, UnistylesValues } from '../types/stylesheet';
|
3
|
+
export declare const reduceObject: <TObj extends Record<string, any>, TReducer>(obj: TObj, reducer: (value: TObj[keyof TObj], key: keyof TObj) => TReducer) => { [K in keyof TObj]: TReducer; };
|
4
|
+
export declare const keyInObject: <T extends Record<string, any>>(obj: T, key: PropertyKey) => key is keyof T;
|
5
|
+
export declare const schemeToTheme: (scheme: ColorScheme) => AppThemeName;
|
6
|
+
export declare const hexToRGBA: (hex: string, opacity: number) => string;
|
7
|
+
export declare const isServer: () => boolean;
|
8
|
+
/**
|
9
|
+
* Deeply merges properties of passed object
|
10
|
+
*/
|
11
|
+
export declare const deepMergeObjects: <T extends Record<PropertyKey, any>>(...sources: Array<T>) => T;
|
12
|
+
export declare const warn: (message: string) => void;
|
13
|
+
export declare const equal: <T>(a: T, b: T) => boolean;
|
14
|
+
type UnistyleSecrets = {
|
15
|
+
__uni__stylesheet: StyleSheetWithSuperPowers<StyleSheet>;
|
16
|
+
__uni__key: string;
|
17
|
+
__uni__refs: Set<HTMLElement>;
|
18
|
+
__uni__variants: Record<string, any>;
|
19
|
+
__uni__args?: Array<any>;
|
20
|
+
};
|
21
|
+
export declare const assignSecrets: <T>(object: T, secrets: UnistyleSecrets) => T;
|
22
|
+
export declare const extractSecrets: (object: any) => UnistyleSecrets[];
|
23
|
+
export declare const getStyles: (values: UnistylesValues) => {};
|
24
|
+
export declare const createDoubleMap: <TKey, TSecondKey, TValue>() => {
|
25
|
+
get: (key: TKey, secondKey: TSecondKey) => TValue | undefined;
|
26
|
+
set: (key: TKey, secondKey: TSecondKey, value: TValue) => void;
|
27
|
+
delete: (key: TKey, secondKey: TSecondKey) => void;
|
28
|
+
forEach: (callback: (key: TKey, secondKey: TSecondKey, value: TValue) => void) => void;
|
29
|
+
};
|
30
|
+
export declare const extractHiddenProperties: (object: any) => {
|
31
|
+
[k: string]: any;
|
32
|
+
};
|
33
|
+
export declare const isInDocument: (element: HTMLElement) => boolean;
|
34
|
+
export {};
|
35
|
+
//# sourceMappingURL=utils.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/web/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAEjG,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,OAC9D,IAAI,WACA,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,IAAI,KAAK,QAAQ,KACmD,GAAG,CAAe,IAAV,MAAM,IAAI,GAAG,QAAQ,GAAE,CAAA;AAErJ,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,WAAW,KAAG,GAAG,IAAI,MAAM,CAAe,CAAA;AAElH,eAAO,MAAM,aAAa,WAAY,WAAW,KAAG,YAQnD,CAAA;AAED,eAAO,MAAM,SAAS,QAAS,MAAM,WAAW,MAAM,WAM5B,CAAA;AAE1B,eAAO,MAAM,QAAQ,eAAsC,CAAA;AAE3D;;EAEE;AACF,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,cAAc,KAAK,CAAC,CAAC,CAAC,MAqBxF,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAA2D,CAAA;AAE/F,eAAO,MAAM,KAAK,GAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAqBlC,CAAA;AAED,KAAK,eAAe,GAAG;IACnB,iBAAiB,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAA;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACpC,WAAW,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,CAAC,UAAU,CAAC,WAAW,eAAe,MAKnE,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,GAAG,sBAUzC,CAAA;AAED,eAAO,MAAM,SAAS,WAAY,eAAe,OAUhD,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,IAAI,EAAE,UAAU,EAAE,MAAM;eAIrC,IAAI,aAAa,UAAU;eAS3B,IAAI,aAAa,UAAU,SAAS,MAAM;kBAMvC,IAAI,aAAa,UAAU;wBASrB,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI;CAQpF,CAAA;AAED,eAAO,MAAM,uBAAuB,WAAY,GAAG;;CAQlD,CAAA;AAED,eAAO,MAAM,YAAY,YAAa,WAAW,YAAoC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getVariants.d.ts","sourceRoot":"","sources":["../../../../../src/web/variants/getVariants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAWpE,eAAO,MAAM,WAAW,WAAY,qBAAqB,CAAC,UAAU,CAAC,oBAAoB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,+BA8B3G,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/web/variants/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../../src/web/variants/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIpE,eAAO,MAAM,iBAAiB,WAAY,qBAAqB,CAAC,UAAU,CAAC,uBAAuB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,SA2DxI,CAAA"}
|
@@ -11,18 +11,21 @@
|
|
11
11
|
#include <fbjni/fbjni.h>
|
12
12
|
#include "HybridNativePlatformSpec.hpp"
|
13
13
|
|
14
|
+
|
15
|
+
|
16
|
+
|
14
17
|
namespace margelo::nitro::unistyles {
|
15
18
|
|
16
19
|
using namespace facebook;
|
17
20
|
|
18
|
-
class JHybridNativePlatformSpec
|
19
|
-
|
21
|
+
class JHybridNativePlatformSpec: public jni::HybridClass<JHybridNativePlatformSpec, JHybridObject>,
|
22
|
+
public virtual HybridNativePlatformSpec {
|
20
23
|
public:
|
21
24
|
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/unistyles/HybridNativePlatformSpec;";
|
22
25
|
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
23
26
|
static void registerNatives();
|
24
27
|
|
25
|
-
|
28
|
+
protected:
|
26
29
|
// C++ constructor (called from Java via `initHybrid()`)
|
27
30
|
explicit JHybridNativePlatformSpec(jni::alias_ref<jhybridobject> jThis) :
|
28
31
|
HybridObject(HybridNativePlatformSpec::TAG),
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt
CHANGED
@@ -21,10 +21,8 @@ import com.margelo.nitro.core.*
|
|
21
21
|
@Keep
|
22
22
|
@Suppress("RedundantSuppression", "KotlinJniMissingFunction", "PropertyName", "RedundantUnitReturnType", "unused")
|
23
23
|
abstract class HybridNativePlatformSpec: HybridObject() {
|
24
|
-
protected val TAG = "HybridNativePlatformSpec"
|
25
|
-
|
26
24
|
@DoNotStrip
|
27
|
-
|
25
|
+
private var mHybridData: HybridData = initHybrid()
|
28
26
|
|
29
27
|
init {
|
30
28
|
// Pass this `HybridData` through to it's base class,
|
@@ -32,6 +30,13 @@ abstract class HybridNativePlatformSpec: HybridObject() {
|
|
32
30
|
super.updateNative(mHybridData)
|
33
31
|
}
|
34
32
|
|
33
|
+
/**
|
34
|
+
* Call from a child class to initialize HybridData with a child.
|
35
|
+
*/
|
36
|
+
override fun updateNative(hybridData: HybridData) {
|
37
|
+
mHybridData = hybridData
|
38
|
+
}
|
39
|
+
|
35
40
|
// Properties
|
36
41
|
|
37
42
|
|
@@ -55,7 +55,7 @@ namespace margelo::nitro::unistyles {
|
|
55
55
|
* the future, HybridNativePlatformSpecCxx can directly inherit from the C++ class HybridNativePlatformSpec
|
56
56
|
* to simplify the whole structure and memory management.
|
57
57
|
*/
|
58
|
-
class HybridNativePlatformSpecSwift
|
58
|
+
class HybridNativePlatformSpecSwift: public virtual HybridNativePlatformSpec {
|
59
59
|
public:
|
60
60
|
// Constructor from a Swift instance
|
61
61
|
explicit HybridNativePlatformSpecSwift(const Unistyles::HybridNativePlatformSpecCxx& swiftPart):
|
@@ -17,7 +17,7 @@ import NitroModules
|
|
17
17
|
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
18
18
|
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
19
19
|
*/
|
20
|
-
public
|
20
|
+
public class HybridNativePlatformSpecCxx {
|
21
21
|
/**
|
22
22
|
* The Swift <> C++ bridge's namespace (`margelo::nitro::unistyles::bridge::swift`)
|
23
23
|
* from `Unistyles-Swift-Cxx-Bridge.hpp`.
|
@@ -28,7 +28,15 @@ public final class HybridNativePlatformSpecCxx {
|
|
28
28
|
/**
|
29
29
|
* Holds an instance of the `HybridNativePlatformSpec` Swift protocol.
|
30
30
|
*/
|
31
|
-
private
|
31
|
+
private var implementation: HybridNativePlatformSpec
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Get the actual `HybridNativePlatformSpec` instance this class wraps.
|
35
|
+
*/
|
36
|
+
@inline(__always)
|
37
|
+
public func getHybridNativePlatformSpec() -> HybridNativePlatformSpec {
|
38
|
+
return implementation
|
39
|
+
}
|
32
40
|
|
33
41
|
/**
|
34
42
|
* Create a new `HybridNativePlatformSpecCxx` that wraps the given `HybridNativePlatformSpec`.
|
@@ -36,15 +44,18 @@ public final class HybridNativePlatformSpecCxx {
|
|
36
44
|
*/
|
37
45
|
public init(_ implementation: HybridNativePlatformSpec) {
|
38
46
|
self.implementation = implementation
|
47
|
+
/* no base class */
|
39
48
|
}
|
40
49
|
|
41
50
|
/**
|
42
51
|
* Contains a (weak) reference to the C++ HybridObject to cache it.
|
43
52
|
*/
|
44
53
|
public var hybridContext: margelo.nitro.HybridContext {
|
54
|
+
@inline(__always)
|
45
55
|
get {
|
46
56
|
return self.implementation.hybridContext
|
47
57
|
}
|
58
|
+
@inline(__always)
|
48
59
|
set {
|
49
60
|
self.implementation.hybridContext = newValue
|
50
61
|
}
|
@@ -54,6 +65,7 @@ public final class HybridNativePlatformSpecCxx {
|
|
54
65
|
* Get the memory size of the Swift class (plus size of any other allocations)
|
55
66
|
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
56
67
|
*/
|
68
|
+
@inline(__always)
|
57
69
|
public var memorySize: Int {
|
58
70
|
return self.implementation.memorySize
|
59
71
|
}
|
@@ -43,9 +43,12 @@ namespace margelo::nitro::unistyles {
|
|
43
43
|
/**
|
44
44
|
* An abstract base class for `NativePlatform`
|
45
45
|
* Inherit this class to create instances of `HybridNativePlatformSpec` in C++.
|
46
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
46
47
|
* @example
|
47
48
|
* ```cpp
|
48
49
|
* class HybridNativePlatform: public HybridNativePlatformSpec {
|
50
|
+
* public:
|
51
|
+
* HybridNativePlatform(...): HybridObject(TAG) { ... }
|
49
52
|
* // ...
|
50
53
|
* };
|
51
54
|
* ```
|
@@ -24,9 +24,12 @@ namespace margelo::nitro::unistyles {
|
|
24
24
|
/**
|
25
25
|
* An abstract base class for `UnistylesNavigationBar`
|
26
26
|
* Inherit this class to create instances of `HybridUnistylesNavigationBarSpec` in C++.
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
27
28
|
* @example
|
28
29
|
* ```cpp
|
29
30
|
* class HybridUnistylesNavigationBar: public HybridUnistylesNavigationBarSpec {
|
31
|
+
* public:
|
32
|
+
* HybridUnistylesNavigationBar(...): HybridObject(TAG) { ... }
|
30
33
|
* // ...
|
31
34
|
* };
|
32
35
|
* ```
|
@@ -39,9 +39,12 @@ namespace margelo::nitro::unistyles {
|
|
39
39
|
/**
|
40
40
|
* An abstract base class for `UnistylesRuntime`
|
41
41
|
* Inherit this class to create instances of `HybridUnistylesRuntimeSpec` in C++.
|
42
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
42
43
|
* @example
|
43
44
|
* ```cpp
|
44
45
|
* class HybridUnistylesRuntime: public HybridUnistylesRuntimeSpec {
|
46
|
+
* public:
|
47
|
+
* HybridUnistylesRuntime(...): HybridObject(TAG) { ... }
|
45
48
|
* // ...
|
46
49
|
* };
|
47
50
|
* ```
|
@@ -24,9 +24,12 @@ namespace margelo::nitro::unistyles {
|
|
24
24
|
/**
|
25
25
|
* An abstract base class for `UnistylesShadowRegistry`
|
26
26
|
* Inherit this class to create instances of `HybridUnistylesShadowRegistrySpec` in C++.
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
27
28
|
* @example
|
28
29
|
* ```cpp
|
29
30
|
* class HybridUnistylesShadowRegistry: public HybridUnistylesShadowRegistrySpec {
|
31
|
+
* public:
|
32
|
+
* HybridUnistylesShadowRegistry(...): HybridObject(TAG) { ... }
|
30
33
|
* // ...
|
31
34
|
* };
|
32
35
|
* ```
|
@@ -24,9 +24,12 @@ namespace margelo::nitro::unistyles {
|
|
24
24
|
/**
|
25
25
|
* An abstract base class for `UnistylesStatusBar`
|
26
26
|
* Inherit this class to create instances of `HybridUnistylesStatusBarSpec` in C++.
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
27
28
|
* @example
|
28
29
|
* ```cpp
|
29
30
|
* class HybridUnistylesStatusBar: public HybridUnistylesStatusBarSpec {
|
31
|
+
* public:
|
32
|
+
* HybridUnistylesStatusBar(...): HybridObject(TAG) { ... }
|
30
33
|
* // ...
|
31
34
|
* };
|
32
35
|
* ```
|
@@ -15,7 +15,7 @@ namespace margelo::nitro::unistyles {
|
|
15
15
|
// load custom methods/properties
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
17
17
|
prototype.registerHybridGetter("hairlineWidth", &HybridUnistylesStyleSheetSpec::getHairlineWidth);
|
18
|
-
prototype.registerHybridGetter("
|
18
|
+
prototype.registerHybridGetter("__unid", &HybridUnistylesStyleSheetSpec::get__unid);
|
19
19
|
});
|
20
20
|
}
|
21
21
|
|
@@ -24,9 +24,12 @@ namespace margelo::nitro::unistyles {
|
|
24
24
|
/**
|
25
25
|
* An abstract base class for `UnistylesStyleSheet`
|
26
26
|
* Inherit this class to create instances of `HybridUnistylesStyleSheetSpec` in C++.
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
27
28
|
* @example
|
28
29
|
* ```cpp
|
29
30
|
* class HybridUnistylesStyleSheet: public HybridUnistylesStyleSheetSpec {
|
31
|
+
* public:
|
32
|
+
* HybridUnistylesStyleSheet(...): HybridObject(TAG) { ... }
|
30
33
|
* // ...
|
31
34
|
* };
|
32
35
|
* ```
|
@@ -42,7 +45,7 @@ namespace margelo::nitro::unistyles {
|
|
42
45
|
public:
|
43
46
|
// Properties
|
44
47
|
virtual double getHairlineWidth() = 0;
|
45
|
-
virtual double
|
48
|
+
virtual double get__unid() = 0;
|
46
49
|
|
47
50
|
public:
|
48
51
|
// Methods
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-unistyles",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.21",
|
4
4
|
"description": "Level up your React Native StyleSheet",
|
5
5
|
"scripts": {
|
6
6
|
"test": "jest",
|
@@ -74,11 +74,11 @@
|
|
74
74
|
"husky": "9.1.5",
|
75
75
|
"jest": "29.7.0",
|
76
76
|
"metro-react-native-babel-preset": "0.77.0",
|
77
|
-
"nitro-codegen": "0.
|
77
|
+
"nitro-codegen": "0.11.0",
|
78
78
|
"react": "18.3.1",
|
79
79
|
"react-native": "0.75.2",
|
80
80
|
"react-native-builder-bob": "0.30.0",
|
81
|
-
"react-native-nitro-modules": "0.
|
81
|
+
"react-native-nitro-modules": "0.11.0",
|
82
82
|
"react-native-web": "0.19.12",
|
83
83
|
"react-test-renderer": "18.3.1",
|
84
84
|
"release-it": "17.6.0",
|