matsuri-hooks 4.2.26 → 4.2.27-alpha-e4a49e9.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.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getConfig
3
- } from "./chunk-VE65KYR3.js";
3
+ } from "./chunk-BPWNWVBA.js";
4
4
  import {
5
5
  __export
6
- } from "./chunk-2TUXWMP5.js";
6
+ } from "./chunk-UN725CXD.js";
7
7
 
8
8
  // node_modules/@testing-library/user-event/dist/esm/utils/misc/isElementType.js
9
9
  function isElementType(element, tag, props) {
@@ -113,9 +113,12 @@ var DataTransferItemStub = class {
113
113
  }
114
114
  }
115
115
  };
116
+ function toAsciiLowercase(value) {
117
+ return value.replace(/[A-Z]/g, (char) => char.toLowerCase());
118
+ }
116
119
  var DataTransferItemListStub = class extends Array {
117
120
  add(...args) {
118
- const item = new DataTransferItemStub(args[0], args[1]);
121
+ const item = typeof args[0] === "string" ? new DataTransferItemStub(args[0], toAsciiLowercase(args[1])) : new DataTransferItemStub(args[0]);
119
122
  this.push(item);
120
123
  return item;
121
124
  }
@@ -126,6 +129,10 @@ var DataTransferItemListStub = class extends Array {
126
129
  this.splice(index, 1);
127
130
  }
128
131
  };
132
+ function normalizeFormat(format) {
133
+ const type3 = toAsciiLowercase(format);
134
+ return type3 === "text" ? "text/plain" : type3 === "url" ? "text/uri-list" : type3;
135
+ }
129
136
  function getTypeMatcher(type3, exact) {
130
137
  const [group, sub] = type3.split("/");
131
138
  const isGroup = !sub || sub === "*";
@@ -137,7 +144,8 @@ function createDataTransferStub(window) {
137
144
  return new class DataTransferStub {
138
145
  getData(format) {
139
146
  var _this_items_find;
140
- const match = (_this_items_find = this.items.find(getTypeMatcher(format, true))) !== null && _this_items_find !== void 0 ? _this_items_find : this.items.find(getTypeMatcher(format, false));
147
+ const type3 = normalizeFormat(format);
148
+ const match = (_this_items_find = this.items.find(getTypeMatcher(type3, true))) !== null && _this_items_find !== void 0 ? _this_items_find : this.items.find(getTypeMatcher(type3, false));
141
149
  let text = "";
142
150
  match === null || match === void 0 ? void 0 : match.getAsString((t) => {
143
151
  text = t;
@@ -145,8 +153,9 @@ function createDataTransferStub(window) {
145
153
  return text;
146
154
  }
147
155
  setData(format, data) {
148
- const matchIndex = this.items.findIndex(getTypeMatcher(format, true));
149
- const item = new DataTransferItemStub(data, format);
156
+ const type3 = normalizeFormat(format);
157
+ const matchIndex = this.items.findIndex(getTypeMatcher(type3, true));
158
+ const item = new DataTransferItemStub(data, type3);
150
159
  if (matchIndex >= 0) {
151
160
  this.items.splice(matchIndex, 1, item);
152
161
  } else {
@@ -155,7 +164,8 @@ function createDataTransferStub(window) {
155
164
  }
156
165
  clearData(format) {
157
166
  if (format) {
158
- const matchIndex = this.items.findIndex(getTypeMatcher(format, true));
167
+ const type3 = normalizeFormat(format);
168
+ const matchIndex = this.items.findIndex(getTypeMatcher(type3, true));
159
169
  if (matchIndex >= 0) {
160
170
  this.items.remove(matchIndex);
161
171
  }
@@ -426,6 +436,11 @@ function getActiveElement(document) {
426
436
  if (activeElementInShadowTree) {
427
437
  return activeElementInShadowTree;
428
438
  }
439
+ } else if (activeElement && isElementType(activeElement, "iframe")) {
440
+ const contentDocument = activeElement.contentDocument;
441
+ if (contentDocument) {
442
+ return getActiveElement(contentDocument);
443
+ }
429
444
  }
430
445
  if (isDisabled(activeElement)) {
431
446
  return document.ownerDocument ? (
@@ -4189,4 +4204,4 @@ var userEvent = {
4189
4204
  export {
4190
4205
  userEvent
4191
4206
  };
4192
- //# sourceMappingURL=chunk-7DND5YAV.js.map
4207
+ //# sourceMappingURL=chunk-FSZYXURU.js.map