@mhmo91/schmancy 0.2.85 → 0.2.87
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/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-DzIUvkYN.cjs → checkbox-CC0UeBQR.cjs} +2 -2
- package/dist/{checkbox-DzIUvkYN.cjs.map → checkbox-CC0UeBQR.cjs.map} +1 -1
- package/dist/{checkbox-bDNd_3dy.js → checkbox-CwxyfGAd.js} +2 -2
- package/dist/{checkbox-bDNd_3dy.js.map → checkbox-CwxyfGAd.js.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{date-range-CtF2mjKx.cjs → date-range-DBxAQrWq.cjs} +6 -6
- package/dist/date-range-DBxAQrWq.cjs.map +1 -0
- package/dist/{date-range-D9SSEemd.js → date-range-eiBhfMFP.js} +18 -17
- package/dist/date-range-eiBhfMFP.js.map +1 -0
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +44 -43
- package/dist/{input-CXj30kcz.cjs → input-C-eFwjHu.cjs} +11 -11
- package/dist/{input-CXj30kcz.cjs.map → input-C-eFwjHu.cjs.map} +1 -1
- package/dist/{input-DQo_jcQh.js → input-DZ2KhA3T.js} +24 -24
- package/dist/{input-DQo_jcQh.js.map → input-DZ2KhA3T.js.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list-BfuHqQMi.cjs +17 -0
- package/dist/list-BfuHqQMi.cjs.map +1 -0
- package/dist/{list-C9s_UTGh.js → list-CjdF2WAc.js} +24 -31
- package/dist/list-CjdF2WAc.js.map +1 -0
- package/dist/list.cjs +1 -1
- package/dist/list.js +4 -3
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/{sheet-PgbfqWGo.cjs → sheet-CONpdXIq.cjs} +7 -7
- package/dist/{sheet-PgbfqWGo.cjs.map → sheet-CONpdXIq.cjs.map} +1 -1
- package/dist/{sheet-DI6i9VtX.js → sheet-D_cWUJsR.js} +14 -14
- package/dist/{sheet-DI6i9VtX.js.map → sheet-D_cWUJsR.js.map} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/surface-BHP347Uc.cjs +26 -0
- package/dist/surface-BHP347Uc.cjs.map +1 -0
- package/dist/{surface-DkGerfbU.js → surface-Bxn0eKDp.js} +15 -9
- package/dist/surface-Bxn0eKDp.js.map +1 -0
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-CEgJ1UMu.cjs → teleport.component-CV4IxBHf.cjs} +2 -2
- package/dist/{teleport.component-CEgJ1UMu.cjs.map → teleport.component-CV4IxBHf.cjs.map} +1 -1
- package/dist/{teleport.component-BDwKenAE.js → teleport.component-Drhw54K1.js} +7 -7
- package/dist/{teleport.component-BDwKenAE.js.map → teleport.component-Drhw54K1.js.map} +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/types/src/date-range/date-range.d.ts +4 -8
- package/types/src/list/index.d.ts +1 -0
- package/types/src/list/list-v2.d.ts +61 -0
- package/types/src/list/list.d.ts +6 -5
- package/types/src/surface/surface.d.ts +9 -1
- package/dist/date-range-CtF2mjKx.cjs.map +0 -1
- package/dist/date-range-D9SSEemd.js.map +0 -1
- package/dist/list-C9s_UTGh.js.map +0 -1
- package/dist/list-pIDcGS1c.cjs +0 -25
- package/dist/list-pIDcGS1c.cjs.map +0 -1
- package/dist/surface-BbkSDH8N.cjs +0 -20
- package/dist/surface-BbkSDH8N.cjs.map +0 -1
- package/dist/surface-DkGerfbU.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const w=require("./tailwind.mixin-CJgIYh7g.cjs"),g=require("lit"),r=require("lit/decorators.js"),E=require("./litElement.mixin-RgeLRf4d.cjs");var S=Object.defineProperty,k=Object.getOwnPropertyDescriptor,
|
|
1
|
+
"use strict";const s=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const w=require("./tailwind.mixin-CJgIYh7g.cjs"),g=require("lit"),r=require("lit/decorators.js"),E=require("./litElement.mixin-RgeLRf4d.cjs");var S=Object.defineProperty,k=Object.getOwnPropertyDescriptor,f=(t,e,i,o)=>{for(var c,n=o>1?void 0:o?k(e,i):e,l=t.length-1;l>=0;l--)(c=t[l])&&(n=(o?c(e,i,n):c(n))||n);return o&&n&&S(e,i,n),n};let v=class extends w.TailwindElement(){render(){const t={absolute:this.title.length===0,relative:this.title.length>0};return g.html`
|
|
2
2
|
<schmancy-surface fill="width" elevation="1">
|
|
3
3
|
<schmancy-grid class="${this.classMap(t)}" align="center" justify="stretch" cols="auto 1fr auto">
|
|
4
4
|
<slot name="back">
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
</slot>
|
|
19
19
|
</schmancy-grid>
|
|
20
20
|
</schmancy-surface>
|
|
21
|
-
`}};
|
|
21
|
+
`}};f([r.property()],v.prototype,"title",2),v=f([r.customElement("schmancy-sheet-header")],v);var b=(t=>(t.Side="side",t.Bottom="bottom",t.BottomCenter="bottom-center",t.TopRight="top-right",t.BottomRight="bottom-right",t))(b||{});const m="are-you-there-sheet",y="yes-here",u=new class{constructor(){this.bottomSheet=new s.Subject,this.$dismiss=new s.Subject,this.bottomSheet.pipe(s.switchMap(t=>s.forkJoin([s.fromEvent(window,y).pipe(s.takeUntil(s.timer(0)),s.map(e=>e.detail.sheet),s.defaultIfEmpty(void 0)),s.of(t).pipe(s.tap(()=>{window.dispatchEvent(new CustomEvent(m,{detail:{uid:t.uid??t.component.tagName}}))}))])),s.map(([t,e])=>{t||(t=document.createElement("schmancy-sheet"),document.body.appendChild(t)),t.setAttribute("uid",e.uid??e.component.tagName);const i=e.position||(window.innerWidth>=768?"side":"bottom");return t.setAttribute("position",i),t.setAttribute("allowOverlyDismiss",e.allowOverlyDismiss===!1?"false":"true"),e.title&&t.setAttribute("title",e.title),e.persist&&t.setAttribute("persist",e.persist??!1),e.header&&t.setAttribute("header",e.header),document.body.style.overflow="hidden",{target:e,sheet:t}}),s.delay(20),s.filter(({target:t,sheet:e})=>{var i,o;return!t.persist||!((o=(i=e==null?void 0:e.shadowRoot)==null?void 0:i.querySelector("slot"))!=null&&o.assignedElements().find(c=>c.tagName===t.component.tagName))||(e==null||e.setAttribute("open","true"),!1)}),s.tap(({target:t,sheet:e})=>{e==null||e.appendChild(t.component)}),s.delay(1),s.tap(({sheet:t})=>{t==null||t.setAttribute("open","true")}),s.tap(({sheet:t})=>{s.fromEvent(t,"close").pipe(s.take(1)).pipe(s.delay(300)).subscribe(e=>{const i=e.target;i!=null&&i.persist||(i==null||i.remove()),document.body.style.overflow="auto"})})).subscribe(),this.$dismiss.pipe(s.mergeMap(t=>s.forkJoin([s.fromEvent(window,y).pipe(s.takeUntil(s.timer(100)),s.map(e=>e.detail.sheet),s.defaultIfEmpty(void 0)),s.of(t).pipe(s.tap(()=>{window.dispatchEvent(new CustomEvent(m,{detail:{uid:t}}))}))])),s.tap(([t])=>{t==null||t.closeSheet()})).subscribe()}dismiss(t){this.$dismiss.next(t)}open(t){this.bottomSheet.next(t)}};var x=Object.defineProperty,C=Object.getOwnPropertyDescriptor,h=(t,e,i,o)=>{for(var c,n=o>1?void 0:o?C(e,i):e,l=t.length-1;l>=0;l--)(c=t[l])&&(n=(o?c(e,i,n):c(n))||n);return o&&n&&x(e,i,n),n};let a=class extends E.$LitElement(":host{--overlay-color: var(--schmancy-sys-color-surface-dim);--transition-duration: .2s;--sheet-radius: 0;--max-height: 100vh}.sheet{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;display:flex;visibility:visible;transition:visibility var(--transition-duration) ease-in-out}.sheet[aria-hidden=true]{visibility:hidden;pointer-events:none}.sheet[aria-hidden=true] .content{transform:translateY(100%)}.sheet[aria-hidden=true] .content[data-position=side]{transform:translate(100%)}.sheet[aria-hidden=true] .overlay{opacity:0}.overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--overlay-color);opacity:.8;transition:opacity var(--transition-duration) ease-in-out}.content{z-index:1;transition:transform var(--transition-duration) ease-in-out;overflow:hidden}.content[data-position=side]{height:100vh;height:100%;min-width:320px;max-width:90vw;width:fit-content;margin-left:auto}.content[data-position=side] #body{max-height:100vh}.content[data-position=bottom]{width:100%;margin-top:auto;border-radius:16px 16px 0 0;max-height:100vh}.content[data-position=bottom] #body{max-height:90vh}"){constructor(){super(...arguments),this.open=!1,this.header="visible",this.position=b.Side,this.persist=!1,this.allowOverlayDismiss=!0,this.title="",this.focusAttribute="autofocus",this.lastFocusedElement=null,this.handleFocusIn=t=>{var e;(e=this.sheet)!=null&&e.contains(t.target)||this.focus()}}onOpenChange(t,e){var i;e?(this.lastFocusedElement=document.activeElement,this.addFocusTrap(),this.focus()):(this.removeFocusTrap(),(i=this.lastFocusedElement)==null||i.focus(),this.lastFocusedElement=null)}connectedCallback(){super.connectedCallback(),this.setupEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.disconnecting.next(!0)}setupEventListeners(){const t=s.fromEvent(window,"popstate").pipe(s.tap(o=>{o.preventDefault(),this.closeSheet()})),e=s.fromEvent(window,"keyup").pipe(s.tap(o=>{o.key!=="Escape"||this.sheetContainsFocus()||u.dismiss(this.uid)})),i=s.fromEvent(window,m).pipe(s.tap(o=>{o.detail.uid===this.uid&&this.announcePresence()}));s.merge(t,e,i).pipe(s.takeUntil(this.disconnecting)).subscribe()}sheetContainsFocus(){var t;return((t=this.sheet)==null?void 0:t.contains(document.activeElement))??!1}announcePresence(){this.dispatchEvent(new CustomEvent(y,{detail:{sheet:this},bubbles:!0,composed:!0}))}addFocusTrap(){document.addEventListener("focusin",this.handleFocusIn)}removeFocusTrap(){document.removeEventListener("focusin",this.handleFocusIn)}setIsSheetShown(t){var e,i;(e=this.sheet)==null||e.setAttribute("aria-hidden",String(!t)),(i=this.sheet)==null||i.setAttribute("aria-modal",String(t))}closeSheet(){this.open=!1,this.dispatchEvent(new CustomEvent("close"))}getFocusElement(){const t=`[${this.focusAttribute}]`;return this.assignedElements.find(e=>e.matches(t)||e.querySelector(t))??null}focus(){var t;(t=this.getFocusElement())==null||t.focus()}render(){return g.html`
|
|
22
22
|
<div class="sheet" role="dialog" aria-labelledby="sheet-title" aria-hidden=${!this.open} aria-modal=${this.open}>
|
|
23
23
|
<div
|
|
24
24
|
class="overlay"
|
|
25
25
|
@click=${t=>{t.stopPropagation(),this.allowOverlayDismiss&&u.dismiss(this.uid)}}
|
|
26
26
|
></div>
|
|
27
|
-
<
|
|
27
|
+
<schmancy-grid rows="auto 1fr" class="content w-full" data-position=${this.position}>
|
|
28
28
|
<schmancy-sheet-header
|
|
29
29
|
class="sticky top-0 z-50 w-full"
|
|
30
30
|
@dismiss=${t=>{t.stopPropagation(),u.dismiss(this.uid)}}
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
.hidden=${this.header==="hidden"}
|
|
33
33
|
title=${this.title}
|
|
34
34
|
></schmancy-sheet-header>
|
|
35
|
-
<schmancy-surface class="overflow-auto"
|
|
35
|
+
<schmancy-surface rounded="left" scroller id="body" class="overflow-auto" type="surface">
|
|
36
36
|
<slot></slot>
|
|
37
37
|
</schmancy-surface>
|
|
38
|
-
</
|
|
38
|
+
</schmancy-grid>
|
|
39
39
|
</div>
|
|
40
|
-
`}};var d
|
|
41
|
-
//# sourceMappingURL=sheet-
|
|
40
|
+
`}};var p,d;h([r.property({type:String,reflect:!0})],a.prototype,"uid",2),h([r.property({type:Boolean,reflect:!0})],a.prototype,"open",2),h([r.property({type:String,reflect:!0})],a.prototype,"header",2),h([r.property({type:String,reflect:!0})],a.prototype,"position",2),h([r.property({type:Boolean,reflect:!0})],a.prototype,"persist",2),h([r.property({type:Boolean,reflect:!0})],a.prototype,"allowOverlayDismiss",2),h([r.property({type:String,reflect:!0})],a.prototype,"title",2),h([r.query(".sheet")],a.prototype,"sheet",2),h([r.queryAssignedElements({flatten:!0})],a.prototype,"assignedElements",2),h([r.property()],a.prototype,"focusAttribute",2),h([(p="open",(t,e)=>{const{willUpdate:i}=t;d=Object.assign({waitUntilFirstUpdate:!1},d),t.willUpdate=function(o){if(i.call(this,o),o.has(p)){const c=o.get(p),n=this[p];c!==n&&(d!=null&&d.waitUntilFirstUpdate&&!this.hasUpdated||this[e].call(this,c,n))}}})],a.prototype,"onOpenChange",1),a=h([r.customElement("schmancy-sheet")],a),exports.SchmancySheetPosition=b,exports.SheetHereMorty=y,exports.SheetWhereAreYouRicky=m,exports.sheet=u;
|
|
41
|
+
//# sourceMappingURL=sheet-CONpdXIq.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-PgbfqWGo.cjs","sources":["../src/sheet/header.ts","../src/sheet/sheet.service.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement() {\n\t@property() title: string\n\trender() {\n\t\tconst classes = {\n\t\t\tabsolute: this.title.length === 0,\n\t\t\trelative: this.title.length > 0,\n\t\t}\n\t\treturn html`\n\t\t\t<schmancy-surface fill=\"width\" elevation=\"1\">\n\t\t\t\t<schmancy-grid class=\"${this.classMap(classes)}\" align=\"center\" justify=\"stretch\" cols=\"auto 1fr auto\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t\t<schmancy-typography transform=\"capitalize\" type=\"headline\" token=\"lg\"> ${this.title} </schmancy-typography>\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</schmancy-grid>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import {\n\tdefaultIfEmpty,\n\tdelay,\n\tfilter,\n\tforkJoin,\n\tfromEvent,\n\tmap,\n\tmergeMap,\n\tof,\n\tSubject,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimer,\n} from 'rxjs'\nimport SchmancySheet from './sheet'\n\nexport enum SchmancySheetPosition {\n\tSide = 'side',\n\tBottom = 'bottom',\n\t/**\n\t * @deprecated use bottom instead\n\t */\n\tBottomCenter = 'bottom-center',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tTopRight = 'top-right',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tBottomRight = 'bottom-right',\n}\n\ntype BottomSheeetTarget = {\n\tcomponent: HTMLElement\n\tuid?: string\n\tposition?: SchmancySheetPosition\n\tpersist?: boolean\n\tclose?: () => void\n\tallowOverlyDismiss?: boolean\n\ttitle?: string\n\theader?: 'hidden' | 'visible'\n}\n\n// Events for communication between bottom-sheet component and bottom-sheet.service\nexport type SheetWhereAreYouRickyEvent = CustomEvent<{\n\tuid: string\n}>\nexport const SheetWhereAreYouRicky = 'are-you-there-sheet'\n\nexport type SheetHereMortyEvent = CustomEvent<{\n\tsheet: SchmancySheet\n}>\nexport const SheetHereMorty = 'yes-here'\n\n// Function to determine the position based on screen size\nconst getPosition = (): SchmancySheetPosition => {\n\treturn window.innerWidth >= 768 ? SchmancySheetPosition.Side : SchmancySheetPosition.Bottom // Adjust 768 as needed for your breakpoint\n}\n\nclass BottomSheetService {\n\tbottomSheet = new Subject<BottomSheeetTarget>()\n\t$dismiss = new Subject<string>()\n\tconstructor() {\n\t\tthis.bottomSheet\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(0)),\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(SheetWhereAreYouRicky, {\n\t\t\t\t\t\t\t\t\t\tdetail: { uid: target.uid ?? target.component.tagName },\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tmap(([sheet, target]) => {\n\t\t\t\t\tconsole.log(sheet, target)\n\t\t\t\t\tif (!sheet) {\n\t\t\t\t\t\t// if sheet is not found, create it\n\t\t\t\t\t\tsheet = document.createElement('schmancy-sheet')\n\t\t\t\t\t\tdocument.body.appendChild(sheet)\n\t\t\t\t\t}\n\t\t\t\t\tsheet.setAttribute('uid', target.uid ?? target.component.tagName)\n\n\t\t\t\t\t// **Use the dynamic position function here**\n\t\t\t\t\tconst position = target.position || getPosition() // Use target.position if it's set, otherwise determine based on screen size\n\t\t\t\t\tsheet.setAttribute('position', position)\n\n\t\t\t\t\tsheet.setAttribute('allowOverlyDismiss', target.allowOverlyDismiss === false ? 'false' : 'true')\n\t\t\t\t\ttarget.title && sheet.setAttribute('title', target.title)\n\t\t\t\t\ttarget.persist && sheet.setAttribute('persist', target.persist ?? false)\n\t\t\t\t\ttarget.header && sheet.setAttribute('header', target.header)\n\t\t\t\t\tdocument.body.style.overflow = 'hidden' // lock the scroll of the host\n\t\t\t\t\treturn { target, sheet }\n\t\t\t\t}),\n\t\t\t\tdelay(20),\n\t\t\t\tfilter(({ target, sheet }) => {\n\t\t\t\t\t// if the sheet has already the component, just show it\n\t\t\t\t\tif (\n\t\t\t\t\t\ttarget.persist &&\n\t\t\t\t\t\tsheet?.shadowRoot\n\t\t\t\t\t\t\t?.querySelector('slot')\n\t\t\t\t\t\t\t?.assignedElements()\n\t\t\t\t\t\t\t.find(e => e.tagName === target.component.tagName)\n\t\t\t\t\t) {\n\t\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t\t\treturn false\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn true // if the sheet does not have the component, continue to the next step\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttap(({ target, sheet }) => {\n\t\t\t\t\tsheet?.appendChild(target.component)\n\t\t\t\t}),\n\t\t\t\tdelay(1),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t}),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tfromEvent<CustomEvent>(sheet, 'close')\n\t\t\t\t\t\t.pipe(take(1))\n\t\t\t\t\t\t.pipe(delay(300))\n\t\t\t\t\t\t.subscribe(e => {\n\t\t\t\t\t\t\tconst target = e.target as SchmancySheet\n\t\t\t\t\t\t\tconsole.log(target)\n\n\t\t\t\t\t\t\tif (!target?.persist) target?.remove()\n\t\t\t\t\t\t\tdocument.body.style.overflow = 'auto' // unlock the scroll of the host\n\t\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\n\t\tthis.$dismiss\n\t\t\t.pipe(\n\t\t\t\tmergeMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(100)), // Some people say why 10? I say why not?\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(uid).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(SheetWhereAreYouRicky, { detail: { uid } }))\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([sheet]) => {\n\t\t\t\t\tsheet?.closeSheet()\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\tdismiss(uid: string) {\n\t\tthis.$dismiss.next(uid)\n\t}\n\n\topen(target: BottomSheeetTarget) {\n\t\tthis.bottomSheet.next(target)\n\t}\n}\nexport const sheet = new BottomSheetService()\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil, tap } from 'rxjs'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\nimport { on } from './hook'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) allowOverlayDismiss = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button\n\t\tconst popState$ = fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\ttap(e => {\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.closeSheet()\n\t\t\t}),\n\t\t)\n\n\t\t// Handle ESC key\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus()) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (this.allowOverlayDismiss) sheet.dismiss(this.uid)\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<section class=\"content w-full\" data-position=${this.position}>\n\t\t\t\t\t<schmancy-sheet-header\n\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t.hidden=${this.header === 'hidden'}\n\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t></schmancy-sheet-header>\n\t\t\t\t\t<schmancy-surface class=\"overflow-auto\" fill=\"all\" type=\"surface\">\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</section>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","classes","absolute","this","title","length","relative","html","classMap","dispatchEvent","CustomEvent","bubbles","composed","__decorateClass","property","prototype","customElement","SchmancySheetPosition","SheetWhereAreYouRicky","SheetHereMorty","sheet","constructor","bottomSheet","Subject","$dismiss","pipe","switchMap","forkJoin","fromEvent","window","takeUntil","timer","map","e","detail","defaultIfEmpty","of","target","tap","uid","component","tagName","document","createElement","body","appendChild","setAttribute","position","innerWidth","allowOverlyDismiss","persist","header","style","overflow","delay","filter","shadowRoot","querySelector","assignedElements","find","take","subscribe","remove","mergeMap","closeSheet","next","SchmancySheet","$LitElement","super","arguments","open","Side","allowOverlayDismiss","focusAttribute","lastFocusedElement","handleFocusIn","contains","focus","_oldValue","newValue","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","popState$","preventDefault","keyUp$","event","key","sheetContainsFocus","dismiss","rickyComm$","announcePresence","merge","addEventListener","removeEventListener","isShown","String","selector","el","matches","getFocusElement","stopPropagation","propName","options","type","reflect","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":"icAKA,IAAqBA,EAArB,cAAiDC,EAAAA,gBAAAA,CAAAA,CAEhD,QACC,CAAA,MAAMC,EAAU,CACfC,SAAUC,KAAKC,MAAMC,SAAW,EAChCC,SAAUH,KAAKC,MAAMC,OAAS,CAAA,EAExB,OAAAE,EAAAA;AAAAA;AAAAA,4BAEmBJ,KAAKK,SAASP,CAAAA,CAAAA;AAAAA;AAAAA;AAAAA,gBAG1B,IACHE,CAA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B3B,EAAW5E,KAAKuG,GAElBiB,IAAa5C,IACX4B,GAAAA,MAAAA,EAASY,sBAAwBpH,CAAAA,KAAK0H,YAC1C1H,KAAKgH,CAAAA,EAAMM,KAAKtH,KAAMwH,EAAU5C,CAAAA,EAElC,CAEF,CAAA,EAAA,EDtBmBb,EAgBpBnD,UAAA,eAAA,GAhBoBmD,EAArBrD,EAAA,CADCG,EAAAA,cAAc,gBAAA,CAAA,EACMkD"}
|
|
1
|
+
{"version":3,"file":"sheet-CONpdXIq.cjs","sources":["../src/sheet/header.ts","../src/sheet/sheet.service.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement() {\n\t@property() title: string\n\trender() {\n\t\tconst classes = {\n\t\t\tabsolute: this.title.length === 0,\n\t\t\trelative: this.title.length > 0,\n\t\t}\n\t\treturn html`\n\t\t\t<schmancy-surface fill=\"width\" elevation=\"1\">\n\t\t\t\t<schmancy-grid class=\"${this.classMap(classes)}\" align=\"center\" justify=\"stretch\" cols=\"auto 1fr auto\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t\t<schmancy-typography transform=\"capitalize\" type=\"headline\" token=\"lg\"> ${this.title} </schmancy-typography>\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</schmancy-grid>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import {\n\tdefaultIfEmpty,\n\tdelay,\n\tfilter,\n\tforkJoin,\n\tfromEvent,\n\tmap,\n\tmergeMap,\n\tof,\n\tSubject,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimer,\n} from 'rxjs'\nimport SchmancySheet from './sheet'\n\nexport enum SchmancySheetPosition {\n\tSide = 'side',\n\tBottom = 'bottom',\n\t/**\n\t * @deprecated use bottom instead\n\t */\n\tBottomCenter = 'bottom-center',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tTopRight = 'top-right',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tBottomRight = 'bottom-right',\n}\n\ntype BottomSheeetTarget = {\n\tcomponent: HTMLElement\n\tuid?: string\n\tposition?: SchmancySheetPosition\n\tpersist?: boolean\n\tclose?: () => void\n\tallowOverlyDismiss?: boolean\n\ttitle?: string\n\theader?: 'hidden' | 'visible'\n}\n\n// Events for communication between bottom-sheet component and bottom-sheet.service\nexport type SheetWhereAreYouRickyEvent = CustomEvent<{\n\tuid: string\n}>\nexport const SheetWhereAreYouRicky = 'are-you-there-sheet'\n\nexport type SheetHereMortyEvent = CustomEvent<{\n\tsheet: SchmancySheet\n}>\nexport const SheetHereMorty = 'yes-here'\n\n// Function to determine the position based on screen size\nconst getPosition = (): SchmancySheetPosition => {\n\treturn window.innerWidth >= 768 ? SchmancySheetPosition.Side : SchmancySheetPosition.Bottom // Adjust 768 as needed for your breakpoint\n}\n\nclass BottomSheetService {\n\tbottomSheet = new Subject<BottomSheeetTarget>()\n\t$dismiss = new Subject<string>()\n\tconstructor() {\n\t\tthis.bottomSheet\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(0)),\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(SheetWhereAreYouRicky, {\n\t\t\t\t\t\t\t\t\t\tdetail: { uid: target.uid ?? target.component.tagName },\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tmap(([sheet, target]) => {\n\t\t\t\t\tconsole.log(sheet, target)\n\t\t\t\t\tif (!sheet) {\n\t\t\t\t\t\t// if sheet is not found, create it\n\t\t\t\t\t\tsheet = document.createElement('schmancy-sheet')\n\t\t\t\t\t\tdocument.body.appendChild(sheet)\n\t\t\t\t\t}\n\t\t\t\t\tsheet.setAttribute('uid', target.uid ?? target.component.tagName)\n\n\t\t\t\t\t// **Use the dynamic position function here**\n\t\t\t\t\tconst position = target.position || getPosition() // Use target.position if it's set, otherwise determine based on screen size\n\t\t\t\t\tsheet.setAttribute('position', position)\n\n\t\t\t\t\tsheet.setAttribute('allowOverlyDismiss', target.allowOverlyDismiss === false ? 'false' : 'true')\n\t\t\t\t\ttarget.title && sheet.setAttribute('title', target.title)\n\t\t\t\t\ttarget.persist && sheet.setAttribute('persist', target.persist ?? false)\n\t\t\t\t\ttarget.header && sheet.setAttribute('header', target.header)\n\t\t\t\t\tdocument.body.style.overflow = 'hidden' // lock the scroll of the host\n\t\t\t\t\treturn { target, sheet }\n\t\t\t\t}),\n\t\t\t\tdelay(20),\n\t\t\t\tfilter(({ target, sheet }) => {\n\t\t\t\t\t// if the sheet has already the component, just show it\n\t\t\t\t\tif (\n\t\t\t\t\t\ttarget.persist &&\n\t\t\t\t\t\tsheet?.shadowRoot\n\t\t\t\t\t\t\t?.querySelector('slot')\n\t\t\t\t\t\t\t?.assignedElements()\n\t\t\t\t\t\t\t.find(e => e.tagName === target.component.tagName)\n\t\t\t\t\t) {\n\t\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t\t\treturn false\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn true // if the sheet does not have the component, continue to the next step\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttap(({ target, sheet }) => {\n\t\t\t\t\tsheet?.appendChild(target.component)\n\t\t\t\t}),\n\t\t\t\tdelay(1),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t}),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tfromEvent<CustomEvent>(sheet, 'close')\n\t\t\t\t\t\t.pipe(take(1))\n\t\t\t\t\t\t.pipe(delay(300))\n\t\t\t\t\t\t.subscribe(e => {\n\t\t\t\t\t\t\tconst target = e.target as SchmancySheet\n\t\t\t\t\t\t\tconsole.log(target)\n\n\t\t\t\t\t\t\tif (!target?.persist) target?.remove()\n\t\t\t\t\t\t\tdocument.body.style.overflow = 'auto' // unlock the scroll of the host\n\t\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\n\t\tthis.$dismiss\n\t\t\t.pipe(\n\t\t\t\tmergeMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(100)), // Some people say why 10? I say why not?\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(uid).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(SheetWhereAreYouRicky, { detail: { uid } }))\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([sheet]) => {\n\t\t\t\t\tsheet?.closeSheet()\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\tdismiss(uid: string) {\n\t\tthis.$dismiss.next(uid)\n\t}\n\n\topen(target: BottomSheeetTarget) {\n\t\tthis.bottomSheet.next(target)\n\t}\n}\nexport const sheet = new BottomSheetService()\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) allowOverlayDismiss = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button\n\t\tconst popState$ = fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\ttap(e => {\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.closeSheet()\n\t\t\t}),\n\t\t)\n\n\t\t// Handle ESC key\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus()) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (this.allowOverlayDismiss) sheet.dismiss(this.uid)\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid rows=\"auto 1fr\" class=\"content w-full\" data-position=${this.position}>\n\t\t\t\t\t<schmancy-sheet-header\n\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t.hidden=${this.header === 'hidden'}\n\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t></schmancy-sheet-header>\n\t\t\t\t\t<schmancy-surface rounded=\"left\" scroller id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","classes","absolute","this","title","length","relative","html","classMap","dispatchEvent","CustomEvent","bubbles","composed","__decorateClass","property","prototype","customElement","SchmancySheetPosition","SheetWhereAreYouRicky","SheetHereMorty","sheet","constructor","bottomSheet","Subject","$dismiss","pipe","switchMap","forkJoin","fromEvent","window","takeUntil","timer","map","e","detail","defaultIfEmpty","of","target","tap","uid","component","tagName","document","createElement","body","appendChild","setAttribute","position","innerWidth","allowOverlyDismiss","persist","header","style","overflow","delay","filter","shadowRoot","querySelector","assignedElements","find","take","subscribe","remove","mergeMap","closeSheet","next","SchmancySheet","$LitElement","super","arguments","open","Side","allowOverlayDismiss","focusAttribute","lastFocusedElement","handleFocusIn","contains","focus","_oldValue","newValue","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","popState$","preventDefault","keyUp$","event","key","sheetContainsFocus","dismiss","rickyComm$","announcePresence","merge","addEventListener","removeEventListener","isShown","String","selector","el","matches","getFocusElement","stopPropagation","propName","options","type","reflect","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":"icAKA,IAAqBA,EAArB,cAAiDC,EAAAA,gBAAAA,CAAAA,CAEhD,QACC,CAAA,MAAMC,EAAU,CACfC,SAAUC,KAAKC,MAAMC,SAAW,EAChCC,SAAUH,KAAKC,MAAMC,OAAS,CAAA,EAExB,OAAAE,EAAAA;AAAAA;AAAAA,4BAEmBJ,KAAKK,SAASP,CAAAA,CAAAA;AAAAA;AAAAA;AAAAA,gBAG1B,IACHE,CAAAA,KAAAM,cACJ,IAAIC,YAAY,UAAW,CAC1BC,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+EAMuET,KAAKC,KAAAA;AAAAA;AAAAA;AAAAA,gBAGpE,IACHD,CAAAA,KAAAM,cACJ,IAAIC,YAA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A,GAhBoBmD,EAArBrD,EAAA,CADCG,EAAAA,cAAc,gBAAA,CAAA,EACMkD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Subject as E, switchMap as D, forkJoin as x, fromEvent as
|
|
1
|
+
import { Subject as E, switchMap as D, forkJoin as x, fromEvent as l, of as S, takeUntil as f, timer as C, map as m, defaultIfEmpty as F, tap as h, delay as y, filter as U, take as j, mergeMap as P, merge as B } from "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
4
|
import { T } from "./tailwind.mixin-D4STgS5j.js";
|
|
@@ -6,7 +6,7 @@ import { html as $ } from "lit";
|
|
|
6
6
|
import { property as c, customElement as O, query as z, queryAssignedElements as I } from "lit/decorators.js";
|
|
7
7
|
import { $ as q } from "./litElement.mixin-pfcnUcRO.js";
|
|
8
8
|
var L = Object.defineProperty, N = Object.getOwnPropertyDescriptor, k = (t, e, s, i) => {
|
|
9
|
-
for (var a, o = i > 1 ? void 0 : i ? N(e, s) : e,
|
|
9
|
+
for (var a, o = i > 1 ? void 0 : i ? N(e, s) : e, d = t.length - 1; d >= 0; d--) (a = t[d]) && (o = (i ? a(e, s, o) : a(o)) || o);
|
|
10
10
|
return i && o && L(e, s, o), o;
|
|
11
11
|
};
|
|
12
12
|
let b = class extends T() {
|
|
@@ -43,7 +43,7 @@ k([c()], b.prototype, "title", 2), b = k([O("schmancy-sheet-header")], b);
|
|
|
43
43
|
var A = ((t) => (t.Side = "side", t.Bottom = "bottom", t.BottomCenter = "bottom-center", t.TopRight = "top-right", t.BottomRight = "bottom-right", t))(A || {});
|
|
44
44
|
const g = "are-you-there-sheet", w = "yes-here", v = new class {
|
|
45
45
|
constructor() {
|
|
46
|
-
this.bottomSheet = new E(), this.$dismiss = new E(), this.bottomSheet.pipe(D((t) => x([
|
|
46
|
+
this.bottomSheet = new E(), this.$dismiss = new E(), this.bottomSheet.pipe(D((t) => x([l(window, w).pipe(f(C(0)), m((e) => e.detail.sheet), F(void 0)), S(t).pipe(h(() => {
|
|
47
47
|
window.dispatchEvent(new CustomEvent(g, { detail: { uid: t.uid ?? t.component.tagName } }));
|
|
48
48
|
}))])), m(([t, e]) => {
|
|
49
49
|
t || (t = document.createElement("schmancy-sheet"), document.body.appendChild(t)), t.setAttribute("uid", e.uid ?? e.component.tagName);
|
|
@@ -57,11 +57,11 @@ const g = "are-you-there-sheet", w = "yes-here", v = new class {
|
|
|
57
57
|
}), y(1), h(({ sheet: t }) => {
|
|
58
58
|
t == null || t.setAttribute("open", "true");
|
|
59
59
|
}), h(({ sheet: t }) => {
|
|
60
|
-
|
|
60
|
+
l(t, "close").pipe(j(1)).pipe(y(300)).subscribe((e) => {
|
|
61
61
|
const s = e.target;
|
|
62
62
|
s != null && s.persist || (s == null || s.remove()), document.body.style.overflow = "auto";
|
|
63
63
|
});
|
|
64
|
-
})).subscribe(), this.$dismiss.pipe(P((t) => x([
|
|
64
|
+
})).subscribe(), this.$dismiss.pipe(P((t) => x([l(window, w).pipe(f(C(100)), m((e) => e.detail.sheet), F(void 0)), S(t).pipe(h(() => {
|
|
65
65
|
window.dispatchEvent(new CustomEvent(g, { detail: { uid: t } }));
|
|
66
66
|
}))])), h(([t]) => {
|
|
67
67
|
t == null || t.closeSheet();
|
|
@@ -75,10 +75,10 @@ const g = "are-you-there-sheet", w = "yes-here", v = new class {
|
|
|
75
75
|
}
|
|
76
76
|
}();
|
|
77
77
|
var M = Object.defineProperty, R = Object.getOwnPropertyDescriptor, r = (t, e, s, i) => {
|
|
78
|
-
for (var a, o = i > 1 ? void 0 : i ? R(e, s) : e,
|
|
78
|
+
for (var a, o = i > 1 ? void 0 : i ? R(e, s) : e, d = t.length - 1; d >= 0; d--) (a = t[d]) && (o = (i ? a(e, s, o) : a(o)) || o);
|
|
79
79
|
return i && o && M(e, s, o), o;
|
|
80
80
|
};
|
|
81
|
-
let n = class extends q(":host{--overlay-color: var(--schmancy-sys-color-surface-dim);--transition-duration: .2s;--sheet-radius: 0;--max-height: 100vh}.sheet{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;display:flex;visibility:visible;transition:visibility var(--transition-duration) ease-in-out}.sheet[aria-hidden=true]{visibility:hidden;pointer-events:none}.sheet[aria-hidden=true] .content{transform:translateY(100%)}.sheet[aria-hidden=true] .content[data-position=side]{transform:translate(100%)}.sheet[aria-hidden=true] .overlay{opacity:0}.overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--overlay-color);opacity:.8;transition:opacity var(--transition-duration) ease-in-out}.content{z-index:1;transition:transform var(--transition-duration) ease-in-out;overflow:hidden}.content[data-position=side]{height:100%;min-width:320px;max-width:90vw;width:fit-content;margin-left:auto}.content[data-position=side]
|
|
81
|
+
let n = class extends q(":host{--overlay-color: var(--schmancy-sys-color-surface-dim);--transition-duration: .2s;--sheet-radius: 0;--max-height: 100vh}.sheet{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;display:flex;visibility:visible;transition:visibility var(--transition-duration) ease-in-out}.sheet[aria-hidden=true]{visibility:hidden;pointer-events:none}.sheet[aria-hidden=true] .content{transform:translateY(100%)}.sheet[aria-hidden=true] .content[data-position=side]{transform:translate(100%)}.sheet[aria-hidden=true] .overlay{opacity:0}.overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--overlay-color);opacity:.8;transition:opacity var(--transition-duration) ease-in-out}.content{z-index:1;transition:transform var(--transition-duration) ease-in-out;overflow:hidden}.content[data-position=side]{height:100vh;height:100%;min-width:320px;max-width:90vw;width:fit-content;margin-left:auto}.content[data-position=side] #body{max-height:100vh}.content[data-position=bottom]{width:100%;margin-top:auto;border-radius:16px 16px 0 0;max-height:100vh}.content[data-position=bottom] #body{max-height:90vh}") {
|
|
82
82
|
constructor() {
|
|
83
83
|
super(...arguments), this.open = !1, this.header = "visible", this.position = A.Side, this.persist = !1, this.allowOverlayDismiss = !0, this.title = "", this.focusAttribute = "autofocus", this.lastFocusedElement = null, this.handleFocusIn = (t) => {
|
|
84
84
|
var e;
|
|
@@ -96,11 +96,11 @@ let n = class extends q(":host{--overlay-color: var(--schmancy-sys-color-surface
|
|
|
96
96
|
super.disconnectedCallback(), this.disconnecting.next(!0);
|
|
97
97
|
}
|
|
98
98
|
setupEventListeners() {
|
|
99
|
-
const t =
|
|
99
|
+
const t = l(window, "popstate").pipe(h((i) => {
|
|
100
100
|
i.preventDefault(), this.closeSheet();
|
|
101
|
-
})), e =
|
|
101
|
+
})), e = l(window, "keyup").pipe(h((i) => {
|
|
102
102
|
i.key !== "Escape" || this.sheetContainsFocus() || v.dismiss(this.uid);
|
|
103
|
-
})), s =
|
|
103
|
+
})), s = l(window, g).pipe(h((i) => {
|
|
104
104
|
i.detail.uid === this.uid && this.announcePresence();
|
|
105
105
|
}));
|
|
106
106
|
B(t, e, s).pipe(f(this.disconnecting)).subscribe();
|
|
@@ -142,7 +142,7 @@ let n = class extends q(":host{--overlay-color: var(--schmancy-sys-color-surface
|
|
|
142
142
|
t.stopPropagation(), this.allowOverlayDismiss && v.dismiss(this.uid);
|
|
143
143
|
}}
|
|
144
144
|
></div>
|
|
145
|
-
<
|
|
145
|
+
<schmancy-grid rows="auto 1fr" class="content w-full" data-position=${this.position}>
|
|
146
146
|
<schmancy-sheet-header
|
|
147
147
|
class="sticky top-0 z-50 w-full"
|
|
148
148
|
@dismiss=${(t) => {
|
|
@@ -152,10 +152,10 @@ let n = class extends q(":host{--overlay-color: var(--schmancy-sys-color-surface
|
|
|
152
152
|
.hidden=${this.header === "hidden"}
|
|
153
153
|
title=${this.title}
|
|
154
154
|
></schmancy-sheet-header>
|
|
155
|
-
<schmancy-surface class="overflow-auto"
|
|
155
|
+
<schmancy-surface rounded="left" scroller id="body" class="overflow-auto" type="surface">
|
|
156
156
|
<slot></slot>
|
|
157
157
|
</schmancy-surface>
|
|
158
|
-
</
|
|
158
|
+
</schmancy-grid>
|
|
159
159
|
</div>
|
|
160
160
|
`;
|
|
161
161
|
}
|
|
@@ -176,4 +176,4 @@ export {
|
|
|
176
176
|
w as b,
|
|
177
177
|
v as s
|
|
178
178
|
};
|
|
179
|
-
//# sourceMappingURL=sheet-
|
|
179
|
+
//# sourceMappingURL=sheet-D_cWUJsR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-DI6i9VtX.js","sources":["../src/sheet/header.ts","../src/sheet/sheet.service.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement() {\n\t@property() title: string\n\trender() {\n\t\tconst classes = {\n\t\t\tabsolute: this.title.length === 0,\n\t\t\trelative: this.title.length > 0,\n\t\t}\n\t\treturn html`\n\t\t\t<schmancy-surface fill=\"width\" elevation=\"1\">\n\t\t\t\t<schmancy-grid class=\"${this.classMap(classes)}\" align=\"center\" justify=\"stretch\" cols=\"auto 1fr auto\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t\t<schmancy-typography transform=\"capitalize\" type=\"headline\" token=\"lg\"> ${this.title} </schmancy-typography>\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</schmancy-grid>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import {\n\tdefaultIfEmpty,\n\tdelay,\n\tfilter,\n\tforkJoin,\n\tfromEvent,\n\tmap,\n\tmergeMap,\n\tof,\n\tSubject,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimer,\n} from 'rxjs'\nimport SchmancySheet from './sheet'\n\nexport enum SchmancySheetPosition {\n\tSide = 'side',\n\tBottom = 'bottom',\n\t/**\n\t * @deprecated use bottom instead\n\t */\n\tBottomCenter = 'bottom-center',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tTopRight = 'top-right',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tBottomRight = 'bottom-right',\n}\n\ntype BottomSheeetTarget = {\n\tcomponent: HTMLElement\n\tuid?: string\n\tposition?: SchmancySheetPosition\n\tpersist?: boolean\n\tclose?: () => void\n\tallowOverlyDismiss?: boolean\n\ttitle?: string\n\theader?: 'hidden' | 'visible'\n}\n\n// Events for communication between bottom-sheet component and bottom-sheet.service\nexport type SheetWhereAreYouRickyEvent = CustomEvent<{\n\tuid: string\n}>\nexport const SheetWhereAreYouRicky = 'are-you-there-sheet'\n\nexport type SheetHereMortyEvent = CustomEvent<{\n\tsheet: SchmancySheet\n}>\nexport const SheetHereMorty = 'yes-here'\n\n// Function to determine the position based on screen size\nconst getPosition = (): SchmancySheetPosition => {\n\treturn window.innerWidth >= 768 ? SchmancySheetPosition.Side : SchmancySheetPosition.Bottom // Adjust 768 as needed for your breakpoint\n}\n\nclass BottomSheetService {\n\tbottomSheet = new Subject<BottomSheeetTarget>()\n\t$dismiss = new Subject<string>()\n\tconstructor() {\n\t\tthis.bottomSheet\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(0)),\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(SheetWhereAreYouRicky, {\n\t\t\t\t\t\t\t\t\t\tdetail: { uid: target.uid ?? target.component.tagName },\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tmap(([sheet, target]) => {\n\t\t\t\t\tconsole.log(sheet, target)\n\t\t\t\t\tif (!sheet) {\n\t\t\t\t\t\t// if sheet is not found, create it\n\t\t\t\t\t\tsheet = document.createElement('schmancy-sheet')\n\t\t\t\t\t\tdocument.body.appendChild(sheet)\n\t\t\t\t\t}\n\t\t\t\t\tsheet.setAttribute('uid', target.uid ?? target.component.tagName)\n\n\t\t\t\t\t// **Use the dynamic position function here**\n\t\t\t\t\tconst position = target.position || getPosition() // Use target.position if it's set, otherwise determine based on screen size\n\t\t\t\t\tsheet.setAttribute('position', position)\n\n\t\t\t\t\tsheet.setAttribute('allowOverlyDismiss', target.allowOverlyDismiss === false ? 'false' : 'true')\n\t\t\t\t\ttarget.title && sheet.setAttribute('title', target.title)\n\t\t\t\t\ttarget.persist && sheet.setAttribute('persist', target.persist ?? false)\n\t\t\t\t\ttarget.header && sheet.setAttribute('header', target.header)\n\t\t\t\t\tdocument.body.style.overflow = 'hidden' // lock the scroll of the host\n\t\t\t\t\treturn { target, sheet }\n\t\t\t\t}),\n\t\t\t\tdelay(20),\n\t\t\t\tfilter(({ target, sheet }) => {\n\t\t\t\t\t// if the sheet has already the component, just show it\n\t\t\t\t\tif (\n\t\t\t\t\t\ttarget.persist &&\n\t\t\t\t\t\tsheet?.shadowRoot\n\t\t\t\t\t\t\t?.querySelector('slot')\n\t\t\t\t\t\t\t?.assignedElements()\n\t\t\t\t\t\t\t.find(e => e.tagName === target.component.tagName)\n\t\t\t\t\t) {\n\t\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t\t\treturn false\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn true // if the sheet does not have the component, continue to the next step\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttap(({ target, sheet }) => {\n\t\t\t\t\tsheet?.appendChild(target.component)\n\t\t\t\t}),\n\t\t\t\tdelay(1),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t}),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tfromEvent<CustomEvent>(sheet, 'close')\n\t\t\t\t\t\t.pipe(take(1))\n\t\t\t\t\t\t.pipe(delay(300))\n\t\t\t\t\t\t.subscribe(e => {\n\t\t\t\t\t\t\tconst target = e.target as SchmancySheet\n\t\t\t\t\t\t\tconsole.log(target)\n\n\t\t\t\t\t\t\tif (!target?.persist) target?.remove()\n\t\t\t\t\t\t\tdocument.body.style.overflow = 'auto' // unlock the scroll of the host\n\t\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\n\t\tthis.$dismiss\n\t\t\t.pipe(\n\t\t\t\tmergeMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(100)), // Some people say why 10? I say why not?\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(uid).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(SheetWhereAreYouRicky, { detail: { uid } }))\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([sheet]) => {\n\t\t\t\t\tsheet?.closeSheet()\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\tdismiss(uid: string) {\n\t\tthis.$dismiss.next(uid)\n\t}\n\n\topen(target: BottomSheeetTarget) {\n\t\tthis.bottomSheet.next(target)\n\t}\n}\nexport const sheet = new BottomSheetService()\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil, tap } from 'rxjs'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\nimport { on } from './hook'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) allowOverlayDismiss = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button\n\t\tconst popState$ = fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\ttap(e => {\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.closeSheet()\n\t\t\t}),\n\t\t)\n\n\t\t// Handle ESC key\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus()) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (this.allowOverlayDismiss) sheet.dismiss(this.uid)\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<section class=\"content w-full\" data-position=${this.position}>\n\t\t\t\t\t<schmancy-sheet-header\n\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t.hidden=${this.header === 'hidden'}\n\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t></schmancy-sheet-header>\n\t\t\t\t\t<schmancy-surface class=\"overflow-auto\" fill=\"all\" type=\"surface\">\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</section>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","render","classes","absolute","this","title","length","relative","html","classMap","dispatchEvent","CustomEvent","bubbles","composed","__decorateClass","property","prototype","customElement","SchmancySheetPosition","SheetWhereAreYouRicky","SheetHereMorty","sheet","bottomSheet","Subject","$dismiss","pipe","switchMap","forkJoin","fromEvent","window","takeUntil","timer","map","e","detail","defaultIfEmpty","of","target","tap","uid","component","tagName","document","createElement","body","appendChild","setAttribute","position","innerWidth","allowOverlyDismiss","persist","header","style","overflow","delay","filter","shadowRoot","querySelector","assignedElements","find","take","subscribe","remove","mergeMap","closeSheet","next","SchmancySheet","$LitElement","super","arguments","open","Side","allowOverlayDismiss","focusAttribute","lastFocusedElement","handleFocusIn","contains","focus","_oldValue","newValue","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","popState$","preventDefault","keyUp$","event","key","sheetContainsFocus","dismiss","rickyComm$","announcePresence","merge","addEventListener","removeEventListener","isShown","String","getFocusElement","selector","el","matches","stopPropagation","propName","options","type","reflect","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":";;;;;;;;;;;AAKA,IAAqBA,IAArB,cAAiDC,EAAAA,EAAAA;AAAAA,EAEhD,SAAAC;AACC,UAAMC,IAAU,EACfC,UAAUC,KAAKC,MAAMC,WAAW,GAChCC,UAAUH,KAAKC,MAAMC,SAAS,EAExB;AAAA,WAAAE;AAAAA;AAAAA,4BAEmBJ,KAAKK,SAASP,CAAAA,CAAAA;AAAAA;AAAAA;AAAAA,gBAG1B,MACHE;AAAAA,WAAAM,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAEF,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+EAMuET,KAAKC,KAAAA;AAAAA;AAAAA;AAAAA,gBAGpE,MACHD;AAAAA,WAAAM,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAEF,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EACA;AAAA;AAjCKC,EAAA,CAAXC,EADmBhB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MuH,GAAU5C;IAElC;AAAA,EAEF;AAAA,KDtBmBb,EAgBpBlD,WAAA,gBAAA,CAhBoBkD,GAAAA,IAArBpD,EAAA,CADCG,EAAc,oBACMiD;"}
|
|
1
|
+
{"version":3,"file":"sheet-D_cWUJsR.js","sources":["../src/sheet/header.ts","../src/sheet/sheet.service.ts","../src/sheet/sheet.ts","../src/sheet/hook.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\n@customElement('schmancy-sheet-header')\nexport default class SchmancySheetHeader extends TailwindElement() {\n\t@property() title: string\n\trender() {\n\t\tconst classes = {\n\t\t\tabsolute: this.title.length === 0,\n\t\t\trelative: this.title.length > 0,\n\t\t}\n\t\treturn html`\n\t\t\t<schmancy-surface fill=\"width\" elevation=\"1\">\n\t\t\t\t<schmancy-grid class=\"${this.classMap(classes)}\" align=\"center\" justify=\"stretch\" cols=\"auto 1fr auto\">\n\t\t\t\t\t<slot name=\"back\">\n\t\t\t\t\t\t<schmancy-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span class=\"text-[24px]\">← </span>\n\t\t\t\t\t\t</schmancy-button>\n\t\t\t\t\t</slot>\n\t\t\t\t\t<schmancy-typography transform=\"capitalize\" type=\"headline\" token=\"lg\"> ${this.title} </schmancy-typography>\n\t\t\t\t\t<slot name=\"actions\">\n\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent('dismiss', {\n\t\t\t\t\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t</slot>\n\t\t\t\t</schmancy-grid>\n\t\t\t</schmancy-surface>\n\t\t`\n\t}\n}\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet-header': SchmancySheetHeader\n\t}\n}\n","import {\n\tdefaultIfEmpty,\n\tdelay,\n\tfilter,\n\tforkJoin,\n\tfromEvent,\n\tmap,\n\tmergeMap,\n\tof,\n\tSubject,\n\tswitchMap,\n\ttake,\n\ttakeUntil,\n\ttap,\n\ttimer,\n} from 'rxjs'\nimport SchmancySheet from './sheet'\n\nexport enum SchmancySheetPosition {\n\tSide = 'side',\n\tBottom = 'bottom',\n\t/**\n\t * @deprecated use bottom instead\n\t */\n\tBottomCenter = 'bottom-center',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tTopRight = 'top-right',\n\t/**\n\t * @deprecated use side instead\n\t */\n\tBottomRight = 'bottom-right',\n}\n\ntype BottomSheeetTarget = {\n\tcomponent: HTMLElement\n\tuid?: string\n\tposition?: SchmancySheetPosition\n\tpersist?: boolean\n\tclose?: () => void\n\tallowOverlyDismiss?: boolean\n\ttitle?: string\n\theader?: 'hidden' | 'visible'\n}\n\n// Events for communication between bottom-sheet component and bottom-sheet.service\nexport type SheetWhereAreYouRickyEvent = CustomEvent<{\n\tuid: string\n}>\nexport const SheetWhereAreYouRicky = 'are-you-there-sheet'\n\nexport type SheetHereMortyEvent = CustomEvent<{\n\tsheet: SchmancySheet\n}>\nexport const SheetHereMorty = 'yes-here'\n\n// Function to determine the position based on screen size\nconst getPosition = (): SchmancySheetPosition => {\n\treturn window.innerWidth >= 768 ? SchmancySheetPosition.Side : SchmancySheetPosition.Bottom // Adjust 768 as needed for your breakpoint\n}\n\nclass BottomSheetService {\n\tbottomSheet = new Subject<BottomSheeetTarget>()\n\t$dismiss = new Subject<string>()\n\tconstructor() {\n\t\tthis.bottomSheet\n\t\t\t.pipe(\n\t\t\t\tswitchMap(target =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(0)),\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(target).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(\n\t\t\t\t\t\t\t\t\tnew CustomEvent(SheetWhereAreYouRicky, {\n\t\t\t\t\t\t\t\t\t\tdetail: { uid: target.uid ?? target.component.tagName },\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\tmap(([sheet, target]) => {\n\t\t\t\t\tconsole.log(sheet, target)\n\t\t\t\t\tif (!sheet) {\n\t\t\t\t\t\t// if sheet is not found, create it\n\t\t\t\t\t\tsheet = document.createElement('schmancy-sheet')\n\t\t\t\t\t\tdocument.body.appendChild(sheet)\n\t\t\t\t\t}\n\t\t\t\t\tsheet.setAttribute('uid', target.uid ?? target.component.tagName)\n\n\t\t\t\t\t// **Use the dynamic position function here**\n\t\t\t\t\tconst position = target.position || getPosition() // Use target.position if it's set, otherwise determine based on screen size\n\t\t\t\t\tsheet.setAttribute('position', position)\n\n\t\t\t\t\tsheet.setAttribute('allowOverlyDismiss', target.allowOverlyDismiss === false ? 'false' : 'true')\n\t\t\t\t\ttarget.title && sheet.setAttribute('title', target.title)\n\t\t\t\t\ttarget.persist && sheet.setAttribute('persist', target.persist ?? false)\n\t\t\t\t\ttarget.header && sheet.setAttribute('header', target.header)\n\t\t\t\t\tdocument.body.style.overflow = 'hidden' // lock the scroll of the host\n\t\t\t\t\treturn { target, sheet }\n\t\t\t\t}),\n\t\t\t\tdelay(20),\n\t\t\t\tfilter(({ target, sheet }) => {\n\t\t\t\t\t// if the sheet has already the component, just show it\n\t\t\t\t\tif (\n\t\t\t\t\t\ttarget.persist &&\n\t\t\t\t\t\tsheet?.shadowRoot\n\t\t\t\t\t\t\t?.querySelector('slot')\n\t\t\t\t\t\t\t?.assignedElements()\n\t\t\t\t\t\t\t.find(e => e.tagName === target.component.tagName)\n\t\t\t\t\t) {\n\t\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t\t\treturn false\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn true // if the sheet does not have the component, continue to the next step\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttap(({ target, sheet }) => {\n\t\t\t\t\tsheet?.appendChild(target.component)\n\t\t\t\t}),\n\t\t\t\tdelay(1),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tsheet?.setAttribute('open', 'true')\n\t\t\t\t}),\n\t\t\t\ttap(({ sheet }) => {\n\t\t\t\t\tfromEvent<CustomEvent>(sheet, 'close')\n\t\t\t\t\t\t.pipe(take(1))\n\t\t\t\t\t\t.pipe(delay(300))\n\t\t\t\t\t\t.subscribe(e => {\n\t\t\t\t\t\t\tconst target = e.target as SchmancySheet\n\t\t\t\t\t\t\tconsole.log(target)\n\n\t\t\t\t\t\t\tif (!target?.persist) target?.remove()\n\t\t\t\t\t\t\tdocument.body.style.overflow = 'auto' // unlock the scroll of the host\n\t\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\n\t\tthis.$dismiss\n\t\t\t.pipe(\n\t\t\t\tmergeMap(uid =>\n\t\t\t\t\tforkJoin([\n\t\t\t\t\t\tfromEvent<SheetHereMortyEvent>(window, SheetHereMorty).pipe(\n\t\t\t\t\t\t\ttakeUntil(timer(100)), // Some people say why 10? I say why not?\n\t\t\t\t\t\t\tmap(e => e.detail.sheet),\n\t\t\t\t\t\t\tdefaultIfEmpty(undefined),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tof(uid).pipe(\n\t\t\t\t\t\t\ttap(() => {\n\t\t\t\t\t\t\t\twindow.dispatchEvent(new CustomEvent(SheetWhereAreYouRicky, { detail: { uid } }))\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\ttap(([sheet]) => {\n\t\t\t\t\tsheet?.closeSheet()\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\tdismiss(uid: string) {\n\t\tthis.$dismiss.next(uid)\n\t}\n\n\topen(target: BottomSheeetTarget) {\n\t\tthis.bottomSheet.next(target)\n\t}\n}\nexport const sheet = new BottomSheetService()\n","import { $LitElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property, query, queryAssignedElements } from 'lit/decorators.js'\nimport { fromEvent, merge, takeUntil, tap } from 'rxjs'\nimport { on } from './hook'\nimport style from './sheet.scss?inline'\nimport {\n\tSchmancySheetPosition,\n\tSheetHereMorty,\n\tSheetWhereAreYouRicky,\n\tSheetWhereAreYouRickyEvent,\n\tsheet,\n} from './sheet.service'\n\n@customElement('schmancy-sheet')\nexport default class SchmancySheet extends $LitElement(style) {\n\t@property({ type: String, reflect: true }) uid!: string\n\t@property({ type: Boolean, reflect: true }) open = false\n\t@property({ type: String, reflect: true }) header: 'hidden' | 'visible' = 'visible'\n\t@property({ type: String, reflect: true }) position: SchmancySheetPosition = SchmancySheetPosition.Side\n\t@property({ type: Boolean, reflect: true }) persist = false\n\t@property({ type: Boolean, reflect: true }) allowOverlayDismiss = true\n\t@property({ type: String, reflect: true }) title = ''\n\n\t@query('.sheet') private sheet!: HTMLElement\n\t@queryAssignedElements({ flatten: true }) private assignedElements!: HTMLElement[]\n\n\t@property() focusAttribute = 'autofocus'\n\tprivate lastFocusedElement: HTMLElement | null = null\n\n\t@on('open')\n\tonOpenChange(_oldValue: boolean, newValue: boolean) {\n\t\tif (newValue) {\n\t\t\tthis.lastFocusedElement = document.activeElement as HTMLElement\n\t\t\tthis.addFocusTrap()\n\t\t\tthis.focus()\n\t\t} else {\n\t\t\tthis.removeFocusTrap()\n\t\t\tthis.lastFocusedElement?.focus()\n\t\t\tthis.lastFocusedElement = null\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback()\n\t\tthis.setupEventListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tsuper.disconnectedCallback()\n\t\tthis.disconnecting.next(true)\n\t}\n\n\tprivate setupEventListeners() {\n\t\t// Handle browser back button\n\t\tconst popState$ = fromEvent<PopStateEvent>(window, 'popstate').pipe(\n\t\t\ttap(e => {\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.closeSheet()\n\t\t\t}),\n\t\t)\n\n\t\t// Handle ESC key\n\t\tconst keyUp$ = fromEvent<KeyboardEvent>(window, 'keyup').pipe(\n\t\t\ttap(event => {\n\t\t\t\tif (event.key === 'Escape' && !this.sheetContainsFocus()) {\n\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\n\t\t// Handle inter-component communication\n\t\tconst rickyComm$ = fromEvent<SheetWhereAreYouRickyEvent>(window, SheetWhereAreYouRicky).pipe(\n\t\t\ttap(e => {\n\t\t\t\tif (e.detail.uid === this.uid) this.announcePresence()\n\t\t\t}),\n\t\t)\n\n\t\tmerge(popState$, keyUp$, rickyComm$).pipe(takeUntil(this.disconnecting)).subscribe()\n\t}\n\n\tprivate sheetContainsFocus(): boolean {\n\t\treturn this.sheet?.contains(document.activeElement) ?? false\n\t}\n\n\tprivate announcePresence() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent(SheetHereMorty, {\n\t\t\t\tdetail: { sheet: this },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\tprivate addFocusTrap() {\n\t\tdocument.addEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate removeFocusTrap() {\n\t\tdocument.removeEventListener('focusin', this.handleFocusIn)\n\t}\n\n\tprivate handleFocusIn = (e: Event) => {\n\t\tif (!this.sheet?.contains(e.target as Node)) {\n\t\t\tthis.focus()\n\t\t}\n\t}\n\n\tsetIsSheetShown(isShown: boolean) {\n\t\tthis.sheet?.setAttribute('aria-hidden', String(!isShown))\n\t\tthis.sheet?.setAttribute('aria-modal', String(isShown))\n\t}\n\n\tcloseSheet() {\n\t\tthis.open = false\n\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t}\n\n\tprivate getFocusElement(): HTMLElement | null {\n\t\tconst selector = `[${this.focusAttribute}]`\n\t\treturn (this.assignedElements.find(el => el.matches(selector) || el.querySelector(selector)) as HTMLElement) ?? null\n\t}\n\n\toverride focus() {\n\t\tthis.getFocusElement()?.focus()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<div class=\"sheet\" role=\"dialog\" aria-labelledby=\"sheet-title\" aria-hidden=${!this.open} aria-modal=${this.open}>\n\t\t\t\t<div\n\t\t\t\t\tclass=\"overlay\"\n\t\t\t\t\t@click=${(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tif (this.allowOverlayDismiss) sheet.dismiss(this.uid)\n\t\t\t\t\t}}\n\t\t\t\t></div>\n\t\t\t\t<schmancy-grid rows=\"auto 1fr\" class=\"content w-full\" data-position=${this.position}>\n\t\t\t\t\t<schmancy-sheet-header\n\t\t\t\t\t\tclass=\"sticky top-0 z-50 w-full\"\n\t\t\t\t\t\t@dismiss=${(e: CustomEvent) => {\n\t\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\t\tsheet.dismiss(this.uid)\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tid=\"sheet-title\"\n\t\t\t\t\t\t.hidden=${this.header === 'hidden'}\n\t\t\t\t\t\ttitle=${this.title}\n\t\t\t\t\t></schmancy-sheet-header>\n\t\t\t\t\t<schmancy-surface rounded=\"left\" scroller id=\"body\" class=\"overflow-auto\" type=\"surface\">\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</schmancy-surface>\n\t\t\t\t</schmancy-grid>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-sheet': SchmancySheet\n\t}\n}\n","// @watch decorator\n//\n// Runs when an observed property changes, e.g. @property or @state, but before the component updates.\n//\n// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start\n// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.\n//\n// Usage:\n//\n// @watch('propName')\n// handlePropChange(oldValue, newValue) {\n// ...\n// }\n//\ninterface WatchOptions {\n\twaitUntilFirstUpdate?: boolean\n}\n\nexport function on(propName: string, options?: WatchOptions) {\n\treturn (protoOrDescriptor: any, name: string): any => {\n\t\tconst { willUpdate } = protoOrDescriptor\n\n\t\toptions = Object.assign({ waitUntilFirstUpdate: false }, options) as WatchOptions\n\n\t\tprotoOrDescriptor.willUpdate = function (changedProps: Map<string, any>) {\n\t\t\twillUpdate.call(this, changedProps)\n\n\t\t\tif (changedProps.has(propName)) {\n\t\t\t\tconst oldValue = changedProps.get(propName)\n\t\t\t\tconst newValue = this[propName]\n\n\t\t\t\tif (oldValue !== newValue) {\n\t\t\t\t\tif (!options?.waitUntilFirstUpdate || this.hasUpdated) {\n\t\t\t\t\t\tthis[name].call(this, oldValue, newValue)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["SchmancySheetHeader","TailwindElement","render","classes","absolute","this","title","length","relative","html","classMap","dispatchEvent","CustomEvent","bubbles","composed","__decorateClass","property","prototype","customElement","SchmancySheetPosition","SheetWhereAreYouRicky","SheetHereMorty","sheet","bottomSheet","Subject","$dismiss","pipe","switchMap","forkJoin","fromEvent","window","takeUntil","timer","map","e","detail","defaultIfEmpty","of","target","tap","uid","component","tagName","document","createElement","body","appendChild","setAttribute","position","innerWidth","allowOverlyDismiss","persist","header","style","overflow","delay","filter","shadowRoot","querySelector","assignedElements","find","take","subscribe","remove","mergeMap","closeSheet","next","SchmancySheet","$LitElement","super","arguments","open","Side","allowOverlayDismiss","focusAttribute","lastFocusedElement","handleFocusIn","contains","focus","_oldValue","newValue","activeElement","addFocusTrap","removeFocusTrap","connectedCallback","setupEventListeners","disconnectedCallback","disconnecting","popState$","preventDefault","keyUp$","event","key","sheetContainsFocus","dismiss","rickyComm$","announcePresence","merge","addEventListener","removeEventListener","isShown","String","getFocusElement","selector","el","matches","stopPropagation","propName","options","type","reflect","Boolean","query","queryAssignedElements","flatten","protoOrDescriptor","name","willUpdate","Object","assign","waitUntilFirstUpdate","changedProps","call","has","oldValue","get","hasUpdated"],"mappings":";;;;;;;;;;;AAKA,IAAqBA,IAArB,cAAiDC,EAAAA,EAAAA;AAAAA,EAEhD,SAAAC;AACC,UAAMC,IAAU,EACfC,UAAUC,KAAKC,MAAMC,WAAW,GAChCC,UAAUH,KAAKC,MAAMC,SAAS,EAExB;AAAA,WAAAE;AAAAA;AAAAA,4BAEmBJ,KAAKK,SAASP,CAAAA,CAAAA;AAAAA;AAAAA;AAAAA,gBAG1B,MACHE;AAAAA,WAAAM,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAEF,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+EAMuET,KAAKC,KAAAA;AAAAA;AAAAA;AAAAA,gBAGpE,MACHD;AAAAA,WAAAM,cACJ,IAAIC,YAAY,WAAW,EAC1BC,SAAAA,IACAC,UAAAA,GAEF,CAAA,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EACA;AAAA;AAjCKC,EAAA,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AAMM,KAAKrH,MAAMuH,GAAU5C;IAElC;AAAA,EAEF;AAAA,KDtBmBb,EAgBpBlD,WAAA,gBAAA,CAhBoBkD,GAAAA,IAArBpD,EAAA,CADCG,EAAc,oBACMiD;"}
|
package/dist/sheet.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./sheet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./sheet-CONpdXIq.cjs");exports.SchmancySheetPosition=e.SchmancySheetPosition,exports.SheetHereMorty=e.SheetHereMorty,exports.SheetWhereAreYouRicky=e.SheetWhereAreYouRicky,exports.sheet=e.sheet;
|
|
2
2
|
//# sourceMappingURL=sheet.cjs.map
|
package/dist/sheet.js
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";const l=require("./provide-DSU87U5x.cjs"),u=require("./tailwind.mixin-CJgIYh7g.cjs"),a=require("lit"),t=require("lit/decorators.js"),p=require("lit/directives/class-map.js"),d=require("./context-CHWQnKZ-.cjs");var f=Object.defineProperty,y=Object.getOwnPropertyDescriptor,r=(i,s,h,o)=>{for(var c,e=o>1?void 0:o?y(s,h):s,n=i.length-1;n>=0;n--)(c=i[n])&&(e=(o?c(s,h,e):c(e))||e);return o&&e&&f(s,h,e),e};exports.SchmancySurface=class extends u.TailwindElement(a.css`
|
|
2
|
+
:host([fill='all']) {
|
|
3
|
+
height: 100%;
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
:host([fill='width']) {
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
:host([fill='height']) {
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
/* When the scroller attribute is present, enable scrolling behavior */
|
|
16
|
+
:host([scroller]) {
|
|
17
|
+
overflow: auto;
|
|
18
|
+
scroll-behavior: smooth;
|
|
19
|
+
position: relative;
|
|
20
|
+
}
|
|
21
|
+
`){constructor(){super(...arguments),this.fill="auto",this.rounded="none",this.type="surface",this.elevation=0,this.scroller=!1}render(){const i={relative:!0,"inset-0":!0,block:!0,"box-border":!0,"rounded-none":this.rounded==="none","rounded-t-[8px]":this.rounded==="top","rounded-l-[8px]":this.rounded==="left","rounded-r-[8px]":this.rounded==="right","rounded-b-[8px]":this.rounded==="bottom","rounded-[8px]":this.rounded==="all","w-full":this.fill==="width"||this.fill==="all","h-full":this.fill==="height"||this.fill==="all","shadow-xs":this.elevation===1,"shadow-sm":this.elevation===2,"shadow-md":this.elevation===3,"shadow-lg":this.elevation===4,"shadow-xl":this.elevation===5,"text-surface-on":this.type==="surface"||this.type==="surfaceDim"||this.type==="surfaceBright"||this.type==="containerLowest"||this.type==="containerLow"||this.type==="container"||this.type==="containerHigh"||this.type==="containerHighest","bg-surface-default":this.type==="surface","bg-surface-dim":this.type==="surfaceDim","bg-surface-bright":this.type==="surfaceBright","bg-surface-lowest":this.type==="containerLowest","bg-surface-low":this.type==="containerLow","bg-surface-container":this.type==="container","bg-surface-high":this.type==="containerHigh","bg-surface-highest":this.type==="containerHighest"};return a.html`
|
|
22
|
+
<section class=${p.classMap(i)}>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</section>
|
|
25
|
+
`}},r([t.property({type:String,reflect:!0})],exports.SchmancySurface.prototype,"fill",2),r([t.property()],exports.SchmancySurface.prototype,"rounded",2),r([l.e({context:d.SchmancySurfaceTypeContext}),t.property()],exports.SchmancySurface.prototype,"type",2),r([t.property({type:Number,reflect:!0})],exports.SchmancySurface.prototype,"elevation",2),r([t.property({type:Boolean,reflect:!0})],exports.SchmancySurface.prototype,"scroller",2),exports.SchmancySurface=r([t.customElement("schmancy-surface")],exports.SchmancySurface);
|
|
26
|
+
//# sourceMappingURL=surface-BHP347Uc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-BHP347Uc.cjs","sources":["../src/surface/surface.ts"],"sourcesContent":["import { provide } from '@lit/context'\nimport { TailwindElement } from '@mixins/tailwind.mixin'\nimport { TSurfaceColor } from '@schmancy/types'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js' // Utility for conditionally applying CSS classes\nimport { SchmancySurfaceTypeContext } from './context'\n\n/**\n * Defines the fill options for the surface component.\n */\nexport type SchmancySurfaceFill = 'all' | 'width' | 'height' | 'auto'\n\n/**\n * `<schmancy-surface>` component.\n *\n * This component renders a styled surface element that adapts its dimensions based on the\n * provided fill mode. It supports various rounding options, elevation levels, and applies\n * background and text color classes based on the specified surface variant.\n *\n * **Note:** The property for defining the surface variant is named `surface` and is not\n * changed to `type` to maintain API consistency.\n *\n * @element schmancy-surface\n * @slot - Default slot for projecting child elements.\n *\n * @example\n * <schmancy-surface fill=\"all\" rounded=\"all\" elevation=\"3\" surface=\"surfaceBright\" scroller>\n * <p>Your content here</p>\n * </schmancy-surface>\n */\n@customElement('schmancy-surface')\nexport class SchmancySurface extends TailwindElement(css`\n\t:host([fill='all']) {\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\t:host([fill='width']) {\n\t\twidth: 100%;\n\t}\n\t:host([fill='height']) {\n\t\theight: 100%;\n\t}\n\t:host {\n\t\tdisplay: block;\n\t}\n\t/* When the scroller attribute is present, enable scrolling behavior */\n\t:host([scroller]) {\n\t\toverflow: auto;\n\t\tscroll-behavior: smooth;\n\t\tposition: relative;\n\t}\n`) {\n\t/**\n\t * Determines how the component should fill the available space.\n\t *\n\t * - `all`: Fills both width and height.\n\t * - `width`: Fills only the width.\n\t * - `height`: Fills only the height.\n\t * - `auto`: No automatic filling.\n\t *\n\t * @attr fill\n\t * @default 'auto'\n\t */\n\t@property({ type: String, reflect: true }) fill: SchmancySurfaceFill = 'auto'\n\n\t/**\n\t * Specifies the rounding style of the component's corners.\n\t *\n\t * Options:\n\t * - `none`: No rounding.\n\t * - `top`, `left`, `right`, `bottom`: Rounds only one edge.\n\t * - `all`: Rounds all corners.\n\t *\n\t * @attr rounded\n\t * @default 'none'\n\t */\n\t@property() rounded: 'none' | 'top' | 'left' | 'right' | 'bottom' | 'all' = 'none'\n\n\t/**\n\t * Specifies the type variant.\n\t *\n\t * **Note:** The property name is `type` and is kept as-is to maintain API consistency.\n\t * This value is also provided via context to descendant components.\n\t *\n\t * @attr type\n\t * @default 'type'\n\t */\n\t@provide({ context: SchmancySurfaceTypeContext })\n\t@property()\n\ttype: TSurfaceColor = 'surface'\n\n\t/**\n\t * Defines the elevation level (shadow depth) of the surface.\n\t *\n\t * Valid values: 0, 1, 2, 3, 4, 5.\n\t *\n\t * @attr elevation\n\t * @default 0\n\t */\n\t@property({ type: Number, reflect: true }) elevation: 0 | 1 | 2 | 3 | 4 | 5 = 0\n\n\t/**\n\t * When set to true, the surface becomes scrollable.\n\t *\n\t * @attr scroller\n\t * @type {boolean}\n\t * @default false\n\t */\n\t@property({ type: Boolean, reflect: true }) scroller: boolean = false\n\n\t/**\n\t * Renders the component's template.\n\t *\n\t * CSS classes are conditionally applied using the `classMap` directive based on the\n\t * current property values.\n\t *\n\t * @returns The template for the component.\n\t */\n\tprotected render(): unknown {\n\t\tconst classes = {\n\t\t\trelative: true,\n\t\t\t'inset-0': true,\n\t\t\tblock: true,\n\t\t\t'box-border': true,\n\t\t\t// Rounding classes\n\t\t\t'rounded-none': this.rounded === 'none',\n\t\t\t'rounded-t-[8px]': this.rounded === 'top',\n\t\t\t'rounded-l-[8px]': this.rounded === 'left',\n\t\t\t'rounded-r-[8px]': this.rounded === 'right',\n\t\t\t'rounded-b-[8px]': this.rounded === 'bottom',\n\t\t\t'rounded-[8px]': this.rounded === 'all',\n\t\t\t// Fill classes\n\t\t\t'w-full': this.fill === 'width' || this.fill === 'all',\n\t\t\t'h-full': this.fill === 'height' || this.fill === 'all',\n\t\t\t// Elevation shadow classes\n\t\t\t'shadow-xs': this.elevation === 1,\n\t\t\t'shadow-sm': this.elevation === 2,\n\t\t\t'shadow-md': this.elevation === 3,\n\t\t\t'shadow-lg': this.elevation === 4,\n\t\t\t'shadow-xl': this.elevation === 5,\n\t\t\t// Text color based on the surface variant for optimal readability\n\t\t\t'text-surface-on':\n\t\t\t\tthis.type === 'surface' ||\n\t\t\t\tthis.type === 'surfaceDim' ||\n\t\t\t\tthis.type === 'surfaceBright' ||\n\t\t\t\tthis.type === 'containerLowest' ||\n\t\t\t\tthis.type === 'containerLow' ||\n\t\t\t\tthis.type === 'container' ||\n\t\t\t\tthis.type === 'containerHigh' ||\n\t\t\t\tthis.type === 'containerHighest',\n\t\t\t// Background color classes based on the surface variant\n\t\t\t'bg-surface-default': this.type === 'surface',\n\t\t\t'bg-surface-dim': this.type === 'surfaceDim',\n\t\t\t'bg-surface-bright': this.type === 'surfaceBright',\n\t\t\t'bg-surface-lowest': this.type === 'containerLowest',\n\t\t\t'bg-surface-low': this.type === 'containerLow',\n\t\t\t'bg-surface-container': this.type === 'container',\n\t\t\t'bg-surface-high': this.type === 'containerHigh',\n\t\t\t'bg-surface-highest': this.type === 'containerHighest',\n\t\t}\n\n\t\treturn html`\n\t\t\t<section class=${classMap(classes)}>\n\t\t\t\t<slot></slot>\n\t\t\t</section>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-surface': SchmancySurface\n\t}\n}\n"],"names":["SchmancySurface","TailwindElement","css","super","arguments","this","fill","rounded","type","elevation","scroller","render","classes","relative","block","html","classMap","__decorateClass","property","String","reflect","prototype","provide","context","SchmancySurfaceTypeContext","Number","Boolean","customElement"],"mappings":"+ZAgCaA,QAAAA,gBAAN,cAA8BC,EAAAA,gBAAgBC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAA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A,CAAA,EAhCvBpB,wBAgC+BqB,UAAA,OAAA,CAAA,EAa/BJ,EAAA,CAAXC,EAASA,SA7CElB,CAAAA,EAAAA,wBA6CAqB,UAAA,UAAA,CAAA,EAaZJ,EAAA,CAFCK,IAAQ,CAAEC,QAASC,EAAAA,0BAAAA,CAAAA,EACnBN,EAASA,SAAAA,CAAAA,EAzDElB,wBA0DZqB,UAAA,OAAA,CAAA,EAU2CJ,EAAA,CAA1CC,EAAAA,SAAS,CAAEV,KAAMiB,OAAQL,QAAS,EAAA,CAAA,CAAA,EApEvBpB,wBAoE+BqB,UAAA,YAAA,CAAA,EASCJ,EAAA,CAA3CC,EAAAA,SAAS,CAAEV,KAAMkB,QAASN,QAAAA,EA7EfpB,CAAAA,CAAAA,EAAAA,wBA6EgCqB,UAAA,WAAA,CA7EhCrB,EAAAA,QAANA,gBAAAiB,EAAA,CADNU,EAAAA,cAAc,qBACF3B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { e as c } from "./provide-BLSgVvMJ.js";
|
|
2
2
|
import { T as p } from "./tailwind.mixin-D4STgS5j.js";
|
|
3
3
|
import { css as d, html as u } from "lit";
|
|
4
|
-
import { property as
|
|
4
|
+
import { property as s, customElement as f } from "lit/decorators.js";
|
|
5
5
|
import { classMap as y } from "lit/directives/class-map.js";
|
|
6
6
|
import { S as g } from "./context-YZmnxxIi.js";
|
|
7
|
-
var m = Object.defineProperty, b = Object.getOwnPropertyDescriptor,
|
|
8
|
-
for (var
|
|
9
|
-
return
|
|
7
|
+
var m = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (r, i, l, h) => {
|
|
8
|
+
for (var n, t = h > 1 ? void 0 : h ? b(i, l) : i, a = r.length - 1; a >= 0; a--) (n = r[a]) && (t = (h ? n(i, l, t) : n(t)) || t);
|
|
9
|
+
return h && t && m(i, l, t), t;
|
|
10
10
|
};
|
|
11
11
|
let e = class extends p(d`
|
|
12
12
|
:host([fill='all']) {
|
|
@@ -22,21 +22,27 @@ let e = class extends p(d`
|
|
|
22
22
|
:host {
|
|
23
23
|
display: block;
|
|
24
24
|
}
|
|
25
|
+
/* When the scroller attribute is present, enable scrolling behavior */
|
|
26
|
+
:host([scroller]) {
|
|
27
|
+
overflow: auto;
|
|
28
|
+
scroll-behavior: smooth;
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
25
31
|
`) {
|
|
26
32
|
constructor() {
|
|
27
|
-
super(...arguments), this.fill = "auto", this.rounded = "none", this.type = "surface", this.elevation = 0;
|
|
33
|
+
super(...arguments), this.fill = "auto", this.rounded = "none", this.type = "surface", this.elevation = 0, this.scroller = !1;
|
|
28
34
|
}
|
|
29
35
|
render() {
|
|
30
|
-
const
|
|
36
|
+
const r = { relative: !0, "inset-0": !0, block: !0, "box-border": !0, "rounded-none": this.rounded === "none", "rounded-t-[8px]": this.rounded === "top", "rounded-l-[8px]": this.rounded === "left", "rounded-r-[8px]": this.rounded === "right", "rounded-b-[8px]": this.rounded === "bottom", "rounded-[8px]": this.rounded === "all", "w-full": this.fill === "width" || this.fill === "all", "h-full": this.fill === "height" || this.fill === "all", "shadow-xs": this.elevation === 1, "shadow-sm": this.elevation === 2, "shadow-md": this.elevation === 3, "shadow-lg": this.elevation === 4, "shadow-xl": this.elevation === 5, "text-surface-on": this.type === "surface" || this.type === "surfaceDim" || this.type === "surfaceBright" || this.type === "containerLowest" || this.type === "containerLow" || this.type === "container" || this.type === "containerHigh" || this.type === "containerHighest", "bg-surface-default": this.type === "surface", "bg-surface-dim": this.type === "surfaceDim", "bg-surface-bright": this.type === "surfaceBright", "bg-surface-lowest": this.type === "containerLowest", "bg-surface-low": this.type === "containerLow", "bg-surface-container": this.type === "container", "bg-surface-high": this.type === "containerHigh", "bg-surface-highest": this.type === "containerHighest" };
|
|
31
37
|
return u`
|
|
32
|
-
<section class=${y(
|
|
38
|
+
<section class=${y(r)}>
|
|
33
39
|
<slot></slot>
|
|
34
40
|
</section>
|
|
35
41
|
`;
|
|
36
42
|
}
|
|
37
43
|
};
|
|
38
|
-
|
|
44
|
+
o([s({ type: String, reflect: !0 })], e.prototype, "fill", 2), o([s()], e.prototype, "rounded", 2), o([c({ context: g }), s()], e.prototype, "type", 2), o([s({ type: Number, reflect: !0 })], e.prototype, "elevation", 2), o([s({ type: Boolean, reflect: !0 })], e.prototype, "scroller", 2), e = o([f("schmancy-surface")], e);
|
|
39
45
|
export {
|
|
40
46
|
e as S
|
|
41
47
|
};
|
|
42
|
-
//# sourceMappingURL=surface-
|
|
48
|
+
//# sourceMappingURL=surface-Bxn0eKDp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-Bxn0eKDp.js","sources":["../src/surface/surface.ts"],"sourcesContent":["import { provide } from '@lit/context'\nimport { TailwindElement } from '@mixins/tailwind.mixin'\nimport { TSurfaceColor } from '@schmancy/types'\nimport { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js' // Utility for conditionally applying CSS classes\nimport { SchmancySurfaceTypeContext } from './context'\n\n/**\n * Defines the fill options for the surface component.\n */\nexport type SchmancySurfaceFill = 'all' | 'width' | 'height' | 'auto'\n\n/**\n * `<schmancy-surface>` component.\n *\n * This component renders a styled surface element that adapts its dimensions based on the\n * provided fill mode. It supports various rounding options, elevation levels, and applies\n * background and text color classes based on the specified surface variant.\n *\n * **Note:** The property for defining the surface variant is named `surface` and is not\n * changed to `type` to maintain API consistency.\n *\n * @element schmancy-surface\n * @slot - Default slot for projecting child elements.\n *\n * @example\n * <schmancy-surface fill=\"all\" rounded=\"all\" elevation=\"3\" surface=\"surfaceBright\" scroller>\n * <p>Your content here</p>\n * </schmancy-surface>\n */\n@customElement('schmancy-surface')\nexport class SchmancySurface extends TailwindElement(css`\n\t:host([fill='all']) {\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\t:host([fill='width']) {\n\t\twidth: 100%;\n\t}\n\t:host([fill='height']) {\n\t\theight: 100%;\n\t}\n\t:host {\n\t\tdisplay: block;\n\t}\n\t/* When the scroller attribute is present, enable scrolling behavior */\n\t:host([scroller]) {\n\t\toverflow: auto;\n\t\tscroll-behavior: smooth;\n\t\tposition: relative;\n\t}\n`) {\n\t/**\n\t * Determines how the component should fill the available space.\n\t *\n\t * - `all`: Fills both width and height.\n\t * - `width`: Fills only the width.\n\t * - `height`: Fills only the height.\n\t * - `auto`: No automatic filling.\n\t *\n\t * @attr fill\n\t * @default 'auto'\n\t */\n\t@property({ type: String, reflect: true }) fill: SchmancySurfaceFill = 'auto'\n\n\t/**\n\t * Specifies the rounding style of the component's corners.\n\t *\n\t * Options:\n\t * - `none`: No rounding.\n\t * - `top`, `left`, `right`, `bottom`: Rounds only one edge.\n\t * - `all`: Rounds all corners.\n\t *\n\t * @attr rounded\n\t * @default 'none'\n\t */\n\t@property() rounded: 'none' | 'top' | 'left' | 'right' | 'bottom' | 'all' = 'none'\n\n\t/**\n\t * Specifies the type variant.\n\t *\n\t * **Note:** The property name is `type` and is kept as-is to maintain API consistency.\n\t * This value is also provided via context to descendant components.\n\t *\n\t * @attr type\n\t * @default 'type'\n\t */\n\t@provide({ context: SchmancySurfaceTypeContext })\n\t@property()\n\ttype: TSurfaceColor = 'surface'\n\n\t/**\n\t * Defines the elevation level (shadow depth) of the surface.\n\t *\n\t * Valid values: 0, 1, 2, 3, 4, 5.\n\t *\n\t * @attr elevation\n\t * @default 0\n\t */\n\t@property({ type: Number, reflect: true }) elevation: 0 | 1 | 2 | 3 | 4 | 5 = 0\n\n\t/**\n\t * When set to true, the surface becomes scrollable.\n\t *\n\t * @attr scroller\n\t * @type {boolean}\n\t * @default false\n\t */\n\t@property({ type: Boolean, reflect: true }) scroller: boolean = false\n\n\t/**\n\t * Renders the component's template.\n\t *\n\t * CSS classes are conditionally applied using the `classMap` directive based on the\n\t * current property values.\n\t *\n\t * @returns The template for the component.\n\t */\n\tprotected render(): unknown {\n\t\tconst classes = {\n\t\t\trelative: true,\n\t\t\t'inset-0': true,\n\t\t\tblock: true,\n\t\t\t'box-border': true,\n\t\t\t// Rounding classes\n\t\t\t'rounded-none': this.rounded === 'none',\n\t\t\t'rounded-t-[8px]': this.rounded === 'top',\n\t\t\t'rounded-l-[8px]': this.rounded === 'left',\n\t\t\t'rounded-r-[8px]': this.rounded === 'right',\n\t\t\t'rounded-b-[8px]': this.rounded === 'bottom',\n\t\t\t'rounded-[8px]': this.rounded === 'all',\n\t\t\t// Fill classes\n\t\t\t'w-full': this.fill === 'width' || this.fill === 'all',\n\t\t\t'h-full': this.fill === 'height' || this.fill === 'all',\n\t\t\t// Elevation shadow classes\n\t\t\t'shadow-xs': this.elevation === 1,\n\t\t\t'shadow-sm': this.elevation === 2,\n\t\t\t'shadow-md': this.elevation === 3,\n\t\t\t'shadow-lg': this.elevation === 4,\n\t\t\t'shadow-xl': this.elevation === 5,\n\t\t\t// Text color based on the surface variant for optimal readability\n\t\t\t'text-surface-on':\n\t\t\t\tthis.type === 'surface' ||\n\t\t\t\tthis.type === 'surfaceDim' ||\n\t\t\t\tthis.type === 'surfaceBright' ||\n\t\t\t\tthis.type === 'containerLowest' ||\n\t\t\t\tthis.type === 'containerLow' ||\n\t\t\t\tthis.type === 'container' ||\n\t\t\t\tthis.type === 'containerHigh' ||\n\t\t\t\tthis.type === 'containerHighest',\n\t\t\t// Background color classes based on the surface variant\n\t\t\t'bg-surface-default': this.type === 'surface',\n\t\t\t'bg-surface-dim': this.type === 'surfaceDim',\n\t\t\t'bg-surface-bright': this.type === 'surfaceBright',\n\t\t\t'bg-surface-lowest': this.type === 'containerLowest',\n\t\t\t'bg-surface-low': this.type === 'containerLow',\n\t\t\t'bg-surface-container': this.type === 'container',\n\t\t\t'bg-surface-high': this.type === 'containerHigh',\n\t\t\t'bg-surface-highest': this.type === 'containerHighest',\n\t\t}\n\n\t\treturn html`\n\t\t\t<section class=${classMap(classes)}>\n\t\t\t\t<slot></slot>\n\t\t\t</section>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-surface': SchmancySurface\n\t}\n}\n"],"names":["SchmancySurface","TailwindElement","css","super","arguments","this","fill","rounded","type","elevation","scroller","render","classes","relative","block","html","classMap","__decorateClass","property","String","reflect","prototype","provide","context","SchmancySurfaceTypeContext","Number","Boolean","customElement"],"mappings":";;;;;;;;;;AAgCa,IAAAA,IAAN,cAA8BC,EAAgBC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,CAA9C,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAgCiEC,GAAAA,KAAAC,OAAA,QAaKD,KAAAE,UAAA,QAatDF,KAAAG,OAAA,WAUwDH,KAAAI,YAAA,GASdJ,KAAAK,WAAAA;AAAAA,EAAA;AAAA,EAUtD,SAAAC;AACT,UAAMC,IAAU,EACfC,UAAU,IACV,WAAW,IACXC,WACA,cAAA,IAEA,gBAAgBT,KAAKE,YAAY,QACjC,mBAAmBF,KAAKE,YAAY,OACpC,mBAAmBF,KAAKE,YAAY,QACpC,mBAAmBF,KAAKE,YAAY,SACpC,mBAAmBF,KAAKE,YAAY,UACpC,iBAAiBF,KAAKE,YAAY,OAElC,UAAUF,KAAKC,SAAS,WAAWD,KAAKC,SAAS,OACjD,UAAUD,KAAKC,SAAS,YAAYD,KAAKC,SAAS,OAElD,aAAaD,KAAKI,cAAc,GAChC,aAAaJ,KAAKI,cAAc,GAChC,aAAaJ,KAAKI,cAAc,GAChC,aAAaJ,KAAKI,cAAc,GAChC,aAAaJ,KAAKI,cAAc,GAEhC,mBACCJ,KAAKG,SAAS,aACdH,KAAKG,SAAS,gBACdH,KAAKG,SAAS,mBACdH,KAAKG,SAAS,qBACdH,KAAKG,SAAS,kBACdH,KAAKG,SAAS,eACdH,KAAKG,SAAS,mBACdH,KAAKG,SAAS,oBAEf,sBAAsBH,KAAKG,SAAS,WACpC,kBAAkBH,KAAKG,SAAS,cAChC,qBAAqBH,KAAKG,SAAS,iBACnC,qBAAqBH,KAAKG,SAAS,mBACnC,kBAAkBH,KAAKG,SAAS,gBAChC,wBAAwBH,KAAKG,SAAS,aACtC,mBAAmBH,KAAKG,SAAS,iBACjC,sBAAsBH,KAAKG,SAAS,mBAATA;AAGrB,WAAAO;AAAAA,oBACWC,EAASJ,CAAAA,CAAAA;AAAAA;AAAAA;AAAAA;AAAAA,EAAQ;AAnGOK;AAAAA,EAAA,CAA1CC,EAAS,EAAEV,MAAMW,QAAQC,SAAAA,GAhCdpB,CAAAA,CAAAA,GAAAA,EAgC+BqB,WAAA,QAAA,CAa/BJ,GAAAA,EAAA,CAAXC,EAAAA,CAAAA,GA7CWlB,EA6CAqB,WAAA,WAAA,CAAA,GAaZJ,EAAA,CAFCK,EAAQ,EAAEC,SAASC,EAAAA,CAAAA,GACnBN,EAzDWlB,CAAAA,GAAAA,EA0DZqB,WAAA,QAAA,CAU2CJ,GAAAA,EAAA,CAA1CC,EAAS,EAAEV,MAAMiB,QAAQL,SAAAA,GApEdpB,CAAAA,CAAAA,GAAAA,EAoE+BqB,WAAA,aAAA,CASCJ,GAAAA,EAAA,CAA3CC,EAAS,EAAEV,MAAMkB,SAASN,SAAAA,GA7EfpB,CAAAA,CAAAA,GAAAA,EA6EgCqB,WAAA,YAAA,CA7EhCrB,GAAAA,IAANiB,EAAA,CADNU,EAAc,kBAAA,CAAA,GACF3B;"}
|
package/dist/surface.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./surface-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./surface-BHP347Uc.cjs");Object.defineProperty(exports,"SchmancySurface",{enumerable:!0,get:()=>e.SchmancySurface});
|
|
2
2
|
//# sourceMappingURL=surface.cjs.map
|
package/dist/surface.js
CHANGED
package/dist/teleport.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CV4IxBHf.cjs");exports.HereMorty=e.HereMorty,Object.defineProperty(exports,"SchmancyTeleportation",{enumerable:!0,get:()=>e.SchmancyTeleportation}),exports.WhereAreYouRicky=e.WhereAreYouRicky,exports.teleport=e.teleport;
|
|
2
2
|
//# sourceMappingURL=teleport.cjs.map
|