@tamagui/react-native-web-internals 1.116.0 → 1.116.2
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 +192 -0
- package/dist/cjs/StyleSheet/__tests__/compiler-test.js +378 -0
- package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.js +117 -0
- package/dist/cjs/StyleSheet/__tests__/index-test.js +347 -0
- package/dist/cjs/StyleSheet/__tests__/preprocess-test.js +77 -0
- package/dist/cjs/StyleSheet/__tests__/validate-test.js +18 -0
- package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.js +121 -0
- package/dist/cjs/StyleSheet/compiler/hash.js +21 -0
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.js +31 -0
- package/dist/cjs/StyleSheet/compiler/index.js +253 -0
- package/dist/cjs/StyleSheet/compiler/normalizeColor.js +42 -0
- package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.js +45 -0
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.js +35 -0
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.js +44 -0
- package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.js +94 -0
- package/dist/cjs/StyleSheet/dom/index.js +74 -0
- package/dist/cjs/StyleSheet/index.js +52 -0
- package/dist/cjs/StyleSheet/preprocess.js +67 -0
- package/dist/cjs/StyleSheet/validate.js +66 -0
- package/dist/cjs/TextAncestorContext.js +24 -0
- package/dist/cjs/colorProps.js +32 -0
- package/dist/cjs/index.js +73 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.js +46 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.js +30 -0
- package/dist/cjs/modules/AccessibilityUtil/index.js +36 -0
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.js +22 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.js +60 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.js +43 -0
- package/dist/cjs/modules/AssetRegistry/index.js +28 -0
- package/dist/cjs/modules/ImageLoader/index.js +102 -0
- package/dist/cjs/modules/InteractionManager.js +68 -0
- package/dist/cjs/modules/Platform/__tests__/index-test.js +46 -0
- package/dist/cjs/modules/Platform/index.js +26 -0
- package/dist/cjs/modules/TextInputState/index.js +59 -0
- package/dist/cjs/modules/UIManager/__tests__/index-test.js +66 -0
- package/dist/cjs/modules/UIManager/index.js +101 -0
- package/dist/cjs/modules/canUseDOM.js +23 -0
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.js +106 -0
- package/dist/cjs/modules/createDOMProps/index.js +121 -0
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.js +242 -0
- package/dist/cjs/modules/createEventHandle/index.js +74 -0
- package/dist/cjs/modules/dismissKeyboard/index.js +33 -0
- package/dist/cjs/modules/forwardedProps/index.js +145 -0
- package/dist/cjs/modules/getBoundingClientRect/index.js +25 -0
- package/dist/cjs/modules/invariant.js +35 -0
- package/dist/cjs/modules/isSelectionValid/index.js +27 -0
- package/dist/cjs/modules/isWebColor/index.js +22 -0
- package/dist/cjs/modules/mergeRefs/__tests__/index-test.js +34 -0
- package/dist/cjs/modules/mergeRefs/index.js +41 -0
- package/dist/cjs/modules/modality/__tests__/index-test.js +20 -0
- package/dist/cjs/modules/modality/index.js +90 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.js +28 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/index.js +28 -0
- package/dist/cjs/modules/normalizeColor/index.js +40 -0
- package/dist/cjs/modules/pick/index.js +26 -0
- package/dist/cjs/modules/processColor/__tests__/index-test.js +64 -0
- package/dist/cjs/modules/processColor/index.js +36 -0
- package/dist/cjs/modules/requestIdleCallback/index.js +44 -0
- package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.js +34 -0
- package/dist/cjs/modules/setValueForStyles/index.js +39 -0
- package/dist/cjs/modules/unitlessNumbers/index.js +80 -0
- package/dist/cjs/modules/useElementLayout/index.js +65 -0
- package/dist/cjs/modules/useEvent/__tests__/index-test.js +289 -0
- package/dist/cjs/modules/useEvent/index.js +45 -0
- package/dist/cjs/modules/useHover/__tests__/index-test.js +195 -0
- package/dist/cjs/modules/useHover/index.js +81 -0
- package/dist/cjs/modules/useLayoutEffect/index.js +31 -0
- package/dist/cjs/modules/useLocale/index.js +54 -0
- package/dist/cjs/modules/useLocale/isLocaleRTL.js +91 -0
- package/dist/cjs/modules/useMergeRefs/__tests__/index-test.js +68 -0
- package/dist/cjs/modules/useMergeRefs/index.js +36 -0
- package/dist/cjs/modules/usePlatformMethods/index.js +39 -0
- package/dist/cjs/modules/useStable/__tests__/index-test.js +69 -0
- package/dist/cjs/modules/useStable/index.js +34 -0
- package/dist/cjs/styleTypes.js +14 -0
- package/dist/cjs/types.js +14 -0
- package/package.json +7 -7
- /package/dist/cjs/StyleSheet/__tests__/{compiler-createReactDOMStyle-test.cjs.map → compiler-createReactDOMStyle-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{compiler-test.cjs.map → compiler-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{dom-createOrderedCSSStyleSheet-test.cjs.map → dom-createOrderedCSSStyleSheet-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{preprocess-test.cjs.map → preprocess-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{validate-test.cjs.map → validate-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{createReactDOMStyle.cjs.map → createReactDOMStyle.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{hash.cjs.map → hash.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{hyphenateStyleName.cjs.map → hyphenateStyleName.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{normalizeColor.cjs.map → normalizeColor.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{normalizeValueWithProperty.cjs.map → normalizeValueWithProperty.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{resolveShadowValue.cjs.map → resolveShadowValue.js.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{createCSSStyleSheet.cjs.map → createCSSStyleSheet.js.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{createOrderedCSSStyleSheet.cjs.map → createOrderedCSSStyleSheet.js.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StyleSheet/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StyleSheet/{preprocess.cjs.map → preprocess.js.map} +0 -0
- /package/dist/cjs/StyleSheet/{validate.cjs.map → validate.js.map} +0 -0
- /package/dist/cjs/{TextAncestorContext.cjs.map → TextAncestorContext.js.map} +0 -0
- /package/dist/cjs/{colorProps.cjs.map → colorProps.js.map} +0 -0
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/__tests__/{propsToAccessibilityComponent-test.cjs.map → propsToAccessibilityComponent-test.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/__tests__/{propsToAriaRole-test.cjs.map → propsToAriaRole-test.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{isDisabled.cjs.map → isDisabled.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{propsToAccessibilityComponent.cjs.map → propsToAccessibilityComponent.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{propsToAriaRole.cjs.map → propsToAriaRole.js.map} +0 -0
- /package/dist/cjs/modules/AssetRegistry/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/ImageLoader/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/{InteractionManager.cjs.map → InteractionManager.js.map} +0 -0
- /package/dist/cjs/modules/Platform/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/Platform/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/TextInputState/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/UIManager/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/UIManager/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/{canUseDOM.cjs.map → canUseDOM.js.map} +0 -0
- /package/dist/cjs/modules/createDOMProps/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/createDOMProps/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/createEventHandle/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/createEventHandle/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/dismissKeyboard/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/forwardedProps/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/getBoundingClientRect/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/{invariant.cjs.map → invariant.js.map} +0 -0
- /package/dist/cjs/modules/isSelectionValid/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/isWebColor/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/mergeRefs/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/mergeRefs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/modality/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/modality/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/multiplyStyleLengthValue/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/normalizeColor/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/pick/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/processColor/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/processColor/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/requestIdleCallback/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/setValueForStyles/{dangerousStyleValue.cjs.map → dangerousStyleValue.js.map} +0 -0
- /package/dist/cjs/modules/setValueForStyles/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/unitlessNumbers/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useElementLayout/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useEvent/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useEvent/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useHover/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useHover/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useLayoutEffect/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useLocale/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useLocale/{isLocaleRTL.cjs.map → isLocaleRTL.js.map} +0 -0
- /package/dist/cjs/modules/useMergeRefs/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useMergeRefs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/usePlatformMethods/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useStable/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useStable/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{styleTypes.cjs.map → styleTypes.js.map} +0 -0
- /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
|
@@ -0,0 +1,242 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
13
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
14
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
15
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
16
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var import_dom_event_testing_library = require("dom-event-testing-library"), React = __toESM(require("react")), ReactDOM = __toESM(require("react-dom")), ReactDOMServer = __toESM(require("react-dom/server")), import_test_utils = require("react-dom/test-utils"), import__ = __toESM(require("..")), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
|
+
function createRoot(rootNode) {
|
|
22
|
+
return {
|
|
23
|
+
render(element) {
|
|
24
|
+
ReactDOM.render(element, rootNode);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
describe("create-event-handle", () => {
|
|
29
|
+
let root, rootNode;
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
rootNode = document.createElement("div"), document.body.appendChild(rootNode), root = createRoot(rootNode);
|
|
32
|
+
}), afterEach(() => {
|
|
33
|
+
root.render(null), document.body.removeChild(rootNode), rootNode = null, root = null;
|
|
34
|
+
}), test("can render correctly using ReactDOMServer", () => {
|
|
35
|
+
const listener = jest.fn(), targetRef = React.createRef(), addClickListener = (0, import__.default)("click");
|
|
36
|
+
function Component() {
|
|
37
|
+
return React.useEffect(() => addClickListener(targetRef.current, listener)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef });
|
|
38
|
+
}
|
|
39
|
+
const output = ReactDOMServer.renderToString(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
40
|
+
expect(output).toBe('<div data-reactroot=""></div>');
|
|
41
|
+
}), describe("createEventTarget()", () => {
|
|
42
|
+
test("event dispatched on target", () => {
|
|
43
|
+
const listener = jest.fn(), targetRef = React.createRef(), addClickListener = (0, import__.default)("click");
|
|
44
|
+
function Component() {
|
|
45
|
+
return React.useEffect(() => addClickListener(targetRef.current, listener)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef });
|
|
46
|
+
}
|
|
47
|
+
(0, import_test_utils.act)(() => {
|
|
48
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
49
|
+
});
|
|
50
|
+
const target = (0, import_dom_event_testing_library.createEventTarget)(targetRef.current);
|
|
51
|
+
(0, import_test_utils.act)(() => {
|
|
52
|
+
target.click();
|
|
53
|
+
}), expect(listener).toBeCalledTimes(1);
|
|
54
|
+
}), test("event dispatched on parent", () => {
|
|
55
|
+
const listener = jest.fn(), listenerCapture = jest.fn(), targetRef = React.createRef(), parentRef = React.createRef(), addClickListener = (0, import__.default)("click"), addClickCaptureListener = (0, import__.default)("click", {
|
|
56
|
+
capture: !0
|
|
57
|
+
});
|
|
58
|
+
function Component() {
|
|
59
|
+
return React.useEffect(() => {
|
|
60
|
+
const removeClickListener = addClickListener(targetRef.current, listener), removeClickCaptureListener = addClickCaptureListener(
|
|
61
|
+
targetRef.current,
|
|
62
|
+
listenerCapture
|
|
63
|
+
);
|
|
64
|
+
return () => {
|
|
65
|
+
removeClickListener(), removeClickCaptureListener();
|
|
66
|
+
};
|
|
67
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: parentRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef }) });
|
|
68
|
+
}
|
|
69
|
+
(0, import_test_utils.act)(() => {
|
|
70
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
71
|
+
});
|
|
72
|
+
const parent = (0, import_dom_event_testing_library.createEventTarget)(parentRef.current);
|
|
73
|
+
(0, import_test_utils.act)(() => {
|
|
74
|
+
parent.click();
|
|
75
|
+
}), expect(listener).toBeCalledTimes(0), expect(listenerCapture).toBeCalledTimes(0);
|
|
76
|
+
}), test("event dispatched on child", () => {
|
|
77
|
+
const log = [], listener = jest.fn(() => {
|
|
78
|
+
log.push("bubble");
|
|
79
|
+
}), listenerCapture = jest.fn(() => {
|
|
80
|
+
log.push("capture");
|
|
81
|
+
}), targetRef = React.createRef(), childRef = React.createRef(), addClickListener = (0, import__.default)("click"), addClickCaptureListener = (0, import__.default)("click", {
|
|
82
|
+
capture: !0
|
|
83
|
+
});
|
|
84
|
+
function Component() {
|
|
85
|
+
return React.useEffect(() => {
|
|
86
|
+
const removeClickListener = addClickListener(targetRef.current, listener), removeClickCaptureListener = addClickCaptureListener(
|
|
87
|
+
targetRef.current,
|
|
88
|
+
listenerCapture
|
|
89
|
+
);
|
|
90
|
+
return () => {
|
|
91
|
+
removeClickListener(), removeClickCaptureListener();
|
|
92
|
+
};
|
|
93
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: childRef }) });
|
|
94
|
+
}
|
|
95
|
+
(0, import_test_utils.act)(() => {
|
|
96
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
97
|
+
});
|
|
98
|
+
const child = (0, import_dom_event_testing_library.createEventTarget)(childRef.current);
|
|
99
|
+
(0, import_test_utils.act)(() => {
|
|
100
|
+
child.click();
|
|
101
|
+
}), expect(listenerCapture).toBeCalledTimes(1), expect(listener).toBeCalledTimes(1), expect(log).toEqual(["capture", "bubble"]);
|
|
102
|
+
}), test("event dispatched on text node", () => {
|
|
103
|
+
const listener = jest.fn(), targetRef = React.createRef(), childRef = React.createRef(), addClickListener = (0, import__.default)("click");
|
|
104
|
+
function Component() {
|
|
105
|
+
return React.useEffect(() => addClickListener(targetRef.current, listener)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: childRef, children: "text" }) });
|
|
106
|
+
}
|
|
107
|
+
(0, import_test_utils.act)(() => {
|
|
108
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
109
|
+
});
|
|
110
|
+
const text = (0, import_dom_event_testing_library.createEventTarget)(childRef.current.firstChild);
|
|
111
|
+
(0, import_test_utils.act)(() => {
|
|
112
|
+
text.click();
|
|
113
|
+
}), expect(listener).toBeCalledTimes(1);
|
|
114
|
+
}), test("listener can be attached to document", () => {
|
|
115
|
+
const listener = jest.fn(), targetRef = React.createRef(), addClickListener = (0, import__.default)("click");
|
|
116
|
+
function Component({ target: target2 }) {
|
|
117
|
+
return React.useEffect(() => addClickListener(target2, listener)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef });
|
|
118
|
+
}
|
|
119
|
+
(0, import_test_utils.act)(() => {
|
|
120
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { target: document }));
|
|
121
|
+
});
|
|
122
|
+
const target = (0, import_dom_event_testing_library.createEventTarget)(targetRef.current);
|
|
123
|
+
(0, import_test_utils.act)(() => {
|
|
124
|
+
target.click();
|
|
125
|
+
}), expect(listener).toBeCalledTimes(1);
|
|
126
|
+
}), test("listener can be attached to window ", () => {
|
|
127
|
+
const listener = jest.fn(), targetRef = React.createRef(), addClickListener = (0, import__.default)("click");
|
|
128
|
+
function Component({ target: target2 }) {
|
|
129
|
+
return React.useEffect(() => addClickListener(target2, listener)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef });
|
|
130
|
+
}
|
|
131
|
+
(0, import_test_utils.act)(() => {
|
|
132
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { target: window }));
|
|
133
|
+
});
|
|
134
|
+
const target = (0, import_dom_event_testing_library.createEventTarget)(targetRef.current);
|
|
135
|
+
(0, import_test_utils.act)(() => {
|
|
136
|
+
target.click();
|
|
137
|
+
}), expect(listener).toBeCalledTimes(1);
|
|
138
|
+
}), test("custom event dispatched on target", () => {
|
|
139
|
+
const listener = jest.fn(), targetRef = React.createRef(), addMagicEventListener = (0, import__.default)("magic-event");
|
|
140
|
+
function Component() {
|
|
141
|
+
return React.useEffect(() => addMagicEventListener(targetRef.current, listener)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef });
|
|
142
|
+
}
|
|
143
|
+
(0, import_test_utils.act)(() => {
|
|
144
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
145
|
+
}), (0, import_test_utils.act)(() => {
|
|
146
|
+
const event = new CustomEvent("magic-event", { bubbles: !0 });
|
|
147
|
+
targetRef.current.dispatchEvent(event);
|
|
148
|
+
}), expect(listener).toBeCalledTimes(1);
|
|
149
|
+
}), test("listeners can be set on multiple targets simultaneously", () => {
|
|
150
|
+
const log = [], targetRef = React.createRef(), parentRef = React.createRef(), childRef = React.createRef(), addClickListener = (0, import__.default)("click"), addClickCaptureListener = (0, import__.default)("click", {
|
|
151
|
+
capture: !0
|
|
152
|
+
}), listener = jest.fn((e) => {
|
|
153
|
+
log.push(["bubble", e.currentTarget.id]);
|
|
154
|
+
}), listenerCapture = jest.fn((e) => {
|
|
155
|
+
log.push(["capture", e.currentTarget.id]);
|
|
156
|
+
});
|
|
157
|
+
function Component() {
|
|
158
|
+
return React.useEffect(() => {
|
|
159
|
+
addClickListener(targetRef.current, listener), addClickListener(parentRef.current, listener), addClickCaptureListener(targetRef.current, listenerCapture), addClickCaptureListener(parentRef.current, listenerCapture);
|
|
160
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "parent", ref: parentRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "target", ref: targetRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: childRef }) }) });
|
|
161
|
+
}
|
|
162
|
+
(0, import_test_utils.act)(() => {
|
|
163
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
164
|
+
});
|
|
165
|
+
const child = (0, import_dom_event_testing_library.createEventTarget)(childRef.current);
|
|
166
|
+
(0, import_test_utils.act)(() => {
|
|
167
|
+
child.click();
|
|
168
|
+
}), expect(listenerCapture).toBeCalledTimes(2), expect(listener).toBeCalledTimes(2), expect(log).toEqual([
|
|
169
|
+
["capture", "parent"],
|
|
170
|
+
["capture", "target"],
|
|
171
|
+
["bubble", "target"],
|
|
172
|
+
["bubble", "parent"]
|
|
173
|
+
]);
|
|
174
|
+
}), test("listeners are specific to each event handle", () => {
|
|
175
|
+
const log = [], targetRef = React.createRef(), childRef = React.createRef(), addClickListener = (0, import__.default)("click"), addClickAltListener = (0, import__.default)("click"), addClickCaptureListener = (0, import__.default)("click", {
|
|
176
|
+
capture: !0
|
|
177
|
+
}), addClickCaptureAltListener = (0, import__.default)("click", {
|
|
178
|
+
capture: !0
|
|
179
|
+
}), listener = jest.fn((e) => {
|
|
180
|
+
log.push(["bubble", "target"]);
|
|
181
|
+
}), listenerAlt = jest.fn((e) => {
|
|
182
|
+
log.push(["bubble", "target-alt"]);
|
|
183
|
+
}), listenerCapture = jest.fn((e) => {
|
|
184
|
+
log.push(["capture", "target"]);
|
|
185
|
+
}), listenerCaptureAlt = jest.fn((e) => {
|
|
186
|
+
log.push(["capture", "target-alt"]);
|
|
187
|
+
});
|
|
188
|
+
function Component() {
|
|
189
|
+
return React.useEffect(() => {
|
|
190
|
+
addClickListener(targetRef.current, listener), addClickAltListener(targetRef.current, listenerAlt), addClickCaptureListener(targetRef.current, listenerCapture), addClickCaptureAltListener(targetRef.current, listenerCaptureAlt);
|
|
191
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: "target", ref: targetRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: childRef }) });
|
|
192
|
+
}
|
|
193
|
+
(0, import_test_utils.act)(() => {
|
|
194
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
195
|
+
});
|
|
196
|
+
const child = (0, import_dom_event_testing_library.createEventTarget)(childRef.current);
|
|
197
|
+
(0, import_test_utils.act)(() => {
|
|
198
|
+
child.click();
|
|
199
|
+
}), expect(listenerCapture).toBeCalledTimes(1), expect(listenerCaptureAlt).toBeCalledTimes(1), expect(listener).toBeCalledTimes(1), expect(listenerAlt).toBeCalledTimes(1), expect(log).toEqual([
|
|
200
|
+
["capture", "target"],
|
|
201
|
+
["capture", "target-alt"],
|
|
202
|
+
["bubble", "target"],
|
|
203
|
+
["bubble", "target-alt"]
|
|
204
|
+
]);
|
|
205
|
+
});
|
|
206
|
+
}), describe("stopPropagation and stopImmediatePropagation", () => {
|
|
207
|
+
test("stopPropagation works as expected", () => {
|
|
208
|
+
const childListener = jest.fn((e) => {
|
|
209
|
+
e.stopPropagation();
|
|
210
|
+
}), targetListener = jest.fn(), targetRef = React.createRef(), childRef = React.createRef(), addClickListener = (0, import__.default)("click");
|
|
211
|
+
function Component() {
|
|
212
|
+
return React.useEffect(() => {
|
|
213
|
+
addClickListener(childRef.current, childListener), addClickListener(targetRef.current, targetListener);
|
|
214
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: childRef }) });
|
|
215
|
+
}
|
|
216
|
+
(0, import_test_utils.act)(() => {
|
|
217
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
218
|
+
});
|
|
219
|
+
const child = (0, import_dom_event_testing_library.createEventTarget)(childRef.current);
|
|
220
|
+
(0, import_test_utils.act)(() => {
|
|
221
|
+
child.click();
|
|
222
|
+
}), expect(childListener).toBeCalledTimes(1), expect(targetListener).toBeCalledTimes(0);
|
|
223
|
+
}), test("stopImmediatePropagation works as expected", () => {
|
|
224
|
+
const firstListener = jest.fn((e) => {
|
|
225
|
+
e.stopImmediatePropagation();
|
|
226
|
+
}), secondListener = jest.fn(), targetRef = React.createRef(), addFirstClickListener = (0, import__.default)("click"), addSecondClickListener = (0, import__.default)("click");
|
|
227
|
+
function Component() {
|
|
228
|
+
return React.useEffect(() => {
|
|
229
|
+
addFirstClickListener(targetRef.current, firstListener), addSecondClickListener(targetRef.current, secondListener);
|
|
230
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: targetRef });
|
|
231
|
+
}
|
|
232
|
+
(0, import_test_utils.act)(() => {
|
|
233
|
+
root.render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {}));
|
|
234
|
+
});
|
|
235
|
+
const target = (0, import_dom_event_testing_library.createEventTarget)(targetRef.current);
|
|
236
|
+
(0, import_test_utils.act)(() => {
|
|
237
|
+
target.click();
|
|
238
|
+
}), expect(firstListener).toBeCalledTimes(1), expect(secondListener).toBeCalledTimes(0);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
//# sourceMappingURL=index-test.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var createEventHandle_exports = {};
|
|
25
|
+
__export(createEventHandle_exports, {
|
|
26
|
+
default: () => createEventHandle
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(createEventHandle_exports);
|
|
29
|
+
var import_canUseDOM = __toESM(require("../canUseDOM"));
|
|
30
|
+
const emptyFunction = () => {
|
|
31
|
+
};
|
|
32
|
+
function supportsPassiveEvents() {
|
|
33
|
+
let supported = !1;
|
|
34
|
+
if (import_canUseDOM.default)
|
|
35
|
+
try {
|
|
36
|
+
const options = {};
|
|
37
|
+
Object.defineProperty(options, "passive", {
|
|
38
|
+
get() {
|
|
39
|
+
return supported = !0, !1;
|
|
40
|
+
}
|
|
41
|
+
}), window.addEventListener("test", null, options), window.removeEventListener("test", null, options);
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
return supported;
|
|
45
|
+
}
|
|
46
|
+
const canUsePassiveEvents = supportsPassiveEvents();
|
|
47
|
+
function getOptions(options) {
|
|
48
|
+
return options == null ? !1 : canUsePassiveEvents ? options : !!options.capture;
|
|
49
|
+
}
|
|
50
|
+
function isPropagationStopped() {
|
|
51
|
+
return this.cancelBubble;
|
|
52
|
+
}
|
|
53
|
+
function isDefaultPrevented() {
|
|
54
|
+
return this.defaultPrevented;
|
|
55
|
+
}
|
|
56
|
+
function normalizeEvent(event) {
|
|
57
|
+
return event.nativeEvent = event, event.persist = emptyFunction, event.isDefaultPrevented = isDefaultPrevented, event.isPropagationStopped = isPropagationStopped, event;
|
|
58
|
+
}
|
|
59
|
+
function createEventHandle(type, options) {
|
|
60
|
+
const opts = getOptions(options);
|
|
61
|
+
return function(target, listener) {
|
|
62
|
+
if (target == null || typeof target.addEventListener != "function")
|
|
63
|
+
throw new Error("createEventHandle: called on an invalid target.");
|
|
64
|
+
const element = target;
|
|
65
|
+
if (listener != null) {
|
|
66
|
+
const compatListener = (e) => listener(normalizeEvent(e));
|
|
67
|
+
return element.addEventListener(type, compatListener, opts), function() {
|
|
68
|
+
element?.removeEventListener(type, compatListener, opts);
|
|
69
|
+
};
|
|
70
|
+
} else
|
|
71
|
+
return emptyFunction;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
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 dismissKeyboard_exports = {};
|
|
24
|
+
__export(dismissKeyboard_exports, {
|
|
25
|
+
default: () => dismissKeyboard_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(dismissKeyboard_exports);
|
|
28
|
+
var import_TextInputState = __toESM(require("../TextInputState/index"));
|
|
29
|
+
const dismissKeyboard = () => {
|
|
30
|
+
import_TextInputState.default.blurTextInput(import_TextInputState.default.currentlyFocusedField());
|
|
31
|
+
};
|
|
32
|
+
var dismissKeyboard_default = dismissKeyboard;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var forwardedProps_exports = {};
|
|
16
|
+
__export(forwardedProps_exports, {
|
|
17
|
+
accessibilityProps: () => accessibilityProps,
|
|
18
|
+
clickProps: () => clickProps,
|
|
19
|
+
defaultProps: () => defaultProps,
|
|
20
|
+
focusProps: () => focusProps,
|
|
21
|
+
forwardPropsListText: () => forwardPropsListText,
|
|
22
|
+
forwardPropsListView: () => forwardPropsListView,
|
|
23
|
+
forwardedProps: () => forwardedProps,
|
|
24
|
+
keyboardProps: () => keyboardProps,
|
|
25
|
+
mouseProps: () => mouseProps,
|
|
26
|
+
styleProps: () => styleProps,
|
|
27
|
+
touchProps: () => touchProps
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(forwardedProps_exports);
|
|
30
|
+
const defaultProps = {
|
|
31
|
+
children: !0,
|
|
32
|
+
dataSet: !0,
|
|
33
|
+
nativeID: !0,
|
|
34
|
+
ref: !0,
|
|
35
|
+
suppressHydrationWarning: !0,
|
|
36
|
+
testID: !0,
|
|
37
|
+
id: !0
|
|
38
|
+
}, accessibilityProps = {
|
|
39
|
+
accessibilityActiveDescendant: !0,
|
|
40
|
+
accessibilityAtomic: !0,
|
|
41
|
+
accessibilityAutoComplete: !0,
|
|
42
|
+
accessibilityBusy: !0,
|
|
43
|
+
accessibilityChecked: !0,
|
|
44
|
+
accessibilityColumnCount: !0,
|
|
45
|
+
accessibilityColumnIndex: !0,
|
|
46
|
+
accessibilityColumnSpan: !0,
|
|
47
|
+
accessibilityControls: !0,
|
|
48
|
+
accessibilityCurrent: !0,
|
|
49
|
+
accessibilityDescribedBy: !0,
|
|
50
|
+
accessibilityDetails: !0,
|
|
51
|
+
accessibilityDisabled: !0,
|
|
52
|
+
accessibilityErrorMessage: !0,
|
|
53
|
+
accessibilityExpanded: !0,
|
|
54
|
+
accessibilityFlowTo: !0,
|
|
55
|
+
accessibilityHasPopup: !0,
|
|
56
|
+
accessibilityHidden: !0,
|
|
57
|
+
accessibilityInvalid: !0,
|
|
58
|
+
accessibilityKeyShortcuts: !0,
|
|
59
|
+
accessibilityLabel: !0,
|
|
60
|
+
accessibilityLabelledBy: !0,
|
|
61
|
+
accessibilityLevel: !0,
|
|
62
|
+
accessibilityLiveRegion: !0,
|
|
63
|
+
accessibilityModal: !0,
|
|
64
|
+
accessibilityMultiline: !0,
|
|
65
|
+
accessibilityMultiSelectable: !0,
|
|
66
|
+
accessibilityOrientation: !0,
|
|
67
|
+
accessibilityOwns: !0,
|
|
68
|
+
accessibilityPlaceholder: !0,
|
|
69
|
+
accessibilityPosInSet: !0,
|
|
70
|
+
accessibilityPressed: !0,
|
|
71
|
+
accessibilityReadOnly: !0,
|
|
72
|
+
accessibilityRequired: !0,
|
|
73
|
+
accessibilityRole: !0,
|
|
74
|
+
accessibilityRoleDescription: !0,
|
|
75
|
+
accessibilityRowCount: !0,
|
|
76
|
+
accessibilityRowIndex: !0,
|
|
77
|
+
accessibilityRowSpan: !0,
|
|
78
|
+
accessibilitySelected: !0,
|
|
79
|
+
accessibilitySetSize: !0,
|
|
80
|
+
accessibilitySort: !0,
|
|
81
|
+
accessibilityValueMax: !0,
|
|
82
|
+
accessibilityValueMin: !0,
|
|
83
|
+
accessibilityValueNow: !0,
|
|
84
|
+
accessibilityValueText: !0,
|
|
85
|
+
dir: !0,
|
|
86
|
+
focusable: !0
|
|
87
|
+
}, clickProps = {
|
|
88
|
+
onClick: !0,
|
|
89
|
+
onClickCapture: !0,
|
|
90
|
+
onContextMenu: !0
|
|
91
|
+
}, focusProps = {
|
|
92
|
+
onBlur: !0,
|
|
93
|
+
onFocus: !0
|
|
94
|
+
}, keyboardProps = {
|
|
95
|
+
onKeyDown: !0,
|
|
96
|
+
onKeyDownCapture: !0,
|
|
97
|
+
onKeyUp: !0,
|
|
98
|
+
onKeyUpCapture: !0
|
|
99
|
+
}, mouseProps = {
|
|
100
|
+
onMouseDown: !0,
|
|
101
|
+
onMouseEnter: !0,
|
|
102
|
+
onMouseLeave: !0,
|
|
103
|
+
onMouseMove: !0,
|
|
104
|
+
onMouseOver: !0,
|
|
105
|
+
onMouseOut: !0,
|
|
106
|
+
onMouseUp: !0
|
|
107
|
+
}, touchProps = {
|
|
108
|
+
onTouchCancel: !0,
|
|
109
|
+
onTouchCancelCapture: !0,
|
|
110
|
+
onTouchEnd: !0,
|
|
111
|
+
onTouchEndCapture: !0,
|
|
112
|
+
onTouchMove: !0,
|
|
113
|
+
onTouchMoveCapture: !0,
|
|
114
|
+
onTouchStart: !0,
|
|
115
|
+
onTouchStartCapture: !0
|
|
116
|
+
}, styleProps = {
|
|
117
|
+
classList: !0,
|
|
118
|
+
style: !0
|
|
119
|
+
}, forwardedProps = {
|
|
120
|
+
defaultProps,
|
|
121
|
+
accessibilityProps,
|
|
122
|
+
clickProps,
|
|
123
|
+
focusProps,
|
|
124
|
+
keyboardProps,
|
|
125
|
+
mouseProps,
|
|
126
|
+
touchProps,
|
|
127
|
+
styleProps
|
|
128
|
+
}, forwardPropsListText = {
|
|
129
|
+
...defaultProps,
|
|
130
|
+
...accessibilityProps,
|
|
131
|
+
...clickProps,
|
|
132
|
+
...focusProps,
|
|
133
|
+
...keyboardProps,
|
|
134
|
+
...mouseProps,
|
|
135
|
+
...touchProps,
|
|
136
|
+
...styleProps,
|
|
137
|
+
href: !0,
|
|
138
|
+
lang: !0,
|
|
139
|
+
pointerEvents: !0
|
|
140
|
+
}, forwardPropsListView = {
|
|
141
|
+
...forwardPropsListText,
|
|
142
|
+
onScroll: !0,
|
|
143
|
+
onWheel: !0
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var getBoundingClientRect_exports = {};
|
|
16
|
+
__export(getBoundingClientRect_exports, {
|
|
17
|
+
default: () => getBoundingClientRect_default
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(getBoundingClientRect_exports);
|
|
20
|
+
const getBoundingClientRect = (node) => {
|
|
21
|
+
if (node != null && node.nodeType === 1 && typeof node.getBoundingClientRect == "function")
|
|
22
|
+
return node.getBoundingClientRect();
|
|
23
|
+
};
|
|
24
|
+
var getBoundingClientRect_default = getBoundingClientRect;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var invariant_exports = {};
|
|
16
|
+
__export(invariant_exports, {
|
|
17
|
+
invariant: () => invariant,
|
|
18
|
+
warning: () => warning
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(invariant_exports);
|
|
21
|
+
function invariant(condition, log, ...logVars) {
|
|
22
|
+
if (!condition)
|
|
23
|
+
throw new Error(
|
|
24
|
+
process.env.NODE_ENV === "development" ? log.split("%s").flatMap((chunk, i) => [chunk, logVars[i]]).join("") : log
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
function warning(condition, log, ...logVars) {
|
|
28
|
+
if (process.env.NODE_ENV === "development")
|
|
29
|
+
try {
|
|
30
|
+
invariant(condition, log, ...logVars);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.warn(err);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=invariant.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var isSelectionValid_exports = {};
|
|
16
|
+
__export(isSelectionValid_exports, {
|
|
17
|
+
default: () => isSelectionValid
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(isSelectionValid_exports);
|
|
20
|
+
function isSelectionValid() {
|
|
21
|
+
const selection = window.getSelection();
|
|
22
|
+
if (!selection) return !1;
|
|
23
|
+
const string = selection.toString(), anchorNode = selection.anchorNode, focusNode = selection.focusNode, isTextNode = anchorNode && anchorNode.nodeType === window.Node.TEXT_NODE || focusNode && focusNode.nodeType === window.Node.TEXT_NODE;
|
|
24
|
+
return string.length >= 1 && string !== `
|
|
25
|
+
` && !!isTextNode;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var isWebColor_exports = {};
|
|
16
|
+
__export(isWebColor_exports, {
|
|
17
|
+
default: () => isWebColor_default
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(isWebColor_exports);
|
|
20
|
+
const isWebColor = (color) => color === "currentcolor" || color === "currentColor" || color === "inherit" || color.startsWith("var(");
|
|
21
|
+
var isWebColor_default = isWebColor;
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
13
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
14
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
15
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
16
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var import_react = require("@testing-library/react"), React = __toESM(require("react")), import__ = __toESM(require("..")), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
|
+
describe("modules/mergeRefs", () => {
|
|
22
|
+
test("merges refs of different types", () => {
|
|
23
|
+
const ref = React.createRef(null);
|
|
24
|
+
let functionRefValue = null, hookRef;
|
|
25
|
+
function Component() {
|
|
26
|
+
const functionRef = (x) => {
|
|
27
|
+
functionRefValue = x;
|
|
28
|
+
};
|
|
29
|
+
return hookRef = React.useRef(null), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: (0, import__.default)(ref, hookRef, functionRef) });
|
|
30
|
+
}
|
|
31
|
+
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {})), expect(ref.current).toBeInstanceOf(HTMLDivElement), expect(hookRef.current).toBeInstanceOf(HTMLDivElement), expect(functionRefValue).toBeInstanceOf(HTMLDivElement);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=index-test.js.map
|