@breadstone/mosaik-elements-svelte 0.1.61 → 0.1.62

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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/index.mjs +116 -67
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.1.62 (2026-07-27)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **theming:** replace direct event handling with proxy output subscription ([e313c5977b](https://github.com/RueDeRennes/mosaik/commit/e313c5977b))
6
+
1
7
  ## 0.1.61 (2026-07-27)
2
8
 
3
9
  ### 🩹 Fixes
package/index.mjs CHANGED
@@ -1461,7 +1461,7 @@ function jn(e, t, n) {
1461
1461
  function Mn(e, t) {
1462
1462
  return new Promise((n) => {
1463
1463
  let r = (i) => {
1464
- i.target === e && (e.removeEventListener(t, r), n(i));
1464
+ i.composedPath()[0] === e && (e.removeEventListener(t, r), n(i));
1465
1465
  };
1466
1466
  e.addEventListener(t, r);
1467
1467
  });
@@ -21048,8 +21048,9 @@ var iT = function(e, t, n, r) {
21048
21048
  _autoSizePadding;
21049
21049
  _isVisible;
21050
21050
  _inlineStyleController;
21051
+ _connectionRevision;
21051
21052
  constructor() {
21052
- super(), this.elevation = qw.Regular, this._anchorElement = null, this._anchor = null, this._active = !1, this._distance = 0, this._skidding = 0, this._placement = K.Top, this._arrow = !1, this._arrowPadding = 12, this._flip = !1, this._isFullScreen = !1, this._flipFallbackPlacements = [], this._flipFallbackStrategy = $w.BestFit, this._arrowPlacement = Zw.Anchor, this._flipBoundary = null, this._flipPadding = 0, this._shift = !1, this._shiftBoundary = null, this._shiftPadding = 0, this._autoSize = Qw.None, this._sync = eT.None, this._autoSizeBoundary = null, this._maxWidth = void 0, this._maxHeight = void 0, this._width = void 0, this._height = void 0, this._repositioned = new b(this, "repositioned"), this._activeChanged = new b(this, "activeChanged"), this._bodyClickSubscription = null, this._strategy = lC.Absolute, this._autoSizePadding = 0, this._isVisible = !1, this._inlineStyleController = new aS(this);
21053
+ super(), this.elevation = qw.Regular, this._anchorElement = null, this._anchor = null, this._active = !1, this._distance = 0, this._skidding = 0, this._placement = K.Top, this._arrow = !1, this._arrowPadding = 12, this._flip = !1, this._isFullScreen = !1, this._flipFallbackPlacements = [], this._flipFallbackStrategy = $w.BestFit, this._arrowPlacement = Zw.Anchor, this._flipBoundary = null, this._flipPadding = 0, this._shift = !1, this._shiftBoundary = null, this._shiftPadding = 0, this._autoSize = Qw.None, this._sync = eT.None, this._autoSizeBoundary = null, this._maxWidth = void 0, this._maxHeight = void 0, this._width = void 0, this._height = void 0, this._repositioned = new b(this, "repositioned"), this._activeChanged = new b(this, "activeChanged"), this._bodyClickSubscription = null, this._strategy = lC.Absolute, this._autoSizePadding = 0, this._isVisible = !1, this._inlineStyleController = new aS(this), this._connectionRevision = 0;
21053
21054
  }
21054
21055
  static get is() {
21055
21056
  return "mosaik-floating";
@@ -21229,65 +21230,66 @@ var iT = function(e, t, n, r) {
21229
21230
  this.active = !1;
21230
21231
  }
21231
21232
  reposition() {
21232
- if (!this.active || !this._anchorElement) return;
21233
- let e = [Pw({
21233
+ if (!this.isConnected || !this.active || !this._anchorElement?.isConnected || !this._bodyElement?.isConnected) return;
21234
+ let e = this._anchorElement, t = this._bodyElement, n = this._connectionRevision, r = [Pw({
21234
21235
  mainAxis: this.distance,
21235
21236
  crossAxis: this.skidding
21236
- })], t = (e) => !(e === void 0 || e === "auto"), n = (e) => typeof e == "number" ? `${e}px` : e.toString();
21237
- (this.sync !== eT.None || t(this.width) || t(this.height) || t(this.maxWidth) || t(this.maxHeight)) && e.push(Lw({ apply: ({ rects: e }) => {
21238
- this.sync !== eT.None && ((this.sync === eT.Width || this.sync === eT.Both) && (this._bodyElement.style.width = `${e.reference.width}px`), (this.sync === eT.Height || this.sync === eT.Both) && (this._bodyElement.style.height = `${e.reference.height}px`)), t(this.width) ? this._bodyElement.style.width = n(this.width) : this.sync !== eT.Width && this.sync !== eT.Both && (this._bodyElement.style.width = ""), t(this.height) ? this._bodyElement.style.height = n(this.height) : this.sync !== eT.Height && this.sync !== eT.Both && (this._bodyElement.style.height = ""), t(this.maxWidth) ? this._bodyElement.style.maxWidth = n(this.maxWidth) : this._bodyElement.style.maxWidth = "", t(this.maxHeight) ? this._bodyElement.style.maxHeight = n(this.maxHeight) : this._bodyElement.style.maxHeight = "";
21239
- } })), this.flip && e.push(Iw({
21237
+ })], i = (e) => !(e === void 0 || e === "auto"), a = (e) => typeof e == "number" ? `${e}px` : e.toString();
21238
+ (this.sync !== eT.None || i(this.width) || i(this.height) || i(this.maxWidth) || i(this.maxHeight)) && r.push(Lw({ apply: ({ rects: e }) => {
21239
+ this.sync !== eT.None && ((this.sync === eT.Width || this.sync === eT.Both) && (this._bodyElement.style.width = `${e.reference.width}px`), (this.sync === eT.Height || this.sync === eT.Both) && (this._bodyElement.style.height = `${e.reference.height}px`)), i(this.width) ? this._bodyElement.style.width = a(this.width) : this.sync !== eT.Width && this.sync !== eT.Both && (this._bodyElement.style.width = ""), i(this.height) ? this._bodyElement.style.height = a(this.height) : this.sync !== eT.Height && this.sync !== eT.Both && (this._bodyElement.style.height = ""), i(this.maxWidth) ? this._bodyElement.style.maxWidth = a(this.maxWidth) : this._bodyElement.style.maxWidth = "", i(this.maxHeight) ? this._bodyElement.style.maxHeight = a(this.maxHeight) : this._bodyElement.style.maxHeight = "";
21240
+ } })), this.flip && r.push(Iw({
21240
21241
  boundary: this.flipBoundary ?? void 0,
21241
21242
  fallbackPlacements: this.flipFallbackPlacements,
21242
21243
  fallbackStrategy: this.flipFallbackStrategy === $w.BestFit ? "bestFit" : "initialPlacement",
21243
21244
  padding: this.flipPadding
21244
- })), this.shift && e.push(Fw({
21245
+ })), this.shift && r.push(Fw({
21245
21246
  boundary: this.shiftBoundary ?? void 0,
21246
21247
  padding: this.shiftPadding
21247
- })), this.autoSize === Qw.None ? (this._inlineStyleController.remove("floating-auto-size-available-width"), this._inlineStyleController.remove("floating-auto-size-available-height")) : e.push(Lw({
21248
+ })), this.autoSize === Qw.None ? (this._inlineStyleController.remove("floating-auto-size-available-width"), this._inlineStyleController.remove("floating-auto-size-available-height")) : r.push(Lw({
21248
21249
  boundary: this.autoSizeBoundary ?? void 0,
21249
21250
  padding: this.autoSizePadding,
21250
21251
  apply: ({ availableWidth: e, availableHeight: t }) => {
21251
21252
  this.autoSize === Qw.Vertical || this.autoSize === Qw.Both ? this._inlineStyleController.set("floating-auto-size-available-height", `${t}px`) : this._inlineStyleController.remove("floating-auto-size-available-height"), this.autoSize === Qw.Horizontal || this.autoSize === Qw.Both ? this._inlineStyleController.set("floating-auto-size-available-width", `${e}px`) : this._inlineStyleController.remove("floating-auto-size-available-width");
21252
21253
  }
21253
- })), this.arrow && e.push(Que({
21254
+ })), this.arrow && r.push(Que({
21254
21255
  element: this._arrowElement,
21255
21256
  padding: this.arrowPadding
21256
21257
  }));
21257
- let r = this.strategy === "absolute" ? (e) => jw.getOffsetParent(e) : jw.getOffsetParent;
21258
- Rw(this._anchorElement, this._bodyElement, {
21258
+ let o = this.strategy === "absolute" ? (e) => jw.getOffsetParent(e) : jw.getOffsetParent;
21259
+ Rw(e, t, {
21259
21260
  placement: this.placement,
21260
- middleware: e,
21261
+ middleware: r,
21261
21262
  strategy: this.strategy,
21262
21263
  platform: {
21263
21264
  ...jw,
21264
- getOffsetParent: r
21265
+ getOffsetParent: o
21265
21266
  }
21266
- }).then(({ x: e, y: t, middlewareData: n, placement: r }) => {
21267
- let i = window.getComputedStyle(this).direction === "rtl", a = {
21267
+ }).then(({ x: r, y: i, middlewareData: a, placement: o }) => {
21268
+ if (!this.isCurrentConnection(n) || !this.active || this._anchorElement !== e || this._bodyElement !== t || !e.isConnected || !t.isConnected) return;
21269
+ let s = window.getComputedStyle(this).direction === "rtl", c = {
21268
21270
  top: "bottom",
21269
21271
  right: "left",
21270
21272
  bottom: "top",
21271
21273
  left: "right"
21272
- }[r.split("-")[0]] ?? "";
21273
- if (this.setAttribute("data-current-placement", r), Object.assign(this._bodyElement.style, {
21274
- left: `${e}px`,
21275
- top: `${t}px`
21274
+ }[o.split("-")[0]] ?? "";
21275
+ if (this.setAttribute("data-current-placement", o), Object.assign(this._bodyElement.style, {
21276
+ left: `${r}px`,
21277
+ top: `${i}px`
21276
21278
  }), this.arrow) {
21277
- let e = n.arrow?.x, t = n.arrow?.y, r = "", o = "", s = "", c = "";
21279
+ let e = a.arrow?.x, t = a.arrow?.y, n = "", r = "", i = "", o = "";
21278
21280
  if (this.arrowPlacement === Zw.Start) {
21279
- let n = typeof e == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "";
21280
- r = typeof t == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "", o = i ? n : "", c = i ? "" : n;
21281
+ let i = typeof e == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "";
21282
+ n = typeof t == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "", r = s ? i : "", o = s ? "" : i;
21281
21283
  } else if (this.arrowPlacement === Zw.End) {
21282
21284
  let n = typeof e == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "";
21283
- o = i ? "" : n, c = i ? n : "", s = typeof t == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "";
21284
- } else this.arrowPlacement === Zw.Center ? (c = typeof e == "number" ? "calc(50% - var(--floating-arrow-size-diagonal))" : "", r = typeof t == "number" ? "calc(50% - var(--floating-arrow-size-diagonal))" : "") : (c = typeof e == "number" ? `${e}px` : "", r = typeof t == "number" ? `${t}px` : "");
21285
+ r = s ? "" : n, o = s ? n : "", i = typeof t == "number" ? `calc(${this.arrowPadding}px - var(--floating-arrow-padding-offset))` : "";
21286
+ } else this.arrowPlacement === Zw.Center ? (o = typeof e == "number" ? "calc(50% - var(--floating-arrow-size-diagonal))" : "", n = typeof t == "number" ? "calc(50% - var(--floating-arrow-size-diagonal))" : "") : (o = typeof e == "number" ? `${e}px` : "", n = typeof t == "number" ? `${t}px` : "");
21285
21287
  Object.assign(this._arrowElement.style, {
21286
- top: r,
21287
- right: o,
21288
- bottom: s,
21289
- left: c,
21290
- [a]: "calc(var(--floating-arrow-size-diagonal) * -1)"
21288
+ top: n,
21289
+ right: r,
21290
+ bottom: i,
21291
+ left: o,
21292
+ [c]: "calc(var(--floating-arrow-size-diagonal) * -1)"
21291
21293
  });
21292
21294
  }
21293
21295
  }), this._repositioned.emit();
@@ -21296,10 +21298,14 @@ var iT = function(e, t, n, r) {
21296
21298
  return this._bodyElement;
21297
21299
  }
21298
21300
  connectedCallback() {
21299
- super.connectedCallback(), this.updateComplete.then(() => this.start());
21301
+ this._connectionRevision++, super.connectedCallback();
21302
+ let e = this._connectionRevision;
21303
+ this.updateComplete.then(() => {
21304
+ this.isCurrentConnection(e) && this.handleAnchorChange();
21305
+ });
21300
21306
  }
21301
21307
  disconnectedCallback() {
21302
- this.stop();
21308
+ this._connectionRevision++, this.stop(), super.disconnectedCallback();
21303
21309
  }
21304
21310
  onApplyTemplate() {
21305
21311
  super.onApplyTemplate();
@@ -21310,11 +21316,21 @@ var iT = function(e, t, n, r) {
21310
21316
  }
21311
21317
  }
21312
21318
  updated(e) {
21313
- super.updated(e), e.has("active") && (this.active ? (this._isVisible = !0, this.requestUpdate("isVisible"), this.updateComplete.then(() => {
21314
- this.play(this.enter ?? zw).then(() => this.start());
21315
- })) : this.play(this.exit ?? Bw).then(() => {
21316
- this.stop(), this._isVisible = !1, this.requestUpdate("isVisible");
21317
- })), e.has("anchor") && this.handleAnchorChange(), this.active && this.updateComplete.then(() => this.reposition());
21319
+ if (super.updated(e), e.has("active")) if (this.active) {
21320
+ this._isVisible = !0, this.requestUpdate("isVisible");
21321
+ let e = this._connectionRevision;
21322
+ this.updateComplete.then(() => {
21323
+ !this.isCurrentConnection(e) || !this.active || this.play(this.enter ?? zw).then(() => {
21324
+ this.isCurrentConnection(e) && this.active && this.start();
21325
+ });
21326
+ });
21327
+ } else {
21328
+ let e = this._connectionRevision;
21329
+ this.play(this.exit ?? Bw).then(() => {
21330
+ !this.isCurrentConnection(e) || this.active || (this.stop(), this._isVisible = !1, this.requestUpdate("isVisible"));
21331
+ });
21332
+ }
21333
+ e.has("anchor") && this.handleAnchorChange(), this.active && this.updateComplete.then(() => this.reposition());
21318
21334
  }
21319
21335
  onRepositioned(e) {
21320
21336
  this._repositioned.emit(e);
@@ -21329,15 +21345,18 @@ var iT = function(e, t, n, r) {
21329
21345
  this.reposition();
21330
21346
  }
21331
21347
  async handleAnchorChange() {
21332
- if (await this.stop(), this.anchor && typeof this.anchor == "string") {
21333
- let e = this.getRootNode();
21334
- this._anchorElement = e.getElementById(this.anchor);
21335
- } else this.anchor instanceof Element ? this._anchorElement = this.anchor : this._anchorElement = this.querySelector("[slot=\"anchor\"]");
21336
- if (this._anchorElement instanceof HTMLSlotElement && (this._anchorElement = this._anchorElement.assignedElements({ flatten: !0 })[0]), !this._anchorElement) throw Error("Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.");
21337
- this.start();
21348
+ let e = this._connectionRevision;
21349
+ if (await this.stop(), this.isCurrentConnection(e)) {
21350
+ if (this.anchor && typeof this.anchor == "string") {
21351
+ let e = this.getRootNode();
21352
+ this._anchorElement = e.getElementById(this.anchor);
21353
+ } else this.anchor instanceof Element ? this._anchorElement = this.anchor : this._anchorElement = this.querySelector("[slot=\"anchor\"]");
21354
+ if (this._anchorElement instanceof HTMLSlotElement && (this._anchorElement = this._anchorElement.assignedElements({ flatten: !0 })[0]), !this._anchorElement && this.anchor !== null) throw Error("Invalid anchor element: no anchor could be found using the anchor slot or the anchor attribute.");
21355
+ this.start();
21356
+ }
21338
21357
  }
21339
21358
  start() {
21340
- this._anchorElement && (this._cleanup = Nw(this._anchorElement, this._bodyElement, () => {
21359
+ !this.isConnected || !this.active || !this._anchorElement?.isConnected || !this._bodyElement?.isConnected || (this._cleanup?.(), this._cleanup = void 0, this._cleanup = Nw(this._anchorElement, this._bodyElement, () => {
21341
21360
  this.reposition();
21342
21361
  }), this._bodyClickSubscription ??= x(this._bodyElement, "click", (e) => {
21343
21362
  e.composedPath().find((e) => e instanceof HTMLElement && e.hasAttribute("force-close") && e.getAttribute("force-close") === "true") && (this.active = !1);
@@ -21348,6 +21367,9 @@ var iT = function(e, t, n, r) {
21348
21367
  this._cleanup ? (this._cleanup(), this._cleanup = void 0, this.removeAttribute("data-current-placement"), this._inlineStyleController.remove("floating-auto-size-available-width"), this._inlineStyleController.remove("floating-auto-size-available-height"), requestAnimationFrame(e)) : e();
21349
21368
  });
21350
21369
  }
21370
+ isCurrentConnection(e) {
21371
+ return this.isConnected && this._connectionRevision === e;
21372
+ }
21351
21373
  };
21352
21374
  iT([
21353
21375
  k({ type: Object }),
@@ -40519,8 +40541,10 @@ var DO = function(e, t, n, r) {
40519
40541
  _mouseoutSubscription;
40520
40542
  _slottedControl;
40521
40543
  _anchorReady;
40544
+ _connectionRevision;
40545
+ _controlBindingFrame;
40522
40546
  constructor() {
40523
- super(), this._floatingElement = null, this._content = "", this._placement = K.Bottom, this._horizontalOffset = 8, this._verticalOffset = 0, this._isOpen = !1, this._showDelay = 150, this._hideDelay = 0, this._trigger = SO.Hover, this._staysOpen = !1, this._hoverTimeout = null, this._blurSubscription = null, this._focusSubscription = null, this._clickSubscription = null, this._keydownSubscription = null, this._mouseoverSubscription = null, this._mouseoutSubscription = null, this._slottedControl = null, this._anchorReady = !1, this._projectionController = new uT(this, {
40547
+ super(), this._floatingElement = null, this._content = "", this._placement = K.Bottom, this._horizontalOffset = 8, this._verticalOffset = 0, this._isOpen = !1, this._showDelay = 150, this._hideDelay = 0, this._trigger = SO.Hover, this._staysOpen = !1, this._hoverTimeout = null, this._blurSubscription = null, this._focusSubscription = null, this._clickSubscription = null, this._keydownSubscription = null, this._mouseoverSubscription = null, this._mouseoutSubscription = null, this._slottedControl = null, this._anchorReady = !1, this._connectionRevision = 0, this._controlBindingFrame = null, this._projectionController = new uT(this, {
40524
40548
  slotName: "content",
40525
40549
  targetSelector: "[part=\"projection\"]"
40526
40550
  }), Object.assign(this, { enter: zw }), Object.assign(this, { exit: Bw });
@@ -40595,27 +40619,23 @@ var DO = function(e, t, n, r) {
40595
40619
  return this.isOpen && this._anchorReady && this.anchorElement !== null;
40596
40620
  }
40597
40621
  async open() {
40598
- await super.open().then(() => {
40599
- this.isOpen = !0;
40600
- });
40622
+ let e = this._connectionRevision;
40623
+ await super.open(), this.isCurrentConnection(e) && (this.isOpen = !0);
40601
40624
  }
40602
40625
  async close() {
40603
- return this._staysOpen ? Promise.resolve(!1) : this._isOpen ? super.close().then((e) => this.isOpen = e) : Promise.resolve(!0);
40626
+ if (this._staysOpen) return Promise.resolve(!1);
40627
+ if (!this._isOpen) return Promise.resolve(!0);
40628
+ let e = this._connectionRevision, t = await super.close();
40629
+ return this.isCurrentConnection(e) && (this.isOpen = t), t;
40604
40630
  }
40605
40631
  attach(e) {
40606
- super.attach(e), this.updateComplete.then(() => {
40607
- this.unbindControlEvents(), this.bindControlEvents(), this.updateFloatingAnchor();
40608
- });
40632
+ super.attach(e), this.scheduleControlRebinding(!1);
40609
40633
  }
40610
40634
  connectedCallback() {
40611
- super.connectedCallback(), this.updateComplete.then(() => {
40612
- requestAnimationFrame(() => {
40613
- this.bindControlEvents(), this.updateFloatingAnchor();
40614
- });
40615
- });
40635
+ this._connectionRevision++, super.connectedCallback(), this.scheduleControlRebinding(!0);
40616
40636
  }
40617
40637
  disconnectedCallback() {
40618
- super.disconnectedCallback(), this.unbindControlEvents();
40638
+ this._connectionRevision++, this.cancelControlBindingFrame(), this.clearHoverTimeout(), this.unbindControlEvents(), this._anchorReady = !1, this._isOpen && (this.isOpen = !1), super.disconnectedCallback();
40619
40639
  }
40620
40640
  onApplyTemplate() {
40621
40641
  super.onApplyTemplate();
@@ -40623,6 +40643,7 @@ var DO = function(e, t, n, r) {
40623
40643
  e && (e.addEventListener("slotchange", () => this.onDefaultSlotChange(e)), this.onDefaultSlotChange(e));
40624
40644
  let t = this.getTemplatePart("portal");
40625
40645
  t.addEventListener("portalAttached", () => {
40646
+ if (!this.isConnected) return;
40626
40647
  let e = t.projection;
40627
40648
  e && (this._floatingElement = S.current.findDescendant(e, "[part=\"popup\"]", { strict: !0 }), this.updateFloatingAnchor());
40628
40649
  }, { once: !0 });
@@ -40643,14 +40664,19 @@ var DO = function(e, t, n, r) {
40643
40664
  this.isOpen && e.key === "Escape" && (e.stopPropagation(), this.close());
40644
40665
  }
40645
40666
  onMouseOver(e) {
40646
- this.hasTrigger(SO.Hover) && (this._hoverTimeout && clearTimeout(this._hoverTimeout), this._hoverTimeout = window.setTimeout(() => void this.open(), this._showDelay));
40667
+ this.hasTrigger(SO.Hover) && (this.clearHoverTimeout(), this._hoverTimeout = window.setTimeout(() => {
40668
+ this._hoverTimeout = null, this.isConnected && this.open();
40669
+ }, this._showDelay));
40647
40670
  }
40648
40671
  onMouseOut(e) {
40649
- this.hasTrigger(SO.Hover) && (this._hoverTimeout && clearTimeout(this._hoverTimeout), this._hoverTimeout = window.setTimeout(() => void this.close(), this._hideDelay));
40672
+ this.hasTrigger(SO.Hover) && (this.clearHoverTimeout(), this._hoverTimeout = window.setTimeout(() => {
40673
+ this._hoverTimeout = null, this.isConnected && this.close();
40674
+ }, this._hideDelay));
40650
40675
  }
40651
40676
  onIsOpenPropertyChange() {
40677
+ let e = this._connectionRevision;
40652
40678
  this.updateComplete.then(() => {
40653
- if (this.isOpen) {
40679
+ if (this.isCurrentConnection(e)) if (this.isOpen) {
40654
40680
  if (this.disabled) return;
40655
40681
  this.opened.emit();
40656
40682
  } else this.closed.emit({ cancel: !1 });
@@ -40678,11 +40704,7 @@ var DO = function(e, t, n, r) {
40678
40704
  this.disabled && this.isOpen && this.close();
40679
40705
  }
40680
40706
  onForPropertyChange() {
40681
- this.updateComplete.then(() => {
40682
- requestAnimationFrame(() => {
40683
- this.unbindControlEvents(), this.bindControlEvents(), this.updateFloatingAnchor();
40684
- });
40685
- });
40707
+ this.scheduleControlRebinding(!0);
40686
40708
  }
40687
40709
  onDefaultSlotChange(e) {
40688
40710
  let t = e.assignedElements({ flatten: !0 }), n = this._slottedControl;
@@ -40691,8 +40713,35 @@ var DO = function(e, t, n, r) {
40691
40713
  this._slottedControl !== null && (this._anchorReady = !0), n !== this._slottedControl && (this.unbindControlEvents(), this.bindControlEvents(), this.updateFloatingAnchor()), r !== this._anchorReady && this.requestUpdate("anchorElement");
40692
40714
  }
40693
40715
  updateFloatingAnchor() {
40716
+ if (!this.isConnected) {
40717
+ this._anchorReady = !1;
40718
+ return;
40719
+ }
40694
40720
  this._anchorReady = this.anchorElement !== null, this.requestUpdate("anchorElement");
40695
40721
  }
40722
+ scheduleControlRebinding(e) {
40723
+ let t = this._connectionRevision;
40724
+ this.updateComplete.then(() => {
40725
+ if (!this.isCurrentConnection(t)) return;
40726
+ let n = () => {
40727
+ this._controlBindingFrame = null, this.isCurrentConnection(t) && (this.unbindControlEvents(), this.bindControlEvents(), this.updateFloatingAnchor());
40728
+ };
40729
+ if (!e) {
40730
+ n();
40731
+ return;
40732
+ }
40733
+ this.cancelControlBindingFrame(), this._controlBindingFrame = requestAnimationFrame(n);
40734
+ });
40735
+ }
40736
+ cancelControlBindingFrame() {
40737
+ this._controlBindingFrame !== null && (cancelAnimationFrame(this._controlBindingFrame), this._controlBindingFrame = null);
40738
+ }
40739
+ clearHoverTimeout() {
40740
+ this._hoverTimeout !== null && (clearTimeout(this._hoverTimeout), this._hoverTimeout = null);
40741
+ }
40742
+ isCurrentConnection(e) {
40743
+ return this.isConnected && this._connectionRevision === e;
40744
+ }
40696
40745
  bindControlEvents() {
40697
40746
  let e = this.anchorElement;
40698
40747
  e && (this._blurSubscription = x(e, "blur", (e) => this.onBlur(e), !0), this._focusSubscription = x(e, "focus", (e) => this.onFocus(e), !0), this._clickSubscription = x(e, "click", (e) => this.onClick(e)), this._keydownSubscription = x(e, "keydown", (e) => this.onKeyDown(e)), this._mouseoverSubscription = x(e, "mouseover", (e) => this.onMouseOver(e)), this._mouseoutSubscription = x(e, "mouseout", (e) => this.onMouseOut(e)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breadstone/mosaik-elements-svelte",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "description": "Mosaik elements for Svelte.",
5
5
  "license": "MIT",
6
6
  "author": "andre.wehlert <awehlert@breadstone.de> (https://www.breadstone.de)",
@@ -11,8 +11,8 @@
11
11
  "url": "git+ssh://git@github.com/RueDeRennes/mosaik.git"
12
12
  },
13
13
  "dependencies": {
14
- "@breadstone/mosaik-elements": "0.1.61",
15
- "@breadstone/mosaik-elements-foundation": "0.1.61",
14
+ "@breadstone/mosaik-elements": "0.1.62",
15
+ "@breadstone/mosaik-elements-foundation": "0.1.62",
16
16
  "tslib": "2.8.1"
17
17
  },
18
18
  "peerDependencies": {