@mhmo91/schmancy 0.10.39 → 0.10.40
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/dist/agent/schmancy.agent.js +14 -7
- package/dist/agent/schmancy.agent.js.map +1 -1
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/boat-BJPl_Jti.cjs +34 -0
- package/dist/boat-BJPl_Jti.cjs.map +1 -0
- package/dist/{boat-fqodYt2n.js → boat-BeqA9_ms.js} +9 -4
- package/dist/boat-BeqA9_ms.js.map +1 -0
- package/dist/boat.cjs +1 -1
- package/dist/boat.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{directives-Bb0S1DKZ.cjs → directives-BZIRQDBq.cjs} +1 -1
- package/dist/{directives-Bb0S1DKZ.cjs.map → directives-BZIRQDBq.cjs.map} +1 -1
- package/dist/{directives-Bfm1lkoy.js → directives-BvRTjCFa.js} +5 -3
- package/dist/{directives-Bfm1lkoy.js.map → directives-BvRTjCFa.js.map} +1 -1
- package/dist/directives.cjs +1 -1
- package/dist/directives.js +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/handover/agent-runtime-followups.md +1 -1
- package/dist/handover/agent-runtime-v1.md +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/navigation-bar.cjs +1 -1
- package/dist/navigation-bar.js +1 -1
- package/dist/{select-Cawz88lG.js → select-CGBsblDA.js} +1 -1
- package/dist/{select-Cawz88lG.js.map → select-CGBsblDA.js.map} +1 -1
- package/dist/{select-BWpV2iv-.cjs → select-LWdPs7b_.cjs} +1 -1
- package/dist/{select-BWpV2iv-.cjs.map → select-LWdPs7b_.cjs.map} +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/skills/SKILL.md +4 -0
- package/dist/skills/chips.md +41 -1
- package/dist/skills/schmancy/SKILL.md +4 -0
- package/dist/skills/schmancy/chips.md +41 -1
- package/dist/{src-8VJ7eluk.js → src-Dmqjtcmp.js} +3 -3
- package/dist/{src-8VJ7eluk.js.map → src-Dmqjtcmp.js.map} +1 -1
- package/dist/{src-GJA8uSAS.cjs → src-SAXA4LEH.cjs} +1 -1
- package/dist/{src-GJA8uSAS.cjs.map → src-SAXA4LEH.cjs.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +2 -1
- package/skills/schmancy/SKILL.md +4 -0
- package/skills/schmancy/chips.md +41 -1
- package/src/boat/boat.ts +20 -5
- package/src/directives/reveal.ts +7 -1
- package/types/src/boat/boat.d.ts +1 -0
- package/types/src/directives/reveal.d.ts +2 -0
- package/dist/boat-DsFJNfPH.cjs +0 -34
- package/dist/boat-DsFJNfPH.cjs.map +0 -1
- package/dist/boat-fqodYt2n.js.map +0 -1
package/skills/schmancy/SKILL.md
CHANGED
|
@@ -171,6 +171,10 @@ See `layout.md` for the full shell pattern with rail + content area.
|
|
|
171
171
|
|
|
172
172
|
A web-component host that establishes `inline-flex` layout declares `flex-shrink: 0` in its `:host` block so it preserves its intrinsic content size regardless of the flex container it lands in.
|
|
173
173
|
|
|
174
|
+
### DIRECTIVE_TRANSITION_TRACKS_PREV_VALUE
|
|
175
|
+
|
|
176
|
+
A Lit directive that gates an effect on a value transition stores the previous value in a private field and compares the incoming value against it in `update()`, firing the effect only when the two differ.
|
|
177
|
+
|
|
174
178
|
## Workflow
|
|
175
179
|
|
|
176
180
|
1. User describes a UI task.
|
package/skills/schmancy/chips.md
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
# Chips
|
|
2
2
|
|
|
3
|
-
> Four chip types: filter (toggleable), input (removable), suggestion (action), assist (action + elevated). Filter chips have embedded `magnetic` directive and selection glow.
|
|
3
|
+
> Four chip types: filter (toggleable), input (removable), suggestion (action), assist (action + elevated). Filter chips have embedded `magnetic` directive and selection glow. The `schmancy-chips` **container** wraps a set of chips, owns their selection state, and lays them out as one horizontally-scrolling row (or a wrapping grid).
|
|
4
|
+
|
|
5
|
+
## Container — `schmancy-chips`
|
|
6
|
+
|
|
7
|
+
A form-associated container (`SchmancyFormField`: `name`, `required`, `disabled`, `hint`, `checkValidity()`, FormData participation). Slot `<schmancy-filter-chip>` children with **only** `.value` + label — the container drives each child's `selected` from its own `value`, so children carry no `?selected` and no per-chip `@change`. This is the primary entry point; reach for a bare `<schmancy-filter-chip>` only outside a selection group.
|
|
8
|
+
|
|
9
|
+
| Property | Type | Default | Description |
|
|
10
|
+
|----------|------|---------|-------------|
|
|
11
|
+
| `value` | `string \| string[]` | `''` / `[]` | Selected id (single mode) or ids (multi mode). |
|
|
12
|
+
| `values` | `string[]` | `[]` | Typed alias for `value` in multi mode. |
|
|
13
|
+
| `multi` | `boolean` | `false` | `true` → multiple chips selectable; `value` is `string[]`. |
|
|
14
|
+
| `wrap` | `boolean` | `false` | `false` → **single row, horizontal scroll** (internal `<schmancy-scroll direction="horizontal">`). `true` → multi-row wrap, vertical scroll. |
|
|
15
|
+
| `justify` | `'start' \| 'center' \| 'end'` | `'start'` | Main-axis alignment. |
|
|
16
|
+
| `required` | `boolean` | `false` | Single mode: deselecting the chosen chip is ignored (a value is mandatory). |
|
|
17
|
+
|
|
18
|
+
| Event | Detail | Fires on |
|
|
19
|
+
|-------|--------|----------|
|
|
20
|
+
| `change` | `{ value: string \| string[] }` | **User interaction only** — child chip toggled. NOT emitted on a programmatic `.value` set, so no `CONTROLLED_VALUE_ECHO_IS_NOT_INTENT` guard is needed. |
|
|
21
|
+
|
|
22
|
+
Single mode (`multi` false): selecting a chip sets `value` to its id; clicking the selected chip deselects → `change` with `value: ''` (unless `required`). Multi mode: each toggle adds/removes the id from the array.
|
|
23
|
+
|
|
24
|
+
**Host sizing — required for horizontal overscroll.** `:host` is `width: fit-content`, so by default the container hugs its chips and never scrolls. Constrain the host to trigger the single-row scroll: `class="w-full"` standalone, or `class="flex-1 min-w-0"` as a flex-row item beside other controls.
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<!-- single-select, one horizontally-scrolling row -->
|
|
28
|
+
<schmancy-chips
|
|
29
|
+
class="w-full"
|
|
30
|
+
.value=${selectedId ?? ''}
|
|
31
|
+
@change=${(e: CustomEvent<{ value: string }>) =>
|
|
32
|
+
pick(e.detail.value || null)}
|
|
33
|
+
>
|
|
34
|
+
${repeat(items, i => i.id, i => html`
|
|
35
|
+
<schmancy-filter-chip .value=${i.id}>${i.label}</schmancy-filter-chip>`)}
|
|
36
|
+
</schmancy-chips>
|
|
37
|
+
|
|
38
|
+
<!-- multi-select, wrapping grid -->
|
|
39
|
+
<schmancy-chips multi wrap required .value=${tags} @change=${onTags}>
|
|
40
|
+
${repeat(opts, o => o.id, o => html`
|
|
41
|
+
<schmancy-filter-chip .value=${o.id}>${o.name}</schmancy-filter-chip>`)}
|
|
42
|
+
</schmancy-chips>
|
|
43
|
+
```
|
|
4
44
|
|
|
5
45
|
## Chip Types
|
|
6
46
|
|
package/src/boat/boat.ts
CHANGED
|
@@ -69,6 +69,7 @@ export default class SchmancyBoat extends SchmancyElement {
|
|
|
69
69
|
#ready = false
|
|
70
70
|
#sub?: Subscription
|
|
71
71
|
#captured: Element[] = []
|
|
72
|
+
#wrapper?: HTMLElement
|
|
72
73
|
|
|
73
74
|
// ============================================
|
|
74
75
|
// POSITION MANAGEMENT
|
|
@@ -190,12 +191,12 @@ export default class SchmancyBoat extends SchmancyElement {
|
|
|
190
191
|
private openOverlay() {
|
|
191
192
|
if (this.#sub) return
|
|
192
193
|
const anchor = this.containerRef.value
|
|
193
|
-
|
|
194
|
-
wrapper.className = 'flex flex-col'
|
|
194
|
+
this.#wrapper = document.createElement('div')
|
|
195
|
+
this.#wrapper.className = 'flex flex-col'
|
|
195
196
|
this.#captured = [...this.slotted]
|
|
196
|
-
this.#captured.forEach(node => wrapper
|
|
197
|
+
this.#captured.forEach(node => this.#wrapper!.appendChild(node))
|
|
197
198
|
|
|
198
|
-
this.#sub = show(wrapper, {
|
|
199
|
+
this.#sub = show(this.#wrapper, {
|
|
199
200
|
anchor: anchor ?? undefined,
|
|
200
201
|
dismissable: true,
|
|
201
202
|
historyStrategy: 'silent',
|
|
@@ -212,6 +213,7 @@ export default class SchmancyBoat extends SchmancyElement {
|
|
|
212
213
|
private restoreSlotted() {
|
|
213
214
|
this.#captured.forEach(node => this.appendChild(node))
|
|
214
215
|
this.#captured = []
|
|
216
|
+
this.#wrapper = undefined
|
|
215
217
|
this.#sub = undefined
|
|
216
218
|
if (this.open) this.open = false
|
|
217
219
|
this.dispatchScopedEvent('toggle', 'closed')
|
|
@@ -353,6 +355,19 @@ export default class SchmancyBoat extends SchmancyElement {
|
|
|
353
355
|
this.hasHandle = this.handleNodes.length > 0
|
|
354
356
|
}
|
|
355
357
|
|
|
358
|
+
// When Lit re-renders the parent and re-asserts default-slot children back
|
|
359
|
+
// into this element, slotchange fires. If the overlay is live, re-relocate
|
|
360
|
+
// any reassigned nodes into the overlay wrapper to stop the DOM ping-pong.
|
|
361
|
+
private onDefaultSlotChange = () => {
|
|
362
|
+
if (!this.#sub || !this.#wrapper) return
|
|
363
|
+
this.slotted.forEach(node => {
|
|
364
|
+
if (node.parentElement !== this.#wrapper) {
|
|
365
|
+
this.#captured.push(node)
|
|
366
|
+
this.#wrapper!.appendChild(node)
|
|
367
|
+
}
|
|
368
|
+
})
|
|
369
|
+
}
|
|
370
|
+
|
|
356
371
|
protected render(): unknown {
|
|
357
372
|
const containerClasses = classMap({
|
|
358
373
|
'inline-flex': true,
|
|
@@ -412,7 +427,7 @@ export default class SchmancyBoat extends SchmancyElement {
|
|
|
412
427
|
|
|
413
428
|
<!-- Default-slot content parks here (hidden) while collapsed;
|
|
414
429
|
relocated into the show() overlay on open. -->
|
|
415
|
-
<div hidden><slot></slot></div>
|
|
430
|
+
<div hidden><slot @slotchange=${this.onDefaultSlotChange}></slot></div>
|
|
416
431
|
</schmancy-surface>
|
|
417
432
|
`
|
|
418
433
|
}
|
package/src/directives/reveal.ts
CHANGED
|
@@ -77,6 +77,8 @@ class RevealDirective extends AsyncDirective {
|
|
|
77
77
|
private teardown$ = new Subject<void>();
|
|
78
78
|
/** True if this is the very first update call — used to detect always-true initial mount. */
|
|
79
79
|
private firstUpdate = true;
|
|
80
|
+
/** Previous show value — animation only fires on false→true transitions. */
|
|
81
|
+
private prevShow: boolean | undefined = undefined;
|
|
80
82
|
|
|
81
83
|
constructor(partInfo: PartInfo) {
|
|
82
84
|
super(partInfo);
|
|
@@ -106,6 +108,8 @@ class RevealDirective extends AsyncDirective {
|
|
|
106
108
|
|
|
107
109
|
const isFirstUpdate = this.firstUpdate;
|
|
108
110
|
this.firstUpdate = false;
|
|
111
|
+
const didChange = show !== this.prevShow;
|
|
112
|
+
this.prevShow = show;
|
|
109
113
|
|
|
110
114
|
if (!this.initialized) {
|
|
111
115
|
this.initialized = true;
|
|
@@ -137,9 +141,11 @@ class RevealDirective extends AsyncDirective {
|
|
|
137
141
|
}
|
|
138
142
|
element.style.opacity = '1';
|
|
139
143
|
element.style.transform = 'translateY(0) scale(1)';
|
|
140
|
-
} else {
|
|
144
|
+
} else if (didChange) {
|
|
141
145
|
// Toggle case: false→true. Animate from 0 to natural height,
|
|
142
146
|
// then release the clamp so content is fully unconstrained.
|
|
147
|
+
// Guard: skip when show stays true across re-renders — re-animating
|
|
148
|
+
// every render causes the overlay to resize and flicker on every tick.
|
|
143
149
|
if (reducedMotion) {
|
|
144
150
|
if (explicitCap) {
|
|
145
151
|
element.style.maxHeight = maxHeight;
|
package/types/src/boat/boat.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ declare class RevealDirective extends AsyncDirective {
|
|
|
54
54
|
private teardown$;
|
|
55
55
|
/** True if this is the very first update call — used to detect always-true initial mount. */
|
|
56
56
|
private firstUpdate;
|
|
57
|
+
/** Previous show value — animation only fires on false→true transitions. */
|
|
58
|
+
private prevShow;
|
|
57
59
|
constructor(partInfo: PartInfo);
|
|
58
60
|
render(show?: boolean, options?: RevealOptions): symbol;
|
|
59
61
|
update(part: ElementPart, [show, options]: [boolean | undefined, RevealOptions?]): symbol;
|
package/dist/boat-DsFJNfPH.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require(`./chunk-CncqDLb2.cjs`);const e=require(`./SchmancyElement-C41uPa6l.cjs`);require(`./mixins-fIpzhVMd.cjs`);const t=require(`./animation-CCOIW4wJ.cjs`),n=require(`./reduced-motion-Ds-HjMzn.cjs`),r=require(`./theme.service-B15FdjOS.cjs`),i=require(`./overlay.service-Dbu5uP9E.cjs`);let a=require(`rxjs`),o=require(`lit/directives/class-map.js`),s=require(`lit/directives/style-map.js`),c=require(`lit/decorators.js`),l=require(`lit`),u=require(`lit/directives/ref.js`);var d=`schmancy-boat-`,f=class extends e.t{constructor(...e){super(...e),this.id=`default`,this.corner=`bottom-right`,this.open=!1,this.isDragging=!1,this.currentCorner=`bottom-right`,this.hasHandle=!1,this.position={x:16,y:16},this.containerRef=(0,u.createRef)(),this.triggerRef=(0,u.createRef)(),this.handleRef=(0,u.createRef)(),this.#e=!1,this.#n=[],this.onHandleSlotChange=()=>{this.hasHandle=this.handleNodes.length>0}}#e;#t;#n;applyContainerPosition(){let e=this.containerRef.value;if(!e)return;e.style.removeProperty(`left`),e.style.removeProperty(`right`),e.style.removeProperty(`top`),e.style.removeProperty(`bottom`);let{x:t,y:n}=this.position;this.currentCorner.includes(`right`)?e.style.right=`${t}px`:e.style.left=`${t}px`,this.currentCorner.includes(`bottom`)?e.style.bottom=`${n+r.n.bottomOffset}px`:e.style.top=`${n}px`}loadPosition(){try{let e=localStorage.getItem(d+this.id);if(e){let t=JSON.parse(e);this.position={x:t.x,y:t.y},this.currentCorner=t.anchor}}catch{}}savePosition(){try{localStorage.setItem(d+this.id,JSON.stringify({...this.position,anchor:this.currentCorner}))}catch{}}validateBounds(){let e=this.containerRef.value;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0)return;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));this.position={x:i?n-c-t.width:c,y:a?r-l-t.height:l},this.applyContainerPosition()}reorientToNearestCorner(){let e=this.containerRef.value;if(!e)return;let r=e.getBoundingClientRect(),i=r.left+r.width/2,a=r.top+r.height/2,o=i>window.innerWidth/2?`right`:`left`,s=a>window.innerHeight/2?`bottom`:`top`;if(this.currentCorner=`${s}-${o}`,this.position={x:16,y:16},this.applyContainerPosition(),n.t.value)return void this.savePosition();let c=e.getBoundingClientRect(),l=r.left-c.left,u=r.top-c.top;e.style.transform=`translate(${l}px, ${u}px)`,this.currentAnimation?.cancel();let d=e.animate([{transform:e.style.transform},{transform:`translate(0,0)`}],{duration:t.d.duration,easing:t.d.easingFallback,fill:`forwards`});this.currentAnimation=d,d.finished.then(()=>{e.isConnected&&(e.style.transform=``)}),this.savePosition()}openOverlay(){if(this.#t)return;let e=this.containerRef.value,t=document.createElement(`div`);t.className=`flex flex-col`,this.#n=[...this.slotted],this.#n.forEach(e=>t.appendChild(e)),this.#t=i.o(t,{anchor:e??void 0,dismissable:!0,historyStrategy:`silent`}).pipe((0,a.finalize)(()=>this.restoreSlotted()),(0,a.takeUntil)(this.disconnecting)).subscribe(),this.dispatchScopedEvent(`toggle`,`open`)}restoreSlotted(){this.#n.forEach(e=>this.appendChild(e)),this.#n=[],this.#t=void 0,this.open&&=!1,this.dispatchScopedEvent(`toggle`,`closed`)}connectedCallback(){super.connectedCallback(),(0,a.merge)((0,a.fromEvent)(window,`resize`).pipe((0,a.tap)(()=>this.validateBounds())),r.n.bottomOffset$.pipe((0,a.tap)(()=>this.applyContainerPosition()))).pipe((0,a.takeUntil)(this.disconnecting)).subscribe()}firstUpdated(){this.currentCorner=this.corner,this.hasHandle=this.handleNodes.length>0,this.loadPosition();let e=this.containerRef.value,t=this.triggerRef.value,n=this.handleRef.value;e&&t&&n&&(this.applyContainerPosition(),(0,a.merge)((0,a.fromEvent)(t,`click`).pipe((0,a.tap)(()=>this.toggle())),(0,a.fromEvent)(t,`keydown`).pipe((0,a.filter)(e=>e.key===`Enter`||e.key===` `),(0,a.tap)(e=>{e.preventDefault(),this.toggle()})),(0,a.fromEvent)(n,`pointerdown`).pipe((0,a.filter)(e=>e.button===0),(0,a.tap)(e=>{e.preventDefault();try{n.setPointerCapture(e.pointerId)}catch{}}),(0,a.exhaustMap)(t=>{let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top,o=!1,s=e=>e.pointerId===t.pointerId,c=(0,a.merge)((0,a.fromEvent)(window,`pointerup`),(0,a.fromEvent)(window,`pointercancel`)).pipe((0,a.filter)(s));return(0,a.fromEvent)(window,`pointermove`).pipe((0,a.filter)(s),(0,a.tap)(e=>{let a=e.clientX-t.clientX,s=e.clientY-t.clientY;if(!o&&Math.sqrt(a*a+s*s)>5&&(o=!0,this.isDragging=!0),!o)return;let c=window.innerWidth,l=window.innerHeight,u=Math.max(0,Math.min(e.clientX-r,c-n.width)),d=Math.max(0,Math.min(e.clientY-i,l-n.height));this.position={x:this.currentCorner.includes(`right`)?c-u-n.width:u,y:this.currentCorner.includes(`bottom`)?l-d-n.height:d},this.applyContainerPosition()}),(0,a.takeUntil)(c),(0,a.finalize)(()=>{o?this.reorientToNearestCorner():this.toggle(),this.isDragging=!1}))}))).pipe((0,a.takeUntil)(this.disconnecting)).subscribe(),this.#e=!0,this.open&&this.openOverlay())}willUpdate(e){this.#e&&e.has(`open`)&&(this.open&&!this.#t?this.openOverlay():!this.open&&this.#t&&this.#t.unsubscribe())}disconnectedCallback(){super.disconnectedCallback(),this.currentAnimation?.cancel(),this.#t?.unsubscribe()}toggle(){this.open=!this.open}render(){let e=(0,o.classMap)({"inline-flex":!0,"transition-opacity":!0,"duration-200":!0,"opacity-85":this.isDragging,"scale-95":this.isDragging}),t=(0,s.styleMap)({position:`fixed`,"pointer-events":`auto`}),n=(0,o.classMap)({flex:!0,"items-center":!0,"touch-none":!0,"select-none":!0,hidden:!this.hasHandle,"cursor-grabbing":this.isDragging,"cursor-grab":!this.isDragging});return l.html`
|
|
2
|
-
<schmancy-surface
|
|
3
|
-
${(0,u.ref)(this.containerRef)}
|
|
4
|
-
type="glass"
|
|
5
|
-
rounded="all"
|
|
6
|
-
.elevation=${3}
|
|
7
|
-
class="${e} overflow-hidden rounded-2xl"
|
|
8
|
-
style=${t}
|
|
9
|
-
aria-expanded=${this.open}
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
${(0,u.ref)(this.handleRef)}
|
|
13
|
-
class=${n}
|
|
14
|
-
aria-label="Drag to move"
|
|
15
|
-
>
|
|
16
|
-
<slot name="drag-handle" @slotchange=${this.onHandleSlotChange}></slot>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
<div
|
|
20
|
-
${(0,u.ref)(this.triggerRef)}
|
|
21
|
-
class="flex items-center cursor-pointer"
|
|
22
|
-
role="button"
|
|
23
|
-
tabindex="0"
|
|
24
|
-
aria-label="Open panel"
|
|
25
|
-
title="Click to open"
|
|
26
|
-
>
|
|
27
|
-
<slot name="trigger"></slot>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<!-- Default-slot content parks here (hidden) while collapsed;
|
|
31
|
-
relocated into the show() overlay on open. -->
|
|
32
|
-
<div hidden><slot></slot></div>
|
|
33
|
-
</schmancy-surface>
|
|
34
|
-
`}};e.u([(0,c.property)({type:String})],f.prototype,`id`,void 0),e.u([(0,c.property)({type:String})],f.prototype,`corner`,void 0),e.u([(0,c.property)({type:Boolean,reflect:!0})],f.prototype,`open`,void 0),e.u([(0,c.state)()],f.prototype,`isDragging`,void 0),e.u([(0,c.state)()],f.prototype,`currentCorner`,void 0),e.u([(0,c.state)()],f.prototype,`hasHandle`,void 0),e.u([(0,c.queryAssignedElements)()],f.prototype,`slotted`,void 0),e.u([(0,c.queryAssignedElements)({slot:`drag-handle`})],f.prototype,`handleNodes`,void 0);var p=f=e.u([(0,c.customElement)(`schmancy-boat`)],f);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return p}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boat-DsFJNfPH.cjs","names":["#sub","#captured","#ready"],"sources":["../src/boat/boat.ts"],"sourcesContent":["import { SchmancyElement } from '@mixins/index'\nimport { html, type PropertyValues } from 'lit'\nimport { customElement, property, queryAssignedElements, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { exhaustMap, filter, finalize, fromEvent, merge, type Subscription, takeUntil, tap } from 'rxjs'\nimport { reducedMotion$ } from '../directives/reduced-motion'\nimport { show } from '../overlay/overlay.service'\nimport { theme } from '../theme/theme.service.js'\nimport { SPRING_SMOOTH } from '../utils/animation.js'\n\nconst DRAG_THRESHOLD = 5\nconst POSITION_STORAGE_KEY_PREFIX = 'schmancy-boat-'\n\ntype Corner = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\ninterface Position {\n\tx: number\n\ty: number\n}\n\n/**\n * Corner-anchored launcher that delegates its expanded panel to the `show()`\n * overlay service.\n *\n * Three slots, three non-overlapping intents — no element-type sniffing,\n * ever:\n *\n * - `trigger` — pure consumer content. A native click anywhere on it\n * opens the panel; interactive children (buttons, FABs, inputs) work\n * with zero special-casing because the boat never calls\n * `preventDefault` / `stopPropagation` / `setPointerCapture` here.\n * - `drag-handle` — opt-in. Pointer-drag is wired ONLY to this slot's\n * boat-owned wrapper. Slot it to make the boat draggable; omit it and\n * the boat is static at its corner. (A no-move tap on the handle also\n * opens, so the grip doubles as a launcher.)\n * - _(default)_ — the panel body; parked hidden while collapsed,\n * relocated into the `show()` overlay on open.\n *\n * The boat owns drag, corner-snapping, position persistence and the glass\n * surface — never the collapsed shape.\n */\n@customElement('schmancy-boat')\nexport default class SchmancyBoat extends SchmancyElement {\n\n\n\t/** Identity for localStorage drag-position persistence. */\n\t@property({ type: String }) id: string = 'default'\n\t/** Corner the launcher is anchored to. */\n\t@property({ type: String }) corner: Corner = 'bottom-right'\n\t/** Open state. Bind `?open=${…}` to drive the overlay; reflected to the attribute. */\n\t@property({ type: Boolean, reflect: true }) open: boolean = false\n\n\t@state() private isDragging = false\n\t@state() private currentCorner: Corner = 'bottom-right'\n\t@state() private hasHandle = false\n\n\t/** Default-slot nodes — the overlay body. */\n\t@queryAssignedElements() private slotted!: Element[]\n\t/** Slotted drag-handle nodes — presence toggles draggability. */\n\t@queryAssignedElements({ slot: 'drag-handle' }) private handleNodes!: Element[]\n\n\tprivate position: Position = { x: 16, y: 16 }\n\tprivate containerRef = createRef<HTMLElement>()\n\tprivate triggerRef = createRef<HTMLElement>()\n\tprivate handleRef = createRef<HTMLElement>()\n\tprivate currentAnimation?: Animation\n\n\t#ready = false\n\t#sub?: Subscription\n\t#captured: Element[] = []\n\n\t// ============================================\n\t// POSITION MANAGEMENT\n\t// ============================================\n\n\tprivate applyContainerPosition() {\n\t\tconst container = this.containerRef.value\n\t\tif (!container) return\n\t\tcontainer.style.removeProperty('left')\n\t\tcontainer.style.removeProperty('right')\n\t\tcontainer.style.removeProperty('top')\n\t\tcontainer.style.removeProperty('bottom')\n\t\tconst { x, y } = this.position\n\t\tif (this.currentCorner.includes('right')) {\n\t\t\tcontainer.style.right = `${x}px`\n\t\t} else {\n\t\t\tcontainer.style.left = `${x}px`\n\t\t}\n\t\tif (this.currentCorner.includes('bottom')) {\n\t\t\tcontainer.style.bottom = `${y + theme.bottomOffset}px`\n\t\t} else {\n\t\t\tcontainer.style.top = `${y}px`\n\t\t}\n\t}\n\n\tprivate loadPosition() {\n\t\ttry {\n\t\t\tconst saved = localStorage.getItem(POSITION_STORAGE_KEY_PREFIX + this.id)\n\t\t\tif (saved) {\n\t\t\t\tconst parsed = JSON.parse(saved) as { x: number; y: number; anchor: Corner }\n\t\t\t\tthis.position = { x: parsed.x, y: parsed.y }\n\t\t\t\tthis.currentCorner = parsed.anchor\n\t\t\t}\n\t\t} catch {\n\t\t\t// ignore localStorage errors\n\t\t}\n\t}\n\n\tprivate savePosition() {\n\t\ttry {\n\t\t\tlocalStorage.setItem(\n\t\t\t\tPOSITION_STORAGE_KEY_PREFIX + this.id,\n\t\t\t\tJSON.stringify({ ...this.position, anchor: this.currentCorner }),\n\t\t\t)\n\t\t} catch {\n\t\t\t// ignore localStorage errors\n\t\t}\n\t}\n\n\tprivate validateBounds() {\n\t\tconst container = this.containerRef.value\n\t\tif (!container) return\n\t\tconst rect = container.getBoundingClientRect()\n\t\tif (rect.width === 0) return\n\t\tconst vw = window.innerWidth\n\t\tconst vh = window.innerHeight\n\t\tconst isRight = this.currentCorner.includes('right')\n\t\tconst isBottom = this.currentCorner.includes('bottom')\n\t\tconst actualLeft = isRight ? vw - this.position.x - rect.width : this.position.x\n\t\tconst actualTop = isBottom ? vh - this.position.y - rect.height : this.position.y\n\t\tconst newLeft = Math.max(0, Math.min(actualLeft, vw - rect.width))\n\t\tconst newTop = Math.max(0, Math.min(actualTop, vh - rect.height))\n\t\tthis.position = {\n\t\t\tx: isRight ? vw - newLeft - rect.width : newLeft,\n\t\t\ty: isBottom ? vh - newTop - rect.height : newTop,\n\t\t}\n\t\tthis.applyContainerPosition()\n\t}\n\n\t// ============================================\n\t// CORNER SNAPPING (FLIP)\n\t// ============================================\n\n\tprivate reorientToNearestCorner(): void {\n\t\tconst container = this.containerRef.value\n\t\tif (!container) return\n\n\t\tconst rect = container.getBoundingClientRect()\n\t\tconst fabCenterX = rect.left + rect.width / 2\n\t\tconst fabCenterY = rect.top + rect.height / 2\n\t\tconst side = fabCenterX > window.innerWidth / 2 ? 'right' : 'left'\n\t\tconst vert = fabCenterY > window.innerHeight / 2 ? 'bottom' : 'top'\n\t\tthis.currentCorner = `${vert}-${side}` as Corner\n\t\tthis.position = { x: 16, y: 16 }\n\t\tthis.applyContainerPosition()\n\n\t\tif (reducedMotion$.value) {\n\t\t\tthis.savePosition()\n\t\t\treturn\n\t\t}\n\n\t\tconst newRect = container.getBoundingClientRect()\n\t\tconst dx = rect.left - newRect.left\n\t\tconst dy = rect.top - newRect.top\n\t\tcontainer.style.transform = `translate(${dx}px, ${dy}px)`\n\n\t\tthis.currentAnimation?.cancel()\n\t\tconst anim = container.animate(\n\t\t\t[{ transform: container.style.transform }, { transform: 'translate(0,0)' }],\n\t\t\t{\n\t\t\t\tduration: SPRING_SMOOTH.duration,\n\t\t\t\teasing: SPRING_SMOOTH.easingFallback,\n\t\t\t\tfill: 'forwards',\n\t\t\t},\n\t\t)\n\t\tthis.currentAnimation = anim\n\t\tanim.finished.then(() => {\n\t\t\tif (container.isConnected) container.style.transform = ''\n\t\t\treturn\n\t\t})\n\n\t\tthis.savePosition()\n\t}\n\n\t// ============================================\n\t// OVERLAY DELEGATION\n\t// ============================================\n\n\tprivate openOverlay() {\n\t\tif (this.#sub) return\n\t\tconst anchor = this.containerRef.value\n\t\tconst wrapper = document.createElement('div')\n\t\twrapper.className = 'flex flex-col'\n\t\tthis.#captured = [...this.slotted]\n\t\tthis.#captured.forEach(node => wrapper.appendChild(node))\n\n\t\tthis.#sub = show(wrapper, {\n\t\t\tanchor: anchor ?? undefined,\n\t\t\tdismissable: true,\n\t\t\thistoryStrategy: 'silent',\n\t\t})\n\t\t\t.pipe(\n\t\t\t\tfinalize(() => this.restoreSlotted()),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\n\t\tthis.dispatchScopedEvent('toggle', 'open')\n\t}\n\n\tprivate restoreSlotted() {\n\t\tthis.#captured.forEach(node => this.appendChild(node))\n\t\tthis.#captured = []\n\t\tthis.#sub = undefined\n\t\tif (this.open) this.open = false\n\t\tthis.dispatchScopedEvent('toggle', 'closed')\n\t}\n\n\t// ============================================\n\t// LIFECYCLE\n\t// ============================================\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// One concern: keep the container in place when the environment\n\t\t// shifts. Viewport resize re-validates bounds; a theme bottom-offset\n\t\t// change (e.g. a snackbar pushing the safe area) re-applies position.\n\t\tmerge(\n\t\t\tfromEvent(window, 'resize').pipe(tap(() => this.validateBounds())),\n\t\t\ttheme.bottomOffset$.pipe(tap(() => this.applyContainerPosition())),\n\t\t)\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe()\n\t}\n\n\tfirstUpdated() {\n\t\tthis.currentCorner = this.corner\n\t\tthis.hasHandle = this.handleNodes.length > 0\n\t\tthis.loadPosition()\n\t\tconst container = this.containerRef.value\n\t\tconst trigger = this.triggerRef.value\n\t\tconst handle = this.handleRef.value\n\t\tif (!container || !trigger || !handle) return\n\t\tthis.applyContainerPosition()\n\n\t\t// Three intents, three sources, one pipeline, one subscribe.\n\t\t//\n\t\t// open$ — a plain click/Enter/Space on the trigger region. No\n\t\t// preventDefault/stopPropagation: a slotted button's own\n\t\t// click still fires; it merely also bubbles to \"open\".\n\t\t// drag$ — pointerdown on the boat-owned drag-handle wrapper. A\n\t\t// dedicated region, so every pointerdown there is a drag\n\t\t// intent — no element-type sniffing. A session ends on\n\t\t// pointerup/cancel; settle = move past threshold ? snap to\n\t\t// the nearest corner : treat as a tap and open.\n\t\tmerge(\n\t\t\tfromEvent<MouseEvent>(trigger, 'click').pipe(tap(() => this.toggle())),\n\t\t\tfromEvent<KeyboardEvent>(trigger, 'keydown').pipe(\n\t\t\t\tfilter(e => e.key === 'Enter' || e.key === ' '),\n\t\t\t\ttap(e => {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\tthis.toggle()\n\t\t\t\t}),\n\t\t\t),\n\t\t\tfromEvent<PointerEvent>(handle, 'pointerdown').pipe(\n\t\t\t\tfilter(e => e.button === 0),\n\t\t\t\ttap(e => {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\t// Capture can throw InvalidStateError if the pointer is\n\t\t\t\t\t// already released (fast tap) — drag still works without it.\n\t\t\t\t\ttry {\n\t\t\t\t\t\thandle.setPointerCapture(e.pointerId)\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// no active pointer to capture; ignore\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\texhaustMap(down => {\n\t\t\t\t\tconst rect = container.getBoundingClientRect()\n\t\t\t\t\tconst offsetX = down.clientX - rect.left\n\t\t\t\t\tconst offsetY = down.clientY - rect.top\n\t\t\t\t\tlet moved = false\n\t\t\t\t\tconst sameId = (e: PointerEvent) => e.pointerId === down.pointerId\n\t\t\t\t\tconst end$ = merge(\n\t\t\t\t\t\tfromEvent<PointerEvent>(window, 'pointerup'),\n\t\t\t\t\t\tfromEvent<PointerEvent>(window, 'pointercancel'),\n\t\t\t\t\t).pipe(filter(sameId))\n\n\t\t\t\t\treturn fromEvent<PointerEvent>(window, 'pointermove').pipe(\n\t\t\t\t\t\tfilter(sameId),\n\t\t\t\t\t\ttap(e => {\n\t\t\t\t\t\t\tconst dx = e.clientX - down.clientX\n\t\t\t\t\t\t\tconst dy = e.clientY - down.clientY\n\t\t\t\t\t\t\tif (!moved && Math.sqrt(dx * dx + dy * dy) > DRAG_THRESHOLD) {\n\t\t\t\t\t\t\t\tmoved = true\n\t\t\t\t\t\t\t\tthis.isDragging = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!moved) return\n\t\t\t\t\t\t\tconst vw = window.innerWidth\n\t\t\t\t\t\t\tconst vh = window.innerHeight\n\t\t\t\t\t\t\tconst left = Math.max(0, Math.min(e.clientX - offsetX, vw - rect.width))\n\t\t\t\t\t\t\tconst top = Math.max(0, Math.min(e.clientY - offsetY, vh - rect.height))\n\t\t\t\t\t\t\tthis.position = {\n\t\t\t\t\t\t\t\tx: this.currentCorner.includes('right') ? vw - left - rect.width : left,\n\t\t\t\t\t\t\t\ty: this.currentCorner.includes('bottom') ? vh - top - rect.height : top,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.applyContainerPosition()\n\t\t\t\t\t\t}),\n\t\t\t\t\t\ttakeUntil(end$),\n\t\t\t\t\t\tfinalize(() => {\n\t\t\t\t\t\t\tif (moved) this.reorientToNearestCorner()\n\t\t\t\t\t\t\telse this.toggle()\n\t\t\t\t\t\t\tthis.isDragging = false\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe()\n\n\t\tthis.#ready = true\n\t\tif (this.open) this.openOverlay()\n\t}\n\n\tprotected willUpdate(changed: PropertyValues<this>) {\n\t\tif (!this.#ready || !changed.has('open')) return\n\t\tif (this.open && !this.#sub) this.openOverlay()\n\t\telse if (!this.open && this.#sub) this.#sub.unsubscribe()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.currentAnimation?.cancel()\n\t\tthis.#sub?.unsubscribe()\n\t}\n\n\t// ============================================\n\t// PUBLIC API\n\t// ============================================\n\n\t/** Flip open ↔ closed. */\n\ttoggle() {\n\t\tthis.open = !this.open\n\t}\n\n\t// ============================================\n\t// RENDER\n\t// ============================================\n\n\tprivate onHandleSlotChange = () => {\n\t\tthis.hasHandle = this.handleNodes.length > 0\n\t}\n\n\tprotected render(): unknown {\n\t\tconst containerClasses = classMap({\n\t\t\t'inline-flex': true,\n\t\t\t'transition-opacity': true,\n\t\t\t'duration-200': true,\n\t\t\t'opacity-85': this.isDragging,\n\t\t\t'scale-95': this.isDragging,\n\t\t})\n\n\t\tconst containerStyles = styleMap({\n\t\t\tposition: 'fixed',\n\t\t\t'pointer-events': 'auto',\n\t\t})\n\n\t\t// Boat-owned drag region — wraps ONLY the drag-handle slot, so every\n\t\t// pointerdown inside it is unambiguously a drag intent. Hidden (and\n\t\t// out of layout) when the consumer slots no handle: the boat is then\n\t\t// simply not draggable.\n\t\tconst handleClasses = classMap({\n\t\t\tflex: true,\n\t\t\t'items-center': true,\n\t\t\t'touch-none': true,\n\t\t\t'select-none': true,\n\t\t\thidden: !this.hasHandle,\n\t\t\t'cursor-grabbing': this.isDragging,\n\t\t\t'cursor-grab': !this.isDragging,\n\t\t})\n\n\t\treturn html`\n\t\t\t<schmancy-surface\n\t\t\t\t${ref(this.containerRef)}\n\t\t\t\ttype=\"glass\"\n\t\t\t\trounded=\"all\"\n\t\t\t\t.elevation=${3}\n\t\t\t\tclass=\"${containerClasses} overflow-hidden rounded-2xl\"\n\t\t\t\tstyle=${containerStyles}\n\t\t\t\taria-expanded=${this.open}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\t${ref(this.handleRef)}\n\t\t\t\t\tclass=${handleClasses}\n\t\t\t\t\taria-label=\"Drag to move\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"drag-handle\" @slotchange=${this.onHandleSlotChange}></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div\n\t\t\t\t\t${ref(this.triggerRef)}\n\t\t\t\t\tclass=\"flex items-center cursor-pointer\"\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\taria-label=\"Open panel\"\n\t\t\t\t\ttitle=\"Click to open\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"trigger\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- Default-slot content parks here (hidden) while collapsed;\n\t\t\t\t relocated into the show() overlay on open. -->\n\t\t\t\t<div hidden><slot></slot></div>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-boat': SchmancyBoat\n\t}\n}\n"],"mappings":"2dAYA,IACM,EAA8B,iBA8BrB,EAAA,cAA2B,EAAA,CAAA,CAAA,YAAA,GAAA,EAAA,CAAA,MAAA,GAAA,CAAA,EAAA,KAAA,GAIA,UAAA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AA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,uBAEA,CAAE,KAAM,aAAA,CAAA,CAAA,EAAe,EAAA,UAAA,cAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,eAlBhC,eAAA,CAAA,EAAe,CAAA,EAAA,OAAA,eAAA,QAAA,IAAA,CAAA,WAAA,CAAA,EAAA,IAAA,UAAA,CAAA,OAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boat-fqodYt2n.js","names":["#sub","#captured","#ready"],"sources":["../src/boat/boat.ts"],"sourcesContent":["import { SchmancyElement } from '@mixins/index'\nimport { html, type PropertyValues } from 'lit'\nimport { customElement, property, queryAssignedElements, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { createRef, ref } from 'lit/directives/ref.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { exhaustMap, filter, finalize, fromEvent, merge, type Subscription, takeUntil, tap } from 'rxjs'\nimport { reducedMotion$ } from '../directives/reduced-motion'\nimport { show } from '../overlay/overlay.service'\nimport { theme } from '../theme/theme.service.js'\nimport { SPRING_SMOOTH } from '../utils/animation.js'\n\nconst DRAG_THRESHOLD = 5\nconst POSITION_STORAGE_KEY_PREFIX = 'schmancy-boat-'\n\ntype Corner = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\ninterface Position {\n\tx: number\n\ty: number\n}\n\n/**\n * Corner-anchored launcher that delegates its expanded panel to the `show()`\n * overlay service.\n *\n * Three slots, three non-overlapping intents — no element-type sniffing,\n * ever:\n *\n * - `trigger` — pure consumer content. A native click anywhere on it\n * opens the panel; interactive children (buttons, FABs, inputs) work\n * with zero special-casing because the boat never calls\n * `preventDefault` / `stopPropagation` / `setPointerCapture` here.\n * - `drag-handle` — opt-in. Pointer-drag is wired ONLY to this slot's\n * boat-owned wrapper. Slot it to make the boat draggable; omit it and\n * the boat is static at its corner. (A no-move tap on the handle also\n * opens, so the grip doubles as a launcher.)\n * - _(default)_ — the panel body; parked hidden while collapsed,\n * relocated into the `show()` overlay on open.\n *\n * The boat owns drag, corner-snapping, position persistence and the glass\n * surface — never the collapsed shape.\n */\n@customElement('schmancy-boat')\nexport default class SchmancyBoat extends SchmancyElement {\n\n\n\t/** Identity for localStorage drag-position persistence. */\n\t@property({ type: String }) id: string = 'default'\n\t/** Corner the launcher is anchored to. */\n\t@property({ type: String }) corner: Corner = 'bottom-right'\n\t/** Open state. Bind `?open=${…}` to drive the overlay; reflected to the attribute. */\n\t@property({ type: Boolean, reflect: true }) open: boolean = false\n\n\t@state() private isDragging = false\n\t@state() private currentCorner: Corner = 'bottom-right'\n\t@state() private hasHandle = false\n\n\t/** Default-slot nodes — the overlay body. */\n\t@queryAssignedElements() private slotted!: Element[]\n\t/** Slotted drag-handle nodes — presence toggles draggability. */\n\t@queryAssignedElements({ slot: 'drag-handle' }) private handleNodes!: Element[]\n\n\tprivate position: Position = { x: 16, y: 16 }\n\tprivate containerRef = createRef<HTMLElement>()\n\tprivate triggerRef = createRef<HTMLElement>()\n\tprivate handleRef = createRef<HTMLElement>()\n\tprivate currentAnimation?: Animation\n\n\t#ready = false\n\t#sub?: Subscription\n\t#captured: Element[] = []\n\n\t// ============================================\n\t// POSITION MANAGEMENT\n\t// ============================================\n\n\tprivate applyContainerPosition() {\n\t\tconst container = this.containerRef.value\n\t\tif (!container) return\n\t\tcontainer.style.removeProperty('left')\n\t\tcontainer.style.removeProperty('right')\n\t\tcontainer.style.removeProperty('top')\n\t\tcontainer.style.removeProperty('bottom')\n\t\tconst { x, y } = this.position\n\t\tif (this.currentCorner.includes('right')) {\n\t\t\tcontainer.style.right = `${x}px`\n\t\t} else {\n\t\t\tcontainer.style.left = `${x}px`\n\t\t}\n\t\tif (this.currentCorner.includes('bottom')) {\n\t\t\tcontainer.style.bottom = `${y + theme.bottomOffset}px`\n\t\t} else {\n\t\t\tcontainer.style.top = `${y}px`\n\t\t}\n\t}\n\n\tprivate loadPosition() {\n\t\ttry {\n\t\t\tconst saved = localStorage.getItem(POSITION_STORAGE_KEY_PREFIX + this.id)\n\t\t\tif (saved) {\n\t\t\t\tconst parsed = JSON.parse(saved) as { x: number; y: number; anchor: Corner }\n\t\t\t\tthis.position = { x: parsed.x, y: parsed.y }\n\t\t\t\tthis.currentCorner = parsed.anchor\n\t\t\t}\n\t\t} catch {\n\t\t\t// ignore localStorage errors\n\t\t}\n\t}\n\n\tprivate savePosition() {\n\t\ttry {\n\t\t\tlocalStorage.setItem(\n\t\t\t\tPOSITION_STORAGE_KEY_PREFIX + this.id,\n\t\t\t\tJSON.stringify({ ...this.position, anchor: this.currentCorner }),\n\t\t\t)\n\t\t} catch {\n\t\t\t// ignore localStorage errors\n\t\t}\n\t}\n\n\tprivate validateBounds() {\n\t\tconst container = this.containerRef.value\n\t\tif (!container) return\n\t\tconst rect = container.getBoundingClientRect()\n\t\tif (rect.width === 0) return\n\t\tconst vw = window.innerWidth\n\t\tconst vh = window.innerHeight\n\t\tconst isRight = this.currentCorner.includes('right')\n\t\tconst isBottom = this.currentCorner.includes('bottom')\n\t\tconst actualLeft = isRight ? vw - this.position.x - rect.width : this.position.x\n\t\tconst actualTop = isBottom ? vh - this.position.y - rect.height : this.position.y\n\t\tconst newLeft = Math.max(0, Math.min(actualLeft, vw - rect.width))\n\t\tconst newTop = Math.max(0, Math.min(actualTop, vh - rect.height))\n\t\tthis.position = {\n\t\t\tx: isRight ? vw - newLeft - rect.width : newLeft,\n\t\t\ty: isBottom ? vh - newTop - rect.height : newTop,\n\t\t}\n\t\tthis.applyContainerPosition()\n\t}\n\n\t// ============================================\n\t// CORNER SNAPPING (FLIP)\n\t// ============================================\n\n\tprivate reorientToNearestCorner(): void {\n\t\tconst container = this.containerRef.value\n\t\tif (!container) return\n\n\t\tconst rect = container.getBoundingClientRect()\n\t\tconst fabCenterX = rect.left + rect.width / 2\n\t\tconst fabCenterY = rect.top + rect.height / 2\n\t\tconst side = fabCenterX > window.innerWidth / 2 ? 'right' : 'left'\n\t\tconst vert = fabCenterY > window.innerHeight / 2 ? 'bottom' : 'top'\n\t\tthis.currentCorner = `${vert}-${side}` as Corner\n\t\tthis.position = { x: 16, y: 16 }\n\t\tthis.applyContainerPosition()\n\n\t\tif (reducedMotion$.value) {\n\t\t\tthis.savePosition()\n\t\t\treturn\n\t\t}\n\n\t\tconst newRect = container.getBoundingClientRect()\n\t\tconst dx = rect.left - newRect.left\n\t\tconst dy = rect.top - newRect.top\n\t\tcontainer.style.transform = `translate(${dx}px, ${dy}px)`\n\n\t\tthis.currentAnimation?.cancel()\n\t\tconst anim = container.animate(\n\t\t\t[{ transform: container.style.transform }, { transform: 'translate(0,0)' }],\n\t\t\t{\n\t\t\t\tduration: SPRING_SMOOTH.duration,\n\t\t\t\teasing: SPRING_SMOOTH.easingFallback,\n\t\t\t\tfill: 'forwards',\n\t\t\t},\n\t\t)\n\t\tthis.currentAnimation = anim\n\t\tanim.finished.then(() => {\n\t\t\tif (container.isConnected) container.style.transform = ''\n\t\t\treturn\n\t\t})\n\n\t\tthis.savePosition()\n\t}\n\n\t// ============================================\n\t// OVERLAY DELEGATION\n\t// ============================================\n\n\tprivate openOverlay() {\n\t\tif (this.#sub) return\n\t\tconst anchor = this.containerRef.value\n\t\tconst wrapper = document.createElement('div')\n\t\twrapper.className = 'flex flex-col'\n\t\tthis.#captured = [...this.slotted]\n\t\tthis.#captured.forEach(node => wrapper.appendChild(node))\n\n\t\tthis.#sub = show(wrapper, {\n\t\t\tanchor: anchor ?? undefined,\n\t\t\tdismissable: true,\n\t\t\thistoryStrategy: 'silent',\n\t\t})\n\t\t\t.pipe(\n\t\t\t\tfinalize(() => this.restoreSlotted()),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe()\n\n\t\tthis.dispatchScopedEvent('toggle', 'open')\n\t}\n\n\tprivate restoreSlotted() {\n\t\tthis.#captured.forEach(node => this.appendChild(node))\n\t\tthis.#captured = []\n\t\tthis.#sub = undefined\n\t\tif (this.open) this.open = false\n\t\tthis.dispatchScopedEvent('toggle', 'closed')\n\t}\n\n\t// ============================================\n\t// LIFECYCLE\n\t// ============================================\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\n\t\t// One concern: keep the container in place when the environment\n\t\t// shifts. Viewport resize re-validates bounds; a theme bottom-offset\n\t\t// change (e.g. a snackbar pushing the safe area) re-applies position.\n\t\tmerge(\n\t\t\tfromEvent(window, 'resize').pipe(tap(() => this.validateBounds())),\n\t\t\ttheme.bottomOffset$.pipe(tap(() => this.applyContainerPosition())),\n\t\t)\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe()\n\t}\n\n\tfirstUpdated() {\n\t\tthis.currentCorner = this.corner\n\t\tthis.hasHandle = this.handleNodes.length > 0\n\t\tthis.loadPosition()\n\t\tconst container = this.containerRef.value\n\t\tconst trigger = this.triggerRef.value\n\t\tconst handle = this.handleRef.value\n\t\tif (!container || !trigger || !handle) return\n\t\tthis.applyContainerPosition()\n\n\t\t// Three intents, three sources, one pipeline, one subscribe.\n\t\t//\n\t\t// open$ — a plain click/Enter/Space on the trigger region. No\n\t\t// preventDefault/stopPropagation: a slotted button's own\n\t\t// click still fires; it merely also bubbles to \"open\".\n\t\t// drag$ — pointerdown on the boat-owned drag-handle wrapper. A\n\t\t// dedicated region, so every pointerdown there is a drag\n\t\t// intent — no element-type sniffing. A session ends on\n\t\t// pointerup/cancel; settle = move past threshold ? snap to\n\t\t// the nearest corner : treat as a tap and open.\n\t\tmerge(\n\t\t\tfromEvent<MouseEvent>(trigger, 'click').pipe(tap(() => this.toggle())),\n\t\t\tfromEvent<KeyboardEvent>(trigger, 'keydown').pipe(\n\t\t\t\tfilter(e => e.key === 'Enter' || e.key === ' '),\n\t\t\t\ttap(e => {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\tthis.toggle()\n\t\t\t\t}),\n\t\t\t),\n\t\t\tfromEvent<PointerEvent>(handle, 'pointerdown').pipe(\n\t\t\t\tfilter(e => e.button === 0),\n\t\t\t\ttap(e => {\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\t// Capture can throw InvalidStateError if the pointer is\n\t\t\t\t\t// already released (fast tap) — drag still works without it.\n\t\t\t\t\ttry {\n\t\t\t\t\t\thandle.setPointerCapture(e.pointerId)\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// no active pointer to capture; ignore\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\texhaustMap(down => {\n\t\t\t\t\tconst rect = container.getBoundingClientRect()\n\t\t\t\t\tconst offsetX = down.clientX - rect.left\n\t\t\t\t\tconst offsetY = down.clientY - rect.top\n\t\t\t\t\tlet moved = false\n\t\t\t\t\tconst sameId = (e: PointerEvent) => e.pointerId === down.pointerId\n\t\t\t\t\tconst end$ = merge(\n\t\t\t\t\t\tfromEvent<PointerEvent>(window, 'pointerup'),\n\t\t\t\t\t\tfromEvent<PointerEvent>(window, 'pointercancel'),\n\t\t\t\t\t).pipe(filter(sameId))\n\n\t\t\t\t\treturn fromEvent<PointerEvent>(window, 'pointermove').pipe(\n\t\t\t\t\t\tfilter(sameId),\n\t\t\t\t\t\ttap(e => {\n\t\t\t\t\t\t\tconst dx = e.clientX - down.clientX\n\t\t\t\t\t\t\tconst dy = e.clientY - down.clientY\n\t\t\t\t\t\t\tif (!moved && Math.sqrt(dx * dx + dy * dy) > DRAG_THRESHOLD) {\n\t\t\t\t\t\t\t\tmoved = true\n\t\t\t\t\t\t\t\tthis.isDragging = true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!moved) return\n\t\t\t\t\t\t\tconst vw = window.innerWidth\n\t\t\t\t\t\t\tconst vh = window.innerHeight\n\t\t\t\t\t\t\tconst left = Math.max(0, Math.min(e.clientX - offsetX, vw - rect.width))\n\t\t\t\t\t\t\tconst top = Math.max(0, Math.min(e.clientY - offsetY, vh - rect.height))\n\t\t\t\t\t\t\tthis.position = {\n\t\t\t\t\t\t\t\tx: this.currentCorner.includes('right') ? vw - left - rect.width : left,\n\t\t\t\t\t\t\t\ty: this.currentCorner.includes('bottom') ? vh - top - rect.height : top,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.applyContainerPosition()\n\t\t\t\t\t\t}),\n\t\t\t\t\t\ttakeUntil(end$),\n\t\t\t\t\t\tfinalize(() => {\n\t\t\t\t\t\t\tif (moved) this.reorientToNearestCorner()\n\t\t\t\t\t\t\telse this.toggle()\n\t\t\t\t\t\t\tthis.isDragging = false\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t),\n\t\t)\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe()\n\n\t\tthis.#ready = true\n\t\tif (this.open) this.openOverlay()\n\t}\n\n\tprotected willUpdate(changed: PropertyValues<this>) {\n\t\tif (!this.#ready || !changed.has('open')) return\n\t\tif (this.open && !this.#sub) this.openOverlay()\n\t\telse if (!this.open && this.#sub) this.#sub.unsubscribe()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.currentAnimation?.cancel()\n\t\tthis.#sub?.unsubscribe()\n\t}\n\n\t// ============================================\n\t// PUBLIC API\n\t// ============================================\n\n\t/** Flip open ↔ closed. */\n\ttoggle() {\n\t\tthis.open = !this.open\n\t}\n\n\t// ============================================\n\t// RENDER\n\t// ============================================\n\n\tprivate onHandleSlotChange = () => {\n\t\tthis.hasHandle = this.handleNodes.length > 0\n\t}\n\n\tprotected render(): unknown {\n\t\tconst containerClasses = classMap({\n\t\t\t'inline-flex': true,\n\t\t\t'transition-opacity': true,\n\t\t\t'duration-200': true,\n\t\t\t'opacity-85': this.isDragging,\n\t\t\t'scale-95': this.isDragging,\n\t\t})\n\n\t\tconst containerStyles = styleMap({\n\t\t\tposition: 'fixed',\n\t\t\t'pointer-events': 'auto',\n\t\t})\n\n\t\t// Boat-owned drag region — wraps ONLY the drag-handle slot, so every\n\t\t// pointerdown inside it is unambiguously a drag intent. Hidden (and\n\t\t// out of layout) when the consumer slots no handle: the boat is then\n\t\t// simply not draggable.\n\t\tconst handleClasses = classMap({\n\t\t\tflex: true,\n\t\t\t'items-center': true,\n\t\t\t'touch-none': true,\n\t\t\t'select-none': true,\n\t\t\thidden: !this.hasHandle,\n\t\t\t'cursor-grabbing': this.isDragging,\n\t\t\t'cursor-grab': !this.isDragging,\n\t\t})\n\n\t\treturn html`\n\t\t\t<schmancy-surface\n\t\t\t\t${ref(this.containerRef)}\n\t\t\t\ttype=\"glass\"\n\t\t\t\trounded=\"all\"\n\t\t\t\t.elevation=${3}\n\t\t\t\tclass=\"${containerClasses} overflow-hidden rounded-2xl\"\n\t\t\t\tstyle=${containerStyles}\n\t\t\t\taria-expanded=${this.open}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\t${ref(this.handleRef)}\n\t\t\t\t\tclass=${handleClasses}\n\t\t\t\t\taria-label=\"Drag to move\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"drag-handle\" @slotchange=${this.onHandleSlotChange}></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<div\n\t\t\t\t\t${ref(this.triggerRef)}\n\t\t\t\t\tclass=\"flex items-center cursor-pointer\"\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\taria-label=\"Open panel\"\n\t\t\t\t\ttitle=\"Click to open\"\n\t\t\t\t>\n\t\t\t\t\t<slot name=\"trigger\"></slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- Default-slot content parks here (hidden) while collapsed;\n\t\t\t\t relocated into the show() overlay on open. -->\n\t\t\t\t<div hidden><slot></slot></div>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-boat': SchmancyBoat\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IACM,IAA8B,kBA8BrB,IAAA,cAA2B,E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