@tamagui/react-native-web-internals 1.114.3 → 1.115.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/dist/cjs/StyleSheet/__tests__/{compiler-createReactDOMStyle-test.js → compiler-createReactDOMStyle-test.cjs} +98 -50
- package/dist/cjs/StyleSheet/__tests__/{compiler-test.js → compiler-test.cjs} +158 -129
- package/dist/cjs/StyleSheet/__tests__/{dom-createOrderedCSSStyleSheet-test.js → dom-createOrderedCSSStyleSheet-test.cjs} +23 -19
- package/dist/cjs/StyleSheet/__tests__/{index-test.js → index-test.cjs} +173 -116
- 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 +99 -0
- package/dist/cjs/StyleSheet/compiler/hash.cjs +26 -0
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +37 -0
- package/dist/cjs/StyleSheet/compiler/index.cjs +329 -0
- package/dist/cjs/StyleSheet/compiler/{normalizeColor.js → normalizeColor.cjs} +30 -20
- package/dist/cjs/StyleSheet/compiler/{normalizeValueWithProperty.js → normalizeValueWithProperty.cjs} +24 -15
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +60 -0
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +48 -0
- package/dist/cjs/StyleSheet/dom/{createOrderedCSSStyleSheet.js → createOrderedCSSStyleSheet.cjs} +36 -20
- package/dist/cjs/StyleSheet/dom/index.cjs +78 -0
- package/dist/cjs/StyleSheet/{index.js → index.cjs} +24 -19
- package/dist/cjs/StyleSheet/preprocess.cjs +112 -0
- package/dist/cjs/StyleSheet/validate.cjs +69 -0
- package/dist/cjs/TextAncestorContext.cjs +29 -0
- package/dist/cjs/{colorProps.js → colorProps.cjs} +16 -11
- package/dist/cjs/index.cjs +113 -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.js → index.cjs} +25 -15
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +27 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +69 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +48 -0
- package/dist/cjs/modules/AssetRegistry/{index.js → index.cjs} +16 -11
- package/dist/cjs/modules/ImageLoader/index.cjs +112 -0
- package/dist/cjs/modules/{InteractionManager.js → InteractionManager.cjs} +26 -20
- package/dist/cjs/modules/Platform/__tests__/index-test.cjs +48 -0
- package/dist/cjs/modules/Platform/index.cjs +31 -0
- package/dist/cjs/modules/TextInputState/{index.js → index.cjs} +23 -15
- package/dist/cjs/modules/UIManager/__tests__/{index-test.js → index-test.cjs} +56 -32
- package/dist/cjs/modules/UIManager/index.cjs +138 -0
- package/dist/cjs/modules/canUseDOM.cjs +28 -0
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +156 -0
- package/dist/cjs/modules/createDOMProps/index.cjs +138 -0
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +344 -0
- package/dist/cjs/modules/createEventHandle/{index.js → index.cjs} +38 -34
- package/dist/cjs/modules/dismissKeyboard/{index.js → index.cjs} +23 -15
- package/dist/cjs/modules/forwardedProps/index.cjs +160 -0
- package/dist/cjs/modules/getBoundingClientRect/index.cjs +29 -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 +27 -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.js → index-test.cjs} +20 -8
- package/dist/cjs/modules/modality/{index.js → index.cjs} +75 -19
- package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/{index-test.js → index-test.cjs} +16 -14
- package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +36 -0
- package/dist/cjs/modules/normalizeColor/{index.js → index.cjs} +29 -18
- package/dist/cjs/modules/pick/index.cjs +30 -0
- package/dist/cjs/modules/processColor/__tests__/{index-test.js → index-test.cjs} +17 -15
- package/dist/cjs/modules/processColor/{index.js → index.cjs} +25 -19
- package/dist/cjs/modules/requestIdleCallback/index.cjs +56 -0
- package/dist/cjs/modules/setValueForStyles/{dangerousStyleValue.js → dangerousStyleValue.cjs} +23 -15
- package/dist/cjs/modules/setValueForStyles/{index.js → index.cjs} +26 -18
- package/dist/cjs/modules/unitlessNumbers/index.cjs +87 -0
- package/dist/cjs/modules/useElementLayout/{index.js → index.cjs} +40 -23
- package/dist/cjs/modules/useEvent/__tests__/{index-test.js → index-test.cjs} +218 -99
- package/dist/cjs/modules/useEvent/index.cjs +56 -0
- package/dist/cjs/modules/useHover/__tests__/{index-test.js → index-test.cjs} +118 -40
- package/dist/cjs/modules/useHover/index.cjs +108 -0
- package/dist/cjs/modules/useLayoutEffect/{index.js → index.cjs} +24 -15
- package/dist/cjs/modules/useLocale/index.cjs +66 -0
- package/dist/cjs/modules/useLocale/{isLocaleRTL.js → isLocaleRTL.cjs} +23 -31
- 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 +48 -0
- package/dist/cjs/modules/useStable/__tests__/{index-test.js → index-test.cjs} +46 -23
- package/dist/cjs/modules/useStable/{index.js → index.cjs} +22 -14
- package/dist/cjs/styleTypes.cjs +16 -0
- package/dist/cjs/types.cjs +16 -0
- package/package.json +9 -8
- package/dist/cjs/StyleSheet/__tests__/preprocess-test.js +0 -77
- package/dist/cjs/StyleSheet/__tests__/validate-test.js +0 -18
- package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.js +0 -121
- package/dist/cjs/StyleSheet/compiler/hash.js +0 -21
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.js +0 -31
- package/dist/cjs/StyleSheet/compiler/index.js +0 -253
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.js +0 -35
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.js +0 -44
- package/dist/cjs/StyleSheet/dom/index.js +0 -74
- package/dist/cjs/StyleSheet/preprocess.js +0 -67
- package/dist/cjs/StyleSheet/validate.js +0 -66
- package/dist/cjs/TextAncestorContext.js +0 -24
- package/dist/cjs/index.js +0 -73
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.js +0 -46
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.js +0 -30
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.js +0 -22
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.js +0 -60
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.js +0 -43
- package/dist/cjs/modules/ImageLoader/index.js +0 -102
- package/dist/cjs/modules/Platform/__tests__/index-test.js +0 -46
- package/dist/cjs/modules/Platform/index.js +0 -26
- package/dist/cjs/modules/UIManager/index.js +0 -101
- package/dist/cjs/modules/canUseDOM.js +0 -23
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.js +0 -106
- package/dist/cjs/modules/createDOMProps/index.js +0 -121
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.js +0 -242
- package/dist/cjs/modules/forwardedProps/index.js +0 -145
- package/dist/cjs/modules/getBoundingClientRect/index.js +0 -25
- package/dist/cjs/modules/invariant.js +0 -35
- package/dist/cjs/modules/isSelectionValid/index.js +0 -27
- package/dist/cjs/modules/isWebColor/index.js +0 -22
- package/dist/cjs/modules/mergeRefs/__tests__/index-test.js +0 -34
- package/dist/cjs/modules/mergeRefs/index.js +0 -41
- package/dist/cjs/modules/multiplyStyleLengthValue/index.js +0 -28
- package/dist/cjs/modules/pick/index.js +0 -26
- package/dist/cjs/modules/requestIdleCallback/index.js +0 -44
- package/dist/cjs/modules/unitlessNumbers/index.js +0 -80
- package/dist/cjs/modules/useEvent/index.js +0 -45
- package/dist/cjs/modules/useHover/index.js +0 -81
- package/dist/cjs/modules/useLocale/index.js +0 -54
- package/dist/cjs/modules/useMergeRefs/__tests__/index-test.js +0 -68
- package/dist/cjs/modules/useMergeRefs/index.js +0 -36
- package/dist/cjs/modules/usePlatformMethods/index.js +0 -39
- package/dist/cjs/styleTypes.js +0 -14
- package/dist/cjs/types.js +0 -14
- /package/dist/cjs/StyleSheet/__tests__/{compiler-createReactDOMStyle-test.js.map → compiler-createReactDOMStyle-test.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{compiler-test.js.map → compiler-test.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{dom-createOrderedCSSStyleSheet-test.js.map → dom-createOrderedCSSStyleSheet-test.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{preprocess-test.js.map → preprocess-test.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{validate-test.js.map → validate-test.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{createReactDOMStyle.js.map → createReactDOMStyle.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{hash.js.map → hash.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{hyphenateStyleName.js.map → hyphenateStyleName.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{normalizeColor.js.map → normalizeColor.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{normalizeValueWithProperty.js.map → normalizeValueWithProperty.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{resolveShadowValue.js.map → resolveShadowValue.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{createCSSStyleSheet.js.map → createCSSStyleSheet.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{createOrderedCSSStyleSheet.js.map → createOrderedCSSStyleSheet.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/{preprocess.js.map → preprocess.cjs.map} +0 -0
- /package/dist/cjs/StyleSheet/{validate.js.map → validate.cjs.map} +0 -0
- /package/dist/cjs/{TextAncestorContext.js.map → TextAncestorContext.cjs.map} +0 -0
- /package/dist/cjs/{colorProps.js.map → colorProps.cjs.map} +0 -0
- /package/dist/cjs/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/__tests__/{propsToAccessibilityComponent-test.js.map → propsToAccessibilityComponent-test.cjs.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/__tests__/{propsToAriaRole-test.js.map → propsToAriaRole-test.cjs.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{isDisabled.js.map → isDisabled.cjs.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{propsToAccessibilityComponent.js.map → propsToAccessibilityComponent.cjs.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{propsToAriaRole.js.map → propsToAriaRole.cjs.map} +0 -0
- /package/dist/cjs/modules/AssetRegistry/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/ImageLoader/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/{InteractionManager.js.map → InteractionManager.cjs.map} +0 -0
- /package/dist/cjs/modules/Platform/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/Platform/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/TextInputState/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/UIManager/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/UIManager/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/{canUseDOM.js.map → canUseDOM.cjs.map} +0 -0
- /package/dist/cjs/modules/createDOMProps/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/createDOMProps/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/createEventHandle/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/createEventHandle/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/dismissKeyboard/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/forwardedProps/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/getBoundingClientRect/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/{invariant.js.map → invariant.cjs.map} +0 -0
- /package/dist/cjs/modules/isSelectionValid/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/isWebColor/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/mergeRefs/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/mergeRefs/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/modality/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/modality/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/multiplyStyleLengthValue/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/normalizeColor/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/pick/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/processColor/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/processColor/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/requestIdleCallback/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/setValueForStyles/{dangerousStyleValue.js.map → dangerousStyleValue.cjs.map} +0 -0
- /package/dist/cjs/modules/setValueForStyles/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/unitlessNumbers/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useElementLayout/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useEvent/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/useEvent/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useHover/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/useHover/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useLayoutEffect/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useLocale/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useLocale/{isLocaleRTL.js.map → isLocaleRTL.cjs.map} +0 -0
- /package/dist/cjs/modules/useMergeRefs/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/useMergeRefs/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/usePlatformMethods/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/modules/useStable/__tests__/{index-test.js.map → index-test.cjs.map} +0 -0
- /package/dist/cjs/modules/useStable/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/{styleTypes.js.map → styleTypes.cjs.map} +0 -0
- /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
15
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
16
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
17
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
18
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
19
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: !0
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
var import_react = require("@testing-library/react"),
|
|
24
|
+
React = __toESM(require("react")),
|
|
25
|
+
import_test_utils = require("react-dom/test-utils"),
|
|
26
|
+
import__ = __toESM(require("../index.cjs")),
|
|
27
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
describe("modules/useMergeRefs/index.js", () => {
|
|
29
|
+
function TestComponent({
|
|
30
|
+
refs,
|
|
31
|
+
...rest
|
|
32
|
+
}) {
|
|
33
|
+
const mergedRef = (0, import__.default)(...refs);
|
|
34
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)("div", {
|
|
35
|
+
ref: mergedRef,
|
|
36
|
+
...rest
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
afterEach(import_react.cleanup), test("handles no refs", () => {
|
|
40
|
+
(0, import_test_utils.act)(() => {
|
|
41
|
+
(0, import_react.render)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
42
|
+
refs: []
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
}), test("merges any number of varying refs", () => {
|
|
46
|
+
const callbackRef1 = jest.fn(),
|
|
47
|
+
callbackRef2 = jest.fn(),
|
|
48
|
+
objectRef1 = React.createRef(),
|
|
49
|
+
objectRef2 = React.createRef(),
|
|
50
|
+
nullRef = null;
|
|
51
|
+
(0, import_test_utils.act)(() => {
|
|
52
|
+
(0, import_react.render)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
53
|
+
refs: [callbackRef1, callbackRef2, objectRef1, objectRef2, nullRef]
|
|
54
|
+
}));
|
|
55
|
+
}), expect(callbackRef1).toHaveBeenCalledTimes(1), expect(callbackRef2).toHaveBeenCalledTimes(1), expect(objectRef1.current).toBeInstanceOf(HTMLDivElement), expect(objectRef2.current).toBeInstanceOf(HTMLDivElement);
|
|
56
|
+
}), test("ref is called when ref changes", () => {
|
|
57
|
+
const ref = jest.fn(),
|
|
58
|
+
nextRef = jest.fn();
|
|
59
|
+
let rerender;
|
|
60
|
+
(0, import_test_utils.act)(() => {
|
|
61
|
+
({
|
|
62
|
+
rerender
|
|
63
|
+
} = (0, import_react.render)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
64
|
+
refs: [ref]
|
|
65
|
+
})));
|
|
66
|
+
}), expect(ref).toHaveBeenCalled(), (0, import_test_utils.act)(() => {
|
|
67
|
+
rerender(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
68
|
+
refs: [nextRef]
|
|
69
|
+
}));
|
|
70
|
+
}), expect(nextRef).toHaveBeenCalled();
|
|
71
|
+
}), test("ref is not called for each rerender", () => {
|
|
72
|
+
const ref = jest.fn();
|
|
73
|
+
let rerender;
|
|
74
|
+
(0, import_test_utils.act)(() => {
|
|
75
|
+
({
|
|
76
|
+
rerender
|
|
77
|
+
} = (0, import_react.render)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
78
|
+
refs: [ref]
|
|
79
|
+
})));
|
|
80
|
+
}), expect(ref).toHaveBeenCalledTimes(1), (0, import_test_utils.act)(() => {
|
|
81
|
+
rerender(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
82
|
+
refs: [ref]
|
|
83
|
+
}));
|
|
84
|
+
}), expect(ref).toHaveBeenCalledTimes(1);
|
|
85
|
+
}), test("ref is not called for props changes", () => {
|
|
86
|
+
const ref = jest.fn();
|
|
87
|
+
let rerender;
|
|
88
|
+
(0, import_test_utils.act)(() => {
|
|
89
|
+
({
|
|
90
|
+
rerender
|
|
91
|
+
} = (0, import_react.render)(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
92
|
+
id: "foo",
|
|
93
|
+
refs: [ref]
|
|
94
|
+
})));
|
|
95
|
+
}), expect(ref).toHaveBeenCalledTimes(1), (0, import_test_utils.act)(() => {
|
|
96
|
+
rerender(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
97
|
+
id: "bar",
|
|
98
|
+
refs: [ref]
|
|
99
|
+
}));
|
|
100
|
+
}), expect(ref).toHaveBeenCalledTimes(1);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var useMergeRefs_exports = {};
|
|
33
|
+
__export(useMergeRefs_exports, {
|
|
34
|
+
useMergeRefs: () => useMergeRefs
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(useMergeRefs_exports);
|
|
37
|
+
var React = __toESM(require("react")),
|
|
38
|
+
import_mergeRefs = require("../mergeRefs/index.cjs");
|
|
39
|
+
function useMergeRefs(...args) {
|
|
40
|
+
return React.useMemo(() => (0, import_mergeRefs.mergeRefs)(...args),
|
|
41
|
+
// eslint-disable-next-line
|
|
42
|
+
[...args]);
|
|
43
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var usePlatformMethods_exports = {};
|
|
33
|
+
__export(usePlatformMethods_exports, {
|
|
34
|
+
default: () => usePlatformMethods_default,
|
|
35
|
+
usePlatformMethods: () => usePlatformMethods
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(usePlatformMethods_exports);
|
|
38
|
+
var import_UIManager = __toESM(require("../UIManager/index.cjs")),
|
|
39
|
+
import_useStable = __toESM(require("../useStable/index.cjs"));
|
|
40
|
+
function usePlatformMethods({
|
|
41
|
+
pointerEvents,
|
|
42
|
+
style
|
|
43
|
+
}) {
|
|
44
|
+
return (0, import_useStable.default)(() => hostNode => {
|
|
45
|
+
hostNode != null && (hostNode.measure = callback => import_UIManager.default.measure(hostNode, callback), hostNode.measureLayout = (relativeToNode, success, failure) => import_UIManager.default.measureLayout(hostNode, relativeToNode, failure, success), hostNode.measureInWindow = callback => import_UIManager.default.measureInWindow(hostNode, callback));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var usePlatformMethods_default = usePlatformMethods;
|
|
@@ -2,22 +2,28 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
|
+
get: () => from[key],
|
|
10
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
11
|
+
});
|
|
10
12
|
return to;
|
|
11
13
|
};
|
|
12
14
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
mod
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
16
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
17
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
18
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
19
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: !0
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
var ReactDOM = __toESM(require("react-dom")),
|
|
24
|
+
import_test_utils = require("react-dom/test-utils"),
|
|
25
|
+
import__ = __toESM(require("../index.cjs")),
|
|
26
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
21
27
|
function createRoot(rootNode) {
|
|
22
28
|
return {
|
|
23
29
|
render(element) {
|
|
@@ -26,8 +32,12 @@ function createRoot(rootNode) {
|
|
|
26
32
|
};
|
|
27
33
|
}
|
|
28
34
|
describe("useStable", () => {
|
|
29
|
-
let root,
|
|
30
|
-
|
|
35
|
+
let root,
|
|
36
|
+
rootNode,
|
|
37
|
+
spy = {};
|
|
38
|
+
const TestComponent = ({
|
|
39
|
+
initialValueCallback
|
|
40
|
+
}) => {
|
|
31
41
|
const value = (0, import__.default)(initialValueCallback);
|
|
32
42
|
return spy.value = value, null;
|
|
33
43
|
};
|
|
@@ -38,32 +48,45 @@ describe("useStable", () => {
|
|
|
38
48
|
}), test("correctly sets the initial value", () => {
|
|
39
49
|
const initialValueCallback = () => 5;
|
|
40
50
|
(0, import_test_utils.act)(() => {
|
|
41
|
-
root.render(/* @__PURE__ */
|
|
51
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
52
|
+
initialValueCallback
|
|
53
|
+
}));
|
|
42
54
|
}), expect(spy.value).toBe(5);
|
|
43
55
|
}), test("does not change the value", () => {
|
|
44
56
|
let counter = 0;
|
|
45
57
|
const initialValueCallback = () => counter++;
|
|
46
58
|
(0, import_test_utils.act)(() => {
|
|
47
|
-
root.render(/* @__PURE__ */
|
|
59
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
60
|
+
initialValueCallback
|
|
61
|
+
}));
|
|
48
62
|
}), expect(spy.value).toBe(0), (0, import_test_utils.act)(() => {
|
|
49
|
-
root.render(/* @__PURE__ */
|
|
63
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
64
|
+
initialValueCallback
|
|
65
|
+
}));
|
|
50
66
|
}), expect(spy.value).toBe(0);
|
|
51
67
|
}), test("only calls the callback once", () => {
|
|
52
68
|
let counter = 0;
|
|
53
69
|
const initialValueCallback = () => counter++;
|
|
54
70
|
(0, import_test_utils.act)(() => {
|
|
55
|
-
root.render(/* @__PURE__ */
|
|
71
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
72
|
+
initialValueCallback
|
|
73
|
+
}));
|
|
56
74
|
}), expect(counter).toBe(1), (0, import_test_utils.act)(() => {
|
|
57
|
-
root.render(/* @__PURE__ */
|
|
75
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
76
|
+
initialValueCallback
|
|
77
|
+
}));
|
|
58
78
|
}), expect(counter).toBe(1);
|
|
59
79
|
}), test("does not change the value if the callback initially returns null", () => {
|
|
60
80
|
let counter = 0;
|
|
61
81
|
const initialValueCallback = () => counter === 0 ? (counter++, null) : counter++;
|
|
62
82
|
(0, import_test_utils.act)(() => {
|
|
63
|
-
root.render(/* @__PURE__ */
|
|
83
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
84
|
+
initialValueCallback
|
|
85
|
+
}));
|
|
64
86
|
}), expect(spy.value).toBe(null), (0, import_test_utils.act)(() => {
|
|
65
|
-
root.render(/* @__PURE__ */
|
|
87
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(TestComponent, {
|
|
88
|
+
initialValueCallback
|
|
89
|
+
}));
|
|
66
90
|
}), expect(spy.value).toBe(null);
|
|
67
91
|
});
|
|
68
|
-
});
|
|
69
|
-
//# sourceMappingURL=index-test.js.map
|
|
92
|
+
});
|
|
@@ -2,24 +2,33 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf,
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
15
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
18
23
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
24
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
23
32
|
var useStable_exports = {};
|
|
24
33
|
__export(useStable_exports, {
|
|
25
34
|
default: () => useStable
|
|
@@ -30,5 +39,4 @@ const UNINITIALIZED = typeof Symbol == "function" && typeof Symbol() == "symbol"
|
|
|
30
39
|
function useStable(getInitialValue) {
|
|
31
40
|
const ref = React.useRef(UNINITIALIZED);
|
|
32
41
|
return ref.current === UNINITIALIZED && (ref.current = getInitialValue()), ref.current;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
|
+
get: () => from[key],
|
|
8
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
|
+
});
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
13
|
+
value: !0
|
|
14
|
+
}), mod);
|
|
15
|
+
var styleTypes_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(styleTypes_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
|
+
get: () => from[key],
|
|
8
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
9
|
+
});
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
13
|
+
value: !0
|
|
14
|
+
}), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/react-native-web-internals",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.115.0",
|
|
4
4
|
"description": "React Native for Web",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -24,19 +24,20 @@
|
|
|
24
24
|
"react-native": "./dist/cjs/index.native.js",
|
|
25
25
|
"types": "./types/index.d.ts",
|
|
26
26
|
"import": "./dist/esm/index.mjs",
|
|
27
|
-
"require": "./dist/cjs/index.
|
|
27
|
+
"require": "./dist/cjs/index.cjs",
|
|
28
|
+
"default": "./dist/cjs/index.native.js"
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@tamagui/normalize-css-color": "1.
|
|
32
|
-
"@tamagui/react-native-use-pressable": "1.
|
|
33
|
-
"@tamagui/react-native-use-responder-events": "1.
|
|
34
|
-
"@tamagui/simple-hash": "1.
|
|
35
|
-
"@tamagui/web": "1.
|
|
32
|
+
"@tamagui/normalize-css-color": "1.115.0",
|
|
33
|
+
"@tamagui/react-native-use-pressable": "1.115.0",
|
|
34
|
+
"@tamagui/react-native-use-responder-events": "1.115.0",
|
|
35
|
+
"@tamagui/simple-hash": "1.115.0",
|
|
36
|
+
"@tamagui/web": "1.115.0",
|
|
36
37
|
"react": "^18.2.0 || ^19.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "1.
|
|
40
|
+
"@tamagui/build": "1.115.0"
|
|
40
41
|
},
|
|
41
42
|
"license": "MIT",
|
|
42
43
|
"tags": [
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
var import_preprocess = require("../preprocess");
|
|
2
|
-
describe("StyleSheet/preprocess", () => {
|
|
3
|
-
describe("preprocesses multiple shadow styles into a single declaration", () => {
|
|
4
|
-
test("shadowColor only", () => {
|
|
5
|
-
expect((0, import_preprocess.preprocess)({ shadowColor: "red" })).toEqual({
|
|
6
|
-
boxShadow: "0px 0px 0px rgba(255,0,0,1.00)"
|
|
7
|
-
});
|
|
8
|
-
}), test("shadowColor and shadowOpacity only", () => {
|
|
9
|
-
expect((0, import_preprocess.preprocess)({ shadowColor: "red", shadowOpacity: 0.5 })).toEqual({
|
|
10
|
-
boxShadow: "0px 0px 0px rgba(255,0,0,0.50)"
|
|
11
|
-
});
|
|
12
|
-
}), test("shadowOffset only", () => {
|
|
13
|
-
expect((0, import_preprocess.preprocess)({ shadowOffset: { width: 1, height: 2 } })).toEqual({
|
|
14
|
-
boxShadow: "1px 2px 0px rgba(0,0,0,1.00)"
|
|
15
|
-
});
|
|
16
|
-
}), test("shadowRadius only", () => {
|
|
17
|
-
expect((0, import_preprocess.preprocess)({ shadowRadius: 5 })).toEqual({
|
|
18
|
-
boxShadow: "0px 0px 5px rgba(0,0,0,1.00)"
|
|
19
|
-
});
|
|
20
|
-
}), test("shadowOffset, shadowRadius, shadowColor", () => {
|
|
21
|
-
expect(
|
|
22
|
-
(0, import_preprocess.preprocess)({
|
|
23
|
-
shadowColor: "rgba(50,60,70,0.5)",
|
|
24
|
-
shadowOffset: { width: 1, height: 2 },
|
|
25
|
-
shadowOpacity: 0.5,
|
|
26
|
-
shadowRadius: 3
|
|
27
|
-
})
|
|
28
|
-
).toEqual({
|
|
29
|
-
boxShadow: "1px 2px 3px rgba(50,60,70,0.25)"
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
}), describe("preprocesses multiple textShadow styles into a single declaration", () => {
|
|
33
|
-
test("textShadowColor only", () => {
|
|
34
|
-
expect((0, import_preprocess.preprocess)({ textShadowColor: "red" })).toEqual({});
|
|
35
|
-
}), test("textShadowOffset only", () => {
|
|
36
|
-
expect((0, import_preprocess.preprocess)({ textShadowOffset: { width: 1, height: 2 } })).toEqual({});
|
|
37
|
-
}), test("textShadowRadius only", () => {
|
|
38
|
-
expect((0, import_preprocess.preprocess)({ textShadowRadius: 5 })).toEqual({});
|
|
39
|
-
}), test("textShadowColor and textShadowOffset only", () => {
|
|
40
|
-
expect(
|
|
41
|
-
(0, import_preprocess.preprocess)({
|
|
42
|
-
textShadowColor: "red",
|
|
43
|
-
textShadowOffset: { width: 0, height: 0 }
|
|
44
|
-
})
|
|
45
|
-
).toEqual({}), expect(
|
|
46
|
-
(0, import_preprocess.preprocess)({
|
|
47
|
-
textShadowColor: "red",
|
|
48
|
-
textShadowOffset: { width: -1, height: 0 }
|
|
49
|
-
})
|
|
50
|
-
).toEqual({
|
|
51
|
-
textShadow: "-1px 0px 0px rgba(255,0,0,1.00)"
|
|
52
|
-
}), expect(
|
|
53
|
-
(0, import_preprocess.preprocess)({
|
|
54
|
-
textShadowColor: "red",
|
|
55
|
-
textShadowOffset: { width: 1, height: 2 }
|
|
56
|
-
})
|
|
57
|
-
).toEqual({
|
|
58
|
-
textShadow: "1px 2px 0px rgba(255,0,0,1.00)"
|
|
59
|
-
});
|
|
60
|
-
}), test("textShadowColor and textShadowRadius only", () => {
|
|
61
|
-
expect((0, import_preprocess.preprocess)({ textShadowColor: "red", textShadowRadius: 0 })).toEqual({}), expect((0, import_preprocess.preprocess)({ textShadowColor: "red", textShadowRadius: 5 })).toEqual({
|
|
62
|
-
textShadow: "0px 0px 5px rgba(255,0,0,1.00)"
|
|
63
|
-
});
|
|
64
|
-
}), test("textShadowColor, textShadowOffset, textShadowRadius", () => {
|
|
65
|
-
expect(
|
|
66
|
-
(0, import_preprocess.preprocess)({
|
|
67
|
-
textShadowColor: "rgba(50,60,70,0.50)",
|
|
68
|
-
textShadowOffset: { width: 5, height: 10 },
|
|
69
|
-
textShadowRadius: 15
|
|
70
|
-
})
|
|
71
|
-
).toEqual({
|
|
72
|
-
textShadow: "5px 10px 15px rgba(50,60,70,0.50)"
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
//# sourceMappingURL=preprocess-test.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var import_validate = require("../validate");
|
|
2
|
-
describe("validate", () => {
|
|
3
|
-
beforeAll(() => {
|
|
4
|
-
jest.spyOn(console, "error").mockImplementation(() => {
|
|
5
|
-
});
|
|
6
|
-
}), afterAll(() => {
|
|
7
|
-
console.error.mockRestore();
|
|
8
|
-
}), afterEach(() => {
|
|
9
|
-
console.error.mockClear();
|
|
10
|
-
}), test("invalid shortform properties", () => {
|
|
11
|
-
(0, import_validate.validate)({ background: "red" }), (0, import_validate.validate)({ font: "arial" }), (0, import_validate.validate)({ borderTop: "1px solid red" }), expect(console.error).toHaveBeenCalled();
|
|
12
|
-
}), test("valid shortform values", () => {
|
|
13
|
-
(0, import_validate.validate)({ flex: 1 }), (0, import_validate.validate)({ margin: 10 }), (0, import_validate.validate)({ margin: "calc(10 * 1px)" }), (0, import_validate.validate)({ margin: "calc(10 * calc(10 * 1px))" }), expect(console.error).not.toHaveBeenCalled();
|
|
14
|
-
}), test("invalid shortform multi-values", () => {
|
|
15
|
-
(0, import_validate.validate)({ flex: "1 1 25%" }), (0, import_validate.validate)({ margin: "10px 20px" }), (0, import_validate.validate)({ margin: "calc(10 * 1px) var(--test)" }), expect(console.error).toHaveBeenCalledTimes(3);
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=validate-test.js.map
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
return to;
|
|
14
|
-
};
|
|
15
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
-
mod
|
|
22
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
-
var createReactDOMStyle_exports = {};
|
|
24
|
-
__export(createReactDOMStyle_exports, {
|
|
25
|
-
createTransformValue: () => createTransformValue,
|
|
26
|
-
default: () => createReactDOMStyle_default
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(createReactDOMStyle_exports);
|
|
29
|
-
var import_canUseDOM = __toESM(require("../../modules/canUseDOM")), import_normalizeValueWithProperty = __toESM(require("./normalizeValueWithProperty"));
|
|
30
|
-
const emptyObject = {}, supportsCSS3TextDecoration = !import_canUseDOM.default || window.CSS != null && window.CSS.supports != null && (window.CSS.supports("text-decoration-line", "none") || window.CSS.supports("-webkit-text-decoration-line", "none")), ignoredProps = {
|
|
31
|
-
elevation: !0,
|
|
32
|
-
overlayColor: !0,
|
|
33
|
-
resizeMode: !0,
|
|
34
|
-
tintColor: !0
|
|
35
|
-
}, MONOSPACE_FONT_STACK = "monospace,monospace", SYSTEM_FONT_STACK = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif', STYLE_SHORT_FORM_EXPANSIONS = {
|
|
36
|
-
borderColor: [
|
|
37
|
-
"borderTopColor",
|
|
38
|
-
"borderRightColor",
|
|
39
|
-
"borderBottomColor",
|
|
40
|
-
"borderLeftColor"
|
|
41
|
-
],
|
|
42
|
-
borderRadius: [
|
|
43
|
-
"borderTopLeftRadius",
|
|
44
|
-
"borderTopRightRadius",
|
|
45
|
-
"borderBottomRightRadius",
|
|
46
|
-
"borderBottomLeftRadius"
|
|
47
|
-
],
|
|
48
|
-
borderStyle: [
|
|
49
|
-
"borderTopStyle",
|
|
50
|
-
"borderRightStyle",
|
|
51
|
-
"borderBottomStyle",
|
|
52
|
-
"borderLeftStyle"
|
|
53
|
-
],
|
|
54
|
-
borderWidth: [
|
|
55
|
-
"borderTopWidth",
|
|
56
|
-
"borderRightWidth",
|
|
57
|
-
"borderBottomWidth",
|
|
58
|
-
"borderLeftWidth"
|
|
59
|
-
],
|
|
60
|
-
marginHorizontal: ["marginRight", "marginLeft"],
|
|
61
|
-
marginVertical: ["marginTop", "marginBottom"],
|
|
62
|
-
overflow: ["overflowX", "overflowY"],
|
|
63
|
-
overscrollBehavior: ["overscrollBehaviorX", "overscrollBehaviorY"],
|
|
64
|
-
paddingHorizontal: ["paddingRight", "paddingLeft"],
|
|
65
|
-
paddingVertical: ["paddingTop", "paddingBottom"]
|
|
66
|
-
}, mapTransform = (transform) => {
|
|
67
|
-
const type = Object.keys(transform)[0], value = transform[type];
|
|
68
|
-
if (type === "matrix" || type === "matrix3d")
|
|
69
|
-
return `${type}(${value.join(",")})`;
|
|
70
|
-
{
|
|
71
|
-
const normalizedValue = (0, import_normalizeValueWithProperty.default)(value, type);
|
|
72
|
-
return `${type}(${normalizedValue})`;
|
|
73
|
-
}
|
|
74
|
-
}, createTransformValue = (style) => {
|
|
75
|
-
let transform = style.transform;
|
|
76
|
-
return Array.isArray(style.transform) && (transform = style.transform.map(mapTransform).join(" ")), transform;
|
|
77
|
-
}, createReactDOMStyle = (style, isInline) => {
|
|
78
|
-
if (!style)
|
|
79
|
-
return emptyObject;
|
|
80
|
-
const resolvedStyle = {};
|
|
81
|
-
for (const prop in style) {
|
|
82
|
-
const value = style[prop];
|
|
83
|
-
if (
|
|
84
|
-
// Ignore everything with a null value
|
|
85
|
-
!(value == null || // Ignore some React Native styles
|
|
86
|
-
ignoredProps[prop])
|
|
87
|
-
)
|
|
88
|
-
if (prop === "aspectRatio")
|
|
89
|
-
resolvedStyle[prop] = value.toString();
|
|
90
|
-
else if (prop === "backgroundClip")
|
|
91
|
-
value === "text" && (resolvedStyle.backgroundClip = value, resolvedStyle.WebkitBackgroundClip = value);
|
|
92
|
-
else if (prop === "flex")
|
|
93
|
-
value === -1 ? (resolvedStyle.flexGrow = 0, resolvedStyle.flexShrink = 1, resolvedStyle.flexBasis = "auto") : resolvedStyle.flex = value;
|
|
94
|
-
else if (prop === "font")
|
|
95
|
-
resolvedStyle[prop] = value.replace("System", SYSTEM_FONT_STACK);
|
|
96
|
-
else if (prop === "fontFamily")
|
|
97
|
-
if (value.indexOf("System") > -1) {
|
|
98
|
-
const stack = value.split(/,\s*/);
|
|
99
|
-
stack[stack.indexOf("System")] = SYSTEM_FONT_STACK, resolvedStyle[prop] = stack.join(",");
|
|
100
|
-
} else value === "monospace" ? resolvedStyle[prop] = MONOSPACE_FONT_STACK : resolvedStyle[prop] = value;
|
|
101
|
-
else if (prop === "fontVariant")
|
|
102
|
-
Array.isArray(value) && value.length > 0 && (resolvedStyle.fontVariant = value.join(" "));
|
|
103
|
-
else if (prop === "textAlignVertical")
|
|
104
|
-
resolvedStyle.verticalAlign = value === "center" ? "middle" : value;
|
|
105
|
-
else if (prop === "textDecorationLine")
|
|
106
|
-
supportsCSS3TextDecoration ? resolvedStyle.textDecorationLine = value : resolvedStyle.textDecoration = value;
|
|
107
|
-
else if (prop === "transform" || prop === "transformMatrix")
|
|
108
|
-
resolvedStyle.transform = createTransformValue(style);
|
|
109
|
-
else if (prop === "writingDirection")
|
|
110
|
-
resolvedStyle.direction = value;
|
|
111
|
-
else {
|
|
112
|
-
const value2 = (0, import_normalizeValueWithProperty.default)(style[prop], prop), longFormProperties = STYLE_SHORT_FORM_EXPANSIONS[prop];
|
|
113
|
-
isInline && prop === "margin" ? (style.marginHorizontal == null && (resolvedStyle.marginLeft = value2, resolvedStyle.marginRight = value2), style.marginVertical == null && (resolvedStyle.marginTop = value2, resolvedStyle.marginBottom = value2)) : isInline && prop === "padding" ? (style.paddingHorizontal == null && (resolvedStyle.paddingLeft = value2, resolvedStyle.paddingRight = value2), style.paddingVertical == null && (resolvedStyle.paddingTop = value2, resolvedStyle.paddingBottom = value2)) : longFormProperties ? longFormProperties.forEach((longForm, i) => {
|
|
114
|
-
style[longForm] == null && (resolvedStyle[longForm] = value2);
|
|
115
|
-
}) : resolvedStyle[prop] = Array.isArray(value2) ? value2.join(",") : value2;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return resolvedStyle;
|
|
119
|
-
};
|
|
120
|
-
var createReactDOMStyle_default = createReactDOMStyle;
|
|
121
|
-
//# sourceMappingURL=createReactDOMStyle.js.map
|