@hanzogui/react-native-web-internals 2.0.0
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 +240 -0
- package/dist/cjs/StyleSheet/__tests__/compiler-test.cjs +407 -0
- package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.cjs +121 -0
- package/dist/cjs/StyleSheet/__tests__/index-test.cjs +404 -0
- package/dist/cjs/StyleSheet/__tests__/preprocess-test.cjs +108 -0
- package/dist/cjs/StyleSheet/__tests__/validate-test.cjs +36 -0
- package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.cjs +87 -0
- package/dist/cjs/StyleSheet/compiler/hash.cjs +26 -0
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +36 -0
- package/dist/cjs/StyleSheet/compiler/index.cjs +318 -0
- package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +40 -0
- package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.cjs +43 -0
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +48 -0
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +37 -0
- package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.cjs +110 -0
- package/dist/cjs/StyleSheet/dom/index.cjs +67 -0
- package/dist/cjs/StyleSheet/index.cjs +57 -0
- package/dist/cjs/StyleSheet/preprocess.cjs +101 -0
- package/dist/cjs/StyleSheet/validate.cjs +69 -0
- package/dist/cjs/TextAncestorContext.cjs +27 -0
- package/dist/cjs/colorProps.cjs +37 -0
- package/dist/cjs/index.cjs +103 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.cjs +50 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.cjs +40 -0
- package/dist/cjs/modules/AccessibilityUtil/index.cjs +33 -0
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +26 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +57 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +47 -0
- package/dist/cjs/modules/AssetRegistry/index.cjs +33 -0
- package/dist/cjs/modules/ImageLoader/index.cjs +111 -0
- package/dist/cjs/modules/InteractionManager.cjs +184 -0
- package/dist/cjs/modules/Platform/__tests__/index-test.cjs +48 -0
- package/dist/cjs/modules/Platform/index.cjs +30 -0
- package/dist/cjs/modules/TextInputState/index.cjs +55 -0
- package/dist/cjs/modules/UIManager/__tests__/index-test.cjs +90 -0
- package/dist/cjs/modules/UIManager/index.cjs +60 -0
- package/dist/cjs/modules/canUseDOM.cjs +26 -0
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +156 -0
- package/dist/cjs/modules/createDOMProps/index.cjs +179 -0
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +344 -0
- package/dist/cjs/modules/createEventHandle/index.cjs +67 -0
- package/dist/cjs/modules/dismissKeyboard/index.cjs +29 -0
- package/dist/cjs/modules/forwardedProps/index.cjs +161 -0
- package/dist/cjs/modules/getBoundingClientRect/index.cjs +28 -0
- package/dist/cjs/modules/invariant.cjs +36 -0
- package/dist/cjs/modules/isSelectionValid/index.cjs +35 -0
- package/dist/cjs/modules/isWebColor/index.cjs +26 -0
- package/dist/cjs/modules/mergeRefs/__tests__/index-test.cjs +42 -0
- package/dist/cjs/modules/mergeRefs/index.cjs +42 -0
- package/dist/cjs/modules/modality/__tests__/index-test.cjs +32 -0
- package/dist/cjs/modules/modality/index.cjs +135 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.cjs +30 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +35 -0
- package/dist/cjs/modules/normalizeColor/index.cjs +39 -0
- package/dist/cjs/modules/pick/index.cjs +30 -0
- package/dist/cjs/modules/processColor/__tests__/index-test.cjs +66 -0
- package/dist/cjs/modules/processColor/index.cjs +42 -0
- package/dist/cjs/modules/requestIdleCallback/index.cjs +44 -0
- package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.cjs +35 -0
- package/dist/cjs/modules/setValueForStyles/index.cjs +35 -0
- package/dist/cjs/modules/unitlessNumbers/index.cjs +85 -0
- package/dist/cjs/modules/useElementLayout/index.cjs +39 -0
- package/dist/cjs/modules/useEvent/__tests__/index-test.cjs +408 -0
- package/dist/cjs/modules/useEvent/index.cjs +45 -0
- package/dist/cjs/modules/useHover/__tests__/index-test.cjs +273 -0
- package/dist/cjs/modules/useHover/index.cjs +97 -0
- package/dist/cjs/modules/useLayoutEffect/index.cjs +39 -0
- package/dist/cjs/modules/useLocale/index.cjs +66 -0
- package/dist/cjs/modules/useLocale/isLocaleRTL.cjs +83 -0
- package/dist/cjs/modules/useMergeRefs/__tests__/index-test.cjs +102 -0
- package/dist/cjs/modules/useMergeRefs/index.cjs +43 -0
- package/dist/cjs/modules/usePlatformMethods/index.cjs +35 -0
- package/dist/cjs/modules/useStable/__tests__/index-test.cjs +92 -0
- package/dist/cjs/modules/useStable/index.cjs +42 -0
- package/dist/cjs/styleTypes.cjs +16 -0
- package/dist/cjs/types.cjs +16 -0
- package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs +219 -0
- package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/compiler-test.mjs +408 -0
- package/dist/esm/StyleSheet/__tests__/compiler-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs +100 -0
- package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/index-test.mjs +383 -0
- package/dist/esm/StyleSheet/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs +109 -0
- package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/__tests__/validate-test.mjs +37 -0
- package/dist/esm/StyleSheet/__tests__/validate-test.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs +63 -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 +13 -0
- package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/index.mjs +292 -0
- package/dist/esm/StyleSheet/compiler/index.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +17 -0
- package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs +20 -0
- package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs.map +1 -0
- package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs +25 -0
- package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs.map +1 -0
- package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs +14 -0
- package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs.map +1 -0
- package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs +87 -0
- package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs.map +1 -0
- package/dist/esm/StyleSheet/dom/index.mjs +44 -0
- package/dist/esm/StyleSheet/dom/index.mjs.map +1 -0
- package/dist/esm/StyleSheet/index.mjs +33 -0
- package/dist/esm/StyleSheet/index.mjs.map +1 -0
- package/dist/esm/StyleSheet/preprocess.mjs +75 -0
- package/dist/esm/StyleSheet/preprocess.mjs.map +1 -0
- package/dist/esm/StyleSheet/validate.mjs +46 -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 +29 -0
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs +19 -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 +34 -0
- package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs.map +1 -0
- package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs +24 -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 +87 -0
- package/dist/esm/modules/ImageLoader/index.mjs.map +1 -0
- package/dist/esm/modules/InteractionManager.mjs +161 -0
- package/dist/esm/modules/InteractionManager.mjs.map +1 -0
- package/dist/esm/modules/Platform/__tests__/index-test.mjs +27 -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 +32 -0
- package/dist/esm/modules/TextInputState/index.mjs.map +1 -0
- package/dist/esm/modules/UIManager/__tests__/index-test.mjs +69 -0
- package/dist/esm/modules/UIManager/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/UIManager/index.mjs +37 -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 +135 -0
- package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/createDOMProps/index.mjs +155 -0
- package/dist/esm/modules/createDOMProps/index.mjs.map +1 -0
- package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs +323 -0
- package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/createEventHandle/index.mjs +42 -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 +5 -0
- package/dist/esm/modules/getBoundingClientRect/index.mjs.map +1 -0
- package/dist/esm/modules/invariant.mjs +12 -0
- package/dist/esm/modules/invariant.mjs.map +1 -0
- package/dist/esm/modules/isSelectionValid/index.mjs +12 -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 +21 -0
- package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/mergeRefs/index.mjs +19 -0
- package/dist/esm/modules/mergeRefs/index.mjs.map +1 -0
- package/dist/esm/modules/modality/__tests__/index-test.mjs +33 -0
- package/dist/esm/modules/modality/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/modality/index.mjs +109 -0
- package/dist/esm/modules/modality/index.mjs.map +1 -0
- package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs +9 -0
- package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/multiplyStyleLengthValue/index.mjs +12 -0
- package/dist/esm/modules/multiplyStyleLengthValue/index.mjs.map +1 -0
- package/dist/esm/modules/normalizeColor/index.mjs +16 -0
- package/dist/esm/modules/normalizeColor/index.mjs.map +1 -0
- package/dist/esm/modules/pick/index.mjs +7 -0
- package/dist/esm/modules/pick/index.mjs.map +1 -0
- package/dist/esm/modules/processColor/__tests__/index-test.mjs +45 -0
- package/dist/esm/modules/processColor/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/processColor/index.mjs +8 -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 +12 -0
- package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs.map +1 -0
- package/dist/esm/modules/setValueForStyles/index.mjs +12 -0
- package/dist/esm/modules/setValueForStyles/index.mjs.map +1 -0
- package/dist/esm/modules/unitlessNumbers/index.mjs +62 -0
- package/dist/esm/modules/unitlessNumbers/index.mjs.map +1 -0
- package/dist/esm/modules/useElementLayout/index.mjs +16 -0
- package/dist/esm/modules/useElementLayout/index.mjs.map +1 -0
- package/dist/esm/modules/useEvent/__tests__/index-test.mjs +387 -0
- package/dist/esm/modules/useEvent/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useEvent/index.mjs +22 -0
- package/dist/esm/modules/useEvent/index.mjs.map +1 -0
- package/dist/esm/modules/useHover/__tests__/index-test.mjs +252 -0
- package/dist/esm/modules/useHover/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useHover/index.mjs +74 -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 +30 -0
- package/dist/esm/modules/useLocale/index.mjs.map +1 -0
- package/dist/esm/modules/useLocale/isLocaleRTL.mjs +60 -0
- package/dist/esm/modules/useLocale/isLocaleRTL.mjs.map +1 -0
- package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs +81 -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 +12 -0
- package/dist/esm/modules/usePlatformMethods/index.mjs.map +1 -0
- package/dist/esm/modules/useStable/__tests__/index-test.mjs +71 -0
- package/dist/esm/modules/useStable/__tests__/index-test.mjs.map +1 -0
- package/dist/esm/modules/useStable/index.mjs +8 -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,195 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Nicolas Gallagher.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @flow strict-local
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type Groups = {
|
|
12
|
+
[K in number]: {
|
|
13
|
+
start: number | null
|
|
14
|
+
rules: Array<string>
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type Selectors = {
|
|
19
|
+
[K in string]: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type OrderedCSSStyleSheet = {
|
|
23
|
+
getTextContent: () => string
|
|
24
|
+
insert: (cssText: string, groupValue: number) => void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const slice = Array.prototype.slice
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Order-based insertion of CSS.
|
|
31
|
+
*
|
|
32
|
+
* Each rule is associated with a numerically defined group.
|
|
33
|
+
* Groups are ordered within the style sheet according to their number, with the
|
|
34
|
+
* lowest first.
|
|
35
|
+
*
|
|
36
|
+
* Groups are implemented using marker rules. The selector of the first rule of
|
|
37
|
+
* each group is used only to encode the group number for hydration. An
|
|
38
|
+
* alternative implementation could rely on CSSMediaRule, allowing groups to be
|
|
39
|
+
* treated as a sub-sheet, but the Edge implementation of CSSMediaRule is
|
|
40
|
+
* broken.
|
|
41
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/CSSMediaRule
|
|
42
|
+
* https://gist.github.com/necolas/aa0c37846ad6bd3b05b727b959e82674
|
|
43
|
+
*/
|
|
44
|
+
export function createOrderedCSSStyleSheet(
|
|
45
|
+
sheet: CSSStyleSheet | null
|
|
46
|
+
): OrderedCSSStyleSheet {
|
|
47
|
+
const groups: Groups = {}
|
|
48
|
+
const selectors: Selectors = {}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Hydrate approximate record from any existing rules in the sheet.
|
|
52
|
+
*/
|
|
53
|
+
if (sheet != null) {
|
|
54
|
+
let group
|
|
55
|
+
slice.call(sheet.cssRules).forEach((cssRule, i) => {
|
|
56
|
+
const cssText = cssRule.cssText
|
|
57
|
+
// Create record of existing selectors and rules
|
|
58
|
+
if (cssText.indexOf('stylesheet-group') > -1) {
|
|
59
|
+
group = decodeGroupRule(cssRule)
|
|
60
|
+
groups[group] = { start: i, rules: [cssText] }
|
|
61
|
+
} else {
|
|
62
|
+
const selectorText = getSelectorText(cssText)
|
|
63
|
+
if (selectorText != null) {
|
|
64
|
+
selectors[selectorText] = true
|
|
65
|
+
groups[group].rules.push(cssText)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function sheetInsert(sheet, group, text) {
|
|
72
|
+
const orderedGroups = getOrderedGroups(groups)
|
|
73
|
+
const groupIndex = orderedGroups.indexOf(group)
|
|
74
|
+
const nextGroupIndex = groupIndex + 1
|
|
75
|
+
const nextGroup = orderedGroups[nextGroupIndex]
|
|
76
|
+
// Insert rule before the next group, or at the end of the stylesheet
|
|
77
|
+
const position =
|
|
78
|
+
nextGroup != null && groups[nextGroup].start != null
|
|
79
|
+
? groups[nextGroup].start
|
|
80
|
+
: sheet.cssRules.length
|
|
81
|
+
const isInserted = insertRuleAt(sheet, text, position)
|
|
82
|
+
|
|
83
|
+
if (isInserted) {
|
|
84
|
+
// Set the starting index of the new group
|
|
85
|
+
if (groups[group].start == null) {
|
|
86
|
+
groups[group].start = position
|
|
87
|
+
}
|
|
88
|
+
// Increment the starting index of all subsequent groups
|
|
89
|
+
for (let i = nextGroupIndex; i < orderedGroups.length; i += 1) {
|
|
90
|
+
const groupNumber = orderedGroups[i]
|
|
91
|
+
const previousStart = groups[groupNumber].start || 0
|
|
92
|
+
groups[groupNumber].start = previousStart + 1
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return isInserted
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const OrderedCSSStyleSheet = {
|
|
100
|
+
/**
|
|
101
|
+
* The textContent of the style sheet.
|
|
102
|
+
*/
|
|
103
|
+
getTextContent(): string {
|
|
104
|
+
return getOrderedGroups(groups)
|
|
105
|
+
.map((group) => {
|
|
106
|
+
const rules = groups[group].rules
|
|
107
|
+
// Sorting provides deterministic order of styles in group for
|
|
108
|
+
// build-time extraction of the style sheet.
|
|
109
|
+
const marker = rules.shift()
|
|
110
|
+
rules.sort()
|
|
111
|
+
rules.unshift(marker)
|
|
112
|
+
return rules.join('\n')
|
|
113
|
+
})
|
|
114
|
+
.join('\n')
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Insert a rule into the style sheet
|
|
119
|
+
*/
|
|
120
|
+
insert(cssText: string, groupValue: number) {
|
|
121
|
+
const group = Number(groupValue)
|
|
122
|
+
|
|
123
|
+
// Create a new group.
|
|
124
|
+
if (groups[group] == null) {
|
|
125
|
+
const markerRule = encodeGroupRule(group)
|
|
126
|
+
// Create the internal record.
|
|
127
|
+
groups[group] = { start: null, rules: [markerRule] }
|
|
128
|
+
// Update CSSOM.
|
|
129
|
+
if (sheet != null) {
|
|
130
|
+
sheetInsert(sheet, group, markerRule)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// selectorText is more reliable than cssText for insertion checks. The
|
|
135
|
+
// browser excludes vendor-prefixed properties and rewrites certain values
|
|
136
|
+
// making cssText more likely to be different from what was inserted.
|
|
137
|
+
const selectorText = getSelectorText(cssText)
|
|
138
|
+
if (selectorText != null && selectors[selectorText] == null) {
|
|
139
|
+
// Update the internal records.
|
|
140
|
+
selectors[selectorText] = true
|
|
141
|
+
groups[group].rules.push(cssText)
|
|
142
|
+
// Update CSSOM.
|
|
143
|
+
if (sheet != null) {
|
|
144
|
+
const isInserted = sheetInsert(sheet, group, cssText)
|
|
145
|
+
if (!isInserted) {
|
|
146
|
+
// Revert internal record change if a rule was rejected (e.g.,
|
|
147
|
+
// unrecognized pseudo-selector)
|
|
148
|
+
groups[group].rules.pop()
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return OrderedCSSStyleSheet
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Helper functions
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
function encodeGroupRule(group) {
|
|
163
|
+
return `[stylesheet-group="${group}"]{}`
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const groupPattern = /["']/g
|
|
167
|
+
function decodeGroupRule(cssRule) {
|
|
168
|
+
return Number(cssRule.selectorText.split(groupPattern)[1])
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function getOrderedGroups(obj: {
|
|
172
|
+
[K in number]: any
|
|
173
|
+
}) {
|
|
174
|
+
return Object.keys(obj)
|
|
175
|
+
.map(Number)
|
|
176
|
+
.sort((a, b) => (a > b ? 1 : -1))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const selectorPattern = /\s*([,])\s*/g
|
|
180
|
+
function getSelectorText(cssText) {
|
|
181
|
+
const selector = cssText.split('{')[0].trim()
|
|
182
|
+
return selector !== '' ? selector.replace(selectorPattern, '$1') : null
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function insertRuleAt(root, cssText: string, position: number): boolean {
|
|
186
|
+
try {
|
|
187
|
+
// @ts-ignore : Flow is missing CSSOM types needed to type 'root'.
|
|
188
|
+
root.insertRule(cssText, position)
|
|
189
|
+
return true
|
|
190
|
+
} catch (e) {
|
|
191
|
+
// JSDOM doesn't support `CSSSMediaRule#insertRule`.
|
|
192
|
+
// Also ignore errors that occur from attempting to insert vendor-prefixed selectors.
|
|
193
|
+
return false
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Nicolas Gallagher.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @flow strict-local
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { canUseDOM } from '../../modules/canUseDOM'
|
|
12
|
+
import { createCSSStyleSheet } from './createCSSStyleSheet'
|
|
13
|
+
import type { OrderedCSSStyleSheet } from './createOrderedCSSStyleSheet'
|
|
14
|
+
import { createOrderedCSSStyleSheet } from './createOrderedCSSStyleSheet'
|
|
15
|
+
|
|
16
|
+
type Sheet = {
|
|
17
|
+
id: string
|
|
18
|
+
} & OrderedCSSStyleSheet
|
|
19
|
+
|
|
20
|
+
const defaultId = 'react-native-stylesheet'
|
|
21
|
+
const roots = new WeakMap<Node, number>()
|
|
22
|
+
const sheets = []
|
|
23
|
+
|
|
24
|
+
const initialRules = [
|
|
25
|
+
// minimal top-level reset
|
|
26
|
+
'html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);}',
|
|
27
|
+
'body{margin:0;}',
|
|
28
|
+
// minimal form pseudo-element reset
|
|
29
|
+
'button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}',
|
|
30
|
+
'input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;}',
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
export function createSheet(root?: HTMLElement, id = defaultId): Sheet {
|
|
34
|
+
let sheet
|
|
35
|
+
|
|
36
|
+
function createSheet() {
|
|
37
|
+
if (sheet) return
|
|
38
|
+
|
|
39
|
+
if (canUseDOM) {
|
|
40
|
+
const rootNode: Node = root != null ? root.getRootNode() : document
|
|
41
|
+
// Create the initial style sheet
|
|
42
|
+
if (sheets.length === 0) {
|
|
43
|
+
sheet = createOrderedCSSStyleSheet(createCSSStyleSheet(id))
|
|
44
|
+
initialRules.forEach((rule) => {
|
|
45
|
+
sheet.insert(rule, 0)
|
|
46
|
+
})
|
|
47
|
+
roots.set(rootNode, sheets.length)
|
|
48
|
+
sheets.push(sheet)
|
|
49
|
+
} else {
|
|
50
|
+
const index = roots.get(rootNode)
|
|
51
|
+
if (index == null) {
|
|
52
|
+
const initialSheet = sheets[0]
|
|
53
|
+
// If we're creating a new sheet, populate it with existing styles
|
|
54
|
+
const textContent = initialSheet != null ? initialSheet.getTextContent() : ''
|
|
55
|
+
// Cast rootNode to 'any' because Flow types for getRootNode are wrong
|
|
56
|
+
sheet = createOrderedCSSStyleSheet(
|
|
57
|
+
createCSSStyleSheet(id, rootNode as any, textContent)
|
|
58
|
+
)
|
|
59
|
+
roots.set(rootNode, sheets.length)
|
|
60
|
+
sheets.push(sheet)
|
|
61
|
+
} else {
|
|
62
|
+
sheet = sheets[index]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
// Create the initial style sheet
|
|
67
|
+
if (sheets.length === 0) {
|
|
68
|
+
sheet = createOrderedCSSStyleSheet(createCSSStyleSheet(id))
|
|
69
|
+
initialRules.forEach((rule) => {
|
|
70
|
+
sheet.insert(rule, 0)
|
|
71
|
+
})
|
|
72
|
+
sheets.push(sheet)
|
|
73
|
+
} else {
|
|
74
|
+
sheet = sheets[0]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
getTextContent() {
|
|
81
|
+
createSheet()
|
|
82
|
+
return sheet.getTextContent()
|
|
83
|
+
},
|
|
84
|
+
id,
|
|
85
|
+
insert(cssText: string, groupValue: number) {
|
|
86
|
+
createSheet()
|
|
87
|
+
sheets.forEach((s) => {
|
|
88
|
+
s.insert(cssText, groupValue)
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Nicolas Gallagher.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @flow
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const staticStyleMap: WeakMap<object, object> = new WeakMap()
|
|
12
|
+
|
|
13
|
+
function insertRules(compiledOrderedRules) {}
|
|
14
|
+
|
|
15
|
+
function compileAndInsertAtomic(style) {}
|
|
16
|
+
|
|
17
|
+
function compileAndInsertReset(style, key) {}
|
|
18
|
+
|
|
19
|
+
/* ----- API ----- */
|
|
20
|
+
|
|
21
|
+
const absoluteFillObject = {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
left: 0,
|
|
24
|
+
right: 0,
|
|
25
|
+
top: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const absoluteFill = absoluteFillObject as any
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* create
|
|
33
|
+
*/
|
|
34
|
+
function create(styles) {
|
|
35
|
+
return styles
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* compose
|
|
40
|
+
*/
|
|
41
|
+
function compose(style1: any, style2: any): any {
|
|
42
|
+
return flatten(style1, style2)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* flatten
|
|
47
|
+
*/
|
|
48
|
+
export function flatten(...styles: any): { [key: string]: any } {
|
|
49
|
+
return styles
|
|
50
|
+
.flat()
|
|
51
|
+
.flat()
|
|
52
|
+
.flat()
|
|
53
|
+
.flat()
|
|
54
|
+
.reduce((acc, cur) => {
|
|
55
|
+
if (cur) {
|
|
56
|
+
Object.assign(acc, cur)
|
|
57
|
+
}
|
|
58
|
+
return acc
|
|
59
|
+
}, {})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* getSheet
|
|
64
|
+
*/
|
|
65
|
+
function getSheet(): { id: string; textContent: string } {
|
|
66
|
+
return {
|
|
67
|
+
id: '',
|
|
68
|
+
textContent: sheet.getTextContent(),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* resolve
|
|
74
|
+
*/
|
|
75
|
+
type StyleProps = [string, { [key: string]: any } | null]
|
|
76
|
+
type Options = { writingDirection: 'ltr' | 'rtl' }
|
|
77
|
+
|
|
78
|
+
export function StyleSheet(styles: any, options?: Options): StyleProps {}
|
|
79
|
+
|
|
80
|
+
StyleSheet.absoluteFill = absoluteFill
|
|
81
|
+
StyleSheet.absoluteFillObject = absoluteFillObject
|
|
82
|
+
StyleSheet.create = create
|
|
83
|
+
StyleSheet.compose = compose
|
|
84
|
+
StyleSheet.flatten = flatten
|
|
85
|
+
StyleSheet.getSheet = getSheet
|
|
86
|
+
// `hairlineWidth` is not implemented using screen density as browsers may
|
|
87
|
+
// round sub-pixel values down to `0`, causing the line not to be rendered.
|
|
88
|
+
StyleSheet.hairlineWidth = 1
|
|
89
|
+
|
|
90
|
+
export type IStyleSheet = {
|
|
91
|
+
(styles: any, options?: Options): StyleProps
|
|
92
|
+
absoluteFill: object
|
|
93
|
+
absoluteFillObject: object
|
|
94
|
+
create: typeof create
|
|
95
|
+
compose: typeof compose
|
|
96
|
+
flatten: typeof flatten
|
|
97
|
+
getSheet: typeof getSheet
|
|
98
|
+
hairlineWidth: number
|
|
99
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Nicolas Gallagher.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @flow
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { normalizeColor } from './compiler/normalizeColor'
|
|
12
|
+
import { normalizeValueWithProperty } from './compiler/normalizeValueWithProperty'
|
|
13
|
+
|
|
14
|
+
const emptyObject = {}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Shadows
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const defaultOffset = { height: 0, width: 0 }
|
|
21
|
+
|
|
22
|
+
export const createBoxShadowValue = (style: object): void | string => {
|
|
23
|
+
const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style
|
|
24
|
+
const { height, width } = shadowOffset || defaultOffset
|
|
25
|
+
const offsetX = normalizeValueWithProperty(width)
|
|
26
|
+
const offsetY = normalizeValueWithProperty(height)
|
|
27
|
+
const blurRadius = normalizeValueWithProperty(shadowRadius || 0)
|
|
28
|
+
const color = normalizeColor(shadowColor || 'black', shadowOpacity)
|
|
29
|
+
if (color != null && offsetX != null && offsetY != null && blurRadius != null) {
|
|
30
|
+
return `${offsetX} ${offsetY} ${blurRadius} ${color}`
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const createTextShadowValue = (style: object): void | string => {
|
|
35
|
+
const { textShadowColor, textShadowOffset, textShadowRadius } = style
|
|
36
|
+
const { height, width } = textShadowOffset || defaultOffset
|
|
37
|
+
const radius = textShadowRadius || 0
|
|
38
|
+
const offsetX = normalizeValueWithProperty(width)
|
|
39
|
+
const offsetY = normalizeValueWithProperty(height)
|
|
40
|
+
const blurRadius = normalizeValueWithProperty(radius)
|
|
41
|
+
const color = normalizeValueWithProperty(textShadowColor, 'textShadowColor')
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
color &&
|
|
45
|
+
(height !== 0 || width !== 0 || radius !== 0) &&
|
|
46
|
+
offsetX != null &&
|
|
47
|
+
offsetY != null &&
|
|
48
|
+
blurRadius != null
|
|
49
|
+
) {
|
|
50
|
+
return `${offsetX} ${offsetY} ${blurRadius} ${color}`
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Preprocess styles
|
|
56
|
+
*/
|
|
57
|
+
export const preprocess = <
|
|
58
|
+
T extends {
|
|
59
|
+
[K in string]: any
|
|
60
|
+
},
|
|
61
|
+
>(
|
|
62
|
+
originalStyle: T
|
|
63
|
+
): T => {
|
|
64
|
+
const style = originalStyle || emptyObject
|
|
65
|
+
const nextStyle = {}
|
|
66
|
+
|
|
67
|
+
for (const originalProp in style) {
|
|
68
|
+
const originalValue = style[originalProp]
|
|
69
|
+
let prop = originalProp
|
|
70
|
+
let value = originalValue
|
|
71
|
+
|
|
72
|
+
if (
|
|
73
|
+
!Object.prototype.hasOwnProperty.call(style, originalProp) ||
|
|
74
|
+
originalValue == null
|
|
75
|
+
) {
|
|
76
|
+
continue
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Convert shadow styles
|
|
80
|
+
if (
|
|
81
|
+
prop === 'shadowColor' ||
|
|
82
|
+
prop === 'shadowOffset' ||
|
|
83
|
+
prop === 'shadowOpacity' ||
|
|
84
|
+
prop === 'shadowRadius'
|
|
85
|
+
) {
|
|
86
|
+
const boxShadowValue = createBoxShadowValue(style)
|
|
87
|
+
if (boxShadowValue != null && nextStyle.boxShadow == null) {
|
|
88
|
+
const { boxShadow } = style
|
|
89
|
+
prop = 'boxShadow'
|
|
90
|
+
value = boxShadow ? `${boxShadow}, ${boxShadowValue}` : boxShadowValue
|
|
91
|
+
} else {
|
|
92
|
+
continue
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Convert text shadow styles
|
|
97
|
+
if (
|
|
98
|
+
prop === 'textShadowColor' ||
|
|
99
|
+
prop === 'textShadowOffset' ||
|
|
100
|
+
prop === 'textShadowRadius'
|
|
101
|
+
) {
|
|
102
|
+
const textShadowValue = createTextShadowValue(style)
|
|
103
|
+
if (textShadowValue != null && nextStyle.textShadow == null) {
|
|
104
|
+
const { textShadow } = style
|
|
105
|
+
prop = 'textShadow'
|
|
106
|
+
value = textShadow ? `${textShadow}, ${textShadowValue}` : textShadowValue
|
|
107
|
+
} else {
|
|
108
|
+
continue
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
nextStyle[prop] = value
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// $FlowIgnore
|
|
116
|
+
return nextStyle
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const processStyle = preprocess
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Nicolas Gallagher.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @noflow
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const invalidShortforms = {
|
|
11
|
+
background: true,
|
|
12
|
+
borderBottom: true,
|
|
13
|
+
borderLeft: true,
|
|
14
|
+
borderRight: true,
|
|
15
|
+
borderTop: true,
|
|
16
|
+
font: true,
|
|
17
|
+
grid: true,
|
|
18
|
+
outline: true,
|
|
19
|
+
textDecoration: true,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const invalidMultiValueShortforms = {
|
|
23
|
+
flex: true,
|
|
24
|
+
margin: true,
|
|
25
|
+
padding: true,
|
|
26
|
+
borderColor: true,
|
|
27
|
+
borderRadius: true,
|
|
28
|
+
borderStyle: true,
|
|
29
|
+
borderWidth: true,
|
|
30
|
+
marginHorizontal: true,
|
|
31
|
+
marginVertical: true,
|
|
32
|
+
paddingHorizontal: true,
|
|
33
|
+
paddingVertical: true,
|
|
34
|
+
overflow: true,
|
|
35
|
+
overscrollBehavior: true,
|
|
36
|
+
backgroundPosition: true,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function error(message) {
|
|
40
|
+
console.error(message)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function validate(obj: object) {
|
|
44
|
+
for (const k in obj) {
|
|
45
|
+
const prop = k.trim()
|
|
46
|
+
const value = obj[prop]
|
|
47
|
+
let isInvalid = false
|
|
48
|
+
|
|
49
|
+
if (value === null) {
|
|
50
|
+
continue
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (typeof value === 'string' && value.indexOf('!important') > -1) {
|
|
54
|
+
error(
|
|
55
|
+
`Invalid style declaration "${prop}:${value}". Values cannot include "!important"`
|
|
56
|
+
)
|
|
57
|
+
isInvalid = true
|
|
58
|
+
} else {
|
|
59
|
+
let suggestion = ''
|
|
60
|
+
if (prop === 'animation' || prop === 'animationName') {
|
|
61
|
+
suggestion = 'Did you mean "animationKeyframes"?'
|
|
62
|
+
// } else if (prop === 'boxShadow') {
|
|
63
|
+
// suggestion = 'Did you mean "shadow{Color,Offset,Opacity,Radius}"?';
|
|
64
|
+
isInvalid = true
|
|
65
|
+
} else if (prop === 'direction') {
|
|
66
|
+
suggestion = 'Did you mean "writingDirection"?'
|
|
67
|
+
isInvalid = true
|
|
68
|
+
} else if (prop === 'verticalAlign') {
|
|
69
|
+
suggestion = 'Did you mean "textAlignVertical"?'
|
|
70
|
+
isInvalid = true
|
|
71
|
+
} else if (invalidShortforms[prop]) {
|
|
72
|
+
suggestion = 'Please use long-form properties.'
|
|
73
|
+
isInvalid = true
|
|
74
|
+
} else if (invalidMultiValueShortforms[prop]) {
|
|
75
|
+
// TODO
|
|
76
|
+
// if (typeof value === 'string' && valueParser(value).nodes.length > 1) {
|
|
77
|
+
// suggestion = `Value is "${value}" but only single values are supported.`
|
|
78
|
+
// isInvalid = true
|
|
79
|
+
// }
|
|
80
|
+
}
|
|
81
|
+
if (suggestion !== '') {
|
|
82
|
+
error(`Invalid style property of "${prop}". ${suggestion}`)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (isInvalid) {
|
|
87
|
+
delete obj[k]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { Context } from 'react'
|
|
11
|
+
import { createContext } from 'react'
|
|
12
|
+
|
|
13
|
+
export const TextAncestorContext = createContext(false) as Context<boolean>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const colorProps = {
|
|
2
|
+
backgroundColor: true,
|
|
3
|
+
borderColor: true,
|
|
4
|
+
borderTopColor: true,
|
|
5
|
+
borderRightColor: true,
|
|
6
|
+
borderBottomColor: true,
|
|
7
|
+
borderLeftColor: true,
|
|
8
|
+
color: true,
|
|
9
|
+
shadowColor: true,
|
|
10
|
+
textDecorationColor: true,
|
|
11
|
+
textShadowColor: true,
|
|
12
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ColorValue,
|
|
3
|
+
DimensionValue,
|
|
4
|
+
EdgeInsetsValue,
|
|
5
|
+
GenericStyleProp,
|
|
6
|
+
LayoutEvent,
|
|
7
|
+
LayoutValue,
|
|
8
|
+
PlatformMethods,
|
|
9
|
+
PointValue,
|
|
10
|
+
} from './types'
|
|
11
|
+
export * from './modules/AssetRegistry/index'
|
|
12
|
+
export * from './modules/forwardedProps/index'
|
|
13
|
+
export * from './modules/mergeRefs/index'
|
|
14
|
+
export * from './modules/modality/index'
|
|
15
|
+
export * from './modules/useLocale/index'
|
|
16
|
+
export { usePlatformMethods } from './modules/usePlatformMethods/index'
|
|
17
|
+
export { TextAncestorContext } from './TextAncestorContext'
|
|
18
|
+
|
|
19
|
+
export * from '@hanzogui/react-native-use-pressable'
|
|
20
|
+
export * from '@hanzogui/react-native-use-responder-events'
|
|
21
|
+
|
|
22
|
+
export { colorProps } from './colorProps'
|
|
23
|
+
export { AccessibilityUtil } from './modules/AccessibilityUtil/index'
|
|
24
|
+
export { canUseDOM } from './modules/canUseDOM'
|
|
25
|
+
export { createDOMProps } from './modules/createDOMProps/index'
|
|
26
|
+
export { stylesFromProps } from './modules/createDOMProps/index'
|
|
27
|
+
export {
|
|
28
|
+
createReactDOMStyle,
|
|
29
|
+
createTransformValue,
|
|
30
|
+
} from './StyleSheet/compiler/createReactDOMStyle'
|
|
31
|
+
export { createEventHandle } from './modules/createEventHandle/index'
|
|
32
|
+
export { dismissKeyboard } from './modules/dismissKeyboard/index'
|
|
33
|
+
export { getBoundingClientRect } from './modules/getBoundingClientRect/index'
|
|
34
|
+
export { ImageLoader } from './modules/ImageLoader/index'
|
|
35
|
+
export { isSelectionValid } from './modules/isSelectionValid/index'
|
|
36
|
+
export { isWebColor } from './modules/isWebColor/index'
|
|
37
|
+
export { multiplyStyleLengthValue } from './modules/multiplyStyleLengthValue/index'
|
|
38
|
+
export { normalizeColor } from './modules/normalizeColor/index'
|
|
39
|
+
export { pick } from './modules/pick/index'
|
|
40
|
+
export { Platform } from './modules/Platform/index'
|
|
41
|
+
export * from './StyleSheet/preprocess'
|
|
42
|
+
export { flatten as flattenStyle } from './StyleSheet/index'
|
|
43
|
+
export { createSheet } from './StyleSheet/dom/index'
|
|
44
|
+
export { requestIdleCallback } from './modules/requestIdleCallback/index'
|
|
45
|
+
export { setValueForStyles } from './modules/setValueForStyles/index'
|
|
46
|
+
export { TextInputState } from './modules/TextInputState/index'
|
|
47
|
+
export { UIManager } from './modules/UIManager/index'
|
|
48
|
+
export { unitlessNumbers } from './modules/unitlessNumbers/index'
|
|
49
|
+
export { useElementLayout } from './modules/useElementLayout/index'
|
|
50
|
+
export { useEvent } from './modules/useEvent/index'
|
|
51
|
+
export { useHover } from './modules/useHover/index'
|
|
52
|
+
export { useLayoutEffectImpl as useLayoutEffect } from './modules/useLayoutEffect/index'
|
|
53
|
+
export { useStable } from './modules/useStable/index'
|
|
54
|
+
export { InteractionManager } from './modules/InteractionManager'
|
|
55
|
+
export * from './modules/invariant'
|
|
56
|
+
export { processColor } from './modules/processColor/index'
|
|
57
|
+
export { StyleSheet } from './StyleSheet/index'
|
|
58
|
+
export { useMergeRefs } from './modules/useMergeRefs/index'
|