@vielzeug/refine 2.2.3 → 2.2.5
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/accordion.cjs +1 -1
- package/dist/accordion.cjs.map +1 -1
- package/dist/accordion.js +2 -2
- package/dist/accordion.js.map +1 -1
- package/dist/carousel.cjs +25 -24
- package/dist/carousel.cjs.map +1 -1
- package/dist/carousel.js +125 -135
- package/dist/carousel.js.map +1 -1
- package/dist/combobox.cjs +14 -14
- package/dist/combobox.cjs.map +1 -1
- package/dist/combobox.js +88 -98
- package/dist/combobox.js.map +1 -1
- package/dist/content/carousel/carousel.d.ts.map +1 -1
- package/dist/content/list/_list-item-reveal.cjs +1 -1
- package/dist/content/list/_list-item-reveal.cjs.map +1 -1
- package/dist/content/list/_list-item-reveal.d.ts +3 -3
- package/dist/content/list/_list-item-reveal.d.ts.map +1 -1
- package/dist/content/list/_list-item-reveal.js +22 -22
- package/dist/content/list/_list-item-reveal.js.map +1 -1
- package/dist/content/list/list-item.d.ts.map +1 -1
- package/dist/core/focus.cjs +1 -1
- package/dist/core/focus.cjs.map +1 -1
- package/dist/core/focus.d.ts.map +1 -1
- package/dist/core/focus.js +21 -20
- package/dist/core/focus.js.map +1 -1
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/nav.cjs +1 -1
- package/dist/core/nav.cjs.map +1 -1
- package/dist/core/nav.d.ts +3 -62
- package/dist/core/nav.d.ts.map +1 -1
- package/dist/core/nav.js +41 -124
- package/dist/core/nav.js.map +1 -1
- package/dist/core/option-list.cjs +1 -1
- package/dist/core/option-list.cjs.map +1 -1
- package/dist/core/option-list.d.ts +5 -5
- package/dist/core/option-list.d.ts.map +1 -1
- package/dist/core/option-list.js +14 -13
- package/dist/core/option-list.js.map +1 -1
- package/dist/core/overlay.cjs +1 -1
- package/dist/core/overlay.cjs.map +1 -1
- package/dist/core/overlay.d.ts +0 -8
- package/dist/core/overlay.d.ts.map +1 -1
- package/dist/core/overlay.js +1 -3
- package/dist/core/overlay.js.map +1 -1
- package/dist/custom-elements.json +3823 -3918
- package/dist/drawer.cjs +6 -6
- package/dist/drawer.cjs.map +1 -1
- package/dist/drawer.js +65 -75
- package/dist/drawer.js.map +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -4
- package/dist/errors.js.map +1 -1
- package/dist/feedback/skeleton/skeleton.d.ts.map +1 -1
- package/dist/feedback/toast/toast.d.ts.map +1 -1
- package/dist/grid.cjs +2 -2
- package/dist/grid.cjs.map +1 -1
- package/dist/grid.js +42 -41
- package/dist/grid.js.map +1 -1
- package/dist/layout/grid/grid.d.ts.map +1 -1
- package/dist/layout/navbar/navbar.d.ts.map +1 -1
- package/dist/layout/sidebar/sidebar.d.ts.map +1 -1
- package/dist/list-item.cjs +2 -6
- package/dist/list-item.cjs.map +1 -1
- package/dist/list-item.js +40 -39
- package/dist/list-item.js.map +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.cjs.map +1 -1
- package/dist/list.js +2 -2
- package/dist/list.js.map +1 -1
- package/dist/menu.cjs +5 -5
- package/dist/menu.cjs.map +1 -1
- package/dist/menu.js +59 -59
- package/dist/menu.js.map +1 -1
- package/dist/navbar.cjs +9 -9
- package/dist/navbar.cjs.map +1 -1
- package/dist/navbar.js +124 -116
- package/dist/navbar.js.map +1 -1
- package/dist/otp-input.cjs +1 -1
- package/dist/otp-input.cjs.map +1 -1
- package/dist/otp-input.js +2 -2
- package/dist/otp-input.js.map +1 -1
- package/dist/overlay/drawer/drawer.d.ts.map +1 -1
- package/dist/overlay/menu/menu.d.ts.map +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.cjs.map +1 -1
- package/dist/radio-group.js +2 -3
- package/dist/radio-group.js.map +1 -1
- package/dist/radio.cjs +1 -1
- package/dist/radio.cjs.map +1 -1
- package/dist/radio.js +2 -3
- package/dist/radio.js.map +1 -1
- package/dist/refine.cjs +188 -195
- package/dist/refine.cjs.map +1 -1
- package/dist/refine.iife.js +212 -219
- package/dist/refine.iife.js.map +1 -1
- package/dist/refine.js +392 -399
- package/dist/refine.js.map +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.cjs.map +1 -1
- package/dist/select.js +1 -0
- package/dist/select.js.map +1 -1
- package/dist/sidebar.cjs +16 -16
- package/dist/sidebar.cjs.map +1 -1
- package/dist/sidebar.js +106 -91
- package/dist/sidebar.js.map +1 -1
- package/dist/skeleton.cjs +3 -3
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +8 -7
- package/dist/skeleton.js.map +1 -1
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.cjs.map +1 -1
- package/dist/stepper.js +3 -3
- package/dist/stepper.js.map +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.cjs.map +1 -1
- package/dist/tabs.js +4 -5
- package/dist/tabs.js.map +1 -1
- package/dist/toast.cjs +13 -17
- package/dist/toast.cjs.map +1 -1
- package/dist/toast.js +86 -85
- package/dist/toast.js.map +1 -1
- package/package.json +11 -8
- package/dist/core/swipe.cjs +0 -2
- package/dist/core/swipe.cjs.map +0 -1
- package/dist/core/swipe.d.ts +0 -40
- package/dist/core/swipe.d.ts.map +0 -1
- package/dist/core/swipe.js +0 -63
- package/dist/core/swipe.js.map +0 -1
- package/dist/core/typeahead.cjs +0 -2
- package/dist/core/typeahead.cjs.map +0 -1
- package/dist/core/typeahead.d.ts +0 -53
- package/dist/core/typeahead.d.ts.map +0 -1
- package/dist/core/typeahead.js +0 -23
- package/dist/core/typeahead.js.map +0 -1
package/dist/drawer.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./styles/mixins/theme.css.cjs"),n=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./styles/mixins/theme.css.cjs"),n=require("./overlay/shared/use-dialog.cjs"),r=require("./overlay/drawer/drawer.css.cjs");let i=require("@vielzeug/ore"),a=require("@vielzeug/ripple"),o=require("@vielzeug/gesture");var s=e=>e==null?void 0:e===``||e===`true`,c={bottom:{axis:`y`,closingDistance:e=>Math.max(0,e),translate:e=>`translateY(${e}px)`},left:{axis:`x`,closingDistance:e=>Math.max(0,-e),translate:e=>`translateX(${e}px)`},right:{axis:`x`,closingDistance:e=>Math.max(0,e),translate:e=>`translateX(${e}px)`},top:{axis:`y`,closingDistance:e=>Math.max(0,-e),translate:e=>`translateY(${e}px)`}},l=`ore-drawer`;(0,i.define)(l,{props:{backdrop:i.prop.string(),"default-open":i.prop.bool(!1),dismissible:i.prop.bool(!0),"drag-handle-placement":i.prop.oneOf([`outside`,`inset`],`outside`),"initial-focus":i.prop.string(),label:i.prop.string(),open:{default:void 0,parse:s},persistent:i.prop.bool(!1),placement:i.prop.oneOf([`left`,`right`,`top`,`bottom`],`right`),"return-focus":i.prop.bool(!0),size:i.prop.string(),title:i.prop.string()},setup(e){let t=(0,i.getHost)(),r=(0,i.useEmit)(),s=(0,i.useSlots)(),l=(0,i.createStableId)(`drawer-label`),u=(0,i.ref)(),d=(0,i.ref)(),f=(0,a.signal)(!1),p,m,h=()=>e.label.value??e.title.value??``,g=()=>s.has(`header`).value||!!h(),_=()=>g()||e.dismissible.value,v=()=>s.has(`footer`).value,y=()=>e.placement.value||`right`,b=()=>c[y()],x=(e,t)=>{let n=t===`x`?e.offsetWidth:e.offsetHeight;return Math.min(96,Math.max(36,n*.18))},S=(e,t)=>b().closingDistance(e)>=t,C=e=>{if(!f.value)return;m&&=(clearTimeout(m),void 0);let t=u.value;if(!t){f.value=!1;return}t.style.transition=`none`,e.style.opacity=`0`,e.style.visibility=`hidden`,t.offsetWidth,A(`swipe`)},w=(e,t,n)=>{if(f.value)return;f.value=!0;let r=t.axis===`x`?e.offsetWidth:e.offsetHeight,i=n>=0?Math.max(n,r):Math.min(n,-r),a=t.translate(i);e.style.transition=`transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease-out`,e.offsetWidth;let o=t=>{t.target===e&&t.propertyName===`transform`&&(e.removeEventListener(`transitionend`,o),C(e))};e.addEventListener(`transitionend`,o);let s=parseFloat(getComputedStyle(e).transitionDuration)*1e3;m=setTimeout(()=>{e.removeEventListener(`transitionend`,o),C(e)},s+50),e.style.transform=a,e.style.opacity=`0.2`},T=e=>{m&&=(clearTimeout(m),void 0),e.style.transition=``,e.style.transform=``,e.style.opacity=``,e.style.visibility=``,f.value=!1},E=({distance:e,reason:t})=>{let n=d.value;if(!n)return;let r=x(n,b().axis);if(t===`release`&&S(e,r)){w(n,b(),e);return}T(n)},{closeWithAnimation:D,handleCancel:O,overlay:k,requestClose:A,watchOpenProp:j}=n.useDialogControl({beforeOpen:e=>{let t=d.value;t&&T(t)},closeRequestDetail:t=>({placement:e.placement.value??`right`}),defaultOpen:e[`default-open`],dialogRef:u,getPanelEl:()=>d.value,host:t,initialFocus:e[`initial-focus`],isPersistent:()=>!!e.persistent.value,onCleanup:i.onCleanup,onEvent:i.onEvent,onNativeClose:e=>{let t=d.value;t&&e!==`swipe`&&T(t);let n=u.value;n&&(n.style.transition=``),r(`open-change`,{open:!1,reason:e})},onOpen:e=>r(`open-change`,{open:!0,reason:e}),openProp:e.open,performClose:(e,t)=>{t===`swipe`?e.close():D()},returnFocus:e[`return-focus`]});return(0,i.onMounted)(()=>{let n=u.value;if(!n)return;let r=t;r.show=()=>{k.open(`programmatic`)},r.hide=()=>{k.close(`programmatic`)},j(),(0,i.onEvent)(n,`cancel`,O),(0,i.onEvent)(n,`click`,t=>{e.persistent.value||p?.active||f.value||t.target===n&&A(`outsideClick`)});let a=d.value?.querySelector(`[part="drag-handle"]`);return a&&(p=(0,o.createPanGesture)(a,{axis:()=>b().axis,disabled:()=>f.value,onEnd:E,onMove:({distance:e})=>{let t=d.value;if(!t)return;let n=b(),r=x(t,n.axis),i=n.closingDistance(e),a=Math.min(i/r,1);t.style.transition=`none`,t.style.transform=n.translate(e),t.style.opacity=String(1-a*.4)}})),()=>{p?.dispose(),p=void 0,k.dispose()}}),i.html`
|
|
2
2
|
<dialog
|
|
3
3
|
ref=${u}
|
|
4
4
|
aria-modal="true"
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
6
6
|
aria-labelledby="${()=>e.label.value?null:l}">
|
|
7
7
|
<div class="panel" part="panel" ref=${d}>
|
|
8
8
|
<div class="drag-handle" part="drag-handle" aria-label="Drag to close" role="button"></div>
|
|
9
|
-
<div class="header" part="header" ?hidden=${()=>!
|
|
10
|
-
<span class="header-title" id="${l}" ?hidden=${()=>!
|
|
11
|
-
<slot name="header">${()=>
|
|
9
|
+
<div class="header" part="header" ?hidden=${()=>!_()}>
|
|
10
|
+
<span class="header-title" id="${l}" ?hidden=${()=>!g()}>
|
|
11
|
+
<slot name="header">${()=>h()}</slot>
|
|
12
12
|
</span>
|
|
13
13
|
<button
|
|
14
14
|
class="close-btn"
|
|
@@ -23,10 +23,10 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
23
23
|
<div class="body" part="body">
|
|
24
24
|
<slot></slot>
|
|
25
25
|
</div>
|
|
26
|
-
<div class="footer" part="footer" ?hidden=${()=>!
|
|
26
|
+
<div class="footer" part="footer" ?hidden=${()=>!v()}>
|
|
27
27
|
<slot name="footer"></slot>
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
30
|
</dialog>
|
|
31
|
-
`},styles:[t.forcedColorsMixin,e.coarsePointerMixin,e.reducedMotionMixin,
|
|
31
|
+
`},styles:[t.forcedColorsMixin,e.coarsePointerMixin,e.reducedMotionMixin,r.default]}),exports.DRAWER_TAG=l;
|
|
32
32
|
//# sourceMappingURL=drawer.cjs.map
|
package/dist/drawer.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.cjs","names":[],"sources":["../src/overlay/drawer/drawer.ts"],"sourcesContent":["import {\n createStableId,\n define,\n getHost,\n html,\n onCleanup,\n onEvent,\n onMounted,\n prop,\n ref,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { signal } from '@vielzeug/ripple';\n\nimport type { OverlayOpenChangeDetail, SwipeAxis } from '../../core';\n\nimport { createSwipeControl } from '../../core';\nimport '../../content/icon/icon';\nimport { coarsePointerMixin, forcedColorsMixin, reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport styles from './drawer.css?inline';\n\ntype DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';\ntype DrawerSize = 'sm' | 'lg' | 'full';\ntype DrawerBackdrop = 'opaque' | 'blur' | 'transparent';\ntype DrawerDragHandlePlacement = 'outside' | 'inset';\ntype DrawerSwipeConfig = {\n axis: SwipeAxis;\n closingDistance: (distance: number) => number;\n translate: (distance: number) => string;\n};\n\nconst parseOptionalBool = (value: string | null): boolean | undefined =>\n value == null ? undefined : value === '' || value === 'true';\n\nconst drawerSwipeConfig: Record<DrawerPlacement, DrawerSwipeConfig> = {\n bottom: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n left: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n right: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n top: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n};\n\n/** Element interface exposing the imperative API for `ore-drawer`. */\nexport interface DrawerElement extends HTMLElement, Omit<OreDrawerProps, 'title'> {\n /** Programmatically close the drawer with the exit animation. */\n hide(): void;\n /** Programmatically open the drawer. Equivalent to setting `open`. */\n show(): void;\n}\n\n/** Drawer component properties */\n\nexport type OreDrawerEvents = {\n 'open-change': OverlayOpenChangeDetail;\n};\n\nexport type OreDrawerProps = {\n /** Backdrop style — 'opaque' (default), 'blur', or 'transparent' */\n backdrop?: DrawerBackdrop;\n /** Initial uncontrolled open state. Ignored when `open` is set. */\n 'default-open'?: boolean;\n /** Show the close (×) button in the header (default: true) */\n dismissible?: boolean;\n /** Drag handle position used for swipe-to-close gestures */\n 'drag-handle-placement'?: DrawerDragHandlePlacement;\n /**\n * CSS selector for the element inside the drawer that should receive focus on open.\n * Defaults to native dialog focus management (first focusable element).\n * @example '#submit-btn' | 'input[name=\"email\"]'\n */\n 'initial-focus'?: string;\n /**\n * Invisible accessible label for the dialog (`aria-label`).\n * Use when the drawer has no visible title (e.g. image-only content).\n * When omitted, `aria-labelledby` points to the visible header title instead.\n */\n label?: string;\n /** Controlled open state */\n open?: boolean;\n /** When true, backdrop clicks do not close the drawer (default: false) */\n persistent?: boolean;\n /** Side from which the drawer slides in */\n placement?: DrawerPlacement;\n /**\n * When true (default), focus returns to the triggering element after the drawer closes.\n * Set to false to manage focus manually.\n */\n 'return-focus'?: boolean;\n /** Drawer width/height preset */\n size?: DrawerSize;\n /**\n * Visible title text rendered inside the header.\n * Used as the dialog's accessible label via `aria-labelledby` when `label` is not set.\n */\n title?: string;\n};\n\n/**\n * A panel that slides in from any edge of the screen, built on the native `<dialog>` element.\n *\n * @element ore-drawer\n *\n * @attr {boolean} open - Controlled open state\n * @attr {boolean} default-open - Initial uncontrolled open state\n * @attr {string} placement - 'left' | 'right' (default) | 'top' | 'bottom'\n * @attr {string} size - 'sm' | 'lg' | 'full'\n * @attr {string} title - Visible header title text\n * @attr {string} label - Invisible aria-label (for drawers without a visible title)\n * @attr {boolean} dismissible - Show the close (×) button (default: true)\n * @attr {string} drag-handle-placement - 'outside' (default) | 'inset'\n * @attr {string} backdrop - Backdrop style: 'opaque' (default) | 'blur' | 'transparent'\n * @attr {boolean} persistent - Prevent backdrop-click from closing (default: false)\n *\n * @fires open-change - When the drawer state changes. detail: { open, reason }\n *\n * @slot header - Drawer header content\n * @slot - Main body content\n * @slot footer - Drawer footer content\n *\n * @cssprop --drawer-backdrop-bg - Backdrop background color\n * @cssprop --drawer-bg - Panel background color\n * @cssprop --drawer-size - Panel width (horizontal) or height (vertical)\n * @cssprop --drawer-shadow - Panel box-shadow\n * @cssprop --drawer-panel-blur - Panel backdrop blur amount\n *\n * @part drag-handle - Drawer drag handle.\n * @part panel - Panel container.\n * @part header - Header container.\n * @part close-btn - Close button.\n * @part body - Body content container.\n * @part footer - Footer container.\n * @example\n * ```html\n * <!-- With visible title -->\n * <ore-drawer open title=\"Settings\" placement=\"right\">\n * <p>Settings content here.</p>\n * </ore-drawer>\n *\n * <!-- With custom header slot -->\n * <ore-drawer open placement=\"right\">\n * <span slot=\"header\">Settings</span>\n * <p>Settings content here.</p>\n * </ore-drawer>\n * ```\n */\n\nexport const DRAWER_TAG = 'ore-drawer' as const;\ndefine<OreDrawerProps>(DRAWER_TAG, {\n props: {\n backdrop: prop.string<DrawerBackdrop>(),\n 'default-open': prop.bool(false),\n dismissible: prop.bool(true),\n 'drag-handle-placement': prop.oneOf(['outside', 'inset'] as const, 'outside'),\n 'initial-focus': prop.string(),\n label: prop.string(),\n open: { default: undefined as boolean | undefined, parse: parseOptionalBool },\n persistent: prop.bool(false),\n placement: prop.oneOf(['left', 'right', 'top', 'bottom'] as const, 'right'),\n 'return-focus': prop.bool(true),\n size: prop.string<DrawerSize>(),\n title: prop.string(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreDrawerEvents>();\n const slots = useSlots();\n\n const drawerLabelId = createStableId('drawer-label');\n const dialogRef = ref<HTMLDialogElement>();\n const panelRef = ref<HTMLDivElement>();\n\n // Drag-to-close state\n const isSwipeClosing = signal(false);\n let swipeCloseTimer: ReturnType<typeof setTimeout> | undefined;\n\n const getHeaderText = () => props.label.value ?? props.title.value ?? '';\n const hasHeaderTitle = () => slots.has('header').value || !!getHeaderText();\n\n // Header is visible when there is slot content, a text label, or a close button.\n const hasHeader = () => hasHeaderTitle() || props.dismissible.value;\n const hasFooter = () => slots.has('footer').value;\n\n const getPlacement = (): DrawerPlacement => props.placement.value || 'right';\n\n const getSwipeConfig = (): DrawerSwipeConfig => drawerSwipeConfig[getPlacement()];\n\n const getSnapThreshold = (panel: HTMLElement, axis: SwipeAxis) => {\n const panelSize = axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n\n return Math.min(96, Math.max(36, panelSize * 0.18));\n };\n\n const shouldCommitSwipeClose = (distance: number, threshold: number) => {\n return getSwipeConfig().closingDistance(distance) >= threshold;\n };\n\n const finalizeSwipeClose = (panel: HTMLElement) => {\n if (!isSwipeClosing.value) return;\n\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n const dialog = dialogRef.value;\n\n if (!dialog) {\n isSwipeClosing.value = false;\n\n return;\n }\n\n dialog.style.transition = 'none';\n panel.style.opacity = '0';\n panel.style.visibility = 'hidden';\n void dialog.offsetWidth;\n\n requestClose('swipe');\n };\n\n const startSwipeClose = (panel: HTMLElement, swipe: DrawerSwipeConfig, committedDistance: number) => {\n if (isSwipeClosing.value) return;\n\n isSwipeClosing.value = true;\n\n const panelSize = swipe.axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n // Preserve overshoot so closing continues from the dragged position instead of snapping back.\n const exitDistance =\n committedDistance >= 0 ? Math.max(committedDistance, panelSize) : Math.min(committedDistance, -panelSize);\n const exitTransform = swipe.translate(exitDistance);\n\n // Commit the current drag position first so the magnetic snap continues\n // from the finger instead of jumping back to rest.\n panel.style.transition = 'transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease-out';\n void panel.offsetWidth;\n\n const onExitTransitionEnd = (ev: TransitionEvent) => {\n if (ev.target !== panel || ev.propertyName !== 'transform') return;\n\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n };\n\n panel.addEventListener('transitionend', onExitTransitionEnd);\n\n const durationMs = parseFloat(getComputedStyle(panel).transitionDuration) * 1000;\n\n swipeCloseTimer = setTimeout(() => {\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n }, durationMs + 50);\n\n panel.style.transform = exitTransform;\n panel.style.opacity = '0.2';\n };\n\n const resetPanelDragStyles = (panel: HTMLElement) => {\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n // Re-enable transitions so the snap-back or exit animates.\n panel.style.transition = '';\n panel.style.transform = '';\n panel.style.opacity = '';\n panel.style.visibility = '';\n isSwipeClosing.value = false;\n };\n\n // Same \"snap back or commit close\" decision whether the swipe was\n // interrupted by the platform (onCancel) or simply released without an\n // intervening move event crossing the threshold (onRelease).\n const handleSwipeRelease = ({ distance, threshold }: { distance: number; threshold: number }): void => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n // If the release event crosses the threshold (without an intervening\n // move event), commit close instead of snapping back to rest first.\n if (shouldCommitSwipeClose(distance, threshold)) {\n startSwipeClose(panel, getSwipeConfig(), distance);\n\n return;\n }\n\n resetPanelDragStyles(panel);\n };\n\n const swipe = createSwipeControl({\n axis: () => getSwipeConfig().axis,\n disabled: isSwipeClosing,\n onCancel: handleSwipeRelease,\n onCommit: ({ distance }) => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n startSwipeClose(panel, getSwipeConfig(), distance);\n },\n onMove: ({ distance, threshold }) => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n const swipeConfig = getSwipeConfig();\n const closingDistance = swipeConfig.closingDistance(distance);\n const progress = Math.min(closingDistance / threshold, 1);\n\n // Kill CSS transitions so the panel tracks the finger instantly.\n panel.style.transition = 'none';\n panel.style.transform = swipeConfig.translate(distance);\n panel.style.opacity = String(1 - progress * 0.4);\n },\n onRelease: handleSwipeRelease,\n shouldCommit: ({ distance, threshold }) => shouldCommitSwipeClose(distance, threshold),\n threshold: () => {\n const panel = panelRef.value;\n\n if (!panel) return 48;\n\n return getSnapThreshold(panel, getSwipeConfig().axis);\n },\n });\n\n // ────────────────────────────────────────────────────────────────\n // Overlay State Management\n // ────────────────────────────────────────────────────────────────\n\n const { closeWithAnimation, handleCancel, overlay, requestClose, watchOpenProp } = useDialogControl({\n beforeOpen: (dialog) => {\n // Clear any inline drag styles from a previous swipe-close so the CSS\n // entry animation starts from the correct base state.\n const panel = panelRef.value;\n\n if (panel) resetPanelDragStyles(panel);\n\n void dialog;\n },\n closeRequestDetail: (_reason) => ({ placement: props.placement.value ?? 'right' }),\n defaultOpen: props['default-open'],\n dialogRef,\n getPanelEl: () => panelRef.value,\n host: el,\n initialFocus: props['initial-focus'],\n isPersistent: () => Boolean(props.persistent.value),\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n const panelEl = panelRef.value;\n\n // For swipe-close, keep the panel hidden and off-screen until the next\n // open cycle — resetting inline styles during native close can produce\n // a visible frame at the rest position on some browsers.\n if (panelEl && reason !== 'swipe') resetPanelDragStyles(panelEl);\n\n const dialog = dialogRef.value;\n\n if (dialog) dialog.style.transition = '';\n\n emit('open-change', { open: false, reason });\n },\n onOpen: (reason) => emit('open-change', { open: true, reason }),\n openProp: props.open,\n performClose: (dialog, reason) => {\n if (reason === 'swipe') {\n dialog.close();\n } else {\n closeWithAnimation();\n }\n },\n returnFocus: props['return-focus'],\n });\n\n const handleCloseButtonClick = () => {\n requestClose('trigger');\n };\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle: Setup Drawer Integration\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const dialog = dialogRef.value;\n\n if (!dialog) return;\n\n // Expose imperative API\n const drawerEl = el as DrawerElement;\n\n drawerEl.show = () => {\n overlay.open('programmatic');\n };\n\n drawerEl.hide = () => {\n overlay.close('programmatic');\n };\n\n // ────────────────────────────────────────────────────────────\n // Event Handlers: Cancel, Backdrop Click\n // ────────────────────────────────────────────────────────────\n // `handleCancel` (Escape via the native `cancel` event) is provided by\n // `useDialogControl` above — drawer only needs its own backdrop-click\n // handler since it has swipe-to-dismiss logic the shared dialog helper\n // doesn't know about.\n\n const handleBackdropClick = (e: MouseEvent) => {\n if (props.persistent.value) return;\n\n if (swipe.isActive() || isSwipeClosing.value) return;\n\n if (e.target !== dialog) return; // Click inside panel\n\n requestClose('outsideClick');\n };\n\n watchOpenProp();\n\n onEvent(dialog, 'cancel', handleCancel);\n onEvent(dialog, 'click', handleBackdropClick);\n\n // Drag-to-close handlers — scoped to the handle element only so interactions\n // with panel content don't accidentally start a drag.\n const panel = panelRef.value;\n const dragHandleEl = panel?.querySelector<HTMLElement>('[part=\"drag-handle\"]');\n\n if (dragHandleEl) {\n onEvent(dragHandleEl, 'pointerdown', swipe.handlePointerDown);\n onEvent(dragHandleEl, 'pointermove', swipe.handlePointerMove);\n onEvent(dragHandleEl, 'pointerup', swipe.handlePointerUp);\n onEvent(dragHandleEl, 'pointercancel', swipe.handlePointerCancel);\n }\n\n return () => {\n overlay.dispose();\n };\n });\n\n return html`\n <dialog\n ref=${dialogRef}\n aria-modal=\"true\"\n aria-label=\"${() => props.label.value ?? null}\"\n aria-labelledby=\"${() => (!props.label.value ? drawerLabelId : null)}\">\n <div class=\"panel\" part=\"panel\" ref=${panelRef}>\n <div class=\"drag-handle\" part=\"drag-handle\" aria-label=\"Drag to close\" role=\"button\"></div>\n <div class=\"header\" part=\"header\" ?hidden=${() => !hasHeader()}>\n <span class=\"header-title\" id=\"${drawerLabelId}\" ?hidden=${() => !hasHeaderTitle()}>\n <slot name=\"header\">${() => getHeaderText()}</slot>\n </span>\n <button\n class=\"close-btn\"\n part=\"close-btn\"\n type=\"button\"\n aria-label=\"Close\"\n ?hidden=${() => !props.dismissible.value}\n @click=${handleCloseButtonClick}>\n <ore-icon name=\"x\" size=\"16\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </div>\n <div class=\"body\" part=\"body\">\n <slot></slot>\n </div>\n <div class=\"footer\" part=\"footer\" ?hidden=${() => !hasFooter()}>\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [forcedColorsMixin, coarsePointerMixin, reducedMotionMixin, styles],\n});\n"],"mappings":"4VAiCA,IAAM,EAAqB,GACzB,GAAS,KAAO,IAAA,GAAY,IAAU,IAAM,IAAU,OAElD,EAAgE,CACpE,OAAQ,CACN,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAQ,EACnD,UAAY,GAAa,cAAc,EAAS,IAClD,EACA,KAAM,CACJ,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAC,CAAQ,EACpD,UAAY,GAAa,cAAc,EAAS,IAClD,EACA,MAAO,CACL,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAQ,EACnD,UAAY,GAAa,cAAc,EAAS,IAClD,EACA,IAAK,CACH,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAC,CAAQ,EACpD,UAAY,GAAa,cAAc,EAAS,IAClD,CACF,EA0Ga,EAAa,cAC1B,EAAA,EAAA,OAAA,CAAuB,EAAY,CACjC,MAAO,CACL,SAAU,EAAA,KAAK,OAAuB,EACtC,eAAgB,EAAA,KAAK,KAAK,EAAK,EAC/B,YAAa,EAAA,KAAK,KAAK,EAAI,EAC3B,wBAAyB,EAAA,KAAK,MAAM,CAAC,UAAW,OAAO,EAAY,SAAS,EAC5E,gBAAiB,EAAA,KAAK,OAAO,EAC7B,MAAO,EAAA,KAAK,OAAO,EACnB,KAAM,CAAE,QAAS,IAAA,GAAkC,MAAO,CAAkB,EAC5E,WAAY,EAAA,KAAK,KAAK,EAAK,EAC3B,UAAW,EAAA,KAAK,MAAM,CAAC,OAAQ,QAAS,MAAO,QAAQ,EAAY,OAAO,EAC1E,eAAgB,EAAA,KAAK,KAAK,EAAI,EAC9B,KAAM,EAAA,KAAK,O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Ac,CAC7B,EAEA,EAAS,SAAa,CACpB,EAAQ,MAAM,cAAc,CAC9B,EAoBA,EAAc,GAEd,EAAA,EAAA,QAAA,CAAQ,EAAQ,SAAU,CAAY,GACtC,EAAA,EAAA,QAAA,CAAQ,EAAQ,QAba,GAAkB,CACzC,EAAM,WAAW,OAEjB,EAAM,SAAS,GAAK,EAAe,OAEnC,EAAE,SAAW,GAEjB,EAAa,cAAc,CAC7B,CAK4C,EAK5C,IAAM,EADQ,EAAS,OACK,cAA2B,sBAAsB,EAS7E,OAPI,KACF,EAAA,EAAA,QAAA,CAAQ,EAAc,cAAe,EAAM,iBAAiB,GAC5D,EAAA,EAAA,QAAA,CAAQ,EAAc,cAAe,EAAM,iBAAiB,GAC5D,EAAA,EAAA,QAAA,CAAQ,EAAc,YAAa,EAAM,eAAe,GACxD,EAAA,EAAA,QAAA,CAAQ,EAAc,gBAAiB,EAAM,mBAAmB,OAGrD,CACX,EAAQ,QAAQ,CAClB,CACF,CAAC,EAEM,EAAA,IAAI;;cAED,EAAU;;0BAEI,EAAM,MAAM,OAAS,KAAK;+BACnB,EAAM,MAAM,MAAwB,KAAhB,EAAsB;8CAC/B,EAAS;;0DAEK,CAAC,EAAU,EAAE;6CAC5B,EAAc,gBAAkB,CAAC,EAAe,EAAE;wCACrD,EAAc,EAAE;;;;;;;4BAO5B,CAAC,EAAM,YAAY,MAAM;2BAjFd,CACnC,EAAa,SAAS,CACxB,EAgF0C;;;;;;;0DAOc,CAAC,EAAU,EAAE;;;;;KAMvE,EACA,OAAQ,CAAC,EAAA,kBAAmB,EAAA,mBAAoB,EAAA,mBAAoB,EAAA,OAAM,CAC5E,CAAC"}
|
|
1
|
+
{"version":3,"file":"drawer.cjs","names":[],"sources":["../src/overlay/drawer/drawer.ts"],"sourcesContent":["import { createPanGesture, type PanAxis, type PanGesture, type PanGestureEndDetail } from '@vielzeug/gesture';\nimport {\n createStableId,\n define,\n getHost,\n html,\n onCleanup,\n onEvent,\n onMounted,\n prop,\n ref,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { signal } from '@vielzeug/ripple';\n\nimport type { OverlayOpenChangeDetail } from '../../core';\nimport '../../content/icon/icon';\nimport { coarsePointerMixin, forcedColorsMixin, reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport styles from './drawer.css?inline';\n\ntype DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';\ntype DrawerSize = 'sm' | 'lg' | 'full';\ntype DrawerBackdrop = 'opaque' | 'blur' | 'transparent';\ntype DrawerDragHandlePlacement = 'outside' | 'inset';\ntype DrawerSwipeConfig = {\n axis: PanAxis;\n closingDistance: (distance: number) => number;\n translate: (distance: number) => string;\n};\n\nconst parseOptionalBool = (value: string | null): boolean | undefined =>\n value == null ? undefined : value === '' || value === 'true';\n\nconst drawerSwipeConfig: Record<DrawerPlacement, DrawerSwipeConfig> = {\n bottom: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n left: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n right: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n top: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n};\n\n/** Element interface exposing the imperative API for `ore-drawer`. */\nexport interface DrawerElement extends HTMLElement, Omit<OreDrawerProps, 'title'> {\n /** Programmatically close the drawer with the exit animation. */\n hide(): void;\n /** Programmatically open the drawer. Equivalent to setting `open`. */\n show(): void;\n}\n\n/** Drawer component properties */\n\nexport type OreDrawerEvents = {\n 'open-change': OverlayOpenChangeDetail;\n};\n\nexport type OreDrawerProps = {\n /** Backdrop style — 'opaque' (default), 'blur', or 'transparent' */\n backdrop?: DrawerBackdrop;\n /** Initial uncontrolled open state. Ignored when `open` is set. */\n 'default-open'?: boolean;\n /** Show the close (×) button in the header (default: true) */\n dismissible?: boolean;\n /** Drag handle position used for swipe-to-close gestures */\n 'drag-handle-placement'?: DrawerDragHandlePlacement;\n /**\n * CSS selector for the element inside the drawer that should receive focus on open.\n * Defaults to native dialog focus management (first focusable element).\n * @example '#submit-btn' | 'input[name=\"email\"]'\n */\n 'initial-focus'?: string;\n /**\n * Invisible accessible label for the dialog (`aria-label`).\n * Use when the drawer has no visible title (e.g. image-only content).\n * When omitted, `aria-labelledby` points to the visible header title instead.\n */\n label?: string;\n /** Controlled open state */\n open?: boolean;\n /** When true, backdrop clicks do not close the drawer (default: false) */\n persistent?: boolean;\n /** Side from which the drawer slides in */\n placement?: DrawerPlacement;\n /**\n * When true (default), focus returns to the triggering element after the drawer closes.\n * Set to false to manage focus manually.\n */\n 'return-focus'?: boolean;\n /** Drawer width/height preset */\n size?: DrawerSize;\n /**\n * Visible title text rendered inside the header.\n * Used as the dialog's accessible label via `aria-labelledby` when `label` is not set.\n */\n title?: string;\n};\n\n/**\n * A panel that slides in from any edge of the screen, built on the native `<dialog>` element.\n *\n * @element ore-drawer\n *\n * @attr {boolean} open - Controlled open state\n * @attr {boolean} default-open - Initial uncontrolled open state\n * @attr {string} placement - 'left' | 'right' (default) | 'top' | 'bottom'\n * @attr {string} size - 'sm' | 'lg' | 'full'\n * @attr {string} title - Visible header title text\n * @attr {string} label - Invisible aria-label (for drawers without a visible title)\n * @attr {boolean} dismissible - Show the close (×) button (default: true)\n * @attr {string} drag-handle-placement - 'outside' (default) | 'inset'\n * @attr {string} backdrop - Backdrop style: 'opaque' (default) | 'blur' | 'transparent'\n * @attr {boolean} persistent - Prevent backdrop-click from closing (default: false)\n *\n * @fires open-change - When the drawer state changes. detail: { open, reason }\n *\n * @slot header - Drawer header content\n * @slot - Main body content\n * @slot footer - Drawer footer content\n *\n * @cssprop --drawer-backdrop-bg - Backdrop background color\n * @cssprop --drawer-bg - Panel background color\n * @cssprop --drawer-size - Panel width (horizontal) or height (vertical)\n * @cssprop --drawer-shadow - Panel box-shadow\n * @cssprop --drawer-panel-blur - Panel backdrop blur amount\n *\n * @part drag-handle - Drawer drag handle.\n * @part panel - Panel container.\n * @part header - Header container.\n * @part close-btn - Close button.\n * @part body - Body content container.\n * @part footer - Footer container.\n * @example\n * ```html\n * <!-- With visible title -->\n * <ore-drawer open title=\"Settings\" placement=\"right\">\n * <p>Settings content here.</p>\n * </ore-drawer>\n *\n * <!-- With custom header slot -->\n * <ore-drawer open placement=\"right\">\n * <span slot=\"header\">Settings</span>\n * <p>Settings content here.</p>\n * </ore-drawer>\n * ```\n */\n\nexport const DRAWER_TAG = 'ore-drawer' as const;\ndefine<OreDrawerProps>(DRAWER_TAG, {\n props: {\n backdrop: prop.string<DrawerBackdrop>(),\n 'default-open': prop.bool(false),\n dismissible: prop.bool(true),\n 'drag-handle-placement': prop.oneOf(['outside', 'inset'] as const, 'outside'),\n 'initial-focus': prop.string(),\n label: prop.string(),\n open: { default: undefined as boolean | undefined, parse: parseOptionalBool },\n persistent: prop.bool(false),\n placement: prop.oneOf(['left', 'right', 'top', 'bottom'] as const, 'right'),\n 'return-focus': prop.bool(true),\n size: prop.string<DrawerSize>(),\n title: prop.string(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreDrawerEvents>();\n const slots = useSlots();\n\n const drawerLabelId = createStableId('drawer-label');\n const dialogRef = ref<HTMLDialogElement>();\n const panelRef = ref<HTMLDivElement>();\n\n // Drag-to-close state\n const isSwipeClosing = signal(false);\n let swipe: PanGesture | undefined;\n let swipeCloseTimer: ReturnType<typeof setTimeout> | undefined;\n\n const getHeaderText = () => props.label.value ?? props.title.value ?? '';\n const hasHeaderTitle = () => slots.has('header').value || !!getHeaderText();\n\n // Header is visible when there is slot content, a text label, or a close button.\n const hasHeader = () => hasHeaderTitle() || props.dismissible.value;\n const hasFooter = () => slots.has('footer').value;\n\n const getPlacement = (): DrawerPlacement => props.placement.value || 'right';\n\n const getSwipeConfig = (): DrawerSwipeConfig => drawerSwipeConfig[getPlacement()];\n\n const getSnapThreshold = (panel: HTMLElement, axis: PanAxis) => {\n const panelSize = axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n\n return Math.min(96, Math.max(36, panelSize * 0.18));\n };\n\n const shouldCommitSwipeClose = (distance: number, threshold: number) => {\n return getSwipeConfig().closingDistance(distance) >= threshold;\n };\n\n const finalizeSwipeClose = (panel: HTMLElement) => {\n if (!isSwipeClosing.value) return;\n\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n const dialog = dialogRef.value;\n\n if (!dialog) {\n isSwipeClosing.value = false;\n\n return;\n }\n\n dialog.style.transition = 'none';\n panel.style.opacity = '0';\n panel.style.visibility = 'hidden';\n void dialog.offsetWidth;\n\n requestClose('swipe');\n };\n\n const startSwipeClose = (panel: HTMLElement, swipe: DrawerSwipeConfig, committedDistance: number) => {\n if (isSwipeClosing.value) return;\n\n isSwipeClosing.value = true;\n\n const panelSize = swipe.axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n // Preserve overshoot so closing continues from the dragged position instead of snapping back.\n const exitDistance =\n committedDistance >= 0 ? Math.max(committedDistance, panelSize) : Math.min(committedDistance, -panelSize);\n const exitTransform = swipe.translate(exitDistance);\n\n // Commit the current drag position first so the magnetic snap continues\n // from the finger instead of jumping back to rest.\n panel.style.transition = 'transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease-out';\n void panel.offsetWidth;\n\n const onExitTransitionEnd = (ev: TransitionEvent) => {\n if (ev.target !== panel || ev.propertyName !== 'transform') return;\n\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n };\n\n panel.addEventListener('transitionend', onExitTransitionEnd);\n\n const durationMs = parseFloat(getComputedStyle(panel).transitionDuration) * 1000;\n\n swipeCloseTimer = setTimeout(() => {\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n }, durationMs + 50);\n\n panel.style.transform = exitTransform;\n panel.style.opacity = '0.2';\n };\n\n const resetPanelDragStyles = (panel: HTMLElement) => {\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n // Re-enable transitions so the snap-back or exit animates.\n panel.style.transition = '';\n panel.style.transform = '';\n panel.style.opacity = '';\n panel.style.visibility = '';\n isSwipeClosing.value = false;\n };\n\n const handleSwipeEnd = ({ distance, reason }: PanGestureEndDetail): void => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n const threshold = getSnapThreshold(panel, getSwipeConfig().axis);\n\n if (reason === 'release' && shouldCommitSwipeClose(distance, threshold)) {\n startSwipeClose(panel, getSwipeConfig(), distance);\n\n return;\n }\n\n resetPanelDragStyles(panel);\n };\n\n // ────────────────────────────────────────────────────────────────\n // Overlay State Management\n // ────────────────────────────────────────────────────────────────\n\n const { closeWithAnimation, handleCancel, overlay, requestClose, watchOpenProp } = useDialogControl({\n beforeOpen: (dialog) => {\n // Clear any inline drag styles from a previous swipe-close so the CSS\n // entry animation starts from the correct base state.\n const panel = panelRef.value;\n\n if (panel) resetPanelDragStyles(panel);\n\n void dialog;\n },\n closeRequestDetail: (_reason) => ({ placement: props.placement.value ?? 'right' }),\n defaultOpen: props['default-open'],\n dialogRef,\n getPanelEl: () => panelRef.value,\n host: el,\n initialFocus: props['initial-focus'],\n isPersistent: () => Boolean(props.persistent.value),\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n const panelEl = panelRef.value;\n\n // For swipe-close, keep the panel hidden and off-screen until the next\n // open cycle — resetting inline styles during native close can produce\n // a visible frame at the rest position on some browsers.\n if (panelEl && reason !== 'swipe') resetPanelDragStyles(panelEl);\n\n const dialog = dialogRef.value;\n\n if (dialog) dialog.style.transition = '';\n\n emit('open-change', { open: false, reason });\n },\n onOpen: (reason) => emit('open-change', { open: true, reason }),\n openProp: props.open,\n performClose: (dialog, reason) => {\n if (reason === 'swipe') {\n dialog.close();\n } else {\n closeWithAnimation();\n }\n },\n returnFocus: props['return-focus'],\n });\n\n const handleCloseButtonClick = () => {\n requestClose('trigger');\n };\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle: Setup Drawer Integration\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const dialog = dialogRef.value;\n\n if (!dialog) return;\n\n // Expose imperative API\n const drawerEl = el as DrawerElement;\n\n drawerEl.show = () => {\n overlay.open('programmatic');\n };\n\n drawerEl.hide = () => {\n overlay.close('programmatic');\n };\n\n // ────────────────────────────────────────────────────────────\n // Event Handlers: Cancel, Backdrop Click\n // ────────────────────────────────────────────────────────────\n // `handleCancel` (Escape via the native `cancel` event) is provided by\n // `useDialogControl` above — drawer only needs its own backdrop-click\n // handler since it has swipe-to-dismiss logic the shared dialog helper\n // doesn't know about.\n\n const handleBackdropClick = (e: MouseEvent) => {\n if (props.persistent.value) return;\n\n if (swipe?.active || isSwipeClosing.value) return;\n\n if (e.target !== dialog) return; // Click inside panel\n\n requestClose('outsideClick');\n };\n\n watchOpenProp();\n\n onEvent(dialog, 'cancel', handleCancel);\n onEvent(dialog, 'click', handleBackdropClick);\n\n // Drag-to-close handlers — scoped to the handle element only so interactions\n // with panel content don't accidentally start a drag.\n const panel = panelRef.value;\n const dragHandleEl = panel?.querySelector<HTMLElement>('[part=\"drag-handle\"]');\n\n if (dragHandleEl) {\n swipe = createPanGesture(dragHandleEl, {\n axis: () => getSwipeConfig().axis,\n disabled: () => isSwipeClosing.value,\n onEnd: handleSwipeEnd,\n onMove: ({ distance }) => {\n const currentPanel = panelRef.value;\n\n if (!currentPanel) return;\n\n const swipeConfig = getSwipeConfig();\n const threshold = getSnapThreshold(currentPanel, swipeConfig.axis);\n const closingDistance = swipeConfig.closingDistance(distance);\n const progress = Math.min(closingDistance / threshold, 1);\n\n currentPanel.style.transition = 'none';\n currentPanel.style.transform = swipeConfig.translate(distance);\n currentPanel.style.opacity = String(1 - progress * 0.4);\n },\n });\n }\n\n return () => {\n swipe?.dispose();\n swipe = undefined;\n overlay.dispose();\n };\n });\n\n return html`\n <dialog\n ref=${dialogRef}\n aria-modal=\"true\"\n aria-label=\"${() => props.label.value ?? null}\"\n aria-labelledby=\"${() => (!props.label.value ? drawerLabelId : null)}\">\n <div class=\"panel\" part=\"panel\" ref=${panelRef}>\n <div class=\"drag-handle\" part=\"drag-handle\" aria-label=\"Drag to close\" role=\"button\"></div>\n <div class=\"header\" part=\"header\" ?hidden=${() => !hasHeader()}>\n <span class=\"header-title\" id=\"${drawerLabelId}\" ?hidden=${() => !hasHeaderTitle()}>\n <slot name=\"header\">${() => getHeaderText()}</slot>\n </span>\n <button\n class=\"close-btn\"\n part=\"close-btn\"\n type=\"button\"\n aria-label=\"Close\"\n ?hidden=${() => !props.dismissible.value}\n @click=${handleCloseButtonClick}>\n <ore-icon name=\"x\" size=\"16\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </div>\n <div class=\"body\" part=\"body\">\n <slot></slot>\n </div>\n <div class=\"footer\" part=\"footer\" ?hidden=${() => !hasFooter()}>\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [forcedColorsMixin, coarsePointerMixin, reducedMotionMixin, styles],\n});\n"],"mappings":"6VAgCA,IAAM,EAAqB,GACzB,GAAS,KAAO,IAAA,GAAY,IAAU,IAAM,IAAU,OAElD,EAAgE,CACpE,OAAQ,CACN,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAQ,EACnD,UAAY,GAAa,cAAc,EAAS,IAClD,EACA,KAAM,CACJ,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAC,CAAQ,EACpD,UAAY,GAAa,cAAc,EAAS,IAClD,EACA,MAAO,CACL,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAQ,EACnD,UAAY,GAAa,cAAc,EAAS,IAClD,EACA,IAAK,CACH,KAAM,IACN,gBAAkB,GAAa,KAAK,IAAI,EAAG,CAAC,C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BAAoB,EAAA,mBAAoB,EAAA,OAAM,CAC5E,CAAC"}
|
package/dist/drawer.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { coarsePointerMixin as e, reducedMotionMixin as t } from "./styles/mixins/accessibility.css.js";
|
|
2
2
|
import { forcedColorsMixin as n } from "./styles/mixins/theme.css.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import a from "
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { useDialogControl as r } from "./overlay/shared/use-dialog.js";
|
|
4
|
+
import i from "./overlay/drawer/drawer.css.js";
|
|
5
|
+
import { createStableId as a, define as o, getHost as s, html as c, onCleanup as l, onEvent as u, onMounted as d, prop as f, ref as p, useEmit as m, useSlots as h } from "@vielzeug/ore";
|
|
6
|
+
import { signal as g } from "@vielzeug/ripple";
|
|
7
|
+
import { createPanGesture as _ } from "@vielzeug/gesture";
|
|
8
8
|
//#region src/overlay/drawer/drawer.ts
|
|
9
9
|
var v = (e) => e == null ? void 0 : e === "" || e === "true", y = {
|
|
10
10
|
bottom: {
|
|
@@ -28,104 +28,84 @@ var v = (e) => e == null ? void 0 : e === "" || e === "true", y = {
|
|
|
28
28
|
translate: (e) => `translateY(${e}px)`
|
|
29
29
|
}
|
|
30
30
|
}, b = "ore-drawer";
|
|
31
|
-
|
|
31
|
+
o(b, {
|
|
32
32
|
props: {
|
|
33
|
-
backdrop:
|
|
34
|
-
"default-open":
|
|
35
|
-
dismissible:
|
|
36
|
-
"drag-handle-placement":
|
|
37
|
-
"initial-focus":
|
|
38
|
-
label:
|
|
33
|
+
backdrop: f.string(),
|
|
34
|
+
"default-open": f.bool(!1),
|
|
35
|
+
dismissible: f.bool(!0),
|
|
36
|
+
"drag-handle-placement": f.oneOf(["outside", "inset"], "outside"),
|
|
37
|
+
"initial-focus": f.string(),
|
|
38
|
+
label: f.string(),
|
|
39
39
|
open: {
|
|
40
40
|
default: void 0,
|
|
41
41
|
parse: v
|
|
42
42
|
},
|
|
43
|
-
persistent:
|
|
44
|
-
placement:
|
|
43
|
+
persistent: f.bool(!1),
|
|
44
|
+
placement: f.oneOf([
|
|
45
45
|
"left",
|
|
46
46
|
"right",
|
|
47
47
|
"top",
|
|
48
48
|
"bottom"
|
|
49
49
|
], "right"),
|
|
50
|
-
"return-focus":
|
|
51
|
-
size:
|
|
52
|
-
title:
|
|
50
|
+
"return-focus": f.bool(!0),
|
|
51
|
+
size: f.string(),
|
|
52
|
+
title: f.string()
|
|
53
53
|
},
|
|
54
54
|
setup(e) {
|
|
55
|
-
let t =
|
|
55
|
+
let t = s(), n = m(), i = h(), o = a("drawer-label"), f = p(), v = p(), b = g(!1), x, S, C = () => e.label.value ?? e.title.value ?? "", w = () => i.has("header").value || !!C(), T = () => w() || e.dismissible.value, E = () => i.has("footer").value, D = () => e.placement.value || "right", O = () => y[D()], k = (e, t) => {
|
|
56
56
|
let n = t === "x" ? e.offsetWidth : e.offsetHeight;
|
|
57
57
|
return Math.min(96, Math.max(36, n * .18));
|
|
58
|
-
},
|
|
58
|
+
}, A = (e, t) => O().closingDistance(e) >= t, j = (e) => {
|
|
59
59
|
if (!b.value) return;
|
|
60
|
-
|
|
61
|
-
let t =
|
|
60
|
+
S &&= (clearTimeout(S), void 0);
|
|
61
|
+
let t = f.value;
|
|
62
62
|
if (!t) {
|
|
63
63
|
b.value = !1;
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
t.style.transition = "none", e.style.opacity = "0", e.style.visibility = "hidden", t.offsetWidth, R("swipe");
|
|
67
|
-
},
|
|
67
|
+
}, M = (e, t, n) => {
|
|
68
68
|
if (b.value) return;
|
|
69
69
|
b.value = !0;
|
|
70
70
|
let r = t.axis === "x" ? e.offsetWidth : e.offsetHeight, i = n >= 0 ? Math.max(n, r) : Math.min(n, -r), a = t.translate(i);
|
|
71
71
|
e.style.transition = "transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease-out", e.offsetWidth;
|
|
72
72
|
let o = (t) => {
|
|
73
|
-
t.target === e && t.propertyName === "transform" && (e.removeEventListener("transitionend", o),
|
|
73
|
+
t.target === e && t.propertyName === "transform" && (e.removeEventListener("transitionend", o), j(e));
|
|
74
74
|
};
|
|
75
75
|
e.addEventListener("transitionend", o);
|
|
76
76
|
let s = parseFloat(getComputedStyle(e).transitionDuration) * 1e3;
|
|
77
|
-
|
|
78
|
-
e.removeEventListener("transitionend", o),
|
|
77
|
+
S = setTimeout(() => {
|
|
78
|
+
e.removeEventListener("transitionend", o), j(e);
|
|
79
79
|
}, s + 50), e.style.transform = a, e.style.opacity = "0.2";
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
},
|
|
80
|
+
}, N = (e) => {
|
|
81
|
+
S &&= (clearTimeout(S), void 0), e.style.transition = "", e.style.transform = "", e.style.opacity = "", e.style.visibility = "", b.value = !1;
|
|
82
|
+
}, P = ({ distance: e, reason: t }) => {
|
|
83
83
|
let n = v.value;
|
|
84
|
-
if (n)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
M(n);
|
|
90
|
-
}
|
|
91
|
-
}, P = r({
|
|
92
|
-
axis: () => D().axis,
|
|
93
|
-
disabled: b,
|
|
94
|
-
onCancel: N,
|
|
95
|
-
onCommit: ({ distance: e }) => {
|
|
96
|
-
let t = v.value;
|
|
97
|
-
t && j(t, D(), e);
|
|
98
|
-
},
|
|
99
|
-
onMove: ({ distance: e, threshold: t }) => {
|
|
100
|
-
let n = v.value;
|
|
101
|
-
if (!n) return;
|
|
102
|
-
let r = D(), i = r.closingDistance(e), a = Math.min(i / t, 1);
|
|
103
|
-
n.style.transition = "none", n.style.transform = r.translate(e), n.style.opacity = String(1 - a * .4);
|
|
104
|
-
},
|
|
105
|
-
onRelease: N,
|
|
106
|
-
shouldCommit: ({ distance: e, threshold: t }) => k(e, t),
|
|
107
|
-
threshold: () => {
|
|
108
|
-
let e = v.value;
|
|
109
|
-
return e ? O(e, D().axis) : 48;
|
|
84
|
+
if (!n) return;
|
|
85
|
+
let r = k(n, O().axis);
|
|
86
|
+
if (t === "release" && A(e, r)) {
|
|
87
|
+
M(n, O(), e);
|
|
88
|
+
return;
|
|
110
89
|
}
|
|
111
|
-
|
|
90
|
+
N(n);
|
|
91
|
+
}, { closeWithAnimation: F, handleCancel: I, overlay: L, requestClose: R, watchOpenProp: z } = r({
|
|
112
92
|
beforeOpen: (e) => {
|
|
113
93
|
let t = v.value;
|
|
114
|
-
t &&
|
|
94
|
+
t && N(t);
|
|
115
95
|
},
|
|
116
96
|
closeRequestDetail: (t) => ({ placement: e.placement.value ?? "right" }),
|
|
117
97
|
defaultOpen: e["default-open"],
|
|
118
|
-
dialogRef:
|
|
98
|
+
dialogRef: f,
|
|
119
99
|
getPanelEl: () => v.value,
|
|
120
100
|
host: t,
|
|
121
101
|
initialFocus: e["initial-focus"],
|
|
122
102
|
isPersistent: () => !!e.persistent.value,
|
|
123
|
-
onCleanup:
|
|
124
|
-
onEvent:
|
|
103
|
+
onCleanup: l,
|
|
104
|
+
onEvent: u,
|
|
125
105
|
onNativeClose: (e) => {
|
|
126
106
|
let t = v.value;
|
|
127
|
-
t && e !== "swipe" &&
|
|
128
|
-
let r =
|
|
107
|
+
t && e !== "swipe" && N(t);
|
|
108
|
+
let r = f.value;
|
|
129
109
|
r && (r.style.transition = ""), n("open-change", {
|
|
130
110
|
open: !1,
|
|
131
111
|
reason: e
|
|
@@ -141,32 +121,42 @@ s(b, {
|
|
|
141
121
|
},
|
|
142
122
|
returnFocus: e["return-focus"]
|
|
143
123
|
});
|
|
144
|
-
return
|
|
145
|
-
let n =
|
|
124
|
+
return d(() => {
|
|
125
|
+
let n = f.value;
|
|
146
126
|
if (!n) return;
|
|
147
127
|
let r = t;
|
|
148
128
|
r.show = () => {
|
|
149
129
|
L.open("programmatic");
|
|
150
130
|
}, r.hide = () => {
|
|
151
131
|
L.close("programmatic");
|
|
152
|
-
}, z(),
|
|
153
|
-
e.persistent.value ||
|
|
132
|
+
}, z(), u(n, "cancel", I), u(n, "click", (t) => {
|
|
133
|
+
e.persistent.value || x?.active || b.value || t.target === n && R("outsideClick");
|
|
154
134
|
});
|
|
155
135
|
let i = v.value?.querySelector("[part=\"drag-handle\"]");
|
|
156
|
-
return i && (
|
|
157
|
-
|
|
136
|
+
return i && (x = _(i, {
|
|
137
|
+
axis: () => O().axis,
|
|
138
|
+
disabled: () => b.value,
|
|
139
|
+
onEnd: P,
|
|
140
|
+
onMove: ({ distance: e }) => {
|
|
141
|
+
let t = v.value;
|
|
142
|
+
if (!t) return;
|
|
143
|
+
let n = O(), r = k(t, n.axis), i = n.closingDistance(e), a = Math.min(i / r, 1);
|
|
144
|
+
t.style.transition = "none", t.style.transform = n.translate(e), t.style.opacity = String(1 - a * .4);
|
|
145
|
+
}
|
|
146
|
+
})), () => {
|
|
147
|
+
x?.dispose(), x = void 0, L.dispose();
|
|
158
148
|
};
|
|
159
|
-
}),
|
|
149
|
+
}), c`
|
|
160
150
|
<dialog
|
|
161
|
-
ref=${
|
|
151
|
+
ref=${f}
|
|
162
152
|
aria-modal="true"
|
|
163
153
|
aria-label="${() => e.label.value ?? null}"
|
|
164
|
-
aria-labelledby="${() => e.label.value ? null :
|
|
154
|
+
aria-labelledby="${() => e.label.value ? null : o}">
|
|
165
155
|
<div class="panel" part="panel" ref=${v}>
|
|
166
156
|
<div class="drag-handle" part="drag-handle" aria-label="Drag to close" role="button"></div>
|
|
167
|
-
<div class="header" part="header" ?hidden=${() => !
|
|
168
|
-
<span class="header-title" id="${
|
|
169
|
-
<slot name="header">${() =>
|
|
157
|
+
<div class="header" part="header" ?hidden=${() => !T()}>
|
|
158
|
+
<span class="header-title" id="${o}" ?hidden=${() => !w()}>
|
|
159
|
+
<slot name="header">${() => C()}</slot>
|
|
170
160
|
</span>
|
|
171
161
|
<button
|
|
172
162
|
class="close-btn"
|
|
@@ -183,7 +173,7 @@ s(b, {
|
|
|
183
173
|
<div class="body" part="body">
|
|
184
174
|
<slot></slot>
|
|
185
175
|
</div>
|
|
186
|
-
<div class="footer" part="footer" ?hidden=${() => !
|
|
176
|
+
<div class="footer" part="footer" ?hidden=${() => !E()}>
|
|
187
177
|
<slot name="footer"></slot>
|
|
188
178
|
</div>
|
|
189
179
|
</div>
|
|
@@ -194,7 +184,7 @@ s(b, {
|
|
|
194
184
|
n,
|
|
195
185
|
e,
|
|
196
186
|
t,
|
|
197
|
-
|
|
187
|
+
i
|
|
198
188
|
]
|
|
199
189
|
});
|
|
200
190
|
//#endregion
|
package/dist/drawer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":[],"sources":["../src/overlay/drawer/drawer.ts"],"sourcesContent":["import {\n createStableId,\n define,\n getHost,\n html,\n onCleanup,\n onEvent,\n onMounted,\n prop,\n ref,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { signal } from '@vielzeug/ripple';\n\nimport type { OverlayOpenChangeDetail, SwipeAxis } from '../../core';\n\nimport { createSwipeControl } from '../../core';\nimport '../../content/icon/icon';\nimport { coarsePointerMixin, forcedColorsMixin, reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport styles from './drawer.css?inline';\n\ntype DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';\ntype DrawerSize = 'sm' | 'lg' | 'full';\ntype DrawerBackdrop = 'opaque' | 'blur' | 'transparent';\ntype DrawerDragHandlePlacement = 'outside' | 'inset';\ntype DrawerSwipeConfig = {\n axis: SwipeAxis;\n closingDistance: (distance: number) => number;\n translate: (distance: number) => string;\n};\n\nconst parseOptionalBool = (value: string | null): boolean | undefined =>\n value == null ? undefined : value === '' || value === 'true';\n\nconst drawerSwipeConfig: Record<DrawerPlacement, DrawerSwipeConfig> = {\n bottom: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n left: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n right: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n top: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n};\n\n/** Element interface exposing the imperative API for `ore-drawer`. */\nexport interface DrawerElement extends HTMLElement, Omit<OreDrawerProps, 'title'> {\n /** Programmatically close the drawer with the exit animation. */\n hide(): void;\n /** Programmatically open the drawer. Equivalent to setting `open`. */\n show(): void;\n}\n\n/** Drawer component properties */\n\nexport type OreDrawerEvents = {\n 'open-change': OverlayOpenChangeDetail;\n};\n\nexport type OreDrawerProps = {\n /** Backdrop style — 'opaque' (default), 'blur', or 'transparent' */\n backdrop?: DrawerBackdrop;\n /** Initial uncontrolled open state. Ignored when `open` is set. */\n 'default-open'?: boolean;\n /** Show the close (×) button in the header (default: true) */\n dismissible?: boolean;\n /** Drag handle position used for swipe-to-close gestures */\n 'drag-handle-placement'?: DrawerDragHandlePlacement;\n /**\n * CSS selector for the element inside the drawer that should receive focus on open.\n * Defaults to native dialog focus management (first focusable element).\n * @example '#submit-btn' | 'input[name=\"email\"]'\n */\n 'initial-focus'?: string;\n /**\n * Invisible accessible label for the dialog (`aria-label`).\n * Use when the drawer has no visible title (e.g. image-only content).\n * When omitted, `aria-labelledby` points to the visible header title instead.\n */\n label?: string;\n /** Controlled open state */\n open?: boolean;\n /** When true, backdrop clicks do not close the drawer (default: false) */\n persistent?: boolean;\n /** Side from which the drawer slides in */\n placement?: DrawerPlacement;\n /**\n * When true (default), focus returns to the triggering element after the drawer closes.\n * Set to false to manage focus manually.\n */\n 'return-focus'?: boolean;\n /** Drawer width/height preset */\n size?: DrawerSize;\n /**\n * Visible title text rendered inside the header.\n * Used as the dialog's accessible label via `aria-labelledby` when `label` is not set.\n */\n title?: string;\n};\n\n/**\n * A panel that slides in from any edge of the screen, built on the native `<dialog>` element.\n *\n * @element ore-drawer\n *\n * @attr {boolean} open - Controlled open state\n * @attr {boolean} default-open - Initial uncontrolled open state\n * @attr {string} placement - 'left' | 'right' (default) | 'top' | 'bottom'\n * @attr {string} size - 'sm' | 'lg' | 'full'\n * @attr {string} title - Visible header title text\n * @attr {string} label - Invisible aria-label (for drawers without a visible title)\n * @attr {boolean} dismissible - Show the close (×) button (default: true)\n * @attr {string} drag-handle-placement - 'outside' (default) | 'inset'\n * @attr {string} backdrop - Backdrop style: 'opaque' (default) | 'blur' | 'transparent'\n * @attr {boolean} persistent - Prevent backdrop-click from closing (default: false)\n *\n * @fires open-change - When the drawer state changes. detail: { open, reason }\n *\n * @slot header - Drawer header content\n * @slot - Main body content\n * @slot footer - Drawer footer content\n *\n * @cssprop --drawer-backdrop-bg - Backdrop background color\n * @cssprop --drawer-bg - Panel background color\n * @cssprop --drawer-size - Panel width (horizontal) or height (vertical)\n * @cssprop --drawer-shadow - Panel box-shadow\n * @cssprop --drawer-panel-blur - Panel backdrop blur amount\n *\n * @part drag-handle - Drawer drag handle.\n * @part panel - Panel container.\n * @part header - Header container.\n * @part close-btn - Close button.\n * @part body - Body content container.\n * @part footer - Footer container.\n * @example\n * ```html\n * <!-- With visible title -->\n * <ore-drawer open title=\"Settings\" placement=\"right\">\n * <p>Settings content here.</p>\n * </ore-drawer>\n *\n * <!-- With custom header slot -->\n * <ore-drawer open placement=\"right\">\n * <span slot=\"header\">Settings</span>\n * <p>Settings content here.</p>\n * </ore-drawer>\n * ```\n */\n\nexport const DRAWER_TAG = 'ore-drawer' as const;\ndefine<OreDrawerProps>(DRAWER_TAG, {\n props: {\n backdrop: prop.string<DrawerBackdrop>(),\n 'default-open': prop.bool(false),\n dismissible: prop.bool(true),\n 'drag-handle-placement': prop.oneOf(['outside', 'inset'] as const, 'outside'),\n 'initial-focus': prop.string(),\n label: prop.string(),\n open: { default: undefined as boolean | undefined, parse: parseOptionalBool },\n persistent: prop.bool(false),\n placement: prop.oneOf(['left', 'right', 'top', 'bottom'] as const, 'right'),\n 'return-focus': prop.bool(true),\n size: prop.string<DrawerSize>(),\n title: prop.string(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreDrawerEvents>();\n const slots = useSlots();\n\n const drawerLabelId = createStableId('drawer-label');\n const dialogRef = ref<HTMLDialogElement>();\n const panelRef = ref<HTMLDivElement>();\n\n // Drag-to-close state\n const isSwipeClosing = signal(false);\n let swipeCloseTimer: ReturnType<typeof setTimeout> | undefined;\n\n const getHeaderText = () => props.label.value ?? props.title.value ?? '';\n const hasHeaderTitle = () => slots.has('header').value || !!getHeaderText();\n\n // Header is visible when there is slot content, a text label, or a close button.\n const hasHeader = () => hasHeaderTitle() || props.dismissible.value;\n const hasFooter = () => slots.has('footer').value;\n\n const getPlacement = (): DrawerPlacement => props.placement.value || 'right';\n\n const getSwipeConfig = (): DrawerSwipeConfig => drawerSwipeConfig[getPlacement()];\n\n const getSnapThreshold = (panel: HTMLElement, axis: SwipeAxis) => {\n const panelSize = axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n\n return Math.min(96, Math.max(36, panelSize * 0.18));\n };\n\n const shouldCommitSwipeClose = (distance: number, threshold: number) => {\n return getSwipeConfig().closingDistance(distance) >= threshold;\n };\n\n const finalizeSwipeClose = (panel: HTMLElement) => {\n if (!isSwipeClosing.value) return;\n\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n const dialog = dialogRef.value;\n\n if (!dialog) {\n isSwipeClosing.value = false;\n\n return;\n }\n\n dialog.style.transition = 'none';\n panel.style.opacity = '0';\n panel.style.visibility = 'hidden';\n void dialog.offsetWidth;\n\n requestClose('swipe');\n };\n\n const startSwipeClose = (panel: HTMLElement, swipe: DrawerSwipeConfig, committedDistance: number) => {\n if (isSwipeClosing.value) return;\n\n isSwipeClosing.value = true;\n\n const panelSize = swipe.axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n // Preserve overshoot so closing continues from the dragged position instead of snapping back.\n const exitDistance =\n committedDistance >= 0 ? Math.max(committedDistance, panelSize) : Math.min(committedDistance, -panelSize);\n const exitTransform = swipe.translate(exitDistance);\n\n // Commit the current drag position first so the magnetic snap continues\n // from the finger instead of jumping back to rest.\n panel.style.transition = 'transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease-out';\n void panel.offsetWidth;\n\n const onExitTransitionEnd = (ev: TransitionEvent) => {\n if (ev.target !== panel || ev.propertyName !== 'transform') return;\n\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n };\n\n panel.addEventListener('transitionend', onExitTransitionEnd);\n\n const durationMs = parseFloat(getComputedStyle(panel).transitionDuration) * 1000;\n\n swipeCloseTimer = setTimeout(() => {\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n }, durationMs + 50);\n\n panel.style.transform = exitTransform;\n panel.style.opacity = '0.2';\n };\n\n const resetPanelDragStyles = (panel: HTMLElement) => {\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n // Re-enable transitions so the snap-back or exit animates.\n panel.style.transition = '';\n panel.style.transform = '';\n panel.style.opacity = '';\n panel.style.visibility = '';\n isSwipeClosing.value = false;\n };\n\n // Same \"snap back or commit close\" decision whether the swipe was\n // interrupted by the platform (onCancel) or simply released without an\n // intervening move event crossing the threshold (onRelease).\n const handleSwipeRelease = ({ distance, threshold }: { distance: number; threshold: number }): void => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n // If the release event crosses the threshold (without an intervening\n // move event), commit close instead of snapping back to rest first.\n if (shouldCommitSwipeClose(distance, threshold)) {\n startSwipeClose(panel, getSwipeConfig(), distance);\n\n return;\n }\n\n resetPanelDragStyles(panel);\n };\n\n const swipe = createSwipeControl({\n axis: () => getSwipeConfig().axis,\n disabled: isSwipeClosing,\n onCancel: handleSwipeRelease,\n onCommit: ({ distance }) => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n startSwipeClose(panel, getSwipeConfig(), distance);\n },\n onMove: ({ distance, threshold }) => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n const swipeConfig = getSwipeConfig();\n const closingDistance = swipeConfig.closingDistance(distance);\n const progress = Math.min(closingDistance / threshold, 1);\n\n // Kill CSS transitions so the panel tracks the finger instantly.\n panel.style.transition = 'none';\n panel.style.transform = swipeConfig.translate(distance);\n panel.style.opacity = String(1 - progress * 0.4);\n },\n onRelease: handleSwipeRelease,\n shouldCommit: ({ distance, threshold }) => shouldCommitSwipeClose(distance, threshold),\n threshold: () => {\n const panel = panelRef.value;\n\n if (!panel) return 48;\n\n return getSnapThreshold(panel, getSwipeConfig().axis);\n },\n });\n\n // ────────────────────────────────────────────────────────────────\n // Overlay State Management\n // ────────────────────────────────────────────────────────────────\n\n const { closeWithAnimation, handleCancel, overlay, requestClose, watchOpenProp } = useDialogControl({\n beforeOpen: (dialog) => {\n // Clear any inline drag styles from a previous swipe-close so the CSS\n // entry animation starts from the correct base state.\n const panel = panelRef.value;\n\n if (panel) resetPanelDragStyles(panel);\n\n void dialog;\n },\n closeRequestDetail: (_reason) => ({ placement: props.placement.value ?? 'right' }),\n defaultOpen: props['default-open'],\n dialogRef,\n getPanelEl: () => panelRef.value,\n host: el,\n initialFocus: props['initial-focus'],\n isPersistent: () => Boolean(props.persistent.value),\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n const panelEl = panelRef.value;\n\n // For swipe-close, keep the panel hidden and off-screen until the next\n // open cycle — resetting inline styles during native close can produce\n // a visible frame at the rest position on some browsers.\n if (panelEl && reason !== 'swipe') resetPanelDragStyles(panelEl);\n\n const dialog = dialogRef.value;\n\n if (dialog) dialog.style.transition = '';\n\n emit('open-change', { open: false, reason });\n },\n onOpen: (reason) => emit('open-change', { open: true, reason }),\n openProp: props.open,\n performClose: (dialog, reason) => {\n if (reason === 'swipe') {\n dialog.close();\n } else {\n closeWithAnimation();\n }\n },\n returnFocus: props['return-focus'],\n });\n\n const handleCloseButtonClick = () => {\n requestClose('trigger');\n };\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle: Setup Drawer Integration\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const dialog = dialogRef.value;\n\n if (!dialog) return;\n\n // Expose imperative API\n const drawerEl = el as DrawerElement;\n\n drawerEl.show = () => {\n overlay.open('programmatic');\n };\n\n drawerEl.hide = () => {\n overlay.close('programmatic');\n };\n\n // ────────────────────────────────────────────────────────────\n // Event Handlers: Cancel, Backdrop Click\n // ────────────────────────────────────────────────────────────\n // `handleCancel` (Escape via the native `cancel` event) is provided by\n // `useDialogControl` above — drawer only needs its own backdrop-click\n // handler since it has swipe-to-dismiss logic the shared dialog helper\n // doesn't know about.\n\n const handleBackdropClick = (e: MouseEvent) => {\n if (props.persistent.value) return;\n\n if (swipe.isActive() || isSwipeClosing.value) return;\n\n if (e.target !== dialog) return; // Click inside panel\n\n requestClose('outsideClick');\n };\n\n watchOpenProp();\n\n onEvent(dialog, 'cancel', handleCancel);\n onEvent(dialog, 'click', handleBackdropClick);\n\n // Drag-to-close handlers — scoped to the handle element only so interactions\n // with panel content don't accidentally start a drag.\n const panel = panelRef.value;\n const dragHandleEl = panel?.querySelector<HTMLElement>('[part=\"drag-handle\"]');\n\n if (dragHandleEl) {\n onEvent(dragHandleEl, 'pointerdown', swipe.handlePointerDown);\n onEvent(dragHandleEl, 'pointermove', swipe.handlePointerMove);\n onEvent(dragHandleEl, 'pointerup', swipe.handlePointerUp);\n onEvent(dragHandleEl, 'pointercancel', swipe.handlePointerCancel);\n }\n\n return () => {\n overlay.dispose();\n };\n });\n\n return html`\n <dialog\n ref=${dialogRef}\n aria-modal=\"true\"\n aria-label=\"${() => props.label.value ?? null}\"\n aria-labelledby=\"${() => (!props.label.value ? drawerLabelId : null)}\">\n <div class=\"panel\" part=\"panel\" ref=${panelRef}>\n <div class=\"drag-handle\" part=\"drag-handle\" aria-label=\"Drag to close\" role=\"button\"></div>\n <div class=\"header\" part=\"header\" ?hidden=${() => !hasHeader()}>\n <span class=\"header-title\" id=\"${drawerLabelId}\" ?hidden=${() => !hasHeaderTitle()}>\n <slot name=\"header\">${() => getHeaderText()}</slot>\n </span>\n <button\n class=\"close-btn\"\n part=\"close-btn\"\n type=\"button\"\n aria-label=\"Close\"\n ?hidden=${() => !props.dismissible.value}\n @click=${handleCloseButtonClick}>\n <ore-icon name=\"x\" size=\"16\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </div>\n <div class=\"body\" part=\"body\">\n <slot></slot>\n </div>\n <div class=\"footer\" part=\"footer\" ?hidden=${() => !hasFooter()}>\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [forcedColorsMixin, coarsePointerMixin, reducedMotionMixin, styles],\n});\n"],"mappings":";;;;;;;;AAiCA,IAAM,KAAqB,MACzB,KAAS,OAAO,KAAA,IAAY,MAAU,MAAM,MAAU,QAElD,IAAgE;CACpE,QAAQ;EACN,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAQ;EACnD,YAAY,MAAa,cAAc,EAAS;CAClD;CACA,MAAM;EACJ,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAC,CAAQ;EACpD,YAAY,MAAa,cAAc,EAAS;CAClD;CACA,OAAO;EACL,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAQ;EACnD,YAAY,MAAa,cAAc,EAAS;CAClD;CACA,KAAK;EACH,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAC,CAAQ;EACpD,YAAY,MAAa,cAAc,EAAS;CAClD;AACF,GA0Ga,IAAa;AAC1B,EAAuB,GAAY;CACjC,OAAO;EACL,UAAU,EAAK,OAAuB;EACtC,gBAAgB,EAAK,KAAK,EAAK;EAC/B,aAAa,EAAK,KAAK,EAAI;EAC3B,yBAAyB,EAAK,MAAM,CAAC,WAAW,OAAO,GAAY,SAAS;EAC5E,iBAAiB,E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,OAxDA,QAAgB;GACd,IAAM,IAAS,EAAU;GAEzB,IAAI,CAAC,GAAQ;GAGb,IAAM,IAAW;GA+BjB,AA7BA,EAAS,aAAa;IACpB,EAAQ,KAAK,cAAc;GAC7B,GAEA,EAAS,aAAa;IACpB,EAAQ,MAAM,cAAc;GAC9B,GAoBA,EAAc,GAEd,EAAQ,GAAQ,UAAU,CAAY,GACtC,EAAQ,GAAQ,UAba,MAAkB;IACzC,EAAM,WAAW,SAEjB,EAAM,SAAS,KAAK,EAAe,SAEnC,EAAE,WAAW,KAEjB,EAAa,cAAc;GAC7B,CAK4C;GAK5C,IAAM,IADQ,EAAS,OACK,cAA2B,wBAAsB;GAS7E,OAPI,MACF,EAAQ,GAAc,eAAe,EAAM,iBAAiB,GAC5D,EAAQ,GAAc,eAAe,EAAM,iBAAiB,GAC5D,EAAQ,GAAc,aAAa,EAAM,eAAe,GACxD,EAAQ,GAAc,iBAAiB,EAAM,mBAAmB,UAGrD;IACX,EAAQ,QAAQ;GAClB;EACF,CAAC,GAEM,CAAI;;cAED,EAAU;;4BAEI,EAAM,MAAM,SAAS,KAAK;iCACnB,EAAM,MAAM,QAAwB,OAAhB,EAAsB;8CAC/B,EAAS;;4DAEK,CAAC,EAAU,EAAE;6CAC5B,EAAc,kBAAkB,CAAC,EAAe,EAAE;0CACrD,EAAc,EAAE;;;;;;;8BAO5B,CAAC,EAAM,YAAY,MAAM;6BAjFd;GACnC,EAAa,SAAS;EACxB,EAgF0C;;;;;;;4DAOc,CAAC,EAAU,EAAE;;;;;;CAMvE;CACA,QAAQ;EAAC;EAAmB;EAAoB;EAAoB;CAAM;AAC5E,CAAC"}
|
|
1
|
+
{"version":3,"file":"drawer.js","names":[],"sources":["../src/overlay/drawer/drawer.ts"],"sourcesContent":["import { createPanGesture, type PanAxis, type PanGesture, type PanGestureEndDetail } from '@vielzeug/gesture';\nimport {\n createStableId,\n define,\n getHost,\n html,\n onCleanup,\n onEvent,\n onMounted,\n prop,\n ref,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { signal } from '@vielzeug/ripple';\n\nimport type { OverlayOpenChangeDetail } from '../../core';\nimport '../../content/icon/icon';\nimport { coarsePointerMixin, forcedColorsMixin, reducedMotionMixin } from '../../styles';\nimport { useDialogControl } from '../shared/use-dialog';\nimport styles from './drawer.css?inline';\n\ntype DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';\ntype DrawerSize = 'sm' | 'lg' | 'full';\ntype DrawerBackdrop = 'opaque' | 'blur' | 'transparent';\ntype DrawerDragHandlePlacement = 'outside' | 'inset';\ntype DrawerSwipeConfig = {\n axis: PanAxis;\n closingDistance: (distance: number) => number;\n translate: (distance: number) => string;\n};\n\nconst parseOptionalBool = (value: string | null): boolean | undefined =>\n value == null ? undefined : value === '' || value === 'true';\n\nconst drawerSwipeConfig: Record<DrawerPlacement, DrawerSwipeConfig> = {\n bottom: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n left: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n right: {\n axis: 'x',\n closingDistance: (distance) => Math.max(0, distance),\n translate: (distance) => `translateX(${distance}px)`,\n },\n top: {\n axis: 'y',\n closingDistance: (distance) => Math.max(0, -distance),\n translate: (distance) => `translateY(${distance}px)`,\n },\n};\n\n/** Element interface exposing the imperative API for `ore-drawer`. */\nexport interface DrawerElement extends HTMLElement, Omit<OreDrawerProps, 'title'> {\n /** Programmatically close the drawer with the exit animation. */\n hide(): void;\n /** Programmatically open the drawer. Equivalent to setting `open`. */\n show(): void;\n}\n\n/** Drawer component properties */\n\nexport type OreDrawerEvents = {\n 'open-change': OverlayOpenChangeDetail;\n};\n\nexport type OreDrawerProps = {\n /** Backdrop style — 'opaque' (default), 'blur', or 'transparent' */\n backdrop?: DrawerBackdrop;\n /** Initial uncontrolled open state. Ignored when `open` is set. */\n 'default-open'?: boolean;\n /** Show the close (×) button in the header (default: true) */\n dismissible?: boolean;\n /** Drag handle position used for swipe-to-close gestures */\n 'drag-handle-placement'?: DrawerDragHandlePlacement;\n /**\n * CSS selector for the element inside the drawer that should receive focus on open.\n * Defaults to native dialog focus management (first focusable element).\n * @example '#submit-btn' | 'input[name=\"email\"]'\n */\n 'initial-focus'?: string;\n /**\n * Invisible accessible label for the dialog (`aria-label`).\n * Use when the drawer has no visible title (e.g. image-only content).\n * When omitted, `aria-labelledby` points to the visible header title instead.\n */\n label?: string;\n /** Controlled open state */\n open?: boolean;\n /** When true, backdrop clicks do not close the drawer (default: false) */\n persistent?: boolean;\n /** Side from which the drawer slides in */\n placement?: DrawerPlacement;\n /**\n * When true (default), focus returns to the triggering element after the drawer closes.\n * Set to false to manage focus manually.\n */\n 'return-focus'?: boolean;\n /** Drawer width/height preset */\n size?: DrawerSize;\n /**\n * Visible title text rendered inside the header.\n * Used as the dialog's accessible label via `aria-labelledby` when `label` is not set.\n */\n title?: string;\n};\n\n/**\n * A panel that slides in from any edge of the screen, built on the native `<dialog>` element.\n *\n * @element ore-drawer\n *\n * @attr {boolean} open - Controlled open state\n * @attr {boolean} default-open - Initial uncontrolled open state\n * @attr {string} placement - 'left' | 'right' (default) | 'top' | 'bottom'\n * @attr {string} size - 'sm' | 'lg' | 'full'\n * @attr {string} title - Visible header title text\n * @attr {string} label - Invisible aria-label (for drawers without a visible title)\n * @attr {boolean} dismissible - Show the close (×) button (default: true)\n * @attr {string} drag-handle-placement - 'outside' (default) | 'inset'\n * @attr {string} backdrop - Backdrop style: 'opaque' (default) | 'blur' | 'transparent'\n * @attr {boolean} persistent - Prevent backdrop-click from closing (default: false)\n *\n * @fires open-change - When the drawer state changes. detail: { open, reason }\n *\n * @slot header - Drawer header content\n * @slot - Main body content\n * @slot footer - Drawer footer content\n *\n * @cssprop --drawer-backdrop-bg - Backdrop background color\n * @cssprop --drawer-bg - Panel background color\n * @cssprop --drawer-size - Panel width (horizontal) or height (vertical)\n * @cssprop --drawer-shadow - Panel box-shadow\n * @cssprop --drawer-panel-blur - Panel backdrop blur amount\n *\n * @part drag-handle - Drawer drag handle.\n * @part panel - Panel container.\n * @part header - Header container.\n * @part close-btn - Close button.\n * @part body - Body content container.\n * @part footer - Footer container.\n * @example\n * ```html\n * <!-- With visible title -->\n * <ore-drawer open title=\"Settings\" placement=\"right\">\n * <p>Settings content here.</p>\n * </ore-drawer>\n *\n * <!-- With custom header slot -->\n * <ore-drawer open placement=\"right\">\n * <span slot=\"header\">Settings</span>\n * <p>Settings content here.</p>\n * </ore-drawer>\n * ```\n */\n\nexport const DRAWER_TAG = 'ore-drawer' as const;\ndefine<OreDrawerProps>(DRAWER_TAG, {\n props: {\n backdrop: prop.string<DrawerBackdrop>(),\n 'default-open': prop.bool(false),\n dismissible: prop.bool(true),\n 'drag-handle-placement': prop.oneOf(['outside', 'inset'] as const, 'outside'),\n 'initial-focus': prop.string(),\n label: prop.string(),\n open: { default: undefined as boolean | undefined, parse: parseOptionalBool },\n persistent: prop.bool(false),\n placement: prop.oneOf(['left', 'right', 'top', 'bottom'] as const, 'right'),\n 'return-focus': prop.bool(true),\n size: prop.string<DrawerSize>(),\n title: prop.string(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreDrawerEvents>();\n const slots = useSlots();\n\n const drawerLabelId = createStableId('drawer-label');\n const dialogRef = ref<HTMLDialogElement>();\n const panelRef = ref<HTMLDivElement>();\n\n // Drag-to-close state\n const isSwipeClosing = signal(false);\n let swipe: PanGesture | undefined;\n let swipeCloseTimer: ReturnType<typeof setTimeout> | undefined;\n\n const getHeaderText = () => props.label.value ?? props.title.value ?? '';\n const hasHeaderTitle = () => slots.has('header').value || !!getHeaderText();\n\n // Header is visible when there is slot content, a text label, or a close button.\n const hasHeader = () => hasHeaderTitle() || props.dismissible.value;\n const hasFooter = () => slots.has('footer').value;\n\n const getPlacement = (): DrawerPlacement => props.placement.value || 'right';\n\n const getSwipeConfig = (): DrawerSwipeConfig => drawerSwipeConfig[getPlacement()];\n\n const getSnapThreshold = (panel: HTMLElement, axis: PanAxis) => {\n const panelSize = axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n\n return Math.min(96, Math.max(36, panelSize * 0.18));\n };\n\n const shouldCommitSwipeClose = (distance: number, threshold: number) => {\n return getSwipeConfig().closingDistance(distance) >= threshold;\n };\n\n const finalizeSwipeClose = (panel: HTMLElement) => {\n if (!isSwipeClosing.value) return;\n\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n const dialog = dialogRef.value;\n\n if (!dialog) {\n isSwipeClosing.value = false;\n\n return;\n }\n\n dialog.style.transition = 'none';\n panel.style.opacity = '0';\n panel.style.visibility = 'hidden';\n void dialog.offsetWidth;\n\n requestClose('swipe');\n };\n\n const startSwipeClose = (panel: HTMLElement, swipe: DrawerSwipeConfig, committedDistance: number) => {\n if (isSwipeClosing.value) return;\n\n isSwipeClosing.value = true;\n\n const panelSize = swipe.axis === 'x' ? panel.offsetWidth : panel.offsetHeight;\n // Preserve overshoot so closing continues from the dragged position instead of snapping back.\n const exitDistance =\n committedDistance >= 0 ? Math.max(committedDistance, panelSize) : Math.min(committedDistance, -panelSize);\n const exitTransform = swipe.translate(exitDistance);\n\n // Commit the current drag position first so the magnetic snap continues\n // from the finger instead of jumping back to rest.\n panel.style.transition = 'transform 180ms cubic-bezier(0.2, 0.9, 0.2, 1), opacity 180ms ease-out';\n void panel.offsetWidth;\n\n const onExitTransitionEnd = (ev: TransitionEvent) => {\n if (ev.target !== panel || ev.propertyName !== 'transform') return;\n\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n };\n\n panel.addEventListener('transitionend', onExitTransitionEnd);\n\n const durationMs = parseFloat(getComputedStyle(panel).transitionDuration) * 1000;\n\n swipeCloseTimer = setTimeout(() => {\n panel.removeEventListener('transitionend', onExitTransitionEnd);\n finalizeSwipeClose(panel);\n }, durationMs + 50);\n\n panel.style.transform = exitTransform;\n panel.style.opacity = '0.2';\n };\n\n const resetPanelDragStyles = (panel: HTMLElement) => {\n if (swipeCloseTimer) {\n clearTimeout(swipeCloseTimer);\n swipeCloseTimer = undefined;\n }\n\n // Re-enable transitions so the snap-back or exit animates.\n panel.style.transition = '';\n panel.style.transform = '';\n panel.style.opacity = '';\n panel.style.visibility = '';\n isSwipeClosing.value = false;\n };\n\n const handleSwipeEnd = ({ distance, reason }: PanGestureEndDetail): void => {\n const panel = panelRef.value;\n\n if (!panel) return;\n\n const threshold = getSnapThreshold(panel, getSwipeConfig().axis);\n\n if (reason === 'release' && shouldCommitSwipeClose(distance, threshold)) {\n startSwipeClose(panel, getSwipeConfig(), distance);\n\n return;\n }\n\n resetPanelDragStyles(panel);\n };\n\n // ────────────────────────────────────────────────────────────────\n // Overlay State Management\n // ────────────────────────────────────────────────────────────────\n\n const { closeWithAnimation, handleCancel, overlay, requestClose, watchOpenProp } = useDialogControl({\n beforeOpen: (dialog) => {\n // Clear any inline drag styles from a previous swipe-close so the CSS\n // entry animation starts from the correct base state.\n const panel = panelRef.value;\n\n if (panel) resetPanelDragStyles(panel);\n\n void dialog;\n },\n closeRequestDetail: (_reason) => ({ placement: props.placement.value ?? 'right' }),\n defaultOpen: props['default-open'],\n dialogRef,\n getPanelEl: () => panelRef.value,\n host: el,\n initialFocus: props['initial-focus'],\n isPersistent: () => Boolean(props.persistent.value),\n onCleanup,\n onEvent,\n onNativeClose: (reason) => {\n const panelEl = panelRef.value;\n\n // For swipe-close, keep the panel hidden and off-screen until the next\n // open cycle — resetting inline styles during native close can produce\n // a visible frame at the rest position on some browsers.\n if (panelEl && reason !== 'swipe') resetPanelDragStyles(panelEl);\n\n const dialog = dialogRef.value;\n\n if (dialog) dialog.style.transition = '';\n\n emit('open-change', { open: false, reason });\n },\n onOpen: (reason) => emit('open-change', { open: true, reason }),\n openProp: props.open,\n performClose: (dialog, reason) => {\n if (reason === 'swipe') {\n dialog.close();\n } else {\n closeWithAnimation();\n }\n },\n returnFocus: props['return-focus'],\n });\n\n const handleCloseButtonClick = () => {\n requestClose('trigger');\n };\n\n // ────────────────────────────────────────────────────────────────\n // Lifecycle: Setup Drawer Integration\n // ────────────────────────────────────────────────────────────────\n\n onMounted(() => {\n const dialog = dialogRef.value;\n\n if (!dialog) return;\n\n // Expose imperative API\n const drawerEl = el as DrawerElement;\n\n drawerEl.show = () => {\n overlay.open('programmatic');\n };\n\n drawerEl.hide = () => {\n overlay.close('programmatic');\n };\n\n // ────────────────────────────────────────────────────────────\n // Event Handlers: Cancel, Backdrop Click\n // ────────────────────────────────────────────────────────────\n // `handleCancel` (Escape via the native `cancel` event) is provided by\n // `useDialogControl` above — drawer only needs its own backdrop-click\n // handler since it has swipe-to-dismiss logic the shared dialog helper\n // doesn't know about.\n\n const handleBackdropClick = (e: MouseEvent) => {\n if (props.persistent.value) return;\n\n if (swipe?.active || isSwipeClosing.value) return;\n\n if (e.target !== dialog) return; // Click inside panel\n\n requestClose('outsideClick');\n };\n\n watchOpenProp();\n\n onEvent(dialog, 'cancel', handleCancel);\n onEvent(dialog, 'click', handleBackdropClick);\n\n // Drag-to-close handlers — scoped to the handle element only so interactions\n // with panel content don't accidentally start a drag.\n const panel = panelRef.value;\n const dragHandleEl = panel?.querySelector<HTMLElement>('[part=\"drag-handle\"]');\n\n if (dragHandleEl) {\n swipe = createPanGesture(dragHandleEl, {\n axis: () => getSwipeConfig().axis,\n disabled: () => isSwipeClosing.value,\n onEnd: handleSwipeEnd,\n onMove: ({ distance }) => {\n const currentPanel = panelRef.value;\n\n if (!currentPanel) return;\n\n const swipeConfig = getSwipeConfig();\n const threshold = getSnapThreshold(currentPanel, swipeConfig.axis);\n const closingDistance = swipeConfig.closingDistance(distance);\n const progress = Math.min(closingDistance / threshold, 1);\n\n currentPanel.style.transition = 'none';\n currentPanel.style.transform = swipeConfig.translate(distance);\n currentPanel.style.opacity = String(1 - progress * 0.4);\n },\n });\n }\n\n return () => {\n swipe?.dispose();\n swipe = undefined;\n overlay.dispose();\n };\n });\n\n return html`\n <dialog\n ref=${dialogRef}\n aria-modal=\"true\"\n aria-label=\"${() => props.label.value ?? null}\"\n aria-labelledby=\"${() => (!props.label.value ? drawerLabelId : null)}\">\n <div class=\"panel\" part=\"panel\" ref=${panelRef}>\n <div class=\"drag-handle\" part=\"drag-handle\" aria-label=\"Drag to close\" role=\"button\"></div>\n <div class=\"header\" part=\"header\" ?hidden=${() => !hasHeader()}>\n <span class=\"header-title\" id=\"${drawerLabelId}\" ?hidden=${() => !hasHeaderTitle()}>\n <slot name=\"header\">${() => getHeaderText()}</slot>\n </span>\n <button\n class=\"close-btn\"\n part=\"close-btn\"\n type=\"button\"\n aria-label=\"Close\"\n ?hidden=${() => !props.dismissible.value}\n @click=${handleCloseButtonClick}>\n <ore-icon name=\"x\" size=\"16\" stroke-width=\"2.5\" aria-hidden=\"true\"></ore-icon>\n </button>\n </div>\n <div class=\"body\" part=\"body\">\n <slot></slot>\n </div>\n <div class=\"footer\" part=\"footer\" ?hidden=${() => !hasFooter()}>\n <slot name=\"footer\"></slot>\n </div>\n </div>\n </dialog>\n `;\n },\n styles: [forcedColorsMixin, coarsePointerMixin, reducedMotionMixin, styles],\n});\n"],"mappings":";;;;;;;;AAgCA,IAAM,KAAqB,MACzB,KAAS,OAAO,KAAA,IAAY,MAAU,MAAM,MAAU,QAElD,IAAgE;CACpE,QAAQ;EACN,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAQ;EACnD,YAAY,MAAa,cAAc,EAAS;CAClD;CACA,MAAM;EACJ,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAC,CAAQ;EACpD,YAAY,MAAa,cAAc,EAAS;CAClD;CACA,OAAO;EACL,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAQ;EACnD,YAAY,MAAa,cAAc,EAAS;CAClD;CACA,KAAK;EACH,MAAM;EACN,kBAAkB,MAAa,KAAK,IAAI,GAAG,CAAC,CAAQ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AW,KAEjB,EAAa,cAAc;GAC7B,CAK4C;GAK5C,IAAM,IADQ,EAAS,OACK,cAA2B,wBAAsB;GAwB7E,OAtBI,MACF,IAAQ,EAAiB,GAAc;IACrC,YAAY,EAAe,CAAC,CAAC;IAC7B,gBAAgB,EAAe;IAC/B,OAAO;IACP,SAAS,EAAE,kBAAe;KACxB,IAAM,IAAe,EAAS;KAE9B,IAAI,CAAC,GAAc;KAEnB,IAAM,IAAc,EAAe,GAC7B,IAAY,EAAiB,GAAc,EAAY,IAAI,GAC3D,IAAkB,EAAY,gBAAgB,CAAQ,GACtD,IAAW,KAAK,IAAI,IAAkB,GAAW,CAAC;KAIxD,AAFA,EAAa,MAAM,aAAa,QAChC,EAAa,MAAM,YAAY,EAAY,UAAU,CAAQ,GAC7D,EAAa,MAAM,UAAU,OAAO,IAAI,IAAW,EAAG;IACxD;GACF,CAAC,UAGU;IAGX,AAFA,GAAO,QAAQ,GACf,IAAQ,KAAA,GACR,EAAQ,QAAQ;GAClB;EACF,CAAC,GAEM,CAAI;;cAED,EAAU;;4BAEI,EAAM,MAAM,SAAS,KAAK;iCACnB,EAAM,MAAM,QAAwB,OAAhB,EAAsB;8CAC/B,EAAS;;4DAEK,CAAC,EAAU,EAAE;6CAC5B,EAAc,kBAAkB,CAAC,EAAe,EAAE;0CACrD,EAAc,EAAE;;;;;;;8BAO5B,CAAC,EAAM,YAAY,MAAM;6BAlGd;GACnC,EAAa,SAAS;EACxB,EAiG0C;;;;;;;4DAOc,CAAC,EAAU,EAAE;;;;;;CAMvE;CACA,QAAQ;EAAC;EAAmB;EAAoB;EAAoB;CAAM;AAC5E,CAAC"}
|
package/dist/errors.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=class
|
|
1
|
+
var e=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},t=class extends e{};exports.RefineConfigError=t,exports.RefineError=e;
|
|
2
2
|
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/** Base class for all refine errors. Use `instanceof RefineError` to catch any refine-originated error. */\nexport class RefineError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/** Base class for all refine errors. Use `instanceof RefineError` to catch any refine-originated error. */\nexport class RefineError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when a refine component receives an invalid or unsupported configuration. */\nexport class RefineConfigError extends RefineError {}\n"],"mappings":"AACA,IAAa,EAAb,cAAiC,KAAM,CACrC,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CACF,EAGa,EAAb,cAAuC,CAAY,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** Base class for all refine errors. Use `instanceof RefineError` to catch any refine-originated error. */
|
|
2
2
|
export declare class RefineError extends Error {
|
|
3
3
|
constructor(message: string, opts?: ErrorOptions);
|
|
4
|
-
static is(err: unknown): err is RefineError;
|
|
5
4
|
}
|
|
6
5
|
/** Thrown when a refine component receives an invalid or unsupported configuration. */
|
|
7
6
|
export declare class RefineConfigError extends RefineError {
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY;CAKjD;AAED,uFAAuF;AACvF,qBAAa,iBAAkB,SAAQ,WAAW;CAAG"}
|
package/dist/errors.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
//#region src/errors.ts
|
|
2
|
-
var e = class
|
|
2
|
+
var e = class extends Error {
|
|
3
3
|
constructor(e, t) {
|
|
4
4
|
super(e, t), this.name = new.target.name, Object.setPrototypeOf(this, new.target.prototype);
|
|
5
5
|
}
|
|
6
|
-
static is(t) {
|
|
7
|
-
return t instanceof e;
|
|
8
|
-
}
|
|
9
6
|
}, t = class extends e {};
|
|
10
7
|
//#endregion
|
|
11
8
|
export { t as RefineConfigError, e as RefineError };
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/** Base class for all refine errors. Use `instanceof RefineError` to catch any refine-originated error. */\nexport class RefineError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../src/errors.ts"],"sourcesContent":["/** Base class for all refine errors. Use `instanceof RefineError` to catch any refine-originated error. */\nexport class RefineError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/** Thrown when a refine component receives an invalid or unsupported configuration. */\nexport class RefineConfigError extends RefineError {}\n"],"mappings":";AACA,IAAa,IAAb,cAAiC,MAAM;CACrC,YAAY,GAAiB,GAAqB;EAGhD,AAFA,MAAM,GAAS,CAAI,GACnB,KAAK,OAAO,WAAW,MACvB,OAAO,eAAe,MAAM,WAAW,SAAS;CAClD;AACF,GAGa,IAAb,cAAuC,EAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/feedback/skeleton/skeleton.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../src/feedback/skeleton/skeleton.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,2CAA2C;AAC3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,YAAY,EAAG,cAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/feedback/toast/toast.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/feedback/toast/toast.ts"],"names":[],"mappings":"AAAA,OAAO,gB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