react-native-unistyles 3.0.0-alpha.33 → 3.0.0-alpha.35
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Helpers.h +24 -2
- package/cxx/core/HostStyle.cpp +1 -1
- package/cxx/core/UnistyleWrapper.h +31 -1
- package/cxx/core/UnistylesMountHook.cpp +1 -1
- package/cxx/core/UnistylesMountHook.h +4 -2
- package/cxx/core/UnistylesRegistry.cpp +7 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +1 -2
- package/cxx/hybridObjects/HybridShadowRegistry.h +1 -3
- package/cxx/hybridObjects/HybridStyleSheet.cpp +4 -1
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +12 -0
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
- package/cxx/parser/Parser.cpp +6 -6
- package/cxx/parser/Parser.h +1 -1
- package/cxx/shadowTree/ShadowTrafficController.h +2 -0
- package/lib/commonjs/components/Display.js +18 -0
- package/lib/commonjs/components/Display.js.map +1 -0
- package/lib/commonjs/components/Hide.js +18 -0
- package/lib/commonjs/components/Hide.js.map +1 -0
- package/lib/commonjs/components/index.js +20 -0
- package/lib/commonjs/components/index.js.map +1 -0
- package/lib/commonjs/components/useMedia.js +59 -0
- package/lib/commonjs/components/useMedia.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +2 -1
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.native.js +40 -2
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/commonjs/core/index.js +0 -14
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/global.js +0 -4
- package/lib/commonjs/global.js.map +1 -1
- package/lib/commonjs/index.js +12 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +27 -11
- package/lib/commonjs/mq.js.map +1 -2
- package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
- package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -2
- package/lib/commonjs/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +5 -0
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -2
- package/lib/commonjs/specs/ShadowRegistry/types.js +0 -4
- package/lib/commonjs/specs/ShadowRegistry/types.js.map +1 -1
- package/lib/commonjs/specs/StatusBar/index.js.map +1 -2
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js +4 -2
- package/lib/commonjs/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +1 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +3 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -2
- package/lib/commonjs/specs/TurboUnistyles/index.js.map +1 -1
- package/lib/commonjs/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +1 -1
- package/lib/commonjs/specs/index.web.js.map +1 -2
- package/lib/commonjs/specs/types.js +10 -10
- package/lib/commonjs/specs/types.js.map +1 -1
- package/lib/commonjs/types/accessibility.js +9 -9
- package/lib/commonjs/types/accessibility.js.map +1 -1
- package/lib/commonjs/types/breakpoints.js.map +1 -1
- package/lib/commonjs/types/common.js +0 -4
- package/lib/commonjs/types/common.js.map +1 -1
- package/lib/commonjs/types/core.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -2
- package/lib/commonjs/types/stylesheet.js +2 -1
- package/lib/commonjs/types/stylesheet.js.map +1 -2
- package/lib/commonjs/web/convert/index.js +7 -1
- package/lib/commonjs/web/convert/index.js.map +1 -2
- package/lib/commonjs/web/convert/pseudo.js.map +1 -2
- package/lib/commonjs/web/convert/shadow.js +5 -1
- package/lib/commonjs/web/convert/shadow.js.map +1 -2
- package/lib/commonjs/web/convert/style.js.map +1 -2
- package/lib/commonjs/web/convert/textShadow.js.map +1 -2
- package/lib/commonjs/web/convert/transform.js.map +1 -2
- package/lib/commonjs/web/convert/types.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js +2 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -2
- package/lib/commonjs/web/index.js.map +1 -2
- package/lib/commonjs/web/listener.js.map +1 -2
- package/lib/commonjs/web/mock.js.map +1 -2
- package/lib/commonjs/web/runtime.js.map +1 -2
- package/lib/commonjs/web/shadowRegistry.js +9 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -2
- package/lib/commonjs/web/state.js +5 -1
- package/lib/commonjs/web/utils/common.js +3 -1
- package/lib/commonjs/web/utils/common.js.map +1 -2
- package/lib/commonjs/web/utils/index.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +1 -1
- package/lib/commonjs/web/variants/index.js.map +1 -1
- package/lib/module/common.js.map +1 -1
- package/lib/module/components/Display.js +13 -0
- package/lib/module/components/Display.js.map +1 -0
- package/lib/module/components/Hide.js +13 -0
- package/lib/module/components/Hide.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/components/useMedia.js +54 -0
- package/lib/module/components/useMedia.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +2 -1
- package/lib/module/core/createUnistylesComponent.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.native.js +41 -3
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/module/core/index.js +0 -2
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/global.js +1 -1
- package/lib/module/global.js.map +0 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +21 -11
- package/lib/module/mq.js.map +1 -1
- package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +0 -1
- package/lib/module/specs/NativePlatform/index.js.map +1 -1
- package/lib/module/specs/NavigtionBar/UnistylesNavigationBar.nitro.js.map +0 -1
- package/lib/module/specs/ShadowRegistry/ShadowRegistry.nitro.js.map +0 -1
- package/lib/module/specs/ShadowRegistry/index.js +5 -0
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/types.js +0 -2
- package/lib/module/specs/ShadowRegistry/types.js.map +1 -1
- package/lib/module/specs/StatusBar/UnistylesStatusBar.nitro.js.map +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js +1 -1
- package/lib/module/specs/StyleSheet/UnistylesStyleSheet.nitro.js.map +0 -1
- package/lib/module/specs/UnistylesRuntime/UnistylesRuntime.nitro.js.map +0 -1
- package/lib/module/specs/index.web.js.map +1 -2
- package/lib/module/specs/types.js.map +0 -1
- package/lib/module/types/accessibility.js +1 -1
- package/lib/module/types/accessibility.js.map +0 -1
- package/lib/module/types/breakpoints.js.map +0 -1
- package/lib/module/types/common.js +1 -1
- package/lib/module/types/common.js.map +0 -1
- package/lib/module/types/core.js.map +0 -1
- package/lib/module/types/index.js.map +1 -2
- package/lib/module/types/stylesheet.js +2 -2
- package/lib/module/types/stylesheet.js.map +1 -2
- package/lib/module/types/variants.js.map +0 -1
- package/lib/module/web/convert/boxShadow.js +4 -1
- package/lib/module/web/convert/boxShadow.js.map +1 -2
- package/lib/module/web/convert/index.js +7 -1
- package/lib/module/web/convert/shadow.js +5 -1
- package/lib/module/web/convert/shadow.js.map +1 -2
- package/lib/module/web/convert/textShadow.js +4 -1
- package/lib/module/web/convert/utils.js +2 -1
- package/lib/module/web/convert/utils.js.map +1 -2
- package/lib/module/web/create.js +5 -1
- package/lib/module/web/create.js.map +1 -2
- package/lib/module/web/index.js +2 -1
- package/lib/module/web/index.js.map +1 -2
- package/lib/module/web/listener.js.map +1 -2
- package/lib/module/web/registry.js +3 -1
- package/lib/module/web/shadowRegistry.js +9 -1
- package/lib/module/web/shadowRegistry.js.map +1 -2
- package/lib/module/web/state.js +5 -1
- package/lib/module/web/state.js.map +1 -2
- package/lib/module/web/utils/common.js +3 -1
- package/lib/module/web/utils/common.js.map +1 -2
- package/lib/module/web/utils/unistyle.js +1 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/variants/getVariants.js.map +1 -2
- package/lib/module/web/variants/index.js.map +1 -1
- package/lib/typescript/src/components/Display.d.ts +7 -0
- package/lib/typescript/src/components/Display.d.ts.map +1 -0
- package/lib/typescript/src/components/Hide.d.ts +7 -0
- package/lib/typescript/src/components/Hide.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +3 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/src/components/useMedia.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +3 -2
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +3 -2
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +0 -2
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mq.d.ts +8 -0
- package/lib/typescript/src/mq.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -0
- package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +2 -0
- package/package.json +1 -1
- package/plugin/ref.js +4 -4
- package/plugin/style.js +15 -3
- package/src/components/Display.tsx +12 -0
- package/src/components/Hide.tsx +12 -0
- package/src/components/index.ts +2 -0
- package/src/components/useMedia.ts +64 -0
- package/src/core/createUnistylesComponent.native.tsx +48 -4
- package/src/core/createUnistylesComponent.tsx +4 -2
- package/src/core/index.ts +0 -2
- package/src/index.ts +2 -1
- package/src/mq.ts +27 -9
- package/src/specs/ShadowRegistry/index.ts +5 -0
- package/src/specs/ShadowRegistry/types.ts +4 -1
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -0
- package/src/web/utils/unistyle.ts +1 -1
- package/lib/commonjs/core/useBreakpoint.js +0 -22
- package/lib/commonjs/core/useBreakpoint.js.map +0 -1
- package/lib/commonjs/core/useBreakpoint.native.js +0 -24
- package/lib/commonjs/core/useBreakpoint.native.js.map +0 -1
- package/lib/commonjs/core/useTheme.js +0 -22
- package/lib/commonjs/core/useTheme.js.map +0 -2
- package/lib/commonjs/core/useTheme.native.js +0 -24
- package/lib/commonjs/core/useTheme.native.js.map +0 -1
- package/lib/commonjs/web/mq.js +0 -23
- package/lib/commonjs/web/mq.js.map +0 -1
- package/lib/module/core/useBreakpoint.js +0 -17
- package/lib/module/core/useBreakpoint.js.map +0 -1
- package/lib/module/core/useBreakpoint.native.js +0 -19
- package/lib/module/core/useBreakpoint.native.js.map +0 -2
- package/lib/module/core/useTheme.js +0 -17
- package/lib/module/core/useTheme.js.map +0 -2
- package/lib/module/core/useTheme.native.js +0 -19
- package/lib/module/core/useTheme.native.js.map +0 -1
- package/lib/module/web/mq.js +0 -17
- package/lib/module/web/mq.js.map +0 -1
- package/lib/typescript/src/core/useBreakpoint.d.ts +0 -2
- package/lib/typescript/src/core/useBreakpoint.d.ts.map +0 -1
- package/lib/typescript/src/core/useBreakpoint.native.d.ts +0 -2
- package/lib/typescript/src/core/useBreakpoint.native.d.ts.map +0 -1
- package/lib/typescript/src/core/useTheme.d.ts +0 -3
- package/lib/typescript/src/core/useTheme.d.ts.map +0 -1
- package/lib/typescript/src/core/useTheme.native.d.ts +0 -3
- package/lib/typescript/src/core/useTheme.native.d.ts.map +0 -1
- package/lib/typescript/src/web/mq.d.ts +0 -8
- package/lib/typescript/src/web/mq.d.ts.map +0 -1
- package/src/common.js +0 -4
- package/src/core/createUnistylesComponent.js +0 -6
- package/src/core/createUnistylesComponent.native.js +0 -31
- package/src/core/index.js +0 -3
- package/src/core/useBreakpoint.js +0 -14
- package/src/core/useBreakpoint.native.js +0 -16
- package/src/core/useBreakpoint.native.ts +0 -21
- package/src/core/useBreakpoint.ts +0 -18
- package/src/core/useTheme.js +0 -14
- package/src/core/useTheme.native.js +0 -16
- package/src/core/useTheme.native.ts +0 -22
- package/src/core/useTheme.ts +0 -19
- package/src/global.js +0 -1
- package/src/index.js +0 -3
- package/src/mq.js +0 -38
- package/src/specs/NativePlatform/NativePlatform.nitro.js +0 -19
- package/src/specs/NativePlatform/index.js +0 -1
- package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.js +0 -1
- package/src/specs/NavigtionBar/index.js +0 -9
- package/src/specs/ShadowRegistry/ShadowRegistry.nitro.js +0 -1
- package/src/specs/ShadowRegistry/index.js +0 -26
- package/src/specs/ShadowRegistry/types.js +0 -1
- package/src/specs/StatusBar/UnistylesStatusBar.nitro.js +0 -1
- package/src/specs/StatusBar/index.js +0 -25
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.js +0 -1
- package/src/specs/StyleSheet/index.js +0 -13
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.js +0 -2
- package/src/specs/TurboUnistyles/index.js +0 -1
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.js +0 -1
- package/src/specs/UnistylesRuntime/index.js +0 -20
- package/src/specs/index.js +0 -8
- package/src/specs/index.web.js +0 -2
- package/src/specs/types.js +0 -17
- package/src/types/accessibility.js +0 -30
- package/src/types/breakpoints.js +0 -1
- package/src/types/common.js +0 -1
- package/src/types/core.js +0 -1
- package/src/types/index.js +0 -1
- package/src/types/stylesheet.js +0 -2
- package/src/types/variants.js +0 -1
- package/src/web/convert/boxShadow.js +0 -59
- package/src/web/convert/index.js +0 -56
- package/src/web/convert/pseudo.js +0 -131
- package/src/web/convert/shadow.js +0 -50
- package/src/web/convert/style.js +0 -137
- package/src/web/convert/textShadow.js +0 -56
- package/src/web/convert/transform.js +0 -65
- package/src/web/convert/types.js +0 -2
- package/src/web/convert/utils.js +0 -39
- package/src/web/create.js +0 -36
- package/src/web/index.js +0 -22
- package/src/web/listener.js +0 -26
- package/src/web/mock.js +0 -21
- package/src/web/mq.js +0 -14
- package/src/web/mq.ts +0 -17
- package/src/web/registry.js +0 -165
- package/src/web/runtime.js +0 -160
- package/src/web/shadowRegistry.js +0 -96
- package/src/web/state.js +0 -68
- package/src/web/utils/common.js +0 -79
- package/src/web/utils/index.js +0 -2
- package/src/web/utils/unistyle.js +0 -72
- package/src/web/variants/getVariants.js +0 -26
- package/src/web/variants/index.js +0 -2
- package/src/web/variants/useVariants.js +0 -50
@@ -1,26 +0,0 @@
|
|
1
|
-
import { NitroModules } from 'react-native-nitro-modules';
|
2
|
-
const HybridShadowRegistry = NitroModules.createHybridObject('UnistylesShadowRegistry');
|
3
|
-
const findShadowNodeForHandle = (handle) => {
|
4
|
-
const node = handle?.__internalInstanceHandle?.stateNode?.node
|
5
|
-
?? handle?.getScrollResponder?.()?.getNativeScrollRef?.()?.__internalInstanceHandle?.stateNode?.node
|
6
|
-
?? handle?.getNativeScrollRef?.()?.__internalInstanceHandle?.stateNode?.node;
|
7
|
-
if (!node) {
|
8
|
-
// todo extend log with file name / component name
|
9
|
-
throw new Error('Could not find shadow node for one of your components');
|
10
|
-
}
|
11
|
-
return node;
|
12
|
-
};
|
13
|
-
HybridShadowRegistry.add = (handle, style, variants, args) => {
|
14
|
-
// virtualized nodes can be null
|
15
|
-
if (!handle || !style) {
|
16
|
-
return;
|
17
|
-
}
|
18
|
-
HybridShadowRegistry.link(findShadowNodeForHandle(handle), style, variants ?? {}, args ?? []);
|
19
|
-
};
|
20
|
-
HybridShadowRegistry.remove = handle => {
|
21
|
-
if (!handle) {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
HybridShadowRegistry.unlink(findShadowNodeForHandle(handle));
|
25
|
-
};
|
26
|
-
export const UnistylesShadowRegistry = HybridShadowRegistry;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { processColor, StatusBar as NativeStatusBar } from 'react-native';
|
2
|
-
import { StatusBarStyle } from '../types';
|
3
|
-
export const attachStatusBarJSMethods = (hybridObject) => {
|
4
|
-
hybridObject.setStyle = (style, animated) => {
|
5
|
-
switch (style) {
|
6
|
-
case StatusBarStyle.Light:
|
7
|
-
return NativeStatusBar.setBarStyle('light-content', animated);
|
8
|
-
case StatusBarStyle.Dark:
|
9
|
-
return NativeStatusBar.setBarStyle('dark-content', animated);
|
10
|
-
case StatusBarStyle.Default:
|
11
|
-
return NativeStatusBar.setBarStyle('default', animated);
|
12
|
-
}
|
13
|
-
};
|
14
|
-
const privateHybrid = hybridObject;
|
15
|
-
privateHybrid._setHidden = hybridObject.setHidden;
|
16
|
-
hybridObject.setHidden = (isHidden, animation) => {
|
17
|
-
NativeStatusBar.setHidden(isHidden, animation);
|
18
|
-
privateHybrid._setHidden(isHidden);
|
19
|
-
};
|
20
|
-
privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
|
21
|
-
hybridObject.setBackgroundColor = (color) => {
|
22
|
-
const parsedColor = processColor(color) ?? 0;
|
23
|
-
privateHybrid._setBackgroundColor(parsedColor);
|
24
|
-
};
|
25
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
import { UnistyleDependency } from '../NativePlatform';
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { NitroModules } from 'react-native-nitro-modules';
|
2
|
-
import { processColor, StyleSheet as NativeStyleSheet } from 'react-native';
|
3
|
-
const HybridUnistylesStyleSheet = NitroModules
|
4
|
-
.createHybridObject('UnistylesStyleSheet');
|
5
|
-
HybridUnistylesStyleSheet.absoluteFillObject = NativeStyleSheet.absoluteFillObject;
|
6
|
-
HybridUnistylesStyleSheet.absoluteFill = NativeStyleSheet.absoluteFill;
|
7
|
-
HybridUnistylesStyleSheet.flatten = NativeStyleSheet.flatten;
|
8
|
-
HybridUnistylesStyleSheet.compose = NativeStyleSheet.compose;
|
9
|
-
HybridUnistylesStyleSheet.jsMethods = {
|
10
|
-
processColor
|
11
|
-
};
|
12
|
-
HybridUnistylesStyleSheet.init();
|
13
|
-
export const StyleSheet = HybridUnistylesStyleSheet;
|
@@ -1 +0,0 @@
|
|
1
|
-
import './NativeTurboUnistyles';
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { processColor } from 'react-native';
|
2
|
-
import { NitroModules } from 'react-native-nitro-modules';
|
3
|
-
import { attachStatusBarJSMethods } from '../StatusBar';
|
4
|
-
import { attachNavigationBarJSMethods } from '../NavigtionBar';
|
5
|
-
import { isIOS } from '../../common';
|
6
|
-
const HybridUnistylesRuntime = NitroModules
|
7
|
-
.createHybridObject('UnistylesRuntime');
|
8
|
-
HybridUnistylesRuntime.statusBar = HybridUnistylesRuntime.createHybridStatusBar();
|
9
|
-
HybridUnistylesRuntime.navigationBar = HybridUnistylesRuntime.createHybridNavigationBar();
|
10
|
-
HybridUnistylesRuntime._setRootViewBackgroundColor = HybridUnistylesRuntime.setRootViewBackgroundColor;
|
11
|
-
HybridUnistylesRuntime.setRootViewBackgroundColor = (color) => {
|
12
|
-
const parsedColor = processColor(color) ?? 0;
|
13
|
-
HybridUnistylesRuntime._setRootViewBackgroundColor(parsedColor);
|
14
|
-
};
|
15
|
-
if (isIOS) {
|
16
|
-
HybridUnistylesRuntime.setImmersiveMode = (isEnabled) => HybridUnistylesRuntime.statusBar.setHidden(isEnabled, 'fade');
|
17
|
-
}
|
18
|
-
attachStatusBarJSMethods(HybridUnistylesRuntime.statusBar);
|
19
|
-
attachNavigationBarJSMethods(HybridUnistylesRuntime.navigationBar);
|
20
|
-
export const Runtime = HybridUnistylesRuntime;
|
package/src/specs/index.js
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
import './TurboUnistyles';
|
2
|
-
import { Runtime } from './UnistylesRuntime';
|
3
|
-
import { StyleSheet } from './StyleSheet';
|
4
|
-
import { UnistylesShadowRegistry } from './ShadowRegistry';
|
5
|
-
import { StatusBarStyle, ColorScheme, Orientation } from './types';
|
6
|
-
import { UnistyleDependency } from './NativePlatform';
|
7
|
-
export { StatusBarStyle, ColorScheme, Orientation, UnistyleDependency };
|
8
|
-
export { UnistylesShadowRegistry, Runtime as UnistylesRuntime, StyleSheet, };
|
package/src/specs/index.web.js
DELETED
package/src/specs/types.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
export var ColorScheme;
|
2
|
-
(function (ColorScheme) {
|
3
|
-
ColorScheme["Light"] = "light";
|
4
|
-
ColorScheme["Dark"] = "dark";
|
5
|
-
ColorScheme["Unspecified"] = "unspecified";
|
6
|
-
})(ColorScheme || (ColorScheme = {}));
|
7
|
-
export var Orientation;
|
8
|
-
(function (Orientation) {
|
9
|
-
Orientation["Portrait"] = "portrait";
|
10
|
-
Orientation["Landscape"] = "landscape";
|
11
|
-
})(Orientation || (Orientation = {}));
|
12
|
-
export var StatusBarStyle;
|
13
|
-
(function (StatusBarStyle) {
|
14
|
-
StatusBarStyle["Default"] = "default";
|
15
|
-
StatusBarStyle["Light"] = "light";
|
16
|
-
StatusBarStyle["Dark"] = "dark";
|
17
|
-
})(StatusBarStyle || (StatusBarStyle = {}));
|
@@ -1,30 +0,0 @@
|
|
1
|
-
export var IOSContentSizeCategory;
|
2
|
-
(function (IOSContentSizeCategory) {
|
3
|
-
IOSContentSizeCategory["AccessibilityExtraExtraExtraLarge"] = "accessibilityExtraExtraExtraLarge";
|
4
|
-
IOSContentSizeCategory["AccessibilityExtraExtraLarge"] = "accessibilityExtraExtraLarge";
|
5
|
-
IOSContentSizeCategory["AccessibilityExtraLarge"] = "accessibilityExtraLarge";
|
6
|
-
IOSContentSizeCategory["AccessibilityLarge"] = "accessibilityLarge";
|
7
|
-
IOSContentSizeCategory["AccessibilityMedium"] = "accessibilityMedium";
|
8
|
-
IOSContentSizeCategory["ExtraExtraExtraLarge"] = "xxxLarge";
|
9
|
-
IOSContentSizeCategory["ExtraExtraLarge"] = "xxLarge";
|
10
|
-
IOSContentSizeCategory["ExtraLarge"] = "xLarge";
|
11
|
-
IOSContentSizeCategory["Large"] = "Large";
|
12
|
-
IOSContentSizeCategory["Medium"] = "Medium";
|
13
|
-
IOSContentSizeCategory["Small"] = "Small";
|
14
|
-
IOSContentSizeCategory["ExtraSmall"] = "xSmall";
|
15
|
-
IOSContentSizeCategory["Unspecified"] = "unspecified";
|
16
|
-
})(IOSContentSizeCategory || (IOSContentSizeCategory = {}));
|
17
|
-
export var AndroidContentSizeCategory;
|
18
|
-
(function (AndroidContentSizeCategory) {
|
19
|
-
AndroidContentSizeCategory["Small"] = "Small";
|
20
|
-
AndroidContentSizeCategory["Default"] = "Default";
|
21
|
-
AndroidContentSizeCategory["Large"] = "Large";
|
22
|
-
AndroidContentSizeCategory["ExtraLarge"] = "ExtraLarge";
|
23
|
-
AndroidContentSizeCategory["Huge"] = "Huge";
|
24
|
-
AndroidContentSizeCategory["ExtraHuge"] = "ExtraHuge";
|
25
|
-
AndroidContentSizeCategory["ExtraExtraHuge"] = "ExtraExtraHuge";
|
26
|
-
})(AndroidContentSizeCategory || (AndroidContentSizeCategory = {}));
|
27
|
-
export var WebContentSizeCategory;
|
28
|
-
(function (WebContentSizeCategory) {
|
29
|
-
WebContentSizeCategory["Unspecified"] = "web-unspecified";
|
30
|
-
})(WebContentSizeCategory || (WebContentSizeCategory = {}));
|
package/src/types/breakpoints.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/src/types/common.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/src/types/core.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
package/src/types/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { AndroidContentSizeCategory, IOSContentSizeCategory, WebContentSizeCategory } from './accessibility';
|
package/src/types/stylesheet.js
DELETED
package/src/types/variants.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,59 +0,0 @@
|
|
1
|
-
import { deepMergeObjects, warn } from '../utils';
|
2
|
-
import { validateShadow } from './shadow';
|
3
|
-
import { BOX_SHADOW_STYLES } from './types';
|
4
|
-
import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
|
5
|
-
const createBoxShadowValue = (style) => {
|
6
|
-
// at this point every prop is present
|
7
|
-
const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style;
|
8
|
-
const offsetX = normalizeNumericValue(shadowOffset.width);
|
9
|
-
const offsetY = normalizeNumericValue(shadowOffset.height);
|
10
|
-
const radius = normalizeNumericValue(shadowRadius);
|
11
|
-
const color = normalizeColor(shadowColor, shadowOpacity);
|
12
|
-
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
13
|
-
};
|
14
|
-
export const getBoxShadowStyle = (styles) => {
|
15
|
-
const missingStyles = BOX_SHADOW_STYLES.filter(key => !(key in styles));
|
16
|
-
if (missingStyles.length) {
|
17
|
-
warn(`can't apply box shadow as you miss these properties: ${missingStyles.join(', ')}`);
|
18
|
-
return {};
|
19
|
-
}
|
20
|
-
const breakpointsSet = new Set();
|
21
|
-
try {
|
22
|
-
validateShadow(BOX_SHADOW_STYLES, styles, breakpointsSet);
|
23
|
-
}
|
24
|
-
catch (error) {
|
25
|
-
if (typeof error === 'string') {
|
26
|
-
warn(error);
|
27
|
-
}
|
28
|
-
return {};
|
29
|
-
}
|
30
|
-
const breakpoints = Array.from(breakpointsSet);
|
31
|
-
// If no breakpoints were used return styles without media queries
|
32
|
-
if (breakpoints.length === 0) {
|
33
|
-
return {
|
34
|
-
boxShadow: createBoxShadowValue(styles)
|
35
|
-
};
|
36
|
-
}
|
37
|
-
// Create boxShadow for each breakpoint
|
38
|
-
const breakpointStyles = breakpoints.map(breakpoint => {
|
39
|
-
const color = extractShadowValue('shadowColor', breakpoint, styles);
|
40
|
-
const { width, height } = extractShadowValue('shadowOffset', breakpoint, styles);
|
41
|
-
const radius = extractShadowValue('shadowRadius', breakpoint, styles);
|
42
|
-
const opacity = extractShadowValue('shadowOpacity', breakpoint, styles);
|
43
|
-
return {
|
44
|
-
[breakpoint]: {
|
45
|
-
boxShadow: createBoxShadowValue({
|
46
|
-
shadowColor: color,
|
47
|
-
shadowOffset: {
|
48
|
-
width,
|
49
|
-
height
|
50
|
-
},
|
51
|
-
shadowRadius: radius,
|
52
|
-
shadowOpacity: opacity
|
53
|
-
})
|
54
|
-
}
|
55
|
-
};
|
56
|
-
});
|
57
|
-
// Merge all breakpoints styles into one
|
58
|
-
return deepMergeObjects(...breakpointStyles);
|
59
|
-
};
|
package/src/web/convert/index.js
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
import { isPseudo } from './pseudo';
|
2
|
-
import { getStyle } from './style';
|
3
|
-
import { deepMergeObjects } from '../utils';
|
4
|
-
import { getTransformStyle } from './transform';
|
5
|
-
import { isBoxShadow, isTextShadow, isTransform } from './utils';
|
6
|
-
import { getTextShadowStyle } from './textShadow';
|
7
|
-
import { getBoxShadowStyle } from './boxShadow';
|
8
|
-
export const convertUnistyles = (value) => {
|
9
|
-
// Flag to mark if textShadow is already created
|
10
|
-
let hasTextShadow = false;
|
11
|
-
// Flag to mark if boxShadow is already created
|
12
|
-
let hasBoxShadow = false;
|
13
|
-
const stylesArray = Object.entries({
|
14
|
-
...value,
|
15
|
-
...value._web
|
16
|
-
}).flatMap(([unistylesKey, unistylesValue]) => {
|
17
|
-
// Keys to omit
|
18
|
-
if (['_classNames', '_web', 'variants', 'compoundVariants', 'uni__dependencies', '__unistyles-secrets__'].includes(unistylesKey) || unistylesKey.startsWith('variant-')) {
|
19
|
-
return [];
|
20
|
-
}
|
21
|
-
// Pseudo classes :hover, :before etc.
|
22
|
-
if (isPseudo(unistylesKey)) {
|
23
|
-
const flattenValues = convertUnistyles(unistylesValue);
|
24
|
-
return { [unistylesKey]: flattenValues };
|
25
|
-
}
|
26
|
-
// Text shadow
|
27
|
-
if (isTextShadow(unistylesKey)) {
|
28
|
-
if (hasTextShadow) {
|
29
|
-
return [];
|
30
|
-
}
|
31
|
-
hasTextShadow = true;
|
32
|
-
return getTextShadowStyle(value);
|
33
|
-
}
|
34
|
-
// Box shadow
|
35
|
-
if (isBoxShadow(unistylesKey)) {
|
36
|
-
if (hasBoxShadow) {
|
37
|
-
return [];
|
38
|
-
}
|
39
|
-
hasBoxShadow = true;
|
40
|
-
return getBoxShadowStyle(value);
|
41
|
-
}
|
42
|
-
// Transforms
|
43
|
-
if (isTransform(unistylesKey, unistylesValue)) {
|
44
|
-
return getTransformStyle(unistylesValue);
|
45
|
-
}
|
46
|
-
// Breakpoints
|
47
|
-
if (typeof unistylesValue === 'object' && unistylesValue !== null) {
|
48
|
-
return Object.entries(unistylesValue).map(([breakpointKey, breakpointValue]) => {
|
49
|
-
return { [breakpointKey]: getStyle(unistylesKey, breakpointValue) };
|
50
|
-
});
|
51
|
-
}
|
52
|
-
// Regular styles
|
53
|
-
return getStyle(unistylesKey, unistylesValue);
|
54
|
-
});
|
55
|
-
return deepMergeObjects(...stylesArray);
|
56
|
-
};
|
@@ -1,131 +0,0 @@
|
|
1
|
-
export const pseudos = [
|
2
|
-
'_-moz-broken',
|
3
|
-
'_-moz-drag-over',
|
4
|
-
'_-moz-first-node',
|
5
|
-
'_-moz-handler-blocked',
|
6
|
-
'_-moz-handler-crashed',
|
7
|
-
'_-moz-handler-disabled',
|
8
|
-
'_-moz-last-node',
|
9
|
-
'_-moz-loading',
|
10
|
-
'_-moz-locale-dir(ltr)',
|
11
|
-
'_-moz-locale-dir(rtl)',
|
12
|
-
'_-moz-only-whitespace',
|
13
|
-
'_-moz-submit-invalid',
|
14
|
-
'_-moz-suppressed',
|
15
|
-
'_-moz-user-disabled',
|
16
|
-
'_-moz-window-inactive',
|
17
|
-
'_active',
|
18
|
-
'_any-link',
|
19
|
-
'_autofill',
|
20
|
-
'_blank',
|
21
|
-
'_buffering',
|
22
|
-
'_checked',
|
23
|
-
'_current',
|
24
|
-
'_default',
|
25
|
-
'_defined',
|
26
|
-
'_dir(',
|
27
|
-
'_disabled',
|
28
|
-
'_empty',
|
29
|
-
'_enabled',
|
30
|
-
'_first',
|
31
|
-
'_first-child',
|
32
|
-
'_first-of-type',
|
33
|
-
'_focus',
|
34
|
-
'_focus-visible',
|
35
|
-
'_focus-within',
|
36
|
-
'_fullscreen',
|
37
|
-
'_future',
|
38
|
-
'_has(',
|
39
|
-
'_host',
|
40
|
-
'_host-context(',
|
41
|
-
'_host(',
|
42
|
-
'_hover',
|
43
|
-
'_in-range',
|
44
|
-
'_indeterminate',
|
45
|
-
'_invalid',
|
46
|
-
'_is(',
|
47
|
-
'_lang(',
|
48
|
-
'_last-child',
|
49
|
-
'_last-of-type',
|
50
|
-
'_left',
|
51
|
-
'_link',
|
52
|
-
'_local-link',
|
53
|
-
'_modal',
|
54
|
-
'_muted',
|
55
|
-
'_not(',
|
56
|
-
'_nth-child(',
|
57
|
-
'_nth-last-child(',
|
58
|
-
'_nth-last-of-type(',
|
59
|
-
'_nth-of-type(',
|
60
|
-
'_only-child',
|
61
|
-
'_only-of-type',
|
62
|
-
'_optional',
|
63
|
-
'_out-of-range',
|
64
|
-
'_past',
|
65
|
-
'_paused',
|
66
|
-
'_picture-in-picture',
|
67
|
-
'_placeholder-shown',
|
68
|
-
'_playing',
|
69
|
-
'_popover-open',
|
70
|
-
'_read-only',
|
71
|
-
'_read-write',
|
72
|
-
'_required',
|
73
|
-
'_right',
|
74
|
-
'_scope',
|
75
|
-
'_seeking',
|
76
|
-
'_stalled',
|
77
|
-
'_state(',
|
78
|
-
'_target',
|
79
|
-
'_target-within',
|
80
|
-
'_user-invalid',
|
81
|
-
'_user-valid',
|
82
|
-
'_valid',
|
83
|
-
'_visited',
|
84
|
-
'_volume-locked',
|
85
|
-
'_where(',
|
86
|
-
'_-moz-color-swatch',
|
87
|
-
'_-moz-focus-inner',
|
88
|
-
'_-moz-list-bullet',
|
89
|
-
'_-moz-list-number',
|
90
|
-
'_-moz-meter-bar',
|
91
|
-
'_-moz-progress-bar',
|
92
|
-
'_-moz-range-progress',
|
93
|
-
'_-moz-range-thumb',
|
94
|
-
'_-moz-range-track',
|
95
|
-
'_-webkit-inner-spin-button',
|
96
|
-
'_-webkit-meter-barDeprecated',
|
97
|
-
'_-webkit-meter-even-less-good-value',
|
98
|
-
'_-webkit-meter-inner-element',
|
99
|
-
'_-webkit-meter-optimum-value',
|
100
|
-
'_-webkit-meter-suboptimum-value',
|
101
|
-
'_-webkit-progress-bar',
|
102
|
-
'_-webkit-progress-inner-element',
|
103
|
-
'_-webkit-progress-value',
|
104
|
-
'_-webkit-scrollbar',
|
105
|
-
'_-webkit-search-cancel-button',
|
106
|
-
'_-webkit-search-results-button',
|
107
|
-
'_-webkit-slider-runnable-track',
|
108
|
-
'_-webkit-slider-thumb',
|
109
|
-
'_after',
|
110
|
-
'_backdrop',
|
111
|
-
'_before',
|
112
|
-
'_cue',
|
113
|
-
'_file-selector-button',
|
114
|
-
'_first-letter',
|
115
|
-
'_first-line',
|
116
|
-
'_grammar-error',
|
117
|
-
'_highlight(',
|
118
|
-
'_marker',
|
119
|
-
'_part(',
|
120
|
-
'_placeholder',
|
121
|
-
'_selection',
|
122
|
-
'_slotted(',
|
123
|
-
'_spelling-error',
|
124
|
-
'_target-text',
|
125
|
-
'_view-transition',
|
126
|
-
'_view-transition-group',
|
127
|
-
'_view-transition-image-pair',
|
128
|
-
'_view-transition-new',
|
129
|
-
'_view-transition-old',
|
130
|
-
];
|
131
|
-
export const isPseudo = (selector) => pseudos.some(pseudo => selector.startsWith(pseudo));
|
@@ -1,50 +0,0 @@
|
|
1
|
-
export const validateShadow = (shadowProperties, styles, breakpoints) => {
|
2
|
-
// Collect breakpoints
|
3
|
-
shadowProperties.forEach(key => {
|
4
|
-
const value = styles[key];
|
5
|
-
if (typeof value !== 'object') {
|
6
|
-
return;
|
7
|
-
}
|
8
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
9
|
-
const { width, height } = value;
|
10
|
-
// If shadowOffset.width has breakpoints
|
11
|
-
if (typeof width === 'object') {
|
12
|
-
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
|
13
|
-
}
|
14
|
-
// If shadowOffset.height has breakpoints
|
15
|
-
if (typeof height === 'object') {
|
16
|
-
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
|
17
|
-
}
|
18
|
-
return;
|
19
|
-
}
|
20
|
-
// Collect regular breakpoints
|
21
|
-
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
22
|
-
});
|
23
|
-
// Validate if all breakpoints are present
|
24
|
-
shadowProperties.forEach(key => {
|
25
|
-
const value = styles[key];
|
26
|
-
if (typeof value !== 'object') {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
30
|
-
const { width, height } = value;
|
31
|
-
if (typeof width === 'object') {
|
32
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
|
33
|
-
if (missingBreakpoints.length) {
|
34
|
-
throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
if (typeof height === 'object') {
|
38
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
|
39
|
-
if (missingBreakpoints.length) {
|
40
|
-
throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
|
41
|
-
}
|
42
|
-
}
|
43
|
-
return;
|
44
|
-
}
|
45
|
-
const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
|
46
|
-
if (missingBreakpoints.length) {
|
47
|
-
throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
|
48
|
-
}
|
49
|
-
});
|
50
|
-
};
|
package/src/web/convert/style.js
DELETED
@@ -1,137 +0,0 @@
|
|
1
|
-
import { keyInObject } from '../utils';
|
2
|
-
const SKIP_STYLES = [
|
3
|
-
'borderCurve',
|
4
|
-
'elevation',
|
5
|
-
'textAlignVertical',
|
6
|
-
'includeFontPadding',
|
7
|
-
'overlayColor',
|
8
|
-
'tintColor'
|
9
|
-
];
|
10
|
-
const CSS_NUMBER_KEYS = [
|
11
|
-
'animationIterationCount',
|
12
|
-
'borderImageOutset',
|
13
|
-
'borderImageSlice',
|
14
|
-
'borderImageWidth',
|
15
|
-
'boxFlex',
|
16
|
-
'boxFlexGroup',
|
17
|
-
'boxOrdinalGroup',
|
18
|
-
'columnCount',
|
19
|
-
'columns',
|
20
|
-
'counterIncrement',
|
21
|
-
'counterReset',
|
22
|
-
'flex',
|
23
|
-
'flexGrow',
|
24
|
-
'flexPositive',
|
25
|
-
'flexShrink',
|
26
|
-
'flexNegative',
|
27
|
-
'flexOrder',
|
28
|
-
'fontWeight',
|
29
|
-
'gridArea',
|
30
|
-
'gridColumn',
|
31
|
-
'gridColumnEnd',
|
32
|
-
'gridColumnSpan',
|
33
|
-
'gridColumnStart',
|
34
|
-
'gridRow',
|
35
|
-
'gridRowEnd',
|
36
|
-
'gridRowSpan',
|
37
|
-
'gridRowStart',
|
38
|
-
'line-clamp',
|
39
|
-
'line-height',
|
40
|
-
'opacity',
|
41
|
-
'order',
|
42
|
-
'orphans',
|
43
|
-
'tabSize',
|
44
|
-
'widows',
|
45
|
-
'zIndex',
|
46
|
-
'zoom',
|
47
|
-
'fillOpacity',
|
48
|
-
'floodOpacity',
|
49
|
-
'stopOpacity',
|
50
|
-
'strokeDasharray',
|
51
|
-
'strokeDashoffset',
|
52
|
-
'strokeMiterlimit',
|
53
|
-
'strokeOpacity',
|
54
|
-
'strokeWidth'
|
55
|
-
];
|
56
|
-
const convertMap = {
|
57
|
-
marginHorizontal: (value) => ({
|
58
|
-
marginInline: value
|
59
|
-
}),
|
60
|
-
marginVertical: (value) => ({
|
61
|
-
marginBlock: value
|
62
|
-
}),
|
63
|
-
paddingHorizontal: (value) => ({
|
64
|
-
paddingInline: value
|
65
|
-
}),
|
66
|
-
paddingVertical: (value) => ({
|
67
|
-
paddingBlock: value
|
68
|
-
}),
|
69
|
-
writingDirection: (value) => ({
|
70
|
-
direction: value
|
71
|
-
}),
|
72
|
-
borderBottomEndRadius: (value) => ({
|
73
|
-
borderBottomRightRadius: value
|
74
|
-
}),
|
75
|
-
borderBottomStartRadius: (value) => ({
|
76
|
-
borderBottomLeftRadius: value
|
77
|
-
}),
|
78
|
-
borderEndColor: (value) => ({
|
79
|
-
borderInlineEndColor: value
|
80
|
-
}),
|
81
|
-
borderStartColor: (value) => ({
|
82
|
-
borderInlineStartColor: value
|
83
|
-
}),
|
84
|
-
borderTopEndRadius: (value) => ({
|
85
|
-
borderTopRightRadius: value
|
86
|
-
}),
|
87
|
-
borderTopStartRadius: (value) => ({
|
88
|
-
borderTopLeftRadius: value
|
89
|
-
}),
|
90
|
-
borderEndWidth: (value) => ({
|
91
|
-
borderInlineEndWidth: value
|
92
|
-
}),
|
93
|
-
borderStartWidth: (value) => ({
|
94
|
-
borderInlineStartWidth: value
|
95
|
-
}),
|
96
|
-
end: (value) => ({
|
97
|
-
right: value
|
98
|
-
}),
|
99
|
-
start: (value) => ({
|
100
|
-
left: value
|
101
|
-
}),
|
102
|
-
marginEnd: (value) => ({
|
103
|
-
marginRight: value
|
104
|
-
}),
|
105
|
-
marginStart: (value) => ({
|
106
|
-
marginLeft: value
|
107
|
-
}),
|
108
|
-
paddingEnd: (value) => ({
|
109
|
-
paddingRight: value
|
110
|
-
}),
|
111
|
-
paddingStart: (value) => ({
|
112
|
-
paddingLeft: value
|
113
|
-
}),
|
114
|
-
transformMatrix: (value) => ({
|
115
|
-
transform: `matrix(${value.join(', ')})`
|
116
|
-
}),
|
117
|
-
resizeMode: (value) => ({
|
118
|
-
backgroundSize: value
|
119
|
-
})
|
120
|
-
};
|
121
|
-
const convertNumber = (key, value) => {
|
122
|
-
if (typeof value === 'number') {
|
123
|
-
return CSS_NUMBER_KEYS.includes(key, value) ? value : `${value}px`;
|
124
|
-
}
|
125
|
-
return value;
|
126
|
-
};
|
127
|
-
export const getStyle = (key, value) => {
|
128
|
-
if (SKIP_STYLES.includes(key)) {
|
129
|
-
return {};
|
130
|
-
}
|
131
|
-
if (keyInObject(convertMap, key)) {
|
132
|
-
return convertMap[key]?.(convertNumber(key, value)) ?? {};
|
133
|
-
}
|
134
|
-
return {
|
135
|
-
[key]: convertNumber(key, value)
|
136
|
-
};
|
137
|
-
};
|