@react-aria/utils 3.33.0 → 3.34.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.
Files changed (262) hide show
  1. package/dist/import.mjs +47 -43
  2. package/dist/main.js +120 -114
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +47 -43
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +45 -0
  7. package/package.json +15 -15
  8. package/src/index.ts +45 -43
  9. package/dist/DOMFunctions.main.js +0 -44
  10. package/dist/DOMFunctions.main.js.map +0 -1
  11. package/dist/DOMFunctions.mjs +0 -37
  12. package/dist/DOMFunctions.module.js +0 -37
  13. package/dist/DOMFunctions.module.js.map +0 -1
  14. package/dist/ShadowTreeWalker.main.js +0 -200
  15. package/dist/ShadowTreeWalker.main.js.map +0 -1
  16. package/dist/ShadowTreeWalker.mjs +0 -194
  17. package/dist/ShadowTreeWalker.module.js +0 -194
  18. package/dist/ShadowTreeWalker.module.js.map +0 -1
  19. package/dist/animation.main.js +0 -97
  20. package/dist/animation.main.js.map +0 -1
  21. package/dist/animation.mjs +0 -91
  22. package/dist/animation.module.js +0 -91
  23. package/dist/animation.module.js.map +0 -1
  24. package/dist/chain.main.js +0 -26
  25. package/dist/chain.main.js.map +0 -1
  26. package/dist/chain.mjs +0 -21
  27. package/dist/chain.module.js +0 -21
  28. package/dist/chain.module.js.map +0 -1
  29. package/dist/constants.main.js +0 -23
  30. package/dist/constants.main.js.map +0 -1
  31. package/dist/constants.mjs +0 -17
  32. package/dist/constants.module.js +0 -17
  33. package/dist/constants.module.js.map +0 -1
  34. package/dist/domHelpers.main.js +0 -28
  35. package/dist/domHelpers.main.js.map +0 -1
  36. package/dist/domHelpers.mjs +0 -21
  37. package/dist/domHelpers.module.js +0 -21
  38. package/dist/domHelpers.module.js.map +0 -1
  39. package/dist/filterDOMProps.main.js +0 -88
  40. package/dist/filterDOMProps.main.js.map +0 -1
  41. package/dist/filterDOMProps.mjs +0 -83
  42. package/dist/filterDOMProps.module.js +0 -83
  43. package/dist/filterDOMProps.module.js.map +0 -1
  44. package/dist/focusWithoutScrolling.main.js +0 -72
  45. package/dist/focusWithoutScrolling.main.js.map +0 -1
  46. package/dist/focusWithoutScrolling.mjs +0 -67
  47. package/dist/focusWithoutScrolling.module.js +0 -67
  48. package/dist/focusWithoutScrolling.module.js.map +0 -1
  49. package/dist/getOffset.main.js +0 -24
  50. package/dist/getOffset.main.js.map +0 -1
  51. package/dist/getOffset.mjs +0 -19
  52. package/dist/getOffset.module.js +0 -19
  53. package/dist/getOffset.module.js.map +0 -1
  54. package/dist/getScrollParent.main.js +0 -28
  55. package/dist/getScrollParent.main.js.map +0 -1
  56. package/dist/getScrollParent.mjs +0 -23
  57. package/dist/getScrollParent.module.js +0 -23
  58. package/dist/getScrollParent.module.js.map +0 -1
  59. package/dist/getScrollParents.main.js +0 -30
  60. package/dist/getScrollParents.main.js.map +0 -1
  61. package/dist/getScrollParents.mjs +0 -25
  62. package/dist/getScrollParents.module.js +0 -25
  63. package/dist/getScrollParents.module.js.map +0 -1
  64. package/dist/inertValue.main.js +0 -19
  65. package/dist/inertValue.main.js.map +0 -1
  66. package/dist/inertValue.mjs +0 -14
  67. package/dist/inertValue.module.js +0 -14
  68. package/dist/inertValue.module.js.map +0 -1
  69. package/dist/isElementVisible.main.js +0 -45
  70. package/dist/isElementVisible.main.js.map +0 -1
  71. package/dist/isElementVisible.mjs +0 -40
  72. package/dist/isElementVisible.module.js +0 -40
  73. package/dist/isElementVisible.module.js.map +0 -1
  74. package/dist/isFocusable.main.js +0 -56
  75. package/dist/isFocusable.main.js.map +0 -1
  76. package/dist/isFocusable.mjs +0 -50
  77. package/dist/isFocusable.module.js +0 -50
  78. package/dist/isFocusable.module.js.map +0 -1
  79. package/dist/isScrollable.main.js +0 -26
  80. package/dist/isScrollable.main.js.map +0 -1
  81. package/dist/isScrollable.mjs +0 -21
  82. package/dist/isScrollable.module.js +0 -21
  83. package/dist/isScrollable.module.js.map +0 -1
  84. package/dist/isVirtualEvent.main.js +0 -41
  85. package/dist/isVirtualEvent.main.js.map +0 -1
  86. package/dist/isVirtualEvent.mjs +0 -35
  87. package/dist/isVirtualEvent.module.js +0 -35
  88. package/dist/isVirtualEvent.module.js.map +0 -1
  89. package/dist/keyboard.main.js +0 -42
  90. package/dist/keyboard.main.js.map +0 -1
  91. package/dist/keyboard.mjs +0 -36
  92. package/dist/keyboard.module.js +0 -36
  93. package/dist/keyboard.module.js.map +0 -1
  94. package/dist/mergeProps.main.js +0 -54
  95. package/dist/mergeProps.main.js.map +0 -1
  96. package/dist/mergeProps.mjs +0 -45
  97. package/dist/mergeProps.module.js +0 -45
  98. package/dist/mergeProps.module.js.map +0 -1
  99. package/dist/mergeRefs.main.js +0 -40
  100. package/dist/mergeRefs.main.js.map +0 -1
  101. package/dist/mergeRefs.mjs +0 -35
  102. package/dist/mergeRefs.module.js +0 -35
  103. package/dist/mergeRefs.module.js.map +0 -1
  104. package/dist/openLink.main.js +0 -169
  105. package/dist/openLink.main.js.map +0 -1
  106. package/dist/openLink.mjs +0 -153
  107. package/dist/openLink.module.js +0 -153
  108. package/dist/openLink.module.js.map +0 -1
  109. package/dist/platform.main.js +0 -73
  110. package/dist/platform.main.js.map +0 -1
  111. package/dist/platform.mjs +0 -60
  112. package/dist/platform.module.js +0 -60
  113. package/dist/platform.module.js.map +0 -1
  114. package/dist/runAfterTransition.main.js +0 -92
  115. package/dist/runAfterTransition.main.js.map +0 -1
  116. package/dist/runAfterTransition.mjs +0 -87
  117. package/dist/runAfterTransition.module.js +0 -87
  118. package/dist/runAfterTransition.module.js.map +0 -1
  119. package/dist/scrollIntoView.main.js +0 -105
  120. package/dist/scrollIntoView.main.js.map +0 -1
  121. package/dist/scrollIntoView.mjs +0 -99
  122. package/dist/scrollIntoView.module.js +0 -99
  123. package/dist/scrollIntoView.module.js.map +0 -1
  124. package/dist/types.d.ts +0 -286
  125. package/dist/types.d.ts.map +0 -1
  126. package/dist/useDeepMemo.main.js +0 -30
  127. package/dist/useDeepMemo.main.js.map +0 -1
  128. package/dist/useDeepMemo.mjs +0 -25
  129. package/dist/useDeepMemo.module.js +0 -25
  130. package/dist/useDeepMemo.module.js.map +0 -1
  131. package/dist/useDescription.main.js +0 -59
  132. package/dist/useDescription.main.js.map +0 -1
  133. package/dist/useDescription.mjs +0 -54
  134. package/dist/useDescription.module.js +0 -54
  135. package/dist/useDescription.module.js.map +0 -1
  136. package/dist/useDrag1D.main.js +0 -141
  137. package/dist/useDrag1D.main.js.map +0 -1
  138. package/dist/useDrag1D.mjs +0 -136
  139. package/dist/useDrag1D.module.js +0 -136
  140. package/dist/useDrag1D.module.js.map +0 -1
  141. package/dist/useEffectEvent.main.js +0 -45
  142. package/dist/useEffectEvent.main.js.map +0 -1
  143. package/dist/useEffectEvent.mjs +0 -36
  144. package/dist/useEffectEvent.module.js +0 -36
  145. package/dist/useEffectEvent.module.js.map +0 -1
  146. package/dist/useEvent.main.js +0 -41
  147. package/dist/useEvent.main.js.map +0 -1
  148. package/dist/useEvent.mjs +0 -36
  149. package/dist/useEvent.module.js +0 -36
  150. package/dist/useEvent.module.js.map +0 -1
  151. package/dist/useFormReset.main.js +0 -39
  152. package/dist/useFormReset.main.js.map +0 -1
  153. package/dist/useFormReset.mjs +0 -34
  154. package/dist/useFormReset.module.js +0 -34
  155. package/dist/useFormReset.module.js.map +0 -1
  156. package/dist/useGlobalListeners.main.js +0 -62
  157. package/dist/useGlobalListeners.main.js.map +0 -1
  158. package/dist/useGlobalListeners.mjs +0 -57
  159. package/dist/useGlobalListeners.module.js +0 -57
  160. package/dist/useGlobalListeners.module.js.map +0 -1
  161. package/dist/useId.main.js +0 -108
  162. package/dist/useId.main.js.map +0 -1
  163. package/dist/useId.mjs +0 -101
  164. package/dist/useId.module.js +0 -101
  165. package/dist/useId.module.js.map +0 -1
  166. package/dist/useLabels.main.js +0 -44
  167. package/dist/useLabels.main.js.map +0 -1
  168. package/dist/useLabels.mjs +0 -39
  169. package/dist/useLabels.module.js +0 -39
  170. package/dist/useLabels.module.js.map +0 -1
  171. package/dist/useLayoutEffect.main.js +0 -27
  172. package/dist/useLayoutEffect.main.js.map +0 -1
  173. package/dist/useLayoutEffect.mjs +0 -18
  174. package/dist/useLayoutEffect.module.js +0 -18
  175. package/dist/useLayoutEffect.module.js.map +0 -1
  176. package/dist/useLoadMore.main.js +0 -73
  177. package/dist/useLoadMore.main.js.map +0 -1
  178. package/dist/useLoadMore.mjs +0 -68
  179. package/dist/useLoadMore.module.js +0 -68
  180. package/dist/useLoadMore.module.js.map +0 -1
  181. package/dist/useLoadMoreSentinel.main.js +0 -58
  182. package/dist/useLoadMoreSentinel.main.js.map +0 -1
  183. package/dist/useLoadMoreSentinel.mjs +0 -53
  184. package/dist/useLoadMoreSentinel.module.js +0 -53
  185. package/dist/useLoadMoreSentinel.module.js.map +0 -1
  186. package/dist/useObjectRef.main.js +0 -58
  187. package/dist/useObjectRef.main.js.map +0 -1
  188. package/dist/useObjectRef.mjs +0 -53
  189. package/dist/useObjectRef.module.js +0 -53
  190. package/dist/useObjectRef.module.js.map +0 -1
  191. package/dist/useResizeObserver.main.js +0 -47
  192. package/dist/useResizeObserver.main.js.map +0 -1
  193. package/dist/useResizeObserver.mjs +0 -42
  194. package/dist/useResizeObserver.module.js +0 -42
  195. package/dist/useResizeObserver.module.js.map +0 -1
  196. package/dist/useSyncRef.main.js +0 -32
  197. package/dist/useSyncRef.main.js.map +0 -1
  198. package/dist/useSyncRef.mjs +0 -27
  199. package/dist/useSyncRef.module.js +0 -27
  200. package/dist/useSyncRef.module.js.map +0 -1
  201. package/dist/useUpdateEffect.main.js +0 -42
  202. package/dist/useUpdateEffect.main.js.map +0 -1
  203. package/dist/useUpdateEffect.mjs +0 -37
  204. package/dist/useUpdateEffect.module.js +0 -37
  205. package/dist/useUpdateEffect.module.js.map +0 -1
  206. package/dist/useUpdateLayoutEffect.main.js +0 -40
  207. package/dist/useUpdateLayoutEffect.main.js.map +0 -1
  208. package/dist/useUpdateLayoutEffect.mjs +0 -35
  209. package/dist/useUpdateLayoutEffect.module.js +0 -35
  210. package/dist/useUpdateLayoutEffect.module.js.map +0 -1
  211. package/dist/useValueEffect.main.js +0 -63
  212. package/dist/useValueEffect.main.js.map +0 -1
  213. package/dist/useValueEffect.mjs +0 -58
  214. package/dist/useValueEffect.module.js +0 -58
  215. package/dist/useValueEffect.module.js.map +0 -1
  216. package/dist/useViewportSize.main.js +0 -79
  217. package/dist/useViewportSize.main.js.map +0 -1
  218. package/dist/useViewportSize.mjs +0 -74
  219. package/dist/useViewportSize.module.js +0 -74
  220. package/dist/useViewportSize.module.js.map +0 -1
  221. package/src/animation.ts +0 -103
  222. package/src/chain.ts +0 -24
  223. package/src/constants.ts +0 -15
  224. package/src/domHelpers.ts +0 -33
  225. package/src/filterDOMProps.ts +0 -127
  226. package/src/focusWithoutScrolling.ts +0 -96
  227. package/src/getOffset.ts +0 -21
  228. package/src/getScrollParent.ts +0 -27
  229. package/src/getScrollParents.ts +0 -26
  230. package/src/inertValue.ts +0 -11
  231. package/src/isElementVisible.ts +0 -75
  232. package/src/isFocusable.ts +0 -56
  233. package/src/isScrollable.ts +0 -25
  234. package/src/isVirtualEvent.ts +0 -58
  235. package/src/keyboard.tsx +0 -48
  236. package/src/mergeProps.ts +0 -77
  237. package/src/mergeRefs.ts +0 -52
  238. package/src/openLink.tsx +0 -201
  239. package/src/platform.ts +0 -78
  240. package/src/runAfterTransition.ts +0 -121
  241. package/src/scrollIntoView.ts +0 -129
  242. package/src/shadowdom/DOMFunctions.ts +0 -71
  243. package/src/shadowdom/ShadowTreeWalker.ts +0 -319
  244. package/src/useDeepMemo.ts +0 -27
  245. package/src/useDescription.ts +0 -56
  246. package/src/useDrag1D.ts +0 -191
  247. package/src/useEffectEvent.ts +0 -30
  248. package/src/useEvent.ts +0 -37
  249. package/src/useFormReset.ts +0 -36
  250. package/src/useGlobalListeners.ts +0 -52
  251. package/src/useId.ts +0 -129
  252. package/src/useLabels.ts +0 -48
  253. package/src/useLayoutEffect.ts +0 -20
  254. package/src/useLoadMore.ts +0 -82
  255. package/src/useLoadMoreSentinel.ts +0 -63
  256. package/src/useObjectRef.ts +0 -69
  257. package/src/useResizeObserver.ts +0 -52
  258. package/src/useSyncRef.ts +0 -33
  259. package/src/useUpdateEffect.ts +0 -39
  260. package/src/useUpdateLayoutEffect.ts +0 -37
  261. package/src/useValueEffect.ts +0 -68
  262. package/src/useViewportSize.ts +0 -96
@@ -1,200 +0,0 @@
1
- var $d723bea02f3e2567$exports = require("./DOMFunctions.main.js");
2
- var $hdE3O$reactstatelyflags = require("@react-stately/flags");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "ShadowTreeWalker", () => $8e13b2545651735a$export$63eb3ababa9c55c4);
10
- $parcel$export(module.exports, "createShadowTreeWalker", () => $8e13b2545651735a$export$4d0f8be8b12a7ef6);
11
- // https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts
12
-
13
-
14
- class $8e13b2545651735a$export$63eb3ababa9c55c4 {
15
- get currentNode() {
16
- return this._currentNode;
17
- }
18
- set currentNode(node) {
19
- if (!(0, $d723bea02f3e2567$exports.nodeContains)(this.root, node)) throw new Error('Cannot set currentNode to a node that is not contained by the root node.');
20
- const walkers = [];
21
- let curNode = node;
22
- let currentWalkerCurrentNode = node;
23
- this._currentNode = node;
24
- while(curNode && curNode !== this.root)if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
25
- const shadowRoot = curNode;
26
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
27
- acceptNode: this._acceptNode
28
- });
29
- walkers.push(walker);
30
- walker.currentNode = currentWalkerCurrentNode;
31
- this._currentSetFor.add(walker);
32
- curNode = currentWalkerCurrentNode = shadowRoot.host;
33
- } else curNode = curNode.parentNode;
34
- const walker = this._doc.createTreeWalker(this.root, this.whatToShow, {
35
- acceptNode: this._acceptNode
36
- });
37
- walkers.push(walker);
38
- walker.currentNode = currentWalkerCurrentNode;
39
- this._currentSetFor.add(walker);
40
- this._walkerStack = walkers;
41
- }
42
- get doc() {
43
- return this._doc;
44
- }
45
- firstChild() {
46
- let currentNode = this.currentNode;
47
- let newNode = this.nextNode();
48
- if (!(0, $d723bea02f3e2567$exports.nodeContains)(currentNode, newNode)) {
49
- this.currentNode = currentNode;
50
- return null;
51
- }
52
- if (newNode) this.currentNode = newNode;
53
- return newNode;
54
- }
55
- lastChild() {
56
- let walker = this._walkerStack[0];
57
- let newNode = walker.lastChild();
58
- if (newNode) this.currentNode = newNode;
59
- return newNode;
60
- }
61
- nextNode() {
62
- const nextNode = this._walkerStack[0].nextNode();
63
- if (nextNode) {
64
- const shadowRoot = nextNode.shadowRoot;
65
- if (shadowRoot) {
66
- var _this_filter;
67
- let nodeResult;
68
- if (typeof this.filter === 'function') nodeResult = this.filter(nextNode);
69
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(nextNode);
70
- if (nodeResult === NodeFilter.FILTER_ACCEPT) {
71
- this.currentNode = nextNode;
72
- return nextNode;
73
- }
74
- // _acceptNode should have added new walker for this shadow,
75
- // go in recursively.
76
- let newNode = this.nextNode();
77
- if (newNode) this.currentNode = newNode;
78
- return newNode;
79
- }
80
- if (nextNode) this.currentNode = nextNode;
81
- return nextNode;
82
- } else {
83
- if (this._walkerStack.length > 1) {
84
- this._walkerStack.shift();
85
- let newNode = this.nextNode();
86
- if (newNode) this.currentNode = newNode;
87
- return newNode;
88
- } else return null;
89
- }
90
- }
91
- previousNode() {
92
- const currentWalker = this._walkerStack[0];
93
- if (currentWalker.currentNode === currentWalker.root) {
94
- if (this._currentSetFor.has(currentWalker)) {
95
- this._currentSetFor.delete(currentWalker);
96
- if (this._walkerStack.length > 1) {
97
- this._walkerStack.shift();
98
- let newNode = this.previousNode();
99
- if (newNode) this.currentNode = newNode;
100
- return newNode;
101
- } else return null;
102
- }
103
- return null;
104
- }
105
- const previousNode = currentWalker.previousNode();
106
- if (previousNode) {
107
- const shadowRoot = previousNode.shadowRoot;
108
- if (shadowRoot) {
109
- var _this_filter;
110
- let nodeResult;
111
- if (typeof this.filter === 'function') nodeResult = this.filter(previousNode);
112
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(previousNode);
113
- if (nodeResult === NodeFilter.FILTER_ACCEPT) {
114
- if (previousNode) this.currentNode = previousNode;
115
- return previousNode;
116
- }
117
- // _acceptNode should have added new walker for this shadow,
118
- // go in recursively.
119
- let newNode = this.lastChild();
120
- if (newNode) this.currentNode = newNode;
121
- return newNode;
122
- }
123
- if (previousNode) this.currentNode = previousNode;
124
- return previousNode;
125
- } else {
126
- if (this._walkerStack.length > 1) {
127
- this._walkerStack.shift();
128
- let newNode = this.previousNode();
129
- if (newNode) this.currentNode = newNode;
130
- return newNode;
131
- } else return null;
132
- }
133
- }
134
- /**
135
- * @deprecated
136
- */ nextSibling() {
137
- // if (__DEV__) {
138
- // throw new Error("Method not implemented.");
139
- // }
140
- return null;
141
- }
142
- /**
143
- * @deprecated
144
- */ previousSibling() {
145
- // if (__DEV__) {
146
- // throw new Error("Method not implemented.");
147
- // }
148
- return null;
149
- }
150
- /**
151
- * @deprecated
152
- */ parentNode() {
153
- // if (__DEV__) {
154
- // throw new Error("Method not implemented.");
155
- // }
156
- return null;
157
- }
158
- constructor(doc, root, whatToShow, filter){
159
- this._walkerStack = [];
160
- this._currentSetFor = new Set();
161
- this._acceptNode = (node)=>{
162
- if (node.nodeType === Node.ELEMENT_NODE) {
163
- const shadowRoot = node.shadowRoot;
164
- if (shadowRoot) {
165
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
166
- acceptNode: this._acceptNode
167
- });
168
- this._walkerStack.unshift(walker);
169
- return NodeFilter.FILTER_ACCEPT;
170
- } else {
171
- var _this_filter;
172
- if (typeof this.filter === 'function') return this.filter(node);
173
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) return this.filter.acceptNode(node);
174
- else if (this.filter === null) return NodeFilter.FILTER_ACCEPT;
175
- }
176
- }
177
- return NodeFilter.FILTER_SKIP;
178
- };
179
- this._doc = doc;
180
- this.root = root;
181
- this.filter = filter !== null && filter !== void 0 ? filter : null;
182
- this.whatToShow = whatToShow !== null && whatToShow !== void 0 ? whatToShow : NodeFilter.SHOW_ALL;
183
- this._currentNode = root;
184
- this._walkerStack.unshift(doc.createTreeWalker(root, whatToShow, this._acceptNode));
185
- const shadowRoot = root.shadowRoot;
186
- if (shadowRoot) {
187
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
188
- acceptNode: this._acceptNode
189
- });
190
- this._walkerStack.unshift(walker);
191
- }
192
- }
193
- }
194
- function $8e13b2545651735a$export$4d0f8be8b12a7ef6(doc, root, whatToShow, filter) {
195
- if ((0, $hdE3O$reactstatelyflags.shadowDOM)()) return new $8e13b2545651735a$export$63eb3ababa9c55c4(doc, root, whatToShow, filter);
196
- return doc.createTreeWalker(root, whatToShow, filter);
197
- }
198
-
199
-
200
- //# sourceMappingURL=ShadowTreeWalker.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;AAAA,0HAA0H;;;AAKnH,MAAM;IAmEX,IAAW,cAAoB;QAC7B,OAAO,IAAI,CAAC,YAAY;IAC1B;IAEA,IAAW,YAAY,IAAU,EAAE;QACjC,IAAI,CAAC,CAAA,GAAA,sCAAW,EAAE,IAAI,CAAC,IAAI,EAAE,OAC3B,MAAM,IAAI,MACR;QAIJ,MAAM,UAAwB,EAAE;QAChC,IAAI,UAAmC;QACvC,IAAI,2BAA2B;QAE/B,IAAI,CAAC,YAAY,GAAG;QAEpB,MAAO,WAAW,YAAY,IAAI,C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,CAAC,MAAM,YAAY;AAChD","sources":["packages/@react-aria/utils/src/shadowdom/ShadowTreeWalker.ts"],"sourcesContent":["// https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts\n\nimport {nodeContains} from './DOMFunctions';\nimport {shadowDOM} from '@react-stately/flags';\n\nexport class ShadowTreeWalker implements TreeWalker {\n public readonly filter: NodeFilter | null;\n public readonly root: Node;\n public readonly whatToShow: number;\n\n private _doc: Document;\n private _walkerStack: Array<TreeWalker> = [];\n private _currentNode: Node;\n private _currentSetFor: Set<TreeWalker> = new Set();\n\n constructor(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n ) {\n this._doc = doc;\n this.root = root;\n this.filter = filter ?? null;\n this.whatToShow = whatToShow ?? NodeFilter.SHOW_ALL;\n this._currentNode = root;\n\n this._walkerStack.unshift(\n doc.createTreeWalker(root, whatToShow, this._acceptNode)\n );\n\n const shadowRoot = (root as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n }\n }\n\n private _acceptNode = (node: Node): number => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const shadowRoot = (node as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n\n return NodeFilter.FILTER_ACCEPT;\n } else {\n if (typeof this.filter === 'function') {\n return this.filter(node);\n } else if (this.filter?.acceptNode) {\n return this.filter.acceptNode(node);\n } else if (this.filter === null) {\n return NodeFilter.FILTER_ACCEPT;\n }\n }\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n public get currentNode(): Node {\n return this._currentNode;\n }\n\n public set currentNode(node: Node) {\n if (!nodeContains(this.root, node)) {\n throw new Error(\n 'Cannot set currentNode to a node that is not contained by the root node.'\n );\n }\n\n const walkers: TreeWalker[] = [];\n let curNode: Node | null | undefined = node;\n let currentWalkerCurrentNode = node;\n\n this._currentNode = node;\n\n while (curNode && curNode !== this.root) {\n if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowRoot = curNode as ShadowRoot;\n\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n curNode = currentWalkerCurrentNode = shadowRoot.host;\n } else {\n curNode = curNode.parentNode;\n }\n }\n\n const walker = this._doc.createTreeWalker(\n this.root,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n this._walkerStack = walkers;\n }\n\n public get doc(): Document {\n return this._doc;\n }\n\n public firstChild(): Node | null {\n let currentNode = this.currentNode;\n let newNode = this.nextNode();\n if (!nodeContains(currentNode, newNode)) {\n this.currentNode = currentNode;\n return null;\n }\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public lastChild(): Node | null {\n let walker = this._walkerStack[0];\n let newNode = walker.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public nextNode(): Node | null {\n const nextNode = this._walkerStack[0].nextNode();\n\n if (nextNode) {\n const shadowRoot = (nextNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(nextNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(nextNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n this.currentNode = nextNode;\n return nextNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (nextNode) {\n this.currentNode = nextNode;\n }\n return nextNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n public previousNode(): Node | null {\n const currentWalker = this._walkerStack[0];\n\n if (currentWalker.currentNode === currentWalker.root) {\n if (this._currentSetFor.has(currentWalker)) {\n this._currentSetFor.delete(currentWalker);\n\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n const previousNode = currentWalker.previousNode();\n\n if (previousNode) {\n const shadowRoot = (previousNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(previousNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(previousNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n /**\n * @deprecated\n */\n public nextSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public previousSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public parentNode(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n}\n\n/**\n * ShadowDOM safe version of document.createTreeWalker.\n */\nexport function createShadowTreeWalker(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n): TreeWalker {\n if (shadowDOM()) {\n return new ShadowTreeWalker(doc, root, whatToShow, filter);\n }\n return doc.createTreeWalker(root, whatToShow, filter);\n}\n"],"names":[],"version":3,"file":"ShadowTreeWalker.main.js.map"}
@@ -1,194 +0,0 @@
1
- import {nodeContains as $d4ee10de306f2510$export$4282f70798064fe0} from "./DOMFunctions.mjs";
2
- import {shadowDOM as $bJKXg$shadowDOM} from "@react-stately/flags";
3
-
4
- // https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts
5
-
6
-
7
- class $dfc540311bf7f109$export$63eb3ababa9c55c4 {
8
- get currentNode() {
9
- return this._currentNode;
10
- }
11
- set currentNode(node) {
12
- if (!(0, $d4ee10de306f2510$export$4282f70798064fe0)(this.root, node)) throw new Error('Cannot set currentNode to a node that is not contained by the root node.');
13
- const walkers = [];
14
- let curNode = node;
15
- let currentWalkerCurrentNode = node;
16
- this._currentNode = node;
17
- while(curNode && curNode !== this.root)if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
18
- const shadowRoot = curNode;
19
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
20
- acceptNode: this._acceptNode
21
- });
22
- walkers.push(walker);
23
- walker.currentNode = currentWalkerCurrentNode;
24
- this._currentSetFor.add(walker);
25
- curNode = currentWalkerCurrentNode = shadowRoot.host;
26
- } else curNode = curNode.parentNode;
27
- const walker = this._doc.createTreeWalker(this.root, this.whatToShow, {
28
- acceptNode: this._acceptNode
29
- });
30
- walkers.push(walker);
31
- walker.currentNode = currentWalkerCurrentNode;
32
- this._currentSetFor.add(walker);
33
- this._walkerStack = walkers;
34
- }
35
- get doc() {
36
- return this._doc;
37
- }
38
- firstChild() {
39
- let currentNode = this.currentNode;
40
- let newNode = this.nextNode();
41
- if (!(0, $d4ee10de306f2510$export$4282f70798064fe0)(currentNode, newNode)) {
42
- this.currentNode = currentNode;
43
- return null;
44
- }
45
- if (newNode) this.currentNode = newNode;
46
- return newNode;
47
- }
48
- lastChild() {
49
- let walker = this._walkerStack[0];
50
- let newNode = walker.lastChild();
51
- if (newNode) this.currentNode = newNode;
52
- return newNode;
53
- }
54
- nextNode() {
55
- const nextNode = this._walkerStack[0].nextNode();
56
- if (nextNode) {
57
- const shadowRoot = nextNode.shadowRoot;
58
- if (shadowRoot) {
59
- var _this_filter;
60
- let nodeResult;
61
- if (typeof this.filter === 'function') nodeResult = this.filter(nextNode);
62
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(nextNode);
63
- if (nodeResult === NodeFilter.FILTER_ACCEPT) {
64
- this.currentNode = nextNode;
65
- return nextNode;
66
- }
67
- // _acceptNode should have added new walker for this shadow,
68
- // go in recursively.
69
- let newNode = this.nextNode();
70
- if (newNode) this.currentNode = newNode;
71
- return newNode;
72
- }
73
- if (nextNode) this.currentNode = nextNode;
74
- return nextNode;
75
- } else {
76
- if (this._walkerStack.length > 1) {
77
- this._walkerStack.shift();
78
- let newNode = this.nextNode();
79
- if (newNode) this.currentNode = newNode;
80
- return newNode;
81
- } else return null;
82
- }
83
- }
84
- previousNode() {
85
- const currentWalker = this._walkerStack[0];
86
- if (currentWalker.currentNode === currentWalker.root) {
87
- if (this._currentSetFor.has(currentWalker)) {
88
- this._currentSetFor.delete(currentWalker);
89
- if (this._walkerStack.length > 1) {
90
- this._walkerStack.shift();
91
- let newNode = this.previousNode();
92
- if (newNode) this.currentNode = newNode;
93
- return newNode;
94
- } else return null;
95
- }
96
- return null;
97
- }
98
- const previousNode = currentWalker.previousNode();
99
- if (previousNode) {
100
- const shadowRoot = previousNode.shadowRoot;
101
- if (shadowRoot) {
102
- var _this_filter;
103
- let nodeResult;
104
- if (typeof this.filter === 'function') nodeResult = this.filter(previousNode);
105
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(previousNode);
106
- if (nodeResult === NodeFilter.FILTER_ACCEPT) {
107
- if (previousNode) this.currentNode = previousNode;
108
- return previousNode;
109
- }
110
- // _acceptNode should have added new walker for this shadow,
111
- // go in recursively.
112
- let newNode = this.lastChild();
113
- if (newNode) this.currentNode = newNode;
114
- return newNode;
115
- }
116
- if (previousNode) this.currentNode = previousNode;
117
- return previousNode;
118
- } else {
119
- if (this._walkerStack.length > 1) {
120
- this._walkerStack.shift();
121
- let newNode = this.previousNode();
122
- if (newNode) this.currentNode = newNode;
123
- return newNode;
124
- } else return null;
125
- }
126
- }
127
- /**
128
- * @deprecated
129
- */ nextSibling() {
130
- // if (__DEV__) {
131
- // throw new Error("Method not implemented.");
132
- // }
133
- return null;
134
- }
135
- /**
136
- * @deprecated
137
- */ previousSibling() {
138
- // if (__DEV__) {
139
- // throw new Error("Method not implemented.");
140
- // }
141
- return null;
142
- }
143
- /**
144
- * @deprecated
145
- */ parentNode() {
146
- // if (__DEV__) {
147
- // throw new Error("Method not implemented.");
148
- // }
149
- return null;
150
- }
151
- constructor(doc, root, whatToShow, filter){
152
- this._walkerStack = [];
153
- this._currentSetFor = new Set();
154
- this._acceptNode = (node)=>{
155
- if (node.nodeType === Node.ELEMENT_NODE) {
156
- const shadowRoot = node.shadowRoot;
157
- if (shadowRoot) {
158
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
159
- acceptNode: this._acceptNode
160
- });
161
- this._walkerStack.unshift(walker);
162
- return NodeFilter.FILTER_ACCEPT;
163
- } else {
164
- var _this_filter;
165
- if (typeof this.filter === 'function') return this.filter(node);
166
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) return this.filter.acceptNode(node);
167
- else if (this.filter === null) return NodeFilter.FILTER_ACCEPT;
168
- }
169
- }
170
- return NodeFilter.FILTER_SKIP;
171
- };
172
- this._doc = doc;
173
- this.root = root;
174
- this.filter = filter !== null && filter !== void 0 ? filter : null;
175
- this.whatToShow = whatToShow !== null && whatToShow !== void 0 ? whatToShow : NodeFilter.SHOW_ALL;
176
- this._currentNode = root;
177
- this._walkerStack.unshift(doc.createTreeWalker(root, whatToShow, this._acceptNode));
178
- const shadowRoot = root.shadowRoot;
179
- if (shadowRoot) {
180
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
181
- acceptNode: this._acceptNode
182
- });
183
- this._walkerStack.unshift(walker);
184
- }
185
- }
186
- }
187
- function $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root, whatToShow, filter) {
188
- if ((0, $bJKXg$shadowDOM)()) return new $dfc540311bf7f109$export$63eb3ababa9c55c4(doc, root, whatToShow, filter);
189
- return doc.createTreeWalker(root, whatToShow, filter);
190
- }
191
-
192
-
193
- export {$dfc540311bf7f109$export$63eb3ababa9c55c4 as ShadowTreeWalker, $dfc540311bf7f109$export$4d0f8be8b12a7ef6 as createShadowTreeWalker};
194
- //# sourceMappingURL=ShadowTreeWalker.module.js.map
@@ -1,194 +0,0 @@
1
- import {nodeContains as $d4ee10de306f2510$export$4282f70798064fe0} from "./DOMFunctions.module.js";
2
- import {shadowDOM as $bJKXg$shadowDOM} from "@react-stately/flags";
3
-
4
- // https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts
5
-
6
-
7
- class $dfc540311bf7f109$export$63eb3ababa9c55c4 {
8
- get currentNode() {
9
- return this._currentNode;
10
- }
11
- set currentNode(node) {
12
- if (!(0, $d4ee10de306f2510$export$4282f70798064fe0)(this.root, node)) throw new Error('Cannot set currentNode to a node that is not contained by the root node.');
13
- const walkers = [];
14
- let curNode = node;
15
- let currentWalkerCurrentNode = node;
16
- this._currentNode = node;
17
- while(curNode && curNode !== this.root)if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
18
- const shadowRoot = curNode;
19
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
20
- acceptNode: this._acceptNode
21
- });
22
- walkers.push(walker);
23
- walker.currentNode = currentWalkerCurrentNode;
24
- this._currentSetFor.add(walker);
25
- curNode = currentWalkerCurrentNode = shadowRoot.host;
26
- } else curNode = curNode.parentNode;
27
- const walker = this._doc.createTreeWalker(this.root, this.whatToShow, {
28
- acceptNode: this._acceptNode
29
- });
30
- walkers.push(walker);
31
- walker.currentNode = currentWalkerCurrentNode;
32
- this._currentSetFor.add(walker);
33
- this._walkerStack = walkers;
34
- }
35
- get doc() {
36
- return this._doc;
37
- }
38
- firstChild() {
39
- let currentNode = this.currentNode;
40
- let newNode = this.nextNode();
41
- if (!(0, $d4ee10de306f2510$export$4282f70798064fe0)(currentNode, newNode)) {
42
- this.currentNode = currentNode;
43
- return null;
44
- }
45
- if (newNode) this.currentNode = newNode;
46
- return newNode;
47
- }
48
- lastChild() {
49
- let walker = this._walkerStack[0];
50
- let newNode = walker.lastChild();
51
- if (newNode) this.currentNode = newNode;
52
- return newNode;
53
- }
54
- nextNode() {
55
- const nextNode = this._walkerStack[0].nextNode();
56
- if (nextNode) {
57
- const shadowRoot = nextNode.shadowRoot;
58
- if (shadowRoot) {
59
- var _this_filter;
60
- let nodeResult;
61
- if (typeof this.filter === 'function') nodeResult = this.filter(nextNode);
62
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(nextNode);
63
- if (nodeResult === NodeFilter.FILTER_ACCEPT) {
64
- this.currentNode = nextNode;
65
- return nextNode;
66
- }
67
- // _acceptNode should have added new walker for this shadow,
68
- // go in recursively.
69
- let newNode = this.nextNode();
70
- if (newNode) this.currentNode = newNode;
71
- return newNode;
72
- }
73
- if (nextNode) this.currentNode = nextNode;
74
- return nextNode;
75
- } else {
76
- if (this._walkerStack.length > 1) {
77
- this._walkerStack.shift();
78
- let newNode = this.nextNode();
79
- if (newNode) this.currentNode = newNode;
80
- return newNode;
81
- } else return null;
82
- }
83
- }
84
- previousNode() {
85
- const currentWalker = this._walkerStack[0];
86
- if (currentWalker.currentNode === currentWalker.root) {
87
- if (this._currentSetFor.has(currentWalker)) {
88
- this._currentSetFor.delete(currentWalker);
89
- if (this._walkerStack.length > 1) {
90
- this._walkerStack.shift();
91
- let newNode = this.previousNode();
92
- if (newNode) this.currentNode = newNode;
93
- return newNode;
94
- } else return null;
95
- }
96
- return null;
97
- }
98
- const previousNode = currentWalker.previousNode();
99
- if (previousNode) {
100
- const shadowRoot = previousNode.shadowRoot;
101
- if (shadowRoot) {
102
- var _this_filter;
103
- let nodeResult;
104
- if (typeof this.filter === 'function') nodeResult = this.filter(previousNode);
105
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(previousNode);
106
- if (nodeResult === NodeFilter.FILTER_ACCEPT) {
107
- if (previousNode) this.currentNode = previousNode;
108
- return previousNode;
109
- }
110
- // _acceptNode should have added new walker for this shadow,
111
- // go in recursively.
112
- let newNode = this.lastChild();
113
- if (newNode) this.currentNode = newNode;
114
- return newNode;
115
- }
116
- if (previousNode) this.currentNode = previousNode;
117
- return previousNode;
118
- } else {
119
- if (this._walkerStack.length > 1) {
120
- this._walkerStack.shift();
121
- let newNode = this.previousNode();
122
- if (newNode) this.currentNode = newNode;
123
- return newNode;
124
- } else return null;
125
- }
126
- }
127
- /**
128
- * @deprecated
129
- */ nextSibling() {
130
- // if (__DEV__) {
131
- // throw new Error("Method not implemented.");
132
- // }
133
- return null;
134
- }
135
- /**
136
- * @deprecated
137
- */ previousSibling() {
138
- // if (__DEV__) {
139
- // throw new Error("Method not implemented.");
140
- // }
141
- return null;
142
- }
143
- /**
144
- * @deprecated
145
- */ parentNode() {
146
- // if (__DEV__) {
147
- // throw new Error("Method not implemented.");
148
- // }
149
- return null;
150
- }
151
- constructor(doc, root, whatToShow, filter){
152
- this._walkerStack = [];
153
- this._currentSetFor = new Set();
154
- this._acceptNode = (node)=>{
155
- if (node.nodeType === Node.ELEMENT_NODE) {
156
- const shadowRoot = node.shadowRoot;
157
- if (shadowRoot) {
158
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
159
- acceptNode: this._acceptNode
160
- });
161
- this._walkerStack.unshift(walker);
162
- return NodeFilter.FILTER_ACCEPT;
163
- } else {
164
- var _this_filter;
165
- if (typeof this.filter === 'function') return this.filter(node);
166
- else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) return this.filter.acceptNode(node);
167
- else if (this.filter === null) return NodeFilter.FILTER_ACCEPT;
168
- }
169
- }
170
- return NodeFilter.FILTER_SKIP;
171
- };
172
- this._doc = doc;
173
- this.root = root;
174
- this.filter = filter !== null && filter !== void 0 ? filter : null;
175
- this.whatToShow = whatToShow !== null && whatToShow !== void 0 ? whatToShow : NodeFilter.SHOW_ALL;
176
- this._currentNode = root;
177
- this._walkerStack.unshift(doc.createTreeWalker(root, whatToShow, this._acceptNode));
178
- const shadowRoot = root.shadowRoot;
179
- if (shadowRoot) {
180
- const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
181
- acceptNode: this._acceptNode
182
- });
183
- this._walkerStack.unshift(walker);
184
- }
185
- }
186
- }
187
- function $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root, whatToShow, filter) {
188
- if ((0, $bJKXg$shadowDOM)()) return new $dfc540311bf7f109$export$63eb3ababa9c55c4(doc, root, whatToShow, filter);
189
- return doc.createTreeWalker(root, whatToShow, filter);
190
- }
191
-
192
-
193
- export {$dfc540311bf7f109$export$63eb3ababa9c55c4 as ShadowTreeWalker, $dfc540311bf7f109$export$4d0f8be8b12a7ef6 as createShadowTreeWalker};
194
- //# sourceMappingURL=ShadowTreeWalker.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;AAAA,0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AS,IAAI,CAAC,IAAI,CAAC,gBAAgB,CACvC,YACA,IAAI,CAAC,UAAU,EACf;gBAAC,YAAY,IAAI,CAAC,WAAW;YAAA;YAG/B,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAC5B;IACF;AAqQF;AAKO,SAAS,0CACZ,GAAa,EACb,IAAU,EACV,UAAmB,EACnB,MAA0B;IAE5B,IAAI,CAAA,GAAA,gBAAQ,KACV,OAAO,IAAI,0CAAiB,KAAK,MAAM,YAAY;IAErD,OAAO,IAAI,gBAAgB,CAAC,MAAM,YAAY;AAChD","sources":["packages/@react-aria/utils/src/shadowdom/ShadowTreeWalker.ts"],"sourcesContent":["// https://github.com/microsoft/tabster/blob/a89fc5d7e332d48f68d03b1ca6e344489d1c3898/src/Shadowdomize/ShadowTreeWalker.ts\n\nimport {nodeContains} from './DOMFunctions';\nimport {shadowDOM} from '@react-stately/flags';\n\nexport class ShadowTreeWalker implements TreeWalker {\n public readonly filter: NodeFilter | null;\n public readonly root: Node;\n public readonly whatToShow: number;\n\n private _doc: Document;\n private _walkerStack: Array<TreeWalker> = [];\n private _currentNode: Node;\n private _currentSetFor: Set<TreeWalker> = new Set();\n\n constructor(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n ) {\n this._doc = doc;\n this.root = root;\n this.filter = filter ?? null;\n this.whatToShow = whatToShow ?? NodeFilter.SHOW_ALL;\n this._currentNode = root;\n\n this._walkerStack.unshift(\n doc.createTreeWalker(root, whatToShow, this._acceptNode)\n );\n\n const shadowRoot = (root as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n }\n }\n\n private _acceptNode = (node: Node): number => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const shadowRoot = (node as Element).shadowRoot;\n\n if (shadowRoot) {\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n this._walkerStack.unshift(walker);\n\n return NodeFilter.FILTER_ACCEPT;\n } else {\n if (typeof this.filter === 'function') {\n return this.filter(node);\n } else if (this.filter?.acceptNode) {\n return this.filter.acceptNode(node);\n } else if (this.filter === null) {\n return NodeFilter.FILTER_ACCEPT;\n }\n }\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n public get currentNode(): Node {\n return this._currentNode;\n }\n\n public set currentNode(node: Node) {\n if (!nodeContains(this.root, node)) {\n throw new Error(\n 'Cannot set currentNode to a node that is not contained by the root node.'\n );\n }\n\n const walkers: TreeWalker[] = [];\n let curNode: Node | null | undefined = node;\n let currentWalkerCurrentNode = node;\n\n this._currentNode = node;\n\n while (curNode && curNode !== this.root) {\n if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowRoot = curNode as ShadowRoot;\n\n const walker = this._doc.createTreeWalker(\n shadowRoot,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n curNode = currentWalkerCurrentNode = shadowRoot.host;\n } else {\n curNode = curNode.parentNode;\n }\n }\n\n const walker = this._doc.createTreeWalker(\n this.root,\n this.whatToShow,\n {acceptNode: this._acceptNode}\n );\n\n walkers.push(walker);\n\n walker.currentNode = currentWalkerCurrentNode;\n\n this._currentSetFor.add(walker);\n\n this._walkerStack = walkers;\n }\n\n public get doc(): Document {\n return this._doc;\n }\n\n public firstChild(): Node | null {\n let currentNode = this.currentNode;\n let newNode = this.nextNode();\n if (!nodeContains(currentNode, newNode)) {\n this.currentNode = currentNode;\n return null;\n }\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public lastChild(): Node | null {\n let walker = this._walkerStack[0];\n let newNode = walker.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n public nextNode(): Node | null {\n const nextNode = this._walkerStack[0].nextNode();\n\n if (nextNode) {\n const shadowRoot = (nextNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(nextNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(nextNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n this.currentNode = nextNode;\n return nextNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (nextNode) {\n this.currentNode = nextNode;\n }\n return nextNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.nextNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n public previousNode(): Node | null {\n const currentWalker = this._walkerStack[0];\n\n if (currentWalker.currentNode === currentWalker.root) {\n if (this._currentSetFor.has(currentWalker)) {\n this._currentSetFor.delete(currentWalker);\n\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n\n return null;\n }\n\n const previousNode = currentWalker.previousNode();\n\n if (previousNode) {\n const shadowRoot = (previousNode as Element).shadowRoot;\n\n if (shadowRoot) {\n let nodeResult: number | undefined;\n\n if (typeof this.filter === 'function') {\n nodeResult = this.filter(previousNode);\n } else if (this.filter?.acceptNode) {\n nodeResult = this.filter.acceptNode(previousNode);\n }\n\n if (nodeResult === NodeFilter.FILTER_ACCEPT) {\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n }\n\n // _acceptNode should have added new walker for this shadow,\n // go in recursively.\n let newNode = this.lastChild();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n }\n\n if (previousNode) {\n this.currentNode = previousNode;\n }\n return previousNode;\n } else {\n if (this._walkerStack.length > 1) {\n this._walkerStack.shift();\n\n let newNode = this.previousNode();\n if (newNode) {\n this.currentNode = newNode;\n }\n return newNode;\n } else {\n return null;\n }\n }\n }\n\n /**\n * @deprecated\n */\n public nextSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public previousSibling(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n\n /**\n * @deprecated\n */\n public parentNode(): Node | null {\n // if (__DEV__) {\n // throw new Error(\"Method not implemented.\");\n // }\n\n return null;\n }\n}\n\n/**\n * ShadowDOM safe version of document.createTreeWalker.\n */\nexport function createShadowTreeWalker(\n doc: Document,\n root: Node,\n whatToShow?: number,\n filter?: NodeFilter | null\n): TreeWalker {\n if (shadowDOM()) {\n return new ShadowTreeWalker(doc, root, whatToShow, filter);\n }\n return doc.createTreeWalker(root, whatToShow, filter);\n}\n"],"names":[],"version":3,"file":"ShadowTreeWalker.module.js.map"}