@vireo-ai/trellis-ui 0.1.57 → 0.1.59

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 (78) hide show
  1. package/package.json +2 -1
  2. package/packages/client/src/components/keybinding/styles.css +15 -5
  3. package/packages/client/src/components/tabs/styles.css +9 -1
  4. package/packages/client/src/components/tooltip/styles.css +2 -2
  5. package/packages/client/src/directives/sortable.css +8 -0
  6. package/packages/client/src/runtime/drag-and-drop/resize-handle.css +50 -0
  7. package/packages/client/src/styles/generated/theme-fonts.css +1 -1
  8. package/packages/client/src/styles/generated/theme-palette.css +1 -1
  9. package/packages/client/src/styles/generated/theme-runtime.css +3 -3
  10. package/packages/client/src/styles/generated-sources.css +1 -1
  11. package/packages/client/types/components/keybinding/contract.d.ts +5 -5
  12. package/packages/client/types/components/modal/contract.d.ts +9 -3
  13. package/packages/client/types/motion/recipe.d.ts +2 -2
  14. package/packages/client/types/runtime/drag-and-drop/pdd.d.ts +2 -2
  15. package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.css +45 -13
  16. package/packages/server/trellis_ui/static/trellis_ui/assets/css/trellis.min.css +1 -1
  17. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/build-metadata.json +277 -277
  18. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/motion.js +1 -1
  19. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/capabilities/sortable.js +1 -1
  20. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{capability-motion-BGVnZE_T.js → capability-motion-D_BJBnwB.js} +2 -2
  21. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{capability-motion-BGVnZE_T.js.map → capability-motion-D_BJBnwB.js.map} +1 -1
  22. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-BDbURlVO.js +5 -0
  23. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-BDbURlVO.js.map +1 -0
  24. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/controller-C8xqwkr0.js +2 -0
  25. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/controller-C8xqwkr0.js.map +1 -0
  26. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-DYQxGle9.js → entry.generated-18lXAVBg.js} +2 -2
  27. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-DYQxGle9.js.map → entry.generated-18lXAVBg.js.map} +1 -1
  28. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-C_ObpRjR.js → entry.generated-2YvnuzOD.js} +2 -2
  29. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-C_ObpRjR.js.map → entry.generated-2YvnuzOD.js.map} +1 -1
  30. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-z3EbXrD0.js → entry.generated-BITa8xFV.js} +2 -2
  31. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-z3EbXrD0.js.map → entry.generated-BITa8xFV.js.map} +1 -1
  32. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-D_jeOgRf.js → entry.generated-BSVJpGWu.js} +2 -2
  33. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-D_jeOgRf.js.map → entry.generated-BSVJpGWu.js.map} +1 -1
  34. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BgGSoQFS.js +2 -0
  35. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-BgGSoQFS.js.map +1 -0
  36. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-COp9wMCd.js → entry.generated-Bp3Npe3t.js} +2 -2
  37. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-COp9wMCd.js.map → entry.generated-Bp3Npe3t.js.map} +1 -1
  38. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-CVOYoh61.js → entry.generated-Ce_fpT15.js} +2 -2
  39. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-CVOYoh61.js.map → entry.generated-Ce_fpT15.js.map} +1 -1
  40. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-Cb-VMAE1.js → entry.generated-DDrayI_M.js} +2 -2
  41. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-Cb-VMAE1.js.map → entry.generated-DDrayI_M.js.map} +1 -1
  42. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-DaXIKPN9.js → entry.generated-HqE8R7N1.js} +2 -2
  43. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-DaXIKPN9.js.map → entry.generated-HqE8R7N1.js.map} +1 -1
  44. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-BREj4oHG.js → entry.generated-OT_bt7F2.js} +2 -2
  45. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-BREj4oHG.js.map → entry.generated-OT_bt7F2.js.map} +1 -1
  46. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-BAghaHV-.js → entry.generated-WRveW7p9.js} +2 -2
  47. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-BAghaHV-.js.map → entry.generated-WRveW7p9.js.map} +1 -1
  48. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-D6ai6meC.js → entry.generated-dcqwycC7.js} +2 -2
  49. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{entry.generated-D6ai6meC.js.map → entry.generated-dcqwycC7.js.map} +1 -1
  50. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{flip-Bzn312Nc.js → flip-crNQSZEa.js} +2 -2
  51. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{flip-Bzn312Nc.js.map → flip-crNQSZEa.js.map} +1 -1
  52. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/{motion-DI5H1Js0.js → motion-B90yNOaV.js} +2 -2
  53. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-B90yNOaV.js.map +1 -0
  54. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/pdd-BG5sXFGF.js.map +1 -1
  55. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/accordion.js +1 -1
  56. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/data-grid.js +1 -1
  57. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/date-picker.js +1 -1
  58. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/dropdown.js +1 -1
  59. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/index.js +1 -1
  60. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/keybinding.js +1 -1
  61. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/modal.js +1 -1
  62. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/panels.js +1 -1
  63. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/select.js +1 -1
  64. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/sidebar.js +1 -1
  65. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tabs.js +1 -1
  66. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/toast.js +1 -1
  67. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/components/tooltip.js +1 -1
  68. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/index.js +1 -1
  69. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/logical-entry-manifest.json +77 -77
  70. package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.js +7 -7
  71. package/packages/server/trellis_ui/static/trellis_ui/assets/js/trellis.min.js +7 -7
  72. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-ehmPfdn1.js +0 -5
  73. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/capability-sortable-ehmPfdn1.js.map +0 -1
  74. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/controller-CalXJ5hB.js +0 -2
  75. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/controller-CalXJ5hB.js.map +0 -1
  76. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DqL-zI7j.js +0 -2
  77. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/entry.generated-DqL-zI7j.js.map +0 -1
  78. package/packages/server/trellis_ui/static/trellis_ui/assets/js/esm/chunks/motion-DI5H1Js0.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as e,t}from"./dom-DiTFTWeR.js";import{t as n}from"./capability-motion-BGVnZE_T.js";import{n as r}from"./morph-Cq3V_23_.js";import{c as i,f as a,l as o,n as s,t as c}from"./codecs-CQ7olTJL.js";import{i as l,t as u}from"./alpine-machine-CE2UN4Qu.js";import{n as d}from"./dom-invalidation-Dw6clnS4.js";import{n as f}from"./focus-pk_lz9sg.js";import{t as p}from"./cleanup-manager-D9QiZF_Q.js";import{n as m}from"./alpine-data-Dvc_bXq6.js";import{n as h}from"./anchored-popover-BwQbt4V2.js";import{n as g,t as _}from"./styles-CX2j92ex.js";import{t as v}from"./merge-bindings-BtqW3UgP.js";import{t as y}from"./machine-CNnHDbyo.js";import{t as b}from"./semantic-observer-CIoriWtV.js";import{I as x,L as S,d as C,t as w,z as T}from"./common-CBK89mIt.js";import{o as E}from"./capability-shortcut-DZUQHJ3A.js";import{n as D,t as O}from"./controller-CalXJ5hB.js";var k={side:o(S,`bottom`),align:o(w,`center`),offset:i.clamp(-100,100).default(0),gap:i.clamp(0,50).default(8),openDelay:i.clamp(0,5e3).default(400),closeDelay:i.clamp(0,5e3).default(150),color:o([`neutral`,`accent`,`success`,`warning`,`danger`],`neutral`),variant:o([`surface`,`soft`,`solid`],`surface`),surface:o(T,`2`),elevation:o(C,`4`),disabled:s,class:a},A={side:c(k.side,`ui-tooltip-side`),align:c(k.align,`ui-tooltip-align`),offset:c(k.offset,`ui-tooltip-offset`),gap:c(k.gap,`ui-tooltip-gap`),openDelay:c(k.openDelay,`ui-tooltip-open-delay`),closeDelay:c(k.closeDelay,`ui-tooltip-close-delay`),color:c(k.color,`ui-tooltip-color`),variant:c(k.variant,`ui-tooltip-variant`),surface:c(k.surface,`ui-tooltip-surface`),elevation:c(k.elevation,`ui-tooltip-elevation`),disabled:c(k.disabled,`ui-tooltip-disabled`)},j=({context:e})=>e.transition,M=[l({name:`opening`,state:`opening`,project:j,onDone:`OPENING_DONE`,onError:`OPENING_ERROR`}),l({name:`closing`,state:`closing`,project:j,onDone:`CLOSING_DONE`,onError:`CLOSING_ERROR`})],N=e=>{let t=e.reason;return t===`focus`||t===`escape`||t===`activation`||t===`scroll`||t===`blur`||t===`disabled`||t===`replacement`?t:`pointer`},P=(e,t)=>y({initial:`closed`,states:{closed:{tags:[`closed`],on:{OPEN:{target:`opening`,guard:`canOpen`,reduce:`transition`,effects:`prepareOpen`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}}},opening:{tags:[`visible`,`expanded`,`transitioning`],on:{OPENING_DONE:{target:`open`,effects:`finishOpen`},OPENING_ERROR:{target:`open`,effects:`finishOpen`},CLOSE:{target:`closing`,reduce:`transition`,effects:`prepareClose`},PROPS_CHANGED:[{target:`closing`,guard:`becomesDisabled`,reduce:`replacePropsDisabled`,effects:[`syncProps`,`prepareClose`]},{reduce:`replaceProps`,effects:`syncProps`}]}},open:{tags:[`visible`,`expanded`,`open`],on:{CLOSE:{target:`closing`,reduce:`transition`,effects:`prepareClose`},PROPS_CHANGED:[{target:`closing`,guard:`becomesDisabled`,reduce:`replacePropsDisabled`,effects:[`syncProps`,`prepareClose`]},{reduce:`replaceProps`,effects:`syncProps`}]}},closing:{tags:[`visible`,`transitioning`],on:{CLOSING_DONE:{target:`closed`,effects:`finishClose`},CLOSING_ERROR:{target:`closed`,effects:`finishClose`},OPEN:{target:`opening`,guard:`canOpen`,reduce:`transition`,effects:`prepareOpen`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}}}}},{context:{transition:{reason:`pointer`,instant:!1}},props:e,reducers:{transition:({context:e,props:t,event:n})=>({context:{transition:{reason:N(n),instant:n.instant===!0}},props:t}),replaceProps:({context:e,props:t,event:n})=>({context:e,props:n.props??t}),replacePropsDisabled:({context:e,props:t,event:n})=>({context:{transition:{reason:`disabled`,instant:!0}},props:n.props??t})},guards:{canOpen:({props:e})=>!e.disabled,becomesDisabled:({event:e})=>e.props?.disabled===!0},effects:t}),F=_({definition:{component:`ui.tooltip`,parts:{root:{base:`contents`},content:{base:[x,`pointer-events-auto min-h-control-md max-w-72 auto-cols-max grid-flow-col items-center gap-2 rounded-overlay-sm px-2 py-1`,`font-body text-1 [font-weight:var(--font-weight-normal)]`,`data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0`],variants:{color:{neutral:``,accent:``,success:``,warning:``,danger:``},variant:{surface:``,soft:``,solid:``}},defaults:{color:`neutral`,variant:`surface`}},shortcut:{base:`ml-1 inline-flex items-center gap-1 text-[var(--ui-semantic-surface-ink-muted)]`}}}}),I=new WeakMap,L=e=>{let t=I.get(e);return t||(t={active:null},I.set(e,t)),t},R=(e,t)=>{let n=new Set((e.getAttribute(`aria-describedby`)??``).split(/\s+/).filter(Boolean));n.add(t),e.setAttribute(`aria-describedby`,[...n].join(` `))},z=(e,t)=>{let n=(e.getAttribute(`aria-describedby`)??``).split(/\s+/).filter(e=>e&&e!==t);n.length?e.setAttribute(`aria-describedby`,n.join(` `)):e.removeAttribute(`aria-describedby`)},B=({owner:n,trigger:i,content:a,schema:o,syncShortcut:s})=>{let c=new p,l=null,d=null,m=null,_=``,v=!1,y=!1,x=e=>{let t=e===`open`?d:m;t!==null&&clearTimeout(t),e===`open`?d=null:m=null},S=()=>E.getSnapshot().props,C=()=>E.hasTag(`visible`),w=()=>{let e=S(),t=a();t.dataset.state=E.hasTag(`expanded`)?`open`:`closed`,t.setAttribute(`data-ui-semantic-surface`,``),t.dataset.color=e.color,t.dataset.variant=e.variant,t.dataset.uiSurface=e.surface,t.dataset.uiElevation=e.elevation,t.className=g({part:F.parts.content,props:e,className:t.dataset.class}),s?.(i().dataset.uiTooltipShortcut??``),l?.sync()},T={prepareOpen(){a().hidden=!1,l?.open(),w()},finishOpen(){w(),e({el:n(),name:`ui:open`})},prepareClose(){w()},finishClose:()=>{l?.close(),a().hidden=!0,w();let t=L(n().ownerDocument);t.active===j&&(t.active=null),e({el:n(),name:`ui:close`})},syncProps(){w(),S().disabled&&C()&&j.close(`disabled`,!0)}},E=u({schema:o,hooks:M,createMachine:({props:e})=>P(e,T)}),D=(e,t=!1)=>{if(x(`open`),x(`close`),S().disabled||E.hasTag(`expanded`))return;let r=L(n().ownerDocument),i=r.active!==null&&r.active!==j;r.active&&r.active!==j&&r.active.close(`replacement`,!0),r.active=j,E.send({type:`OPEN`,reason:e,instant:t||i})},O=(e,t=!1)=>{x(`open`),x(`close`),C()&&E.send({type:`CLOSE`,reason:e,instant:t})},k=()=>{if(x(`close`),C()||S().disabled)return;let e=L(n().ownerDocument).active?0:S().openDelay;x(`open`),d=setTimeout(()=>D(`pointer`,e===0),e)},A=()=>{x(`open`),C()&&(x(`close`),m=setTimeout(()=>O(`pointer`),S().closeDelay))},j={bridge:E,connect(e){E.connect(n(),e),_=a().id||`ui-tooltip-${crypto.randomUUID()}`,a().id=_,a().setAttribute(`role`,`tooltip`),a().setAttribute(`popover`,`manual`),a().setAttribute(`data-ui-tooltip-content`,``),a().hidden=!0,i().setAttribute(`data-ui-tooltip-trigger`,``),R(i(),_),r(i(),`aria-describedby`,`data-ui-tooltip-trigger`),l=h({reference:i,floating:a,position:()=>S().side,align:()=>S().align,gap:()=>S().gap,offset:()=>S().offset}),w(),t({target:i(),event:`pointerenter`,cleanup:c,handler:()=>{v=!0,k()}}),t({target:i(),event:`pointermove`,handler:k,cleanup:c}),t({target:i(),event:`pointerleave`,cleanup:c,handler:()=>{v=!1,y||A()}}),t({target:a(),event:`pointerenter`,cleanup:c,handler:()=>{y=!0,x(`close`)}}),t({target:a(),event:`pointerleave`,cleanup:c,handler:()=>{y=!1,v||A()}}),t({target:i(),event:`focusin`,cleanup:c,handler:()=>{queueMicrotask(()=>{let e=i();e.ownerDocument.activeElement===e&&!f(e)&&e.matches(`:focus-visible`)&&D(`focus`,!0)})}}),t({target:i(),event:`focusout`,cleanup:c,handler:()=>{!v&&!y&&O(`blur`,!0)}}),t({target:i(),event:`pointerdown`,handler:()=>O(`activation`,!0),cleanup:c}),t({target:i(),event:`click`,handler:()=>O(`activation`,!0),cleanup:c}),t({target:n().ownerDocument,event:`keydown`,cleanup:c,handler:e=>{e instanceof KeyboardEvent&&e.key===`Escape`&&C()&&O(`escape`,!0)}}),t({target:n().ownerDocument,event:`scroll`,options:{capture:!0},cleanup:c,handler:()=>{C()&&O(`scroll`,!0)}}),c.add(b({targets:i(),read:()=>i().dataset.uiTooltipShortcut??``,onChange:w,observer:{attributes:!0,attributeFilter:[`data-ui-tooltip-shortcut`]}}))},close:O,sync:w,destroy(){x(`open`),x(`close`),c.run();let e=L(n().ownerDocument);e.active===j&&(e.active=null),l?.destroy(),l=null,z(i(),_),i().removeAttribute(`data-ui-tooltip-trigger`),E.disconnect()}};return j},V=()=>{let e=null,t=null,n=()=>{if(!e)throw Error(`Tooltip has not been initialized.`);return e},r=()=>{let e=n().querySelector(`:scope > [data-ui-tooltip-content]`);if(!(e instanceof HTMLElement))throw Error(`Tooltip requires ui.tooltip.content.`);return e},i=()=>{let e=Array.from(n().children).find(e=>e instanceof HTMLElement&&e!==r());if(!(e instanceof HTMLElement))throw Error(`Tooltip requires an interactive trigger before its content.`);return e};return{...u({schema:k,hooks:M,createMachine:({props:e})=>P(e,{prepareOpen(){},finishOpen(){},prepareClose(){},finishClose(){},syncProps(){}})}),init(){e=this.$el,t=B({owner:n,trigger:i,content:r,schema:k}),t.connect(this.snapshot)},destroy(){t?.destroy(),t=null,e=null},get root(){return v({inputs:[g({part:F.parts.root,props:this.snapshot.current?.props??{}}),{"data-ui-tooltip-root":``}]})},get content(){return{"data-ui-tooltip-content":``}}}},H=e=>{e.addInitSelector(()=>`[x-ui-tooltip]`),e.directive(`ui-tooltip`,e.skipDuringClone((e,{expression:t},n)=>{if(!(e instanceof HTMLElement))return;let i=e.ownerDocument.createElement(`div`),a=e.ownerDocument.createElement(`span`);a.setAttribute(`data-ui-tooltip-label`,``),i.append(a);let o=e.ownerDocument.createElement(`span`);o.setAttribute(`data-ui-keybinding`,``),o.setAttribute(`aria-hidden`,`true`),o.className=g({part:D.parts.root,className:g({part:F.parts.shortcut})}),i.append(o);let s=O(o);e.insertAdjacentElement(`afterend`,i);let c=B({owner:()=>e,trigger:()=>e,content:()=>i,schema:A,syncShortcut:e=>s.setValue(e)});c.connect();let l=d(i,{invalidateDom(){e.isConnected&&(i.previousElementSibling!==e&&e.insertAdjacentElement(`afterend`,i),R(e,i.id),c.sync())}});r(e,`data-ui-tooltip-disabled`,`data-ui-tooltip-shortcut`);let u=n.evaluateLater(t);n.effect(()=>u(t=>{let n=typeof t==`string`?t.trim():``;a.textContent=n,e.toggleAttribute(`data-ui-tooltip-disabled`,!n),c.sync()})),n.cleanup(()=>{l(),c.destroy(),s.destroy(),i.remove()})})).before(`ui-transition`)},U=e=>{m(`UiTooltip`,V)(e),H(e)},W=new WeakSet,G=e=>{W.has(e)||(W.add(e),n(e),E(e),U(e))};export{V as n,H as r,G as t};
2
- //# sourceMappingURL=entry.generated-z3EbXrD0.js.map
1
+ import{r as e,t}from"./dom-DiTFTWeR.js";import{t as n}from"./capability-motion-D_BJBnwB.js";import{n as r}from"./morph-Cq3V_23_.js";import{c as i,f as a,l as o,n as s,t as c}from"./codecs-CQ7olTJL.js";import{i as l,t as u}from"./alpine-machine-CE2UN4Qu.js";import{n as d}from"./dom-invalidation-Dw6clnS4.js";import{n as f}from"./focus-pk_lz9sg.js";import{t as p}from"./cleanup-manager-D9QiZF_Q.js";import{n as m}from"./alpine-data-Dvc_bXq6.js";import{n as h}from"./anchored-popover-BwQbt4V2.js";import{n as g,t as _}from"./styles-CX2j92ex.js";import{t as v}from"./merge-bindings-BtqW3UgP.js";import{t as y}from"./machine-CNnHDbyo.js";import{t as b}from"./semantic-observer-CIoriWtV.js";import{I as x,L as S,d as C,t as w,z as T}from"./common-CBK89mIt.js";import{o as E}from"./capability-shortcut-DZUQHJ3A.js";import{n as D,t as O}from"./controller-C8xqwkr0.js";var k={side:o(S,`bottom`),align:o(w,`center`),offset:i.clamp(-100,100).default(0),gap:i.clamp(0,50).default(8),openDelay:i.clamp(0,5e3).default(400),closeDelay:i.clamp(0,5e3).default(150),color:o([`neutral`,`accent`,`success`,`warning`,`danger`],`neutral`),variant:o([`surface`,`soft`,`solid`],`surface`),surface:o(T,`2`),elevation:o(C,`4`),disabled:s,class:a},A={side:c(k.side,`ui-tooltip-side`),align:c(k.align,`ui-tooltip-align`),offset:c(k.offset,`ui-tooltip-offset`),gap:c(k.gap,`ui-tooltip-gap`),openDelay:c(k.openDelay,`ui-tooltip-open-delay`),closeDelay:c(k.closeDelay,`ui-tooltip-close-delay`),color:c(k.color,`ui-tooltip-color`),variant:c(k.variant,`ui-tooltip-variant`),surface:c(k.surface,`ui-tooltip-surface`),elevation:c(k.elevation,`ui-tooltip-elevation`),disabled:c(k.disabled,`ui-tooltip-disabled`)},j=({context:e})=>e.transition,M=[l({name:`opening`,state:`opening`,project:j,onDone:`OPENING_DONE`,onError:`OPENING_ERROR`}),l({name:`closing`,state:`closing`,project:j,onDone:`CLOSING_DONE`,onError:`CLOSING_ERROR`})],N=e=>{let t=e.reason;return t===`focus`||t===`escape`||t===`activation`||t===`scroll`||t===`blur`||t===`disabled`||t===`replacement`?t:`pointer`},P=(e,t)=>y({initial:`closed`,states:{closed:{tags:[`closed`],on:{OPEN:{target:`opening`,guard:`canOpen`,reduce:`transition`,effects:`prepareOpen`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}}},opening:{tags:[`visible`,`expanded`,`transitioning`],on:{OPENING_DONE:{target:`open`,effects:`finishOpen`},OPENING_ERROR:{target:`open`,effects:`finishOpen`},CLOSE:{target:`closing`,reduce:`transition`,effects:`prepareClose`},PROPS_CHANGED:[{target:`closing`,guard:`becomesDisabled`,reduce:`replacePropsDisabled`,effects:[`syncProps`,`prepareClose`]},{reduce:`replaceProps`,effects:`syncProps`}]}},open:{tags:[`visible`,`expanded`,`open`],on:{CLOSE:{target:`closing`,reduce:`transition`,effects:`prepareClose`},PROPS_CHANGED:[{target:`closing`,guard:`becomesDisabled`,reduce:`replacePropsDisabled`,effects:[`syncProps`,`prepareClose`]},{reduce:`replaceProps`,effects:`syncProps`}]}},closing:{tags:[`visible`,`transitioning`],on:{CLOSING_DONE:{target:`closed`,effects:`finishClose`},CLOSING_ERROR:{target:`closed`,effects:`finishClose`},OPEN:{target:`opening`,guard:`canOpen`,reduce:`transition`,effects:`prepareOpen`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`syncProps`}}}}},{context:{transition:{reason:`pointer`,instant:!1}},props:e,reducers:{transition:({context:e,props:t,event:n})=>({context:{transition:{reason:N(n),instant:n.instant===!0}},props:t}),replaceProps:({context:e,props:t,event:n})=>({context:e,props:n.props??t}),replacePropsDisabled:({context:e,props:t,event:n})=>({context:{transition:{reason:`disabled`,instant:!0}},props:n.props??t})},guards:{canOpen:({props:e})=>!e.disabled,becomesDisabled:({event:e})=>e.props?.disabled===!0},effects:t}),F=_({definition:{component:`ui.tooltip`,parts:{root:{base:`contents`},content:{base:[x,`pointer-events-auto min-h-control-md max-w-72 auto-cols-max grid-flow-col items-center gap-2 rounded-overlay-sm px-2 py-1`,`font-body text-1 [font-weight:var(--font-weight-normal)]`,`data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0`],variants:{color:{neutral:``,accent:``,success:``,warning:``,danger:``},variant:{surface:``,soft:``,solid:``}},defaults:{color:`neutral`,variant:`surface`}},shortcut:{base:`ml-1 inline-flex items-center gap-1 text-[var(--ui-semantic-surface-ink-muted)]`}}}}),I=new WeakMap,L=e=>{let t=I.get(e);return t||(t={active:null},I.set(e,t)),t},R=(e,t)=>{let n=new Set((e.getAttribute(`aria-describedby`)??``).split(/\s+/).filter(Boolean));n.add(t),e.setAttribute(`aria-describedby`,[...n].join(` `))},z=(e,t)=>{let n=(e.getAttribute(`aria-describedby`)??``).split(/\s+/).filter(e=>e&&e!==t);n.length?e.setAttribute(`aria-describedby`,n.join(` `)):e.removeAttribute(`aria-describedby`)},B=({owner:n,trigger:i,content:a,schema:o,syncShortcut:s})=>{let c=new p,l=null,d=null,m=null,_=``,v=!1,y=!1,x=e=>{let t=e===`open`?d:m;t!==null&&clearTimeout(t),e===`open`?d=null:m=null},S=()=>E.getSnapshot().props,C=()=>E.hasTag(`visible`),w=()=>{let e=S(),t=a();t.dataset.state=E.hasTag(`expanded`)?`open`:`closed`,t.setAttribute(`data-ui-semantic-surface`,``),t.dataset.color=e.color,t.dataset.variant=e.variant,t.dataset.uiSurface=e.surface,t.dataset.uiElevation=e.elevation,t.className=g({part:F.parts.content,props:e,className:t.dataset.class}),s?.(i().dataset.uiTooltipShortcut??``),l?.sync()},T={prepareOpen(){a().hidden=!1,l?.open(),w()},finishOpen(){w(),e({el:n(),name:`ui:open`})},prepareClose(){w()},finishClose:()=>{l?.close(),a().hidden=!0,w();let t=L(n().ownerDocument);t.active===j&&(t.active=null),e({el:n(),name:`ui:close`})},syncProps(){w(),S().disabled&&C()&&j.close(`disabled`,!0)}},E=u({schema:o,hooks:M,createMachine:({props:e})=>P(e,T)}),D=(e,t=!1)=>{if(x(`open`),x(`close`),S().disabled||E.hasTag(`expanded`))return;let r=L(n().ownerDocument),i=r.active!==null&&r.active!==j;r.active&&r.active!==j&&r.active.close(`replacement`,!0),r.active=j,E.send({type:`OPEN`,reason:e,instant:t||i})},O=(e,t=!1)=>{x(`open`),x(`close`),C()&&E.send({type:`CLOSE`,reason:e,instant:t})},k=()=>{if(x(`close`),C()||S().disabled)return;let e=L(n().ownerDocument).active?0:S().openDelay;x(`open`),d=setTimeout(()=>D(`pointer`,e===0),e)},A=()=>{x(`open`),C()&&(x(`close`),m=setTimeout(()=>O(`pointer`),S().closeDelay))},j={bridge:E,connect(e){E.connect(n(),e),_=a().id||`ui-tooltip-${crypto.randomUUID()}`,a().id=_,a().setAttribute(`role`,`tooltip`),a().setAttribute(`popover`,`manual`),a().setAttribute(`data-ui-tooltip-content`,``),a().hidden=!0,i().setAttribute(`data-ui-tooltip-trigger`,``),R(i(),_),r(i(),`aria-describedby`,`data-ui-tooltip-trigger`),l=h({reference:i,floating:a,position:()=>S().side,align:()=>S().align,gap:()=>S().gap,offset:()=>S().offset}),w(),t({target:i(),event:`pointerenter`,cleanup:c,handler:()=>{v=!0,k()}}),t({target:i(),event:`pointermove`,handler:k,cleanup:c}),t({target:i(),event:`pointerleave`,cleanup:c,handler:()=>{v=!1,y||A()}}),t({target:a(),event:`pointerenter`,cleanup:c,handler:()=>{y=!0,x(`close`)}}),t({target:a(),event:`pointerleave`,cleanup:c,handler:()=>{y=!1,v||A()}}),t({target:i(),event:`focusin`,cleanup:c,handler:()=>{queueMicrotask(()=>{let e=i();e.ownerDocument.activeElement===e&&!f(e)&&e.matches(`:focus-visible`)&&D(`focus`,!0)})}}),t({target:i(),event:`focusout`,cleanup:c,handler:()=>{!v&&!y&&O(`blur`,!0)}}),t({target:i(),event:`pointerdown`,handler:()=>O(`activation`,!0),cleanup:c}),t({target:i(),event:`click`,handler:()=>O(`activation`,!0),cleanup:c}),t({target:n().ownerDocument,event:`keydown`,cleanup:c,handler:e=>{e instanceof KeyboardEvent&&e.key===`Escape`&&C()&&O(`escape`,!0)}}),t({target:n().ownerDocument,event:`scroll`,options:{capture:!0},cleanup:c,handler:()=>{C()&&O(`scroll`,!0)}}),c.add(b({targets:i(),read:()=>i().dataset.uiTooltipShortcut??``,onChange:w,observer:{attributes:!0,attributeFilter:[`data-ui-tooltip-shortcut`]}}))},close:O,sync:w,destroy(){x(`open`),x(`close`),c.run();let e=L(n().ownerDocument);e.active===j&&(e.active=null),l?.destroy(),l=null,z(i(),_),i().removeAttribute(`data-ui-tooltip-trigger`),E.disconnect()}};return j},V=()=>{let e=null,t=null,n=()=>{if(!e)throw Error(`Tooltip has not been initialized.`);return e},r=()=>{let e=n().querySelector(`:scope > [data-ui-tooltip-content]`);if(!(e instanceof HTMLElement))throw Error(`Tooltip requires ui.tooltip.content.`);return e},i=()=>{let e=Array.from(n().children).find(e=>e instanceof HTMLElement&&e!==r());if(!(e instanceof HTMLElement))throw Error(`Tooltip requires an interactive trigger before its content.`);return e};return{...u({schema:k,hooks:M,createMachine:({props:e})=>P(e,{prepareOpen(){},finishOpen(){},prepareClose(){},finishClose(){},syncProps(){}})}),init(){e=this.$el,t=B({owner:n,trigger:i,content:r,schema:k}),t.connect(this.snapshot)},destroy(){t?.destroy(),t=null,e=null},get root(){return v({inputs:[g({part:F.parts.root,props:this.snapshot.current?.props??{}}),{"data-ui-tooltip-root":``}]})},get content(){return{"data-ui-tooltip-content":``}}}},H=e=>{e.addInitSelector(()=>`[x-ui-tooltip]`),e.directive(`ui-tooltip`,e.skipDuringClone((e,{expression:t},n)=>{if(!(e instanceof HTMLElement))return;let i=e.ownerDocument.createElement(`div`),a=e.ownerDocument.createElement(`span`);a.setAttribute(`data-ui-tooltip-label`,``),i.append(a);let o=e.ownerDocument.createElement(`span`);o.setAttribute(`data-ui-keybinding`,``),o.dataset.variant=`outline`,o.setAttribute(`aria-hidden`,`true`),o.className=g({part:D.parts.root,className:g({part:F.parts.shortcut})}),i.append(o);let s=O(o);e.insertAdjacentElement(`afterend`,i);let c=B({owner:()=>e,trigger:()=>e,content:()=>i,schema:A,syncShortcut:e=>s.setValue(e)});c.connect();let l=d(i,{invalidateDom(){e.isConnected&&(i.previousElementSibling!==e&&e.insertAdjacentElement(`afterend`,i),R(e,i.id),c.sync())}});r(e,`data-ui-tooltip-disabled`,`data-ui-tooltip-shortcut`);let u=n.evaluateLater(t);n.effect(()=>u(t=>{let n=typeof t==`string`?t.trim():``;a.textContent=n,e.toggleAttribute(`data-ui-tooltip-disabled`,!n),c.sync()})),n.cleanup(()=>{l(),c.destroy(),s.destroy(),i.remove()})})).before(`ui-transition`)},U=e=>{m(`UiTooltip`,V)(e),H(e)},W=new WeakSet,G=e=>{W.has(e)||(W.add(e),n(e),E(e),U(e))};export{V as n,H as r,G as t};
2
+ //# sourceMappingURL=entry.generated-BITa8xFV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry.generated-z3EbXrD0.js","names":[],"sources":["../../../../../../../../client/src/components/tooltip/contract.ts","../../../../../../../../client/src/components/tooltip/machine.ts","../../../../../../../../client/src/components/tooltip/styles.ts","../../../../../../../../client/src/components/tooltip/index.ts","../../../../../../../../client/src/components/tooltip/entry.generated.ts"],"sourcesContent":["import {attribute, bool, number, oneOf, string, type SchemaToProps} from '../../runtime';\nimport {\n ALIGNMENTS,\n ELEVATION_REFERENCES,\n POSITIONS,\n SURFACE_REFERENCES,\n type Alignment,\n type ElevationReference,\n type Position,\n type SurfaceReference,\n} from '../common';\n\nconst TOOLTIP_COLORS = ['neutral', 'accent', 'success', 'warning', 'danger'] as const;\nconst TOOLTIP_VARIANTS = ['surface', 'soft', 'solid'] as const;\n\nconst tooltipSchema = {\n side: oneOf(POSITIONS, 'bottom' as Position),\n align: oneOf(ALIGNMENTS, 'center' as Alignment),\n offset: number.clamp(-100, 100).default(0),\n gap: number.clamp(0, 50).default(8),\n openDelay: number.clamp(0, 5000).default(400),\n closeDelay: number.clamp(0, 5000).default(150),\n color: oneOf(TOOLTIP_COLORS, 'neutral'),\n variant: oneOf(TOOLTIP_VARIANTS, 'surface'),\n surface: oneOf(SURFACE_REFERENCES, '2' as SurfaceReference),\n elevation: oneOf(ELEVATION_REFERENCES, '4' as ElevationReference),\n disabled: bool,\n class: string,\n};\n\nconst tooltipDirectiveSchema = {\n side: attribute(tooltipSchema.side, 'ui-tooltip-side'),\n align: attribute(tooltipSchema.align, 'ui-tooltip-align'),\n offset: attribute(tooltipSchema.offset, 'ui-tooltip-offset'),\n gap: attribute(tooltipSchema.gap, 'ui-tooltip-gap'),\n openDelay: attribute(tooltipSchema.openDelay, 'ui-tooltip-open-delay'),\n closeDelay: attribute(tooltipSchema.closeDelay, 'ui-tooltip-close-delay'),\n color: attribute(tooltipSchema.color, 'ui-tooltip-color'),\n variant: attribute(tooltipSchema.variant, 'ui-tooltip-variant'),\n surface: attribute(tooltipSchema.surface, 'ui-tooltip-surface'),\n elevation: attribute(tooltipSchema.elevation, 'ui-tooltip-elevation'),\n disabled: attribute(tooltipSchema.disabled, 'ui-tooltip-disabled'),\n};\n\ntype TooltipProps = SchemaToProps<typeof tooltipSchema>;\ntype TooltipDirectiveProps = SchemaToProps<typeof tooltipDirectiveSchema>;\ntype TooltipColor = typeof TOOLTIP_COLORS[number];\ntype TooltipVariant = typeof TOOLTIP_VARIANTS[number];\n\nexport {\n TOOLTIP_COLORS,\n TOOLTIP_VARIANTS,\n tooltipDirectiveSchema,\n tooltipSchema,\n};\nexport type {TooltipColor, TooltipDirectiveProps, TooltipProps, TooltipVariant};\n","import {createMachine, type Machine, type MachineEventObject} from '../../runtime/state-machine';\nimport {defineHook, type TransitionHookDefinition} from '../../runtime/transition-coordinator';\nimport type {TooltipProps} from './contract';\n\ntype TooltipReason = 'pointer' | 'focus' | 'escape' | 'activation' | 'scroll' | 'blur' | 'disabled' | 'replacement';\ntype TooltipContext = {transition: {reason: TooltipReason; instant: boolean}};\ntype TooltipTransitionData = {reason: TooltipReason; instant: boolean};\ntype TooltipMachineEffects = {\n prepareOpen(): void;\n finishOpen(): void;\n prepareClose(): void;\n finishClose(): void;\n syncProps(): void;\n};\n\nconst transitionData = ({context}: {context: TooltipContext}): TooltipTransitionData => context.transition;\nconst openingHook = defineHook({\n name: 'opening', state: 'opening', project: transitionData, onDone: 'OPENING_DONE', onError: 'OPENING_ERROR',\n} satisfies TransitionHookDefinition<TooltipContext, TooltipProps, TooltipTransitionData, 'opening'>);\nconst closingHook = defineHook({\n name: 'closing', state: 'closing', project: transitionData, onDone: 'CLOSING_DONE', onError: 'CLOSING_ERROR',\n} satisfies TransitionHookDefinition<TooltipContext, TooltipProps, TooltipTransitionData, 'closing'>);\nconst tooltipHooks = [openingHook, closingHook] as const;\n\nconst reasonFrom = (event: MachineEventObject): TooltipReason => {\n const reason = event.reason;\n return reason === 'focus' || reason === 'escape' || reason === 'activation' || reason === 'scroll'\n || reason === 'blur' || reason === 'disabled' || reason === 'replacement' ? reason : 'pointer';\n};\n\nconst createTooltipMachine = (\n props: TooltipProps,\n effects: TooltipMachineEffects,\n): Machine<TooltipContext, TooltipProps> => createMachine<TooltipContext, TooltipProps>({\n initial: 'closed',\n states: {\n closed: {tags: ['closed'], on: {\n OPEN: {target: 'opening', guard: 'canOpen', reduce: 'transition', effects: 'prepareOpen'},\n PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'},\n }},\n opening: {tags: ['visible', 'expanded', 'transitioning'], on: {\n OPENING_DONE: {target: 'open', effects: 'finishOpen'},\n OPENING_ERROR: {target: 'open', effects: 'finishOpen'},\n CLOSE: {target: 'closing', reduce: 'transition', effects: 'prepareClose'},\n PROPS_CHANGED: [\n {target: 'closing', guard: 'becomesDisabled', reduce: 'replacePropsDisabled', effects: ['syncProps', 'prepareClose']},\n {reduce: 'replaceProps', effects: 'syncProps'},\n ],\n }},\n open: {tags: ['visible', 'expanded', 'open'], on: {\n CLOSE: {target: 'closing', reduce: 'transition', effects: 'prepareClose'},\n PROPS_CHANGED: [\n {target: 'closing', guard: 'becomesDisabled', reduce: 'replacePropsDisabled', effects: ['syncProps', 'prepareClose']},\n {reduce: 'replaceProps', effects: 'syncProps'},\n ],\n }},\n closing: {tags: ['visible', 'transitioning'], on: {\n CLOSING_DONE: {target: 'closed', effects: 'finishClose'},\n CLOSING_ERROR: {target: 'closed', effects: 'finishClose'},\n OPEN: {target: 'opening', guard: 'canOpen', reduce: 'transition', effects: 'prepareOpen'},\n PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'},\n }},\n },\n}, {\n context: {transition: {reason: 'pointer', instant: false}},\n props,\n reducers: {\n transition: ({context, props: currentProps, event}) => ({\n context: {transition: {reason: reasonFrom(event), instant: event.instant === true}},\n props: currentProps,\n }),\n replaceProps: ({context, props: currentProps, event}) => ({\n context,\n props: (event.props as TooltipProps | undefined) ?? currentProps,\n }),\n replacePropsDisabled: ({context, props: currentProps, event}) => ({\n context: {transition: {reason: 'disabled', instant: true}},\n props: (event.props as TooltipProps | undefined) ?? currentProps,\n }),\n },\n guards: {\n canOpen: ({props: currentProps}) => !currentProps.disabled,\n becomesDisabled: ({event}) => (event.props as TooltipProps | undefined)?.disabled === true,\n },\n effects,\n});\n\nexport {createTooltipMachine, tooltipHooks};\nexport type {TooltipContext, TooltipMachineEffects, TooltipReason, TooltipTransitionData};\n","import {defineStyles} from '../../runtime';\nimport {POPOVER_GEOMETRY_CLASSES} from '../common';\n\nconst tooltipStyles = defineStyles({definition: {\n component: 'ui.tooltip',\n parts: {\n root: {base: 'contents'},\n content: {\n base: [\n POPOVER_GEOMETRY_CLASSES,\n 'pointer-events-auto min-h-control-md max-w-72 auto-cols-max grid-flow-col items-center gap-2 rounded-overlay-sm px-2 py-1',\n 'font-body text-1 [font-weight:var(--font-weight-normal)]',\n 'data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0',\n ],\n variants: {\n color: {neutral: '', accent: '', success: '', warning: '', danger: ''},\n variant: {surface: '', soft: '', solid: ''},\n },\n defaults: {color: 'neutral', variant: 'surface'},\n },\n shortcut: {base: 'ml-1 inline-flex items-center gap-1 text-[var(--ui-semantic-surface-ink-muted)]'},\n },\n}});\n\nexport {tooltipStyles};\n","import type Alpine from 'alpinejs';\n\nimport {\n createAlpineMachine,\n defineAlpineData,\n type SchemaToProps,\n type TransitionForHook,\n type TrellisAlpineComponent,\n} from '@client/runtime';\nimport {createAnchoredPopoverSurface, type AnchoredPopoverSurface} from '@client/runtime/anchored-popover';\nimport {CleanupManager} from '@client/runtime/cleanup-manager';\nimport type {CodecFn} from '@client/runtime/codecs';\nimport {registerDomInvalidationOwner} from '@client/runtime/dom-invalidation';\nimport {isFocusIndicatorSuppressed} from '@client/runtime/focus';\nimport {mergeBindings, type BindingObject} from '@client/runtime/merge-bindings';\nimport {declareMorphAttributes} from '@client/runtime/morph';\nimport {observeSemanticChanges} from '@client/runtime/semantic-observer';\nimport {resolveStyle} from '@client/runtime/styles';\nimport {addListener, dispatch} from '@client/utils';\nimport {createKeybindingController} from '../keybinding/controller';\nimport {keybindingStyles} from '../keybinding/styles';\nimport {\n tooltipDirectiveSchema,\n type TooltipDirectiveProps,\n type TooltipProps,\n tooltipSchema,\n} from './contract';\nimport {\n createTooltipMachine,\n tooltipHooks,\n type TooltipContext,\n type TooltipReason,\n} from './machine';\nimport {tooltipStyles} from './styles';\n\ntype TooltipTransitionName = (typeof tooltipHooks)[number]['name'];\ntype TooltipTransition<TName extends TooltipTransitionName = TooltipTransitionName> = TransitionForHook<\n Extract<(typeof tooltipHooks)[number], {name: TName}>,\n HTMLElement\n>;\ntype PopoverElement = HTMLElement & {showPopover(): void; hidePopover(): void};\ntype TooltipSchema = Record<string, CodecFn<unknown>>;\ntype TooltipBridge = ReturnType<typeof createAlpineMachine<TooltipContext, typeof tooltipSchema, typeof tooltipHooks>>;\n\ntype TooltipController = {\n bridge: TooltipBridge;\n connect(snapshot?: {current: TooltipBridge['snapshot']['current']}): void;\n destroy(): void;\n sync(): void;\n close(reason: TooltipReason, instant?: boolean): void;\n};\n\ntype TooltipWarmStore = {active: TooltipController | null};\nconst warmStores = new WeakMap<Document, TooltipWarmStore>();\nconst warmStore = (document: Document): TooltipWarmStore => {\n let store = warmStores.get(document);\n if (!store) {\n store = {active: null};\n warmStores.set(document, store);\n }\n return store;\n};\n\nconst appendDescription = (trigger: HTMLElement, id: string): void => {\n const tokens = new Set((trigger.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter(Boolean));\n tokens.add(id);\n trigger.setAttribute('aria-describedby', [...tokens].join(' '));\n};\n\nconst removeDescription = (trigger: HTMLElement, id: string): void => {\n const tokens = (trigger.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter((token) => token && token !== id);\n if (tokens.length) trigger.setAttribute('aria-describedby', tokens.join(' '));\n else trigger.removeAttribute('aria-describedby');\n};\n\nconst createTooltipController = <TSchema extends TooltipSchema>({\n owner,\n trigger,\n content,\n schema,\n syncShortcut,\n}: {\n owner: () => HTMLElement & Alpine.ElementWithXAttributes;\n trigger: () => HTMLElement;\n content: () => PopoverElement;\n schema: TSchema;\n syncShortcut?: (value: string) => void;\n}): TooltipController => {\n const cleanup = new CleanupManager();\n let popover: AnchoredPopoverSurface | null = null;\n let openTimer: ReturnType<typeof setTimeout> | null = null;\n let closeTimer: ReturnType<typeof setTimeout> | null = null;\n let describedById = '';\n let pointerOnTrigger = false;\n let pointerOnContent = false;\n\n const clearTimer = (timer: 'open' | 'close'): void => {\n const current = timer === 'open' ? openTimer : closeTimer;\n if (current !== null) clearTimeout(current);\n if (timer === 'open') openTimer = null;\n else closeTimer = null;\n };\n const props = (): Readonly<TooltipProps> => bridge.getSnapshot().props as TooltipProps;\n const visible = (): boolean => bridge.hasTag('visible');\n const syncSurface = (): void => {\n const value = props();\n const surface = content();\n surface.dataset.state = bridge.hasTag('expanded') ? 'open' : 'closed';\n surface.setAttribute('data-ui-semantic-surface', '');\n surface.dataset.color = value.color;\n surface.dataset.variant = value.variant;\n surface.dataset.uiSurface = value.surface;\n surface.dataset.uiElevation = value.elevation;\n surface.className = resolveStyle({\n part: tooltipStyles.parts.content,\n props: value,\n className: surface.dataset.class,\n });\n syncShortcut?.(trigger().dataset.uiTooltipShortcut ?? '');\n popover?.sync();\n };\n const finishClose = (): void => {\n popover?.close();\n content().hidden = true;\n syncSurface();\n const store = warmStore(owner().ownerDocument);\n if (store.active === controller) store.active = null;\n dispatch({el: owner(), name: 'ui:close'});\n };\n const effects = {\n prepareOpen(): void {\n content().hidden = false;\n popover?.open();\n syncSurface();\n },\n finishOpen(): void {\n syncSurface();\n dispatch({el: owner(), name: 'ui:open'});\n },\n prepareClose(): void { syncSurface(); },\n finishClose,\n syncProps(): void {\n syncSurface();\n if (props().disabled && visible()) controller.close('disabled', true);\n },\n };\n const machineBridge = createAlpineMachine({\n schema,\n hooks: tooltipHooks,\n createMachine: ({props: machineProps}) => createTooltipMachine(machineProps as TooltipProps, effects) as never,\n });\n const bridge = machineBridge as unknown as TooltipBridge;\n\n const open = (reason: TooltipReason, instant = false): void => {\n clearTimer('open');\n clearTimer('close');\n if (props().disabled || bridge.hasTag('expanded')) return;\n const store = warmStore(owner().ownerDocument);\n const warm = store.active !== null && store.active !== controller;\n if (store.active && store.active !== controller) store.active.close('replacement', true);\n store.active = controller;\n bridge.send({type: 'OPEN', reason, instant: instant || warm});\n };\n const close = (reason: TooltipReason, instant = false): void => {\n clearTimer('open');\n clearTimer('close');\n if (!visible()) return;\n bridge.send({type: 'CLOSE', reason, instant});\n };\n const scheduleOpen = (): void => {\n clearTimer('close');\n if (visible() || props().disabled) return;\n const delay = warmStore(owner().ownerDocument).active ? 0 : props().openDelay;\n clearTimer('open');\n openTimer = setTimeout(() => open('pointer', delay === 0), delay);\n };\n const scheduleClose = (): void => {\n clearTimer('open');\n if (!visible()) return;\n clearTimer('close');\n closeTimer = setTimeout(() => close('pointer'), props().closeDelay);\n };\n\n const controller: TooltipController = {\n bridge,\n connect(snapshot): void {\n bridge.connect(owner(), snapshot);\n describedById = content().id || `ui-tooltip-${crypto.randomUUID()}`;\n content().id = describedById;\n content().setAttribute('role', 'tooltip');\n content().setAttribute('popover', 'manual');\n content().setAttribute('data-ui-tooltip-content', '');\n content().hidden = true;\n trigger().setAttribute('data-ui-tooltip-trigger', '');\n appendDescription(trigger(), describedById);\n declareMorphAttributes(\n trigger(),\n 'aria-describedby',\n 'data-ui-tooltip-trigger',\n );\n popover = createAnchoredPopoverSurface({\n reference: trigger,\n floating: content,\n position: () => props().side,\n align: () => props().align,\n gap: () => props().gap,\n offset: () => props().offset,\n });\n syncSurface();\n addListener({target: trigger(), event: 'pointerenter', cleanup, handler: () => {\n pointerOnTrigger = true;\n scheduleOpen();\n }});\n addListener({target: trigger(), event: 'pointermove', handler: scheduleOpen, cleanup});\n addListener({target: trigger(), event: 'pointerleave', cleanup, handler: () => {\n pointerOnTrigger = false;\n if (!pointerOnContent) scheduleClose();\n }});\n addListener({target: content(), event: 'pointerenter', cleanup, handler: () => {\n pointerOnContent = true;\n clearTimer('close');\n }});\n addListener({target: content(), event: 'pointerleave', cleanup, handler: () => {\n pointerOnContent = false;\n if (!pointerOnTrigger) scheduleClose();\n }});\n addListener({target: trigger(), event: 'focusin', cleanup, handler: () => {\n queueMicrotask(() => {\n const target = trigger();\n if (\n target.ownerDocument.activeElement === target\n && !isFocusIndicatorSuppressed(target)\n && target.matches(':focus-visible')\n ) open('focus', true);\n });\n }});\n addListener({target: trigger(), event: 'focusout', cleanup, handler: () => {\n if (!pointerOnTrigger && !pointerOnContent) close('blur', true);\n }});\n addListener({target: trigger(), event: 'pointerdown', handler: () => close('activation', true), cleanup});\n addListener({target: trigger(), event: 'click', handler: () => close('activation', true), cleanup});\n addListener({target: owner().ownerDocument, event: 'keydown', cleanup, handler: (event) => {\n if (event instanceof KeyboardEvent && event.key === 'Escape' && visible()) close('escape', true);\n }});\n addListener({target: owner().ownerDocument, event: 'scroll', options: {capture: true}, cleanup, handler: () => {\n if (visible()) close('scroll', true);\n }});\n cleanup.add(observeSemanticChanges({\n targets: trigger(),\n read: () => trigger().dataset.uiTooltipShortcut ?? '',\n onChange: syncSurface,\n observer: {attributes: true, attributeFilter: ['data-ui-tooltip-shortcut']},\n }));\n },\n close,\n sync: syncSurface,\n destroy(): void {\n clearTimer('open');\n clearTimer('close');\n cleanup.run();\n const store = warmStore(owner().ownerDocument);\n if (store.active === controller) store.active = null;\n popover?.destroy();\n popover = null;\n removeDescription(trigger(), describedById);\n trigger().removeAttribute('data-ui-tooltip-trigger');\n bridge.disconnect();\n },\n };\n return controller;\n};\n\ntype TooltipData = TooltipBridge & {\n readonly root: BindingObject;\n readonly content: BindingObject;\n init(): void;\n destroy(): void;\n};\n\nconst UiTooltip = (): TrellisAlpineComponent<TooltipData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let controller: TooltipController | null = null;\n const root = (): HTMLElement & Alpine.ElementWithXAttributes => {\n if (!rootEl) throw new Error('Tooltip has not been initialized.');\n return rootEl;\n };\n const content = (): PopoverElement => {\n const el = root().querySelector<HTMLElement>(':scope > [data-ui-tooltip-content]');\n if (!(el instanceof HTMLElement)) throw new Error('Tooltip requires ui.tooltip.content.');\n return el as PopoverElement;\n };\n const trigger = (): HTMLElement => {\n const el = Array.from(root().children).find((child) => child instanceof HTMLElement && child !== content());\n if (!(el instanceof HTMLElement)) throw new Error('Tooltip requires an interactive trigger before its content.');\n return el;\n };\n const bridge = createAlpineMachine({\n schema: tooltipSchema,\n hooks: tooltipHooks,\n createMachine: ({props}) => createTooltipMachine(props, {\n prepareOpen() {}, finishOpen() {}, prepareClose() {}, finishClose() {}, syncProps() {},\n }),\n }) as TooltipBridge;\n const component: TrellisAlpineComponent<TooltipData> = {\n ...bridge,\n init(): void {\n rootEl = this.$el;\n controller = createTooltipController({owner: root, trigger, content, schema: tooltipSchema});\n controller.connect(this.snapshot);\n },\n destroy(): void {\n controller?.destroy();\n controller = null;\n rootEl = null;\n },\n get root(): BindingObject {\n return mergeBindings({inputs: [\n resolveStyle({part: tooltipStyles.parts.root, props: this.snapshot.current?.props ?? {}}),\n {'data-ui-tooltip-root': ''},\n ]});\n },\n get content(): BindingObject {\n return {'data-ui-tooltip-content': ''};\n },\n };\n return component;\n};\n\nconst registerTooltipDirective = (AlpineInstance: Alpine.Alpine): void => {\n AlpineInstance.addInitSelector(() => '[x-ui-tooltip]');\n AlpineInstance.directive('ui-tooltip', AlpineInstance.skipDuringClone((el, {expression}, utilities) => {\n if (!(el instanceof HTMLElement)) return;\n const content = el.ownerDocument.createElement('div') as PopoverElement;\n const label = el.ownerDocument.createElement('span');\n label.setAttribute('data-ui-tooltip-label', '');\n content.append(label);\n const shortcut = el.ownerDocument.createElement('span');\n shortcut.setAttribute('data-ui-keybinding', '');\n shortcut.setAttribute('aria-hidden', 'true');\n shortcut.className = resolveStyle({\n part: keybindingStyles.parts.root,\n className: resolveStyle({part: tooltipStyles.parts.shortcut}),\n });\n content.append(shortcut);\n const keybinding = createKeybindingController(shortcut);\n el.insertAdjacentElement('afterend', content);\n const owner = () => el as HTMLElement & Alpine.ElementWithXAttributes;\n const controller = createTooltipController({\n owner,\n trigger: () => el,\n content: () => content,\n schema: tooltipDirectiveSchema,\n syncShortcut: (value) => keybinding.setValue(value),\n });\n controller.connect();\n const unregisterInvalidationOwner = registerDomInvalidationOwner(content, {\n invalidateDom(): void {\n if (!el.isConnected) return;\n if (content.previousElementSibling !== el) el.insertAdjacentElement('afterend', content);\n appendDescription(el, content.id);\n controller.sync();\n },\n });\n declareMorphAttributes(el, 'data-ui-tooltip-disabled', 'data-ui-tooltip-shortcut');\n const evaluator = utilities.evaluateLater(expression);\n utilities.effect(() => evaluator((value) => {\n const text = typeof value === 'string' ? value.trim() : '';\n label.textContent = text;\n el.toggleAttribute('data-ui-tooltip-disabled', !text);\n controller.sync();\n }));\n utilities.cleanup(() => {\n unregisterInvalidationOwner();\n controller.destroy();\n keybinding.destroy();\n content.remove();\n });\n })).before('ui-transition');\n};\n\nconst registerTooltip = (AlpineInstance: Alpine.Alpine): void => {\n defineAlpineData('UiTooltip', UiTooltip)(AlpineInstance);\n registerTooltipDirective(AlpineInstance);\n};\n\nexport {registerTooltip, registerTooltipDirective, UiTooltip};\nexport type {TooltipData, TooltipDirectiveProps, TooltipTransition};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\nimport {registerMotionCapability} from '../../capabilities/motion';\nimport {registerShortcutCapability} from '../../capabilities/shortcut';\nimport {registerTooltip as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerTooltip = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n registerMotionCapability(AlpineInstance);\n registerShortcutCapability(AlpineInstance);\n registerComponent(AlpineInstance);\n};\n\nexport {registerTooltip};\nexport default registerTooltip;\nexport * from './index';\n"],"mappings":"61BAeA,IAAM,EAAgB,CAClB,KAAM,EAAM,EAAW,QAAoB,EAC3C,MAAO,EAAM,EAAY,QAAqB,EAC9C,OAAQ,EAAO,MAAM,KAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,EACzC,IAAK,EAAO,MAAM,EAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,EAClC,UAAW,EAAO,MAAM,EAAG,GAAI,CAAC,CAAC,QAAQ,GAAG,EAC5C,WAAY,EAAO,MAAM,EAAG,GAAI,CAAC,CAAC,QAAQ,GAAG,EAC7C,MAAO,EAAM,CAVO,UAAW,SAAU,UAAW,UAAW,QAUlD,EAAgB,SAAS,EACtC,QAAS,EAAM,CAVO,UAAW,OAAQ,OAU1B,EAAkB,SAAS,EAC1C,QAAS,EAAM,EAAoB,GAAuB,EAC1D,UAAW,EAAM,EAAsB,GAAyB,EAChE,SAAU,EACV,MAAO,CACX,EAEM,EAAyB,CAC3B,KAAM,EAAU,EAAc,KAAM,iBAAiB,EACrD,MAAO,EAAU,EAAc,MAAO,kBAAkB,EACxD,OAAQ,EAAU,EAAc,OAAQ,mBAAmB,EAC3D,IAAK,EAA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AAM,KAC7B,UAAW,EAAa,CAAC,KAAM,EAAc,MAAM,QAAQ,CAAC,CAChE,CAAC,EACD,EAAQ,OAAO,CAAQ,EACvB,IAAM,EAAa,EAA2B,CAAQ,EACtD,EAAG,sBAAsB,WAAY,CAAO,EAE5C,IAAM,EAAa,EAAwB,CACvC,UAFgB,EAGhB,YAAe,EACf,YAAe,EACf,OAAQ,EACR,aAAe,GAAU,EAAW,SAAS,CAAK,CACtD,CAAC,EACD,EAAW,QAAQ,EACnB,IAAM,EAA8B,EAA6B,EAAS,CACtE,eAAsB,CACb,EAAG,cACJ,EAAQ,yBAA2B,GAAI,EAAG,sBAAsB,WAAY,CAAO,EACvF,EAAkB,EAAI,EAAQ,EAAE,EAChC,EAAW,KAAK,EACpB,CACJ,CAAC,EACD,EAAuB,EAAI,2BAA4B,0BAA0B,EACjF,IAAM,EAAY,EAAU,cAAc,CAAU,EACpD,EAAU,WAAa,EAAW,GAAU,CACxC,IAAM,EAAO,OAAO,GAAU,SAAW,EAAM,KAAK,EAAI,GACxD,EAAM,YAAc,EACpB,EAAG,gBAAgB,2BAA4B,CAAC,CAAI,EACpD,EAAW,KAAK,CACpB,CAAC,CAAC,EACF,EAAU,YAAc,CACpB,EAA4B,EAC5B,EAAW,QAAQ,EACnB,EAAW,QAAQ,EACnB,EAAQ,OAAO,CACnB,CAAC,CACL,CAAC,CAAC,CAAC,CAAC,OAAO,eAAe,CAC9B,EAEM,EAAmB,GAAwC,CAC7D,EAAiB,YAAa,CAAS,CAAC,CAAC,CAAc,EACvD,EAAyB,CAAc,CAC3C,ECxXM,EAAa,IAAI,QAEjB,EAAmB,GAAqC,CACtD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAC7B,EAAyB,CAAc,EACvC,EAA2B,CAAc,EACzC,EAAkB,CAAc,EACpC"}
1
+ {"version":3,"file":"entry.generated-BITa8xFV.js","names":[],"sources":["../../../../../../../../client/src/components/tooltip/contract.ts","../../../../../../../../client/src/components/tooltip/machine.ts","../../../../../../../../client/src/components/tooltip/styles.ts","../../../../../../../../client/src/components/tooltip/index.ts","../../../../../../../../client/src/components/tooltip/entry.generated.ts"],"sourcesContent":["import {attribute, bool, number, oneOf, string, type SchemaToProps} from '../../runtime';\nimport {\n ALIGNMENTS,\n ELEVATION_REFERENCES,\n POSITIONS,\n SURFACE_REFERENCES,\n type Alignment,\n type ElevationReference,\n type Position,\n type SurfaceReference,\n} from '../common';\n\nconst TOOLTIP_COLORS = ['neutral', 'accent', 'success', 'warning', 'danger'] as const;\nconst TOOLTIP_VARIANTS = ['surface', 'soft', 'solid'] as const;\n\nconst tooltipSchema = {\n side: oneOf(POSITIONS, 'bottom' as Position),\n align: oneOf(ALIGNMENTS, 'center' as Alignment),\n offset: number.clamp(-100, 100).default(0),\n gap: number.clamp(0, 50).default(8),\n openDelay: number.clamp(0, 5000).default(400),\n closeDelay: number.clamp(0, 5000).default(150),\n color: oneOf(TOOLTIP_COLORS, 'neutral'),\n variant: oneOf(TOOLTIP_VARIANTS, 'surface'),\n surface: oneOf(SURFACE_REFERENCES, '2' as SurfaceReference),\n elevation: oneOf(ELEVATION_REFERENCES, '4' as ElevationReference),\n disabled: bool,\n class: string,\n};\n\nconst tooltipDirectiveSchema = {\n side: attribute(tooltipSchema.side, 'ui-tooltip-side'),\n align: attribute(tooltipSchema.align, 'ui-tooltip-align'),\n offset: attribute(tooltipSchema.offset, 'ui-tooltip-offset'),\n gap: attribute(tooltipSchema.gap, 'ui-tooltip-gap'),\n openDelay: attribute(tooltipSchema.openDelay, 'ui-tooltip-open-delay'),\n closeDelay: attribute(tooltipSchema.closeDelay, 'ui-tooltip-close-delay'),\n color: attribute(tooltipSchema.color, 'ui-tooltip-color'),\n variant: attribute(tooltipSchema.variant, 'ui-tooltip-variant'),\n surface: attribute(tooltipSchema.surface, 'ui-tooltip-surface'),\n elevation: attribute(tooltipSchema.elevation, 'ui-tooltip-elevation'),\n disabled: attribute(tooltipSchema.disabled, 'ui-tooltip-disabled'),\n};\n\ntype TooltipProps = SchemaToProps<typeof tooltipSchema>;\ntype TooltipDirectiveProps = SchemaToProps<typeof tooltipDirectiveSchema>;\ntype TooltipColor = typeof TOOLTIP_COLORS[number];\ntype TooltipVariant = typeof TOOLTIP_VARIANTS[number];\n\nexport {\n TOOLTIP_COLORS,\n TOOLTIP_VARIANTS,\n tooltipDirectiveSchema,\n tooltipSchema,\n};\nexport type {TooltipColor, TooltipDirectiveProps, TooltipProps, TooltipVariant};\n","import {createMachine, type Machine, type MachineEventObject} from '../../runtime/state-machine';\nimport {defineHook, type TransitionHookDefinition} from '../../runtime/transition-coordinator';\nimport type {TooltipProps} from './contract';\n\ntype TooltipReason = 'pointer' | 'focus' | 'escape' | 'activation' | 'scroll' | 'blur' | 'disabled' | 'replacement';\ntype TooltipContext = {transition: {reason: TooltipReason; instant: boolean}};\ntype TooltipTransitionData = {reason: TooltipReason; instant: boolean};\ntype TooltipMachineEffects = {\n prepareOpen(): void;\n finishOpen(): void;\n prepareClose(): void;\n finishClose(): void;\n syncProps(): void;\n};\n\nconst transitionData = ({context}: {context: TooltipContext}): TooltipTransitionData => context.transition;\nconst openingHook = defineHook({\n name: 'opening', state: 'opening', project: transitionData, onDone: 'OPENING_DONE', onError: 'OPENING_ERROR',\n} satisfies TransitionHookDefinition<TooltipContext, TooltipProps, TooltipTransitionData, 'opening'>);\nconst closingHook = defineHook({\n name: 'closing', state: 'closing', project: transitionData, onDone: 'CLOSING_DONE', onError: 'CLOSING_ERROR',\n} satisfies TransitionHookDefinition<TooltipContext, TooltipProps, TooltipTransitionData, 'closing'>);\nconst tooltipHooks = [openingHook, closingHook] as const;\n\nconst reasonFrom = (event: MachineEventObject): TooltipReason => {\n const reason = event.reason;\n return reason === 'focus' || reason === 'escape' || reason === 'activation' || reason === 'scroll'\n || reason === 'blur' || reason === 'disabled' || reason === 'replacement' ? reason : 'pointer';\n};\n\nconst createTooltipMachine = (\n props: TooltipProps,\n effects: TooltipMachineEffects,\n): Machine<TooltipContext, TooltipProps> => createMachine<TooltipContext, TooltipProps>({\n initial: 'closed',\n states: {\n closed: {tags: ['closed'], on: {\n OPEN: {target: 'opening', guard: 'canOpen', reduce: 'transition', effects: 'prepareOpen'},\n PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'},\n }},\n opening: {tags: ['visible', 'expanded', 'transitioning'], on: {\n OPENING_DONE: {target: 'open', effects: 'finishOpen'},\n OPENING_ERROR: {target: 'open', effects: 'finishOpen'},\n CLOSE: {target: 'closing', reduce: 'transition', effects: 'prepareClose'},\n PROPS_CHANGED: [\n {target: 'closing', guard: 'becomesDisabled', reduce: 'replacePropsDisabled', effects: ['syncProps', 'prepareClose']},\n {reduce: 'replaceProps', effects: 'syncProps'},\n ],\n }},\n open: {tags: ['visible', 'expanded', 'open'], on: {\n CLOSE: {target: 'closing', reduce: 'transition', effects: 'prepareClose'},\n PROPS_CHANGED: [\n {target: 'closing', guard: 'becomesDisabled', reduce: 'replacePropsDisabled', effects: ['syncProps', 'prepareClose']},\n {reduce: 'replaceProps', effects: 'syncProps'},\n ],\n }},\n closing: {tags: ['visible', 'transitioning'], on: {\n CLOSING_DONE: {target: 'closed', effects: 'finishClose'},\n CLOSING_ERROR: {target: 'closed', effects: 'finishClose'},\n OPEN: {target: 'opening', guard: 'canOpen', reduce: 'transition', effects: 'prepareOpen'},\n PROPS_CHANGED: {reduce: 'replaceProps', effects: 'syncProps'},\n }},\n },\n}, {\n context: {transition: {reason: 'pointer', instant: false}},\n props,\n reducers: {\n transition: ({context, props: currentProps, event}) => ({\n context: {transition: {reason: reasonFrom(event), instant: event.instant === true}},\n props: currentProps,\n }),\n replaceProps: ({context, props: currentProps, event}) => ({\n context,\n props: (event.props as TooltipProps | undefined) ?? currentProps,\n }),\n replacePropsDisabled: ({context, props: currentProps, event}) => ({\n context: {transition: {reason: 'disabled', instant: true}},\n props: (event.props as TooltipProps | undefined) ?? currentProps,\n }),\n },\n guards: {\n canOpen: ({props: currentProps}) => !currentProps.disabled,\n becomesDisabled: ({event}) => (event.props as TooltipProps | undefined)?.disabled === true,\n },\n effects,\n});\n\nexport {createTooltipMachine, tooltipHooks};\nexport type {TooltipContext, TooltipMachineEffects, TooltipReason, TooltipTransitionData};\n","import {defineStyles} from '../../runtime';\nimport {POPOVER_GEOMETRY_CLASSES} from '../common';\n\nconst tooltipStyles = defineStyles({definition: {\n component: 'ui.tooltip',\n parts: {\n root: {base: 'contents'},\n content: {\n base: [\n POPOVER_GEOMETRY_CLASSES,\n 'pointer-events-auto min-h-control-md max-w-72 auto-cols-max grid-flow-col items-center gap-2 rounded-overlay-sm px-2 py-1',\n 'font-body text-1 [font-weight:var(--font-weight-normal)]',\n 'data-[state=closed]:pointer-events-none data-[state=closed]:opacity-0',\n ],\n variants: {\n color: {neutral: '', accent: '', success: '', warning: '', danger: ''},\n variant: {surface: '', soft: '', solid: ''},\n },\n defaults: {color: 'neutral', variant: 'surface'},\n },\n shortcut: {base: 'ml-1 inline-flex items-center gap-1 text-[var(--ui-semantic-surface-ink-muted)]'},\n },\n}});\n\nexport {tooltipStyles};\n","import type Alpine from 'alpinejs';\n\nimport {\n createAlpineMachine,\n defineAlpineData,\n type SchemaToProps,\n type TransitionForHook,\n type TrellisAlpineComponent,\n} from '@client/runtime';\nimport {createAnchoredPopoverSurface, type AnchoredPopoverSurface} from '@client/runtime/anchored-popover';\nimport {CleanupManager} from '@client/runtime/cleanup-manager';\nimport type {CodecFn} from '@client/runtime/codecs';\nimport {registerDomInvalidationOwner} from '@client/runtime/dom-invalidation';\nimport {isFocusIndicatorSuppressed} from '@client/runtime/focus';\nimport {mergeBindings, type BindingObject} from '@client/runtime/merge-bindings';\nimport {declareMorphAttributes} from '@client/runtime/morph';\nimport {observeSemanticChanges} from '@client/runtime/semantic-observer';\nimport {resolveStyle} from '@client/runtime/styles';\nimport {addListener, dispatch} from '@client/utils';\nimport {createKeybindingController} from '../keybinding/controller';\nimport {keybindingStyles} from '../keybinding/styles';\nimport {\n tooltipDirectiveSchema,\n type TooltipDirectiveProps,\n type TooltipProps,\n tooltipSchema,\n} from './contract';\nimport {\n createTooltipMachine,\n tooltipHooks,\n type TooltipContext,\n type TooltipReason,\n} from './machine';\nimport {tooltipStyles} from './styles';\n\ntype TooltipTransitionName = (typeof tooltipHooks)[number]['name'];\ntype TooltipTransition<TName extends TooltipTransitionName = TooltipTransitionName> = TransitionForHook<\n Extract<(typeof tooltipHooks)[number], {name: TName}>,\n HTMLElement\n>;\ntype PopoverElement = HTMLElement & {showPopover(): void; hidePopover(): void};\ntype TooltipSchema = Record<string, CodecFn<unknown>>;\ntype TooltipBridge = ReturnType<typeof createAlpineMachine<TooltipContext, typeof tooltipSchema, typeof tooltipHooks>>;\n\ntype TooltipController = {\n bridge: TooltipBridge;\n connect(snapshot?: {current: TooltipBridge['snapshot']['current']}): void;\n destroy(): void;\n sync(): void;\n close(reason: TooltipReason, instant?: boolean): void;\n};\n\ntype TooltipWarmStore = {active: TooltipController | null};\nconst warmStores = new WeakMap<Document, TooltipWarmStore>();\nconst warmStore = (document: Document): TooltipWarmStore => {\n let store = warmStores.get(document);\n if (!store) {\n store = {active: null};\n warmStores.set(document, store);\n }\n return store;\n};\n\nconst appendDescription = (trigger: HTMLElement, id: string): void => {\n const tokens = new Set((trigger.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter(Boolean));\n tokens.add(id);\n trigger.setAttribute('aria-describedby', [...tokens].join(' '));\n};\n\nconst removeDescription = (trigger: HTMLElement, id: string): void => {\n const tokens = (trigger.getAttribute('aria-describedby') ?? '').split(/\\s+/).filter((token) => token && token !== id);\n if (tokens.length) trigger.setAttribute('aria-describedby', tokens.join(' '));\n else trigger.removeAttribute('aria-describedby');\n};\n\nconst createTooltipController = <TSchema extends TooltipSchema>({\n owner,\n trigger,\n content,\n schema,\n syncShortcut,\n}: {\n owner: () => HTMLElement & Alpine.ElementWithXAttributes;\n trigger: () => HTMLElement;\n content: () => PopoverElement;\n schema: TSchema;\n syncShortcut?: (value: string) => void;\n}): TooltipController => {\n const cleanup = new CleanupManager();\n let popover: AnchoredPopoverSurface | null = null;\n let openTimer: ReturnType<typeof setTimeout> | null = null;\n let closeTimer: ReturnType<typeof setTimeout> | null = null;\n let describedById = '';\n let pointerOnTrigger = false;\n let pointerOnContent = false;\n\n const clearTimer = (timer: 'open' | 'close'): void => {\n const current = timer === 'open' ? openTimer : closeTimer;\n if (current !== null) clearTimeout(current);\n if (timer === 'open') openTimer = null;\n else closeTimer = null;\n };\n const props = (): Readonly<TooltipProps> => bridge.getSnapshot().props as TooltipProps;\n const visible = (): boolean => bridge.hasTag('visible');\n const syncSurface = (): void => {\n const value = props();\n const surface = content();\n surface.dataset.state = bridge.hasTag('expanded') ? 'open' : 'closed';\n surface.setAttribute('data-ui-semantic-surface', '');\n surface.dataset.color = value.color;\n surface.dataset.variant = value.variant;\n surface.dataset.uiSurface = value.surface;\n surface.dataset.uiElevation = value.elevation;\n surface.className = resolveStyle({\n part: tooltipStyles.parts.content,\n props: value,\n className: surface.dataset.class,\n });\n syncShortcut?.(trigger().dataset.uiTooltipShortcut ?? '');\n popover?.sync();\n };\n const finishClose = (): void => {\n popover?.close();\n content().hidden = true;\n syncSurface();\n const store = warmStore(owner().ownerDocument);\n if (store.active === controller) store.active = null;\n dispatch({el: owner(), name: 'ui:close'});\n };\n const effects = {\n prepareOpen(): void {\n content().hidden = false;\n popover?.open();\n syncSurface();\n },\n finishOpen(): void {\n syncSurface();\n dispatch({el: owner(), name: 'ui:open'});\n },\n prepareClose(): void { syncSurface(); },\n finishClose,\n syncProps(): void {\n syncSurface();\n if (props().disabled && visible()) controller.close('disabled', true);\n },\n };\n const machineBridge = createAlpineMachine({\n schema,\n hooks: tooltipHooks,\n createMachine: ({props: machineProps}) => createTooltipMachine(machineProps as TooltipProps, effects) as never,\n });\n const bridge = machineBridge as unknown as TooltipBridge;\n\n const open = (reason: TooltipReason, instant = false): void => {\n clearTimer('open');\n clearTimer('close');\n if (props().disabled || bridge.hasTag('expanded')) return;\n const store = warmStore(owner().ownerDocument);\n const warm = store.active !== null && store.active !== controller;\n if (store.active && store.active !== controller) store.active.close('replacement', true);\n store.active = controller;\n bridge.send({type: 'OPEN', reason, instant: instant || warm});\n };\n const close = (reason: TooltipReason, instant = false): void => {\n clearTimer('open');\n clearTimer('close');\n if (!visible()) return;\n bridge.send({type: 'CLOSE', reason, instant});\n };\n const scheduleOpen = (): void => {\n clearTimer('close');\n if (visible() || props().disabled) return;\n const delay = warmStore(owner().ownerDocument).active ? 0 : props().openDelay;\n clearTimer('open');\n openTimer = setTimeout(() => open('pointer', delay === 0), delay);\n };\n const scheduleClose = (): void => {\n clearTimer('open');\n if (!visible()) return;\n clearTimer('close');\n closeTimer = setTimeout(() => close('pointer'), props().closeDelay);\n };\n\n const controller: TooltipController = {\n bridge,\n connect(snapshot): void {\n bridge.connect(owner(), snapshot);\n describedById = content().id || `ui-tooltip-${crypto.randomUUID()}`;\n content().id = describedById;\n content().setAttribute('role', 'tooltip');\n content().setAttribute('popover', 'manual');\n content().setAttribute('data-ui-tooltip-content', '');\n content().hidden = true;\n trigger().setAttribute('data-ui-tooltip-trigger', '');\n appendDescription(trigger(), describedById);\n declareMorphAttributes(\n trigger(),\n 'aria-describedby',\n 'data-ui-tooltip-trigger',\n );\n popover = createAnchoredPopoverSurface({\n reference: trigger,\n floating: content,\n position: () => props().side,\n align: () => props().align,\n gap: () => props().gap,\n offset: () => props().offset,\n });\n syncSurface();\n addListener({target: trigger(), event: 'pointerenter', cleanup, handler: () => {\n pointerOnTrigger = true;\n scheduleOpen();\n }});\n addListener({target: trigger(), event: 'pointermove', handler: scheduleOpen, cleanup});\n addListener({target: trigger(), event: 'pointerleave', cleanup, handler: () => {\n pointerOnTrigger = false;\n if (!pointerOnContent) scheduleClose();\n }});\n addListener({target: content(), event: 'pointerenter', cleanup, handler: () => {\n pointerOnContent = true;\n clearTimer('close');\n }});\n addListener({target: content(), event: 'pointerleave', cleanup, handler: () => {\n pointerOnContent = false;\n if (!pointerOnTrigger) scheduleClose();\n }});\n addListener({target: trigger(), event: 'focusin', cleanup, handler: () => {\n queueMicrotask(() => {\n const target = trigger();\n if (\n target.ownerDocument.activeElement === target\n && !isFocusIndicatorSuppressed(target)\n && target.matches(':focus-visible')\n ) open('focus', true);\n });\n }});\n addListener({target: trigger(), event: 'focusout', cleanup, handler: () => {\n if (!pointerOnTrigger && !pointerOnContent) close('blur', true);\n }});\n addListener({target: trigger(), event: 'pointerdown', handler: () => close('activation', true), cleanup});\n addListener({target: trigger(), event: 'click', handler: () => close('activation', true), cleanup});\n addListener({target: owner().ownerDocument, event: 'keydown', cleanup, handler: (event) => {\n if (event instanceof KeyboardEvent && event.key === 'Escape' && visible()) close('escape', true);\n }});\n addListener({target: owner().ownerDocument, event: 'scroll', options: {capture: true}, cleanup, handler: () => {\n if (visible()) close('scroll', true);\n }});\n cleanup.add(observeSemanticChanges({\n targets: trigger(),\n read: () => trigger().dataset.uiTooltipShortcut ?? '',\n onChange: syncSurface,\n observer: {attributes: true, attributeFilter: ['data-ui-tooltip-shortcut']},\n }));\n },\n close,\n sync: syncSurface,\n destroy(): void {\n clearTimer('open');\n clearTimer('close');\n cleanup.run();\n const store = warmStore(owner().ownerDocument);\n if (store.active === controller) store.active = null;\n popover?.destroy();\n popover = null;\n removeDescription(trigger(), describedById);\n trigger().removeAttribute('data-ui-tooltip-trigger');\n bridge.disconnect();\n },\n };\n return controller;\n};\n\ntype TooltipData = TooltipBridge & {\n readonly root: BindingObject;\n readonly content: BindingObject;\n init(): void;\n destroy(): void;\n};\n\nconst UiTooltip = (): TrellisAlpineComponent<TooltipData> => {\n let rootEl: (HTMLElement & Alpine.ElementWithXAttributes) | null = null;\n let controller: TooltipController | null = null;\n const root = (): HTMLElement & Alpine.ElementWithXAttributes => {\n if (!rootEl) throw new Error('Tooltip has not been initialized.');\n return rootEl;\n };\n const content = (): PopoverElement => {\n const el = root().querySelector<HTMLElement>(':scope > [data-ui-tooltip-content]');\n if (!(el instanceof HTMLElement)) throw new Error('Tooltip requires ui.tooltip.content.');\n return el as PopoverElement;\n };\n const trigger = (): HTMLElement => {\n const el = Array.from(root().children).find((child) => child instanceof HTMLElement && child !== content());\n if (!(el instanceof HTMLElement)) throw new Error('Tooltip requires an interactive trigger before its content.');\n return el;\n };\n const bridge = createAlpineMachine({\n schema: tooltipSchema,\n hooks: tooltipHooks,\n createMachine: ({props}) => createTooltipMachine(props, {\n prepareOpen() {}, finishOpen() {}, prepareClose() {}, finishClose() {}, syncProps() {},\n }),\n }) as TooltipBridge;\n const component: TrellisAlpineComponent<TooltipData> = {\n ...bridge,\n init(): void {\n rootEl = this.$el;\n controller = createTooltipController({owner: root, trigger, content, schema: tooltipSchema});\n controller.connect(this.snapshot);\n },\n destroy(): void {\n controller?.destroy();\n controller = null;\n rootEl = null;\n },\n get root(): BindingObject {\n return mergeBindings({inputs: [\n resolveStyle({part: tooltipStyles.parts.root, props: this.snapshot.current?.props ?? {}}),\n {'data-ui-tooltip-root': ''},\n ]});\n },\n get content(): BindingObject {\n return {'data-ui-tooltip-content': ''};\n },\n };\n return component;\n};\n\nconst registerTooltipDirective = (AlpineInstance: Alpine.Alpine): void => {\n AlpineInstance.addInitSelector(() => '[x-ui-tooltip]');\n AlpineInstance.directive('ui-tooltip', AlpineInstance.skipDuringClone((el, {expression}, utilities) => {\n if (!(el instanceof HTMLElement)) return;\n const content = el.ownerDocument.createElement('div') as PopoverElement;\n const label = el.ownerDocument.createElement('span');\n label.setAttribute('data-ui-tooltip-label', '');\n content.append(label);\n const shortcut = el.ownerDocument.createElement('span');\n shortcut.setAttribute('data-ui-keybinding', '');\n shortcut.dataset.variant = 'outline';\n shortcut.setAttribute('aria-hidden', 'true');\n shortcut.className = resolveStyle({\n part: keybindingStyles.parts.root,\n className: resolveStyle({part: tooltipStyles.parts.shortcut}),\n });\n content.append(shortcut);\n const keybinding = createKeybindingController(shortcut);\n el.insertAdjacentElement('afterend', content);\n const owner = () => el as HTMLElement & Alpine.ElementWithXAttributes;\n const controller = createTooltipController({\n owner,\n trigger: () => el,\n content: () => content,\n schema: tooltipDirectiveSchema,\n syncShortcut: (value) => keybinding.setValue(value),\n });\n controller.connect();\n const unregisterInvalidationOwner = registerDomInvalidationOwner(content, {\n invalidateDom(): void {\n if (!el.isConnected) return;\n if (content.previousElementSibling !== el) el.insertAdjacentElement('afterend', content);\n appendDescription(el, content.id);\n controller.sync();\n },\n });\n declareMorphAttributes(el, 'data-ui-tooltip-disabled', 'data-ui-tooltip-shortcut');\n const evaluator = utilities.evaluateLater(expression);\n utilities.effect(() => evaluator((value) => {\n const text = typeof value === 'string' ? value.trim() : '';\n label.textContent = text;\n el.toggleAttribute('data-ui-tooltip-disabled', !text);\n controller.sync();\n }));\n utilities.cleanup(() => {\n unregisterInvalidationOwner();\n controller.destroy();\n keybinding.destroy();\n content.remove();\n });\n })).before('ui-transition');\n};\n\nconst registerTooltip = (AlpineInstance: Alpine.Alpine): void => {\n defineAlpineData('UiTooltip', UiTooltip)(AlpineInstance);\n registerTooltipDirective(AlpineInstance);\n};\n\nexport {registerTooltip, registerTooltipDirective, UiTooltip};\nexport type {TooltipData, TooltipDirectiveProps, TooltipTransition};\n","// Generated by scripts/generate_component_entries.mjs from packages/client/component-entries.json.\n// Do not edit by hand.\nimport type {Alpine as AlpineType} from 'alpinejs';\nimport {registerMotionCapability} from '../../capabilities/motion';\nimport {registerShortcutCapability} from '../../capabilities/shortcut';\nimport {registerTooltip as registerComponent} from './index';\n\nconst registered = new WeakSet<AlpineType>();\n\nconst registerTooltip = (AlpineInstance: AlpineType): void => {\n if (registered.has(AlpineInstance)) return;\n registered.add(AlpineInstance);\n registerMotionCapability(AlpineInstance);\n registerShortcutCapability(AlpineInstance);\n registerComponent(AlpineInstance);\n};\n\nexport {registerTooltip};\nexport default registerTooltip;\nexport * from './index';\n"],"mappings":"61BAeA,IAAM,EAAgB,CAClB,KAAM,EAAM,EAAW,QAAoB,EAC3C,MAAO,EAAM,EAAY,QAAqB,EAC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C,IAAM,EAAO,OAAO,GAAU,SAAW,EAAM,KAAK,EAAI,GACxD,EAAM,YAAc,EACpB,EAAG,gBAAgB,2BAA4B,CAAC,CAAI,EACpD,EAAW,KAAK,CACpB,CAAC,CAAC,EACF,EAAU,YAAc,CACpB,EAA4B,EAC5B,EAAW,QAAQ,EACnB,EAAW,QAAQ,EACnB,EAAQ,OAAO,CACnB,CAAC,CACL,CAAC,CAAC,CAAC,CAAC,OAAO,eAAe,CAC9B,EAEM,EAAmB,GAAwC,CAC7D,EAAiB,YAAa,CAAS,CAAC,CAAC,CAAc,EACvD,EAAyB,CAAc,CAC3C,ECzXM,EAAa,IAAI,QAEjB,EAAmB,GAAqC,CACtD,EAAW,IAAI,CAAc,IACjC,EAAW,IAAI,CAAc,EAC7B,EAAyB,CAAc,EACvC,EAA2B,CAAc,EACzC,EAAkB,CAAc,EACpC"}
@@ -1,2 +1,2 @@
1
- import{i as e,r as t,s as n,t as r}from"./dom-DiTFTWeR.js";import{f as i,s as a}from"./motion-DI5H1Js0.js";import{t as o}from"./capability-motion-BGVnZE_T.js";import{n as s}from"./morph-Cq3V_23_.js";import{a as c,f as l,l as u,n as d}from"./codecs-CQ7olTJL.js";import{i as f,t as ee}from"./alpine-machine-CE2UN4Qu.js";import{t as p}from"./focus-pk_lz9sg.js";import{t as m}from"./cleanup-manager-D9QiZF_Q.js";import{n as h,t as te}from"./alpine-data-Dvc_bXq6.js";import{n as g,t as _}from"./styles-CX2j92ex.js";import{t as ne}from"./merge-bindings-BtqW3UgP.js";import{t as v}from"./machine-CNnHDbyo.js";import{r as re}from"./focus-scope-BrYxsrhc.js";import{t as ie}from"./semantic-observer-CIoriWtV.js";import{n as ae,t as y}from"./capability-resizable-ByUbMIHF.js";var oe=(e,t)=>{let n=getComputedStyle(e).getPropertyValue(`--breakpoint-${t}`),r=Number.parseFloat(n);return Number.isFinite(r)?r:1/0},b=[`horizontal`,`vertical`],x=[`div`,`section`,`aside`,`main`,`nav`],S=[`1`,`2`,`3`,`4`,`5`,`6`,`fill`],C=[`none`,`start`,`end`],se=[`toggle`,`expand`,`collapse`],ce={id:l.default(`ui-panels`),orientation:u(b,`horizontal`),persist:d,divider:d.default(!0),class:l},le={id:l,as:u(x,`section`),size:u(S,`fill`),resize:u(C,`none`),collapsible:d,defaultCollapsed:d,class:l},w={target:l,action:u(se,`toggle`),icon:l.default(`menu`),label:l.default(`Expand`),class:l},ue=[f({name:`opening`,state:`changing`,projectEach:e=>e.context.change.openingIds.map(e=>({panelId:e})),onDone:`CHANGE_DONE`,onError:`CHANGE_ERROR`,sends:{expand:e=>({type:`EXPAND`,panelId:e}),collapse:e=>({type:`COLLAPSE`,panelId:e}),toggle:e=>({type:`TOGGLE`,panelId:e})}}),f({name:`closing`,state:`changing`,projectEach:e=>e.context.change.closingIds.map(e=>({panelId:e})),onDone:`CHANGE_DONE`,onError:`CHANGE_ERROR`,sends:{expand:e=>({type:`EXPAND`,panelId:e}),collapse:e=>({type:`COLLAPSE`,panelId:e}),toggle:e=>({type:`TOGGLE`,panelId:e})}}),f({name:`sizing`,state:`sizing`,projectEach:e=>e.context.sizing.changes,onDone:`SIZE_DONE`,onError:`SIZE_ERROR`}),f({name:`persisting`,state:`persisting`,project:e=>({groupId:e.props.id,collapsed:[...e.context.layout.collapsedIds],sizes:{...e.context.layout.committedSizes}}),onDone:`PERSIST_DONE`,onError:`PERSIST_ERROR`})],T=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],E=e=>typeof e.panelId==`string`?e.panelId:``,D=e=>typeof e==`number`&&Number.isFinite(e)?e:null,O=e=>(Array.isArray(e.changes)?e.changes:[e]).flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e,n=typeof t.panelId==`string`?t.panelId:``,r=D(t.from),i=D(t.to),a=t.reset===!0;return n&&r!==null&&i!==null&&(r!==i||a)?[{panelId:n,from:r,to:i,...a?{reset:!0}:{}}]:[]}),k=(e,t)=>typeof e.props==`object`&&e.props!==null?e.props:t,A=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),j=e=>{if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(typeof e!=`object`||!e)return;let n=e;if(typeof n.id!=`string`||!n.id)return;let r=n.collapsible===!0?{collapsible:!0,defaultCollapsed:n.defaultCollapsed===!0}:{collapsible:!1,defaultCollapsed:!1};n.kind===`fill`&&t.push({id:n.id,kind:`fill`,...r}),n.kind===`bounded`&&t.push({id:n.id,kind:`bounded`,resizable:n.resizable===!0,...r})}),t},M=e=>new Map(e.map(e=>[e.id,e])),N=(e,t)=>Object.fromEntries(e.flatMap(e=>e.kind===`bounded`&&Object.hasOwn(t,e.id)?[[e.id,t[e.id]]]:[])),P=e=>{let t=E(e.event),n=e.context.layout.collapsedIds,r=e.context.collection,i=M(r).get(t);switch(e.event.type){case`COLLAPSE`:return i?.collapsible&&!n.includes(t)?r.map(e=>e.id).filter(e=>n.includes(e)||e===t):n;case`EXPAND`:return n.filter(e=>e!==t);case`TOGGLE`:return i?.collapsible?n.includes(t)?n.filter(e=>e!==t):r.map(e=>e.id).filter(e=>n.includes(e)||e===t):n;default:return n}},F=e=>{let t=E(e.event);return M(e.context.collection).has(t)&&!A(e.context.layout.collapsedIds,P(e))},I=e=>{let t=E(e.event),n=M(e.context.collection).get(t);return n?.kind===`bounded`&&n.resizable&&!e.context.layout.collapsedIds.includes(t)&&D(e.event.size)!==null},L=e=>{let t=O(e.event),n=M(e.context.collection);return t.length>0&&t.every(({panelId:t})=>n.get(t)?.kind===`bounded`&&!e.context.layout.collapsedIds.includes(t))},R=e=>{let t=O(e.event),n=M(e.context.collection);return t.length>0&&t.every(({panelId:t})=>n.get(t)?.kind===`bounded`&&e.context.layout.collapsedIds.includes(t))},z=e=>{let t=T(e.event.ids),n=M(e.context.collection);return t.length>0&&t.every(t=>n.get(t)?.kind===`bounded`&&e.context.layout.collapsedIds.includes(t)&&Object.hasOwn(e.context.layout.committedSizes,t))},B=e=>{let t=O(e.event),n={...e.context.layout.committedSizes};return t.forEach(({panelId:e,to:t,reset:r})=>{r?delete n[e]:n[e]=t}),{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,n)},sizing:{changes:t}}}},V=e=>{let t=O(e.event),n={...e.context.layout.committedSizes,...Object.fromEntries(t.map(({panelId:e,to:t})=>[e,t]))};return{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,n)}}}},de=e=>{let t={...e.context.layout.committedSizes};return T(e.event.ids).forEach(e=>delete t[e]),{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,t)}}}},H=e=>{let t=P(e),n=e.context.layout.collapsedIds;return{context:{...e.context,layout:{...e.context.layout,collapsedIds:t},change:{openingIds:n.filter(e=>!t.includes(e)),closingIds:t.filter(e=>!n.includes(e))}}}},U=e=>{let t=j(e.event.collection),n=M(e.context.collection),r=t.filter(t=>(e.context.layout.collapsedIds.includes(t.id)||!n.has(t.id)&&t.defaultCollapsed)&&t.collapsible).map(e=>e.id),i=N(t,e.context.layout.committedSizes),a=M(t).get(e.context.resize.activeId),o=a?.kind===`bounded`&&a.resizable;return{context:{...e.context,collection:t,layout:{collapsedIds:r,committedSizes:i},resize:o?e.context.resize:{activeId:``,initialSize:null,previewSize:null}}}},W=e=>{let t=M(j(e.event.collection)).get(e.context.resize.activeId);return t?.kind!==`bounded`||!t.resizable},fe=({props:e,context:t,effects:n})=>v({initial:`stable`,on:{DOM_INVALIDATED:{effects:`sync`}},states:{stable:{tags:[`stable`],on:{COLLAPSE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},EXPAND:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},TOGGLE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},SIZE:{target:`sizing`,guard:L,reduce:B,effects:`prepareSizing`},RESTORE_HIDDEN_SIZES:{guard:R,reduce:V},RESET_HIDDEN_SIZES:{target:`persisting`,guard:z,reduce:de,effects:[`sync`,`persist`]},RESIZE_START:{target:`resizing`,guard:I,reduce:`startResize`,effects:`beginResize`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},changing:{tags:[`changing`,`transitioning`],on:{CHANGE_DONE:{target:`persisting`,effects:[`finishChange`,`persist`]},CHANGE_ERROR:{target:`persisting`,effects:[`finishChange`,`persist`]},COLLAPSE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},EXPAND:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},TOGGLE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},sizing:{tags:[`sizing`,`transitioning`],on:{SIZE_DONE:{target:`persisting`,effects:[`finishSizing`,`persist`]},SIZE_ERROR:{target:`persisting`,effects:[`finishSizing`,`persist`]},SIZE:{target:`sizing`,guard:L,reduce:B,effects:`prepareSizing`},RESIZE_START:{target:`resizing`,guard:I,reduce:`startResize`,effects:`beginResize`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},resizing:{tags:[`resizing`],on:{RESIZE:{guard:`activeResize`,reduce:`previewResize`,effects:`previewResize`},RESIZE_END:{target:`persisting`,guard:`activeResize`,reduce:`commitResize`,effects:[`commitResize`,`persist`]},RESIZE_CANCEL:{target:`stable`,reduce:`clearResize`,effects:`cancelResize`},PANELS_CHANGED:[{target:`stable`,guard:W,reduce:U,effects:[`cancelResize`,`sync`]},{reduce:U,effects:`sync`}],PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},persisting:{tags:[`persisting`],on:{PERSIST_DONE:`stable`,PERSIST_ERROR:`stable`,COLLAPSE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},EXPAND:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},TOGGLE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},SIZE:{target:`sizing`,guard:L,reduce:B,effects:`prepareSizing`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}}}},{props:e,context:t,reducers:{replaceProps:e=>({props:k(e.event,e.props)}),startResize:e=>{let t=D(e.event.size);return{context:{...e.context,resize:{activeId:E(e.event),initialSize:t,previewSize:t}}}},previewResize:e=>({context:{...e.context,resize:{...e.context.resize,previewSize:D(e.event.size)}}}),commitResize:e=>{let t=E(e.event),n=D(e.event.size);if(n!==null)return{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,{...e.context.layout.committedSizes,[t]:n})},resize:{activeId:``,initialSize:null,previewSize:null}}}},clearResize:e=>({context:{...e.context,resize:{activeId:``,initialSize:null,previewSize:null}}})},guards:{activeResize:e=>E(e.event)===e.context.resize.activeId&&D(e.event.size)!==null},effects:{prepareChange:n.prepareChange,finishChange:n.finishChange,sync:n.sync,beginResize:n.beginResize,previewResize:n.previewResize,commitResize:n.commitResize,cancelResize:n.cancelResize,prepareSizing:n.prepareSizing,finishSizing:n.finishSizing,persist:n.persist}}),G=_({definition:{component:`ui.panels`,parts:{root:{base:`relative flex h-full min-h-0 w-full min-w-0`,variants:{orientation:{horizontal:`flex-row`,vertical:`flex-col`}},defaults:{orientation:`horizontal`}},panel:{base:`relative min-w-0 overflow-hidden border-separator`,variants:{orientation:{horizontal:`h-full`,vertical:`w-full`},divider:{true:``,false:``},resize:{none:``,start:``,end:``}},defaults:{orientation:`horizontal`,divider:!0,resize:`none`}},expanded:{base:`h-full min-h-0 w-full min-w-0`},collapsed:{base:`flex h-full min-h-0 w-full min-w-0 items-center justify-center overflow-hidden`},resizeHandle:{base:[`absolute z-20 touch-none outline-none`],variants:{orientation:{horizontal:`inset-y-0 w-panel-resize-handle cursor-col-resize`,vertical:`inset-x-0 h-panel-resize-handle cursor-row-resize`},edge:{start:``,end:``}},defaults:{orientation:`horizontal`,edge:`end`}},toggle:{base:`inline-flex size-control-md items-center justify-center outline-none focus-visible:ui-focus-ring-inset`},toggleIcon:{base:`size-icon-md shrink-0`}}}}),K=new Set,q=e=>e instanceof CustomEvent&&e.detail&&typeof e.detail==`object`?e.detail:{},pe=(()=>{let e=!1;return()=>{if(e||typeof document>`u`)return;let t=e=>t=>{let n=q(t);!n.__panelsNotification&&n.panelId&&K.forEach(t=>{n.groupId&&n.groupId!==t.id||t.hasPanel(n.panelId)&&t.perform(n.action??e,n.panelId,n.trigger)})};document.addEventListener(`ui:panel-collapse`,t(`collapse`)),document.addEventListener(`ui:panel-expand`,t(`expand`)),document.addEventListener(`ui:panel-toggle`,t(`toggle`)),document.addEventListener(`ui:panel-size`,e=>{let t=q(e);!t.__panelsNotification&&t.panelId&&Number.isFinite(t.size)&&K.forEach(e=>{t.groupId&&t.groupId!==e.id||e.hasPanel(t.panelId)&&e.resize(t.panelId,t.size)})}),document.addEventListener(`ui:panels-reset`,e=>{let t=q(e);t.__panelsNotification||K.forEach(e=>{t.groupId&&t.groupId!==e.id||(!t.panelId||e.hasPanel(t.panelId))&&e.reset(t.panelId)})}),e=!0}})(),me=e=>`trellis-ui:panels:${e}:v1`,he=e=>typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&Number.isFinite(e[1]))),J=()=>{let o=null,l=null,u=null,d=`wide`,f,h=null,_=new Set,v=new Set,y=new Map,b=new Map,x=new Map,S=new Map,C=()=>{if(!o)throw Error(`Panels has not been initialized.`);return o},se=e=>e.closest(`[data-ui-panels]`)===C(),w=()=>Array.from(C().children).flatMap(e=>{if(!(e instanceof HTMLElement)||!e.hasAttribute(`data-ui-panel`))return[];let t=e.querySelector(`:scope > [data-ui-panel-expanded]`);return!t||!se(t)?[]:[{panel:e,expanded:t,collapsed:e.querySelector(`:scope > [data-ui-panel-collapsed]`),handle:e.querySelector(`:scope > [data-ui-panel-resize-handle]`),props:c({el:e,schema:le})}]}),T=e=>w().find(t=>t.props.id===e)??null,E=()=>Q.getCommittedSnapshot().context,D=()=>Q.getCommittedSnapshot().props,O=e=>E().layout.collapsedIds.includes(e),k=()=>D().orientation===`horizontal`&&d===`stacked`,A=()=>k()?`vertical`:D().orientation,j=()=>C().dataset.orientation===`vertical`?`vertical`:`horizontal`,M=e=>{let t=e.getBoundingClientRect();return j()===`horizontal`?t.width:t.height},N=()=>{let e=w(),t=e.map(({props:e})=>e.id);if(t.some(e=>!e))throw Error(`Every Panel requires a stable id.`);if(new Set(t).size!==t.length)throw Error(`Panel ids must be unique within a Panels group.`);if(e.length>0&&!e.some(({props:e})=>e.size===`fill`))throw Error(`A Panels group requires at least one size="fill" Panel.`);if(e.some(({props:e})=>e.size===`fill`&&e.resize!==`none`))throw Error(`A size="fill" Panel cannot own a resize handle.`);return e.map(({props:e})=>{let t=e.collapsible?{collapsible:!0,defaultCollapsed:e.defaultCollapsed}:{collapsible:!1,defaultCollapsed:!1};return e.size===`fill`?{id:e.id,kind:`fill`,...t}:{id:e.id,kind:`bounded`,resizable:e.resize!==`none`,...t}})},P=e=>{let t=document.createElement(`div`);t.style.cssText=`position:absolute;visibility:hidden;pointer-events:none;inset:0 auto auto 0;`,j()===`horizontal`?t.style.width=`var(${e})`:t.style.height=`var(${e})`,C().append(t);let n=M(t);return t.remove(),n},F=e=>e.props.size===`fill`?{minimum:0,maximum:1/0}:{minimum:P(`--spacing-panel-${e.props.size}-min`),maximum:P(`--spacing-panel-${e.props.size}-max`)},I=(e,t)=>{let{minimum:n,maximum:r}=F(e);return Math.min(r,Math.max(n,t))},L=()=>{let e=N();return{collection:e,layout:{collapsedIds:e.filter(e=>e.defaultCollapsed).map(({id:e})=>e),committedSizes:{}},change:{openingIds:[],closingIds:[]},resize:{activeId:``,initialSize:null,previewSize:null},sizing:{changes:[]}}},R=(e,t,n)=>{j()===`horizontal`?(e.style.minWidth=t,e.style.maxWidth=n,e.style.minHeight=``,e.style.maxHeight=``):(e.style.minHeight=t,e.style.maxHeight=n,e.style.minWidth=``,e.style.maxWidth=``)},z=e=>{e.style.flex=``,e.style.minWidth=``,e.style.maxWidth=``,e.style.minHeight=``,e.style.maxHeight=``},B=(e,t)=>{if(k()){z(e.panel);return}if(t!==void 0){e.panel.style.flex=`0 0 ${t}px`,R(e.panel,`0px`,`none`);return}if(O(e.props.id)){if(E().collection.find(({id:t})=>t===e.props.id)?.defaultCollapsed){z(e.panel);return}let t=e.collapsed?`var(--spacing-panel-collapsed)`:`0px`;e.panel.style.flex=`0 0 ${t}`,R(e.panel,t,t);return}if(e.props.size===`fill`){z(e.panel);return}let n=E().resize.activeId===e.props.id?E().resize.previewSize:E().layout.committedSizes[e.props.id];if(n==null){z(e.panel);return}let r=`${I(e,n)}px`;e.panel.style.flex=`0 1 ${r}`,R(e.panel,`var(--spacing-panel-${e.props.size}-min)`,`var(--spacing-panel-${e.props.size}-max)`)},V=(e,t)=>{e.toggleAttribute(`inert`,t),e.setAttribute(`aria-hidden`,t?`true`:`false`)},de=e=>{let t=D(),r=A(),i=O(e.props.id),a=Q.hasTag(`changing`)&&E().change.openingIds.includes(e.props.id),o=Q.hasTag(`changing`)&&E().change.closingIds.includes(e.props.id),s=!(i&&!o),c=i&&!o&&!a&&e.collapsed!==null;if(e.panel.dataset.state=i?`collapsed`:`expanded`,e.panel.dataset.orientation=r,e.panel.dataset.size=e.props.size,e.panel.dataset.resize=e.props.resize,e.panel.className=g({part:G.parts.panel,props:{orientation:r,divider:t.divider,resize:e.props.resize},className:e.props.class}),n({el:e.panel,attr:`data-collapsible`,present:e.props.collapsible}),n({el:e.panel,attr:`data-resizing`,present:E().resize.activeId===e.props.id}),B(e),e.expanded.hidden=!s,V(e.expanded,!s),e.collapsed&&(e.collapsed.hidden=!c,V(e.collapsed,!c)),e.handle){let t=k()||i||e.props.size===`fill`||e.props.resize===`none`;e.handle.dataset.orientation=r,e.handle.dataset.resizeEdge=e.props.resize,e.handle.setAttribute(`aria-label`,`Resize ${e.props.id} panel`),e.handle.toggleAttribute(`data-resize-disabled`,t),e.handle.hidden=k(),e.handle.className=g({part:G.parts.resizeHandle,props:{orientation:r,edge:e.props.resize},className:e.handle.dataset.class??``})}},H=e=>{e.forEach((t,r)=>{let i=e[r+1];s(t.panel,`data-divider`),n({el:t.panel,attr:`data-divider`,present:D().divider&&i!==void 0})})},U=e=>{let t=e.dataset.target||``;if(!t){let t=e.closest(`[data-ui-panel]`),n=t?.closest(`[data-ui-panels]`),r=[...K].find(e=>e.id===n?.id),i=t&&r===$?T(t.id):null;return i&&r?{record:i,controller:r}:null}let n=e.dataset.groupId||e.closest(`[data-ui-panels]`)?.id,r=[...K].filter(e=>!n||e.id===n).find(e=>e.hasPanel(t)),i=r===$?T(t):null;return i&&r?{record:i,controller:r}:null},W=()=>{document.querySelectorAll(`[data-ui-panel-toggle]`).forEach(e=>{let t=U(e);if(!t||t.controller!==$)return;let n=O(t.record.props.id);e.dataset.target=t.record.props.id,e.dataset.groupId=D().id,e.dataset.state=n?`collapsed`:`expanded`,e.setAttribute(`aria-controls`,t.record.panel.id),e.setAttribute(`aria-expanded`,n?`false`:`true`),e.toggleAttribute(`disabled`,!t.record.props.collapsible)})},q=()=>{let e=D(),t=A();C().dataset.responsiveMode=d,C().dataset.layoutOrientation=t,C().style.flexDirection=t===`horizontal`?`row`:`column`,C().className=g({part:G.parts.root,props:{...e,orientation:t},className:e.class}),n({el:C(),attr:`data-resizing`,present:Q.hasTag(`resizing`)}),n({el:C(),attr:`data-transitioning`,present:Q.hasTag(`transitioning`)});let r=w();r.forEach(de),H(r),W()},J=(e,t=!1,n=!0)=>{let r=document.activeElement;if(!t&&(!(r instanceof HTMLElement)||!e.collapsed?.contains(r)))return;let i=x.get(e.props.id);i?.isConnected&&e.expanded.contains(i)?p(i,{showIndicator:n}):(e.expanded.tabIndex=-1,p(e.expanded,{showIndicator:n}))},ge=(e,t=!1,n=!0)=>{let r=document.activeElement;if(!t&&(!(r instanceof HTMLElement)||!e.expanded.contains(r)))return;let i=e.collapsed?re(e.collapsed)[0]:void 0,a=S.get(e.props.id),o=a?.isConnected&&!e.panel.contains(a)?a:void 0;i?p(i,{showIndicator:n}):o?p(o,{showIndicator:n}):(C().tabIndex=-1,p(C(),{showIndicator:n}))},_e=()=>{let e=[...E().change.openingIds,...E().change.closingIds],t=new Map(E().change.openingIds.flatMap(e=>{let t=T(e),n=document.activeElement;return t!==null&&t.collapsed!==null&&n instanceof HTMLElement&&t.collapsed.contains(n)?[[e,n.matches(`:focus-visible`)]]:[]})),n=new Map(e.flatMap(e=>{let t=T(e);if(!t)return[];if(E().change.closingIds.includes(e)){let n=document.activeElement;n instanceof HTMLElement&&t.expanded.contains(n)&&x.set(e,n)}return[[e,M(t.panel)]]}));q(),E().change.openingIds.forEach(e=>{let n=T(e);n&&J(n,t.has(e),t.get(e)??!0)}),e.forEach(e=>{let t=T(e),r=n.get(e);if(!t||r===void 0)return;let i=M(t.panel);b.set(e,{from:r,to:i}),B(t,r)})},ve=()=>{let e=[...E().change.openingIds],t=[...E().change.closingIds],n=new Map(t.flatMap(e=>{let t=T(e),n=document.activeElement;return t!==null&&n instanceof HTMLElement&&t.expanded.contains(n)?[[e,n.matches(`:focus-visible`)]]:[]}));w().forEach(e=>B(e)),q(),t.forEach(e=>{let t=T(e);t&&ge(t,n.has(e),n.get(e)??!0)}),e.forEach(e=>Y(`ui:panel-expand`,e)),t.forEach(e=>Y(`ui:panel-collapse`,e)),[...e,...t].forEach(e=>b.delete(e))},Y=(e,n,r={})=>{t({el:C(),name:e,detail:{groupId:D().id,panelId:n,__panelsNotification:!0,...r}})},ye=()=>{let e=E().layout;if(D().persist)try{localStorage.setItem(me(D().id),JSON.stringify({collapsed:e.collapsedIds,sizes:e.committedSizes}))}catch{}t({el:C(),name:`ui:panels-layout-change`,detail:{groupId:D().id,collapsed:[...e.collapsedIds],sizes:{...e.committedSizes},__panelsNotification:!0}})},X=e=>{if(!o)return;if(Q.hasTag(`stable`)){e();return}let t=window.setTimeout(()=>{_.delete(t),X(e)},16);_.add(t)},Z=(e,t)=>{let n=e.find(e=>t(e)!==O(e));n&&(Q.send({type:t(n)?`COLLAPSE`:`EXPAND`,panelId:n}),X(()=>Z(e,t)))},be=()=>{if(!D().persist)return;let e;try{e=JSON.parse(localStorage.getItem(me(D().id))??`null`)}catch{return}if(typeof e!=`object`||!e)return;let t=N(),n=t.filter(e=>e.collapsible),r=new Set((Array.isArray(e.collapsed)?e.collapsed:[]).filter(e=>typeof e==`string`&&n.some(t=>t.id===e))),i=he(e.sizes),a=()=>{Z(n.map(({id:e})=>e),e=>r.has(e))},o=()=>{let e=t.filter(e=>e.kind===`bounded`).flatMap(({id:e})=>{let t=T(e),n=i[e];if(!t||n===void 0)return[];let r=M(t.panel),a=I(t,n);return Math.abs(r-a)<.5?[]:[{panelId:e,from:r,to:a}]});if(k()){e.length>0&&Q.send({type:`RESTORE_HIDDEN_SIZES`,changes:e}),a();return}let n=e.filter(({panelId:e})=>O(e)),r=e.filter(({panelId:e})=>!O(e));if(n.length>0&&Q.send({type:`RESTORE_HIDDEN_SIZES`,changes:n}),r.length>0){Q.send({type:`SIZE`,changes:r}),X(a);return}a()},s=n.map(({id:e})=>e).filter(e=>O(e)&&!r.has(e));s.length>0?(Z(s,()=>!1),X(o)):o()},xe=()=>{let e=requestAnimationFrame(()=>{v.delete(e);let t=requestAnimationFrame(()=>{v.delete(t),be()});v.add(t)});v.add(e)},Se=e=>{let t=N(),n=e?t.filter(({id:t})=>t===e):t;if(n.length===0)return;let r=()=>{Z(n.filter(e=>e.collapsible).map(({id:e})=>e),e=>t.find(t=>t.id===e)?.defaultCollapsed===!0)},i=n.filter(e=>e.kind===`bounded`).map(({id:e})=>e).filter(e=>Object.hasOwn(E().layout.committedSizes,e));if(k()){i.length>0?(Q.send({type:`RESET_HIDDEN_SIZES`,ids:i}),X(r)):r();return}let a=i.filter(O);a.length>0&&Q.send({type:`RESET_HIDDEN_SIZES`,ids:a});let o=i.filter(e=>!O(e)).flatMap(e=>{let t=T(e);return!t||t.props.size===`fill`?[]:[{panelId:e,from:M(t.panel),to:P(`--spacing-panel-${t.props.size}`),reset:!0}]});if(o.length>0){Q.send({type:`SIZE`,changes:o}),X(r);return}r()},Ce=()=>{E().sizing.changes.forEach(({panelId:e,from:t})=>{let n=T(e);n&&B(n,t)})},we=()=>{E().sizing.changes.forEach(({panelId:e,to:t})=>{let n=T(e);n&&(B(n),Y(`ui:panel-resize-end`,e,{size:t}))}),q()},Te=t=>{if(A()===`vertical`)return t===`start`?`negative`:`positive`;let n=e({el:C()});return t===`start`?n?`positive`:`negative`:n?`negative`:`positive`},Ee=()=>{let e=h;if(!e)return;let t=new Set(w().map(({panel:e})=>e));y.forEach((e,n)=>{t.has(n)||(e.run(),y.delete(n))}),w().forEach(t=>{if(y.has(t.panel)||!t.handle||t.props.size===`fill`||t.props.resize===`none`)return;let n=F(t),r=P(`--spacing-panel-resize-handle`),i=P(`--spacing-panel-resize-handle-coarse`),a=new m;e.addChild(a),a.add(ae({element:t.panel,handle:t.handle,axis:A()===`horizontal`?`x`:`y`,direction:Te(t.props.resize),min:n.minimum,max:n.maximum,mode:`onChange`,hitArea:r,coarseHitArea:i,disabled:()=>k()||O(t.props.id),onStart:e=>Q.send({type:`RESIZE_START`,panelId:t.props.id,size:Oe(e)}),onResize:e=>Q.send({type:`RESIZE`,panelId:t.props.id,size:Oe(e)}),onEnd:e=>Q.send({type:`RESIZE_END`,panelId:t.props.id,size:Oe(e)})})),y.set(t.panel,a)})},De=()=>{h?.run(),y.clear(),h=new m,f.addChild(h),Ee()},Oe=e=>A()===`horizontal`?e.previewWidth:e.previewHeight,ke=e=>{let t=D().orientation===`horizontal`&&e<oe(C(),`sm`)?`stacked`:`wide`;t!==d&&(d=t,q(),De())},Q=ee({schema:ce,hooks:ue,resolveTransitionElement:({data:e})=>{let t=e?.panelId;return t?T(t)?.panel??null:C()},createMachine:({props:e})=>fe({props:e,context:L(),effects:{prepareChange:_e,finishChange:ve,sync:()=>{q(),De()},beginResize:()=>{q()},previewResize:()=>{let e=E().resize.activeId,t=T(e);t&&B(t);let n=E().resize.previewSize;n!==null&&Y(`ui:panel-resize`,e,{size:n})},commitResize:e=>{q();let t=typeof e.event.panelId==`string`?e.event.panelId:``,n=E().layout.committedSizes[t];t&&n!==void 0&&Y(`ui:panel-resize-end`,t,{size:n})},cancelResize:q,prepareSizing:Ce,finishSizing:we,persist:ye}})}),Ae=()=>{let e=N();Q.send({type:`PANELS_CHANGED`,collection:e}),Ee()},je=()=>{l=ie({targets:C(),read:N,onChange:Ae,observer:{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`id`,`data-size`,`data-resize`,`data-collapsible`,`data-default-collapsed`]}})},$;return $={...Q,get id(){return C().id||D().id},get orientation(){return A()},get collapsed(){return[...E().layout.collapsedIds]},get sizes(){return{...E().layout.committedSizes}},get root(){let e=this.snapshot.current?.props??D();return ne({inputs:[g({part:G.parts.root,props:e,className:e.class}),{"data-ui-panels":``}]})},init(){f=te(this),h=new m,f.addChild(h),o=this.$el,Q.connect(this.$el,this.snapshot),C().id||=D().id,d=D().orientation===`horizontal`&&C().getBoundingClientRect().width<oe(C(),`sm`)?`stacked`:`wide`,K.add($),pe(),q(),Ee(),u=new ResizeObserver(e=>{ke(e[0]?.contentRect.width??C().clientWidth)}),u.observe(C()),je(),D().persist&&xe(),r({target:C(),event:`keydown`,handler:()=>W(),cleanup:f})},destroy(){K.delete($),l?.(),l=null,u?.disconnect(),u=null,y.clear(),h=null,_.forEach(e=>window.clearTimeout(e)),_.clear(),v.forEach(e=>cancelAnimationFrame(e)),v.clear(),Q.disconnect(),o=null},transitionPanel(e){let t=e.data.panelId,n=T(t),r=b.get(t);return!n||!r||r.from===r.to?(n&&B(n,r?.to),i()):a(e,{target:n.panel,keyframes:{flexBasis:[`${r.from}px`,`${r.to}px`]},role:`layout`,cleanup:()=>B(n)})},transitionPanelSize(e){let{panelId:t,from:n,to:r}=e.data,o=T(t);return!o||n===r?(o&&B(o),i()):a(e,{target:o.panel,keyframes:{flexBasis:[`${n}px`,`${r}px`]},role:`layoutQuick`,cleanup:()=>B(o)})},hasPanel(e){return T(e)!==null},isCollapsed:O,collapse(e){Q.send({type:`COLLAPSE`,panelId:e})},expand(e){Q.send({type:`EXPAND`,panelId:e})},toggle(e){Q.send({type:`TOGGLE`,panelId:e})},resize(e,t){let n=T(e);if(k()||!n||n.props.size===`fill`||O(e)||!Number.isFinite(t))return;let r=M(n.panel),i=I(n,t);Math.abs(r-i)<.5||Q.send({type:`SIZE`,panelId:e,from:r,to:i})},reset(e){Se(e)},perform(e,t,n){n&&S.set(t,n),{collapse:this.collapse,expand:this.expand,toggle:this.toggle}[e](t)},syncToggles:W},$},ge=()=>{let e={};return{get props(){return e},init(){e=c({el:this.$el,schema:w})},destroy(){},get root(){return ne({inputs:[g({part:G.parts.toggle,props:{},className:e.class}),{"data-ui-panel-toggle":``,":data-target":()=>e.target||void 0,":data-action":()=>e.action,"@click":e=>this.trigger(e)}]})},trigger(t){t?.preventDefault();let n=this.$el,r=n.closest(`[data-ui-panel]`),i=r?.closest(`[data-ui-panels]`),a=e.target||r?.id||``;a&&document.dispatchEvent(new CustomEvent(`ui:panel-toggle`,{detail:{panelId:a,groupId:i?.id,action:e.action,trigger:n}}))}}},_e=e=>{h(`UiPanels`,J)(e),h(`UiPanelToggle`,ge)(e)},ve=new WeakSet,Y=e=>{ve.has(e)||(ve.add(e),o(e),y(e),_e(e))};export{ge as n,J as r,Y as t};
2
- //# sourceMappingURL=entry.generated-D_jeOgRf.js.map
1
+ import{i as e,r as t,s as n,t as r}from"./dom-DiTFTWeR.js";import{f as i,s as a}from"./motion-B90yNOaV.js";import{t as o}from"./capability-motion-D_BJBnwB.js";import{n as s}from"./morph-Cq3V_23_.js";import{a as c,f as l,l as u,n as d}from"./codecs-CQ7olTJL.js";import{i as f,t as ee}from"./alpine-machine-CE2UN4Qu.js";import{t as p}from"./focus-pk_lz9sg.js";import{t as m}from"./cleanup-manager-D9QiZF_Q.js";import{n as h,t as te}from"./alpine-data-Dvc_bXq6.js";import{n as g,t as _}from"./styles-CX2j92ex.js";import{t as ne}from"./merge-bindings-BtqW3UgP.js";import{t as v}from"./machine-CNnHDbyo.js";import{r as re}from"./focus-scope-BrYxsrhc.js";import{t as ie}from"./semantic-observer-CIoriWtV.js";import{n as ae,t as y}from"./capability-resizable-ByUbMIHF.js";var oe=(e,t)=>{let n=getComputedStyle(e).getPropertyValue(`--breakpoint-${t}`),r=Number.parseFloat(n);return Number.isFinite(r)?r:1/0},b=[`horizontal`,`vertical`],x=[`div`,`section`,`aside`,`main`,`nav`],S=[`1`,`2`,`3`,`4`,`5`,`6`,`fill`],C=[`none`,`start`,`end`],se=[`toggle`,`expand`,`collapse`],ce={id:l.default(`ui-panels`),orientation:u(b,`horizontal`),persist:d,divider:d.default(!0),class:l},le={id:l,as:u(x,`section`),size:u(S,`fill`),resize:u(C,`none`),collapsible:d,defaultCollapsed:d,class:l},w={target:l,action:u(se,`toggle`),icon:l.default(`menu`),label:l.default(`Expand`),class:l},ue=[f({name:`opening`,state:`changing`,projectEach:e=>e.context.change.openingIds.map(e=>({panelId:e})),onDone:`CHANGE_DONE`,onError:`CHANGE_ERROR`,sends:{expand:e=>({type:`EXPAND`,panelId:e}),collapse:e=>({type:`COLLAPSE`,panelId:e}),toggle:e=>({type:`TOGGLE`,panelId:e})}}),f({name:`closing`,state:`changing`,projectEach:e=>e.context.change.closingIds.map(e=>({panelId:e})),onDone:`CHANGE_DONE`,onError:`CHANGE_ERROR`,sends:{expand:e=>({type:`EXPAND`,panelId:e}),collapse:e=>({type:`COLLAPSE`,panelId:e}),toggle:e=>({type:`TOGGLE`,panelId:e})}}),f({name:`sizing`,state:`sizing`,projectEach:e=>e.context.sizing.changes,onDone:`SIZE_DONE`,onError:`SIZE_ERROR`}),f({name:`persisting`,state:`persisting`,project:e=>({groupId:e.props.id,collapsed:[...e.context.layout.collapsedIds],sizes:{...e.context.layout.committedSizes}}),onDone:`PERSIST_DONE`,onError:`PERSIST_ERROR`})],T=e=>Array.isArray(e)?e.filter(e=>typeof e==`string`):[],E=e=>typeof e.panelId==`string`?e.panelId:``,D=e=>typeof e==`number`&&Number.isFinite(e)?e:null,O=e=>(Array.isArray(e.changes)?e.changes:[e]).flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e,n=typeof t.panelId==`string`?t.panelId:``,r=D(t.from),i=D(t.to),a=t.reset===!0;return n&&r!==null&&i!==null&&(r!==i||a)?[{panelId:n,from:r,to:i,...a?{reset:!0}:{}}]:[]}),k=(e,t)=>typeof e.props==`object`&&e.props!==null?e.props:t,A=(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),j=e=>{if(!Array.isArray(e))return[];let t=[];return e.forEach(e=>{if(typeof e!=`object`||!e)return;let n=e;if(typeof n.id!=`string`||!n.id)return;let r=n.collapsible===!0?{collapsible:!0,defaultCollapsed:n.defaultCollapsed===!0}:{collapsible:!1,defaultCollapsed:!1};n.kind===`fill`&&t.push({id:n.id,kind:`fill`,...r}),n.kind===`bounded`&&t.push({id:n.id,kind:`bounded`,resizable:n.resizable===!0,...r})}),t},M=e=>new Map(e.map(e=>[e.id,e])),N=(e,t)=>Object.fromEntries(e.flatMap(e=>e.kind===`bounded`&&Object.hasOwn(t,e.id)?[[e.id,t[e.id]]]:[])),P=e=>{let t=E(e.event),n=e.context.layout.collapsedIds,r=e.context.collection,i=M(r).get(t);switch(e.event.type){case`COLLAPSE`:return i?.collapsible&&!n.includes(t)?r.map(e=>e.id).filter(e=>n.includes(e)||e===t):n;case`EXPAND`:return n.filter(e=>e!==t);case`TOGGLE`:return i?.collapsible?n.includes(t)?n.filter(e=>e!==t):r.map(e=>e.id).filter(e=>n.includes(e)||e===t):n;default:return n}},F=e=>{let t=E(e.event);return M(e.context.collection).has(t)&&!A(e.context.layout.collapsedIds,P(e))},I=e=>{let t=E(e.event),n=M(e.context.collection).get(t);return n?.kind===`bounded`&&n.resizable&&!e.context.layout.collapsedIds.includes(t)&&D(e.event.size)!==null},L=e=>{let t=O(e.event),n=M(e.context.collection);return t.length>0&&t.every(({panelId:t})=>n.get(t)?.kind===`bounded`&&!e.context.layout.collapsedIds.includes(t))},R=e=>{let t=O(e.event),n=M(e.context.collection);return t.length>0&&t.every(({panelId:t})=>n.get(t)?.kind===`bounded`&&e.context.layout.collapsedIds.includes(t))},z=e=>{let t=T(e.event.ids),n=M(e.context.collection);return t.length>0&&t.every(t=>n.get(t)?.kind===`bounded`&&e.context.layout.collapsedIds.includes(t)&&Object.hasOwn(e.context.layout.committedSizes,t))},B=e=>{let t=O(e.event),n={...e.context.layout.committedSizes};return t.forEach(({panelId:e,to:t,reset:r})=>{r?delete n[e]:n[e]=t}),{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,n)},sizing:{changes:t}}}},V=e=>{let t=O(e.event),n={...e.context.layout.committedSizes,...Object.fromEntries(t.map(({panelId:e,to:t})=>[e,t]))};return{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,n)}}}},de=e=>{let t={...e.context.layout.committedSizes};return T(e.event.ids).forEach(e=>delete t[e]),{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,t)}}}},H=e=>{let t=P(e),n=e.context.layout.collapsedIds;return{context:{...e.context,layout:{...e.context.layout,collapsedIds:t},change:{openingIds:n.filter(e=>!t.includes(e)),closingIds:t.filter(e=>!n.includes(e))}}}},U=e=>{let t=j(e.event.collection),n=M(e.context.collection),r=t.filter(t=>(e.context.layout.collapsedIds.includes(t.id)||!n.has(t.id)&&t.defaultCollapsed)&&t.collapsible).map(e=>e.id),i=N(t,e.context.layout.committedSizes),a=M(t).get(e.context.resize.activeId),o=a?.kind===`bounded`&&a.resizable;return{context:{...e.context,collection:t,layout:{collapsedIds:r,committedSizes:i},resize:o?e.context.resize:{activeId:``,initialSize:null,previewSize:null}}}},W=e=>{let t=M(j(e.event.collection)).get(e.context.resize.activeId);return t?.kind!==`bounded`||!t.resizable},fe=({props:e,context:t,effects:n})=>v({initial:`stable`,on:{DOM_INVALIDATED:{effects:`sync`}},states:{stable:{tags:[`stable`],on:{COLLAPSE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},EXPAND:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},TOGGLE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},SIZE:{target:`sizing`,guard:L,reduce:B,effects:`prepareSizing`},RESTORE_HIDDEN_SIZES:{guard:R,reduce:V},RESET_HIDDEN_SIZES:{target:`persisting`,guard:z,reduce:de,effects:[`sync`,`persist`]},RESIZE_START:{target:`resizing`,guard:I,reduce:`startResize`,effects:`beginResize`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},changing:{tags:[`changing`,`transitioning`],on:{CHANGE_DONE:{target:`persisting`,effects:[`finishChange`,`persist`]},CHANGE_ERROR:{target:`persisting`,effects:[`finishChange`,`persist`]},COLLAPSE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},EXPAND:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},TOGGLE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},sizing:{tags:[`sizing`,`transitioning`],on:{SIZE_DONE:{target:`persisting`,effects:[`finishSizing`,`persist`]},SIZE_ERROR:{target:`persisting`,effects:[`finishSizing`,`persist`]},SIZE:{target:`sizing`,guard:L,reduce:B,effects:`prepareSizing`},RESIZE_START:{target:`resizing`,guard:I,reduce:`startResize`,effects:`beginResize`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},resizing:{tags:[`resizing`],on:{RESIZE:{guard:`activeResize`,reduce:`previewResize`,effects:`previewResize`},RESIZE_END:{target:`persisting`,guard:`activeResize`,reduce:`commitResize`,effects:[`commitResize`,`persist`]},RESIZE_CANCEL:{target:`stable`,reduce:`clearResize`,effects:`cancelResize`},PANELS_CHANGED:[{target:`stable`,guard:W,reduce:U,effects:[`cancelResize`,`sync`]},{reduce:U,effects:`sync`}],PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}},persisting:{tags:[`persisting`],on:{PERSIST_DONE:`stable`,PERSIST_ERROR:`stable`,COLLAPSE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},EXPAND:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},TOGGLE:{target:`changing`,guard:F,reduce:H,effects:`prepareChange`},SIZE:{target:`sizing`,guard:L,reduce:B,effects:`prepareSizing`},PANELS_CHANGED:{reduce:U,effects:`sync`},PROPS_CHANGED:{reduce:`replaceProps`,effects:`sync`}}}}},{props:e,context:t,reducers:{replaceProps:e=>({props:k(e.event,e.props)}),startResize:e=>{let t=D(e.event.size);return{context:{...e.context,resize:{activeId:E(e.event),initialSize:t,previewSize:t}}}},previewResize:e=>({context:{...e.context,resize:{...e.context.resize,previewSize:D(e.event.size)}}}),commitResize:e=>{let t=E(e.event),n=D(e.event.size);if(n!==null)return{context:{...e.context,layout:{...e.context.layout,committedSizes:N(e.context.collection,{...e.context.layout.committedSizes,[t]:n})},resize:{activeId:``,initialSize:null,previewSize:null}}}},clearResize:e=>({context:{...e.context,resize:{activeId:``,initialSize:null,previewSize:null}}})},guards:{activeResize:e=>E(e.event)===e.context.resize.activeId&&D(e.event.size)!==null},effects:{prepareChange:n.prepareChange,finishChange:n.finishChange,sync:n.sync,beginResize:n.beginResize,previewResize:n.previewResize,commitResize:n.commitResize,cancelResize:n.cancelResize,prepareSizing:n.prepareSizing,finishSizing:n.finishSizing,persist:n.persist}}),G=_({definition:{component:`ui.panels`,parts:{root:{base:`relative flex h-full min-h-0 w-full min-w-0`,variants:{orientation:{horizontal:`flex-row`,vertical:`flex-col`}},defaults:{orientation:`horizontal`}},panel:{base:`relative min-w-0 overflow-hidden border-separator`,variants:{orientation:{horizontal:`h-full`,vertical:`w-full`},divider:{true:``,false:``},resize:{none:``,start:``,end:``}},defaults:{orientation:`horizontal`,divider:!0,resize:`none`}},expanded:{base:`h-full min-h-0 w-full min-w-0`},collapsed:{base:`flex h-full min-h-0 w-full min-w-0 items-center justify-center overflow-hidden`},resizeHandle:{base:[`absolute z-20 touch-none outline-none`],variants:{orientation:{horizontal:`inset-y-0 w-panel-resize-handle cursor-col-resize`,vertical:`inset-x-0 h-panel-resize-handle cursor-row-resize`},edge:{start:``,end:``}},defaults:{orientation:`horizontal`,edge:`end`}},toggle:{base:`inline-flex size-control-md items-center justify-center outline-none focus-visible:ui-focus-ring-inset`},toggleIcon:{base:`size-icon-md shrink-0`}}}}),K=new Set,q=e=>e instanceof CustomEvent&&e.detail&&typeof e.detail==`object`?e.detail:{},pe=(()=>{let e=!1;return()=>{if(e||typeof document>`u`)return;let t=e=>t=>{let n=q(t);!n.__panelsNotification&&n.panelId&&K.forEach(t=>{n.groupId&&n.groupId!==t.id||t.hasPanel(n.panelId)&&t.perform(n.action??e,n.panelId,n.trigger)})};document.addEventListener(`ui:panel-collapse`,t(`collapse`)),document.addEventListener(`ui:panel-expand`,t(`expand`)),document.addEventListener(`ui:panel-toggle`,t(`toggle`)),document.addEventListener(`ui:panel-size`,e=>{let t=q(e);!t.__panelsNotification&&t.panelId&&Number.isFinite(t.size)&&K.forEach(e=>{t.groupId&&t.groupId!==e.id||e.hasPanel(t.panelId)&&e.resize(t.panelId,t.size)})}),document.addEventListener(`ui:panels-reset`,e=>{let t=q(e);t.__panelsNotification||K.forEach(e=>{t.groupId&&t.groupId!==e.id||(!t.panelId||e.hasPanel(t.panelId))&&e.reset(t.panelId)})}),e=!0}})(),me=e=>`trellis-ui:panels:${e}:v1`,he=e=>typeof e!=`object`||!e||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(e=>typeof e[1]==`number`&&Number.isFinite(e[1]))),J=()=>{let o=null,l=null,u=null,d=`wide`,f,h=null,_=new Set,v=new Set,y=new Map,b=new Map,x=new Map,S=new Map,C=()=>{if(!o)throw Error(`Panels has not been initialized.`);return o},se=e=>e.closest(`[data-ui-panels]`)===C(),w=()=>Array.from(C().children).flatMap(e=>{if(!(e instanceof HTMLElement)||!e.hasAttribute(`data-ui-panel`))return[];let t=e.querySelector(`:scope > [data-ui-panel-expanded]`);return!t||!se(t)?[]:[{panel:e,expanded:t,collapsed:e.querySelector(`:scope > [data-ui-panel-collapsed]`),handle:e.querySelector(`:scope > [data-ui-panel-resize-handle]`),props:c({el:e,schema:le})}]}),T=e=>w().find(t=>t.props.id===e)??null,E=()=>Q.getCommittedSnapshot().context,D=()=>Q.getCommittedSnapshot().props,O=e=>E().layout.collapsedIds.includes(e),k=()=>D().orientation===`horizontal`&&d===`stacked`,A=()=>k()?`vertical`:D().orientation,j=()=>C().dataset.orientation===`vertical`?`vertical`:`horizontal`,M=e=>{let t=e.getBoundingClientRect();return j()===`horizontal`?t.width:t.height},N=()=>{let e=w(),t=e.map(({props:e})=>e.id);if(t.some(e=>!e))throw Error(`Every Panel requires a stable id.`);if(new Set(t).size!==t.length)throw Error(`Panel ids must be unique within a Panels group.`);if(e.length>0&&!e.some(({props:e})=>e.size===`fill`))throw Error(`A Panels group requires at least one size="fill" Panel.`);if(e.some(({props:e})=>e.size===`fill`&&e.resize!==`none`))throw Error(`A size="fill" Panel cannot own a resize handle.`);return e.map(({props:e})=>{let t=e.collapsible?{collapsible:!0,defaultCollapsed:e.defaultCollapsed}:{collapsible:!1,defaultCollapsed:!1};return e.size===`fill`?{id:e.id,kind:`fill`,...t}:{id:e.id,kind:`bounded`,resizable:e.resize!==`none`,...t}})},P=e=>{let t=document.createElement(`div`);t.style.cssText=`position:absolute;visibility:hidden;pointer-events:none;inset:0 auto auto 0;`,j()===`horizontal`?t.style.width=`var(${e})`:t.style.height=`var(${e})`,C().append(t);let n=M(t);return t.remove(),n},F=e=>e.props.size===`fill`?{minimum:0,maximum:1/0}:{minimum:P(`--spacing-panel-${e.props.size}-min`),maximum:P(`--spacing-panel-${e.props.size}-max`)},I=(e,t)=>{let{minimum:n,maximum:r}=F(e);return Math.min(r,Math.max(n,t))},L=()=>{let e=N();return{collection:e,layout:{collapsedIds:e.filter(e=>e.defaultCollapsed).map(({id:e})=>e),committedSizes:{}},change:{openingIds:[],closingIds:[]},resize:{activeId:``,initialSize:null,previewSize:null},sizing:{changes:[]}}},R=(e,t,n)=>{j()===`horizontal`?(e.style.minWidth=t,e.style.maxWidth=n,e.style.minHeight=``,e.style.maxHeight=``):(e.style.minHeight=t,e.style.maxHeight=n,e.style.minWidth=``,e.style.maxWidth=``)},z=e=>{e.style.flex=``,e.style.minWidth=``,e.style.maxWidth=``,e.style.minHeight=``,e.style.maxHeight=``},B=(e,t)=>{if(k()){z(e.panel);return}if(t!==void 0){e.panel.style.flex=`0 0 ${t}px`,R(e.panel,`0px`,`none`);return}if(O(e.props.id)){if(E().collection.find(({id:t})=>t===e.props.id)?.defaultCollapsed){z(e.panel);return}let t=e.collapsed?`var(--spacing-panel-collapsed)`:`0px`;e.panel.style.flex=`0 0 ${t}`,R(e.panel,t,t);return}if(e.props.size===`fill`){z(e.panel);return}let n=E().resize.activeId===e.props.id?E().resize.previewSize:E().layout.committedSizes[e.props.id];if(n==null){z(e.panel);return}let r=`${I(e,n)}px`;e.panel.style.flex=`0 1 ${r}`,R(e.panel,`var(--spacing-panel-${e.props.size}-min)`,`var(--spacing-panel-${e.props.size}-max)`)},V=(e,t)=>{e.toggleAttribute(`inert`,t),e.setAttribute(`aria-hidden`,t?`true`:`false`)},de=e=>{let t=D(),r=A(),i=O(e.props.id),a=Q.hasTag(`changing`)&&E().change.openingIds.includes(e.props.id),o=Q.hasTag(`changing`)&&E().change.closingIds.includes(e.props.id),s=!(i&&!o),c=i&&!o&&!a&&e.collapsed!==null;if(e.panel.dataset.state=i?`collapsed`:`expanded`,e.panel.dataset.orientation=r,e.panel.dataset.size=e.props.size,e.panel.dataset.resize=e.props.resize,e.panel.className=g({part:G.parts.panel,props:{orientation:r,divider:t.divider,resize:e.props.resize},className:e.props.class}),n({el:e.panel,attr:`data-collapsible`,present:e.props.collapsible}),n({el:e.panel,attr:`data-resizing`,present:E().resize.activeId===e.props.id}),B(e),e.expanded.hidden=!s,V(e.expanded,!s),e.collapsed&&(e.collapsed.hidden=!c,V(e.collapsed,!c)),e.handle){let t=k()||i||e.props.size===`fill`||e.props.resize===`none`;e.handle.dataset.orientation=r,e.handle.dataset.resizeEdge=e.props.resize,e.handle.setAttribute(`aria-label`,`Resize ${e.props.id} panel`),e.handle.toggleAttribute(`data-resize-disabled`,t),e.handle.hidden=k(),e.handle.className=g({part:G.parts.resizeHandle,props:{orientation:r,edge:e.props.resize},className:e.handle.dataset.class??``})}},H=e=>{e.forEach((t,r)=>{let i=e[r+1];s(t.panel,`data-divider`),n({el:t.panel,attr:`data-divider`,present:D().divider&&i!==void 0})})},U=e=>{let t=e.dataset.target||``;if(!t){let t=e.closest(`[data-ui-panel]`),n=t?.closest(`[data-ui-panels]`),r=[...K].find(e=>e.id===n?.id),i=t&&r===$?T(t.id):null;return i&&r?{record:i,controller:r}:null}let n=e.dataset.groupId||e.closest(`[data-ui-panels]`)?.id,r=[...K].filter(e=>!n||e.id===n).find(e=>e.hasPanel(t)),i=r===$?T(t):null;return i&&r?{record:i,controller:r}:null},W=()=>{document.querySelectorAll(`[data-ui-panel-toggle]`).forEach(e=>{let t=U(e);if(!t||t.controller!==$)return;let n=O(t.record.props.id);e.dataset.target=t.record.props.id,e.dataset.groupId=D().id,e.dataset.state=n?`collapsed`:`expanded`,e.setAttribute(`aria-controls`,t.record.panel.id),e.setAttribute(`aria-expanded`,n?`false`:`true`),e.toggleAttribute(`disabled`,!t.record.props.collapsible)})},q=()=>{let e=D(),t=A();C().dataset.responsiveMode=d,C().dataset.layoutOrientation=t,C().style.flexDirection=t===`horizontal`?`row`:`column`,C().className=g({part:G.parts.root,props:{...e,orientation:t},className:e.class}),n({el:C(),attr:`data-resizing`,present:Q.hasTag(`resizing`)}),n({el:C(),attr:`data-transitioning`,present:Q.hasTag(`transitioning`)});let r=w();r.forEach(de),H(r),W()},J=(e,t=!1,n=!0)=>{let r=document.activeElement;if(!t&&(!(r instanceof HTMLElement)||!e.collapsed?.contains(r)))return;let i=x.get(e.props.id);i?.isConnected&&e.expanded.contains(i)?p(i,{showIndicator:n}):(e.expanded.tabIndex=-1,p(e.expanded,{showIndicator:n}))},ge=(e,t=!1,n=!0)=>{let r=document.activeElement;if(!t&&(!(r instanceof HTMLElement)||!e.expanded.contains(r)))return;let i=e.collapsed?re(e.collapsed)[0]:void 0,a=S.get(e.props.id),o=a?.isConnected&&!e.panel.contains(a)?a:void 0;i?p(i,{showIndicator:n}):o?p(o,{showIndicator:n}):(C().tabIndex=-1,p(C(),{showIndicator:n}))},_e=()=>{let e=[...E().change.openingIds,...E().change.closingIds],t=new Map(E().change.openingIds.flatMap(e=>{let t=T(e),n=document.activeElement;return t!==null&&t.collapsed!==null&&n instanceof HTMLElement&&t.collapsed.contains(n)?[[e,n.matches(`:focus-visible`)]]:[]})),n=new Map(e.flatMap(e=>{let t=T(e);if(!t)return[];if(E().change.closingIds.includes(e)){let n=document.activeElement;n instanceof HTMLElement&&t.expanded.contains(n)&&x.set(e,n)}return[[e,M(t.panel)]]}));q(),E().change.openingIds.forEach(e=>{let n=T(e);n&&J(n,t.has(e),t.get(e)??!0)}),e.forEach(e=>{let t=T(e),r=n.get(e);if(!t||r===void 0)return;let i=M(t.panel);b.set(e,{from:r,to:i}),B(t,r)})},ve=()=>{let e=[...E().change.openingIds],t=[...E().change.closingIds],n=new Map(t.flatMap(e=>{let t=T(e),n=document.activeElement;return t!==null&&n instanceof HTMLElement&&t.expanded.contains(n)?[[e,n.matches(`:focus-visible`)]]:[]}));w().forEach(e=>B(e)),q(),t.forEach(e=>{let t=T(e);t&&ge(t,n.has(e),n.get(e)??!0)}),e.forEach(e=>Y(`ui:panel-expand`,e)),t.forEach(e=>Y(`ui:panel-collapse`,e)),[...e,...t].forEach(e=>b.delete(e))},Y=(e,n,r={})=>{t({el:C(),name:e,detail:{groupId:D().id,panelId:n,__panelsNotification:!0,...r}})},ye=()=>{let e=E().layout;if(D().persist)try{localStorage.setItem(me(D().id),JSON.stringify({collapsed:e.collapsedIds,sizes:e.committedSizes}))}catch{}t({el:C(),name:`ui:panels-layout-change`,detail:{groupId:D().id,collapsed:[...e.collapsedIds],sizes:{...e.committedSizes},__panelsNotification:!0}})},X=e=>{if(!o)return;if(Q.hasTag(`stable`)){e();return}let t=window.setTimeout(()=>{_.delete(t),X(e)},16);_.add(t)},Z=(e,t)=>{let n=e.find(e=>t(e)!==O(e));n&&(Q.send({type:t(n)?`COLLAPSE`:`EXPAND`,panelId:n}),X(()=>Z(e,t)))},be=()=>{if(!D().persist)return;let e;try{e=JSON.parse(localStorage.getItem(me(D().id))??`null`)}catch{return}if(typeof e!=`object`||!e)return;let t=N(),n=t.filter(e=>e.collapsible),r=new Set((Array.isArray(e.collapsed)?e.collapsed:[]).filter(e=>typeof e==`string`&&n.some(t=>t.id===e))),i=he(e.sizes),a=()=>{Z(n.map(({id:e})=>e),e=>r.has(e))},o=()=>{let e=t.filter(e=>e.kind===`bounded`).flatMap(({id:e})=>{let t=T(e),n=i[e];if(!t||n===void 0)return[];let r=M(t.panel),a=I(t,n);return Math.abs(r-a)<.5?[]:[{panelId:e,from:r,to:a}]});if(k()){e.length>0&&Q.send({type:`RESTORE_HIDDEN_SIZES`,changes:e}),a();return}let n=e.filter(({panelId:e})=>O(e)),r=e.filter(({panelId:e})=>!O(e));if(n.length>0&&Q.send({type:`RESTORE_HIDDEN_SIZES`,changes:n}),r.length>0){Q.send({type:`SIZE`,changes:r}),X(a);return}a()},s=n.map(({id:e})=>e).filter(e=>O(e)&&!r.has(e));s.length>0?(Z(s,()=>!1),X(o)):o()},xe=()=>{let e=requestAnimationFrame(()=>{v.delete(e);let t=requestAnimationFrame(()=>{v.delete(t),be()});v.add(t)});v.add(e)},Se=e=>{let t=N(),n=e?t.filter(({id:t})=>t===e):t;if(n.length===0)return;let r=()=>{Z(n.filter(e=>e.collapsible).map(({id:e})=>e),e=>t.find(t=>t.id===e)?.defaultCollapsed===!0)},i=n.filter(e=>e.kind===`bounded`).map(({id:e})=>e).filter(e=>Object.hasOwn(E().layout.committedSizes,e));if(k()){i.length>0?(Q.send({type:`RESET_HIDDEN_SIZES`,ids:i}),X(r)):r();return}let a=i.filter(O);a.length>0&&Q.send({type:`RESET_HIDDEN_SIZES`,ids:a});let o=i.filter(e=>!O(e)).flatMap(e=>{let t=T(e);return!t||t.props.size===`fill`?[]:[{panelId:e,from:M(t.panel),to:P(`--spacing-panel-${t.props.size}`),reset:!0}]});if(o.length>0){Q.send({type:`SIZE`,changes:o}),X(r);return}r()},Ce=()=>{E().sizing.changes.forEach(({panelId:e,from:t})=>{let n=T(e);n&&B(n,t)})},we=()=>{E().sizing.changes.forEach(({panelId:e,to:t})=>{let n=T(e);n&&(B(n),Y(`ui:panel-resize-end`,e,{size:t}))}),q()},Te=t=>{if(A()===`vertical`)return t===`start`?`negative`:`positive`;let n=e({el:C()});return t===`start`?n?`positive`:`negative`:n?`negative`:`positive`},Ee=()=>{let e=h;if(!e)return;let t=new Set(w().map(({panel:e})=>e));y.forEach((e,n)=>{t.has(n)||(e.run(),y.delete(n))}),w().forEach(t=>{if(y.has(t.panel)||!t.handle||t.props.size===`fill`||t.props.resize===`none`)return;let n=F(t),r=P(`--spacing-panel-resize-handle`),i=P(`--spacing-panel-resize-handle-coarse`),a=new m;e.addChild(a),a.add(ae({element:t.panel,handle:t.handle,axis:A()===`horizontal`?`x`:`y`,direction:Te(t.props.resize),min:n.minimum,max:n.maximum,mode:`onChange`,hitArea:r,coarseHitArea:i,disabled:()=>k()||O(t.props.id),onStart:e=>Q.send({type:`RESIZE_START`,panelId:t.props.id,size:Oe(e)}),onResize:e=>Q.send({type:`RESIZE`,panelId:t.props.id,size:Oe(e)}),onEnd:e=>Q.send({type:`RESIZE_END`,panelId:t.props.id,size:Oe(e)})})),y.set(t.panel,a)})},De=()=>{h?.run(),y.clear(),h=new m,f.addChild(h),Ee()},Oe=e=>A()===`horizontal`?e.previewWidth:e.previewHeight,ke=e=>{let t=D().orientation===`horizontal`&&e<oe(C(),`sm`)?`stacked`:`wide`;t!==d&&(d=t,q(),De())},Q=ee({schema:ce,hooks:ue,resolveTransitionElement:({data:e})=>{let t=e?.panelId;return t?T(t)?.panel??null:C()},createMachine:({props:e})=>fe({props:e,context:L(),effects:{prepareChange:_e,finishChange:ve,sync:()=>{q(),De()},beginResize:()=>{q()},previewResize:()=>{let e=E().resize.activeId,t=T(e);t&&B(t);let n=E().resize.previewSize;n!==null&&Y(`ui:panel-resize`,e,{size:n})},commitResize:e=>{q();let t=typeof e.event.panelId==`string`?e.event.panelId:``,n=E().layout.committedSizes[t];t&&n!==void 0&&Y(`ui:panel-resize-end`,t,{size:n})},cancelResize:q,prepareSizing:Ce,finishSizing:we,persist:ye}})}),Ae=()=>{let e=N();Q.send({type:`PANELS_CHANGED`,collection:e}),Ee()},je=()=>{l=ie({targets:C(),read:N,onChange:Ae,observer:{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`id`,`data-size`,`data-resize`,`data-collapsible`,`data-default-collapsed`]}})},$;return $={...Q,get id(){return C().id||D().id},get orientation(){return A()},get collapsed(){return[...E().layout.collapsedIds]},get sizes(){return{...E().layout.committedSizes}},get root(){let e=this.snapshot.current?.props??D();return ne({inputs:[g({part:G.parts.root,props:e,className:e.class}),{"data-ui-panels":``}]})},init(){f=te(this),h=new m,f.addChild(h),o=this.$el,Q.connect(this.$el,this.snapshot),C().id||=D().id,d=D().orientation===`horizontal`&&C().getBoundingClientRect().width<oe(C(),`sm`)?`stacked`:`wide`,K.add($),pe(),q(),Ee(),u=new ResizeObserver(e=>{ke(e[0]?.contentRect.width??C().clientWidth)}),u.observe(C()),je(),D().persist&&xe(),r({target:C(),event:`keydown`,handler:()=>W(),cleanup:f})},destroy(){K.delete($),l?.(),l=null,u?.disconnect(),u=null,y.clear(),h=null,_.forEach(e=>window.clearTimeout(e)),_.clear(),v.forEach(e=>cancelAnimationFrame(e)),v.clear(),Q.disconnect(),o=null},transitionPanel(e){let t=e.data.panelId,n=T(t),r=b.get(t);return!n||!r||r.from===r.to?(n&&B(n,r?.to),i()):a(e,{target:n.panel,keyframes:{flexBasis:[`${r.from}px`,`${r.to}px`]},role:`layout`,cleanup:()=>B(n)})},transitionPanelSize(e){let{panelId:t,from:n,to:r}=e.data,o=T(t);return!o||n===r?(o&&B(o),i()):a(e,{target:o.panel,keyframes:{flexBasis:[`${n}px`,`${r}px`]},role:`layoutQuick`,cleanup:()=>B(o)})},hasPanel(e){return T(e)!==null},isCollapsed:O,collapse(e){Q.send({type:`COLLAPSE`,panelId:e})},expand(e){Q.send({type:`EXPAND`,panelId:e})},toggle(e){Q.send({type:`TOGGLE`,panelId:e})},resize(e,t){let n=T(e);if(k()||!n||n.props.size===`fill`||O(e)||!Number.isFinite(t))return;let r=M(n.panel),i=I(n,t);Math.abs(r-i)<.5||Q.send({type:`SIZE`,panelId:e,from:r,to:i})},reset(e){Se(e)},perform(e,t,n){n&&S.set(t,n),{collapse:this.collapse,expand:this.expand,toggle:this.toggle}[e](t)},syncToggles:W},$},ge=()=>{let e={};return{get props(){return e},init(){e=c({el:this.$el,schema:w})},destroy(){},get root(){return ne({inputs:[g({part:G.parts.toggle,props:{},className:e.class}),{"data-ui-panel-toggle":``,":data-target":()=>e.target||void 0,":data-action":()=>e.action,"@click":e=>this.trigger(e)}]})},trigger(t){t?.preventDefault();let n=this.$el,r=n.closest(`[data-ui-panel]`),i=r?.closest(`[data-ui-panels]`),a=e.target||r?.id||``;a&&document.dispatchEvent(new CustomEvent(`ui:panel-toggle`,{detail:{panelId:a,groupId:i?.id,action:e.action,trigger:n}}))}}},_e=e=>{h(`UiPanels`,J)(e),h(`UiPanelToggle`,ge)(e)},ve=new WeakSet,Y=e=>{ve.has(e)||(ve.add(e),o(e),y(e),_e(e))};export{ge as n,J as r,Y as t};
2
+ //# sourceMappingURL=entry.generated-BSVJpGWu.js.map