@mhmo91/schmancy 0.10.34 → 0.10.35

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.
@@ -445,23 +445,10 @@
445
445
  "attributes": [
446
446
  {
447
447
  "name": "id",
448
+ "description": "Identity for localStorage drag-position persistence.",
448
449
  "type": "string",
449
450
  "default": "\"default\""
450
451
  },
451
- {
452
- "name": "icon",
453
- "type": "string | undefined"
454
- },
455
- {
456
- "name": "label",
457
- "type": "string | undefined"
458
- },
459
- {
460
- "name": "lowered",
461
- "description": "When true, uses a lower elevation shadow on the FAB.",
462
- "type": "boolean",
463
- "default": "false"
464
- },
465
452
  {
466
453
  "name": "corner",
467
454
  "description": "Corner the FAB is anchored to.",
@@ -484,26 +471,10 @@
484
471
  {
485
472
  "name": "id",
486
473
  "attribute": "id",
474
+ "description": "Identity for localStorage drag-position persistence.",
487
475
  "type": "string",
488
476
  "default": "\"default\""
489
477
  },
490
- {
491
- "name": "icon",
492
- "attribute": "icon",
493
- "type": "string | undefined"
494
- },
495
- {
496
- "name": "label",
497
- "attribute": "label",
498
- "type": "string | undefined"
499
- },
500
- {
501
- "name": "lowered",
502
- "attribute": "lowered",
503
- "description": "When true, uses a lower elevation shadow on the FAB.",
504
- "type": "boolean",
505
- "default": "false"
506
- },
507
478
  {
508
479
  "name": "corner",
509
480
  "attribute": "corner",
@@ -13455,10 +13455,10 @@ typeof document < "u" && It(k(document, "pointerdown", {
13455
13455
  }))).subscribe((e) => wu.next(e));
13456
13456
  var ju = "schmancy-boat-", Mu = class extends K {
13457
13457
  constructor(...e) {
13458
- super(...e), this.id = "default", this.lowered = !1, this.corner = "bottom-right", this.open = !1, this.isDragging = !1, this._currentCorner = "bottom-right", this._position = {
13458
+ super(...e), this.id = "default", this.corner = "bottom-right", this.open = !1, this.isDragging = !1, this.currentCorner = "bottom-right", this.position = {
13459
13459
  x: 16,
13460
13460
  y: 16
13461
- }, this._containerRef = Ms(), this._headerRef = Ms(), this.#e = !1, this.#n = [];
13461
+ }, this.containerRef = Ms(), this.headerRef = Ms(), this.#e = !1, this.#n = [];
13462
13462
  }
13463
13463
  static {
13464
13464
  this.styles = [U`
@@ -13473,65 +13473,65 @@ var ju = "schmancy-boat-", Mu = class extends K {
13473
13473
  #e;
13474
13474
  #t;
13475
13475
  #n;
13476
- _applyContainerPosition() {
13477
- let e = this._containerRef.value;
13476
+ applyContainerPosition() {
13477
+ let e = this.containerRef.value;
13478
13478
  if (!e) return;
13479
13479
  e.style.removeProperty("left"), e.style.removeProperty("right"), e.style.removeProperty("top"), e.style.removeProperty("bottom");
13480
- let { x: t, y: n } = this._position;
13481
- this._currentCorner.includes("right") ? e.style.right = `${t}px` : e.style.left = `${t}px`, this._currentCorner.includes("bottom") ? e.style.bottom = `${n + il.bottomOffset}px` : e.style.top = `${n}px`;
13480
+ let { x: t, y: n } = this.position;
13481
+ this.currentCorner.includes("right") ? e.style.right = `${t}px` : e.style.left = `${t}px`, this.currentCorner.includes("bottom") ? e.style.bottom = `${n + il.bottomOffset}px` : e.style.top = `${n}px`;
13482
13482
  }
13483
- _loadPosition() {
13483
+ loadPosition() {
13484
13484
  try {
13485
13485
  let e = localStorage.getItem(ju + this.id);
13486
13486
  if (e) {
13487
13487
  let t = JSON.parse(e);
13488
- this._position = {
13488
+ this.position = {
13489
13489
  x: t.x,
13490
13490
  y: t.y
13491
- }, this._currentCorner = t.anchor;
13491
+ }, this.currentCorner = t.anchor;
13492
13492
  }
13493
13493
  } catch {}
13494
13494
  }
13495
- _savePosition() {
13495
+ savePosition() {
13496
13496
  try {
13497
13497
  localStorage.setItem(ju + this.id, JSON.stringify({
13498
- ...this._position,
13499
- anchor: this._currentCorner
13498
+ ...this.position,
13499
+ anchor: this.currentCorner
13500
13500
  }));
13501
13501
  } catch {}
13502
13502
  }
13503
- _validateBounds() {
13504
- let e = this._containerRef.value;
13503
+ validateBounds() {
13504
+ let e = this.containerRef.value;
13505
13505
  if (!e) return;
13506
13506
  let t = e.getBoundingClientRect();
13507
13507
  if (t.width === 0) return;
13508
- let n = window.innerWidth, r = window.innerHeight, i = this._currentCorner.includes("right"), a = this._currentCorner.includes("bottom"), o = i ? n - this._position.x - t.width : this._position.x, s = a ? r - this._position.y - t.height : this._position.y, c = Math.max(0, Math.min(o, n - t.width)), l = Math.max(0, Math.min(s, r - t.height));
13509
- this._position = {
13508
+ let n = window.innerWidth, r = window.innerHeight, i = this.currentCorner.includes("right"), a = this.currentCorner.includes("bottom"), o = i ? n - this.position.x - t.width : this.position.x, s = a ? r - this.position.y - t.height : this.position.y, c = Math.max(0, Math.min(o, n - t.width)), l = Math.max(0, Math.min(s, r - t.height));
13509
+ this.position = {
13510
13510
  x: i ? n - c - t.width : c,
13511
13511
  y: a ? r - l - t.height : l
13512
- }, this._applyContainerPosition();
13512
+ }, this.applyContainerPosition();
13513
13513
  }
13514
- _reorientToNearestCorner() {
13515
- let e = this._containerRef.value;
13514
+ reorientToNearestCorner() {
13515
+ let e = this.containerRef.value;
13516
13516
  if (!e) return;
13517
13517
  let t = e.getBoundingClientRect(), n = t.left + t.width / 2, r = t.top + t.height / 2, i = n > window.innerWidth / 2 ? "right" : "left", a = r > window.innerHeight / 2 ? "bottom" : "top";
13518
- if (this._currentCorner = `${a}-${i}`, this._position = {
13518
+ if (this.currentCorner = `${a}-${i}`, this.position = {
13519
13519
  x: 16,
13520
13520
  y: 16
13521
- }, this._applyContainerPosition(), Bc.value) return void this._savePosition();
13521
+ }, this.applyContainerPosition(), Bc.value) return void this.savePosition();
13522
13522
  let o = e.getBoundingClientRect(), s = t.left - o.left, c = t.top - o.top;
13523
- e.style.transform = `translate(${s}px, ${c}px)`, this._currentAnimation?.cancel();
13523
+ e.style.transform = `translate(${s}px, ${c}px)`, this.currentAnimation?.cancel();
13524
13524
  let l = e.animate([{ transform: e.style.transform }, { transform: "translate(0,0)" }], {
13525
13525
  duration: Y.duration,
13526
13526
  easing: Y.easingFallback,
13527
13527
  fill: "forwards"
13528
13528
  });
13529
- this._currentAnimation = l, l.finished.then(() => {
13529
+ this.currentAnimation = l, l.finished.then(() => {
13530
13530
  e.isConnected && (e.style.transform = "");
13531
- }), this._savePosition();
13531
+ }), this.savePosition();
13532
13532
  }
13533
- _setupDrag() {
13534
- let e = this._headerRef.value, t = this._containerRef.value;
13533
+ setupDrag() {
13534
+ let e = this.headerRef.value, t = this.containerRef.value;
13535
13535
  if (!e || !t) return;
13536
13536
  let n = !1;
13537
13537
  k(e, "pointerdown").pipe(j((e) => e.button === 0), I((t) => {
@@ -13552,38 +13552,38 @@ var ju = "schmancy-boat-", Mu = class extends K {
13552
13552
  let c = e - t, l = s - r;
13553
13553
  if (Math.sqrt(c * c + l * l) > 5 && !n && (n = !0, this.isDragging = !0), !n) return;
13554
13554
  let u = window.innerWidth, d = window.innerHeight, f = Math.max(0, Math.min(e - i, u - o.width)), p = Math.max(0, Math.min(s - a, d - o.height));
13555
- this._position = {
13556
- x: this._currentCorner.includes("right") ? u - f - o.width : f,
13557
- y: this._currentCorner.includes("bottom") ? d - p - o.height : p
13558
- }, this._applyContainerPosition();
13555
+ this.position = {
13556
+ x: this.currentCorner.includes("right") ? u - f - o.width : f,
13557
+ y: this.currentCorner.includes("bottom") ? d - p - o.height : p
13558
+ }, this.applyContainerPosition();
13559
13559
  }), F(l), en(() => {
13560
- n ? (this._reorientToNearestCorner(), this.isDragging = !1, n = !1) : (this.isDragging = !1, n = !1, this.toggle());
13560
+ n ? (this.reorientToNearestCorner(), this.isDragging = !1, n = !1) : (this.isDragging = !1, n = !1, this.toggle());
13561
13561
  }));
13562
13562
  }), F(this.disconnecting)).subscribe();
13563
13563
  }
13564
- _openOverlay() {
13564
+ openOverlay() {
13565
13565
  if (this.#t) return;
13566
- let e = this._containerRef.value, t = document.createElement("div");
13567
- t.className = "flex flex-col", this.#n = [...this._slotted], this.#n.forEach((e) => t.appendChild(e)), this.#t = Eu(t, {
13566
+ let e = this.containerRef.value, t = document.createElement("div");
13567
+ t.className = "flex flex-col", this.#n = [...this.slotted], this.#n.forEach((e) => t.appendChild(e)), this.#t = Eu(t, {
13568
13568
  anchor: e ?? void 0,
13569
13569
  dismissable: !0,
13570
13570
  historyStrategy: "silent"
13571
- }).pipe(en(() => this._restoreSlotted()), F(this.disconnecting)).subscribe(), this.dispatchScopedEvent("toggle", "open");
13571
+ }).pipe(en(() => this.restoreSlotted()), F(this.disconnecting)).subscribe(), this.dispatchScopedEvent("toggle", "open");
13572
13572
  }
13573
- _restoreSlotted() {
13573
+ restoreSlotted() {
13574
13574
  this.#n.forEach((e) => this.appendChild(e)), this.#n = [], this.#t = void 0, this.open &&= !1, this.dispatchScopedEvent("toggle", "closed");
13575
13575
  }
13576
13576
  connectedCallback() {
13577
- super.connectedCallback(), k(window, "resize").pipe(F(this.disconnecting)).subscribe(() => this._validateBounds()), il.bottomOffset$.pipe(I(() => this._applyContainerPosition()), F(this.disconnecting)).subscribe();
13577
+ super.connectedCallback(), k(window, "resize").pipe(F(this.disconnecting)).subscribe(() => this.validateBounds()), il.bottomOffset$.pipe(I(() => this.applyContainerPosition()), F(this.disconnecting)).subscribe();
13578
13578
  }
13579
13579
  firstUpdated() {
13580
- this._currentCorner = this.corner, this._loadPosition(), this._containerRef.value && (this._applyContainerPosition(), this._setupDrag(), this.#e = !0, this.open && this._openOverlay());
13580
+ this.currentCorner = this.corner, this.loadPosition(), this.containerRef.value && (this.applyContainerPosition(), this.setupDrag(), this.#e = !0, this.open && this.openOverlay());
13581
13581
  }
13582
13582
  willUpdate(e) {
13583
- this.#e && e.has("open") && (this.open && !this.#t ? this._openOverlay() : !this.open && this.#t && this.#t.unsubscribe());
13583
+ this.#e && e.has("open") && (this.open && !this.#t ? this.openOverlay() : !this.open && this.#t && this.#t.unsubscribe());
13584
13584
  }
13585
13585
  disconnectedCallback() {
13586
- super.disconnectedCallback(), this._currentAnimation?.cancel(), this.#t?.unsubscribe();
13586
+ super.disconnectedCallback(), this.currentAnimation?.cancel(), this.#t?.unsubscribe();
13587
13587
  }
13588
13588
  toggle() {
13589
13589
  this.open = !this.open;
@@ -13602,41 +13602,36 @@ var ju = "schmancy-boat-", Mu = class extends K {
13602
13602
  "pointer-events": "auto"
13603
13603
  }), n = $n({
13604
13604
  "h-14": !0,
13605
+ "min-w-14": !0,
13606
+ "px-4": !0,
13605
13607
  "rounded-full": !0,
13606
13608
  flex: !0,
13607
13609
  "items-center": !0,
13610
+ "justify-center": !0,
13608
13611
  "gap-3": !0,
13609
13612
  "select-none": !0,
13610
13613
  "touch-none": !0,
13611
13614
  "cursor-grabbing": this.isDragging,
13612
- "cursor-pointer": !this.isDragging,
13613
- "px-5": !!this.label,
13614
- "w-14": !this.label,
13615
- "justify-center": !this.label
13615
+ "cursor-pointer": !this.isDragging
13616
13616
  });
13617
13617
  return L`
13618
13618
  <schmancy-surface
13619
- ${Fs(this._containerRef)}
13619
+ ${Fs(this.containerRef)}
13620
13620
  type="glass"
13621
- .elevation=${this.lowered ? 1 : 3}
13621
+ .elevation=${3}
13622
13622
  class=${e}
13623
13623
  style=${t}
13624
13624
  aria-expanded=${this.open}
13625
13625
  >
13626
13626
  <div
13627
- ${Fs(this._headerRef)}
13627
+ ${Fs(this.headerRef)}
13628
13628
  class=${n}
13629
13629
  role="button"
13630
13630
  tabindex="0"
13631
- aria-label=${this.label ?? "Open panel"}
13631
+ aria-label="Open panel"
13632
13632
  title="Drag to move · click to open"
13633
13633
  >
13634
- <slot name="header">
13635
- ${J(!!this.icon, () => L`<schmancy-icon>${this.icon}</schmancy-icon>`, () => z)}
13636
- </slot>
13637
- ${J(!!this.label, () => L`<schmancy-typography type="label" token="lg" class="whitespace-nowrap">
13638
- ${this.label}
13639
- </schmancy-typography>`, () => z)}
13634
+ <slot name="header"></slot>
13640
13635
  <slot name="summary"></slot>
13641
13636
  </div>
13642
13637
 
@@ -13647,13 +13642,10 @@ var ju = "schmancy-boat-", Mu = class extends K {
13647
13642
  `;
13648
13643
  }
13649
13644
  };
13650
- V([W({ type: String })], Mu.prototype, "id", void 0), V([W({ type: String })], Mu.prototype, "icon", void 0), V([W({ type: String })], Mu.prototype, "label", void 0), V([W({
13651
- type: Boolean,
13652
- reflect: !0
13653
- })], Mu.prototype, "lowered", void 0), V([W({ type: String })], Mu.prototype, "corner", void 0), V([W({
13645
+ V([W({ type: String })], Mu.prototype, "id", void 0), V([W({ type: String })], Mu.prototype, "corner", void 0), V([W({
13654
13646
  type: Boolean,
13655
13647
  reflect: !0
13656
- })], Mu.prototype, "open", void 0), V([G()], Mu.prototype, "isDragging", void 0), V([G()], Mu.prototype, "_currentCorner", void 0), V([zr()], Mu.prototype, "_slotted", void 0);
13648
+ })], Mu.prototype, "open", void 0), V([G()], Mu.prototype, "isDragging", void 0), V([G()], Mu.prototype, "currentCorner", void 0), V([zr()], Mu.prototype, "slotted", void 0);
13657
13649
  var Nu = Mu = V([H("schmancy-boat")], Mu), Pu = class extends K {
13658
13650
  static {
13659
13651
  this.styles = [U`