@threadlabs/looma 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/{chunk-JXSHRMYW.js → chunk-CSULYHMX.js} +32 -32
  2. package/dist/{chunk-M7FPK6GN.js → chunk-D5WRORG6.js} +21 -1
  3. package/dist/cjs/{positioning-D5q9DM-0.js → positioning-CCR6ifPj.js} +35 -0
  4. package/dist/cjs/ui-affordance-scope.cjs.entry.js +1 -1
  5. package/dist/cjs/ui-chip_2.cjs.entry.js +1 -1
  6. package/dist/cjs/ui-combobox.cjs.entry.js +1 -1
  7. package/dist/cjs/ui-context-menu.cjs.entry.js +1 -1
  8. package/dist/cjs/ui-menu.cjs.entry.js +1 -1
  9. package/dist/cjs/ui-popover.cjs.entry.js +1 -1
  10. package/dist/cjs/ui-toast-region.cjs.entry.js +1 -1
  11. package/dist/collection/overlay/positioning.js +35 -0
  12. package/dist/components/{p-DYiNETk6.js → p-6SWSrfmW.js} +1 -1
  13. package/dist/components/p-B_DaIVEY.js +1 -0
  14. package/dist/components/{p-DWN2m6ta.js → p-BzaB_bXo.js} +1 -1
  15. package/dist/components/ui-affordance-scope.js +1 -1
  16. package/dist/components/ui-combobox.js +1 -1
  17. package/dist/components/ui-context-menu.js +1 -1
  18. package/dist/components/ui-menu.js +1 -1
  19. package/dist/components/ui-popover.js +1 -1
  20. package/dist/components/ui-toast-region.js +1 -1
  21. package/dist/components/ui-tooltip.js +1 -1
  22. package/dist/esm/{positioning-Drmwg-C1.js → positioning-ZOr-2PSe.js} +35 -0
  23. package/dist/esm/ui-affordance-scope.entry.js +1 -1
  24. package/dist/esm/ui-chip_2.entry.js +1 -1
  25. package/dist/esm/ui-combobox.entry.js +1 -1
  26. package/dist/esm/ui-context-menu.entry.js +1 -1
  27. package/dist/esm/ui-menu.entry.js +1 -1
  28. package/dist/esm/ui-popover.entry.js +1 -1
  29. package/dist/esm/ui-toast-region.entry.js +1 -1
  30. package/dist/index.cjs +48 -10
  31. package/dist/index.js +19 -1
  32. package/dist/looma/looma.esm.js +1 -1
  33. package/dist/looma/{p-55e06e2e.entry.js → p-0b5b8d9e.entry.js} +1 -1
  34. package/dist/looma/{p-32c85198.entry.js → p-16e0669d.entry.js} +1 -1
  35. package/dist/looma/{p-37ec2b4b.entry.js → p-6d8b99ee.entry.js} +1 -1
  36. package/dist/looma/{p-b6fb6ba3.entry.js → p-99116a72.entry.js} +1 -1
  37. package/dist/looma/{p-5cbbf7a0.entry.js → p-9ff2fa19.entry.js} +1 -1
  38. package/dist/looma/p-ZOr-2PSe.js +1 -0
  39. package/dist/looma/{p-d46317e0.entry.js → p-a2dd4c6c.entry.js} +1 -1
  40. package/dist/looma/p-ca2a54fd.entry.js +1 -0
  41. package/dist/{ui-affordance-scope.entry-VR7FLAWG.js → ui-affordance-scope.entry-UHAPBKUL.js} +2 -2
  42. package/dist/{ui-avatar-group.entry-L3UKOY3U.js → ui-avatar-group.entry-5CW7NZXC.js} +1 -1
  43. package/dist/{ui-avatar.entry-VM5OHEFQ.js → ui-avatar.entry-6HZBNQ4Y.js} +1 -1
  44. package/dist/{ui-badge.entry-ZTM4OPUD.js → ui-badge.entry-SNSI6RIY.js} +1 -1
  45. package/dist/{ui-button.entry-CIPUSV5B.js → ui-button.entry-Z3T6L2OC.js} +1 -1
  46. package/dist/{ui-callout.entry-OBFCI2O7.js → ui-callout.entry-DLUGC27N.js} +1 -1
  47. package/dist/{ui-checkbox.entry-XT6ET56H.js → ui-checkbox.entry-3V3KTI2D.js} +1 -1
  48. package/dist/{ui-chip_2.entry-32SHCLV6.js → ui-chip_2.entry-YKN25ITS.js} +2 -2
  49. package/dist/{ui-combobox.entry-ONBBPQ2C.js → ui-combobox.entry-ZQ6MXY7Z.js} +2 -2
  50. package/dist/{ui-context-menu.entry-RXNUOK24.js → ui-context-menu.entry-RAWB3GNP.js} +2 -2
  51. package/dist/{ui-dialog.entry-IJXNUARC.js → ui-dialog.entry-ZRXQ2XCL.js} +1 -1
  52. package/dist/{ui-disclosure.entry-5QS7UDRH.js → ui-disclosure.entry-U3465YX7.js} +1 -1
  53. package/dist/{ui-editable.entry-D7LOQN2H.js → ui-editable.entry-6L3DIEER.js} +1 -1
  54. package/dist/{ui-floating-action-button.entry-XQZCTZQT.js → ui-floating-action-button.entry-HOWHDYGL.js} +1 -1
  55. package/dist/{ui-form-field.entry-A654LJZE.js → ui-form-field.entry-QCVAXSX7.js} +1 -1
  56. package/dist/{ui-icon-button.entry-MJ7F7ZIH.js → ui-icon-button.entry-FSK5NRAO.js} +1 -1
  57. package/dist/{ui-input.entry-B2XM7JQU.js → ui-input.entry-55UHQLHX.js} +1 -1
  58. package/dist/{ui-menu-item.entry-JULYSFVW.js → ui-menu-item.entry-OXGX4CVF.js} +1 -1
  59. package/dist/{ui-menu.entry-ORRWW7HD.js → ui-menu.entry-YBQ66B7X.js} +2 -2
  60. package/dist/{ui-popover.entry-W67V4UPA.js → ui-popover.entry-AG2T2URX.js} +2 -2
  61. package/dist/{ui-radio-group.entry-KCFOR27M.js → ui-radio-group.entry-E3NXQNYV.js} +1 -1
  62. package/dist/{ui-radio.entry-I2P4V5E3.js → ui-radio.entry-UWC5EALS.js} +1 -1
  63. package/dist/{ui-search-result-row.entry-GHODLSLR.js → ui-search-result-row.entry-CS5I2JJX.js} +1 -1
  64. package/dist/{ui-search-shell.entry-PDB5UN4B.js → ui-search-shell.entry-MTB5GDP3.js} +1 -1
  65. package/dist/{ui-select.entry-D3CZHCKB.js → ui-select.entry-BFFNMJNZ.js} +1 -1
  66. package/dist/{ui-switch.entry-WUDRL4H5.js → ui-switch.entry-7JXIFCZY.js} +1 -1
  67. package/dist/{ui-tabs.entry-MW64GKIJ.js → ui-tabs.entry-R4GNA3P2.js} +1 -1
  68. package/dist/{ui-textarea.entry-VHRBYY6G.js → ui-textarea.entry-HIWZP5GO.js} +1 -1
  69. package/dist/{ui-toast-region.entry-ET75RWYP.js → ui-toast-region.entry-B25TKUAZ.js} +2 -2
  70. package/dist/{ui-top-bar.entry-QIYA3LD3.js → ui-top-bar.entry-RHPW4WN3.js} +1 -1
  71. package/dist/{ui-tree-item.entry-BDB7VEUS.js → ui-tree-item.entry-EAAWU24M.js} +1 -1
  72. package/dist/{ui-tree.entry-GSC7BPRN.js → ui-tree.entry-PISIJRSP.js} +1 -1
  73. package/package.json +1 -1
  74. package/dist/components/p-Drw41pSY.js +0 -1
  75. package/dist/looma/p-56dac38a.entry.js +0 -1
  76. package/dist/looma/p-Drmwg-C1.js +0 -1
@@ -1 +1 @@
1
- import{p as t,H as e,h as i,c as s,t as n}from"./p-Bh_1GxOD.js";import{o,c as r,r as a}from"./p-C-0syqXZ.js";import{d as h}from"./p-JwSoedEO.js";import{c}from"./p-Drw41pSY.js";import{d as u}from"./p-DYiNETk6.js";const d=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get host(){return this}open=!1;defaultOpen=!1;for;internalOpen=!1;focusTrigger="programmatic";overlayId="ui-context-menu-"+Math.random().toString(36).slice(2,11);trigger=null;contextTarget=null;pointerX=0;pointerY=0;pointPositioned=!1;surface=null;syncFromProp(){this.internalOpen=this.open}syncTarget(){this.resolveTargets(),this.attachTargetListeners()}syncOverlay(){this.syncTriggerState(),this.internalOpen?(this.pointPositioned?this.surface?.showAtPoint({x:this.pointerX,y:this.pointerY}):this.surface?.show(),o({id:this.overlayId,modal:!1,element:this.host,dismissible:!0,requestClose:(t,e)=>this.closeMenu(t,e)})):(this.surface?.hide(),r(this.overlayId))}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.resolveTargets(),this.attachTargetListeners(),this.setupSurface(),this.syncTriggerState(),this.syncOverlay()}componentDidUpdate(){this.resolveTargets(),this.attachTargetListeners(),this.pointPositioned||this.surface?.setAnchor(this.trigger),this.syncTriggerState()}disconnectedCallback(){this.detachTargetListeners(),this.surface?.destroy(),this.surface=null,r(this.overlayId)}setupSurface(){const t=this.host.shadowRoot?.querySelector(".menu");t&&(this.surface?.destroy(),this.surface=c(t,{anchor:this.trigger,placement:"bottom-start"}))}resolveTargets(){const t=this.trigger,e=this.contextTarget,i=this.host.querySelector('[slot="trigger"]'),s=this.for?document.getElementById(this.for):null;this.trigger=i,this.contextTarget=s??i??this.host.parentElement,t===this.trigger&&e===this.contextTarget||(t?.removeEventListener("click",this.onTriggerClick),t?.removeEventListener("keydown",this.onTriggerKeydown),e?.removeEventListener("contextmenu",this.onContextMenu))}attachTargetListeners(){this.detachTargetListeners(),this.trigger?.addEventListener("click",this.onTriggerClick),this.trigger?.addEventListener("keydown",this.onTriggerKeydown),this.contextTarget?.addEventListener("contextmenu",this.onContextMenu)}detachTargetListeners(){this.trigger?.removeEventListener("click",this.onTriggerClick),this.trigger?.removeEventListener("keydown",this.onTriggerKeydown),this.contextTarget?.removeEventListener("contextmenu",this.onContextMenu)}syncTriggerState(){this.trigger&&(this.trigger.setAttribute("aria-haspopup","menu"),this.trigger.setAttribute("aria-expanded",this.internalOpen?"true":"false"))}getItems(){return Array.from(this.host.querySelectorAll("ui-menu-item")).filter((t=>!this.isItemDisabled(t)))}focusFirstItem(){requestAnimationFrame((()=>this.getItems()[0]?.focus()))}openMenu(t,e,i){this.pointerX=t,this.pointerY=e,this.focusTrigger=i,this.pointPositioned=!0,this.surface?.showAtPoint({x:t,y:e}),this.internalOpen=!0,h(this.host,"open",{open:!0,reason:"action",trigger:i}),this.focusFirstItem()}openFromTrigger(t){this.trigger&&(this.pointPositioned=!1,this.internalOpen=!0,h(this.host,"open",{open:!0,reason:"action",trigger:t}),this.focusFirstItem())}closeMenu(t,e,i=!0){this.internalOpen&&(this.internalOpen=!1,h(this.host,"close",{open:!1,reason:t,trigger:e}),i&&this.trigger?.focus())}onTriggerClick=t=>{this.internalOpen?this.closeMenu("action",0===t.detail?"keyboard":"pointer"):this.openFromTrigger(0===t.detail?"keyboard":"pointer")};onTriggerKeydown=t=>{"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.internalOpen?this.focusFirstItem():this.openFromTrigger("keyboard"))};onContextMenu=t=>{t.preventDefault(),this.openMenu(t.clientX,t.clientY,"pointer")};isItemDisabled(t){return"true"===t.getAttribute("aria-disabled")||t.hasAttribute("disabled")||"true"===t.getAttribute("disabled")||!0===t.disabled}onKeydown=t=>{if(this.internalOpen){if(this.focusTrigger="keyboard","Escape"===t.key)return t.preventDefault(),void a("escape","keyboard");if("Enter"===t.key||" "===t.key){const e=t.target.closest?.("ui-menu-item");if(!e||this.isItemDisabled(e))return;t.preventDefault();const i=e.getAttribute("value")??e.getAttribute("data-value")??"";h(this.host,"select",{value:i,trigger:"keyboard"}),this.closeMenu("action","keyboard")}}};onItemClick=t=>{const e=t.target.closest?.("ui-menu-item");if(!e||this.isItemDisabled(e))return;const i=e.getAttribute("value")??e.getAttribute("data-value")??"";h(this.host,"select",{value:i,trigger:"pointer"}),this.closeMenu("action","pointer")};render(){return i(s,{key:"aaf9f27402b0c88cede3847ee9c8f61ac844f889","data-open":this.internalOpen?"":void 0,"data-focus-trigger":this.internalOpen?this.focusTrigger:void 0,onKeyDown:this.onKeydown,onClick:this.onItemClick},i("slot",{key:"d801d564ec2ee073e517cb991c26efc61d3e499d",name:"trigger"}),i("div",{key:"4febcc5d76c79c2e5361db7b203e971582197fd2",class:"menu","data-open":this.internalOpen?"":void 0},i("ui-menu",{key:"7aace2479a8014a20da35f69bd3ed57b402f9ef2",open:this.internalOpen},i("slot",{key:"a31d703c437cf5d9ab82e5f7793caa093a312dfd"}))))}static get watchers(){return{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}}static get style(){return":host{display:contents}:host([data-focus-trigger='pointer']) ::slotted(ui-menu-item:focus){outline:none}.menu{position:fixed;inset:auto;margin:0;z-index:var(--ui-z-overlay, 1000);min-width:12rem;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.menu:popover-open{opacity:1;transform:translateY(0) scale(1)}@starting-style{.menu:popover-open{opacity:0;transform:translateY(-4px) scale(0.99)}}.menu[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){.menu{transition:none}}"}},[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32],focusTrigger:[32]},void 0,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]),m=d,l=function(){"undefined"!=typeof customElements&&["ui-context-menu","ui-menu"].forEach((t=>{switch(t){case"ui-context-menu":customElements.get(n(t))||customElements.define(n(t),d);break;case"ui-menu":customElements.get(n(t))||u()}}))};export{m as UiContextMenu,l as defineCustomElement}
1
+ import{p as t,H as e,h as i,c as s,t as n}from"./p-Bh_1GxOD.js";import{o,c as r,r as a}from"./p-C-0syqXZ.js";import{d as h}from"./p-JwSoedEO.js";import{c}from"./p-B_DaIVEY.js";import{d as u}from"./p-6SWSrfmW.js";const d=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get host(){return this}open=!1;defaultOpen=!1;for;internalOpen=!1;focusTrigger="programmatic";overlayId="ui-context-menu-"+Math.random().toString(36).slice(2,11);trigger=null;contextTarget=null;pointerX=0;pointerY=0;pointPositioned=!1;surface=null;syncFromProp(){this.internalOpen=this.open}syncTarget(){this.resolveTargets(),this.attachTargetListeners()}syncOverlay(){this.syncTriggerState(),this.internalOpen?(this.pointPositioned?this.surface?.showAtPoint({x:this.pointerX,y:this.pointerY}):this.surface?.show(),o({id:this.overlayId,modal:!1,element:this.host,dismissible:!0,requestClose:(t,e)=>this.closeMenu(t,e)})):(this.surface?.hide(),r(this.overlayId))}componentDidLoad(){this.syncFromProp(),this.internalOpen=this.internalOpen||this.defaultOpen,this.resolveTargets(),this.attachTargetListeners(),this.setupSurface(),this.syncTriggerState(),this.syncOverlay()}componentDidUpdate(){this.resolveTargets(),this.attachTargetListeners(),this.pointPositioned||this.surface?.setAnchor(this.trigger),this.syncTriggerState()}disconnectedCallback(){this.detachTargetListeners(),this.surface?.destroy(),this.surface=null,r(this.overlayId)}setupSurface(){const t=this.host.shadowRoot?.querySelector(".menu");t&&(this.surface?.destroy(),this.surface=c(t,{anchor:this.trigger,placement:"bottom-start"}))}resolveTargets(){const t=this.trigger,e=this.contextTarget,i=this.host.querySelector('[slot="trigger"]'),s=this.for?document.getElementById(this.for):null;this.trigger=i,this.contextTarget=s??i??this.host.parentElement,t===this.trigger&&e===this.contextTarget||(t?.removeEventListener("click",this.onTriggerClick),t?.removeEventListener("keydown",this.onTriggerKeydown),e?.removeEventListener("contextmenu",this.onContextMenu))}attachTargetListeners(){this.detachTargetListeners(),this.trigger?.addEventListener("click",this.onTriggerClick),this.trigger?.addEventListener("keydown",this.onTriggerKeydown),this.contextTarget?.addEventListener("contextmenu",this.onContextMenu)}detachTargetListeners(){this.trigger?.removeEventListener("click",this.onTriggerClick),this.trigger?.removeEventListener("keydown",this.onTriggerKeydown),this.contextTarget?.removeEventListener("contextmenu",this.onContextMenu)}syncTriggerState(){this.trigger&&(this.trigger.setAttribute("aria-haspopup","menu"),this.trigger.setAttribute("aria-expanded",this.internalOpen?"true":"false"))}getItems(){return Array.from(this.host.querySelectorAll("ui-menu-item")).filter((t=>!this.isItemDisabled(t)))}focusFirstItem(){requestAnimationFrame((()=>this.getItems()[0]?.focus()))}openMenu(t,e,i){this.pointerX=t,this.pointerY=e,this.focusTrigger=i,this.pointPositioned=!0,this.surface?.showAtPoint({x:t,y:e}),this.internalOpen=!0,h(this.host,"open",{open:!0,reason:"action",trigger:i}),this.focusFirstItem()}openFromTrigger(t){this.trigger&&(this.pointPositioned=!1,this.internalOpen=!0,h(this.host,"open",{open:!0,reason:"action",trigger:t}),this.focusFirstItem())}closeMenu(t,e,i=!0){this.internalOpen&&(this.internalOpen=!1,h(this.host,"close",{open:!1,reason:t,trigger:e}),i&&this.trigger?.focus())}onTriggerClick=t=>{this.internalOpen?this.closeMenu("action",0===t.detail?"keyboard":"pointer"):this.openFromTrigger(0===t.detail?"keyboard":"pointer")};onTriggerKeydown=t=>{"Enter"!==t.key&&" "!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),this.internalOpen?this.focusFirstItem():this.openFromTrigger("keyboard"))};onContextMenu=t=>{t.preventDefault(),this.openMenu(t.clientX,t.clientY,"pointer")};isItemDisabled(t){return"true"===t.getAttribute("aria-disabled")||t.hasAttribute("disabled")||"true"===t.getAttribute("disabled")||!0===t.disabled}onKeydown=t=>{if(this.internalOpen){if(this.focusTrigger="keyboard","Escape"===t.key)return t.preventDefault(),void a("escape","keyboard");if("Enter"===t.key||" "===t.key){const e=t.target.closest?.("ui-menu-item");if(!e||this.isItemDisabled(e))return;t.preventDefault();const i=e.getAttribute("value")??e.getAttribute("data-value")??"";h(this.host,"select",{value:i,trigger:"keyboard"}),this.closeMenu("action","keyboard")}}};onItemClick=t=>{const e=t.target.closest?.("ui-menu-item");if(!e||this.isItemDisabled(e))return;const i=e.getAttribute("value")??e.getAttribute("data-value")??"";h(this.host,"select",{value:i,trigger:"pointer"}),this.closeMenu("action","pointer")};render(){return i(s,{key:"aaf9f27402b0c88cede3847ee9c8f61ac844f889","data-open":this.internalOpen?"":void 0,"data-focus-trigger":this.internalOpen?this.focusTrigger:void 0,onKeyDown:this.onKeydown,onClick:this.onItemClick},i("slot",{key:"d801d564ec2ee073e517cb991c26efc61d3e499d",name:"trigger"}),i("div",{key:"4febcc5d76c79c2e5361db7b203e971582197fd2",class:"menu","data-open":this.internalOpen?"":void 0},i("ui-menu",{key:"7aace2479a8014a20da35f69bd3ed57b402f9ef2",open:this.internalOpen},i("slot",{key:"a31d703c437cf5d9ab82e5f7793caa093a312dfd"}))))}static get watchers(){return{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}}static get style(){return":host{display:contents}:host([data-focus-trigger='pointer']) ::slotted(ui-menu-item:focus){outline:none}.menu{position:fixed;inset:auto;margin:0;z-index:var(--ui-z-overlay, 1000);min-width:12rem;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.menu:popover-open{opacity:1;transform:translateY(0) scale(1)}@starting-style{.menu:popover-open{opacity:0;transform:translateY(-4px) scale(0.99)}}.menu[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){.menu{transition:none}}"}},[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32],focusTrigger:[32]},void 0,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]),m=d,l=function(){"undefined"!=typeof customElements&&["ui-context-menu","ui-menu"].forEach((t=>{switch(t){case"ui-context-menu":customElements.get(n(t))||customElements.define(n(t),d);break;case"ui-menu":customElements.get(n(t))||u()}}))};export{m as UiContextMenu,l as defineCustomElement}
@@ -1 +1 @@
1
- import{U as o,d as s}from"./p-DYiNETk6.js";const p=o,r=s;export{p as UiMenu,r as defineCustomElement}
1
+ import{U as o,d as r}from"./p-6SWSrfmW.js";const s=o,m=r;export{s as UiMenu,m as defineCustomElement}
@@ -1 +1 @@
1
- import{p as e,H as t,h as o,c as s,t as r}from"./p-Bh_1GxOD.js";import{o as i,c as a,r as n}from"./p-C-0syqXZ.js";import{d as p}from"./p-JwSoedEO.js";import{i as c,c as h}from"./p-BnGhGgTH.js";import{c as d}from"./p-Drw41pSY.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}get host(){return this}open;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId="ui-popover-"+Math.random().toString(36).slice(2,11);anchor=null;surface=null;syncFromProp(){c(this.open)&&(this.internalOpen=this.open)}onOpenChange(){this.syncOverlay(),this.internalOpen?p(this.host,"open",{open:!0,reason:"programmatic",trigger:"programmatic"}):p(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"})}resetSurface(){this.setupSurface(),this.syncSurface()}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=d(this.host,{anchor:this.anchor,placement:this.placement}))}syncSurface(){this.surface&&(this.internalOpen?this.surface.show():this.surface.hide())}syncOverlay(){this.syncSurface(),this.internalOpen?i({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,t)=>this.handleRequestClose(e,t)}):a(this.overlayId)}componentDidLoad(){this.internalOpen=h(this.open,this.defaultOpen),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncOverlay()}disconnectedCallback(){this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,a(this.overlayId)}componentDidUpdate(){this.syncOverlay()}handleRequestClose(e,t){c(this.open)||(this.internalOpen=!1),p(this.host,"close",{open:!1,reason:e,trigger:t})}onKeydown=e=>{"Escape"===e.key&&n("escape","keyboard")};render(){return o(s,{key:"65a0927abc40450205989704bfde2cf7fd80d1f9","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},o("div",{key:"255acaf99e0fe70a92048351b24bdfde1a4ea45f",class:"popover__surface"},o("slot",{key:"9d2f6c9d5a0f7a2766225aef0ec5b98b33ec9f07"})))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}}static get style(){return":host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:visible;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.popover__surface{box-sizing:border-box;max-inline-size:inherit;max-block-size:inherit;overflow:auto;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}"}},[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]),u=l,m=function(){"undefined"!=typeof customElements&&["ui-popover"].forEach((e=>{"ui-popover"===e&&(customElements.get(r(e))||customElements.define(r(e),l))}))};export{u as UiPopover,m as defineCustomElement}
1
+ import{p as e,H as t,h as o,c as s,t as r}from"./p-Bh_1GxOD.js";import{o as i,c as a,r as n}from"./p-C-0syqXZ.js";import{d as p}from"./p-JwSoedEO.js";import{i as c,c as h}from"./p-BnGhGgTH.js";import{c as d}from"./p-B_DaIVEY.js";const l=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}get host(){return this}open;defaultOpen=!1;for;placement="bottom-start";internalOpen=!1;overlayId="ui-popover-"+Math.random().toString(36).slice(2,11);anchor=null;surface=null;syncFromProp(){c(this.open)&&(this.internalOpen=this.open)}onOpenChange(){this.syncOverlay(),this.internalOpen?p(this.host,"open",{open:!0,reason:"programmatic",trigger:"programmatic"}):p(this.host,"close",{open:!1,reason:"programmatic",trigger:"programmatic"})}resetSurface(){this.setupSurface(),this.syncSurface()}setupSurface(){this.surface?.destroy(),this.surface=null,this.anchor=this.for?this.host.ownerDocument.getElementById(this.for):null,this.anchor&&(this.surface=d(this.host,{anchor:this.anchor,placement:this.placement}))}syncSurface(){this.surface&&(this.internalOpen?this.surface.show():this.surface.hide())}syncOverlay(){this.syncSurface(),this.internalOpen?i({id:this.overlayId,modal:!1,element:this.host,relatedElements:this.anchor?[this.anchor]:void 0,dismissible:!0,requestClose:(e,t)=>this.handleRequestClose(e,t)}):a(this.overlayId)}componentDidLoad(){this.internalOpen=h(this.open,this.defaultOpen),this.host.addEventListener("keydown",this.onKeydown),this.setupSurface(),this.syncOverlay()}disconnectedCallback(){this.host.removeEventListener("keydown",this.onKeydown),this.surface?.destroy(),this.surface=null,a(this.overlayId)}componentDidUpdate(){this.syncOverlay()}handleRequestClose(e,t){c(this.open)||(this.internalOpen=!1),p(this.host,"close",{open:!1,reason:e,trigger:t})}onKeydown=e=>{"Escape"===e.key&&n("escape","keyboard")};render(){return o(s,{key:"65a0927abc40450205989704bfde2cf7fd80d1f9","data-open":this.internalOpen?"":void 0,onKeyDown:this.onKeydown},o("div",{key:"255acaf99e0fe70a92048351b24bdfde1a4ea45f",class:"popover__surface"},o("slot",{key:"9d2f6c9d5a0f7a2766225aef0ec5b98b33ec9f07"})))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}}static get style(){return":host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:visible;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.popover__surface{box-sizing:border-box;max-inline-size:inherit;max-block-size:inherit;overflow:auto;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}"}},[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]),u=l,m=function(){"undefined"!=typeof customElements&&["ui-popover"].forEach((e=>{"ui-popover"===e&&(customElements.get(r(e))||customElements.define(r(e),l))}))};export{u as UiPopover,m as defineCustomElement}
@@ -1 +1 @@
1
- import{p as t,H as s,h as i,c as e,t as a}from"./p-Bh_1GxOD.js";import{d as r,e as o}from"./p-JwSoedEO.js";import{b as n}from"./p-Drw41pSY.js";const c=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get host(){return this}open=!0;internalOpen=!1;surface=null;contentObserver=null;pendingDismiss=null;syncFromProp(){this.syncContents()}syncSurface(){this.internalOpen?this.surface?.show():this.surface?.hide()}componentDidLoad(){this.surface=n(this.host),this.contentObserver=new MutationObserver(this.syncContents),this.contentObserver.observe(this.host,{childList:!0,subtree:!0}),this.syncContents(),this.syncSurface(),this.host.addEventListener("click",this.onClick)}disconnectedCallback(){this.host.removeEventListener("click",this.onClick),this.contentObserver?.disconnect(),this.contentObserver=null,this.surface?.destroy(),this.surface=null}getToasts(){return Array.from(this.host.querySelectorAll("[data-ui-toast]"))}syncContents=()=>{const t=this.open&&this.getToasts().length>0,s=this.internalOpen,i=this.pendingDismiss&&!this.host.contains(this.pendingDismiss.toast)?this.pendingDismiss:null;this.internalOpen=t,s&&!t&&i&&r(this.host,"close",{open:!1,reason:"action",trigger:i.trigger}),!i&&this.open||(this.pendingDismiss=null)};onClick=t=>{const s=t.target.closest?.("[data-ui-toast-dismiss]");if(!s)return;const i=s.closest?.("[data-ui-toast]");if(!i)return;const e=i.id??"",a=o(t);this.pendingDismiss={toast:i,trigger:a},r(this.host,"dismiss",{id:e,reason:"action",trigger:a})};render(){return i(e,{key:"9f9c2e14150c631c0f7cb427c693dcd52c20897d",role:"region","aria-label":"Notifications","aria-live":"polite","data-open":this.internalOpen?"":void 0},i("slot",{key:"9e1d9ebb6b587afab2c4302241cecb03a321cee1"}))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}}static get style(){return":host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}"}},[769,"ui-toast-region",{open:[4],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]),u=c,d=function(){"undefined"!=typeof customElements&&["ui-toast-region"].forEach((t=>{"ui-toast-region"===t&&(customElements.get(a(t))||customElements.define(a(t),c))}))};export{u as UiToastRegion,d as defineCustomElement}
1
+ import{p as t,H as s,h as i,c as e,t as a}from"./p-Bh_1GxOD.js";import{d as r,e as o}from"./p-JwSoedEO.js";import{b as n}from"./p-B_DaIVEY.js";const c=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get host(){return this}open=!0;internalOpen=!1;surface=null;contentObserver=null;pendingDismiss=null;syncFromProp(){this.syncContents()}syncSurface(){this.internalOpen?this.surface?.show():this.surface?.hide()}componentDidLoad(){this.surface=n(this.host),this.contentObserver=new MutationObserver(this.syncContents),this.contentObserver.observe(this.host,{childList:!0,subtree:!0}),this.syncContents(),this.syncSurface(),this.host.addEventListener("click",this.onClick)}disconnectedCallback(){this.host.removeEventListener("click",this.onClick),this.contentObserver?.disconnect(),this.contentObserver=null,this.surface?.destroy(),this.surface=null}getToasts(){return Array.from(this.host.querySelectorAll("[data-ui-toast]"))}syncContents=()=>{const t=this.open&&this.getToasts().length>0,s=this.internalOpen,i=this.pendingDismiss&&!this.host.contains(this.pendingDismiss.toast)?this.pendingDismiss:null;this.internalOpen=t,s&&!t&&i&&r(this.host,"close",{open:!1,reason:"action",trigger:i.trigger}),!i&&this.open||(this.pendingDismiss=null)};onClick=t=>{const s=t.target.closest?.("[data-ui-toast-dismiss]");if(!s)return;const i=s.closest?.("[data-ui-toast]");if(!i)return;const e=i.id??"",a=o(t);this.pendingDismiss={toast:i,trigger:a},r(this.host,"dismiss",{id:e,reason:"action",trigger:a})};render(){return i(e,{key:"9f9c2e14150c631c0f7cb427c693dcd52c20897d",role:"region","aria-label":"Notifications","aria-live":"polite","data-open":this.internalOpen?"":void 0},i("slot",{key:"9e1d9ebb6b587afab2c4302241cecb03a321cee1"}))}static get watchers(){return{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}}static get style(){return":host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}"}},[769,"ui-toast-region",{open:[4],internalOpen:[32]},void 0,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]),u=c,d=function(){"undefined"!=typeof customElements&&["ui-toast-region"].forEach((t=>{"ui-toast-region"===t&&(customElements.get(a(t))||customElements.define(a(t),c))}))};export{u as UiToastRegion,d as defineCustomElement}
@@ -1 +1 @@
1
- import{U as o,d as s}from"./p-DWN2m6ta.js";const t=o,a=s;export{t as UiTooltip,a as defineCustomElement}
1
+ import{U as o,d as s}from"./p-BzaB_bXo.js";const a=o,p=s;export{a as UiTooltip,p as defineCustomElement}
@@ -131,6 +131,22 @@ function createAnchoredSurface(surface, options = {}) {
131
131
  let open = false;
132
132
  let frame = null;
133
133
  let listenerAbort = null;
134
+ let sizeObserver = null;
135
+ // The surface can enter the top layer before its content has laid out (a
136
+ // menu's items, a tooltip's text), so its measured size is briefly zero or
137
+ // stale and the viewport clamp would run against the wrong geometry. Re-run
138
+ // positioning whenever the surface's own size settles.
139
+ const ResizeObserverImpl = owner.ResizeObserver;
140
+ const observeSurfaceSize = () => {
141
+ if (sizeObserver || typeof ResizeObserverImpl !== "function")
142
+ return;
143
+ sizeObserver = new ResizeObserverImpl(() => schedule());
144
+ sizeObserver.observe(surface);
145
+ };
146
+ const stopObservingSurfaceSize = () => {
147
+ sizeObserver?.disconnect();
148
+ sizeObserver = null;
149
+ };
134
150
  surface.setAttribute("popover", "manual");
135
151
  surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
136
152
  surface.style.position = "fixed";
@@ -174,6 +190,15 @@ function createAnchoredSurface(surface, options = {}) {
174
190
  positionNative();
175
191
  const viewport = getVisualViewportRect(owner);
176
192
  surfaceRect = surface.getBoundingClientRect();
193
+ // The surface can be measured before it paints (its first frames in the
194
+ // top layer, or while slow content/fonts settle), reporting a zero size.
195
+ // The pixel fallback below would then place it at `anchor - 0`, i.e. off
196
+ // the anchored edge, and leave it stranded there. Trust native anchor
197
+ // placement — which does not depend on our measurement — until the
198
+ // surface has real geometry; the scheduled re-run and ResizeObserver
199
+ // re-position once it does.
200
+ if (surfaceRect.width === 0 || surfaceRect.height === 0)
201
+ return;
177
202
  const shift = clampRectToViewport(surfaceRect, viewport, viewportGap);
178
203
  if (shift.x === 0 && shift.y === 0)
179
204
  return;
@@ -217,6 +242,12 @@ function createAnchoredSurface(surface, options = {}) {
217
242
  syncFallbackListeners();
218
243
  showInTopLayer(surface);
219
244
  position();
245
+ // The surface has just entered the top layer and may not be laid out yet,
246
+ // so the first position() can measure a zero/stale size and skip the
247
+ // viewport clamp. Re-position on the next frame, and keep re-positioning
248
+ // while the surface's own size settles as its content renders.
249
+ schedule();
250
+ observeSurfaceSize();
220
251
  },
221
252
  showAtPoint(nextPoint) {
222
253
  point = nextPoint;
@@ -224,11 +255,14 @@ function createAnchoredSurface(surface, options = {}) {
224
255
  syncFallbackListeners();
225
256
  showInTopLayer(surface);
226
257
  position();
258
+ schedule();
259
+ observeSurfaceSize();
227
260
  },
228
261
  hide() {
229
262
  open = false;
230
263
  point = null;
231
264
  syncFallbackListeners();
265
+ stopObservingSurfaceSize();
232
266
  if (frame !== null)
233
267
  owner.cancelAnimationFrame(frame);
234
268
  frame = null;
@@ -239,6 +273,7 @@ function createAnchoredSurface(surface, options = {}) {
239
273
  open = false;
240
274
  listenerAbort?.abort();
241
275
  listenerAbort = null;
276
+ stopObservingSurfaceSize();
242
277
  if (frame !== null)
243
278
  owner.cancelAnimationFrame(frame);
244
279
  frame = null;
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
- import { D as DEFAULT_AFFORDANCE_NEAR_RADIUS, c as createProximityCoordinator } from './positioning-Drmwg-C1.js';
2
+ import { D as DEFAULT_AFFORDANCE_NEAR_RADIUS, c as createProximityCoordinator } from './positioning-ZOr-2PSe.js';
3
3
 
4
4
  const uiAffordanceScopeCss = () => `:host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}`;
5
5
 
@@ -2,7 +2,7 @@ import { r as registerInstance, h, H as Host, c as createEvent, g as getElement
2
2
  import { o as openOverlay, c as closeOverlay } from './manager-C-0syqXZ.js';
3
3
  import { d as dispatchDetail } from './events-JwSoedEO.js';
4
4
  import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
5
- import { a as createAnchoredSurface } from './positioning-Drmwg-C1.js';
5
+ import { a as createAnchoredSurface } from './positioning-ZOr-2PSe.js';
6
6
 
7
7
  const uiChipCss = () => `:host{--ui-chip-surface:var(--ui-surface-subtle);--ui-chip-text:var(--ui-text-secondary);--ui-chip-border:var(--ui-border-default);--ui-chip-font-size:var(--ui-font-size-xs);--ui-chip-font-weight:var(--ui-font-normal);--ui-chip-line-height:var(--ui-line-height-tight);--ui-chip-padding-block:var(--ui-space-0-5);--ui-chip-padding-inline:var(--ui-space-2);--ui-chip-notch:var(--ui-space-1);display:inline-flex;min-width:0;max-width:100%}:host([data-size='sm']){--ui-chip-font-size:var(--ui-font-size-sm)}.chip__surface{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;max-width:100%;padding:var(--ui-chip-padding-block) var(--ui-chip-padding-inline);border:1px solid var(--ui-chip-border);background:var(--ui-chip-surface);color:var(--ui-chip-text) !important;font-family:var(--ui-font-family-sans) !important;font-size:var(--ui-chip-font-size) !important;font-weight:var(--ui-chip-font-weight) !important;line-height:var(--ui-chip-line-height) !important}.chip__label{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-appearance='pill']) .chip__surface{border-radius:var(--ui-radius-round)}:host([data-appearance='tag']) .chip__surface{border:0;padding-inline-end:calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));clip-path:polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%)}`;
8
8
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
- import { a as createAnchoredSurface } from './positioning-Drmwg-C1.js';
2
+ import { a as createAnchoredSurface } from './positioning-ZOr-2PSe.js';
3
3
  import { c as closeOverlay, o as openOverlay } from './manager-C-0syqXZ.js';
4
4
 
5
5
  /** Formatting is additive: every original character must survive in order.
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { o as openOverlay, c as closeOverlay, r as requestTopOverlayClose } from './manager-C-0syqXZ.js';
3
3
  import { d as dispatchDetail } from './events-JwSoedEO.js';
4
- import { a as createAnchoredSurface } from './positioning-Drmwg-C1.js';
4
+ import { a as createAnchoredSurface } from './positioning-ZOr-2PSe.js';
5
5
 
6
6
  const uiContextMenuCss = () => `:host{display:contents}:host([data-focus-trigger='pointer']) ::slotted(ui-menu-item:focus){outline:none}.menu{position:fixed;inset:auto;margin:0;z-index:var(--ui-z-overlay, 1000);min-width:12rem;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.menu:popover-open{opacity:1;transform:translateY(0) scale(1)}@starting-style{.menu:popover-open{opacity:0;transform:translateY(-4px) scale(0.99)}}.menu[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){.menu{transition:none}}`;
7
7
 
@@ -2,7 +2,7 @@ import { r as registerInstance, g as getElement, h, H as Host } from './index-8B
2
2
  import { d as dispatchDetail, e as eventToTrigger } from './events-JwSoedEO.js';
3
3
  import { o as openOverlay, c as closeOverlay, r as requestTopOverlayClose } from './manager-C-0syqXZ.js';
4
4
  import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
5
- import { a as createAnchoredSurface } from './positioning-Drmwg-C1.js';
5
+ import { a as createAnchoredSurface } from './positioning-ZOr-2PSe.js';
6
6
 
7
7
  const uiMenuCss = () => `:host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;max-inline-size:inherit;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg);max-block-size:inherit;overflow:auto}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:visible;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}`;
8
8
 
@@ -2,7 +2,7 @@ import { r as registerInstance, g as getElement, h, H as Host } from './index-8B
2
2
  import { o as openOverlay, c as closeOverlay, r as requestTopOverlayClose } from './manager-C-0syqXZ.js';
3
3
  import { d as dispatchDetail } from './events-JwSoedEO.js';
4
4
  import { i as isControlled, c as controlledOrDefault } from './controlled-state-BnGhGgTH.js';
5
- import { a as createAnchoredSurface } from './positioning-Drmwg-C1.js';
5
+ import { a as createAnchoredSurface } from './positioning-ZOr-2PSe.js';
6
6
 
7
7
  const uiPopoverCss = () => `:host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:visible;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.popover__surface{box-sizing:border-box;max-inline-size:inherit;max-block-size:inherit;overflow:auto;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}`;
8
8
 
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, g as getElement, h, H as Host } from './index-8BGiMGQ0.js';
2
2
  import { d as dispatchDetail, e as eventToTrigger } from './events-JwSoedEO.js';
3
- import { b as createViewportSurface } from './positioning-Drmwg-C1.js';
3
+ import { b as createViewportSurface } from './positioning-ZOr-2PSe.js';
4
4
 
5
5
  const uiToastRegionCss = () => `:host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}`;
6
6
 
package/dist/index.cjs CHANGED
@@ -24,7 +24,7 @@ var __copyProps = (to, from, except, desc) => {
24
24
  };
25
25
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
26
 
27
- // dist/esm/positioning-Drmwg-C1.js
27
+ // dist/esm/positioning-ZOr-2PSe.js
28
28
  function bindAnchorName(anchor, name) {
29
29
  const binding = anchorBindings.get(anchor) ?? {
30
30
  original: anchor.style.getPropertyValue("anchor-name"),
@@ -129,6 +129,18 @@ function createAnchoredSurface(surface, options = {}) {
129
129
  let open = false;
130
130
  let frame = null;
131
131
  let listenerAbort = null;
132
+ let sizeObserver = null;
133
+ const ResizeObserverImpl = owner.ResizeObserver;
134
+ const observeSurfaceSize = () => {
135
+ if (sizeObserver || typeof ResizeObserverImpl !== "function")
136
+ return;
137
+ sizeObserver = new ResizeObserverImpl(() => schedule());
138
+ sizeObserver.observe(surface);
139
+ };
140
+ const stopObservingSurfaceSize = () => {
141
+ sizeObserver?.disconnect();
142
+ sizeObserver = null;
143
+ };
132
144
  surface.setAttribute("popover", "manual");
133
145
  surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
134
146
  surface.style.position = "fixed";
@@ -173,6 +185,8 @@ function createAnchoredSurface(surface, options = {}) {
173
185
  positionNative();
174
186
  const viewport = getVisualViewportRect(owner);
175
187
  surfaceRect = surface.getBoundingClientRect();
188
+ if (surfaceRect.width === 0 || surfaceRect.height === 0)
189
+ return;
176
190
  const shift = clampRectToViewport(surfaceRect, viewport, viewportGap);
177
191
  if (shift.x === 0 && shift.y === 0)
178
192
  return;
@@ -214,6 +228,8 @@ function createAnchoredSurface(surface, options = {}) {
214
228
  syncFallbackListeners();
215
229
  showInTopLayer(surface);
216
230
  position();
231
+ schedule();
232
+ observeSurfaceSize();
217
233
  },
218
234
  showAtPoint(nextPoint) {
219
235
  point = nextPoint;
@@ -221,11 +237,14 @@ function createAnchoredSurface(surface, options = {}) {
221
237
  syncFallbackListeners();
222
238
  showInTopLayer(surface);
223
239
  position();
240
+ schedule();
241
+ observeSurfaceSize();
224
242
  },
225
243
  hide() {
226
244
  open = false;
227
245
  point = null;
228
246
  syncFallbackListeners();
247
+ stopObservingSurfaceSize();
229
248
  if (frame !== null)
230
249
  owner.cancelAnimationFrame(frame);
231
250
  frame = null;
@@ -236,6 +255,7 @@ function createAnchoredSurface(surface, options = {}) {
236
255
  open = false;
237
256
  listenerAbort?.abort();
238
257
  listenerAbort = null;
258
+ stopObservingSurfaceSize();
239
259
  if (frame !== null)
240
260
  owner.cancelAnimationFrame(frame);
241
261
  frame = null;
@@ -361,8 +381,8 @@ function createProximityCoordinator(scope, options = {}) {
361
381
  };
362
382
  }
363
383
  var DEFAULT_AFFORDANCE_NEAR_RADIUS, anchorSequence, anchorBindings;
364
- var init_positioning_Drmwg_C1 = __esm({
365
- "dist/esm/positioning-Drmwg-C1.js"() {
384
+ var init_positioning_ZOr_2PSe = __esm({
385
+ "dist/esm/positioning-ZOr-2PSe.js"() {
366
386
  DEFAULT_AFFORDANCE_NEAR_RADIUS = 16;
367
387
  anchorSequence = 0;
368
388
  anchorBindings = /* @__PURE__ */ new WeakMap();
@@ -378,7 +398,7 @@ var uiAffordanceScopeCss, UIAffordanceScope;
378
398
  var init_ui_affordance_scope_entry = __esm({
379
399
  "dist/esm/ui-affordance-scope.entry.js"() {
380
400
  init_index_8BGiMGQ0();
381
- init_positioning_Drmwg_C1();
401
+ init_positioning_ZOr_2PSe();
382
402
  uiAffordanceScopeCss = () => `:host{display:contents;--ui-affordance-scope-engaged:0}:host([data-ui-interaction='engaged']){--ui-affordance-scope-engaged:1}`;
383
403
  UIAffordanceScope = class {
384
404
  constructor(hostRef) {
@@ -1220,7 +1240,7 @@ var init_ui_chip_2_entry = __esm({
1220
1240
  init_manager_C_0syqXZ();
1221
1241
  init_events_JwSoedEO();
1222
1242
  init_controlled_state_BnGhGgTH();
1223
- init_positioning_Drmwg_C1();
1243
+ init_positioning_ZOr_2PSe();
1224
1244
  uiChipCss = () => `:host{--ui-chip-surface:var(--ui-surface-subtle);--ui-chip-text:var(--ui-text-secondary);--ui-chip-border:var(--ui-border-default);--ui-chip-font-size:var(--ui-font-size-xs);--ui-chip-font-weight:var(--ui-font-normal);--ui-chip-line-height:var(--ui-line-height-tight);--ui-chip-padding-block:var(--ui-space-0-5);--ui-chip-padding-inline:var(--ui-space-2);--ui-chip-notch:var(--ui-space-1);display:inline-flex;min-width:0;max-width:100%}:host([data-size='sm']){--ui-chip-font-size:var(--ui-font-size-sm)}.chip__surface{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;max-width:100%;padding:var(--ui-chip-padding-block) var(--ui-chip-padding-inline);border:1px solid var(--ui-chip-border);background:var(--ui-chip-surface);color:var(--ui-chip-text) !important;font-family:var(--ui-font-family-sans) !important;font-size:var(--ui-chip-font-size) !important;font-weight:var(--ui-chip-font-weight) !important;line-height:var(--ui-chip-line-height) !important}.chip__label{min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([data-appearance='pill']) .chip__surface{border-radius:var(--ui-radius-round)}:host([data-appearance='tag']) .chip__surface{border:0;padding-inline-end:calc(var(--ui-chip-padding-inline) + var(--ui-chip-notch));clip-path:polygon(0 0, calc(100% - var(--ui-chip-notch)) 0, 100% 50%, calc(100% - var(--ui-chip-notch)) 100%, 0 100%)}`;
1225
1245
  UIChip = class {
1226
1246
  constructor(hostRef) {
@@ -1535,7 +1555,7 @@ var uiComboboxCss, UICombobox;
1535
1555
  var init_ui_combobox_entry = __esm({
1536
1556
  "dist/esm/ui-combobox.entry.js"() {
1537
1557
  init_index_8BGiMGQ0();
1538
- init_positioning_Drmwg_C1();
1558
+ init_positioning_ZOr_2PSe();
1539
1559
  init_manager_C_0syqXZ();
1540
1560
  uiComboboxCss = () => `:host{display:grid;gap:var(--ui-space-1);min-inline-size:0;color:var(--ui-text-primary);font:inherit}label{color:var(--ui-field-label-color, var(--ui-text-primary));font-size:var(--ui-field-label-size, 0.875rem);font-weight:var(--ui-field-label-weight, 500)}.field{display:flex;min-inline-size:0;border:1px solid var(--ui-control-border, var(--ui-border-default));border-radius:var(--ui-radius-2);background:var(--ui-control-surface, var(--ui-surface-default))}.field:focus-within{border-color:var(--ui-control-focus, var(--ui-focus-ring));outline:2px solid var(--ui-control-focus, var(--ui-focus-ring));outline-offset:1px}input{appearance:none;width:100%;min-inline-size:0;min-block-size:var(--ui-control-min-block-size, 2.75rem);box-sizing:border-box;border:0;border-radius:inherit;background:transparent;color:inherit;font:inherit;line-height:var(--ui-line-height-md);padding:var(--ui-space-2) var(--ui-space-3);margin:0;outline:none}:host([data-size='sm']) input{min-block-size:var(--ui-field-compact-size, 2rem);padding:var(--ui-space-1) var(--ui-space-2)}button{appearance:none;border:0;border-radius:var(--ui-radius-2);background:transparent;color:var(--ui-field-affordance-color, var(--ui-text-secondary));font:inherit;font-weight:var(--ui-field-affordance-weight, 400);min-inline-size:2rem;padding:var(--ui-space-1);cursor:pointer}button:hover:enabled{background:var(--ui-surface-muted);color:var(--ui-text-primary)}button:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:-3px}input:disabled,button:disabled{color:var(--ui-text-muted);cursor:not-allowed}.field:has(input:disabled){background:var(--ui-control-surface-disabled, var(--ui-surface-muted))}:host([data-validation='error']) .field{border-color:var(--ui-danger-solid, var(--ui-accent-active))}.popup{box-sizing:border-box;min-inline-size:12rem;max-inline-size:calc(100vw - 1rem);max-block-size:var(--ui-combobox-max-block-size, 18rem);overflow:auto;margin:0;padding:var(--ui-space-1);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-2);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-md)}[hidden]{display:none !important}.option{padding:var(--ui-space-2) var(--ui-space-3);border-radius:var(--ui-radius-1);cursor:pointer;overflow-wrap:anywhere}.option:hover,.option[data-active]{background:var(--ui-surface-muted);outline:1px solid var(--ui-focus-ring);outline-offset:-1px}.option[aria-disabled='true']{color:var(--ui-text-muted);cursor:not-allowed}.primary{display:block;color:var(--ui-option-primary-color, var(--ui-text-primary));font-weight:var(--ui-option-primary-weight, 500)}.secondary{display:block;color:var(--ui-option-secondary-color, var(--ui-text-secondary));font-weight:var(--ui-option-secondary-weight, 400);font-size:var(--ui-font-size-sm)}.message,.group{color:var(--ui-field-message-color, var(--ui-text-secondary));font-weight:var(--ui-field-message-weight, 400);font-size:var(--ui-font-size-sm);line-height:var(--ui-line-height-md);overflow-wrap:anywhere}.group,.popup .message{padding:var(--ui-space-2) var(--ui-space-3)}.sr-only{position:absolute;inline-size:1px;block-size:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}@media (pointer: coarse){button{min-inline-size:2.75rem;min-block-size:2.75rem}}@media (forced-colors: active){.field,.popup{border-color:CanvasText}.option[data-active]{outline-color:Highlight}}:host([multiple]) .field{flex-wrap:wrap;align-items:center;gap:var(--ui-space-1);min-block-size:var(--ui-multi-combobox-min-block-size, 2.5rem);padding:var(--ui-space-1)}:host([multiple]) input{flex:1 0 var(--ui-multi-combobox-input-min-inline-size, 5rem);width:auto;min-block-size:1.75rem;padding:var(--ui-space-0-5) var(--ui-space-1)}.items{display:contents}.item{appearance:none;display:inline-flex;min-inline-size:0;max-inline-size:min(100%, var(--ui-multi-combobox-item-max-inline-size, 12rem));overflow:hidden;padding:0;border:0;border-radius:var(--ui-radius-1);background:transparent;color:inherit;font:inherit;cursor:default}.item>slot{display:block;min-inline-size:0;max-inline-size:100%;overflow:hidden}.item>slot::slotted(*){min-inline-size:0;max-inline-size:100%}.item:focus-visible{outline:2px solid var(--ui-focus-ring);outline-offset:1px}.item:disabled{opacity:.6}`;
1541
1561
  UICombobox = class {
@@ -2192,7 +2212,7 @@ var init_ui_context_menu_entry = __esm({
2192
2212
  init_index_8BGiMGQ0();
2193
2213
  init_manager_C_0syqXZ();
2194
2214
  init_events_JwSoedEO();
2195
- init_positioning_Drmwg_C1();
2215
+ init_positioning_ZOr_2PSe();
2196
2216
  uiContextMenuCss = () => `:host{display:contents}:host([data-focus-trigger='pointer']) ::slotted(ui-menu-item:focus){outline:none}.menu{position:fixed;inset:auto;margin:0;z-index:var(--ui-z-overlay, 1000);min-width:12rem;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}.menu:popover-open{opacity:1;transform:translateY(0) scale(1)}@starting-style{.menu:popover-open{opacity:0;transform:translateY(-4px) scale(0.99)}}.menu[hidden]{display:none !important}@media (prefers-reduced-motion: reduce){.menu{transition:none}}`;
2197
2217
  UIContextMenu = class {
2198
2218
  constructor(hostRef) {
@@ -3117,7 +3137,7 @@ var init_ui_menu_entry = __esm({
3117
3137
  init_events_JwSoedEO();
3118
3138
  init_manager_C_0syqXZ();
3119
3139
  init_controlled_state_BnGhGgTH();
3120
- init_positioning_Drmwg_C1();
3140
+ init_positioning_ZOr_2PSe();
3121
3141
  uiMenuCss = () => `:host{--ui-menu-viewport-gap:var(--ui-space-2, 0.5rem);display:flex;flex-direction:column;box-sizing:border-box;inline-size:max-content;min-inline-size:min(12rem, calc(100vw - (var(--ui-menu-viewport-gap) * 2)));max-inline-size:calc(100vw - (var(--ui-menu-viewport-gap) * 2));padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}.menu__surface{display:flex;flex-direction:column;box-sizing:border-box;max-inline-size:inherit;padding:var(--ui-space-1);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg);max-block-size:inherit;overflow:auto}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;overflow:visible;max-block-size:calc(100dvh - (var(--ui-menu-viewport-gap) * 2));opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}::slotted(ui-menu-item){display:block;width:100%}`;
3122
3142
  UIMenu = class {
3123
3143
  constructor(hostRef) {
@@ -3298,7 +3318,7 @@ var init_ui_popover_entry = __esm({
3298
3318
  init_manager_C_0syqXZ();
3299
3319
  init_events_JwSoedEO();
3300
3320
  init_controlled_state_BnGhGgTH();
3301
- init_positioning_Drmwg_C1();
3321
+ init_positioning_ZOr_2PSe();
3302
3322
  uiPopoverCss = () => `:host{--ui-popover-viewport-gap:var(--ui-space-2, 0.5rem);box-sizing:border-box;max-inline-size:min( 20rem, calc(100vw - (var(--ui-popover-viewport-gap) * 2)) );max-block-size:calc(100dvh - (var(--ui-popover-viewport-gap) * 2));overflow:visible;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.popover__surface{box-sizing:border-box;max-inline-size:inherit;max-block-size:inherit;overflow:auto;padding:var(--ui-space-3);background:var(--ui-surface-elevated);border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);box-shadow:var(--ui-shadow-lg)}:host(:not([data-open])){display:none}:host([popover]){position:fixed;inset:auto;margin:0;opacity:0;transform:translateY(-4px) scale(0.99);transition:opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease), display var(--ui-motion-fast) allow-discrete, overlay var(--ui-motion-fast) allow-discrete}:host([popover]:popover-open){opacity:1;transform:translateY(0) scale(1)}@starting-style{:host([popover]:popover-open){opacity:0;transform:translateY(-4px) scale(0.99)}}:host([hidden]){display:none !important}@media (prefers-reduced-motion: reduce){:host([popover]){transition:none}}`;
3303
3323
  UIPopover = class {
3304
3324
  constructor(hostRef) {
@@ -4215,7 +4235,7 @@ var init_ui_toast_region_entry = __esm({
4215
4235
  "dist/esm/ui-toast-region.entry.js"() {
4216
4236
  init_index_8BGiMGQ0();
4217
4237
  init_events_JwSoedEO();
4218
- init_positioning_Drmwg_C1();
4238
+ init_positioning_ZOr_2PSe();
4219
4239
  uiToastRegionCss = () => `:host{position:fixed;top:calc(var(--ui-space-4) + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:9999;display:grid;gap:var(--ui-space-2);inline-size:min(24rem, calc(100vw - (var(--ui-space-4) * 2)));max-inline-size:100%;pointer-events:none}:host([popover]){right:auto;bottom:auto;margin:0}:host>*{pointer-events:auto}::slotted([data-ui-toast]){display:grid;grid-template-columns:1fr auto;gap:var(--ui-space-2);align-items:start;border:1px solid var(--ui-border-default);border-radius:var(--ui-radius-3);padding:var(--ui-space-3) var(--ui-space-4);background:var(--ui-surface-elevated);color:var(--ui-text-primary);box-shadow:var(--ui-shadow-lg);animation:ui-toast-enter 0.25s var(--ui-motion-ease) forwards}@keyframes ui-toast-enter{from{opacity:0;transform:translateY(-0.5rem)}to{opacity:1;transform:translateY(0)}}::slotted([data-ui-toast][aria-hidden='true']){display:none}::slotted([data-ui-toast-dismiss]){border:0;background:transparent;color:var(--ui-text-secondary);cursor:pointer;font:inherit}`;
4220
4240
  UIToastRegion = class {
4221
4241
  constructor(hostRef) {
@@ -6848,6 +6868,17 @@ function createAnchoredSurface2(surface, options = {}) {
6848
6868
  let open = false;
6849
6869
  let frame = null;
6850
6870
  let listenerAbort = null;
6871
+ let sizeObserver = null;
6872
+ const ResizeObserverImpl = owner.ResizeObserver;
6873
+ const observeSurfaceSize = () => {
6874
+ if (sizeObserver || typeof ResizeObserverImpl !== "function") return;
6875
+ sizeObserver = new ResizeObserverImpl(() => schedule());
6876
+ sizeObserver.observe(surface);
6877
+ };
6878
+ const stopObservingSurfaceSize = () => {
6879
+ sizeObserver?.disconnect();
6880
+ sizeObserver = null;
6881
+ };
6851
6882
  surface.setAttribute("popover", "manual");
6852
6883
  surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
6853
6884
  surface.style.position = "fixed";
@@ -6891,6 +6922,7 @@ function createAnchoredSurface2(surface, options = {}) {
6891
6922
  positionNative();
6892
6923
  const viewport = getVisualViewportRect2(owner);
6893
6924
  surfaceRect = surface.getBoundingClientRect();
6925
+ if (surfaceRect.width === 0 || surfaceRect.height === 0) return;
6894
6926
  const shift = clampRectToViewport2(surfaceRect, viewport, viewportGap);
6895
6927
  if (shift.x === 0 && shift.y === 0) return;
6896
6928
  }
@@ -6936,6 +6968,8 @@ function createAnchoredSurface2(surface, options = {}) {
6936
6968
  syncFallbackListeners();
6937
6969
  showInTopLayer2(surface);
6938
6970
  position();
6971
+ schedule();
6972
+ observeSurfaceSize();
6939
6973
  },
6940
6974
  showAtPoint(nextPoint) {
6941
6975
  point = nextPoint;
@@ -6943,11 +6977,14 @@ function createAnchoredSurface2(surface, options = {}) {
6943
6977
  syncFallbackListeners();
6944
6978
  showInTopLayer2(surface);
6945
6979
  position();
6980
+ schedule();
6981
+ observeSurfaceSize();
6946
6982
  },
6947
6983
  hide() {
6948
6984
  open = false;
6949
6985
  point = null;
6950
6986
  syncFallbackListeners();
6987
+ stopObservingSurfaceSize();
6951
6988
  if (frame !== null) owner.cancelAnimationFrame(frame);
6952
6989
  frame = null;
6953
6990
  hideFromTopLayer2(surface);
@@ -6957,6 +6994,7 @@ function createAnchoredSurface2(surface, options = {}) {
6957
6994
  open = false;
6958
6995
  listenerAbort?.abort();
6959
6996
  listenerAbort = null;
6997
+ stopObservingSurfaceSize();
6960
6998
  if (frame !== null) owner.cancelAnimationFrame(frame);
6961
6999
  frame = null;
6962
7000
  hideFromTopLayer2(surface);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  bootstrapLazy
3
- } from "./chunk-JXSHRMYW.js";
3
+ } from "./chunk-CSULYHMX.js";
4
4
 
5
5
  // dist/esm/app-globals-DQuL1Twl.js
6
6
  var globalScripts = () => {
@@ -241,6 +241,17 @@ function createAnchoredSurface(surface, options = {}) {
241
241
  let open = false;
242
242
  let frame = null;
243
243
  let listenerAbort = null;
244
+ let sizeObserver = null;
245
+ const ResizeObserverImpl = owner.ResizeObserver;
246
+ const observeSurfaceSize = () => {
247
+ if (sizeObserver || typeof ResizeObserverImpl !== "function") return;
248
+ sizeObserver = new ResizeObserverImpl(() => schedule());
249
+ sizeObserver.observe(surface);
250
+ };
251
+ const stopObservingSurfaceSize = () => {
252
+ sizeObserver?.disconnect();
253
+ sizeObserver = null;
254
+ };
244
255
  surface.setAttribute("popover", "manual");
245
256
  surface.dataset.uiPositioning = nativeAnchor ? "anchor" : "fallback";
246
257
  surface.style.position = "fixed";
@@ -284,6 +295,7 @@ function createAnchoredSurface(surface, options = {}) {
284
295
  positionNative();
285
296
  const viewport = getVisualViewportRect(owner);
286
297
  surfaceRect = surface.getBoundingClientRect();
298
+ if (surfaceRect.width === 0 || surfaceRect.height === 0) return;
287
299
  const shift = clampRectToViewport(surfaceRect, viewport, viewportGap);
288
300
  if (shift.x === 0 && shift.y === 0) return;
289
301
  }
@@ -329,6 +341,8 @@ function createAnchoredSurface(surface, options = {}) {
329
341
  syncFallbackListeners();
330
342
  showInTopLayer(surface);
331
343
  position();
344
+ schedule();
345
+ observeSurfaceSize();
332
346
  },
333
347
  showAtPoint(nextPoint) {
334
348
  point = nextPoint;
@@ -336,11 +350,14 @@ function createAnchoredSurface(surface, options = {}) {
336
350
  syncFallbackListeners();
337
351
  showInTopLayer(surface);
338
352
  position();
353
+ schedule();
354
+ observeSurfaceSize();
339
355
  },
340
356
  hide() {
341
357
  open = false;
342
358
  point = null;
343
359
  syncFallbackListeners();
360
+ stopObservingSurfaceSize();
344
361
  if (frame !== null) owner.cancelAnimationFrame(frame);
345
362
  frame = null;
346
363
  hideFromTopLayer(surface);
@@ -350,6 +367,7 @@ function createAnchoredSurface(surface, options = {}) {
350
367
  open = false;
351
368
  listenerAbort?.abort();
352
369
  listenerAbort = null;
370
+ stopObservingSurfaceSize();
353
371
  if (frame !== null) owner.cancelAnimationFrame(frame);
354
372
  frame = null;
355
373
  hideFromTopLayer(surface);
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-8BGiMGQ0.js";export{s as setNonce}from"./p-8BGiMGQ0.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((async e=>(await n(),a([["p-55e06e2e",[[769,"ui-combobox",{label:[1],placeholder:[1],name:[1],value:[1],defaultValue:[1,"default-value"],multiple:[516],tokenSeparators:[16],query:[1],defaultQuery:[1,"default-query"],config:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],size:[1],labelVisibility:[1,"label-visibility"],disclosure:[4],clearable:[4],help:[1],raw:[32],display:[32],selected:[32],expanded:[32],rows:[32],active:[32],loading:[32],helpOpen:[32],lookupError:[32],validation:[32],validate:[64],focusInput:[64]},null,{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}]]],["p-37ec2b4b",[[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32],focusTrigger:[32]},null,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]]],["p-32c85198",[[769,"ui-affordance-scope",{nearRadius:[514,"near-radius"]},null,{nearRadius:[{connectCoordinator:0}]}]]],["p-08f80207",[[513,"ui-avatar",{src:[1],alt:[1],name:[1],fallback:[1],hasImage:[32]},null,{src:[{watchSrc:0}]}]]],["p-d56571a2",[[769,"ui-avatar-group",{max:[2],label:[1],overflowCount:[32]},null,{max:[{syncOverflow:0}]}]]],["p-5fdcee1d",[[769,"ui-badge",{variant:[1],tone:[1]}]]],["p-7ab661ec",[[769,"ui-button",{variant:[1],size:[1],disabled:[4]},null,{variant:[{syncToButton:0}],size:[{syncToButton:0}],disabled:[{syncToButton:0}]}]]],["p-add67e4c",[[769,"ui-callout",{tone:[1]}]]],["p-9d2662ca",[[769,"ui-checkbox",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],indeterminate:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],internalChecked:[{syncToInput:0}],indeterminate:[{syncToInput:0}],disabled:[{syncToInput:0}],required:[{syncToInput:0}]}]]],["p-e604e906",[[769,"ui-dialog",{open:[4],defaultOpen:[4,"default-open"],modal:[4],dismissible:[4],label:[1],internalOpen:[32],accessibleLabel:[32]},null,{open:[{syncFromProp:0}],label:[{syncLabelFromProp:0}],internalOpen:[{syncOpen:0}]}]]],["p-2915d5c0",[[769,"ui-disclosure",{open:[4],defaultOpen:[4,"default-open"],disabled:[4],internalOpen:[32],contentId:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncState:0}]}]]],["p-22842f8c",[[769,"ui-editable",{edit:[4],defaultEdit:[4,"default-edit"],disabled:[4],internalEdit:[32]},null,{edit:[{syncFromProp:0}]}]]],["p-3f60f4c8",[[769,"ui-floating-action-button",{disabled:[516],mobileOnly:[516,"mobile-only"],label:[1]}]]],["p-3b2961a6",[[769,"ui-form-field",{invalid:[4],disabled:[4],required:[4]}]]],["p-b6ede6bb",[[769,"ui-icon-button",{disabled:[516],label:[1],size:[513],variant:[513],anticipatory:[516]}]]],["p-1c00670f",[[769,"ui-input",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToInput:0}],defaultValue:[{syncToInput:0}],disabled:[{syncToInput:0}],invalid:[{syncToInput:0}],readOnly:[{syncToInput:0}]}]]],["p-7c0b5364",[[769,"ui-menu-item",{disabled:[516],value:[1]}]]],["p-b6fb6ba3",[[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]]],["p-424d6719",[[769,"ui-radio",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],name:[1],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],disabled:[{syncToInput:0}],name:[{syncToInput:0}],required:[{syncToInput:0}],value:[{syncToInput:0}]}]]],["p-d5c3954f",[[769,"ui-radio-group",{value:[1],name:[1],orientation:[1],disabled:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToRadios:0}],name:[{syncToRadios:0}],orientation:[{syncToRadios:0}],disabled:[{syncToRadios:0}]}]]],["p-9cfbf722",[[769,"ui-search-result-row",{disabled:[516],selected:[516],hasLeading:[32],hasMeta:[32],hasExcerpt:[32],hasTrailing:[32]}]]],["p-8bdd9495",[[769,"ui-search-shell",{hasStatus:[32],hasFooter:[32]}]]],["p-6f20d470",[[769,"ui-select",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToSelect:0}],defaultValue:[{syncToSelect:0}],disabled:[{syncToSelect:0}],invalid:[{syncToSelect:0}],required:[{syncToSelect:0}]}]]],["p-d4825822",[[769,"ui-switch",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}]}]]],["p-d372b0db",[[769,"ui-tabs",{value:[1],defaultValue:[1,"default-value"],orientation:[1],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncState:0}],orientation:[{syncState:0}]}]]],["p-b76e2111",[[769,"ui-textarea",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],rows:[2],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToTextarea:0}],defaultValue:[{syncToTextarea:0}],disabled:[{syncToTextarea:0}],invalid:[{syncToTextarea:0}],readOnly:[{syncToTextarea:0}],rows:[{syncToTextarea:0}]}]]],["p-56dac38a",[[769,"ui-toast-region",{open:[4],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]]],["p-1249a806",[[769,"ui-top-bar",{hasLeading:[32],hasSearch:[32],hasActions:[32]}]]],["p-f1f7c5cb",[[769,"ui-tree",{label:[1],hoverExpandDelay:[2,"hover-expand-delay"],maxDepth:[2,"max-depth"]}]]],["p-4caccfce",[[769,"ui-tree-item",{itemId:[1,"item-id"],label:[1],dropDepth:[2,"drop-depth"],subtreeDepth:[2,"subtree-depth"],container:[4],sortable:[4],dragType:[1,"drag-type"],dropScope:[1,"drop-scope"],accepts:[1],expanded:[4],defaultExpanded:[4,"default-expanded"],selected:[4],disabled:[4],internalExpanded:[32],structuralLevel:[32],tabStop:[32]},null,{expanded:[{syncExpandedFromProp:0}]}]]],["p-d46317e0",[[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]]],["p-5cbbf7a0",[[769,"ui-chip",{appearance:[1],size:[1]}],[769,"ui-tooltip",{for:[1],open:[4],defaultOpen:[4,"default-open"],placement:[1],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],toggleOnClick:[4,"toggle-on-click"],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}]]]],e))));
1
+ import{p as e,b as a}from"./p-8BGiMGQ0.js";export{s as setNonce}from"./p-8BGiMGQ0.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,n={};return""!==a&&(n.resourcesUrl=new URL(".",a).href),e(n)})().then((async e=>(await n(),a([["p-0b5b8d9e",[[769,"ui-combobox",{label:[1],placeholder:[1],name:[1],value:[1],defaultValue:[1,"default-value"],multiple:[516],tokenSeparators:[16],query:[1],defaultQuery:[1,"default-query"],config:[16],disabled:[4],readOnly:[4,"readonly"],required:[4],size:[1],labelVisibility:[1,"label-visibility"],disclosure:[4],clearable:[4],help:[1],raw:[32],display:[32],selected:[32],expanded:[32],rows:[32],active:[32],loading:[32],helpOpen:[32],lookupError:[32],validation:[32],validate:[64],focusInput:[64]},null,{value:[{syncValue:0}],query:[{syncQuery:0}],disabled:[{syncDisabled:0}],readOnly:[{syncDisabled:0}],config:[{syncConfig:0}]}]]],["p-6d8b99ee",[[769,"ui-context-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],internalOpen:[32],focusTrigger:[32]},null,{open:[{syncFromProp:0}],for:[{syncTarget:0}],internalOpen:[{syncOverlay:0}]}]]],["p-16e0669d",[[769,"ui-affordance-scope",{nearRadius:[514,"near-radius"]},null,{nearRadius:[{connectCoordinator:0}]}]]],["p-08f80207",[[513,"ui-avatar",{src:[1],alt:[1],name:[1],fallback:[1],hasImage:[32]},null,{src:[{watchSrc:0}]}]]],["p-d56571a2",[[769,"ui-avatar-group",{max:[2],label:[1],overflowCount:[32]},null,{max:[{syncOverflow:0}]}]]],["p-5fdcee1d",[[769,"ui-badge",{variant:[1],tone:[1]}]]],["p-7ab661ec",[[769,"ui-button",{variant:[1],size:[1],disabled:[4]},null,{variant:[{syncToButton:0}],size:[{syncToButton:0}],disabled:[{syncToButton:0}]}]]],["p-add67e4c",[[769,"ui-callout",{tone:[1]}]]],["p-9d2662ca",[[769,"ui-checkbox",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],indeterminate:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],internalChecked:[{syncToInput:0}],indeterminate:[{syncToInput:0}],disabled:[{syncToInput:0}],required:[{syncToInput:0}]}]]],["p-e604e906",[[769,"ui-dialog",{open:[4],defaultOpen:[4,"default-open"],modal:[4],dismissible:[4],label:[1],internalOpen:[32],accessibleLabel:[32]},null,{open:[{syncFromProp:0}],label:[{syncLabelFromProp:0}],internalOpen:[{syncOpen:0}]}]]],["p-2915d5c0",[[769,"ui-disclosure",{open:[4],defaultOpen:[4,"default-open"],disabled:[4],internalOpen:[32],contentId:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncState:0}]}]]],["p-22842f8c",[[769,"ui-editable",{edit:[4],defaultEdit:[4,"default-edit"],disabled:[4],internalEdit:[32]},null,{edit:[{syncFromProp:0}]}]]],["p-3f60f4c8",[[769,"ui-floating-action-button",{disabled:[516],mobileOnly:[516,"mobile-only"],label:[1]}]]],["p-3b2961a6",[[769,"ui-form-field",{invalid:[4],disabled:[4],required:[4]}]]],["p-b6ede6bb",[[769,"ui-icon-button",{disabled:[516],label:[1],size:[513],variant:[513],anticipatory:[516]}]]],["p-1c00670f",[[769,"ui-input",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToInput:0}],defaultValue:[{syncToInput:0}],disabled:[{syncToInput:0}],invalid:[{syncToInput:0}],readOnly:[{syncToInput:0}]}]]],["p-7c0b5364",[[769,"ui-menu-item",{disabled:[516],value:[1]}]]],["p-99116a72",[[769,"ui-popover",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{onOpenChange:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}]}]]],["p-424d6719",[[769,"ui-radio",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],name:[1],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}],disabled:[{syncToInput:0}],name:[{syncToInput:0}],required:[{syncToInput:0}],value:[{syncToInput:0}]}]]],["p-d5c3954f",[[769,"ui-radio-group",{value:[1],name:[1],orientation:[1],disabled:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToRadios:0}],name:[{syncToRadios:0}],orientation:[{syncToRadios:0}],disabled:[{syncToRadios:0}]}]]],["p-9cfbf722",[[769,"ui-search-result-row",{disabled:[516],selected:[516],hasLeading:[32],hasMeta:[32],hasExcerpt:[32],hasTrailing:[32]}]]],["p-8bdd9495",[[769,"ui-search-shell",{hasStatus:[32],hasFooter:[32]}]]],["p-6f20d470",[[769,"ui-select",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],required:[4],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToSelect:0}],defaultValue:[{syncToSelect:0}],disabled:[{syncToSelect:0}],invalid:[{syncToSelect:0}],required:[{syncToSelect:0}]}]]],["p-d4825822",[[769,"ui-switch",{checked:[4],defaultChecked:[4,"default-checked"],disabled:[4],required:[4],value:[1],internalChecked:[32]},null,{checked:[{syncFromProp:0}]}]]],["p-d372b0db",[[769,"ui-tabs",{value:[1],defaultValue:[1,"default-value"],orientation:[1],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncState:0}],orientation:[{syncState:0}]}]]],["p-b76e2111",[[769,"ui-textarea",{value:[1],defaultValue:[1,"default-value"],disabled:[4],invalid:[4],readOnly:[4,"readonly"],rows:[2],internalValue:[32]},null,{value:[{syncFromProp:0}],internalValue:[{syncToTextarea:0}],defaultValue:[{syncToTextarea:0}],disabled:[{syncToTextarea:0}],invalid:[{syncToTextarea:0}],readOnly:[{syncToTextarea:0}],rows:[{syncToTextarea:0}]}]]],["p-ca2a54fd",[[769,"ui-toast-region",{open:[4],internalOpen:[32]},null,{open:[{syncFromProp:0}],internalOpen:[{syncSurface:0}]}]]],["p-1249a806",[[769,"ui-top-bar",{hasLeading:[32],hasSearch:[32],hasActions:[32]}]]],["p-f1f7c5cb",[[769,"ui-tree",{label:[1],hoverExpandDelay:[2,"hover-expand-delay"],maxDepth:[2,"max-depth"]}]]],["p-4caccfce",[[769,"ui-tree-item",{itemId:[1,"item-id"],label:[1],dropDepth:[2,"drop-depth"],subtreeDepth:[2,"subtree-depth"],container:[4],sortable:[4],dragType:[1,"drag-type"],dropScope:[1,"drop-scope"],accepts:[1],expanded:[4],defaultExpanded:[4,"default-expanded"],selected:[4],disabled:[4],internalExpanded:[32],structuralLevel:[32],tabStop:[32]},null,{expanded:[{syncExpandedFromProp:0}]}]]],["p-a2dd4c6c",[[769,"ui-menu",{open:[4],defaultOpen:[4,"default-open"],for:[1],placement:[1],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncSurface:0}]}]]],["p-9ff2fa19",[[769,"ui-chip",{appearance:[1],size:[1]}],[769,"ui-tooltip",{for:[1],open:[4],defaultOpen:[4,"default-open"],placement:[1],showDelay:[2,"show-delay"],hideDelay:[2,"hide-delay"],toggleOnClick:[4,"toggle-on-click"],internalOpen:[32]},null,{open:[{syncFromProp:0}],for:[{resetSurface:0}],placement:[{resetSurface:0}],internalOpen:[{syncOverlay:0}]}]]]],e))));