react-native-unistyles 3.0.0-alpha.35 → 3.0.0-alpha.37
Sign up to get free protection for your applications and to get access to all the features.
- package/Unistyles.podspec +1 -1
- package/android/CMakeLists.txt +19 -36
- package/android/build.gradle +2 -1
- package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
- package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
- package/android/src/main/cxx/cpp-adapter.cpp +8 -86
- package/android/src/main/java/com/unistyles/Equatable.kt +61 -0
- package/android/src/main/java/com/unistyles/NativePlatform+android.kt +302 -0
- package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +148 -0
- package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +54 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +51 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
- package/cxx/NativePlatform.h +11 -0
- package/cxx/common/Helpers.h +1 -1
- package/cxx/core/Unistyle.h +1 -1
- package/cxx/core/UnistyleData.h +1 -1
- package/cxx/core/UnistyleWrapper.h +1 -2
- package/cxx/core/UnistylesCommitHook.cpp +1 -1
- package/cxx/core/UnistylesMountHook.cpp +1 -1
- package/cxx/core/UnistylesRegistry.cpp +4 -13
- package/cxx/core/UnistylesRegistry.h +2 -3
- package/cxx/core/UnistylesState.cpp +10 -7
- package/cxx/hybridObjects/HybridNavigationBar.h +3 -3
- package/cxx/hybridObjects/HybridStatusBar.h +3 -3
- package/cxx/hybridObjects/HybridStyleSheet.cpp +21 -18
- package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +4 -8
- package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -3
- package/cxx/parser/Parser.cpp +3 -27
- package/cxx/parser/Parser.h +2 -3
- package/cxx/shadowTree/ShadowTrafficController.h +9 -5
- package/cxx/shadowTree/ShadowTreeManager.cpp +10 -5
- package/cxx/shadowTree/ShadowTreeManager.h +1 -1
- package/lib/commonjs/components/useMedia.js.map +1 -1
- package/lib/commonjs/components/useMedia.web.js +43 -0
- package/lib/commonjs/components/useMedia.web.js.map +1 -0
- package/lib/commonjs/core/createUnistylesComponent.js +57 -4
- package/lib/commonjs/core/createUnistylesComponent.js.map +1 -1
- package/lib/commonjs/core/createUnistylesComponent.native.js +6 -5
- package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +16 -11
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/object/boxShadow.js +58 -0
- package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/object/filter.js +42 -0
- package/lib/commonjs/web/convert/object/filter.js.map +1 -0
- package/lib/commonjs/web/convert/object/index.js +39 -0
- package/lib/commonjs/web/convert/object/index.js.map +1 -0
- package/lib/commonjs/web/convert/object/objectStyle.js +55 -0
- package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
- package/lib/commonjs/web/convert/object/transform.js +27 -0
- package/lib/commonjs/web/convert/object/transform.js.map +1 -0
- package/lib/commonjs/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
- package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
- package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/commonjs/web/convert/shadow/index.js +28 -0
- package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
- package/lib/commonjs/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
- package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/commonjs/web/convert/utils.js +7 -3
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/listener.js +10 -0
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/registry.js +13 -26
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/runtime.js +3 -0
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +79 -39
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +3 -33
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +4 -1
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/module/components/useMedia.js.map +1 -1
- package/lib/module/components/useMedia.web.js +38 -0
- package/lib/module/components/useMedia.web.js.map +1 -0
- package/lib/module/core/createUnistylesComponent.js +55 -3
- package/lib/module/core/createUnistylesComponent.js.map +1 -1
- package/lib/module/core/createUnistylesComponent.native.js +6 -5
- package/lib/module/core/createUnistylesComponent.native.js.map +1 -1
- package/lib/module/web/convert/index.js +14 -9
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/object/boxShadow.js +53 -0
- package/lib/module/web/convert/object/boxShadow.js.map +1 -0
- package/lib/module/web/convert/object/filter.js +37 -0
- package/lib/module/web/convert/object/filter.js.map +1 -0
- package/lib/module/web/convert/object/index.js +6 -0
- package/lib/module/web/convert/object/index.js.map +1 -0
- package/lib/module/web/convert/object/objectStyle.js +50 -0
- package/lib/module/web/convert/object/objectStyle.js.map +1 -0
- package/lib/module/web/convert/object/transform.js +22 -0
- package/lib/module/web/convert/object/transform.js.map +1 -0
- package/lib/module/web/convert/{boxShadow.js → shadow/boxShadow.js} +9 -24
- package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
- package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
- package/lib/module/web/convert/shadow/index.js +5 -0
- package/lib/module/web/convert/shadow/index.js.map +1 -0
- package/lib/module/web/convert/{textShadow.js → shadow/textShadow.js} +9 -23
- package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
- package/lib/module/web/convert/utils.js +4 -2
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/listener.js +10 -0
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/registry.js +14 -27
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/runtime.js +3 -0
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +80 -40
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -31
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +4 -1
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
- package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
- package/lib/typescript/src/core/createUnistylesComponent.d.ts +4 -3
- package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -1
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +4 -3
- package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
- package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
- package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
- package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
- package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
- package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
- package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/types.d.ts +7 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/utils.d.ts +8 -4
- package/lib/typescript/src/web/convert/utils.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +8 -8
- package/lib/typescript/src/web/index.d.ts +8 -8
- package/lib/typescript/src/web/listener.d.ts +2 -0
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +5 -9
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts +1 -0
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +4 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +1 -6
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency_.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +1 -0
- package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +1 -1
- package/package.json +3 -3
- package/src/components/useMedia.ts +1 -1
- package/src/components/useMedia.web.ts +47 -0
- package/src/core/createUnistylesComponent.native.tsx +12 -10
- package/src/core/createUnistylesComponent.tsx +72 -6
- package/src/types/common.ts +1 -0
- package/src/web/convert/index.ts +16 -9
- package/src/web/convert/object/boxShadow.ts +54 -0
- package/src/web/convert/object/filter.ts +39 -0
- package/src/web/convert/object/index.ts +3 -0
- package/src/web/convert/object/objectStyle.ts +68 -0
- package/src/web/convert/object/transform.ts +24 -0
- package/src/web/convert/{boxShadow.ts → shadow/boxShadow.ts} +9 -30
- package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
- package/src/web/convert/shadow/index.ts +2 -0
- package/src/web/convert/{textShadow.ts → shadow/textShadow.ts} +9 -29
- package/src/web/convert/types.ts +8 -1
- package/src/web/convert/utils.ts +11 -5
- package/src/web/listener.ts +10 -0
- package/src/web/registry.ts +10 -31
- package/src/web/runtime.ts +4 -0
- package/src/web/shadowRegistry.ts +85 -46
- package/src/web/utils/common.ts +1 -37
- package/src/web/utils/unistyle.ts +5 -1
- package/android/src/main/cxx/helpers.cpp +0 -105
- package/android/src/main/cxx/helpers.h +0 -16
- package/android/src/main/cxx/platform.cpp +0 -170
- package/android/src/main/cxx/platform.h +0 -20
- package/lib/commonjs/web/convert/boxShadow.js.map +0 -1
- package/lib/commonjs/web/convert/shadow.js +0 -68
- package/lib/commonjs/web/convert/shadow.js.map +0 -1
- package/lib/commonjs/web/convert/textShadow.js.map +0 -1
- package/lib/commonjs/web/convert/transform.js +0 -72
- package/lib/commonjs/web/convert/transform.js.map +0 -1
- package/lib/module/web/convert/boxShadow.js.map +0 -1
- package/lib/module/web/convert/shadow.js +0 -63
- package/lib/module/web/convert/shadow.js.map +0 -1
- package/lib/module/web/convert/textShadow.js.map +0 -1
- package/lib/module/web/convert/transform.js +0 -67
- package/lib/module/web/convert/transform.js.map +0 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/shadow.d.ts +0 -2
- package/lib/typescript/src/web/convert/shadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +0 -1
- package/lib/typescript/src/web/convert/transform.d.ts +0 -4
- package/lib/typescript/src/web/convert/transform.d.ts.map +0 -1
- package/src/web/convert/shadow.ts +0 -68
- package/src/web/convert/transform.ts +0 -88
- /package/lib/typescript/src/web/convert/{boxShadow.d.ts → shadow/boxShadow.d.ts} +0 -0
- /package/lib/typescript/src/web/convert/{textShadow.d.ts → shadow/textShadow.d.ts} +0 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { hyphenate } from '../../utils';
|
4
|
+
import { getObjectStyle } from './objectStyle';
|
5
|
+
import { normalizeColor, normalizeNumericValue } from '../utils';
|
6
|
+
import { UnistylesRuntime } from '../../runtime';
|
7
|
+
import { isUnistylesMq } from '../../../mq';
|
8
|
+
const getDropShadowStyle = dropShadow => {
|
9
|
+
const {
|
10
|
+
offsetX = 0,
|
11
|
+
offsetY = 0,
|
12
|
+
standardDeviation = 0,
|
13
|
+
color = '#000'
|
14
|
+
} = dropShadow;
|
15
|
+
return `${normalizeColor(String(color))} ${normalizeNumericValue(offsetX)} ${normalizeNumericValue(offsetY)} ${normalizeNumericValue(standardDeviation)}`;
|
16
|
+
};
|
17
|
+
export const getFilterStyle = filters => {
|
18
|
+
const restFilters = filters.filter(filter => Object.keys(filter)[0] !== 'dropShadow');
|
19
|
+
const dropShadow = (() => {
|
20
|
+
const dropShadowValue = filters.find(filter => Object.keys(filter)[0] === 'dropShadow')?.dropShadow;
|
21
|
+
if (typeof dropShadowValue !== 'object') {
|
22
|
+
return [];
|
23
|
+
}
|
24
|
+
const breakpoints = Object.keys(dropShadowValue).filter(key => Object.keys(UnistylesRuntime.breakpoints).includes(key) || isUnistylesMq(key));
|
25
|
+
const breakpointsDropShadow = Object.fromEntries(breakpoints.map(breakpoint => [breakpoint, getDropShadowStyle(dropShadowValue[breakpoint])]));
|
26
|
+
if (breakpoints.length === 0) {
|
27
|
+
return [{
|
28
|
+
dropShadow: getDropShadowStyle(dropShadowValue)
|
29
|
+
}];
|
30
|
+
}
|
31
|
+
return [{
|
32
|
+
dropShadow: breakpointsDropShadow
|
33
|
+
}];
|
34
|
+
})();
|
35
|
+
return getObjectStyle([...restFilters, ...dropShadow], 'filter', (key, value) => `${hyphenate(key)}(${normalizeNumericValue(value)})`);
|
36
|
+
};
|
37
|
+
//# sourceMappingURL=filter.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["hyphenate","getObjectStyle","normalizeColor","normalizeNumericValue","UnistylesRuntime","isUnistylesMq","getDropShadowStyle","dropShadow","offsetX","offsetY","standardDeviation","color","String","getFilterStyle","filters","restFilters","filter","Object","keys","dropShadowValue","find","breakpoints","key","includes","breakpointsDropShadow","fromEntries","map","breakpoint","length","value"],"sourceRoot":"../../../../../src","sources":["web/convert/object/filter.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AAChE,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,aAAa,QAAQ,aAAa;AAE3C,MAAMC,kBAAkB,GAAIC,UAA2B,IAAK;EACxD,MAAM;IAAEC,OAAO,GAAG,CAAC;IAAEC,OAAO,GAAG,CAAC;IAAEC,iBAAiB,GAAG,CAAC;IAAEC,KAAK,GAAG;EAAO,CAAC,GAAGJ,UAAU;EAEtF,OAAO,GAAGL,cAAc,CAACU,MAAM,CAACD,KAAK,CAAC,CAAC,IAAIR,qBAAqB,CAACK,OAAO,CAAC,IAAIL,qBAAqB,CAACM,OAAO,CAAC,IAAIN,qBAAqB,CAACO,iBAAiB,CAAC,EAAE;AAC7J,CAAC;AAED,OAAO,MAAMG,cAAc,GAAIC,OAAuB,IAAK;EACvD,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,CAACA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC;EACrF,MAAMT,UAAU,GAAG,CAAC,MAAM;IACtB,MAAMY,eAAe,GAAGL,OAAO,CAACM,IAAI,CAACJ,MAAM,IAAIC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,EAAET,UAAiC;IAE1H,IAAI,OAAOY,eAAe,KAAK,QAAQ,EAAE;MACrC,OAAO,EAAE;IACb;IAEA,MAAME,WAAW,GAAGJ,MAAM,CAACC,IAAI,CAACC,eAAe,CAAC,CAACH,MAAM,CAACM,GAAG,IAAIL,MAAM,CAACC,IAAI,CAACd,gBAAgB,CAACiB,WAAW,CAAC,CAACE,QAAQ,CAACD,GAAG,CAAC,IAAIjB,aAAa,CAACiB,GAAG,CAAC,CAAC;IAC7I,MAAME,qBAAqB,GAAGP,MAAM,CAACQ,WAAW,CAACJ,WAAW,CAACK,GAAG,CAACC,UAAU,IAAI,CAACA,UAAU,EAAErB,kBAAkB,CAACa,eAAe,CAACQ,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9I,IAAIN,WAAW,CAACO,MAAM,KAAK,CAAC,EAAE;MAC1B,OAAO,CAAC;QACJrB,UAAU,EAAED,kBAAkB,CAACa,eAAkC;MACrE,CAAC,CAAC;IACN;IAEA,OAAO,CAAC;MACJZ,UAAU,EAAEiB;IAChB,CAAC,CAAC;EACN,CAAC,EAAE,CAAC;EAEJ,OAAOvB,cAAc,CAAC,CAAC,GAAGc,WAAW,EAAE,GAAGR,UAAU,CAAC,EAAE,QAAQ,EAAE,CAACe,GAAG,EAAEO,KAAK,KAAK,GAAG7B,SAAS,CAACsB,GAAG,CAAC,IAAInB,qBAAqB,CAAC0B,KAAwB,CAAC,GAAG,CAAC;AAC7J,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["web/convert/object/index.ts"],"mappings":";;AAAA,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,UAAU","ignoreList":[]}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { deepMergeObjects, keyInObject } from '../../utils';
|
4
|
+
const createStylesValue = (styles, normalize) => styles.map(style => {
|
5
|
+
const [key] = Object.keys(style);
|
6
|
+
if (!key) {
|
7
|
+
return undefined;
|
8
|
+
}
|
9
|
+
return normalize(key, style[key]);
|
10
|
+
}).filter(Boolean).join(' ');
|
11
|
+
export const getObjectStyle = (styles, styleKey, normalize) => {
|
12
|
+
const breakpoints = new Set();
|
13
|
+
const normalStyles = [];
|
14
|
+
styles.forEach(style => {
|
15
|
+
const [property] = Object.keys(style);
|
16
|
+
if (!property) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
const value = style[property];
|
20
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
21
|
+
Object.keys(value ?? {}).forEach(breakpoint => breakpoints.add(breakpoint));
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
normalStyles.push(style);
|
25
|
+
});
|
26
|
+
const breakpointStyles = Array.from(breakpoints).flatMap(breakpoint => {
|
27
|
+
const stylesPerBreakpoint = styles.flatMap(style => {
|
28
|
+
const [property] = Object.keys(style);
|
29
|
+
if (!property) {
|
30
|
+
return [];
|
31
|
+
}
|
32
|
+
const value = style[property];
|
33
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
34
|
+
return keyInObject(value, breakpoint) ? [{
|
35
|
+
[property]: value[breakpoint]
|
36
|
+
}] : [];
|
37
|
+
}
|
38
|
+
return [];
|
39
|
+
});
|
40
|
+
return [{
|
41
|
+
[breakpoint]: {
|
42
|
+
[styleKey]: createStylesValue(stylesPerBreakpoint, normalize)
|
43
|
+
}
|
44
|
+
}];
|
45
|
+
});
|
46
|
+
return deepMergeObjects({
|
47
|
+
[styleKey]: createStylesValue(normalStyles, normalize)
|
48
|
+
}, ...breakpointStyles);
|
49
|
+
};
|
50
|
+
//# sourceMappingURL=objectStyle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deepMergeObjects","keyInObject","createStylesValue","styles","normalize","map","style","key","Object","keys","undefined","filter","Boolean","join","getObjectStyle","styleKey","breakpoints","Set","normalStyles","forEach","property","value","Array","isArray","breakpoint","add","push","breakpointStyles","from","flatMap","stylesPerBreakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/object/objectStyle.ts"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,aAAa;AAK3D,MAAMC,iBAAiB,GAAGA,CAAyBC,MAAsB,EAAEC,SAA6B,KAAKD,MAAM,CAC9GE,GAAG,CAACC,KAAK,IAAI;EACV,MAAM,CAACC,GAAG,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;EAEhC,IAAI,CAACC,GAAG,EAAE;IACN,OAAOG,SAAS;EACpB;EAEA,OAAON,SAAS,CAACG,GAAG,EAAED,KAAK,CAACC,GAAG,CAAC,CAAC;AACrC,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;AAEd,OAAO,MAAMC,cAAc,GAAGA,CAAyBX,MAAsB,EAAEY,QAAgB,EAAEX,SAA6B,KAAK;EAC/H,MAAMY,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EACrC,MAAMC,YAA4B,GAAG,EAAE;EAEvCf,MAAM,CAACgB,OAAO,CAACb,KAAK,IAAI;IACpB,MAAM,CAACc,QAAQ,CAAC,GAAGZ,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;IAErC,IAAI,CAACc,QAAQ,EAAE;MACX;IACJ;IAEA,MAAMC,KAAK,GAAGf,KAAK,CAACc,QAAQ,CAAC;IAE7B,IAAI,OAAOC,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACpDb,MAAM,CAACC,IAAI,CAACY,KAAK,IAAI,CAAC,CAAC,CAAC,CAACF,OAAO,CAACK,UAAU,IAAIR,WAAW,CAACS,GAAG,CAACD,UAAU,CAAC,CAAC;MAE3E;IACJ;IAEAN,YAAY,CAACQ,IAAI,CAACpB,KAAK,CAAC;EAC5B,CAAC,CAAC;EAEF,MAAMqB,gBAAgB,GAAGL,KAAK,CAACM,IAAI,CAACZ,WAAW,CAAC,CAACa,OAAO,CAACL,UAAU,IAAI;IACnE,MAAMM,mBAAmB,GAAG3B,MAAM,CAAC0B,OAAO,CAACvB,KAAK,IAAI;MAChD,MAAM,CAACc,QAAQ,CAAC,GAAGZ,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC;MAErC,IAAI,CAACc,QAAQ,EAAE;QACX,OAAO,EAAE;MACb;MAEA,MAAMC,KAAK,GAAGf,KAAK,CAACc,QAAQ,CAAC;MAE7B,IAAI,OAAOC,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;QACpD,OAAOpB,WAAW,CAACoB,KAAK,EAAEG,UAAU,CAAC,GAAG,CAAC;UAAE,CAACJ,QAAQ,GAAGC,KAAK,CAACG,UAAU;QAAE,CAAC,CAAC,GAAG,EAAE;MACpF;MAEA,OAAO,EAAE;IACb,CAAC,CAAmB;IAEpB,OAAO,CAAC;MACJ,CAACA,UAAU,GAAG;QACV,CAACT,QAAQ,GAAGb,iBAAiB,CAAC4B,mBAAmB,EAAE1B,SAAS;MAChE;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAOJ,gBAAgB,CAAsB;IACzC,CAACe,QAAQ,GAAGb,iBAAiB,CAACgB,YAAY,EAAEd,SAAS;EACzD,CAAC,EAAE,GAAGuB,gBAAgB,CAAC;AAC3B,CAAC","ignoreList":[]}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
import { getObjectStyle } from './objectStyle';
|
4
|
+
import { normalizeNumericValue } from '../utils';
|
5
|
+
const normalizeTransform = (key, value) => {
|
6
|
+
if (key.includes('scale')) {
|
7
|
+
return value;
|
8
|
+
}
|
9
|
+
if (typeof value === 'number') {
|
10
|
+
return normalizeNumericValue(value);
|
11
|
+
}
|
12
|
+
return value;
|
13
|
+
};
|
14
|
+
export const getTransformStyle = transforms => getObjectStyle(transforms, 'transform', (key, value) => {
|
15
|
+
switch (key) {
|
16
|
+
case 'matrix':
|
17
|
+
return `${key}(${value.join(',')})`;
|
18
|
+
default:
|
19
|
+
return `${key}(${normalizeTransform(key, value)})`;
|
20
|
+
}
|
21
|
+
});
|
22
|
+
//# sourceMappingURL=transform.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getObjectStyle","normalizeNumericValue","normalizeTransform","key","value","includes","getTransformStyle","transforms","join"],"sourceRoot":"../../../../../src","sources":["web/convert/object/transform.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,qBAAqB,QAAQ,UAAU;AAGhD,MAAMC,kBAAkB,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAK;EACpD,IAAID,GAAG,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IACvB,OAAOD,KAAK;EAChB;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOH,qBAAqB,CAACG,KAAK,CAAC;EACvC;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,OAAO,MAAME,iBAAiB,GAAIC,UAAkC,IAAKP,cAAc,CAACO,UAAU,EAAE,WAAW,EAAE,CAACJ,GAAG,EAAEC,KAAK,KAAK;EAC7H,QAAOD,GAAG;IACN,KAAK,QAAQ;MACT,OAAO,GAAGA,GAAG,IAAKC,KAAK,CAAmBI,IAAI,CAAC,GAAG,CAAC,GAAG;IAC1D;MACI,OAAO,GAAGL,GAAG,IAAID,kBAAkB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAG;EAC1D;AACJ,CAAC,CAAC","ignoreList":[]}
|
@@ -1,39 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { deepMergeObjects
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
3
|
+
import { deepMergeObjects } from '../../utils';
|
4
|
+
import { BOX_SHADOW_STYLES } from '../types';
|
5
|
+
import { extractShadowValue, normalizeColor, normalizeNumericValue } from '../utils';
|
6
|
+
import { getShadowBreakpoints } from './getShadowBreakpoints';
|
7
7
|
const createBoxShadowValue = style => {
|
8
|
-
// at this point every prop is present
|
9
8
|
const {
|
10
9
|
shadowColor,
|
11
10
|
shadowOffset,
|
12
11
|
shadowOpacity,
|
13
12
|
shadowRadius
|
14
13
|
} = style;
|
15
|
-
const offsetX = normalizeNumericValue(shadowOffset
|
16
|
-
const offsetY = normalizeNumericValue(shadowOffset
|
17
|
-
const radius = normalizeNumericValue(shadowRadius);
|
18
|
-
const color = normalizeColor(shadowColor, shadowOpacity);
|
14
|
+
const offsetX = normalizeNumericValue(shadowOffset?.width ?? 0);
|
15
|
+
const offsetY = normalizeNumericValue(shadowOffset?.height ?? 0);
|
16
|
+
const radius = normalizeNumericValue(shadowRadius ?? 0);
|
17
|
+
const color = normalizeColor(shadowColor ?? '#000000', shadowOpacity ?? 1);
|
19
18
|
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
20
19
|
};
|
21
20
|
export const getBoxShadowStyle = styles => {
|
22
|
-
const
|
23
|
-
if (missingStyles.length) {
|
24
|
-
warn(`can't apply box shadow as you miss these properties: ${missingStyles.join(', ')}`);
|
25
|
-
return {};
|
26
|
-
}
|
27
|
-
const breakpointsSet = new Set();
|
28
|
-
try {
|
29
|
-
validateShadow(BOX_SHADOW_STYLES, styles, breakpointsSet);
|
30
|
-
} catch (error) {
|
31
|
-
if (typeof error === 'string') {
|
32
|
-
warn(error);
|
33
|
-
}
|
34
|
-
return {};
|
35
|
-
}
|
36
|
-
const breakpoints = Array.from(breakpointsSet);
|
21
|
+
const breakpoints = getShadowBreakpoints(BOX_SHADOW_STYLES, styles);
|
37
22
|
|
38
23
|
// If no breakpoints were used return styles without media queries
|
39
24
|
if (breakpoints.length === 0) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deepMergeObjects","BOX_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","width","offsetY","height","radius","color","getBoxShadowStyle","styles","breakpoints","length","boxShadow","breakpointStyles","map","breakpoint","opacity"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/boxShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,iBAAiB,QAAwB,UAAU;AAC5D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AACpF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,oBAAoB,GAAIC,KAAgB,IAAK;EAC/C,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGJ,KAAK;EACxE,MAAMK,OAAO,GAAGR,qBAAqB,CAACK,YAAY,EAAEI,KAAK,IAAI,CAAC,CAAC;EAC/D,MAAMC,OAAO,GAAGV,qBAAqB,CAACK,YAAY,EAAEM,MAAM,IAAI,CAAC,CAAC;EAChE,MAAMC,MAAM,GAAGZ,qBAAqB,CAACO,YAAY,IAAI,CAAC,CAAC;EACvD,MAAMM,KAAK,GAAGd,cAAc,CAAEK,WAAW,IAAI,SAAS,EAAcE,aAAa,IAAI,CAAY,CAAC;EAElG,OAAO,GAAGE,OAAO,IAAIE,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,iBAAiB,GAAIC,MAA2B,IAAK;EAC9D,MAAMC,WAAW,GAAGf,oBAAoB,CAACJ,iBAAiB,EAAEkB,MAAM,CAAC;;EAEnE;EACA,IAAIC,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;IAC1B,OAAO;MACHC,SAAS,EAAEhB,oBAAoB,CAACa,MAAmB;IACvD,CAAC;EACL;;EAEA;EACA,MAAMI,gBAAgB,GAAGH,WAAW,CAACI,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMR,KAAK,GAAGf,kBAAkB,CAAC,aAAa,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IACnE,MAAM;MAAEN,KAAK;MAAEE;IAAO,CAAC,GAAGb,kBAAkB,CAAC,cAAc,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IAChF,MAAMH,MAAM,GAAGd,kBAAkB,CAAC,cAAc,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IACrE,MAAMO,OAAO,GAAGxB,kBAAkB,CAAC,eAAe,EAAEuB,UAAU,EAAEN,MAAM,CAAC;IAEvE,OAAO;MACH,CAACM,UAAU,GAAG;QACVH,SAAS,EAAEhB,oBAAoB,CAAC;UAC5BE,WAAW,EAAES,KAAK;UAClBR,YAAY,EAAE;YACVI,KAAK;YACLE;UACJ,CAAC;UACDJ,YAAY,EAAEK,MAAM;UACpBN,aAAa,EAAEgB;QACnB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAO1B,gBAAgB,CAAC,GAAGuB,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
export const getShadowBreakpoints = (shadowProperties, styles) => {
|
4
|
+
const breakpoints = new Set();
|
5
|
+
shadowProperties.forEach(key => {
|
6
|
+
const value = styles[key];
|
7
|
+
if (typeof value !== 'object') {
|
8
|
+
return;
|
9
|
+
}
|
10
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
11
|
+
const {
|
12
|
+
width,
|
13
|
+
height
|
14
|
+
} = value;
|
15
|
+
|
16
|
+
// If shadowOffset.width has breakpoints
|
17
|
+
if (typeof width === 'object') {
|
18
|
+
Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
|
19
|
+
}
|
20
|
+
|
21
|
+
// If shadowOffset.height has breakpoints
|
22
|
+
if (typeof height === 'object') {
|
23
|
+
Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
|
24
|
+
}
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
// Collect regular breakpoints
|
29
|
+
Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
|
30
|
+
});
|
31
|
+
return Array.from(breakpoints);
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=getShadowBreakpoints.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getShadowBreakpoints","shadowProperties","styles","breakpoints","Set","forEach","key","value","width","height","Object","keys","breakpoint","add","Array","from"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/getShadowBreakpoints.ts"],"mappings":";;AAEA,OAAO,MAAMA,oBAAoB,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,KAAK;EAC1G,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EAErCH,gBAAgB,CAACI,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGL,MAAM,CAACI,GAAG,CAAC;IAEzB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3B;IACJ;IAEA,IAAID,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB,EAAE;MACtD,MAAM;QAAEE,KAAK;QAAEC;MAAO,CAAC,GAAGF,KAAqB;;MAE/C;MACA,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;QAC3BE,MAAM,CAACC,IAAI,CAACH,KAAK,CAAC,CAACH,OAAO,CAACO,UAAU,IAAIT,WAAW,CAACU,GAAG,CAACD,UAAU,CAAC,CAAC;MACzE;;MAEA;MACA,IAAI,OAAOH,MAAM,KAAK,QAAQ,EAAE;QAC5BC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACJ,OAAO,CAACO,UAAU,IAAIT,WAAW,CAACU,GAAG,CAACD,UAAU,CAAC,CAAC;MAC1E;MAEA;IACJ;;IAEA;IACAF,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACF,OAAO,CAACO,UAAU,IAAIT,WAAW,CAACU,GAAG,CAACD,UAAU,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF,OAAOE,KAAK,CAACC,IAAI,CAACZ,WAAW,CAAC;AAClC,CAAC","ignoreList":[]}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/index.ts"],"mappings":";;AAAA,cAAc,aAAa;AAC3B,cAAc,cAAc","ignoreList":[]}
|
@@ -1,37 +1,23 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { deepMergeObjects
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
3
|
+
import { deepMergeObjects } from '../../utils';
|
4
|
+
import { TEXT_SHADOW_STYLES } from '../types';
|
5
|
+
import { extractShadowValue, normalizeColor, normalizeNumericValue } from '../utils';
|
6
|
+
import { getShadowBreakpoints } from './getShadowBreakpoints';
|
7
7
|
const createTextShadowValue = style => {
|
8
8
|
const {
|
9
9
|
textShadowColor,
|
10
10
|
textShadowOffset,
|
11
11
|
textShadowRadius
|
12
12
|
} = style;
|
13
|
-
const offsetX = normalizeNumericValue(textShadowOffset
|
14
|
-
const offsetY = normalizeNumericValue(textShadowOffset
|
15
|
-
const radius = normalizeNumericValue(textShadowRadius);
|
16
|
-
const color = normalizeColor(textShadowColor);
|
13
|
+
const offsetX = normalizeNumericValue(textShadowOffset?.width ?? 0);
|
14
|
+
const offsetY = normalizeNumericValue(textShadowOffset?.height ?? 0);
|
15
|
+
const radius = normalizeNumericValue(textShadowRadius ?? 0);
|
16
|
+
const color = normalizeColor(textShadowColor ?? '#000000');
|
17
17
|
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
18
18
|
};
|
19
19
|
export const getTextShadowStyle = styles => {
|
20
|
-
const
|
21
|
-
if (missingStyles.length) {
|
22
|
-
warn(`can't apply text shadow as you miss these properties: ${missingStyles.join(', ')}`);
|
23
|
-
return {};
|
24
|
-
}
|
25
|
-
const breakpointsSet = new Set();
|
26
|
-
try {
|
27
|
-
validateShadow(TEXT_SHADOW_STYLES, styles, breakpointsSet);
|
28
|
-
} catch (error) {
|
29
|
-
if (typeof error === 'string') {
|
30
|
-
warn(error);
|
31
|
-
}
|
32
|
-
return {};
|
33
|
-
}
|
34
|
-
const breakpoints = Array.from(breakpointsSet);
|
20
|
+
const breakpoints = getShadowBreakpoints(TEXT_SHADOW_STYLES, styles);
|
35
21
|
|
36
22
|
// If no breakpoints were used return styles without media queries
|
37
23
|
if (breakpoints.length === 0) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["deepMergeObjects","TEXT_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","getShadowBreakpoints","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","color","getTextShadowStyle","styles","breakpoints","length","textShadow","breakpointStyles","map","breakpoint"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/textShadow.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,aAAa;AAC9C,SAASC,kBAAkB,QAAyB,UAAU;AAC9D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,UAAU;AACpF,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,MAAMC,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAGP,qBAAqB,CAACK,gBAAgB,EAAEG,KAAK,IAAI,CAAC,CAAC;EACnE,MAAMC,OAAO,GAAGT,qBAAqB,CAACK,gBAAgB,EAAEK,MAAM,IAAI,CAAC,CAAC;EACpE,MAAMC,MAAM,GAAGX,qBAAqB,CAACM,gBAAgB,IAAI,CAAC,CAAC;EAC3D,MAAMM,KAAK,GAAGb,cAAc,CAAEK,eAAe,IAAI,SAAoB,CAAC;EAEtE,OAAO,GAAGG,OAAO,IAAIE,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAIC,MAA2B,IAAK;EAC/D,MAAMC,WAAW,GAAGd,oBAAoB,CAACJ,kBAAkB,EAAEiB,MAAM,CAAC;;EAEpE;EACA,IAAIC,WAAW,CAACC,MAAM,KAAK,CAAC,EAAE;IAC1B,OAAO;MACHC,UAAU,EAAEf,qBAAqB,CAACY,MAAoB;IAC1D,CAAC;EACL;;EAEA;EACA,MAAMI,gBAAgB,GAAGH,WAAW,CAACI,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMR,KAAK,GAAGd,kBAAkB,CAAC,iBAAiB,EAAEsB,UAAU,EAAEN,MAAM,CAAC;IACvE,MAAM;MAAEN,KAAK;MAAEE;IAAO,CAAC,GAAGZ,kBAAkB,CAAC,kBAAkB,EAAEsB,UAAU,EAAEN,MAAM,CAAC;IACpF,MAAMH,MAAM,GAAGb,kBAAkB,CAAC,kBAAkB,EAAEsB,UAAU,EAAEN,MAAM,CAAC;IAEzE,OAAO;MACH,CAACM,UAAU,GAAG;QACVH,UAAU,EAAEf,qBAAqB,CAAC;UAC9BE,eAAe,EAAEQ,KAAK;UACtBP,gBAAgB,EAAE;YACdG,KAAK;YACLE;UACJ,CAAC;UACDJ,gBAAgB,EAAEK;QACtB,CAAC;MACL;IACJ,CAAC;EACL,CAAC,CAAC;;EAEF;EACA,OAAOf,gBAAgB,CAAC,GAAGsB,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
|
@@ -6,8 +6,10 @@ import normalizeColors from '@react-native/normalize-colors';
|
|
6
6
|
import { BOX_SHADOW_STYLES, TEXT_SHADOW_STYLES } from './types';
|
7
7
|
export const isTransform = (key, value) => key === 'transform' && Array.isArray(value);
|
8
8
|
export const isTextShadow = key => TEXT_SHADOW_STYLES.includes(key);
|
9
|
-
export const
|
10
|
-
export const
|
9
|
+
export const isShadow = key => BOX_SHADOW_STYLES.includes(key);
|
10
|
+
export const isFilter = (key, value) => key === 'filter' && Array.isArray(value);
|
11
|
+
export const isBoxShadow = (key, value) => key === 'boxShadow' && Array.isArray(value);
|
12
|
+
export const normalizeNumericValue = value => value && typeof value === 'number' ? `${value}px` : value;
|
11
13
|
export const normalizeColor = (color, opacity = 1) => {
|
12
14
|
// If the opacity is 1 there's no need to normalize the color
|
13
15
|
if (opacity === 1) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["normalizeColors","BOX_SHADOW_STYLES","TEXT_SHADOW_STYLES","isTransform","key","value","Array","isArray","isTextShadow","includes","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAC5D,SAASC,iBAAiB,EAAEC,kBAAkB,
|
1
|
+
{"version":3,"names":["normalizeColors","BOX_SHADOW_STYLES","TEXT_SHADOW_STYLES","isTransform","key","value","Array","isArray","isTextShadow","includes","isShadow","isFilter","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAC5D,SAASC,iBAAiB,EAAEC,kBAAkB,QAA0D,SAAS;AAIjH,OAAO,MAAMC,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAsCD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAEpI,OAAO,MAAMG,YAAY,GAAIJ,GAAW,IAAKF,kBAAkB,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,CAAC;IAE/B,OAAO,QAAQT,CAAC,IAAIC,CAAC,IAAIC,CAAC,IAAKC,CAAC,GAAG,GAAG,GAAIT,OAAO,GAAG;EACxD;EAEA,OAAOD,KAAK;AAChB,CAAC;AAED,OAAO,MAAMkB,kBAAkB,GAAGA,CAA6B7B,GAAS,EAAE8B,UAAkB,EAAEC,MAAW,KAAsB;EAC3H,MAAM9B,KAAK,GAAG8B,MAAM,CAAC/B,GAAG,CAAC;EAEzB,IAAIA,GAAG,KAAK,kBAAkB,IAAIA,GAAG,KAAK,cAAc,EAAE;IACtD,MAAM;MAAEgC,KAAK;MAAEC;IAAO,CAAC,GAAGhC,KAAK;IAE/B,OAAO;MACH+B,KAAK,EAAE,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAACF,UAAU,CAAC,GAAGE,KAAK;MAC5DC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,CAACH,UAAU,CAAC,GAAGG;IAC9D,CAAC;EACL;EAEA,OAAO,OAAOhC,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAAC6B,UAAU,CAAC,GAAG7B,KAAK;AAChE,CAAC","ignoreList":[]}
|
@@ -7,7 +7,11 @@ class UnistylesListenerBuilder {
|
|
7
7
|
listeners = Array.from({
|
8
8
|
length: Object.keys(UnistyleDependency).length / 2
|
9
9
|
}, () => new Set());
|
10
|
+
stylesheetListeners = Array.from({
|
11
|
+
length: Object.keys(UnistyleDependency).length / 2
|
12
|
+
}, () => new Set());
|
10
13
|
emitChange = dependency => {
|
14
|
+
this.stylesheetListeners[dependency]?.forEach(listener => listener());
|
11
15
|
this.listeners[dependency]?.forEach(listener => listener());
|
12
16
|
};
|
13
17
|
initListeners = () => {
|
@@ -26,6 +30,12 @@ class UnistylesListenerBuilder {
|
|
26
30
|
dependencies.forEach(dependency => this.listeners[dependency]?.delete(listener));
|
27
31
|
};
|
28
32
|
};
|
33
|
+
addStylesheetListeners = (dependencies, listener) => {
|
34
|
+
dependencies.forEach(dependency => this.stylesheetListeners[dependency]?.add(listener));
|
35
|
+
return () => {
|
36
|
+
dependencies.forEach(dependency => this.stylesheetListeners[dependency]?.delete(listener));
|
37
|
+
};
|
38
|
+
};
|
29
39
|
}
|
30
40
|
export const UnistylesListener = new UnistylesListenerBuilder();
|
31
41
|
//# sourceMappingURL=listener.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","UnistylesListener"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,MAAMC,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;
|
1
|
+
{"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,MAAMC,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,I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D,UAAU,IAAI,IAAI,CAACT,SAAS,CAACS,UAAU,CAAC,EAAEa,GAAG,CAACX,QAAQ,CAAC,CAAC;IAE7E,OAAO,MAAM;MACTU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACT,SAAS,CAACS,UAAU,CAAC,EAAEc,MAAM,CAACZ,QAAQ,CAAC,CAAC;IACpF,CAAC;EACL,CAAC;EAEDa,sBAAsB,GAAGA,CAACH,YAAuC,EAAEV,QAAsB,KAAK;IAC1FU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEa,GAAG,CAACX,QAAQ,CAAC,CAAC;IAEvF,OAAO,MAAM;MACTU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEc,MAAM,CAACZ,QAAQ,CAAC,CAAC;IAC9F,CAAC;EACL,CAAC;AACL;AAEA,OAAO,MAAMc,iBAAiB,GAAG,IAAI3B,wBAAwB,CAAC,CAAC","ignoreList":[]}
|
@@ -1,10 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
import { UnistylesRuntime } from './runtime';
|
4
|
-
import { extractMediaQueryValue, keyInObject, getMediaQuery, generateHash, extractUnistyleDependencies
|
4
|
+
import { extractMediaQueryValue, keyInObject, getMediaQuery, generateHash, extractUnistyleDependencies } from './utils';
|
5
5
|
import { UnistylesListener } from './listener';
|
6
6
|
import { convertUnistyles } from './convert';
|
7
|
-
import { getVariants } from './variants';
|
8
7
|
class UnistylesRegistryBuilder {
|
9
8
|
stylesheets = new Map();
|
10
9
|
stylesCounter = new Map();
|
@@ -40,46 +39,31 @@ class UnistylesRegistryBuilder {
|
|
40
39
|
this.disposeListenersMap.get(stylesheet)?.();
|
41
40
|
const dependenciesMap = this.dependenciesMap.get(stylesheet) ?? new Set(dependencies);
|
42
41
|
dependencies.forEach(dependency => dependenciesMap.add(dependency));
|
43
|
-
const dispose = UnistylesListener.
|
42
|
+
const dispose = UnistylesListener.addStylesheetListeners(Array.from(dependenciesMap), () => {
|
44
43
|
const newComputedStylesheet = stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime);
|
45
44
|
this.stylesheets.set(stylesheet, newComputedStylesheet);
|
46
45
|
});
|
47
46
|
this.dependenciesMap.set(stylesheet, dependenciesMap);
|
48
47
|
this.disposeListenersMap.set(stylesheet, dispose);
|
49
48
|
};
|
50
|
-
add =
|
51
|
-
key,
|
52
|
-
value,
|
53
|
-
stylesheet,
|
54
|
-
args,
|
55
|
-
variants
|
56
|
-
}) => {
|
49
|
+
add = value => {
|
57
50
|
const hash = generateHash(value);
|
58
51
|
const existingCounter = this.stylesCounter.get(hash);
|
59
52
|
if (!existingCounter || existingCounter.size === 0) {
|
60
53
|
const counter = new Set();
|
61
|
-
const dependencies = extractUnistyleDependencies(value);
|
62
54
|
counter.add(value);
|
63
55
|
this.stylesCounter.set(hash, counter);
|
64
56
|
this.applyStyles(hash, convertUnistyles(value));
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
const newValue = newComputedStyleSheet[key];
|
70
|
-
const result = typeof newValue === 'function' ? newValue(...args) : newValue;
|
71
|
-
const {
|
72
|
-
variantsResult
|
73
|
-
} = Object.fromEntries(getVariants({
|
74
|
-
variantsResult: result
|
75
|
-
}, variants));
|
76
|
-
const resultWithVariants = deepMergeObjects(result, variantsResult ?? {});
|
77
|
-
this.applyStyles(hash, convertUnistyles(resultWithVariants));
|
78
|
-
});
|
79
|
-
return hash;
|
57
|
+
return {
|
58
|
+
hash,
|
59
|
+
existingHash: false
|
60
|
+
};
|
80
61
|
}
|
81
62
|
existingCounter.add(value);
|
82
|
-
return
|
63
|
+
return {
|
64
|
+
hash,
|
65
|
+
existingHash: true
|
66
|
+
};
|
83
67
|
};
|
84
68
|
applyStyles = (hash, styles) => {
|
85
69
|
Object.entries(styles).forEach(([key, value]) => {
|
@@ -173,6 +157,9 @@ class UnistylesRegistryBuilder {
|
|
173
157
|
existingStyles.delete(value);
|
174
158
|
if (existingStyles.size === 0) {
|
175
159
|
const ruleIndex = Array.from(this.styleTag.sheet?.cssRules ?? []).findIndex(rule => rule.cssText.includes(`.${hash}`));
|
160
|
+
if (ruleIndex === -1) {
|
161
|
+
return;
|
162
|
+
}
|
176
163
|
this.styleTag.sheet?.deleteRule(ruleIndex);
|
177
164
|
}
|
178
165
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistylesRuntime","extractMediaQueryValue","keyInObject","getMediaQuery","generateHash","extractUnistyleDependencies","
|
1
|
+
{"version":3,"names":["UnistylesRuntime","extractMediaQueryValue","keyInObject","getMediaQuery","generateHash","extractUnistyleDependencies","UnistylesListener","convertUnistyles","UnistylesRegistryBuilder","stylesheets","Map","stylesCounter","styleTag","disposeListenersMap","dependenciesMap","tag","newTag","document","createElement","id","head","appendChild","getComputedStylesheet","stylesheet","computedStylesheet","get","createdStylesheet","theme","miniRuntime","dependencies","Object","values","flatMap","value","addDependenciesToStylesheet","set","Set","forEach","dependency","add","dispose","addStylesheetListeners","Array","from","newComputedStylesheet","hash","existingCounter","size","counter","applyStyles","existingHash","styles","entries","key","sheet","startsWith","mediaQuery","cssRules","queryRule","find","rule","CSSMediaRule","media","item","includes","mediaQueryValue","ruleIndex","reduce","acc","ruleMediaQueryValue","conditionText","undefined","length","insertRule","mqKey","mqValue","applyRule","pseudoKey","pseudoValue","replace","CSSStyleRule","selectorText","style","remove","existingStyles","delete","findIndex","cssText","deleteRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAEA,SAASA,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,sBAAsB,EAAEC,WAAW,EAAEC,aAAa,EAAEC,YAAY,EAAEC,2BAA2B,QAAQ,SAAS;AACvH,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,gBAAgB,QAAQ,WAAW;AAa5C,MAAMC,wBAA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AAc,CAACrC,IAAI,KAAK,CAAC,EAAE;MAC3B,MAAMmB,SAAS,GAAGxB,KAAK,CAACC,IAAI,CAAC,IAAI,CAAC/B,QAAQ,CAAC0C,KAAK,EAAEG,QAAQ,IAAI,EAAE,CAAC,CAAC6B,SAAS,CAAC1B,IAAI,IAAIA,IAAI,CAAC2B,OAAO,CAACvB,QAAQ,CAAC,IAAInB,IAAI,EAAE,CAAC,CAAC;MAEtH,IAAIqB,SAAS,KAAK,CAAC,CAAC,EAAE;QAClB;MACJ;MAEA,IAAI,CAACtD,QAAQ,CAAC0C,KAAK,EAAEkC,UAAU,CAACtB,SAAS,CAAC;IAC9C;EACJ,CAAC;AACL;AAEA,OAAO,MAAMuB,iBAAiB,GAAG,IAAIjF,wBAAwB,CAAC,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistyleDependency","ColorScheme","Orientation","WebContentSizeCategory","UnistylesListener","NavigationBar","StatusBar","UnistylesState","hexToRGBA","isServer","schemeToTheme","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","window","matchMedia","colorScheme","matches","Light","Dark","Unspecified","themeName","contentSizeCategory","breakpoint","orientation","Portrait","screen","type","includes","Landscape","theme","getTheme","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","rtl","document","documentElement","dir","hasAdaptiveThemes","navigationBar","miniRuntime","isLandscape","isPortrait","setTheme","UnistylesRuntime","emitChange","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","hex","alpha","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","themes","get","Error","set"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,WAAW,EAAEC,WAAW,QAA0C,gBAAgB;AAE3F,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,iBAAiB,QAA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":["UnistyleDependency","ColorScheme","Orientation","WebContentSizeCategory","UnistylesListener","NavigationBar","StatusBar","UnistylesState","hexToRGBA","isServer","schemeToTheme","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","window","matchMedia","colorScheme","matches","Light","Dark","Unspecified","themeName","contentSizeCategory","breakpoints","breakpoint","orientation","Portrait","screen","type","includes","Landscape","theme","getTheme","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","rtl","document","documentElement","dir","hasAdaptiveThemes","navigationBar","miniRuntime","isLandscape","isPortrait","setTheme","UnistylesRuntime","emitChange","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","hex","alpha","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","themes","get","Error","set"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,WAAW,EAAEC,WAAW,QAA0C,gBAAgB;AAE3F,SAASC,sBAAsB,QAAQ,UAAU;AACjD,SAASC,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,aAAa,EAAEC,SAAS,QAAQ,QAAQ;AACjD,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,SAAS,EAAEC,QAAQ,EAAEC,aAAa,QAAQ,SAAS;AAE5D,MAAMC,uBAAuB,CAAC;EAC1BC,UAAU,GAAG,IAAI,CAACC,aAAa,CAAC,CAAC;EACjCC,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;EAEvBF,aAAaA,CAAA,EAA0B;IAC3C,IAAIJ,QAAQ,CAAC,CAAC,EAAE;MACZ,OAAO,IAAI;IACf;IAEA,IAAI,CAAC,IAAI,CAACG,UAAU,EAAE;MAClB,IAAI,CAACA,UAAU,GAAGI,MAAM,CAACC,UAAU,CAAC,+BAA+B,CAAC;IACxE;IAEA,OAAO,IAAI,CAACL,UAAU;EAC1B;EAEQG,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