@lark-apaas/miaoda-inspector 0.1.0-alpha.1 → 0.1.0-alpha.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.
Files changed (88) hide show
  1. package/dist/es/Inspector/{Inspector.js → Inspector.mjs} +50 -55
  2. package/dist/es/Inspector/{Overlay.js → Overlay.mjs} +157 -125
  3. package/dist/es/Inspector/hooks/use-effect-event.mjs +17 -0
  4. package/dist/es/Inspector/hooks/use-layout-effect.mjs +9 -0
  5. package/dist/es/Inspector/hooks/{use-mouse.js → use-mouse.mjs} +8 -4
  6. package/dist/es/Inspector/index.mjs +5 -0
  7. package/dist/es/Inspector/utils/fiber.mjs +70 -0
  8. package/dist/es/Inspector/utils/highlight.mjs +78 -0
  9. package/dist/es/Inspector/utils/inspect.mjs +131 -0
  10. package/dist/es/Inspector/utils/{overlay.js → overlay.mjs} +7 -2
  11. package/dist/es/MiaodaInspector/MiaodaInspector.mjs +427 -0
  12. package/dist/es/MiaodaInspector/index.mjs +5 -0
  13. package/dist/es/chunk-I4E63NIC.mjs +24 -0
  14. package/dist/es/config/{ui-config.js → ui-config.mjs} +66 -286
  15. package/dist/es/global.d.mjs +0 -0
  16. package/dist/es/index.mjs +7 -0
  17. package/dist/es/types/iframe-events.mjs +0 -0
  18. package/dist/es/types/index.mjs +27 -0
  19. package/dist/es/utils/{config-mapper.js → config-mapper.mjs} +14 -56
  20. package/dist/es/utils/{css.js → css.mjs} +5 -1
  21. package/dist/es/utils/index.mjs +37 -0
  22. package/dist/es/utils/origin.mjs +26 -0
  23. package/dist/es/utils/style-calculator.mjs +177 -0
  24. package/dist/lib/Inspector/Inspector.js +99 -104
  25. package/dist/lib/Inspector/Overlay.js +172 -143
  26. package/dist/lib/Inspector/hooks/index.js +19 -19
  27. package/dist/lib/Inspector/hooks/use-effect-event.js +26 -15
  28. package/dist/lib/Inspector/hooks/use-layout-effect.js +25 -10
  29. package/dist/lib/Inspector/hooks/use-mouse.js +27 -14
  30. package/dist/lib/Inspector/index.js +21 -8
  31. package/dist/lib/Inspector/utils/fiber.js +49 -55
  32. package/dist/lib/Inspector/utils/highlight.js +44 -31
  33. package/dist/lib/Inspector/utils/index.js +19 -19
  34. package/dist/lib/Inspector/utils/inspect.js +62 -72
  35. package/dist/lib/Inspector/utils/overlay.js +20 -15
  36. package/dist/lib/MiaodaInspector/MiaodaInspector.js +265 -266
  37. package/dist/lib/MiaodaInspector/index.js +21 -8
  38. package/dist/lib/config/ui-config.js +81 -292
  39. package/dist/lib/global.d.js +1 -0
  40. package/dist/lib/index.js +22 -17
  41. package/dist/lib/types/iframe-events.js +15 -3
  42. package/dist/lib/types/index.js +30 -43
  43. package/dist/lib/utils/config-mapper.js +41 -69
  44. package/dist/lib/utils/css.js +33 -15
  45. package/dist/lib/utils/index.js +36 -57
  46. package/dist/lib/utils/origin.js +23 -22
  47. package/dist/lib/utils/style-calculator.js +113 -110
  48. package/dist/types/Inspector/Inspector.d.ts +95 -92
  49. package/dist/types/Inspector/Overlay.d.ts +61 -58
  50. package/dist/types/Inspector/hooks/index.d.ts +4 -3
  51. package/dist/types/Inspector/hooks/use-effect-event.d.ts +3 -1
  52. package/dist/types/Inspector/hooks/use-layout-effect.d.ts +5 -2
  53. package/dist/types/Inspector/hooks/use-mouse.d.ts +9 -8
  54. package/dist/types/Inspector/index.d.ts +4 -1
  55. package/dist/types/Inspector/utils/fiber.d.ts +12 -10
  56. package/dist/types/Inspector/utils/highlight.d.ts +7 -5
  57. package/dist/types/Inspector/utils/index.d.ts +4 -3
  58. package/dist/types/Inspector/utils/inspect.d.ts +45 -42
  59. package/dist/types/Inspector/utils/overlay.d.ts +24 -22
  60. package/dist/types/MiaodaInspector/MiaodaInspector.d.ts +42 -41
  61. package/dist/types/MiaodaInspector/index.d.ts +3 -1
  62. package/dist/types/config/ui-config.d.ts +42 -41
  63. package/dist/types/global.d.d.ts +17 -0
  64. package/dist/types/index.d.ts +5 -4
  65. package/dist/types/types/iframe-events.d.ts +133 -130
  66. package/dist/types/types/index.d.ts +2 -1
  67. package/dist/types/utils/config-mapper.d.ts +14 -11
  68. package/dist/types/utils/css.d.ts +5 -2
  69. package/dist/types/utils/index.d.ts +7 -3
  70. package/dist/types/utils/origin.d.ts +12 -8
  71. package/dist/types/utils/style-calculator.d.ts +20 -17
  72. package/package.json +13 -13
  73. package/dist/es/Inspector/hooks/use-effect-event.js +0 -15
  74. package/dist/es/Inspector/hooks/use-layout-effect.js +0 -3
  75. package/dist/es/Inspector/index.js +0 -1
  76. package/dist/es/Inspector/utils/fiber.js +0 -61
  77. package/dist/es/Inspector/utils/highlight.js +0 -74
  78. package/dist/es/Inspector/utils/inspect.js +0 -119
  79. package/dist/es/MiaodaInspector/MiaodaInspector.js +0 -397
  80. package/dist/es/MiaodaInspector/index.js +0 -1
  81. package/dist/es/index.js +0 -2
  82. package/dist/es/types/iframe-events.js +0 -1
  83. package/dist/es/types/index.js +0 -1
  84. package/dist/es/utils/index.js +0 -3
  85. package/dist/es/utils/origin.js +0 -19
  86. package/dist/es/utils/style-calculator.js +0 -158
  87. /package/dist/es/Inspector/hooks/{index.js → index.mjs} +0 -0
  88. /package/dist/es/Inspector/utils/{index.js → index.mjs} +0 -0
@@ -1,23 +1,28 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
6
7
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- Overlay: function() {
14
- return Overlay;
15
- },
16
- ClickOverlay: function() {
17
- return ClickOverlay;
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var Overlay_exports = {};
20
+ __export(Overlay_exports, {
21
+ ClickOverlay: () => ClickOverlay,
22
+ Overlay: () => Overlay
19
23
  });
20
- const _utils = require("./utils");
24
+ module.exports = __toCommonJS(Overlay_exports);
25
+ var import_utils = require("./utils");
21
26
  const overlayStyles = {
22
27
  padding: "transparent",
23
28
  margin: "transparent",
@@ -70,24 +75,6 @@ function findTipPos(dims, bounds, tipSize) {
70
75
  };
71
76
  }
72
77
  class OverlayRect {
73
- remove() {
74
- if (this.node.parentNode) {
75
- this.node.parentNode.removeChild(this.node);
76
- }
77
- }
78
- update(box, dims) {
79
- boxWrap(dims, "margin", this.node);
80
- boxWrap(dims, "border", this.border);
81
- boxWrap(dims, "padding", this.padding);
82
- Object.assign(this.content.style, {
83
- height: `${box.height - dims.borderTop - dims.borderBottom - dims.paddingTop - dims.paddingBottom}px`,
84
- width: `${box.width - dims.borderLeft - dims.borderRight - dims.paddingLeft - dims.paddingRight}px`
85
- });
86
- Object.assign(this.node.style, {
87
- top: `${box.top - dims.marginTop}px`,
88
- left: `${box.left - dims.marginLeft}px`
89
- });
90
- }
91
78
  constructor(doc, container) {
92
79
  this.node = doc.createElement("div");
93
80
  this.border = doc.createElement("div");
@@ -107,21 +94,26 @@ class OverlayRect {
107
94
  this.padding.appendChild(this.content);
108
95
  container.prepend(this.node);
109
96
  }
110
- }
111
- class ClickOverlayRect {
112
97
  remove() {
113
98
  if (this.node.parentNode) {
114
99
  this.node.parentNode.removeChild(this.node);
115
100
  }
116
101
  }
117
102
  update(box, dims) {
103
+ boxWrap(dims, "margin", this.node);
104
+ boxWrap(dims, "border", this.border);
105
+ boxWrap(dims, "padding", this.padding);
106
+ Object.assign(this.content.style, {
107
+ height: `${box.height - dims.borderTop - dims.borderBottom - dims.paddingTop - dims.paddingBottom}px`,
108
+ width: `${box.width - dims.borderLeft - dims.borderRight - dims.paddingLeft - dims.paddingRight}px`
109
+ });
118
110
  Object.assign(this.node.style, {
119
- top: `${box.top - 1 - dims.marginTop}px`,
120
- left: `${box.left - 1 - dims.marginLeft}px`,
121
- width: `${box.width + dims.marginLeft + dims.marginRight + 2}px`,
122
- height: `${box.height + dims.marginTop + dims.marginBottom + 2}px`
111
+ top: `${box.top - dims.marginTop}px`,
112
+ left: `${box.left - dims.marginLeft}px`
123
113
  });
124
114
  }
115
+ }
116
+ class ClickOverlayRect {
125
117
  constructor(doc, container) {
126
118
  this.node = doc.createElement("div");
127
119
  this.border = doc.createElement("div");
@@ -143,36 +135,21 @@ class ClickOverlayRect {
143
135
  this.node.appendChild(this.border);
144
136
  container.appendChild(this.node);
145
137
  }
146
- }
147
- class OverlayTip {
148
138
  remove() {
149
- if (this.tip.parentNode) {
150
- this.tip.parentNode.removeChild(this.tip);
151
- }
152
- }
153
- updateText(name) {
154
- this.titleDiv.textContent = name;
155
- }
156
- updatePosition(dims, bounds) {
157
- const tipRect = this.tip.getBoundingClientRect();
158
- const tipPos = findTipPos(dims, bounds, {
159
- width: tipRect.width,
160
- height: tipRect.height
161
- });
162
- Object.assign(this.tip.style, tipPos.style);
163
- if (dims.width === 0 || dims.height === 0) {
164
- this.invisible();
165
- } else {
166
- Object.assign(this.tip.style, {
167
- display: "flex"
168
- });
139
+ if (this.node.parentNode) {
140
+ this.node.parentNode.removeChild(this.node);
169
141
  }
170
142
  }
171
- invisible() {
172
- Object.assign(this.tip.style, {
173
- display: "none"
143
+ update(box, dims) {
144
+ Object.assign(this.node.style, {
145
+ top: `${box.top - 1 - dims.marginTop}px`,
146
+ left: `${box.left - 1 - dims.marginLeft}px`,
147
+ width: `${box.width + dims.marginLeft + dims.marginRight + 2}px`,
148
+ height: `${box.height + dims.marginTop + dims.marginBottom + 2}px`
174
149
  });
175
150
  }
151
+ }
152
+ class OverlayTip {
176
153
  constructor(doc, container) {
177
154
  this.tip = doc.createElement("div");
178
155
  Object.assign(this.tip.style, {
@@ -206,8 +183,62 @@ class OverlayTip {
206
183
  this.tip.style.zIndex = "10000000";
207
184
  container.appendChild(this.tip);
208
185
  }
186
+ remove() {
187
+ if (this.tip.parentNode) {
188
+ this.tip.parentNode.removeChild(this.tip);
189
+ }
190
+ }
191
+ updateText(name) {
192
+ this.titleDiv.textContent = name;
193
+ }
194
+ updatePosition(dims, bounds) {
195
+ const tipRect = this.tip.getBoundingClientRect();
196
+ const tipPos = findTipPos(dims, bounds, {
197
+ width: tipRect.width,
198
+ height: tipRect.height
199
+ });
200
+ Object.assign(this.tip.style, tipPos.style);
201
+ if (dims.width === 0 || dims.height === 0) {
202
+ this.invisible();
203
+ } else {
204
+ Object.assign(this.tip.style, {
205
+ display: "flex"
206
+ });
207
+ }
208
+ }
209
+ invisible() {
210
+ Object.assign(this.tip.style, {
211
+ display: "none"
212
+ });
213
+ }
209
214
  }
210
215
  class Overlay {
216
+ constructor(handleCodeInfo) {
217
+ this.handleCodeInfo = handleCodeInfo;
218
+ const currentWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
219
+ this.window = currentWindow;
220
+ const tipBoundsWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
221
+ this.tipBoundsWindow = tipBoundsWindow;
222
+ const doc = currentWindow.document;
223
+ this.container = doc.createElement("div");
224
+ this.container.style.zIndex = "10000000";
225
+ this.tip = new OverlayTip(doc, this.container);
226
+ this.rects = [];
227
+ this.removeCallback = () => {
228
+ };
229
+ let rafId = null;
230
+ this.resizeObserver = new ResizeObserver(() => {
231
+ if (rafId) {
232
+ cancelAnimationFrame(rafId);
233
+ }
234
+ rafId = requestAnimationFrame(() => {
235
+ if (this.currentElements && this.currentName) {
236
+ this.updatePositions(this.currentElements, this.currentName);
237
+ }
238
+ });
239
+ });
240
+ doc.body.appendChild(this.container);
241
+ }
211
242
  remove() {
212
243
  this.tip.remove();
213
244
  this.rects.forEach((rect) => {
@@ -228,7 +259,7 @@ class Overlay {
228
259
  this.currentElements = nodes;
229
260
  while (this.rects.length > elements.length) {
230
261
  const rect = this.rects.pop();
231
- rect === null || rect === void 0 ? void 0 : rect.remove();
262
+ rect == null ? void 0 : rect.remove();
232
263
  }
233
264
  if (elements.length === 0) {
234
265
  return;
@@ -242,7 +273,7 @@ class Overlay {
242
273
  const elements = nodes.filter((node) => node.nodeType === Node.ELEMENT_NODE);
243
274
  while (this.rects.length > elements.length) {
244
275
  const rect = this.rects.pop();
245
- rect === null || rect === void 0 ? void 0 : rect.remove();
276
+ rect == null ? void 0 : rect.remove();
246
277
  }
247
278
  if (elements.length === 0) {
248
279
  return;
@@ -257,11 +288,17 @@ class Overlay {
257
288
  left: Number.POSITIVE_INFINITY
258
289
  };
259
290
  elements.forEach((element, index) => {
260
- const box = (0, _utils.getNestedBoundingClientRect)(element, this.window);
261
- const dims = (0, _utils.getElementDimensions)(element);
291
+ const box = (0, import_utils.getNestedBoundingClientRect)(element, this.window);
292
+ const dims = (0, import_utils.getElementDimensions)(element);
262
293
  outerBox.top = Math.min(outerBox.top, box.top - dims.marginTop);
263
- outerBox.right = Math.max(outerBox.right, box.left + box.width + dims.marginRight);
264
- outerBox.bottom = Math.max(outerBox.bottom, box.top + box.height + dims.marginBottom);
294
+ outerBox.right = Math.max(
295
+ outerBox.right,
296
+ box.left + box.width + dims.marginRight
297
+ );
298
+ outerBox.bottom = Math.max(
299
+ outerBox.bottom,
300
+ box.top + box.height + dims.marginBottom
301
+ );
265
302
  outerBox.left = Math.min(outerBox.left, box.left - dims.marginLeft);
266
303
  const rect = this.rects[index];
267
304
  rect.update(box, dims);
@@ -276,55 +313,63 @@ class Overlay {
276
313
  } else {
277
314
  this.tip.updateText(name);
278
315
  }
279
- const tipBounds = (0, _utils.getNestedBoundingClientRect)(this.tipBoundsWindow.document.documentElement, this.window);
280
- this.tip.updatePosition({
281
- top: outerBox.top,
282
- left: outerBox.left,
283
- height: outerBox.bottom - outerBox.top,
284
- width: outerBox.right - outerBox.left
285
- }, {
286
- top: tipBounds.top + this.tipBoundsWindow.scrollY,
287
- left: tipBounds.left + this.tipBoundsWindow.scrollX,
288
- height: this.tipBoundsWindow.innerHeight,
289
- width: this.tipBoundsWindow.innerWidth
290
- });
316
+ const tipBounds = (0, import_utils.getNestedBoundingClientRect)(
317
+ this.tipBoundsWindow.document.documentElement,
318
+ this.window
319
+ );
320
+ this.tip.updatePosition(
321
+ {
322
+ top: outerBox.top,
323
+ left: outerBox.left,
324
+ height: outerBox.bottom - outerBox.top,
325
+ width: outerBox.right - outerBox.left
326
+ },
327
+ {
328
+ top: tipBounds.top + this.tipBoundsWindow.scrollY,
329
+ left: tipBounds.left + this.tipBoundsWindow.scrollX,
330
+ height: this.tipBoundsWindow.innerHeight,
331
+ width: this.tipBoundsWindow.innerWidth
332
+ }
333
+ );
291
334
  }
292
335
  clearRect() {
293
- var _this_rects;
294
- (_this_rects = this.rects) === null || _this_rects === void 0 ? void 0 : _this_rects.forEach((rect) => {
336
+ var _a;
337
+ (_a = this.rects) == null ? void 0 : _a.forEach((rect) => {
295
338
  rect.remove();
296
339
  });
297
340
  this.rects.length = 0;
298
341
  this.tip.invisible();
299
342
  }
300
- constructor(handleCodeInfo) {
301
- this.handleCodeInfo = handleCodeInfo;
343
+ }
344
+ class ClickOverlay {
345
+ constructor(positionUpdate) {
346
+ this.currentElement = null;
347
+ this.currentName = void 0;
348
+ this.positionUpdate = positionUpdate;
302
349
  const currentWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
303
350
  this.window = currentWindow;
304
351
  const tipBoundsWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
305
352
  this.tipBoundsWindow = tipBoundsWindow;
306
353
  const doc = currentWindow.document;
307
354
  this.container = doc.createElement("div");
308
- this.container.style.zIndex = "10000000";
355
+ this.container.style.zIndex = "9999999";
309
356
  this.tip = new OverlayTip(doc, this.container);
310
- this.rects = [];
311
- this.removeCallback = () => {
312
- };
357
+ this.rect = null;
313
358
  let rafId = null;
314
359
  this.resizeObserver = new ResizeObserver(() => {
360
+ var _a;
315
361
  if (rafId) {
316
362
  cancelAnimationFrame(rafId);
317
363
  }
318
364
  rafId = requestAnimationFrame(() => {
319
- if (this.currentElements && this.currentName) {
320
- this.updatePositions(this.currentElements, this.currentName);
365
+ if (this.currentElement) {
366
+ this.updatePosition(this.currentElement);
321
367
  }
322
368
  });
369
+ (_a = this.positionUpdate) == null ? void 0 : _a.call(this);
323
370
  });
324
371
  doc.body.appendChild(this.container);
325
372
  }
326
- }
327
- class ClickOverlay {
328
373
  remove() {
329
374
  this.tip.remove();
330
375
  if (this.rect) {
@@ -353,67 +398,51 @@ class ClickOverlay {
353
398
  this.resizeObserver.observe(element);
354
399
  }
355
400
  updatePosition(element) {
356
- var _this_rect;
401
+ var _a;
357
402
  const outerBox = {
358
403
  top: Number.POSITIVE_INFINITY,
359
404
  right: Number.NEGATIVE_INFINITY,
360
405
  bottom: Number.NEGATIVE_INFINITY,
361
406
  left: Number.POSITIVE_INFINITY
362
407
  };
363
- const box = (0, _utils.getNestedBoundingClientRect)(element, this.window);
364
- const dims = (0, _utils.getElementDimensions)(element);
408
+ const box = (0, import_utils.getNestedBoundingClientRect)(element, this.window);
409
+ const dims = (0, import_utils.getElementDimensions)(element);
365
410
  outerBox.top = Math.min(outerBox.top, box.top - dims.marginTop);
366
- outerBox.right = Math.max(outerBox.right, box.left + box.width + dims.marginRight);
367
- outerBox.bottom = Math.max(outerBox.bottom, box.top + box.height + dims.marginBottom);
411
+ outerBox.right = Math.max(
412
+ outerBox.right,
413
+ box.left + box.width + dims.marginRight
414
+ );
415
+ outerBox.bottom = Math.max(
416
+ outerBox.bottom,
417
+ box.top + box.height + dims.marginBottom
418
+ );
368
419
  outerBox.left = Math.min(outerBox.left, box.left - dims.marginLeft);
369
- (_this_rect = this.rect) === null || _this_rect === void 0 ? void 0 : _this_rect.update(box, dims);
370
- const tipBounds = (0, _utils.getNestedBoundingClientRect)(this.tipBoundsWindow.document.documentElement, this.window);
420
+ (_a = this.rect) == null ? void 0 : _a.update(box, dims);
421
+ const tipBounds = (0, import_utils.getNestedBoundingClientRect)(
422
+ this.tipBoundsWindow.document.documentElement,
423
+ this.window
424
+ );
371
425
  if (box.width === 0 || box.height === 0) {
372
426
  this.tip.invisible();
373
427
  }
374
- this.tip.updatePosition({
375
- top: outerBox.top,
376
- left: outerBox.left,
377
- height: outerBox.bottom - outerBox.top,
378
- width: outerBox.right - outerBox.left
379
- }, {
380
- top: tipBounds.top + this.tipBoundsWindow.scrollY,
381
- left: tipBounds.left + this.tipBoundsWindow.scrollX,
382
- height: this.tipBoundsWindow.innerHeight,
383
- width: this.tipBoundsWindow.innerWidth
384
- });
428
+ this.tip.updatePosition(
429
+ {
430
+ top: outerBox.top,
431
+ left: outerBox.left,
432
+ height: outerBox.bottom - outerBox.top,
433
+ width: outerBox.right - outerBox.left
434
+ },
435
+ {
436
+ top: tipBounds.top + this.tipBoundsWindow.scrollY,
437
+ left: tipBounds.left + this.tipBoundsWindow.scrollX,
438
+ height: this.tipBoundsWindow.innerHeight,
439
+ width: this.tipBoundsWindow.innerWidth
440
+ }
441
+ );
385
442
  }
386
443
  clearRect() {
387
- var _this_rect;
388
- (_this_rect = this.rect) === null || _this_rect === void 0 ? void 0 : _this_rect.remove();
444
+ var _a;
445
+ (_a = this.rect) == null ? void 0 : _a.remove();
389
446
  this.tip.invisible();
390
447
  }
391
- constructor(positionUpdate) {
392
- this.currentElement = null;
393
- this.currentName = void 0;
394
- this.positionUpdate = positionUpdate;
395
- const currentWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
396
- this.window = currentWindow;
397
- const tipBoundsWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window;
398
- this.tipBoundsWindow = tipBoundsWindow;
399
- const doc = currentWindow.document;
400
- this.container = doc.createElement("div");
401
- this.container.style.zIndex = "9999999";
402
- this.tip = new OverlayTip(doc, this.container);
403
- this.rect = null;
404
- let rafId = null;
405
- this.resizeObserver = new ResizeObserver(() => {
406
- var _this_positionUpdate, _this;
407
- if (rafId) {
408
- cancelAnimationFrame(rafId);
409
- }
410
- rafId = requestAnimationFrame(() => {
411
- if (this.currentElement) {
412
- this.updatePosition(this.currentElement);
413
- }
414
- });
415
- (_this_positionUpdate = (_this = this).positionUpdate) === null || _this_positionUpdate === void 0 ? void 0 : _this_positionUpdate.call(_this);
416
- });
417
- doc.body.appendChild(this.container);
418
- }
419
448
  }
@@ -1,20 +1,20 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./use-layout-effect"), exports);
6
- _export_star(require("./use-effect-event"), exports);
7
- _export_star(require("./use-mouse"), exports);
8
- function _export_star(from, to) {
9
- Object.keys(from).forEach(function(k) {
10
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
11
- Object.defineProperty(to, k, {
12
- enumerable: true,
13
- get: function() {
14
- return from[k];
15
- }
16
- });
17
- }
18
- });
19
- return from;
20
- }
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __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
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var hooks_exports = {};
17
+ module.exports = __toCommonJS(hooks_exports);
18
+ __reExport(hooks_exports, require("./use-layout-effect"), module.exports);
19
+ __reExport(hooks_exports, require("./use-effect-event"), module.exports);
20
+ __reExport(hooks_exports, require("./use-mouse"), module.exports);
@@ -1,24 +1,35 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useEffectEvent", {
6
- enumerable: true,
7
- get: function() {
8
- return useEffectEvent;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var use_effect_event_exports = {};
20
+ __export(use_effect_event_exports, {
21
+ useEffectEvent: () => useEffectEvent
10
22
  });
11
- const _react = require("react");
23
+ module.exports = __toCommonJS(use_effect_event_exports);
24
+ var import_react = require("react");
12
25
  const useEffectEvent = (callback) => {
13
- const callbackRef = (0, _react.useRef)(callback);
14
- callbackRef.current = (0, _react.useMemo)(() => callback, [
15
- callback
16
- ]);
17
- const stableRef = (0, _react.useRef)();
26
+ const callbackRef = (0, import_react.useRef)(callback);
27
+ callbackRef.current = (0, import_react.useMemo)(() => callback, [callback]);
28
+ const stableRef = (0, import_react.useRef)();
18
29
  if (!stableRef.current) {
19
30
  stableRef.current = function(...args) {
20
- var _callbackRef_current;
21
- return (_callbackRef_current = callbackRef.current) === null || _callbackRef_current === void 0 ? void 0 : _callbackRef_current.apply(this, args);
31
+ var _a;
32
+ return (_a = callbackRef.current) == null ? void 0 : _a.apply(this, args);
22
33
  };
23
34
  }
24
35
  return stableRef.current;
@@ -1,13 +1,28 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useLayoutEffect", {
6
- enumerable: true,
7
- get: function() {
8
- return useLayoutEffect;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var use_layout_effect_exports = {};
20
+ __export(use_layout_effect_exports, {
21
+ useLayoutEffect: () => useLayoutEffect
10
22
  });
11
- const _react = require("react");
12
- var _window_document, _window;
13
- const useLayoutEffect = typeof window !== "undefined" && ((_window = window) === null || _window === void 0 ? void 0 : (_window_document = _window.document) === null || _window_document === void 0 ? void 0 : _window_document.createElement) ? _react.useLayoutEffect : _react.useEffect;
23
+ module.exports = __toCommonJS(use_layout_effect_exports);
24
+ var import_react = require("react");
25
+ var _a;
26
+ const useLayoutEffect = typeof window !== "undefined" && // @ts-expect-error `window` is not available in SSR
27
+ // eslint-disable-next-line no-restricted-syntax
28
+ ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.createElement) ? import_react.useLayoutEffect : import_react.useEffect;
@@ -1,16 +1,31 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "useMousePosition", {
6
- enumerable: true,
7
- get: function() {
8
- return useMousePosition;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var use_mouse_exports = {};
20
+ __export(use_mouse_exports, {
21
+ useMousePosition: () => useMousePosition
10
22
  });
11
- const _react = require("react");
12
- const useMousePosition = ({ disable }) => {
13
- const mouseRef = (0, _react.useRef)({
23
+ module.exports = __toCommonJS(use_mouse_exports);
24
+ var import_react = require("react");
25
+ const useMousePosition = ({
26
+ disable
27
+ }) => {
28
+ const mouseRef = (0, import_react.useRef)({
14
29
  x: 0,
15
30
  y: 0
16
31
  });
@@ -18,15 +33,13 @@ const useMousePosition = ({ disable }) => {
18
33
  mouseRef.current.x = ev.clientX;
19
34
  mouseRef.current.y = ev.clientY;
20
35
  };
21
- (0, _react.useEffect)(() => {
36
+ (0, import_react.useEffect)(() => {
22
37
  if (!disable) {
23
38
  document.addEventListener("mousemove", recordMousePoint, true);
24
39
  }
25
40
  return () => {
26
41
  document.removeEventListener("mousemove", recordMousePoint, true);
27
42
  };
28
- }, [
29
- disable
30
- ]);
43
+ }, [disable]);
31
44
  return mouseRef;
32
45
  };
@@ -1,11 +1,24 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "Inspector", {
6
- enumerable: true,
7
- get: function() {
8
- return _Inspector.Inspector;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var Inspector_exports = {};
20
+ __export(Inspector_exports, {
21
+ Inspector: () => import_Inspector.Inspector
10
22
  });
11
- const _Inspector = require("./Inspector");
23
+ module.exports = __toCommonJS(Inspector_exports);
24
+ var import_Inspector = require("./Inspector");