@dnd-kit/dom 0.0.8 → 0.0.9-beta-20250205131546

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/index.cjs CHANGED
@@ -381,9 +381,7 @@ var _Feedback = class _Feedback extends (_a = abstract.Plugin, _overlay_dec = [s
381
381
  __privateAdd(this, _Feedback_instances);
382
382
  __privateAdd(this, _overlay, __runInitializers(_init, 8, this)), __runInitializers(_init, 11, this);
383
383
  this.state = {
384
- initial: {
385
- translate: { x: 0, y: 0 }
386
- },
384
+ initial: {},
387
385
  current: {}
388
386
  };
389
387
  this.registerEffect(__privateMethod(this, _Feedback_instances, injectStyles_fn));
@@ -399,15 +397,13 @@ _init = __decoratorStart(_a);
399
397
  _overlay = new WeakMap();
400
398
  _Feedback_instances = new WeakSet();
401
399
  render_fn = function() {
402
- var _a4, _b2;
400
+ var _a4, _b2, _c3;
403
401
  const { state: state$1, manager, options } = this;
404
402
  const { dragOperation } = manager;
405
403
  const { position, source, status } = dragOperation;
406
404
  if (status.idle) {
407
405
  state$1.current = {};
408
- state$1.initial = {
409
- translate: { x: 0, y: 0 }
410
- };
406
+ state$1.initial = {};
411
407
  return;
412
408
  }
413
409
  if (!source) return;
@@ -464,9 +460,9 @@ render_fn = function() {
464
460
  };
465
461
  if (scaleDelta.x !== 1 || scaleDelta.y !== 1) {
466
462
  const { scaleX, scaleY } = elementFrameTransform;
467
- const { x: tX, y: tY } = transformOrigin;
468
- initial.coordinates.x += (width * scaleX - width) * tX;
469
- initial.coordinates.y += (height * scaleY - height) * tY;
463
+ const { x: tX2, y: tY2 } = transformOrigin;
464
+ initial.coordinates.x += (width * scaleX - width) * tX2;
465
+ initial.coordinates.y += (height * scaleY - height) * tY2;
470
466
  }
471
467
  }
472
468
  if (!initial.dimensions) {
@@ -493,7 +489,10 @@ render_fn = function() {
493
489
  };
494
490
  feedbackElement.setAttribute(ATTRIBUTE, "true");
495
491
  const transform = state.untracked(() => dragOperation.transform);
496
- const translateString = `${transform.x * frameTransform.scaleX + initial.translate.x}px ${transform.y * frameTransform.scaleY + initial.translate.y}px 0`;
492
+ const initialTranslate = (_b2 = initial.translate) != null ? _b2 : { x: 0, y: 0 };
493
+ const tX = transform.x * frameTransform.scaleX + initialTranslate.x;
494
+ const tY = transform.y * frameTransform.scaleY + initialTranslate.y;
495
+ const translateString = `${tX}px ${tY}px 0`;
497
496
  styles.set(
498
497
  {
499
498
  width,
@@ -520,26 +519,6 @@ render_fn = function() {
520
519
  utilities.showPopover(feedbackElement);
521
520
  feedbackElement.addEventListener("beforetoggle", preventPopoverClose);
522
521
  }
523
- const actual = new utilities.DOMRectangle(feedbackElement, {
524
- frameTransform,
525
- ignoreTransforms: true
526
- });
527
- const offset = {
528
- top: projected.top - actual.top,
529
- left: projected.left - actual.left
530
- };
531
- if (Math.abs(offset.left) > 0.01 || Math.abs(offset.top) > 0.01) {
532
- styles.set(
533
- {
534
- top: actual.top + offset.top,
535
- left: actual.left + offset.left
536
- },
537
- CSS_PREFIX
538
- );
539
- } else {
540
- offset.left = 0;
541
- offset.top = 0;
542
- }
543
522
  const resizeObserver = new ResizeObserver(() => {
544
523
  if (!placeholder) return;
545
524
  const placeholderShape = new utilities.DOMRectangle(placeholder, {
@@ -624,14 +603,16 @@ render_fn = function() {
624
603
  });
625
604
  }
626
605
  const cleanupEffect = state.effect(() => {
606
+ var _a5;
627
607
  const { transform: transform2, status: status2 } = dragOperation;
628
608
  if (!transform2.x && !transform2.y && !state$1.current.translate) {
629
609
  return;
630
610
  }
631
611
  if (status2.dragging) {
632
612
  const translateTransition = isKeyboardOperation ? "250ms cubic-bezier(0.25, 1, 0.5, 1)" : "0ms linear";
633
- const x = transform2.x / frameTransform.scaleX + initial.translate.x;
634
- const y = transform2.y / frameTransform.scaleY + initial.translate.y;
613
+ const initialTranslate2 = (_a5 = initial.translate) != null ? _a5 : { x: 0, y: 0 };
614
+ const x = transform2.x / frameTransform.scaleX + initialTranslate2.x;
615
+ const y = transform2.y / frameTransform.scaleY + initialTranslate2.y;
635
616
  styles.set(
636
617
  {
637
618
  transition: `${transition}, translate ${translateTransition}`,
@@ -646,7 +627,7 @@ render_fn = function() {
646
627
  };
647
628
  }
648
629
  });
649
- const id = (_b2 = manager.dragOperation.source) == null ? void 0 : _b2.id;
630
+ const id = (_c3 = manager.dragOperation.source) == null ? void 0 : _c3.id;
650
631
  const restoreFocus = () => {
651
632
  var _a5;
652
633
  if (!isKeyboardOperation || id == null) {