@tamagui/react-native-web-internals 2.7.7 → 3.0.0-beta.1097.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/createReactDOMStyle.cjs +150 -136
- package/dist/cjs/StyleSheet/compiler/hash.cjs +14 -18
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +20 -24
- package/dist/cjs/StyleSheet/compiler/index.cjs +294 -321
- package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +19 -23
- package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.cjs +31 -35
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +26 -38
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +36 -40
- package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.cjs +107 -111
- package/dist/cjs/StyleSheet/dom/index.cjs +69 -72
- package/dist/cjs/StyleSheet/index.cjs +32 -34
- package/dist/cjs/StyleSheet/preprocess.cjs +73 -94
- package/dist/cjs/StyleSheet/validate.cjs +71 -75
- package/dist/cjs/TextAncestorContext.cjs +14 -18
- package/dist/cjs/colorProps.cjs +24 -28
- package/dist/cjs/index.cjs +48 -50
- package/dist/cjs/modules/AccessibilityUtil/index.cjs +17 -21
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +14 -18
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +45 -49
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +33 -39
- package/dist/cjs/modules/AssetRegistry/index.cjs +17 -19
- package/dist/cjs/modules/ImageLoader/index.cjs +134 -141
- package/dist/cjs/modules/InteractionManager.cjs +211 -219
- package/dist/cjs/modules/Platform/index.cjs +17 -21
- package/dist/cjs/modules/TextInputState/index.cjs +54 -58
- package/dist/cjs/modules/UIManager/index.cjs +45 -51
- package/dist/cjs/modules/canUseDOM.cjs +14 -18
- package/dist/cjs/modules/createDOMProps/index.cjs +284 -359
- package/dist/cjs/modules/createEventHandle/index.cjs +56 -62
- package/dist/cjs/modules/dismissKeyboard/index.cjs +15 -19
- package/dist/cjs/modules/forwardedProps/index.cjs +127 -130
- package/dist/cjs/modules/getBoundingClientRect/index.cjs +21 -25
- package/dist/cjs/modules/invariant.cjs +25 -27
- package/dist/cjs/modules/isSelectionValid/index.cjs +21 -25
- package/dist/cjs/modules/isWebColor/index.cjs +14 -18
- package/dist/cjs/modules/mergeRefs/index.cjs +30 -34
- package/dist/cjs/modules/modality/index.cjs +130 -134
- package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +24 -28
- package/dist/cjs/modules/normalizeColor/index.cjs +27 -31
- package/dist/cjs/modules/pick/index.cjs +21 -27
- package/dist/cjs/modules/processColor/index.cjs +27 -36
- package/dist/cjs/modules/requestIdleCallback/index.cjs +27 -29
- package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.cjs +38 -42
- package/dist/cjs/modules/setValueForStyles/index.cjs +27 -34
- package/dist/cjs/modules/unitlessNumbers/index.cjs +73 -75
- package/dist/cjs/modules/useElementLayout/index.cjs +23 -31
- package/dist/cjs/modules/useEvent/index.cjs +39 -43
- package/dist/cjs/modules/useHover/index.cjs +112 -118
- package/dist/cjs/modules/useLayoutEffect/index.cjs +17 -26
- package/dist/cjs/modules/useLocale/index.cjs +32 -43
- package/dist/cjs/modules/useLocale/isLocaleRTL.cjs +65 -76
- package/dist/cjs/modules/useMergeRefs/index.cjs +18 -29
- package/dist/cjs/modules/usePlatformMethods/index.cjs +23 -30
- package/dist/cjs/modules/useStable/index.cjs +23 -32
- package/dist/cjs/styleTypes.cjs +9 -11
- package/dist/cjs/types.cjs +9 -11
- package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs +137 -119
- package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs.map +1 -1
- package/dist/esm/StyleSheet/compiler/hash.mjs +2 -2
- package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs +7 -6
- package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs.map +1 -1
- package/dist/esm/StyleSheet/compiler/index.mjs +279 -302
- package/dist/esm/StyleSheet/compiler/index.mjs.map +1 -1
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +7 -5
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -1
- package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs +19 -17
- package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs.map +1 -1
- package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs +14 -20
- package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs.map +1 -1
- package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs +24 -22
- package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs.map +1 -1
- package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs +94 -93
- package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs.map +1 -1
- package/dist/esm/StyleSheet/dom/index.mjs +57 -54
- package/dist/esm/StyleSheet/dom/index.mjs.map +1 -1
- package/dist/esm/StyleSheet/index.mjs +18 -17
- package/dist/esm/StyleSheet/index.mjs.map +1 -1
- package/dist/esm/StyleSheet/preprocess.mjs +58 -75
- package/dist/esm/StyleSheet/preprocess.mjs.map +1 -1
- package/dist/esm/StyleSheet/validate.mjs +58 -57
- package/dist/esm/StyleSheet/validate.mjs.map +1 -1
- package/dist/esm/TextAncestorContext.mjs +2 -0
- package/dist/esm/TextAncestorContext.mjs.map +1 -1
- package/dist/esm/colorProps.mjs +11 -10
- package/dist/esm/colorProps.mjs.map +1 -1
- package/dist/esm/index.js +22 -15
- package/dist/esm/index.mjs +22 -15
- package/dist/esm/modules/AccessibilityUtil/index.mjs +5 -3
- package/dist/esm/modules/AccessibilityUtil/index.mjs.map +1 -1
- package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs +2 -1
- package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs.map +1 -1
- package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs +33 -31
- package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs.map +1 -1
- package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs +20 -21
- package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs.map +1 -1
- package/dist/esm/modules/AssetRegistry/index.mjs +3 -2
- package/dist/esm/modules/AssetRegistry/index.mjs.map +1 -1
- package/dist/esm/modules/ImageLoader/index.mjs +120 -124
- package/dist/esm/modules/ImageLoader/index.mjs.map +1 -1
- package/dist/esm/modules/InteractionManager.mjs +199 -201
- package/dist/esm/modules/InteractionManager.mjs.map +1 -1
- package/dist/esm/modules/Platform/index.mjs +4 -3
- package/dist/esm/modules/Platform/index.mjs.map +1 -1
- package/dist/esm/modules/TextInputState/index.mjs +42 -40
- package/dist/esm/modules/TextInputState/index.mjs.map +1 -1
- package/dist/esm/modules/UIManager/index.mjs +33 -33
- package/dist/esm/modules/UIManager/index.mjs.map +1 -1
- package/dist/esm/modules/canUseDOM.mjs +1 -0
- package/dist/esm/modules/canUseDOM.mjs.map +1 -1
- package/dist/esm/modules/createDOMProps/index.mjs +271 -342
- package/dist/esm/modules/createDOMProps/index.mjs.map +1 -1
- package/dist/esm/modules/createEventHandle/index.mjs +44 -44
- package/dist/esm/modules/createEventHandle/index.mjs.map +1 -1
- package/dist/esm/modules/dismissKeyboard/index.mjs +3 -1
- package/dist/esm/modules/dismissKeyboard/index.mjs.map +1 -1
- package/dist/esm/modules/forwardedProps/index.mjs +104 -104
- package/dist/esm/modules/forwardedProps/index.mjs.map +1 -1
- package/dist/esm/modules/getBoundingClientRect/index.mjs +8 -7
- package/dist/esm/modules/getBoundingClientRect/index.mjs.map +1 -1
- package/dist/esm/modules/invariant.mjs +11 -10
- package/dist/esm/modules/invariant.mjs.map +1 -1
- package/dist/esm/modules/isSelectionValid/index.mjs +8 -7
- package/dist/esm/modules/isSelectionValid/index.mjs.map +1 -1
- package/dist/esm/modules/isWebColor/index.mjs +2 -1
- package/dist/esm/modules/isWebColor/index.mjs.map +1 -1
- package/dist/esm/modules/mergeRefs/index.mjs +17 -16
- package/dist/esm/modules/mergeRefs/index.mjs.map +1 -1
- package/dist/esm/modules/modality/index.mjs +115 -115
- package/dist/esm/modules/modality/index.mjs.map +1 -1
- package/dist/esm/modules/multiplyStyleLengthValue/index.mjs +11 -10
- package/dist/esm/modules/multiplyStyleLengthValue/index.mjs.map +1 -1
- package/dist/esm/modules/normalizeColor/index.mjs +15 -13
- package/dist/esm/modules/normalizeColor/index.mjs.map +1 -1
- package/dist/esm/modules/pick/index.mjs +8 -9
- package/dist/esm/modules/pick/index.mjs.map +1 -1
- package/dist/esm/modules/processColor/index.mjs +12 -10
- package/dist/esm/modules/processColor/index.mjs.map +1 -1
- package/dist/esm/modules/requestIdleCallback/index.mjs +14 -12
- package/dist/esm/modules/requestIdleCallback/index.mjs.map +1 -1
- package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs +27 -25
- package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs.map +1 -1
- package/dist/esm/modules/setValueForStyles/index.mjs +15 -16
- package/dist/esm/modules/setValueForStyles/index.mjs.map +1 -1
- package/dist/esm/modules/unitlessNumbers/index.mjs +60 -57
- package/dist/esm/modules/unitlessNumbers/index.mjs.map +1 -1
- package/dist/esm/modules/useElementLayout/index.mjs +12 -14
- package/dist/esm/modules/useElementLayout/index.mjs.map +1 -1
- package/dist/esm/modules/useEvent/index.mjs +28 -26
- package/dist/esm/modules/useEvent/index.mjs.map +1 -1
- package/dist/esm/modules/useHover/index.mjs +101 -101
- package/dist/esm/modules/useHover/index.mjs.map +1 -1
- package/dist/esm/modules/useLayoutEffect/index.mjs +2 -0
- package/dist/esm/modules/useLayoutEffect/index.mjs.map +1 -1
- package/dist/esm/modules/useLocale/index.mjs +15 -17
- package/dist/esm/modules/useLocale/index.mjs.map +1 -1
- package/dist/esm/modules/useLocale/isLocaleRTL.mjs +52 -58
- package/dist/esm/modules/useLocale/isLocaleRTL.mjs.map +1 -1
- package/dist/esm/modules/useMergeRefs/index.mjs +3 -3
- package/dist/esm/modules/useMergeRefs/index.mjs.map +1 -1
- package/dist/esm/modules/usePlatformMethods/index.mjs +11 -12
- package/dist/esm/modules/usePlatformMethods/index.mjs.map +1 -1
- package/dist/esm/modules/useStable/index.mjs +8 -6
- package/dist/esm/modules/useStable/index.mjs.map +1 -1
- package/dist/esm/styleTypes.mjs +0 -2
- package/dist/esm/types.mjs +0 -2
- package/package.json +10 -10
- package/src/StyleSheet/compiler/index.tsx +2 -5
- package/src/StyleSheet/preprocess.tsx +1 -4
- package/src/modules/createDOMProps/index.tsx +8 -22
- package/src/modules/forwardedProps/index.tsx +0 -1
- package/src/modules/mergeRefs/index.tsx +1 -1
- package/src/modules/pick/index.tsx +2 -4
- package/src/modules/setValueForStyles/dangerousStyleValue.tsx +1 -1
- package/src/modules/setValueForStyles/index.tsx +0 -3
- package/types/StyleSheet/compiler/createReactDOMStyle.d.ts.map +1 -1
- package/types/StyleSheet/compiler/index.d.ts.map +1 -1
- package/types/StyleSheet/compiler/normalizeColor.d.ts.map +1 -1
- package/types/StyleSheet/compiler/resolveShadowValue.d.ts.map +1 -1
- package/types/StyleSheet/index.d.ts +15 -16
- package/types/StyleSheet/index.d.ts.map +1 -1
- package/types/StyleSheet/preprocess.d.ts +1 -1
- package/types/StyleSheet/preprocess.d.ts.map +1 -1
- package/types/colorProps.d.ts.map +1 -1
- package/types/modules/AccessibilityUtil/index.d.ts +6 -5
- package/types/modules/AccessibilityUtil/index.d.ts.map +1 -1
- package/types/modules/AccessibilityUtil/isDisabled.d.ts.map +1 -1
- package/types/modules/AccessibilityUtil/propsToAccessibilityComponent.d.ts.map +1 -1
- package/types/modules/AccessibilityUtil/propsToAriaRole.d.ts.map +1 -1
- package/types/modules/ImageLoader/index.d.ts +1 -1
- package/types/modules/ImageLoader/index.d.ts.map +1 -1
- package/types/modules/InteractionManager.d.ts +3 -3
- package/types/modules/InteractionManager.d.ts.map +1 -1
- package/types/modules/Platform/index.d.ts.map +1 -1
- package/types/modules/TextInputState/index.d.ts.map +1 -1
- package/types/modules/UIManager/index.d.ts +1 -6
- package/types/modules/UIManager/index.d.ts.map +1 -1
- package/types/modules/createDOMProps/index.d.ts.map +1 -1
- package/types/modules/forwardedProps/index.d.ts +70 -74
- package/types/modules/forwardedProps/index.d.ts.map +1 -1
- package/types/modules/getBoundingClientRect/index.d.ts.map +1 -1
- package/types/modules/isWebColor/index.d.ts.map +1 -1
- package/types/modules/multiplyStyleLengthValue/index.d.ts.map +1 -1
- package/types/modules/normalizeColor/index.d.ts.map +1 -1
- package/types/modules/pick/index.d.ts.map +1 -1
- package/types/modules/processColor/index.d.ts.map +1 -1
- package/types/modules/requestIdleCallback/index.d.ts +3 -1
- package/types/modules/requestIdleCallback/index.d.ts.map +1 -1
- package/types/modules/setValueForStyles/index.d.ts.map +1 -1
- package/types/modules/unitlessNumbers/index.d.ts.map +1 -1
- package/types/modules/useLayoutEffect/index.d.ts +1 -1
- package/types/modules/useLayoutEffect/index.d.ts.map +1 -1
- package/dist/cjs/StyleSheet/__tests__/compiler-createReactDOMStyle-test.cjs +0 -265
- package/dist/cjs/StyleSheet/__tests__/compiler-test.cjs +0 -419
- package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.cjs +0 -160
- package/dist/cjs/StyleSheet/__tests__/index-test.cjs +0 -436
- package/dist/cjs/StyleSheet/__tests__/preprocess-test.cjs +0 -121
- package/dist/cjs/StyleSheet/__tests__/validate-test.cjs +0 -51
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.cjs +0 -57
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.cjs +0 -46
- package/dist/cjs/modules/Platform/__tests__/index-test.cjs +0 -56
- package/dist/cjs/modules/UIManager/__tests__/index-test.cjs +0 -111
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +0 -177
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +0 -422
- package/dist/cjs/modules/mergeRefs/__tests__/index-test.cjs +0 -48
- package/dist/cjs/modules/modality/__tests__/index-test.cjs +0 -59
- package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.cjs +0 -38
- package/dist/cjs/modules/processColor/__tests__/index-test.cjs +0 -85
- package/dist/cjs/modules/useEvent/__tests__/index-test.cjs +0 -490
- package/dist/cjs/modules/useHover/__tests__/index-test.cjs +0 -382
- package/dist/cjs/modules/useMergeRefs/__tests__/index-test.cjs +0 -125
- package/dist/cjs/modules/useStable/__tests__/index-test.cjs +0 -122
- package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs +0 -242
- package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs.map +0 -1
- package/dist/esm/StyleSheet/__tests__/compiler-test.mjs +0 -420
- package/dist/esm/StyleSheet/__tests__/compiler-test.mjs.map +0 -1
- package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs +0 -137
- package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs.map +0 -1
- package/dist/esm/StyleSheet/__tests__/index-test.mjs +0 -413
- package/dist/esm/StyleSheet/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs +0 -122
- package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs.map +0 -1
- package/dist/esm/StyleSheet/__tests__/validate-test.mjs +0 -52
- package/dist/esm/StyleSheet/__tests__/validate-test.mjs.map +0 -1
- package/dist/esm/StyleSheet/compiler/hash.mjs.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs +0 -34
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs.map +0 -1
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs +0 -23
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs.map +0 -1
- package/dist/esm/modules/Platform/__tests__/index-test.mjs +0 -33
- package/dist/esm/modules/Platform/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/UIManager/__tests__/index-test.mjs +0 -88
- package/dist/esm/modules/UIManager/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs +0 -154
- package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs +0 -399
- package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs +0 -25
- package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/modality/__tests__/index-test.mjs +0 -60
- package/dist/esm/modules/modality/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs +0 -15
- package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/processColor/__tests__/index-test.mjs +0 -62
- package/dist/esm/modules/processColor/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/useEvent/__tests__/index-test.mjs +0 -467
- package/dist/esm/modules/useEvent/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/useHover/__tests__/index-test.mjs +0 -359
- package/dist/esm/modules/useHover/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs +0 -102
- package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/modules/useStable/__tests__/index-test.mjs +0 -99
- package/dist/esm/modules/useStable/__tests__/index-test.mjs.map +0 -1
- package/dist/esm/styleTypes.mjs.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/src/StyleSheet/__tests__/compiler-createReactDOMStyle-test.tsx +0 -236
- package/src/StyleSheet/__tests__/compiler-test.tsx +0 -426
- package/src/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.tsx +0 -169
- package/src/StyleSheet/__tests__/index-test.tsx +0 -406
- package/src/StyleSheet/__tests__/preprocess-test.tsx +0 -107
- package/src/StyleSheet/__tests__/validate-test.tsx +0 -42
- package/src/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.tsx +0 -44
- package/src/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.tsx +0 -25
- package/src/modules/Platform/__tests__/index-test.tsx +0 -45
- package/src/modules/UIManager/__tests__/index-test.tsx +0 -87
- package/src/modules/createDOMProps/__tests__/index-test.tsx +0 -138
- package/src/modules/createEventHandle/__tests__/index-test.tsx +0 -459
- package/src/modules/mergeRefs/__tests__/index-test.tsx +0 -32
- package/src/modules/modality/__tests__/index-test.tsx +0 -66
- package/src/modules/multiplyStyleLengthValue/__tests__/index-test.tsx +0 -23
- package/src/modules/processColor/__tests__/index-test.tsx +0 -78
- package/src/modules/useEvent/__tests__/index-test.tsx +0 -511
- package/src/modules/useHover/__tests__/index-test.tsx +0 -342
- package/src/modules/useMergeRefs/__tests__/index-test.tsx +0 -91
- package/src/modules/useStable/__tests__/index-test.tsx +0 -101
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { unitlessNumbers
|
|
1
|
+
import { unitlessNumbers } from "../unitlessNumbers/index.mjs";
|
|
2
2
|
import { normalizeValueWithProperty } from "../../StyleSheet/compiler/normalizeValueWithProperty.mjs";
|
|
3
|
+
|
|
3
4
|
function dangerousStyleValue(name, value, isCustomProperty) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
var isEmpty = value == null || typeof value === "boolean" || value === "";
|
|
6
|
+
if (isEmpty) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
if (typeof value === "object" && typeof value.__getValue === "function") {
|
|
10
|
+
value = value.__getValue();
|
|
11
|
+
}
|
|
12
|
+
if (name === "transform" && Array.isArray(value)) {
|
|
13
|
+
return value.map((t) => {
|
|
14
|
+
const key = Object.keys(t)[0];
|
|
15
|
+
let val = t[key];
|
|
16
|
+
if (typeof val === "object" && typeof val.__getValue === "function") {
|
|
17
|
+
val = val.__getValue();
|
|
18
|
+
}
|
|
19
|
+
if (key === "matrix" || key === "matrix3d") {
|
|
20
|
+
return `${key}(${val.join(",")})`;
|
|
21
|
+
}
|
|
22
|
+
return `${key}(${normalizeValueWithProperty(val, key)})`;
|
|
23
|
+
}).join(" ");
|
|
24
|
+
}
|
|
25
|
+
if (!isCustomProperty && typeof value === "number" && value !== 0 && !unitlessNumbers[name]) {
|
|
26
|
+
return value + "px";
|
|
27
|
+
}
|
|
28
|
+
return ("" + value).trim();
|
|
28
29
|
}
|
|
30
|
+
|
|
29
31
|
export { dangerousStyleValue };
|
|
30
32
|
//# sourceMappingURL=dangerousStyleValue.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"dangerousStyleValue.js","names":["isUnitlessNumber"],"sources":["esm/modules/setValueForStyles/dangerousStyleValue.js"],"sourcesContent":["import { unitlessNumbers as isUnitlessNumber } from \"../unitlessNumbers/index\";\nimport { normalizeValueWithProperty } from \"../../StyleSheet/compiler/normalizeValueWithProperty\";\nfunction dangerousStyleValue(name, value, isCustomProperty) {\n var isEmpty = value == null || typeof value === \"boolean\" || value === \"\";\n if (isEmpty) {\n return \"\";\n }\n if (typeof value === \"object\" && typeof value.__getValue === \"function\") {\n value = value.__getValue();\n }\n if (name === \"transform\" && Array.isArray(value)) {\n return value.map((t) => {\n const key = Object.keys(t)[0];\n let val = t[key];\n if (typeof val === \"object\" && typeof val.__getValue === \"function\") {\n val = val.__getValue();\n }\n if (key === \"matrix\" || key === \"matrix3d\") {\n return `${key}(${val.join(\",\")})`;\n }\n return `${key}(${normalizeValueWithProperty(val, key)})`;\n }).join(\" \");\n }\n if (!isCustomProperty && typeof value === \"number\" && value !== 0 && !isUnitlessNumber[name]) {\n return value + \"px\";\n }\n return (\"\" + value).trim();\n}\nexport {\n dangerousStyleValue\n};\n//# sourceMappingURL=dangerousStyleValue.js.map\n"],"mappings":";;;;AAEA,SAAS,oBAAoB,MAAM,OAAO,kBAAkB;CAC1D,IAAI,UAAU,SAAS,QAAQ,OAAO,UAAU,aAAa,UAAU;CACvE,IAAI,SAAS;EACX,OAAO;CACT;CACA,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,eAAe,YAAY;EACvE,QAAQ,MAAM,WAAW;CAC3B;CACA,IAAI,SAAS,eAAe,MAAM,QAAQ,KAAK,GAAG;EAChD,OAAO,MAAM,KAAK,MAAM;GACtB,MAAM,MAAM,OAAO,KAAK,CAAC,CAAC,CAAC;GAC3B,IAAI,MAAM,EAAE;GACZ,IAAI,OAAO,QAAQ,YAAY,OAAO,IAAI,eAAe,YAAY;IACnE,MAAM,IAAI,WAAW;GACvB;GACA,IAAI,QAAQ,YAAY,QAAQ,YAAY;IAC1C,OAAO,GAAG,IAAI,GAAG,IAAI,KAAK,GAAG,EAAE;GACjC;GACA,OAAO,GAAG,IAAI,GAAG,2BAA2B,KAAK,GAAG,EAAE;EACxD,CAAC,CAAC,CAAC,KAAK,GAAG;CACb;CACA,IAAI,CAAC,oBAAoB,OAAO,UAAU,YAAY,UAAU,KAAK,CAACA,gBAAiB,OAAO;EAC5F,OAAO,QAAQ;CACjB;CACA,QAAQ,KAAK,MAAK,CAAE,KAAK;AAC3B"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { dangerousStyleValue } from "./dangerousStyleValue.mjs";
|
|
2
|
+
|
|
2
3
|
function setValueForStyles(node, styles) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
style[styleName] = styleValue;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
4
|
+
const style = node.style;
|
|
5
|
+
for (let styleName in styles) {
|
|
6
|
+
const isCustomProperty = styleName.indexOf("--") === 0;
|
|
7
|
+
const styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
|
|
8
|
+
if (styleName === "float") {
|
|
9
|
+
styleName = "cssFloat";
|
|
10
|
+
}
|
|
11
|
+
if (isCustomProperty) {
|
|
12
|
+
style.setProperty(styleName, styleValue);
|
|
13
|
+
} else {
|
|
14
|
+
style[styleName] = styleValue;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
19
17
|
}
|
|
18
|
+
|
|
20
19
|
export { setValueForStyles };
|
|
21
20
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["esm/modules/setValueForStyles/index.js"],"sourcesContent":["import { dangerousStyleValue } from \"./dangerousStyleValue\";\nfunction setValueForStyles(node, styles) {\n const style = node.style;\n for (let styleName in styles) {\n const isCustomProperty = styleName.indexOf(\"--\") === 0;\n const styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);\n if (styleName === \"float\") {\n styleName = \"cssFloat\";\n }\n if (isCustomProperty) {\n style.setProperty(styleName, styleValue);\n } else {\n style[styleName] = styleValue;\n }\n }\n}\nexport {\n setValueForStyles\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,SAAS,kBAAkB,MAAM,QAAQ;CACvC,MAAM,QAAQ,KAAK;CACnB,KAAK,IAAI,aAAa,QAAQ;EAC5B,MAAM,mBAAmB,UAAU,QAAQ,IAAI,MAAM;EACrD,MAAM,aAAa,oBAAoB,WAAW,OAAO,YAAY,gBAAgB;EACrF,IAAI,cAAc,SAAS;GACzB,YAAY;EACd;EACA,IAAI,kBAAkB;GACpB,MAAM,YAAY,WAAW,UAAU;EACzC,OAAO;GACL,MAAM,aAAa;EACrB;CACF;AACF"}
|
|
@@ -1,64 +1,67 @@
|
|
|
1
1
|
const unitlessNumbers = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
scaleZ: true,
|
|
51
|
-
// RN properties
|
|
52
|
-
shadowOpacity: true
|
|
2
|
+
animationIterationCount: true,
|
|
3
|
+
aspectRatio: true,
|
|
4
|
+
borderImageOutset: true,
|
|
5
|
+
borderImageSlice: true,
|
|
6
|
+
borderImageWidth: true,
|
|
7
|
+
boxFlex: true,
|
|
8
|
+
boxFlexGroup: true,
|
|
9
|
+
boxOrdinalGroup: true,
|
|
10
|
+
columnCount: true,
|
|
11
|
+
flex: true,
|
|
12
|
+
flexGrow: true,
|
|
13
|
+
flexOrder: true,
|
|
14
|
+
flexPositive: true,
|
|
15
|
+
flexShrink: true,
|
|
16
|
+
flexNegative: true,
|
|
17
|
+
fontWeight: true,
|
|
18
|
+
gap: true,
|
|
19
|
+
columnGap: true,
|
|
20
|
+
rowGap: true,
|
|
21
|
+
gridRow: true,
|
|
22
|
+
gridRowEnd: true,
|
|
23
|
+
gridRowGap: true,
|
|
24
|
+
gridRowStart: true,
|
|
25
|
+
gridColumn: true,
|
|
26
|
+
gridColumnEnd: true,
|
|
27
|
+
gridColumnGap: true,
|
|
28
|
+
gridColumnStart: true,
|
|
29
|
+
lineClamp: true,
|
|
30
|
+
opacity: true,
|
|
31
|
+
order: true,
|
|
32
|
+
orphans: true,
|
|
33
|
+
tabSize: true,
|
|
34
|
+
widows: true,
|
|
35
|
+
zIndex: true,
|
|
36
|
+
zoom: true,
|
|
37
|
+
fillOpacity: true,
|
|
38
|
+
floodOpacity: true,
|
|
39
|
+
stopOpacity: true,
|
|
40
|
+
strokeDasharray: true,
|
|
41
|
+
strokeDashoffset: true,
|
|
42
|
+
strokeMiterlimit: true,
|
|
43
|
+
strokeOpacity: true,
|
|
44
|
+
strokeWidth: true,
|
|
45
|
+
scale: true,
|
|
46
|
+
scaleX: true,
|
|
47
|
+
scaleY: true,
|
|
48
|
+
scaleZ: true,
|
|
49
|
+
shadowOpacity: true
|
|
53
50
|
};
|
|
54
|
-
const prefixes = [
|
|
51
|
+
const prefixes = [
|
|
52
|
+
"ms",
|
|
53
|
+
"Moz",
|
|
54
|
+
"O",
|
|
55
|
+
"Webkit"
|
|
56
|
+
];
|
|
55
57
|
const prefixKey = (prefix, key) => {
|
|
56
|
-
|
|
58
|
+
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
|
57
59
|
};
|
|
58
|
-
Object.keys(unitlessNumbers).forEach(prop => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
Object.keys(unitlessNumbers).forEach((prop) => {
|
|
61
|
+
prefixes.forEach((prefix) => {
|
|
62
|
+
unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop];
|
|
63
|
+
});
|
|
62
64
|
});
|
|
65
|
+
|
|
63
66
|
export { unitlessNumbers };
|
|
64
67
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["esm/modules/unitlessNumbers/index.js"],"sourcesContent":["const unitlessNumbers = {\n animationIterationCount: true,\n aspectRatio: true,\n borderImageOutset: true,\n borderImageSlice: true,\n borderImageWidth: true,\n boxFlex: true,\n boxFlexGroup: true,\n boxOrdinalGroup: true,\n columnCount: true,\n flex: true,\n flexGrow: true,\n flexOrder: true,\n flexPositive: true,\n flexShrink: true,\n flexNegative: true,\n fontWeight: true,\n gap: true,\n columnGap: true,\n rowGap: true,\n gridRow: true,\n gridRowEnd: true,\n gridRowGap: true,\n gridRowStart: true,\n gridColumn: true,\n gridColumnEnd: true,\n gridColumnGap: true,\n gridColumnStart: true,\n lineClamp: true,\n opacity: true,\n order: true,\n orphans: true,\n tabSize: true,\n widows: true,\n zIndex: true,\n zoom: true,\n // SVG-related\n fillOpacity: true,\n floodOpacity: true,\n stopOpacity: true,\n strokeDasharray: true,\n strokeDashoffset: true,\n strokeMiterlimit: true,\n strokeOpacity: true,\n strokeWidth: true,\n // transform types\n scale: true,\n scaleX: true,\n scaleY: true,\n scaleZ: true,\n // RN properties\n shadowOpacity: true\n};\nconst prefixes = [\"ms\", \"Moz\", \"O\", \"Webkit\"];\nconst prefixKey = (prefix, key) => {\n return prefix + key.charAt(0).toUpperCase() + key.substring(1);\n};\nObject.keys(unitlessNumbers).forEach((prop) => {\n prefixes.forEach((prefix) => {\n unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop];\n });\n});\nexport {\n unitlessNumbers\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";AAAA,MAAM,kBAAkB;CACtB,yBAAyB;CACzB,aAAa;CACb,mBAAmB;CACnB,kBAAkB;CAClB,kBAAkB;CAClB,SAAS;CACT,cAAc;CACd,iBAAiB;CACjB,aAAa;CACb,MAAM;CACN,UAAU;CACV,WAAW;CACX,cAAc;CACd,YAAY;CACZ,cAAc;CACd,YAAY;CACZ,KAAK;CACL,WAAW;CACX,QAAQ;CACR,SAAS;CACT,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,YAAY;CACZ,eAAe;CACf,eAAe;CACf,iBAAiB;CACjB,WAAW;CACX,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,MAAM;CAEN,aAAa;CACb,cAAc;CACd,aAAa;CACb,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,eAAe;CACf,aAAa;CAEb,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,QAAQ;CAER,eAAe;AACjB;AACA,MAAM,WAAW;CAAC;CAAM;CAAO;CAAK;AAAQ;AAC5C,MAAM,aAAa,QAAQ,QAAQ;CACjC,OAAO,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,UAAU,CAAC;AAC/D;AACA,OAAO,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS;CAC7C,SAAS,SAAS,WAAW;EAC3B,gBAAgB,UAAU,QAAQ,IAAI,KAAK,gBAAgB;CAC7D,CAAC;AACH,CAAC"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { enable, useElementLayout as
|
|
1
|
+
import { enable, useElementLayout as useElementLayout$1 } from "@tamagui/use-element-layout";
|
|
2
2
|
import { useEffect, useMemo } from "react";
|
|
3
|
+
|
|
3
4
|
function useElementLayout(ref, onLayout) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
enable();
|
|
15
|
-
}, []);
|
|
16
|
-
return useTamaguiElementLayout(wrappedRef, onLayout);
|
|
5
|
+
const wrappedRef = useMemo(() => {
|
|
6
|
+
return { current: { get host() {
|
|
7
|
+
return ref.current;
|
|
8
|
+
} } };
|
|
9
|
+
}, [ref]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
enable();
|
|
12
|
+
}, []);
|
|
13
|
+
return useElementLayout$1(wrappedRef, onLayout);
|
|
17
14
|
}
|
|
15
|
+
|
|
18
16
|
export { useElementLayout };
|
|
19
17
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["useTamaguiElementLayout"],"sources":["esm/modules/useElementLayout/index.js"],"sourcesContent":["import {\n enable,\n useElementLayout as useTamaguiElementLayout\n} from \"@tamagui/use-element-layout\";\nimport { useEffect, useMemo } from \"react\";\nfunction useElementLayout(ref, onLayout) {\n const wrappedRef = useMemo(() => {\n return {\n current: {\n get host() {\n return ref.current;\n }\n }\n };\n }, [ref]);\n useEffect(() => {\n enable();\n }, []);\n return useTamaguiElementLayout(wrappedRef, onLayout);\n}\nexport {\n useElementLayout\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AAKA,SAAS,iBAAiB,KAAK,UAAU;CACvC,MAAM,aAAa,cAAc;EAC/B,OAAO,EACL,SAAS,EACP,IAAI,OAAO;GACT,OAAO,IAAI;EACb,EACF,EACF;CACF,GAAG,CAAC,GAAG,CAAC;CACR,gBAAgB;EACd,OAAO;CACT,GAAG,CAAC,CAAC;CACL,OAAOA,mBAAwB,YAAY,QAAQ;AACrD"}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { createEventHandle } from "../createEventHandle/index.mjs";
|
|
2
|
-
import { useLayoutEffectImpl
|
|
2
|
+
import { useLayoutEffectImpl } from "../useLayoutEffect/index.mjs";
|
|
3
3
|
import { useStable } from "../useStable/index.mjs";
|
|
4
|
+
|
|
4
5
|
function useEvent(event, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
const targetListeners = useStable(() => /* @__PURE__ */ new Map());
|
|
7
|
+
const addListener = useStable(() => {
|
|
8
|
+
const addEventListener = createEventHandle(event, options);
|
|
9
|
+
return (target, callback) => {
|
|
10
|
+
const removeTargetListener = targetListeners.get(target);
|
|
11
|
+
if (removeTargetListener != null) {
|
|
12
|
+
removeTargetListener();
|
|
13
|
+
}
|
|
14
|
+
if (callback == null) {
|
|
15
|
+
targetListeners.delete(target);
|
|
16
|
+
}
|
|
17
|
+
const removeEventListener = addEventListener(target, callback);
|
|
18
|
+
targetListeners.set(target, removeEventListener);
|
|
19
|
+
return removeEventListener;
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
useLayoutEffectImpl(() => {
|
|
23
|
+
return () => {
|
|
24
|
+
targetListeners.forEach((removeListener) => {
|
|
25
|
+
removeListener();
|
|
26
|
+
});
|
|
27
|
+
targetListeners.clear();
|
|
28
|
+
};
|
|
29
|
+
}, [targetListeners]);
|
|
30
|
+
return addListener;
|
|
30
31
|
}
|
|
32
|
+
|
|
31
33
|
export { useEvent };
|
|
32
34
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["esm/modules/useEvent/index.js"],"sourcesContent":["import { createEventHandle } from \"../createEventHandle/index\";\nimport { useLayoutEffectImpl as useLayoutEffect } from \"../useLayoutEffect/index\";\nimport { useStable } from \"../useStable/index\";\nfunction useEvent(event, options) {\n const targetListeners = useStable(() => /* @__PURE__ */ new Map());\n const addListener = useStable(() => {\n const addEventListener = createEventHandle(event, options);\n return (target, callback) => {\n const removeTargetListener = targetListeners.get(target);\n if (removeTargetListener != null) {\n removeTargetListener();\n }\n if (callback == null) {\n targetListeners.delete(target);\n }\n const removeEventListener = addEventListener(target, callback);\n targetListeners.set(target, removeEventListener);\n return removeEventListener;\n };\n });\n useLayoutEffect(() => {\n return () => {\n targetListeners.forEach((removeListener) => {\n removeListener();\n });\n targetListeners.clear();\n };\n }, [targetListeners]);\n return addListener;\n}\nexport {\n useEvent\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;AAGA,SAAS,SAAS,OAAO,SAAS;CAChC,MAAM,kBAAkB,gCAAgC,IAAI,IAAI,CAAC;CACjE,MAAM,cAAc,gBAAgB;EAClC,MAAM,mBAAmB,kBAAkB,OAAO,OAAO;EACzD,QAAQ,QAAQ,aAAa;GAC3B,MAAM,uBAAuB,gBAAgB,IAAI,MAAM;GACvD,IAAI,wBAAwB,MAAM;IAChC,qBAAqB;GACvB;GACA,IAAI,YAAY,MAAM;IACpB,gBAAgB,OAAO,MAAM;GAC/B;GACA,MAAM,sBAAsB,iBAAiB,QAAQ,QAAQ;GAC7D,gBAAgB,IAAI,QAAQ,mBAAmB;GAC/C,OAAO;EACT;CACF,CAAC;CACD,0BAAsB;EACpB,aAAa;GACX,gBAAgB,SAAS,mBAAmB;IAC1C,eAAe;GACjB,CAAC;GACD,gBAAgB,MAAM;EACxB;CACF,GAAG,CAAC,eAAe,CAAC;CACpB,OAAO;AACT"}
|
|
@@ -1,115 +1,115 @@
|
|
|
1
1
|
import { getModality } from "../modality/index.mjs";
|
|
2
2
|
import { useEvent } from "../useEvent/index.mjs";
|
|
3
|
-
import { useLayoutEffectImpl
|
|
3
|
+
import { useLayoutEffectImpl } from "../useLayoutEffect/index.mjs";
|
|
4
|
+
|
|
4
5
|
const emptyObject = {};
|
|
5
|
-
const opts = {
|
|
6
|
-
passive: true
|
|
7
|
-
};
|
|
6
|
+
const opts = { passive: true };
|
|
8
7
|
const lockEventType = "react-gui:hover:lock";
|
|
9
8
|
const unlockEventType = "react-gui:hover:unlock";
|
|
10
9
|
const supportsPointerEvent = () => !!(typeof window !== "undefined" && window.PointerEvent != null);
|
|
11
10
|
function dispatchCustomEvent(target, type, payload) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
detail
|
|
17
|
-
} = payload || emptyObject;
|
|
18
|
-
event.initCustomEvent(type, bubbles, cancelable, detail);
|
|
19
|
-
target.dispatchEvent(event);
|
|
11
|
+
const event = document.createEvent("CustomEvent");
|
|
12
|
+
const { bubbles = true, cancelable = true, detail } = payload || emptyObject;
|
|
13
|
+
event.initCustomEvent(type, bubbles, cancelable, detail);
|
|
14
|
+
target.dispatchEvent(event);
|
|
20
15
|
}
|
|
21
16
|
function getPointerType(event) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} = event;
|
|
25
|
-
return pointerType != null ? pointerType : getModality();
|
|
17
|
+
const { pointerType } = event;
|
|
18
|
+
return pointerType != null ? pointerType : getModality();
|
|
26
19
|
}
|
|
27
20
|
function useHover(targetRef, config) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
21
|
+
const { contain, disabled, onHoverStart, onHoverChange, onHoverUpdate, onHoverEnd } = config;
|
|
22
|
+
const canUsePE = supportsPointerEvent();
|
|
23
|
+
const addMoveListener = useEvent(canUsePE ? "pointermove" : "mousemove", opts);
|
|
24
|
+
const addEnterListener = useEvent(canUsePE ? "pointerenter" : "mouseenter", opts);
|
|
25
|
+
const addLeaveListener = useEvent(canUsePE ? "pointerleave" : "mouseleave", opts);
|
|
26
|
+
const addLockListener = useEvent(lockEventType, opts);
|
|
27
|
+
const addUnlockListener = useEvent(unlockEventType, opts);
|
|
28
|
+
useLayoutEffectImpl(() => {
|
|
29
|
+
const target = targetRef.current;
|
|
30
|
+
if (target !== null) {
|
|
31
|
+
const hoverEnd = function(e) {
|
|
32
|
+
if (onHoverEnd != null) {
|
|
33
|
+
onHoverEnd(e);
|
|
34
|
+
}
|
|
35
|
+
if (onHoverChange != null) {
|
|
36
|
+
onHoverChange(false);
|
|
37
|
+
}
|
|
38
|
+
addMoveListener(target, null);
|
|
39
|
+
addLeaveListener(target, null);
|
|
40
|
+
};
|
|
41
|
+
const leaveListener = function(e) {
|
|
42
|
+
const target2 = targetRef.current;
|
|
43
|
+
if (target2 != null && getPointerType(e) !== "touch") {
|
|
44
|
+
if (contain) {
|
|
45
|
+
dispatchCustomEvent(target2, unlockEventType);
|
|
46
|
+
}
|
|
47
|
+
hoverEnd(e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const moveListener = function(e) {
|
|
51
|
+
if (getPointerType(e) !== "touch") {
|
|
52
|
+
if (onHoverUpdate != null) {
|
|
53
|
+
if (e.x == null) {
|
|
54
|
+
e.x = e.clientX;
|
|
55
|
+
}
|
|
56
|
+
if (e.y == null) {
|
|
57
|
+
e.y = e.clientY;
|
|
58
|
+
}
|
|
59
|
+
onHoverUpdate(e);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const hoverStart = function(e) {
|
|
64
|
+
if (onHoverStart != null) {
|
|
65
|
+
onHoverStart(e);
|
|
66
|
+
}
|
|
67
|
+
if (onHoverChange != null) {
|
|
68
|
+
onHoverChange(true);
|
|
69
|
+
}
|
|
70
|
+
if (onHoverUpdate != null) {
|
|
71
|
+
addMoveListener(target, !disabled ? moveListener : null);
|
|
72
|
+
}
|
|
73
|
+
addLeaveListener(target, !disabled ? leaveListener : null);
|
|
74
|
+
};
|
|
75
|
+
const enterListener = function(e) {
|
|
76
|
+
const target2 = targetRef.current;
|
|
77
|
+
if (target2 != null && getPointerType(e) !== "touch") {
|
|
78
|
+
if (contain) {
|
|
79
|
+
dispatchCustomEvent(target2, lockEventType);
|
|
80
|
+
}
|
|
81
|
+
hoverStart(e);
|
|
82
|
+
const lockListener = function(lockEvent) {
|
|
83
|
+
if (lockEvent.target !== target2) {
|
|
84
|
+
hoverEnd(e);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const unlockListener = function(lockEvent) {
|
|
88
|
+
if (lockEvent.target !== target2) {
|
|
89
|
+
hoverStart(e);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
addLockListener(target2, !disabled ? lockListener : null);
|
|
93
|
+
addUnlockListener(target2, !disabled ? unlockListener : null);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
addEnterListener(target, !disabled ? enterListener : null);
|
|
97
|
+
}
|
|
98
|
+
}, [
|
|
99
|
+
addEnterListener,
|
|
100
|
+
addMoveListener,
|
|
101
|
+
addLeaveListener,
|
|
102
|
+
addLockListener,
|
|
103
|
+
addUnlockListener,
|
|
104
|
+
contain,
|
|
105
|
+
disabled,
|
|
106
|
+
onHoverStart,
|
|
107
|
+
onHoverChange,
|
|
108
|
+
onHoverUpdate,
|
|
109
|
+
onHoverEnd,
|
|
110
|
+
targetRef
|
|
111
|
+
]);
|
|
113
112
|
}
|
|
113
|
+
|
|
114
114
|
export { useHover };
|
|
115
115
|
//# sourceMappingURL=index.mjs.map
|