@hanzogui/react-native-web-internals 4.4.0 → 102.0.0-rc.41-hanzoai.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +3 -16
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +3 -16
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -1
- package/dist/esm/modules/useElementLayout/index.mjs +2 -2
- package/dist/esm/modules/useElementLayout/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/StyleSheet/compiler/normalizeColor.tsx +1 -1
- package/src/modules/useElementLayout/index.tsx +3 -3
|
@@ -29,21 +29,8 @@ var import_isWebColor = require("../../modules/isWebColor/index.cjs");
|
|
|
29
29
|
var import_processColor = require("../../modules/processColor/index.cjs");
|
|
30
30
|
const normalizeColor = (color, opacity = 1) => {
|
|
31
31
|
if (color == null) return;
|
|
32
|
-
if (typeof color === "string" && (0, import_isWebColor.isWebColor)(color))
|
|
33
|
-
return color;
|
|
34
|
-
}
|
|
32
|
+
if (typeof color === "string" && (0, import_isWebColor.isWebColor)(color)) return color;
|
|
35
33
|
const colorInt = (0, import_processColor.processColor)(color);
|
|
36
|
-
if (colorInt != null) {
|
|
37
|
-
|
|
38
|
-
const g = colorInt >> 8 & 255;
|
|
39
|
-
const b = colorInt & 255;
|
|
40
|
-
const a = (colorInt >> 24 & 255) / 255;
|
|
41
|
-
const alpha = (a * opacity).toFixed(2);
|
|
42
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
43
|
-
}
|
|
44
|
-
if (true) {
|
|
45
|
-
if (typeof color === "string") {
|
|
46
|
-
return color;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
34
|
+
if (colorInt != null) return `rgba(${colorInt >> 16 & 255},${colorInt >> 8 & 255},${colorInt & 255},${((colorInt >> 24 & 255) / 255 * opacity).toFixed(2)})`;
|
|
35
|
+
if (typeof color === "string") return color;
|
|
49
36
|
};
|
|
@@ -2,23 +2,10 @@ import { isWebColor } from "../../modules/isWebColor/index.mjs";
|
|
|
2
2
|
import { processColor } from "../../modules/processColor/index.mjs";
|
|
3
3
|
const normalizeColor = (color, opacity = 1) => {
|
|
4
4
|
if (color == null) return;
|
|
5
|
-
if (typeof color === "string" && isWebColor(color))
|
|
6
|
-
return color;
|
|
7
|
-
}
|
|
5
|
+
if (typeof color === "string" && isWebColor(color)) return color;
|
|
8
6
|
const colorInt = processColor(color);
|
|
9
|
-
if (colorInt != null) {
|
|
10
|
-
|
|
11
|
-
const g = colorInt >> 8 & 255;
|
|
12
|
-
const b = colorInt & 255;
|
|
13
|
-
const a = (colorInt >> 24 & 255) / 255;
|
|
14
|
-
const alpha = (a * opacity).toFixed(2);
|
|
15
|
-
return `rgba(${r},${g},${b},${alpha})`;
|
|
16
|
-
}
|
|
17
|
-
if (true) {
|
|
18
|
-
if (typeof color === "string") {
|
|
19
|
-
return color;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
7
|
+
if (colorInt != null) return `rgba(${colorInt >> 16 & 255},${colorInt >> 8 & 255},${colorInt & 255},${((colorInt >> 24 & 255) / 255 * opacity).toFixed(2)})`;
|
|
8
|
+
if (typeof color === "string") return color;
|
|
22
9
|
};
|
|
23
10
|
export { normalizeColor };
|
|
24
11
|
//# sourceMappingURL=normalizeColor.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isWebColor","processColor","normalizeColor","color","opacity","colorInt","
|
|
1
|
+
{"version":3,"names":["isWebColor","processColor","normalizeColor","color","opacity","colorInt","toFixed"],"sources":["../../../../src/StyleSheet/compiler/normalizeColor.tsx"],"sourcesContent":[null],"mappings":"AASA,SAASA,UAAA,QAAkB;AAC3B,SAASC,YAAA,QAAoB;AAEtB,MAAMC,cAAA,GAAiBA,CAACC,KAAA,EAAyBC,OAAA,GAAU,MAAqB;EACrF,IAAAD,KAAI,QAAS,EAAM;EAEnB,WAAIA,KAAO,aAAU,IAAAH,UAAY,CAAAG,KAAW,CAAK,SAAGA,KAAA;EAClD,MAAAE,QAAO,GAAAJ,YAAA,CAAAE,KAAA;EAAA,IACTE,QAAA,yBAAAA,QAAA,gBAAAA,QAAA,eAAAA,QAAA,YAAAA,QAAA,sBAAAD,OAAA,EAAAE,OAAA;EAEA,WAAMH,KAAA,KAAW,UAAa,OAAKA,KAAA;AACnC;AACE,SAAAD,cAAW","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { enable, useElementLayout as
|
|
1
|
+
import { enable, useElementLayout as useHanzoguiElementLayout } from "@hanzogui/use-element-layout";
|
|
2
2
|
import { useEffect, useMemo } from "react";
|
|
3
3
|
function useElementLayout(ref, onLayout) {
|
|
4
4
|
const wrappedRef = useMemo(() => {
|
|
@@ -13,7 +13,7 @@ function useElementLayout(ref, onLayout) {
|
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
enable();
|
|
15
15
|
}, []);
|
|
16
|
-
return
|
|
16
|
+
return useHanzoguiElementLayout(wrappedRef, onLayout);
|
|
17
17
|
}
|
|
18
18
|
export { useElementLayout };
|
|
19
19
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["enable","useElementLayout","
|
|
1
|
+
{"version":3,"names":["enable","useElementLayout","useHanzoguiElementLayout","useEffect","useMemo","ref","onLayout","wrappedRef","current","host"],"sources":["../../../../src/modules/useElementLayout/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,SACEA,MAAA,EACAC,gBAAA,IAAoBC,wBAAA,QACf;AACP,SAAyBC,SAAA,EAAWC,OAAA,QAAe;AAG5C,SAASH,iBACdI,GAAA,EACAC,QAAA,EACA;EAEA,MAAMC,UAAA,GAAaH,OAAA,CAAQ,MAAM;IAC/B,OAAO;MACLI,OAAA,EAAS;QACP,IAAIC,KAAA,EAAO;UACT,OAAOJ,GAAA,CAAIG,OAAA;QACb;MACF;IACF;EACF,GAAG,CAACH,GAAG,CAAC;EAERF,SAAA,CAAU,MAAM;IACdH,MAAA,CAAO;EACT,GAAG,EAAE;EAEL,OAAOE,wBAAA,CAAyBK,UAAA,EAAYD,QAAQ;AACtD","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/react-native-web-internals",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "102.0.0-rc.41-hanzoai.1",
|
|
4
4
|
"description": "React Native for Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"build": "
|
|
34
|
-
"watch": "
|
|
35
|
-
"clean": "
|
|
36
|
-
"clean:build": "
|
|
33
|
+
"build": "hanzogui-build --skip-native",
|
|
34
|
+
"watch": "hanzogui-build --skip-native --watch",
|
|
35
|
+
"clean": "hanzogui-build clean",
|
|
36
|
+
"clean:build": "hanzogui-build clean:build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@hanzogui/normalize-css-color": "
|
|
40
|
-
"@hanzogui/react-native-use-pressable": "
|
|
41
|
-
"@hanzogui/react-native-use-responder-events": "
|
|
42
|
-
"@hanzogui/simple-hash": "
|
|
43
|
-
"@hanzogui/use-element-layout": "
|
|
44
|
-
"@hanzogui/web": "
|
|
39
|
+
"@hanzogui/normalize-css-color": "102.0.0-rc.41-hanzoai.1",
|
|
40
|
+
"@hanzogui/react-native-use-pressable": "102.0.0-rc.41-hanzoai.1",
|
|
41
|
+
"@hanzogui/react-native-use-responder-events": "102.0.0-rc.41-hanzoai.1",
|
|
42
|
+
"@hanzogui/simple-hash": "102.0.0-rc.41-hanzoai.1",
|
|
43
|
+
"@hanzogui/use-element-layout": "102.0.0-rc.41-hanzoai.1",
|
|
44
|
+
"@hanzogui/web": "102.0.0-rc.41-hanzoai.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@hanzogui/build": "
|
|
47
|
+
"@hanzogui/build": "102.0.0-rc.41-hanzoai.1",
|
|
48
48
|
"react": ">=19",
|
|
49
49
|
"react-dom": "*"
|
|
50
50
|
},
|
|
@@ -27,7 +27,7 @@ export const normalizeColor = (color?: number | string, opacity = 1): void | str
|
|
|
27
27
|
return `rgba(${r},${g},${b},${alpha})`
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (process.env.
|
|
30
|
+
if (process.env.TAMAGUI_TARGET === 'web') {
|
|
31
31
|
if (typeof color === 'string') {
|
|
32
32
|
return color
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
enable,
|
|
3
|
-
useElementLayout as
|
|
3
|
+
useElementLayout as useHanzoguiElementLayout,
|
|
4
4
|
} from '@hanzogui/use-element-layout'
|
|
5
5
|
import { type RefObject, useEffect, useMemo } from 'react'
|
|
6
6
|
import type { LayoutEvent } from '../../types'
|
|
@@ -9,7 +9,7 @@ export function useElementLayout(
|
|
|
9
9
|
ref: RefObject<any>,
|
|
10
10
|
onLayout?: ((e: LayoutEvent) => void) | null
|
|
11
11
|
) {
|
|
12
|
-
// translates to
|
|
12
|
+
// translates to hanzogui style
|
|
13
13
|
const wrappedRef = useMemo(() => {
|
|
14
14
|
return {
|
|
15
15
|
current: {
|
|
@@ -24,5 +24,5 @@ export function useElementLayout(
|
|
|
24
24
|
enable()
|
|
25
25
|
}, [])
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return useHanzoguiElementLayout(wrappedRef, onLayout)
|
|
28
28
|
}
|