@hanzogui/react-native-web-internals 2.0.0-rc.41-hanzoai.5
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/LICENSE +21 -0
- package/dist/cjs/StyleSheet/__tests__/compiler-createReactDOMStyle-test.cjs +265 -0
- package/dist/cjs/StyleSheet/__tests__/compiler-test.cjs +419 -0
- package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.cjs +160 -0
- package/dist/cjs/StyleSheet/__tests__/index-test.cjs +436 -0
- package/dist/cjs/StyleSheet/__tests__/preprocess-test.cjs +121 -0
- package/dist/cjs/StyleSheet/__tests__/validate-test.cjs +51 -0
- package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.cjs +160 -0
- package/dist/cjs/StyleSheet/compiler/hash.cjs +28 -0
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +40 -0
- package/dist/cjs/StyleSheet/compiler/index.cjs +379 -0
- package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +36 -0
- package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.cjs +50 -0
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +52 -0
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +52 -0
- package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.cjs +135 -0
- package/dist/cjs/StyleSheet/dom/index.cjs +89 -0
- package/dist/cjs/StyleSheet/index.cjs +64 -0
- package/dist/cjs/StyleSheet/preprocess.cjs +114 -0
- package/dist/cjs/StyleSheet/validate.cjs +92 -0
- package/dist/cjs/TextAncestorContext.cjs +29 -0
- package/dist/cjs/colorProps.cjs +39 -0
- package/dist/cjs/index.cjs +105 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.cjs +57 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.cjs +46 -0
- package/dist/cjs/modules/AccessibilityUtil/index.cjs +35 -0
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +28 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +64 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +51 -0
- package/dist/cjs/modules/AssetRegistry/index.cjs +35 -0
- package/dist/cjs/modules/ImageLoader/index.cjs +157 -0
- package/dist/cjs/modules/InteractionManager.cjs +240 -0
- package/dist/cjs/modules/Platform/__tests__/index-test.cjs +56 -0
- package/dist/cjs/modules/Platform/index.cjs +32 -0
- package/dist/cjs/modules/TextInputState/index.cjs +70 -0
- package/dist/cjs/modules/UIManager/__tests__/index-test.cjs +111 -0
- package/dist/cjs/modules/UIManager/index.cjs +65 -0
- package/dist/cjs/modules/canUseDOM.cjs +28 -0
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +177 -0
- package/dist/cjs/modules/createDOMProps/index.cjs +387 -0
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +422 -0
- package/dist/cjs/modules/createEventHandle/index.cjs +88 -0
- package/dist/cjs/modules/dismissKeyboard/index.cjs +31 -0
- package/dist/cjs/modules/forwardedProps/index.cjs +163 -0
- package/dist/cjs/modules/getBoundingClientRect/index.cjs +35 -0
- package/dist/cjs/modules/invariant.cjs +42 -0
- package/dist/cjs/modules/isSelectionValid/index.cjs +36 -0
- package/dist/cjs/modules/isWebColor/index.cjs +28 -0
- package/dist/cjs/modules/mergeRefs/__tests__/index-test.cjs +48 -0
- package/dist/cjs/modules/mergeRefs/index.cjs +45 -0
- package/dist/cjs/modules/modality/__tests__/index-test.cjs +59 -0
- package/dist/cjs/modules/modality/index.cjs +212 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.cjs +38 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +41 -0
- package/dist/cjs/modules/normalizeColor/index.cjs +44 -0
- package/dist/cjs/modules/pick/index.cjs +38 -0
- package/dist/cjs/modules/processColor/__tests__/index-test.cjs +85 -0
- package/dist/cjs/modules/processColor/index.cjs +50 -0
- package/dist/cjs/modules/requestIdleCallback/index.cjs +46 -0
- package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.cjs +55 -0
- package/dist/cjs/modules/setValueForStyles/index.cjs +46 -0
- package/dist/cjs/modules/unitlessNumbers/index.cjs +89 -0
- package/dist/cjs/modules/useElementLayout/index.cjs +44 -0
- package/dist/cjs/modules/useEvent/__tests__/index-test.cjs +490 -0
- package/dist/cjs/modules/useEvent/index.cjs +57 -0
- package/dist/cjs/modules/useHover/__tests__/index-test.cjs +382 -0
- package/dist/cjs/modules/useHover/index.cjs +140 -0
- package/dist/cjs/modules/useLayoutEffect/index.cjs +41 -0
- package/dist/cjs/modules/useLocale/index.cjs +69 -0
- package/dist/cjs/modules/useLocale/isLocaleRTL.cjs +88 -0
- package/dist/cjs/modules/useMergeRefs/__tests__/index-test.cjs +125 -0
- package/dist/cjs/modules/useMergeRefs/index.cjs +45 -0
- package/dist/cjs/modules/usePlatformMethods/index.cjs +42 -0
- package/dist/cjs/modules/useStable/__tests__/index-test.cjs +122 -0
- package/dist/cjs/modules/useStable/index.cjs +47 -0
- package/dist/cjs/styleTypes.cjs +18 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs +242 -0
- package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/compiler-test.mjs +420 -0
- package/dist/esm/StyleSheet/__tests__/compiler-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs +137 -0
- package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/index-test.mjs +413 -0
- package/dist/esm/StyleSheet/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs +122 -0
- package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/validate-test.mjs +52 -0
- package/dist/esm/StyleSheet/__tests__/validate-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs +134 -0
- package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/hash.mjs +3 -0
- package/dist/esm/StyleSheet/compiler/hash.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs +15 -0
- package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/index.mjs +351 -0
- package/dist/esm/StyleSheet/compiler/index.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +11 -0
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs +25 -0
- package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs +27 -0
- package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs.map +1 -0
- package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs +27 -0
- package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs.map +1 -0
- package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs +110 -0
- package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs.map +1 -0
- package/dist/esm/StyleSheet/dom/index.mjs +64 -0
- package/dist/esm/StyleSheet/dom/index.mjs.map +1 -0
- package/dist/esm/StyleSheet/index.mjs +38 -0
- package/dist/esm/StyleSheet/index.mjs.map +1 -0
- package/dist/esm/StyleSheet/preprocess.mjs +86 -0
- package/dist/esm/StyleSheet/preprocess.mjs.map +1 -0
- package/dist/esm/StyleSheet/validate.mjs +67 -0
- package/dist/esm/StyleSheet/validate.mjs.map +1 -0
- package/dist/esm/TextAncestorContext.mjs +4 -0
- package/dist/esm/TextAncestorContext.mjs.map +1 -0
- package/dist/esm/colorProps.mjs +14 -0
- package/dist/esm/colorProps.mjs.map +1 -0
- package/dist/esm/index.js +45 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +45 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs +34 -0
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs +23 -0
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/index.mjs +10 -0
- package/dist/esm/modules/AccessibilityUtil/index.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs +3 -0
- package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs +39 -0
- package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs +26 -0
- package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs.map +1 -0
- package/dist/esm/modules/AssetRegistry/index.mjs +9 -0
- package/dist/esm/modules/AssetRegistry/index.mjs.map +1 -0
- package/dist/esm/modules/ImageLoader/index.mjs +131 -0
- package/dist/esm/modules/ImageLoader/index.mjs.map +1 -0
- package/dist/esm/modules/InteractionManager.mjs +215 -0
- package/dist/esm/modules/InteractionManager.mjs.map +1 -0
- package/dist/esm/modules/Platform/__tests__/index-test.mjs +33 -0
- package/dist/esm/modules/Platform/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/Platform/index.mjs +7 -0
- package/dist/esm/modules/Platform/index.mjs.map +1 -0
- package/dist/esm/modules/TextInputState/index.mjs +45 -0
- package/dist/esm/modules/TextInputState/index.mjs.map +1 -0
- package/dist/esm/modules/UIManager/__tests__/index-test.mjs +88 -0
- package/dist/esm/modules/UIManager/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/UIManager/index.mjs +40 -0
- package/dist/esm/modules/UIManager/index.mjs.map +1 -0
- package/dist/esm/modules/canUseDOM.mjs +3 -0
- package/dist/esm/modules/canUseDOM.mjs.map +1 -0
- package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs +154 -0
- package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/createDOMProps/index.mjs +361 -0
- package/dist/esm/modules/createDOMProps/index.mjs.map +1 -0
- package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs +399 -0
- package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/createEventHandle/index.mjs +61 -0
- package/dist/esm/modules/createEventHandle/index.mjs.map +1 -0
- package/dist/esm/modules/dismissKeyboard/index.mjs +6 -0
- package/dist/esm/modules/dismissKeyboard/index.mjs.map +1 -0
- package/dist/esm/modules/forwardedProps/index.mjs +128 -0
- package/dist/esm/modules/forwardedProps/index.mjs.map +1 -0
- package/dist/esm/modules/getBoundingClientRect/index.mjs +10 -0
- package/dist/esm/modules/getBoundingClientRect/index.mjs.map +1 -0
- package/dist/esm/modules/invariant.mjs +16 -0
- package/dist/esm/modules/invariant.mjs.map +1 -0
- package/dist/esm/modules/isSelectionValid/index.mjs +11 -0
- package/dist/esm/modules/isSelectionValid/index.mjs.map +1 -0
- package/dist/esm/modules/isWebColor/index.mjs +3 -0
- package/dist/esm/modules/isWebColor/index.mjs.map +1 -0
- package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs +25 -0
- package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/mergeRefs/index.mjs +20 -0
- package/dist/esm/modules/mergeRefs/index.mjs.map +1 -0
- package/dist/esm/modules/modality/__tests__/index-test.mjs +60 -0
- package/dist/esm/modules/modality/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/modality/index.mjs +184 -0
- package/dist/esm/modules/modality/index.mjs.map +1 -0
- package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs +15 -0
- package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/multiplyStyleLengthValue/index.mjs +16 -0
- package/dist/esm/modules/multiplyStyleLengthValue/index.mjs.map +1 -0
- package/dist/esm/modules/normalizeColor/index.mjs +19 -0
- package/dist/esm/modules/normalizeColor/index.mjs.map +1 -0
- package/dist/esm/modules/pick/index.mjs +13 -0
- package/dist/esm/modules/pick/index.mjs.map +1 -0
- package/dist/esm/modules/processColor/__tests__/index-test.mjs +62 -0
- package/dist/esm/modules/processColor/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/processColor/index.mjs +14 -0
- package/dist/esm/modules/processColor/index.mjs.map +1 -0
- package/dist/esm/modules/requestIdleCallback/index.mjs +20 -0
- package/dist/esm/modules/requestIdleCallback/index.mjs.map +1 -0
- package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs +30 -0
- package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs.map +1 -0
- package/dist/esm/modules/setValueForStyles/index.mjs +21 -0
- package/dist/esm/modules/setValueForStyles/index.mjs.map +1 -0
- package/dist/esm/modules/unitlessNumbers/index.mjs +64 -0
- package/dist/esm/modules/unitlessNumbers/index.mjs.map +1 -0
- package/dist/esm/modules/useElementLayout/index.mjs +19 -0
- package/dist/esm/modules/useElementLayout/index.mjs.map +1 -0
- package/dist/esm/modules/useEvent/__tests__/index-test.mjs +467 -0
- package/dist/esm/modules/useEvent/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useEvent/index.mjs +32 -0
- package/dist/esm/modules/useEvent/index.mjs.map +1 -0
- package/dist/esm/modules/useHover/__tests__/index-test.mjs +359 -0
- package/dist/esm/modules/useHover/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useHover/index.mjs +115 -0
- package/dist/esm/modules/useHover/index.mjs.map +1 -0
- package/dist/esm/modules/useLayoutEffect/index.mjs +5 -0
- package/dist/esm/modules/useLayoutEffect/index.mjs.map +1 -0
- package/dist/esm/modules/useLocale/index.mjs +31 -0
- package/dist/esm/modules/useLocale/index.mjs.map +1 -0
- package/dist/esm/modules/useLocale/isLocaleRTL.mjs +63 -0
- package/dist/esm/modules/useLocale/isLocaleRTL.mjs.map +1 -0
- package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs +102 -0
- package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useMergeRefs/index.mjs +9 -0
- package/dist/esm/modules/useMergeRefs/index.mjs.map +1 -0
- package/dist/esm/modules/usePlatformMethods/index.mjs +17 -0
- package/dist/esm/modules/usePlatformMethods/index.mjs.map +1 -0
- package/dist/esm/modules/useStable/__tests__/index-test.mjs +99 -0
- package/dist/esm/modules/useStable/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useStable/index.mjs +11 -0
- package/dist/esm/modules/useStable/index.mjs.map +1 -0
- package/dist/esm/styleTypes.mjs +2 -0
- package/dist/esm/styleTypes.mjs.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/package.json +58 -0
- package/src/StyleSheet/__tests__/compiler-createReactDOMStyle-test.tsx +236 -0
- package/src/StyleSheet/__tests__/compiler-test.tsx +426 -0
- package/src/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.tsx +169 -0
- package/src/StyleSheet/__tests__/index-test.tsx +406 -0
- package/src/StyleSheet/__tests__/preprocess-test.tsx +107 -0
- package/src/StyleSheet/__tests__/validate-test.tsx +42 -0
- package/src/StyleSheet/compiler/createReactDOMStyle.tsx +215 -0
- package/src/StyleSheet/compiler/hash.tsx +1 -0
- package/src/StyleSheet/compiler/hyphenateStyleName.tsx +25 -0
- package/src/StyleSheet/compiler/index.tsx +478 -0
- package/src/StyleSheet/compiler/normalizeColor.tsx +35 -0
- package/src/StyleSheet/compiler/normalizeValueWithProperty.tsx +34 -0
- package/src/StyleSheet/compiler/resolveShadowValue.tsx +26 -0
- package/src/StyleSheet/dom/createCSSStyleSheet.tsx +42 -0
- package/src/StyleSheet/dom/createOrderedCSSStyleSheet.tsx +195 -0
- package/src/StyleSheet/dom/index.tsx +92 -0
- package/src/StyleSheet/index.tsx +99 -0
- package/src/StyleSheet/preprocess.tsx +119 -0
- package/src/StyleSheet/validate.tsx +90 -0
- package/src/TextAncestorContext.tsx +13 -0
- package/src/colorProps.tsx +12 -0
- package/src/index.tsx +58 -0
- package/src/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.tsx +44 -0
- package/src/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.tsx +25 -0
- package/src/modules/AccessibilityUtil/index.tsx +18 -0
- package/src/modules/AccessibilityUtil/isDisabled.tsx +13 -0
- package/src/modules/AccessibilityUtil/propsToAccessibilityComponent.tsx +54 -0
- package/src/modules/AccessibilityUtil/propsToAriaRole.tsx +37 -0
- package/src/modules/AssetRegistry/index.tsx +32 -0
- package/src/modules/ImageLoader/index.tsx +165 -0
- package/src/modules/InteractionManager.tsx +315 -0
- package/src/modules/Platform/__tests__/index-test.tsx +45 -0
- package/src/modules/Platform/index.tsx +15 -0
- package/src/modules/TextInputState/index.tsx +62 -0
- package/src/modules/UIManager/__tests__/index-test.tsx +87 -0
- package/src/modules/UIManager/index.tsx +68 -0
- package/src/modules/canUseDOM.tsx +14 -0
- package/src/modules/createDOMProps/__tests__/index-test.tsx +138 -0
- package/src/modules/createDOMProps/index.tsx +436 -0
- package/src/modules/createEventHandle/__tests__/index-test.tsx +459 -0
- package/src/modules/createEventHandle/index.tsx +100 -0
- package/src/modules/dismissKeyboard/index.tsx +14 -0
- package/src/modules/forwardedProps/index.tsx +145 -0
- package/src/modules/getBoundingClientRect/index.tsx +17 -0
- package/src/modules/invariant.ts +23 -0
- package/src/modules/isSelectionValid/index.tsx +20 -0
- package/src/modules/isWebColor/index.tsx +14 -0
- package/src/modules/mergeRefs/__tests__/index-test.tsx +32 -0
- package/src/modules/mergeRefs/index.tsx +36 -0
- package/src/modules/modality/__tests__/index-test.tsx +66 -0
- package/src/modules/modality/index.tsx +228 -0
- package/src/modules/multiplyStyleLengthValue/__tests__/index-test.tsx +23 -0
- package/src/modules/multiplyStyleLengthValue/index.tsx +26 -0
- package/src/modules/normalizeColor/index.tsx +32 -0
- package/src/modules/pick/index.tsx +25 -0
- package/src/modules/processColor/__tests__/index-test.tsx +78 -0
- package/src/modules/processColor/index.tsx +28 -0
- package/src/modules/requestIdleCallback/index.tsx +35 -0
- package/src/modules/setValueForStyles/dangerousStyleValue.tsx +74 -0
- package/src/modules/setValueForStyles/index.tsx +39 -0
- package/src/modules/unitlessNumbers/index.tsx +77 -0
- package/src/modules/useElementLayout/index.tsx +28 -0
- package/src/modules/useEvent/__tests__/index-test.tsx +511 -0
- package/src/modules/useEvent/index.tsx +64 -0
- package/src/modules/useHover/__tests__/index-test.tsx +342 -0
- package/src/modules/useHover/index.tsx +181 -0
- package/src/modules/useLayoutEffect/index.ts +15 -0
- package/src/modules/useLocale/index.tsx +57 -0
- package/src/modules/useLocale/isLocaleRTL.tsx +74 -0
- package/src/modules/useMergeRefs/__tests__/index-test.tsx +91 -0
- package/src/modules/useMergeRefs/index.tsx +22 -0
- package/src/modules/usePlatformMethods/index.tsx +40 -0
- package/src/modules/useStable/__tests__/index-test.tsx +101 -0
- package/src/modules/useStable/index.tsx +24 -0
- package/src/styleTypes.ts +321 -0
- package/src/types.ts +77 -0
- package/types/StyleSheet/compiler/createReactDOMStyle.d.ts +18 -0
- package/types/StyleSheet/compiler/createReactDOMStyle.d.ts.map +1 -0
- package/types/StyleSheet/compiler/hash.d.ts +2 -0
- package/types/StyleSheet/compiler/hash.d.ts.map +1 -0
- package/types/StyleSheet/compiler/hyphenateStyleName.d.ts +10 -0
- package/types/StyleSheet/compiler/hyphenateStyleName.d.ts.map +1 -0
- package/types/StyleSheet/compiler/index.d.ts +39 -0
- package/types/StyleSheet/compiler/index.d.ts.map +1 -0
- package/types/StyleSheet/compiler/normalizeColor.d.ts +10 -0
- package/types/StyleSheet/compiler/normalizeColor.d.ts.map +1 -0
- package/types/StyleSheet/compiler/normalizeValueWithProperty.d.ts +10 -0
- package/types/StyleSheet/compiler/normalizeValueWithProperty.d.ts.map +1 -0
- package/types/StyleSheet/compiler/resolveShadowValue.d.ts +10 -0
- package/types/StyleSheet/compiler/resolveShadowValue.d.ts.map +1 -0
- package/types/StyleSheet/dom/createCSSStyleSheet.d.ts +10 -0
- package/types/StyleSheet/dom/createCSSStyleSheet.d.ts.map +1 -0
- package/types/StyleSheet/dom/createOrderedCSSStyleSheet.d.ts +29 -0
- package/types/StyleSheet/dom/createOrderedCSSStyleSheet.d.ts.map +1 -0
- package/types/StyleSheet/dom/index.d.ts +15 -0
- package/types/StyleSheet/dom/index.d.ts.map +1 -0
- package/types/StyleSheet/index.d.ts +69 -0
- package/types/StyleSheet/index.d.ts.map +1 -0
- package/types/StyleSheet/preprocess.d.ts +16 -0
- package/types/StyleSheet/preprocess.d.ts.map +1 -0
- package/types/StyleSheet/validate.d.ts +10 -0
- package/types/StyleSheet/validate.d.ts.map +1 -0
- package/types/TextAncestorContext.d.ts +11 -0
- package/types/TextAncestorContext.d.ts.map +1 -0
- package/types/colorProps.d.ts +13 -0
- package/types/colorProps.d.ts.map +1 -0
- package/types/index.d.ts +45 -0
- package/types/index.d.ts.map +1 -0
- package/types/modules/AccessibilityUtil/index.d.ts +16 -0
- package/types/modules/AccessibilityUtil/index.d.ts.map +1 -0
- package/types/modules/AccessibilityUtil/isDisabled.d.ts +10 -0
- package/types/modules/AccessibilityUtil/isDisabled.d.ts.map +1 -0
- package/types/modules/AccessibilityUtil/propsToAccessibilityComponent.d.ts +10 -0
- package/types/modules/AccessibilityUtil/propsToAccessibilityComponent.d.ts.map +1 -0
- package/types/modules/AccessibilityUtil/propsToAriaRole.d.ts +12 -0
- package/types/modules/AccessibilityUtil/propsToAriaRole.d.ts.map +1 -0
- package/types/modules/AssetRegistry/index.d.ts +22 -0
- package/types/modules/AssetRegistry/index.d.ts.map +1 -0
- package/types/modules/ImageLoader/index.d.ts +27 -0
- package/types/modules/ImageLoader/index.d.ts.map +1 -0
- package/types/modules/InteractionManager.d.ts +48 -0
- package/types/modules/InteractionManager.d.ts.map +1 -0
- package/types/modules/Platform/index.d.ts +15 -0
- package/types/modules/Platform/index.d.ts.map +1 -0
- package/types/modules/TextInputState/index.d.ts +38 -0
- package/types/modules/TextInputState/index.d.ts.map +1 -0
- package/types/modules/UIManager/index.d.ts +23 -0
- package/types/modules/UIManager/index.d.ts.map +1 -0
- package/types/modules/canUseDOM.d.ts +10 -0
- package/types/modules/canUseDOM.d.ts.map +1 -0
- package/types/modules/createDOMProps/index.d.ts +12 -0
- package/types/modules/createDOMProps/index.d.ts.map +1 -0
- package/types/modules/createEventHandle/index.d.ts +20 -0
- package/types/modules/createEventHandle/index.d.ts.map +1 -0
- package/types/modules/dismissKeyboard/index.d.ts +10 -0
- package/types/modules/dismissKeyboard/index.d.ts.map +1 -0
- package/types/modules/forwardedProps/index.d.ts +383 -0
- package/types/modules/forwardedProps/index.d.ts.map +1 -0
- package/types/modules/getBoundingClientRect/index.d.ts +10 -0
- package/types/modules/getBoundingClientRect/index.d.ts.map +1 -0
- package/types/modules/invariant.d.ts +3 -0
- package/types/modules/invariant.d.ts.map +1 -0
- package/types/modules/isSelectionValid/index.d.ts +10 -0
- package/types/modules/isSelectionValid/index.d.ts.map +1 -0
- package/types/modules/isWebColor/index.d.ts +10 -0
- package/types/modules/isWebColor/index.d.ts.map +1 -0
- package/types/modules/mergeRefs/index.d.ts +11 -0
- package/types/modules/mergeRefs/index.d.ts.map +1 -0
- package/types/modules/modality/index.d.ts +17 -0
- package/types/modules/modality/index.d.ts.map +1 -0
- package/types/modules/multiplyStyleLengthValue/index.d.ts +10 -0
- package/types/modules/multiplyStyleLengthValue/index.d.ts.map +1 -0
- package/types/modules/normalizeColor/index.d.ts +10 -0
- package/types/modules/normalizeColor/index.d.ts.map +1 -0
- package/types/modules/pick/index.d.ts +12 -0
- package/types/modules/pick/index.d.ts.map +1 -0
- package/types/modules/processColor/index.d.ts +11 -0
- package/types/modules/processColor/index.d.ts.map +1 -0
- package/types/modules/requestIdleCallback/index.d.ts +3 -0
- package/types/modules/requestIdleCallback/index.d.ts.map +1 -0
- package/types/modules/setValueForStyles/dangerousStyleValue.d.ts +11 -0
- package/types/modules/setValueForStyles/dangerousStyleValue.d.ts.map +1 -0
- package/types/modules/setValueForStyles/index.d.ts +9 -0
- package/types/modules/setValueForStyles/index.d.ts.map +1 -0
- package/types/modules/unitlessNumbers/index.d.ts +60 -0
- package/types/modules/unitlessNumbers/index.d.ts.map +1 -0
- package/types/modules/useElementLayout/index.d.ts +4 -0
- package/types/modules/useElementLayout/index.d.ts.map +1 -0
- package/types/modules/useEvent/index.d.ts +24 -0
- package/types/modules/useEvent/index.d.ts.map +1 -0
- package/types/modules/useHover/index.d.ts +21 -0
- package/types/modules/useHover/index.d.ts.map +1 -0
- package/types/modules/useLayoutEffect/index.d.ts +13 -0
- package/types/modules/useLayoutEffect/index.d.ts.map +1 -0
- package/types/modules/useLocale/index.d.ts +14 -0
- package/types/modules/useLocale/index.d.ts.map +1 -0
- package/types/modules/useLocale/isLocaleRTL.d.ts +13 -0
- package/types/modules/useLocale/isLocaleRTL.d.ts.map +1 -0
- package/types/modules/useMergeRefs/index.d.ts +11 -0
- package/types/modules/useMergeRefs/index.d.ts.map +1 -0
- package/types/modules/usePlatformMethods/index.d.ts +18 -0
- package/types/modules/usePlatformMethods/index.d.ts.map +1 -0
- package/types/modules/useStable/index.d.ts +10 -0
- package/types/modules/useStable/index.d.ts.map +1 -0
- package/types/styleTypes.d.ts +211 -0
- package/types/styleTypes.d.ts.map +1 -0
- package/types/types.d.ts +46 -0
- package/types/types.d.ts.map +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { dangerousStyleValue } from "./dangerousStyleValue.mjs";
|
|
2
|
+
function setValueForStyles(node, styles) {
|
|
3
|
+
const style = node.style;
|
|
4
|
+
for (let styleName in styles) {
|
|
5
|
+
if (!styles.hasOwnProperty(styleName)) {
|
|
6
|
+
continue;
|
|
7
|
+
}
|
|
8
|
+
const isCustomProperty = styleName.indexOf("--") === 0;
|
|
9
|
+
const styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty);
|
|
10
|
+
if (styleName === "float") {
|
|
11
|
+
styleName = "cssFloat";
|
|
12
|
+
}
|
|
13
|
+
if (isCustomProperty) {
|
|
14
|
+
style.setProperty(styleName, styleValue);
|
|
15
|
+
} else {
|
|
16
|
+
style[styleName] = styleValue;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { setValueForStyles };
|
|
21
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["dangerousStyleValue","setValueForStyles","node","styles","style","styleName","hasOwnProperty","isCustomProperty","indexOf","styleValue","setProperty"],"sources":["../../../../src/modules/setValueForStyles/index.tsx"],"sourcesContent":[null],"mappings":"AAYA,SAASA,mBAAA,QAA2B;AAS7B,SAASC,kBAAkBC,IAAA,EAAMC,MAAA,EAAQ;EAC9C,MAAMC,KAAA,GAAQF,IAAA,CAAKE,KAAA;EACnB,SAASC,SAAA,IAAaF,MAAA,EAAQ;IAC5B,IAAI,CAACA,MAAA,CAAOG,cAAA,CAAeD,SAAS,GAAG;MACrC;IACF;IACA,MAAME,gBAAA,GAAmBF,SAAA,CAAUG,OAAA,CAAQ,IAAI,MAAM;IACrD,MAAMC,UAAA,GAAaT,mBAAA,CAAoBK,SAAA,EAAWF,MAAA,CAAOE,SAAS,GAAGE,gBAAgB;IACrF,IAAIF,SAAA,KAAc,SAAS;MACzBA,SAAA,GAAY;IACd;IACA,IAAIE,gBAAA,EAAkB;MACpBH,KAAA,CAAMM,WAAA,CAAYL,SAAA,EAAWI,UAAU;IACzC,OAAO;MACLL,KAAA,CAAMC,SAAS,IAAII,UAAA;IACrB;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const unitlessNumbers = {
|
|
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
|
+
// SVG-related
|
|
38
|
+
fillOpacity: true,
|
|
39
|
+
floodOpacity: true,
|
|
40
|
+
stopOpacity: true,
|
|
41
|
+
strokeDasharray: true,
|
|
42
|
+
strokeDashoffset: true,
|
|
43
|
+
strokeMiterlimit: true,
|
|
44
|
+
strokeOpacity: true,
|
|
45
|
+
strokeWidth: true,
|
|
46
|
+
// transform types
|
|
47
|
+
scale: true,
|
|
48
|
+
scaleX: true,
|
|
49
|
+
scaleY: true,
|
|
50
|
+
scaleZ: true,
|
|
51
|
+
// RN properties
|
|
52
|
+
shadowOpacity: true
|
|
53
|
+
};
|
|
54
|
+
const prefixes = ["ms", "Moz", "O", "Webkit"];
|
|
55
|
+
const prefixKey = (prefix, key) => {
|
|
56
|
+
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
|
57
|
+
};
|
|
58
|
+
Object.keys(unitlessNumbers).forEach(prop => {
|
|
59
|
+
prefixes.forEach(prefix => {
|
|
60
|
+
unitlessNumbers[prefixKey(prefix, prop)] = unitlessNumbers[prop];
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
export { unitlessNumbers };
|
|
64
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["unitlessNumbers","animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","flex","flexGrow","flexOrder","flexPositive","flexShrink","flexNegative","fontWeight","gap","columnGap","rowGap","gridRow","gridRowEnd","gridRowGap","gridRowStart","gridColumn","gridColumnEnd","gridColumnGap","gridColumnStart","lineClamp","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth","scale","scaleX","scaleY","scaleZ","shadowOpacity","prefixes","prefixKey","prefix","key","charAt","toUpperCase","substring","Object","keys","forEach","prop"],"sources":["../../../../src/modules/unitlessNumbers/index.tsx"],"sourcesContent":[null],"mappings":"AAUO,MAAMA,eAAA,GAAkB;EAC7BC,uBAAA,EAAyB;EACzBC,WAAA,EAAa;EACbC,iBAAA,EAAmB;EACnBC,gBAAA,EAAkB;EAClBC,gB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AAA,EAAQQ,IAAI,CAAC,IAAI3D,eAAA,CAAgB2D,IAAI;EACjE,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { enable, useElementLayout as useHanzoguiElementLayout } from "@hanzogui/use-element-layout";
|
|
2
|
+
import { useEffect, useMemo } from "react";
|
|
3
|
+
function useElementLayout(ref, onLayout) {
|
|
4
|
+
const wrappedRef = useMemo(() => {
|
|
5
|
+
return {
|
|
6
|
+
current: {
|
|
7
|
+
get host() {
|
|
8
|
+
return ref.current;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}, [ref]);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
enable();
|
|
15
|
+
}, []);
|
|
16
|
+
return useHanzoguiElementLayout(wrappedRef, onLayout);
|
|
17
|
+
}
|
|
18
|
+
export { useElementLayout };
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import { createEventTarget } from "dom-event-testing-library";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as ReactDOM from "react-dom";
|
|
4
|
+
import { act } from "react-dom/test-utils";
|
|
5
|
+
import useEvent from "../index.mjs";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function createRoot(rootNode) {
|
|
8
|
+
return {
|
|
9
|
+
render(element) {
|
|
10
|
+
ReactDOM.render(element, rootNode);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
describe("use-event", () => {
|
|
15
|
+
let root;
|
|
16
|
+
let rootNode;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
rootNode = document.createElement("div");
|
|
19
|
+
document.body.appendChild(rootNode);
|
|
20
|
+
root = createRoot(rootNode);
|
|
21
|
+
});
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
root.render(null);
|
|
24
|
+
document.body.removeChild(rootNode);
|
|
25
|
+
rootNode = null;
|
|
26
|
+
root = null;
|
|
27
|
+
});
|
|
28
|
+
describe("setListener()", () => {
|
|
29
|
+
test("event dispatched on target", () => {
|
|
30
|
+
const listener = jest.fn();
|
|
31
|
+
const targetRef = React.createRef();
|
|
32
|
+
function Component() {
|
|
33
|
+
const addClickListener = useEvent("click");
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
addClickListener(targetRef.current, listener);
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */jsx("div", {
|
|
38
|
+
ref: targetRef
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
act(() => {
|
|
42
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
43
|
+
});
|
|
44
|
+
const target = createEventTarget(targetRef.current);
|
|
45
|
+
act(() => {
|
|
46
|
+
target.click();
|
|
47
|
+
});
|
|
48
|
+
expect(listener).toBeCalledTimes(1);
|
|
49
|
+
});
|
|
50
|
+
test("event dispatched on parent", () => {
|
|
51
|
+
const listener = jest.fn();
|
|
52
|
+
const listenerCapture = jest.fn();
|
|
53
|
+
const targetRef = React.createRef();
|
|
54
|
+
const parentRef = React.createRef();
|
|
55
|
+
function Component() {
|
|
56
|
+
const addClickListener = useEvent("click");
|
|
57
|
+
const addClickCaptureListener = useEvent("click", {
|
|
58
|
+
capture: true
|
|
59
|
+
});
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
addClickListener(targetRef.current, listener);
|
|
62
|
+
addClickCaptureListener(targetRef.current, listenerCapture);
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */jsx("div", {
|
|
65
|
+
ref: parentRef,
|
|
66
|
+
children: /* @__PURE__ */jsx("div", {
|
|
67
|
+
ref: targetRef
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
act(() => {
|
|
72
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
73
|
+
});
|
|
74
|
+
const parent = createEventTarget(parentRef.current);
|
|
75
|
+
act(() => {
|
|
76
|
+
parent.click();
|
|
77
|
+
});
|
|
78
|
+
expect(listener).toBeCalledTimes(0);
|
|
79
|
+
expect(listenerCapture).toBeCalledTimes(0);
|
|
80
|
+
});
|
|
81
|
+
test("event dispatched on child", () => {
|
|
82
|
+
const log = [];
|
|
83
|
+
const listener = jest.fn(() => {
|
|
84
|
+
log.push("bubble");
|
|
85
|
+
});
|
|
86
|
+
const listenerCapture = jest.fn(() => {
|
|
87
|
+
log.push("capture");
|
|
88
|
+
});
|
|
89
|
+
const targetRef = React.createRef();
|
|
90
|
+
const childRef = React.createRef();
|
|
91
|
+
function Component() {
|
|
92
|
+
const addClickListener = useEvent("click");
|
|
93
|
+
const addClickCaptureListener = useEvent("click", {
|
|
94
|
+
capture: true
|
|
95
|
+
});
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
addClickListener(targetRef.current, listener);
|
|
98
|
+
addClickCaptureListener(targetRef.current, listenerCapture);
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */jsx("div", {
|
|
101
|
+
ref: targetRef,
|
|
102
|
+
children: /* @__PURE__ */jsx("div", {
|
|
103
|
+
ref: childRef
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
act(() => {
|
|
108
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
109
|
+
});
|
|
110
|
+
const child = createEventTarget(childRef.current);
|
|
111
|
+
act(() => {
|
|
112
|
+
child.click();
|
|
113
|
+
});
|
|
114
|
+
expect(listenerCapture).toBeCalledTimes(1);
|
|
115
|
+
expect(listener).toBeCalledTimes(1);
|
|
116
|
+
expect(log).toEqual(["capture", "bubble"]);
|
|
117
|
+
});
|
|
118
|
+
test("event dispatched on text node", () => {
|
|
119
|
+
const listener = jest.fn();
|
|
120
|
+
const targetRef = React.createRef();
|
|
121
|
+
const childRef = React.createRef();
|
|
122
|
+
function Component() {
|
|
123
|
+
const addClickListener = useEvent("click");
|
|
124
|
+
React.useEffect(() => {
|
|
125
|
+
addClickListener(targetRef.current, listener);
|
|
126
|
+
});
|
|
127
|
+
return /* @__PURE__ */jsx("div", {
|
|
128
|
+
ref: targetRef,
|
|
129
|
+
children: /* @__PURE__ */jsx("div", {
|
|
130
|
+
ref: childRef,
|
|
131
|
+
children: "text"
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
act(() => {
|
|
136
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
137
|
+
});
|
|
138
|
+
const text = createEventTarget(childRef.current.firstChild);
|
|
139
|
+
act(() => {
|
|
140
|
+
text.click();
|
|
141
|
+
});
|
|
142
|
+
expect(listener).toBeCalledTimes(1);
|
|
143
|
+
});
|
|
144
|
+
test("listener can be attached to document ", () => {
|
|
145
|
+
const listener = jest.fn();
|
|
146
|
+
const targetRef = React.createRef();
|
|
147
|
+
function Component({
|
|
148
|
+
target: target2
|
|
149
|
+
}) {
|
|
150
|
+
const addClickListener = useEvent("click");
|
|
151
|
+
React.useEffect(() => {
|
|
152
|
+
addClickListener(target2, listener);
|
|
153
|
+
});
|
|
154
|
+
return /* @__PURE__ */jsx("div", {
|
|
155
|
+
ref: targetRef
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
act(() => {
|
|
159
|
+
root.render(/* @__PURE__ */jsx(Component, {
|
|
160
|
+
target: document
|
|
161
|
+
}));
|
|
162
|
+
});
|
|
163
|
+
const target = createEventTarget(targetRef.current);
|
|
164
|
+
act(() => {
|
|
165
|
+
target.click();
|
|
166
|
+
});
|
|
167
|
+
expect(listener).toBeCalledTimes(1);
|
|
168
|
+
});
|
|
169
|
+
test("listener can be attached to window ", () => {
|
|
170
|
+
const listener = jest.fn();
|
|
171
|
+
const targetRef = React.createRef();
|
|
172
|
+
function Component({
|
|
173
|
+
target: target2
|
|
174
|
+
}) {
|
|
175
|
+
const addClickListener = useEvent("click");
|
|
176
|
+
React.useEffect(() => {
|
|
177
|
+
addClickListener(target2, listener);
|
|
178
|
+
});
|
|
179
|
+
return /* @__PURE__ */jsx("div", {
|
|
180
|
+
ref: targetRef
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
act(() => {
|
|
184
|
+
root.render(/* @__PURE__ */jsx(Component, {
|
|
185
|
+
target: window
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
const target = createEventTarget(targetRef.current);
|
|
189
|
+
act(() => {
|
|
190
|
+
target.click();
|
|
191
|
+
});
|
|
192
|
+
expect(listener).toBeCalledTimes(1);
|
|
193
|
+
});
|
|
194
|
+
test("listener is replaceable", () => {
|
|
195
|
+
const listener = jest.fn();
|
|
196
|
+
const listenerAlt = jest.fn();
|
|
197
|
+
const targetRef = React.createRef();
|
|
198
|
+
function Component({
|
|
199
|
+
onClick
|
|
200
|
+
}) {
|
|
201
|
+
const addClickListener = useEvent("click");
|
|
202
|
+
React.useEffect(() => {
|
|
203
|
+
addClickListener(targetRef.current, onClick);
|
|
204
|
+
});
|
|
205
|
+
return /* @__PURE__ */jsx("div", {
|
|
206
|
+
ref: targetRef
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
act(() => {
|
|
210
|
+
root.render(/* @__PURE__ */jsx(Component, {
|
|
211
|
+
onClick: listener
|
|
212
|
+
}));
|
|
213
|
+
});
|
|
214
|
+
const target = createEventTarget(targetRef.current);
|
|
215
|
+
act(() => {
|
|
216
|
+
target.click();
|
|
217
|
+
});
|
|
218
|
+
expect(listener).toBeCalledTimes(1);
|
|
219
|
+
act(() => {
|
|
220
|
+
root.render(/* @__PURE__ */jsx(Component, {
|
|
221
|
+
onClick: listenerAlt
|
|
222
|
+
}));
|
|
223
|
+
});
|
|
224
|
+
act(() => {
|
|
225
|
+
target.click();
|
|
226
|
+
});
|
|
227
|
+
expect(listener).toBeCalledTimes(1);
|
|
228
|
+
expect(listenerAlt).toBeCalledTimes(1);
|
|
229
|
+
});
|
|
230
|
+
test("listener is removed when value is null", () => {
|
|
231
|
+
const listener = jest.fn();
|
|
232
|
+
const targetRef = React.createRef();
|
|
233
|
+
function Component({
|
|
234
|
+
off
|
|
235
|
+
}) {
|
|
236
|
+
const addClickListener = useEvent("click");
|
|
237
|
+
React.useEffect(() => {
|
|
238
|
+
addClickListener(targetRef.current, off ? null : listener);
|
|
239
|
+
});
|
|
240
|
+
return /* @__PURE__ */jsx("div", {
|
|
241
|
+
ref: targetRef
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
act(() => {
|
|
245
|
+
root.render(/* @__PURE__ */jsx(Component, {
|
|
246
|
+
off: false
|
|
247
|
+
}));
|
|
248
|
+
});
|
|
249
|
+
const target = createEventTarget(targetRef.current);
|
|
250
|
+
act(() => {
|
|
251
|
+
target.click();
|
|
252
|
+
});
|
|
253
|
+
expect(listener).toBeCalledTimes(1);
|
|
254
|
+
act(() => {
|
|
255
|
+
root.render(/* @__PURE__ */jsx(Component, {
|
|
256
|
+
off: true
|
|
257
|
+
}));
|
|
258
|
+
});
|
|
259
|
+
listener.mockClear();
|
|
260
|
+
act(() => {
|
|
261
|
+
target.click();
|
|
262
|
+
});
|
|
263
|
+
expect(listener).toBeCalledTimes(0);
|
|
264
|
+
});
|
|
265
|
+
test("custom event dispatched on target", () => {
|
|
266
|
+
const listener = jest.fn();
|
|
267
|
+
const targetRef = React.createRef();
|
|
268
|
+
function Component() {
|
|
269
|
+
const addMagicEventListener = useEvent("magic-event");
|
|
270
|
+
React.useEffect(() => {
|
|
271
|
+
addMagicEventListener(targetRef.current, listener);
|
|
272
|
+
});
|
|
273
|
+
return /* @__PURE__ */jsx("div", {
|
|
274
|
+
ref: targetRef
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
act(() => {
|
|
278
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
279
|
+
});
|
|
280
|
+
act(() => {
|
|
281
|
+
const event = new CustomEvent("magic-event", {
|
|
282
|
+
bubbles: true
|
|
283
|
+
});
|
|
284
|
+
targetRef.current.dispatchEvent(event);
|
|
285
|
+
});
|
|
286
|
+
expect(listener).toBeCalledTimes(1);
|
|
287
|
+
});
|
|
288
|
+
test("listeners can be set on multiple targets simultaneously", () => {
|
|
289
|
+
const log = [];
|
|
290
|
+
const targetRef = React.createRef();
|
|
291
|
+
const parentRef = React.createRef();
|
|
292
|
+
const childRef = React.createRef();
|
|
293
|
+
const listener = jest.fn(e => {
|
|
294
|
+
log.push(["bubble", e.currentTarget.id]);
|
|
295
|
+
});
|
|
296
|
+
const listenerCapture = jest.fn(e => {
|
|
297
|
+
log.push(["capture", e.currentTarget.id]);
|
|
298
|
+
});
|
|
299
|
+
function Component() {
|
|
300
|
+
const addClickListener = useEvent("click");
|
|
301
|
+
const addClickCaptureListener = useEvent("click", {
|
|
302
|
+
capture: true
|
|
303
|
+
});
|
|
304
|
+
React.useEffect(() => {
|
|
305
|
+
addClickListener(targetRef.current, listener);
|
|
306
|
+
addClickListener(parentRef.current, listener);
|
|
307
|
+
addClickCaptureListener(targetRef.current, listenerCapture);
|
|
308
|
+
addClickCaptureListener(parentRef.current, listenerCapture);
|
|
309
|
+
});
|
|
310
|
+
return /* @__PURE__ */jsx("div", {
|
|
311
|
+
id: "parent",
|
|
312
|
+
ref: parentRef,
|
|
313
|
+
children: /* @__PURE__ */jsx("div", {
|
|
314
|
+
id: "target",
|
|
315
|
+
ref: targetRef,
|
|
316
|
+
children: /* @__PURE__ */jsx("div", {
|
|
317
|
+
ref: childRef
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
act(() => {
|
|
323
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
324
|
+
});
|
|
325
|
+
const child = createEventTarget(childRef.current);
|
|
326
|
+
act(() => {
|
|
327
|
+
child.click();
|
|
328
|
+
});
|
|
329
|
+
expect(listenerCapture).toBeCalledTimes(2);
|
|
330
|
+
expect(listener).toBeCalledTimes(2);
|
|
331
|
+
expect(log).toEqual([["capture", "parent"], ["capture", "target"], ["bubble", "target"], ["bubble", "parent"]]);
|
|
332
|
+
});
|
|
333
|
+
test("listeners are specific to each event handle", () => {
|
|
334
|
+
const log = [];
|
|
335
|
+
const targetRef = React.createRef();
|
|
336
|
+
const childRef = React.createRef();
|
|
337
|
+
const listener = jest.fn(e => {
|
|
338
|
+
log.push(["bubble", "target"]);
|
|
339
|
+
});
|
|
340
|
+
const listenerAlt = jest.fn(e => {
|
|
341
|
+
log.push(["bubble", "target-alt"]);
|
|
342
|
+
});
|
|
343
|
+
const listenerCapture = jest.fn(e => {
|
|
344
|
+
log.push(["capture", "target"]);
|
|
345
|
+
});
|
|
346
|
+
const listenerCaptureAlt = jest.fn(e => {
|
|
347
|
+
log.push(["capture", "target-alt"]);
|
|
348
|
+
});
|
|
349
|
+
function Component() {
|
|
350
|
+
const addClickListener = useEvent("click");
|
|
351
|
+
const addClickAltListener = useEvent("click");
|
|
352
|
+
const addClickCaptureListener = useEvent("click", {
|
|
353
|
+
capture: true
|
|
354
|
+
});
|
|
355
|
+
const addClickCaptureAltListener = useEvent("click", {
|
|
356
|
+
capture: true
|
|
357
|
+
});
|
|
358
|
+
React.useEffect(() => {
|
|
359
|
+
addClickListener(targetRef.current, listener);
|
|
360
|
+
addClickAltListener(targetRef.current, listenerAlt);
|
|
361
|
+
addClickCaptureListener(targetRef.current, listenerCapture);
|
|
362
|
+
addClickCaptureAltListener(targetRef.current, listenerCaptureAlt);
|
|
363
|
+
});
|
|
364
|
+
return /* @__PURE__ */jsx("div", {
|
|
365
|
+
id: "target",
|
|
366
|
+
ref: targetRef,
|
|
367
|
+
children: /* @__PURE__ */jsx("div", {
|
|
368
|
+
ref: childRef
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
act(() => {
|
|
373
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
374
|
+
});
|
|
375
|
+
const child = createEventTarget(childRef.current);
|
|
376
|
+
act(() => {
|
|
377
|
+
child.click();
|
|
378
|
+
});
|
|
379
|
+
expect(listenerCapture).toBeCalledTimes(1);
|
|
380
|
+
expect(listenerCaptureAlt).toBeCalledTimes(1);
|
|
381
|
+
expect(listener).toBeCalledTimes(1);
|
|
382
|
+
expect(listenerAlt).toBeCalledTimes(1);
|
|
383
|
+
expect(log).toEqual([["capture", "target"], ["capture", "target-alt"], ["bubble", "target"], ["bubble", "target-alt"]]);
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
describe("cleanup", () => {
|
|
387
|
+
test("removes all listeners for given event type from targets", () => {
|
|
388
|
+
const clickListener = jest.fn();
|
|
389
|
+
function Component() {
|
|
390
|
+
const addClickListener = useEvent("click");
|
|
391
|
+
React.useEffect(() => {
|
|
392
|
+
addClickListener(document, clickListener);
|
|
393
|
+
});
|
|
394
|
+
return /* @__PURE__ */jsx("div", {});
|
|
395
|
+
}
|
|
396
|
+
act(() => {
|
|
397
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
398
|
+
root.render(null);
|
|
399
|
+
});
|
|
400
|
+
const target = createEventTarget(document);
|
|
401
|
+
act(() => {
|
|
402
|
+
target.click();
|
|
403
|
+
});
|
|
404
|
+
expect(clickListener).toBeCalledTimes(0);
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
describe("stopPropagation and stopImmediatePropagation", () => {
|
|
408
|
+
test("stopPropagation works as expected", () => {
|
|
409
|
+
const childListener = jest.fn(e => {
|
|
410
|
+
e.stopPropagation();
|
|
411
|
+
});
|
|
412
|
+
const targetListener = jest.fn();
|
|
413
|
+
const targetRef = React.createRef();
|
|
414
|
+
const childRef = React.createRef();
|
|
415
|
+
function Component() {
|
|
416
|
+
const addClickListener = useEvent("click");
|
|
417
|
+
React.useEffect(() => {
|
|
418
|
+
addClickListener(childRef.current, childListener);
|
|
419
|
+
addClickListener(targetRef.current, targetListener);
|
|
420
|
+
});
|
|
421
|
+
return /* @__PURE__ */jsx("div", {
|
|
422
|
+
ref: targetRef,
|
|
423
|
+
children: /* @__PURE__ */jsx("div", {
|
|
424
|
+
ref: childRef
|
|
425
|
+
})
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
act(() => {
|
|
429
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
430
|
+
});
|
|
431
|
+
const child = createEventTarget(childRef.current);
|
|
432
|
+
act(() => {
|
|
433
|
+
child.click();
|
|
434
|
+
});
|
|
435
|
+
expect(childListener).toBeCalledTimes(1);
|
|
436
|
+
expect(targetListener).toBeCalledTimes(0);
|
|
437
|
+
});
|
|
438
|
+
test("stopImmediatePropagation works as expected", () => {
|
|
439
|
+
const firstListener = jest.fn(e => {
|
|
440
|
+
e.stopImmediatePropagation();
|
|
441
|
+
});
|
|
442
|
+
const secondListener = jest.fn();
|
|
443
|
+
const targetRef = React.createRef();
|
|
444
|
+
function Component() {
|
|
445
|
+
const addFirstClickListener = useEvent("click");
|
|
446
|
+
const addSecondClickListener = useEvent("click");
|
|
447
|
+
React.useEffect(() => {
|
|
448
|
+
addFirstClickListener(targetRef.current, firstListener);
|
|
449
|
+
addSecondClickListener(targetRef.current, secondListener);
|
|
450
|
+
});
|
|
451
|
+
return /* @__PURE__ */jsx("div", {
|
|
452
|
+
ref: targetRef
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
act(() => {
|
|
456
|
+
root.render(/* @__PURE__ */jsx(Component, {}));
|
|
457
|
+
});
|
|
458
|
+
const target = createEventTarget(targetRef.current);
|
|
459
|
+
act(() => {
|
|
460
|
+
target.click();
|
|
461
|
+
});
|
|
462
|
+
expect(firstListener).toBeCalledTimes(1);
|
|
463
|
+
expect(secondListener).toBeCalledTimes(0);
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
//# sourceMappingURL=index-test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEventTarget","React","ReactDOM","act","useEvent","jsx","createRoot","rootNode","render","element","describe","root","beforeEach","document","createElement","body","appendChild","afterEach","removeChild","test","listener","jest","fn","targetRef","createRef","Component","addClickListener","useEffect","current","ref","target","click","expect","toBeCalledTimes","listenerCapture","parentRef","addClickCaptureListener","capture","children","parent","log","push","childRef","child","toEqual","text","firstChild","target2","window","listenerAlt","onClick","off","mockClear","addMagicEventListener","event","CustomEvent","bubbles","dispatchEvent","e","currentTarget","id","listenerCaptureAlt","addClickAltListener","addClickCaptureAltListener","clickListener","childListener","stopPropagation","targetListener","firstListener","stopImmediatePropagation","secondListener","addFirstClickListener","addSecondClickListener"],"sources":["../../../../../src/modules/useEvent/__tests__/index-test.tsx"],"sourcesContent":[null],"mappings":"AASA,SAASA,iBAAA,QAAyB;AAClC,YAAYC,KAAA,MAAW;AACvB,YAAYC,QAAA,MAAc;AAC1B,SAASC,GAAA,QAAW;AAEpB,OAAOC,QAAA,MAAc;AAqCN,SAAAC,GAAA;AAnCf,SAASC,WAAWC,QAAA,EAAU;EAC5B,OAAO;IACLC,OAAOC,OAAA,EAAS;MACdP,QAAA,CAASM,MAAA,CAAOC,OAAA,EAASF,QAAQ;IACnC;EACF;AACF;AAEAG,QA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,GAAwBnE,QAAA,CAAS,OAAO;QAC9C,MAAMoE,sBAAA,GAAyBpE,QAAA,CAAS,OAAO;QAC/CH,KAAA,CAAM0B,SAAA,CAAU,MAAM;UACpB4C,qBAAA,CAAsBhD,SAAA,CAAUK,OAAA,EAASwC,aAAa;UACtDI,sBAAA,CAAuBjD,SAAA,CAAUK,OAAA,EAAS0C,cAAc;QAC1D,CAAC;QACD,OAAO,eAAAjE,GAAA,CAAC;UAAIwB,GAAA,EAAKN;QAAA,CAAW;MAC9B;MAEApB,GAAA,CAAI,MAAM;QACRQ,IAAA,CAAKH,MAAA,CAAO,eAAAH,GAAA,CAACoB,SAAA,IAAU,CAAE;MAC3B,CAAC;MAED,MAAMK,MAAA,GAAS9B,iBAAA,CAAkBuB,SAAA,CAAUK,OAAO;MAElDzB,GAAA,CAAI,MAAM;QACR2B,MAAA,CAAOC,KAAA,CAAM;MACf,CAAC;MAEDC,MAAA,CAAOoC,aAAa,EAAEnC,eAAA,CAAgB,CAAC;MACvCD,MAAA,CAAOsC,cAAc,EAAErC,eAAA,CAAgB,CAAC;IAC1C,CAAC;EACH,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createEventHandle } from "../createEventHandle/index.mjs";
|
|
2
|
+
import { useLayoutEffectImpl as useLayoutEffect } from "../useLayoutEffect/index.mjs";
|
|
3
|
+
import { useStable } from "../useStable/index.mjs";
|
|
4
|
+
function useEvent(event, options) {
|
|
5
|
+
const targetListeners = useStable(() => /* @__PURE__ */new Map());
|
|
6
|
+
const addListener = useStable(() => {
|
|
7
|
+
const addEventListener = createEventHandle(event, options);
|
|
8
|
+
return (target, callback) => {
|
|
9
|
+
const removeTargetListener = targetListeners.get(target);
|
|
10
|
+
if (removeTargetListener != null) {
|
|
11
|
+
removeTargetListener();
|
|
12
|
+
}
|
|
13
|
+
if (callback == null) {
|
|
14
|
+
targetListeners.delete(target);
|
|
15
|
+
}
|
|
16
|
+
const removeEventListener = addEventListener(target, callback);
|
|
17
|
+
targetListeners.set(target, removeEventListener);
|
|
18
|
+
return removeEventListener;
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
useLayoutEffect(() => {
|
|
22
|
+
return () => {
|
|
23
|
+
targetListeners.forEach(removeListener => {
|
|
24
|
+
removeListener();
|
|
25
|
+
});
|
|
26
|
+
targetListeners.clear();
|
|
27
|
+
};
|
|
28
|
+
}, [targetListeners]);
|
|
29
|
+
return addListener;
|
|
30
|
+
}
|
|
31
|
+
export { useEvent };
|
|
32
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEventHandle","useLayoutEffectImpl","useLayoutEffect","useStable","useEvent","event","options","targetListeners","Map","addListener","addEventListener","target","callback","removeTargetListener","get","delete","removeEventListener","set","forEach","removeListener","clear"],"sources":["../../../../src/modules/useEvent/index.tsx"],"sourcesContent":[null],"mappings":"AASA,SAASA,iBAAA,QAAyB;AAClC,SAASC,mBAAA,IAAuBC,eAAA,QAAuB;AACvD,SAASC,SAAA,QAAiB;AAiBnB,SAASC,SACdC,KAAA,EACAC,OAAA,EAIa;EACb,MAAMC,eAAA,GAAkBJ,SAAA,CAAU,MAAM,mBAAIK,GAAA,CAAI,CAAC;EAEjD,MAAMC,WAAA,GAAcN,SAAA,CAAU,MAAM;IAClC,MAAMO,gBAAA,GAAmBV,iBAAA,CAAkBK,KAAA,EAAOC,OAAO;IACzD,OAAO,CAACK,MAAA,EAAqBC,QAAA,KAAuB;MAClD,MAAMC,oBAAA,GAAuBN,eAAA,CAAgBO,GAAA,CAAIH,MAAM;MACvD,IAAIE,oBAAA,IAAwB,MAAM;QAChCA,oBAAA,CAAqB;MACvB;MACA,IAAID,QAAA,IAAY,MAAM;QACpBL,eAAA,CAAgBQ,MAAA,CAAOJ,MAAM;MAC/B;MACA,MAAMK,mBAAA,GAAsBN,gBAAA,CAAiBC,MAAA,EAAQC,QAAQ;MAC7DL,eAAA,CAAgBU,GAAA,CAAIN,MAAA,EAAQK,mBAAmB;MAC/C,OAAOA,mBAAA;IACT;EACF,CAAC;EAEDd,eAAA,CAAgB,MAAM;IACpB,OAAO,MAAM;MACXK,eAAA,CAAgBW,OAAA,CAASC,cAAA,IAAmB;QAC1CA,cAAA,CAAe;MACjB,CAAC;MACDZ,eAAA,CAAgBa,KAAA,CAAM;IACxB;EACF,GAAG,CAACb,eAAe,CAAC;EAEpB,OAAOE,WAAA;AACT","ignoreList":[]}
|