@womp/kookie-ui 0.32.0 → 0.33.0

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 (105) hide show
  1. package/components.css +86 -35
  2. package/dist/cjs/components/_internal/pane-chrome.js +1 -1
  3. package/dist/cjs/components/_internal/pane-chrome.js.map +2 -2
  4. package/dist/cjs/components/_internal/shell-bottom.d.ts +7 -2
  5. package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
  6. package/dist/cjs/components/_internal/shell-bottom.js +1 -1
  7. package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
  8. package/dist/cjs/components/_internal/shell-inspector.d.ts +7 -2
  9. package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
  10. package/dist/cjs/components/_internal/shell-inspector.js +1 -1
  11. package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
  12. package/dist/cjs/components/_internal/shell-pane.js +1 -1
  13. package/dist/cjs/components/_internal/shell-pane.js.map +2 -2
  14. package/dist/cjs/components/_internal/shell-sidebar.d.ts +7 -2
  15. package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
  16. package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
  17. package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
  18. package/dist/cjs/components/_internal/shell-store.d.ts +6 -6
  19. package/dist/cjs/components/_internal/shell-store.d.ts.map +1 -1
  20. package/dist/cjs/components/_internal/shell-store.js +1 -1
  21. package/dist/cjs/components/_internal/shell-store.js.map +3 -3
  22. package/dist/cjs/components/index.js +1 -1
  23. package/dist/cjs/components/index.js.map +3 -3
  24. package/dist/cjs/components/navigator.js +1 -1
  25. package/dist/cjs/components/navigator.js.map +2 -2
  26. package/dist/cjs/components/shell.context.js +1 -1
  27. package/dist/cjs/components/shell.context.js.map +2 -2
  28. package/dist/cjs/components/shell.d.ts +25 -7
  29. package/dist/cjs/components/shell.d.ts.map +1 -1
  30. package/dist/cjs/components/shell.hooks.js +1 -1
  31. package/dist/cjs/components/shell.hooks.js.map +2 -2
  32. package/dist/cjs/components/shell.js +1 -1
  33. package/dist/cjs/components/shell.js.map +3 -3
  34. package/dist/cjs/components/toolbar.js +1 -1
  35. package/dist/cjs/components/toolbar.js.map +2 -2
  36. package/dist/cjs/index.js +1 -1
  37. package/dist/cjs/index.js.map +3 -3
  38. package/dist/esm/chunk-5BXCPANF.js +3 -0
  39. package/dist/esm/{chunk-GHWEXMF6.js.map → chunk-5BXCPANF.js.map} +3 -3
  40. package/dist/esm/{chunk-ZG2XQUOH.js → chunk-B447PNRD.js} +2 -2
  41. package/dist/esm/{chunk-QDAM2I6O.js → chunk-BR6Z2CAE.js} +2 -2
  42. package/dist/esm/{chunk-4G3FJUER.js → chunk-INGT6DB6.js} +2 -2
  43. package/dist/esm/{chunk-4ZHBNYXM.js → chunk-J6B7UCZN.js} +2 -2
  44. package/dist/esm/chunk-KDJM4NQQ.js +3 -0
  45. package/dist/esm/chunk-KDJM4NQQ.js.map +7 -0
  46. package/dist/esm/{chunk-LTUW36HM.js → chunk-KGCGT4MJ.js} +2 -2
  47. package/dist/esm/chunk-NO2JCJWI.js +3 -0
  48. package/dist/esm/chunk-NO2JCJWI.js.map +7 -0
  49. package/dist/esm/{chunk-NFSW36RG.js → chunk-ODHCDJ3Y.js} +2 -2
  50. package/dist/esm/chunk-UMQOTGJC.js +3 -0
  51. package/dist/esm/chunk-UMQOTGJC.js.map +7 -0
  52. package/dist/esm/chunk-XD676L6S.js +3 -0
  53. package/dist/esm/chunk-XD676L6S.js.map +7 -0
  54. package/dist/esm/{chunk-6SGJWML7.js → chunk-XKYPJTRN.js} +2 -2
  55. package/dist/esm/components/_internal/pane-chrome.js +1 -1
  56. package/dist/esm/components/_internal/shell-bottom.d.ts +7 -2
  57. package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
  58. package/dist/esm/components/_internal/shell-bottom.js +1 -1
  59. package/dist/esm/components/_internal/shell-inspector.d.ts +7 -2
  60. package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
  61. package/dist/esm/components/_internal/shell-inspector.js +1 -1
  62. package/dist/esm/components/_internal/shell-pane.js +1 -1
  63. package/dist/esm/components/_internal/shell-sidebar.d.ts +7 -2
  64. package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
  65. package/dist/esm/components/_internal/shell-sidebar.js +1 -1
  66. package/dist/esm/components/_internal/shell-store.d.ts +6 -6
  67. package/dist/esm/components/_internal/shell-store.d.ts.map +1 -1
  68. package/dist/esm/components/_internal/shell-store.js +1 -1
  69. package/dist/esm/components/index.js +1 -1
  70. package/dist/esm/components/navigator.js +1 -1
  71. package/dist/esm/components/shell.context.js +1 -1
  72. package/dist/esm/components/shell.d.ts +25 -7
  73. package/dist/esm/components/shell.d.ts.map +1 -1
  74. package/dist/esm/components/shell.hooks.js +1 -1
  75. package/dist/esm/components/shell.js +1 -1
  76. package/dist/esm/components/sidebar.js +1 -1
  77. package/dist/esm/components/toolbar.js +1 -1
  78. package/dist/esm/index.js +1 -1
  79. package/package.json +1 -1
  80. package/src/components/_internal/shell-bottom.tsx +11 -6
  81. package/src/components/_internal/shell-inspector.tsx +11 -6
  82. package/src/components/_internal/shell-sidebar.tsx +11 -6
  83. package/src/components/_internal/shell-store.tsx +13 -13
  84. package/src/components/shell.css +133 -47
  85. package/src/components/shell.tsx +50 -32
  86. package/src/styles/tokens/color.css +2 -0
  87. package/styles.css +87 -35
  88. package/tokens/base.css +1 -0
  89. package/tokens.css +1 -0
  90. package/dist/esm/chunk-4B3S2DM7.js +0 -3
  91. package/dist/esm/chunk-4B3S2DM7.js.map +0 -7
  92. package/dist/esm/chunk-AKMRPGNP.js +0 -3
  93. package/dist/esm/chunk-AKMRPGNP.js.map +0 -7
  94. package/dist/esm/chunk-GHWEXMF6.js +0 -3
  95. package/dist/esm/chunk-ZBSGH74F.js +0 -3
  96. package/dist/esm/chunk-ZBSGH74F.js.map +0 -7
  97. package/dist/esm/chunk-ZHXEEOGI.js +0 -3
  98. package/dist/esm/chunk-ZHXEEOGI.js.map +0 -7
  99. /package/dist/esm/{chunk-ZG2XQUOH.js.map → chunk-B447PNRD.js.map} +0 -0
  100. /package/dist/esm/{chunk-QDAM2I6O.js.map → chunk-BR6Z2CAE.js.map} +0 -0
  101. /package/dist/esm/{chunk-4G3FJUER.js.map → chunk-INGT6DB6.js.map} +0 -0
  102. /package/dist/esm/{chunk-4ZHBNYXM.js.map → chunk-J6B7UCZN.js.map} +0 -0
  103. /package/dist/esm/{chunk-LTUW36HM.js.map → chunk-KGCGT4MJ.js.map} +0 -0
  104. /package/dist/esm/{chunk-NFSW36RG.js.map → chunk-ODHCDJ3Y.js.map} +0 -0
  105. /package/dist/esm/{chunk-6SGJWML7.js.map → chunk-XKYPJTRN.js.map} +0 -0
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";"use client";var z=Object.create;var f=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var n in t)f(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!K.call(e,o)&&o!==n&&f(e,o,{get:()=>t[o],enumerable:!(i=A(t,o))||i.enumerable});return e};var g=(e,t,n)=>(n=e!=null?z(H(e)):{},R(t||!e||!e.__esModule?f(n,"default",{value:e,enumerable:!0}):n,e)),j=e=>R(f({},"__esModule",{value:!0}),e);var ne={};$(ne,{useShell:()=>te,useSidebarMode:()=>ee});module.exports=j(ne);var a=g(require("react"));var c=g(require("react"));var k={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},T=["initial","xs","sm","md","lg","xl"];var Q=Object.entries(k),x=null,u=new Set,s=null;function h(){return x??(x=Q.map(([e,t])=>[e,window.matchMedia(t)])),x}function y(){let e="initial";for(let[t,n]of h())n.matches&&(e=t);return e}function S(){let e=y();e!==s&&(s=e,u.forEach(t=>t()))}function B(e){if(typeof window>"u")return()=>{};if(u.size===0){s=y();for(let[,t]of h())typeof t.addEventListener=="function"?t.addEventListener("change",S):t.addListener?.(S)}return u.add(e),()=>{if(u.delete(e),!(u.size>0)){for(let[,t]of h())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",S):t.removeListener?.(S)}catch{}s=null}}}function q(){return typeof window>"u"?"initial":(s??(s=y()),s)}function D(){return"initial"}var U=()=>!0,W=()=>!1,E=()=>()=>{},F=()=>"initial";function w(e=!0){let t=c.useSyncExternalStore(e?B:E,e?q:F,D),n=c.useSyncExternalStore(e?B:E,U,W);return c.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var l=g(require("react")),J=require("radix-ui/internal");function C(e){return typeof e=="object"&&e!==null}function X(e,t){let n={},i=null;for(let o of T){if(e!==void 0&&!C(e)){n[o]=e;continue}let d=C(e)?e[o]:void 0;d!==void 0&&(i={value:d}),n[o]=i?i.value:t(o)}return n}var le=X("fixed",()=>"fixed");function G(e){e.version+=1;for(let t of e.listeners)t()}function M(e,t){return e.listeners.add(t),()=>{e.listeners.delete(t)}}function V(e,t){e.peek!==t&&(e.peek=t,G(e))}var Y=l.createContext(null);function v(e){let t=l.useContext(Y);if(!t)throw new Error(`${e} must be used within <Shell.Root>`);return t}var de=l.createContext(null);var L=e=>e===void 0?void 0:e==="closed"?"collapsed":"expanded",N=e=>e==="collapsed"?"closed":"open",b=e=>e===void 0||e==="closed"?"collapsed":"expanded",P=e=>e==="left"?"rail":e;function Z(e){let t=a.useCallback(n=>M(e,n),[e]);return a.useSyncExternalStore(t,()=>e.version,()=>0)}function ee(){let e=v("useSidebarMode"),t=a.useCallback(o=>M(e,o),[e]),n=a.useSyncExternalStore(t,()=>e.entries.get("sidebar")?.value,()=>{}),i=a.useCallback(o=>{e.entries.get("sidebar")?.setValue(N(o),"toggle")},[e]);return{sidebarMode:L(n)??"expanded",setSidebarMode:i}}var I=()=>{};function te(){let e=v("useShell");a.useEffect(()=>{},[]),Z(e);let{breakpoint:t,ready:n}=w(),i=a.useMemo(()=>{let p=r=>O=>e.entries.get(r)?.setValue(O==="collapsed"?"closed":"open","toggle"),m=r=>V(e,r===null?null:P(r));return{setLeftMode:p("rail"),setPanelMode:p("panel"),setInspectorMode:p("inspector"),setBottomMode:p("bottom"),setSidebarMode:r=>e.entries.get("sidebar")?.setValue(N(r),"toggle"),setPeekTarget:m,peekPane:r=>m(r),clearPeek:()=>m(null),setHasLeft:I,setHasSidebar:I,togglePane:r=>e.entries.get(P(r))?.toggle("toggle"),expandPane:r=>e.entries.get(P(r))?.setValue("open","toggle"),collapsePane:r=>e.entries.get(P(r))?.setValue("closed","toggle")}},[e]),o=p=>e.entries.get(p)?.value,d=e.entries.get("rail");return{leftMode:b(o("rail")),leftControlledOpen:d?.value===void 0?void 0:d.value!=="closed",panelMode:b(o("panel")),sidebarMode:L(o("sidebar"))??"expanded",inspectorMode:b(o("inspector")),bottomMode:b(o("bottom")),peekTarget:e.peek,hasLeft:e.entries.has("rail"),hasSidebar:e.entries.has("sidebar"),currentBreakpoint:t,currentBreakpointReady:n,leftResolvedPresentation:d?.presentation,...i}}
2
+ "use strict";"use client";var z=Object.create;var f=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var n in t)f(e,n,{get:t[n],enumerable:!0})},R=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of A(t))!H.call(e,o)&&o!==n&&f(e,o,{get:()=>t[o],enumerable:!(i=F(t,o))||i.enumerable});return e};var g=(e,t,n)=>(n=e!=null?z(_(e)):{},R(t||!e||!e.__esModule?f(n,"default",{value:e,enumerable:!0}):n,e)),$=e=>R(f({},"__esModule",{value:!0}),e);var ne={};K(ne,{useShell:()=>te,useSidebarMode:()=>ee});module.exports=$(ne);var a=g(require("react"));var c=g(require("react"));var k={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},T=["initial","xs","sm","md","lg","xl"];var j=Object.entries(k),x=null,u=new Set,s=null;function h(){return x??(x=j.map(([e,t])=>[e,window.matchMedia(t)])),x}function y(){let e="initial";for(let[t,n]of h())n.matches&&(e=t);return e}function S(){let e=y();e!==s&&(s=e,u.forEach(t=>t()))}function B(e){if(typeof window>"u")return()=>{};if(u.size===0){s=y();for(let[,t]of h())typeof t.addEventListener=="function"?t.addEventListener("change",S):t.addListener?.(S)}return u.add(e),()=>{if(u.delete(e),!(u.size>0)){for(let[,t]of h())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",S):t.removeListener?.(S)}catch{}s=null}}}function Q(){return typeof window>"u"?"initial":(s??(s=y()),s)}function q(){return"initial"}var D=()=>!0,U=()=>!1,E=()=>()=>{},W=()=>"initial";function w(e=!0){let t=c.useSyncExternalStore(e?B:E,e?Q:W,q),n=c.useSyncExternalStore(e?B:E,D,U);return c.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var l=g(require("react")),J=require("radix-ui/internal");function C(e){return typeof e=="object"&&e!==null}function X(e,t){let n={},i=null;for(let o of T){if(e!==void 0&&!C(e)){n[o]=e;continue}let d=C(e)?e[o]:void 0;d!==void 0&&(i={value:d}),n[o]=i?i.value:t(o)}return n}var le=X("fixed",()=>"fixed");function G(e){e.version+=1;for(let t of e.listeners)t()}function M(e,t){return e.listeners.add(t),()=>{e.listeners.delete(t)}}function V(e,t){e.peek!==t&&(e.peek=t,G(e))}var Y=l.createContext(null);function v(e){let t=l.useContext(Y);if(!t)throw new Error(`${e} must be used within <Shell.Root>`);return t}var de=l.createContext(null);var O=e=>e===void 0?void 0:e==="closed"?"collapsed":"expanded",N=e=>e==="collapsed"?"closed":"open",m=e=>e===void 0||e==="closed"?"collapsed":"expanded",b=e=>e==="left"?"rail":e;function Z(e){let t=a.useCallback(n=>M(e,n),[e]);return a.useSyncExternalStore(t,()=>e.version,()=>0)}function ee(){let e=v("useSidebarMode"),t=a.useCallback(o=>M(e,o),[e]),n=a.useSyncExternalStore(t,()=>e.entries.get("sidebar")?.value,()=>{}),i=a.useCallback(o=>{e.entries.get("sidebar")?.setValue(N(o),"toggle")},[e]);return{sidebarMode:O(n)??"expanded",setSidebarMode:i}}var L=()=>{};function te(){let e=v("useShell");a.useEffect(()=>{},[]),Z(e);let{breakpoint:t,ready:n}=w(),i=a.useMemo(()=>{let p=r=>I=>e.entries.get(r)?.setValue(I==="collapsed"?"closed":"open","toggle"),P=r=>V(e,r===null?null:b(r));return{setLeftMode:p("rail"),setPanelMode:p("panel"),setInspectorMode:p("inspector"),setBottomMode:p("bottom"),setSidebarMode:r=>e.entries.get("sidebar")?.setValue(N(r),"toggle"),setPeekTarget:P,peekPane:r=>P(r),clearPeek:()=>P(null),setHasLeft:L,setHasSidebar:L,togglePane:r=>e.entries.get(b(r))?.toggle("toggle"),expandPane:r=>e.entries.get(b(r))?.setValue("open","toggle"),collapsePane:r=>e.entries.get(b(r))?.setValue("closed","toggle")}},[e]),o=p=>e.entries.get(p)?.value,d=e.entries.get("rail");return{leftMode:m(o("rail")),leftControlledOpen:d?.value===void 0?void 0:d.value!=="closed",panelMode:m(o("panel")),sidebarMode:O(o("sidebar"))??"expanded",inspectorMode:m(o("inspector")),bottomMode:m(o("bottom")),peekTarget:e.peek,hasLeft:e.entries.has("rail"),hasSidebar:e.entries.has("sidebar"),currentBreakpoint:t,currentBreakpointReady:n,leftResolvedPresentation:d?.presentation,...i}}
3
3
  //# sourceMappingURL=shell.context.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/shell.context.tsx", "../../../src/hooks/use-breakpoint.ts", "../../../src/components/shell.types.ts", "../../../src/components/_internal/shell-store.tsx"],
4
- "sourcesContent": ["'use client';\n\n/**\n * Since 0.8.0 the Shell has two contexts: the pane registry (the store) and\n * the inset set. They live in `_internal/shell-store.tsx`. This module keeps\n * the two hooks consumers can reach: `useSidebarMode`, and the deprecated\n * `useShell`.\n */\nimport * as React from 'react';\nimport { useBreakpoint } from '../hooks/use-breakpoint.js';\nimport type { Breakpoint, PaneMode, PaneName, PaneTarget, PresentationValue, SidebarMode } from './shell.types.js';\nimport { setShellPeek, subscribeShellStore, useShellStore, warnOnce, type PaneValue, type ShellStore } from './_internal/shell-store.js';\n\nconst toSidebarMode = (value: PaneValue | undefined): SidebarMode | undefined => (value === undefined ? undefined : value === 'closed' ? 'collapsed' : 'expanded');\n\nconst fromSidebarMode = (mode: SidebarMode): PaneValue => (mode === 'collapsed' ? 'closed' : 'open');\n\nconst toPaneMode = (value: PaneValue | undefined): PaneMode => (value === undefined || value === 'closed' ? 'collapsed' : 'expanded');\n\nconst paneName = (target: PaneTarget): PaneName => (target === 'left' ? 'rail' : target);\n\n/** Re-renders on every change to the registry. For the deprecated whole-shell reader only. */\nfunction useStoreVersion(store: ShellStore) {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.version,\n () => 0,\n );\n}\n\n/**\n * The Sidebar's mode, and a setter. The setter is a user action: it reports\n * through the Sidebar's `onStateChange` the way a Trigger does.\n */\nexport function useSidebarMode(): { sidebarMode: SidebarMode; setSidebarMode: (mode: SidebarMode) => void } {\n const store = useShellStore('useSidebarMode');\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const value = React.useSyncExternalStore(\n subscribe,\n () => store.entries.get('sidebar')?.value,\n () => undefined,\n );\n const setSidebarMode = React.useCallback(\n (mode: SidebarMode) => {\n store.entries.get('sidebar')?.setValue(fromSidebarMode(mode), 'toggle');\n },\n [store],\n );\n return { sidebarMode: toSidebarMode(value) ?? 'expanded', setSidebarMode };\n}\n\nexport interface ShellContextValue {\n leftMode: PaneMode;\n setLeftMode: (mode: PaneMode) => void;\n /** The Rail's open state, resolved, when it is controlled. */\n leftControlledOpen?: boolean;\n panelMode: PaneMode;\n setPanelMode: (mode: PaneMode) => void;\n sidebarMode: SidebarMode;\n setSidebarMode: (mode: SidebarMode) => void;\n inspectorMode: PaneMode;\n setInspectorMode: (mode: PaneMode) => void;\n bottomMode: PaneMode;\n setBottomMode: (mode: PaneMode) => void;\n peekTarget: PaneTarget | null;\n setPeekTarget: (target: PaneTarget | null) => void;\n peekPane: (target: PaneTarget) => void;\n clearPeek: () => void;\n /** Whether a Rail is mounted. */\n hasLeft: boolean;\n /** No effect since 0.8.0: the registry knows which panes are mounted. */\n setHasLeft: (has: boolean) => void;\n /** Whether a Sidebar is mounted. */\n hasSidebar: boolean;\n /** No effect since 0.8.0: the registry knows which panes are mounted. */\n setHasSidebar: (has: boolean) => void;\n currentBreakpoint: Breakpoint;\n currentBreakpointReady: boolean;\n /** The Rail's presentation at the current breakpoint, when known. */\n leftResolvedPresentation?: PresentationValue;\n togglePane: (target: PaneTarget) => void;\n expandPane: (target: PaneTarget) => void;\n collapsePane: (target: PaneTarget) => void;\n}\n\nconst noop = () => {};\n\n/**\n * @deprecated The whole-shell reader re-renders its consumer on every change\n * to any pane. Use `Shell.Trigger` to drive a pane, `Shell.useSidebarMode`\n * for the Sidebar, and each pane's `open`/`onOpenChange` for its state.\n * Removed in 1.0.\n *\n * Keeps 0.7's shape. The setters act as a user would: they report through\n * the pane's own callback with `reason: 'toggle'`, and a controlled pane\n * changes only when the app passes the new value.\n */\nexport function useShell(): ShellContextValue {\n const store = useShellStore('useShell');\n React.useEffect(() => {\n warnOnce(\"Shell.useShell is deprecated and is removed in 1.0. Use Shell.Trigger, Shell.useSidebarMode, or a pane's own open/onOpenChange.\");\n }, []);\n useStoreVersion(store);\n const { breakpoint, ready } = useBreakpoint();\n const actions = React.useMemo(() => {\n const setMode = (name: PaneName) => (mode: PaneMode) => store.entries.get(name)?.setValue(mode === 'collapsed' ? 'closed' : 'open', 'toggle');\n const setPeekTarget = (target: PaneTarget | null) => setShellPeek(store, target === null ? null : paneName(target));\n return {\n setLeftMode: setMode('rail'),\n setPanelMode: setMode('panel'),\n setInspectorMode: setMode('inspector'),\n setBottomMode: setMode('bottom'),\n setSidebarMode: (mode: SidebarMode) => store.entries.get('sidebar')?.setValue(fromSidebarMode(mode), 'toggle'),\n setPeekTarget,\n peekPane: (target: PaneTarget) => setPeekTarget(target),\n clearPeek: () => setPeekTarget(null),\n setHasLeft: noop,\n setHasSidebar: noop,\n togglePane: (target: PaneTarget) => store.entries.get(paneName(target))?.toggle('toggle'),\n expandPane: (target: PaneTarget) => store.entries.get(paneName(target))?.setValue('open', 'toggle'),\n collapsePane: (target: PaneTarget) => store.entries.get(paneName(target))?.setValue('closed', 'toggle'),\n };\n }, [store]);\n const value = (name: PaneName) => store.entries.get(name)?.value;\n const rail = store.entries.get('rail');\n return {\n leftMode: toPaneMode(value('rail')),\n leftControlledOpen: rail?.value === undefined ? undefined : rail.value !== 'closed',\n panelMode: toPaneMode(value('panel')),\n sidebarMode: toSidebarMode(value('sidebar')) ?? 'expanded',\n inspectorMode: toPaneMode(value('inspector')),\n bottomMode: toPaneMode(value('bottom')),\n peekTarget: store.peek,\n hasLeft: store.entries.has('rail'),\n hasSidebar: store.entries.has('sidebar'),\n currentBreakpoint: breakpoint,\n currentBreakpointReady: ready,\n leftResolvedPresentation: rail?.presentation,\n ...actions,\n };\n}\n", "'use client';\n\nimport * as React from 'react';\nimport { _BREAKPOINTS, type Breakpoint } from '../components/shell.types.js';\n\nconst QUERIES = Object.entries(_BREAKPOINTS) as Array<[Breakpoint, string]>;\n\ntype Listener = () => void;\n\n/**\n * One set of `MediaQueryList`s and one set of listeners for the whole\n * application. Every component that asks for the breakpoint used to create and\n * subscribe to its own copy of all five queries.\n */\nlet mediaQueryLists: Array<[Breakpoint, MediaQueryList]> | null = null;\nconst listeners = new Set<Listener>();\nlet cachedBreakpoint: Breakpoint | null = null;\n\nfunction getMediaQueryLists() {\n mediaQueryLists ??= QUERIES.map(([name, query]) => [name, window.matchMedia(query)] as [Breakpoint, MediaQueryList]);\n return mediaQueryLists;\n}\n\nfunction computeBreakpoint(): Breakpoint {\n // The largest matching query wins; `_BREAKPOINTS` is ordered smallest first.\n let matched: Breakpoint = 'initial';\n for (const [name, mql] of getMediaQueryLists()) {\n if (mql.matches) matched = name;\n }\n return matched;\n}\n\nfunction handleChange() {\n const next = computeBreakpoint();\n if (next === cachedBreakpoint) return;\n cachedBreakpoint = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: Listener) {\n if (typeof window === 'undefined') return () => {};\n\n if (listeners.size === 0) {\n cachedBreakpoint = computeBreakpoint();\n for (const [, mql] of getMediaQueryLists()) {\n // Safari below 14 only has the deprecated listener API.\n if (typeof mql.addEventListener === 'function') mql.addEventListener('change', handleChange);\n else mql.addListener?.(handleChange);\n }\n }\n\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size > 0) return;\n\n for (const [, mql] of getMediaQueryLists()) {\n try {\n if (typeof mql.removeEventListener === 'function') mql.removeEventListener('change', handleChange);\n else mql.removeListener?.(handleChange);\n } catch (error) {\n // Removal can throw in edge cases, e.g. the list was already torn down.\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[useBreakpoint] MediaQueryList cleanup warning:', error);\n }\n }\n }\n cachedBreakpoint = null;\n };\n}\n\n/**\n * `getSnapshot` must return a referentially stable value between changes, so it\n * reads the cache that `handleChange` maintains rather than recomputing.\n */\nfunction getSnapshot(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n cachedBreakpoint ??= computeBreakpoint();\n return cachedBreakpoint;\n}\n\nfunction getServerSnapshot(): Breakpoint {\n return 'initial';\n}\n\n/**\n * The breakpoint right now, outside React's render. For an effect that needs\n * the answer at the moment it runs rather than the one its render saw.\n */\nexport function readBreakpoint(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n return computeBreakpoint();\n}\n\nconst getReadySnapshot = () => true;\nconst getReadyServerSnapshot = () => false;\n\nconst noopSubscribe = () => () => {};\nconst getInitialSnapshot = (): Breakpoint => 'initial';\n\n/**\n * The current breakpoint, and whether it has been resolved against a real\n * viewport yet (`false` on the server and during hydration).\n *\n * Reads through `useSyncExternalStore` rather than settling into state from an\n * effect. On a client render the very first pass already has the real\n * breakpoint, instead of rendering the whole shell at `initial` and correcting\n * it after the browser has painted.\n *\n * Pass `enabled = false` to skip the subscription (the breakpoint then reads as\n * `initial`).\n */\nexport function useBreakpoint(enabled = true): { breakpoint: Breakpoint; ready: boolean } {\n // Callers with a non-responsive value pass `enabled = false` so they neither\n // subscribe to the media queries nor re-render when the viewport crosses one.\n const breakpoint = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n enabled ? getSnapshot : getInitialSnapshot,\n getServerSnapshot,\n );\n const ready = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n getReadySnapshot,\n getReadyServerSnapshot,\n );\n\n return React.useMemo(() => ({ breakpoint, ready }), [breakpoint, ready]);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Inset \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type InsetPaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellInsetContext = React.createContext<{\n registerInset: (id: InsetPaneId) => void;\n unregisterInset: (id: InsetPaneId) => void;\n} | null>(null);\n\n/** Registers a pane's `inset` with the Root, which paints the backdrop while any pane is inset. */\nexport function useInsetRegistration(id: InsetPaneId, inset: boolean | undefined) {\n const ctx = React.useContext(ShellInsetContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerInset, unregisterInset } = ctx;\n useLayoutEffect(() => {\n if (!inset) return;\n registerInset(id);\n return () => unregisterInset(id);\n }, [id, inset, registerInset, unregisterInset]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n"],
4
+ "sourcesContent": ["'use client';\n\n/**\n * Since 0.8.0 the Shell has two contexts: the pane registry (the store) and\n * the inset set. They live in `_internal/shell-store.tsx`. This module keeps\n * the two hooks consumers can reach: `useSidebarMode`, and the deprecated\n * `useShell`.\n */\nimport * as React from 'react';\nimport { useBreakpoint } from '../hooks/use-breakpoint.js';\nimport type { Breakpoint, PaneMode, PaneName, PaneTarget, PresentationValue, SidebarMode } from './shell.types.js';\nimport { setShellPeek, subscribeShellStore, useShellStore, warnOnce, type PaneValue, type ShellStore } from './_internal/shell-store.js';\n\nconst toSidebarMode = (value: PaneValue | undefined): SidebarMode | undefined => (value === undefined ? undefined : value === 'closed' ? 'collapsed' : 'expanded');\n\nconst fromSidebarMode = (mode: SidebarMode): PaneValue => (mode === 'collapsed' ? 'closed' : 'open');\n\nconst toPaneMode = (value: PaneValue | undefined): PaneMode => (value === undefined || value === 'closed' ? 'collapsed' : 'expanded');\n\nconst paneName = (target: PaneTarget): PaneName => (target === 'left' ? 'rail' : target);\n\n/** Re-renders on every change to the registry. For the deprecated whole-shell reader only. */\nfunction useStoreVersion(store: ShellStore) {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.version,\n () => 0,\n );\n}\n\n/**\n * The Sidebar's mode, and a setter. The setter is a user action: it reports\n * through the Sidebar's `onStateChange` the way a Trigger does.\n */\nexport function useSidebarMode(): { sidebarMode: SidebarMode; setSidebarMode: (mode: SidebarMode) => void } {\n const store = useShellStore('useSidebarMode');\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const value = React.useSyncExternalStore(\n subscribe,\n () => store.entries.get('sidebar')?.value,\n () => undefined,\n );\n const setSidebarMode = React.useCallback(\n (mode: SidebarMode) => {\n store.entries.get('sidebar')?.setValue(fromSidebarMode(mode), 'toggle');\n },\n [store],\n );\n return { sidebarMode: toSidebarMode(value) ?? 'expanded', setSidebarMode };\n}\n\nexport interface ShellContextValue {\n leftMode: PaneMode;\n setLeftMode: (mode: PaneMode) => void;\n /** The Rail's open state, resolved, when it is controlled. */\n leftControlledOpen?: boolean;\n panelMode: PaneMode;\n setPanelMode: (mode: PaneMode) => void;\n sidebarMode: SidebarMode;\n setSidebarMode: (mode: SidebarMode) => void;\n inspectorMode: PaneMode;\n setInspectorMode: (mode: PaneMode) => void;\n bottomMode: PaneMode;\n setBottomMode: (mode: PaneMode) => void;\n peekTarget: PaneTarget | null;\n setPeekTarget: (target: PaneTarget | null) => void;\n peekPane: (target: PaneTarget) => void;\n clearPeek: () => void;\n /** Whether a Rail is mounted. */\n hasLeft: boolean;\n /** No effect since 0.8.0: the registry knows which panes are mounted. */\n setHasLeft: (has: boolean) => void;\n /** Whether a Sidebar is mounted. */\n hasSidebar: boolean;\n /** No effect since 0.8.0: the registry knows which panes are mounted. */\n setHasSidebar: (has: boolean) => void;\n currentBreakpoint: Breakpoint;\n currentBreakpointReady: boolean;\n /** The Rail's presentation at the current breakpoint, when known. */\n leftResolvedPresentation?: PresentationValue;\n togglePane: (target: PaneTarget) => void;\n expandPane: (target: PaneTarget) => void;\n collapsePane: (target: PaneTarget) => void;\n}\n\nconst noop = () => {};\n\n/**\n * @deprecated The whole-shell reader re-renders its consumer on every change\n * to any pane. Use `Shell.Trigger` to drive a pane, `Shell.useSidebarMode`\n * for the Sidebar, and each pane's `open`/`onOpenChange` for its state.\n * Removed in 1.0.\n *\n * Keeps 0.7's shape. The setters act as a user would: they report through\n * the pane's own callback with `reason: 'toggle'`, and a controlled pane\n * changes only when the app passes the new value.\n */\nexport function useShell(): ShellContextValue {\n const store = useShellStore('useShell');\n React.useEffect(() => {\n warnOnce(\"Shell.useShell is deprecated and is removed in 1.0. Use Shell.Trigger, Shell.useSidebarMode, or a pane's own open/onOpenChange.\");\n }, []);\n useStoreVersion(store);\n const { breakpoint, ready } = useBreakpoint();\n const actions = React.useMemo(() => {\n const setMode = (name: PaneName) => (mode: PaneMode) => store.entries.get(name)?.setValue(mode === 'collapsed' ? 'closed' : 'open', 'toggle');\n const setPeekTarget = (target: PaneTarget | null) => setShellPeek(store, target === null ? null : paneName(target));\n return {\n setLeftMode: setMode('rail'),\n setPanelMode: setMode('panel'),\n setInspectorMode: setMode('inspector'),\n setBottomMode: setMode('bottom'),\n setSidebarMode: (mode: SidebarMode) => store.entries.get('sidebar')?.setValue(fromSidebarMode(mode), 'toggle'),\n setPeekTarget,\n peekPane: (target: PaneTarget) => setPeekTarget(target),\n clearPeek: () => setPeekTarget(null),\n setHasLeft: noop,\n setHasSidebar: noop,\n togglePane: (target: PaneTarget) => store.entries.get(paneName(target))?.toggle('toggle'),\n expandPane: (target: PaneTarget) => store.entries.get(paneName(target))?.setValue('open', 'toggle'),\n collapsePane: (target: PaneTarget) => store.entries.get(paneName(target))?.setValue('closed', 'toggle'),\n };\n }, [store]);\n const value = (name: PaneName) => store.entries.get(name)?.value;\n const rail = store.entries.get('rail');\n return {\n leftMode: toPaneMode(value('rail')),\n leftControlledOpen: rail?.value === undefined ? undefined : rail.value !== 'closed',\n panelMode: toPaneMode(value('panel')),\n sidebarMode: toSidebarMode(value('sidebar')) ?? 'expanded',\n inspectorMode: toPaneMode(value('inspector')),\n bottomMode: toPaneMode(value('bottom')),\n peekTarget: store.peek,\n hasLeft: store.entries.has('rail'),\n hasSidebar: store.entries.has('sidebar'),\n currentBreakpoint: breakpoint,\n currentBreakpointReady: ready,\n leftResolvedPresentation: rail?.presentation,\n ...actions,\n };\n}\n", "'use client';\n\nimport * as React from 'react';\nimport { _BREAKPOINTS, type Breakpoint } from '../components/shell.types.js';\n\nconst QUERIES = Object.entries(_BREAKPOINTS) as Array<[Breakpoint, string]>;\n\ntype Listener = () => void;\n\n/**\n * One set of `MediaQueryList`s and one set of listeners for the whole\n * application. Every component that asks for the breakpoint used to create and\n * subscribe to its own copy of all five queries.\n */\nlet mediaQueryLists: Array<[Breakpoint, MediaQueryList]> | null = null;\nconst listeners = new Set<Listener>();\nlet cachedBreakpoint: Breakpoint | null = null;\n\nfunction getMediaQueryLists() {\n mediaQueryLists ??= QUERIES.map(([name, query]) => [name, window.matchMedia(query)] as [Breakpoint, MediaQueryList]);\n return mediaQueryLists;\n}\n\nfunction computeBreakpoint(): Breakpoint {\n // The largest matching query wins; `_BREAKPOINTS` is ordered smallest first.\n let matched: Breakpoint = 'initial';\n for (const [name, mql] of getMediaQueryLists()) {\n if (mql.matches) matched = name;\n }\n return matched;\n}\n\nfunction handleChange() {\n const next = computeBreakpoint();\n if (next === cachedBreakpoint) return;\n cachedBreakpoint = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: Listener) {\n if (typeof window === 'undefined') return () => {};\n\n if (listeners.size === 0) {\n cachedBreakpoint = computeBreakpoint();\n for (const [, mql] of getMediaQueryLists()) {\n // Safari below 14 only has the deprecated listener API.\n if (typeof mql.addEventListener === 'function') mql.addEventListener('change', handleChange);\n else mql.addListener?.(handleChange);\n }\n }\n\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size > 0) return;\n\n for (const [, mql] of getMediaQueryLists()) {\n try {\n if (typeof mql.removeEventListener === 'function') mql.removeEventListener('change', handleChange);\n else mql.removeListener?.(handleChange);\n } catch (error) {\n // Removal can throw in edge cases, e.g. the list was already torn down.\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[useBreakpoint] MediaQueryList cleanup warning:', error);\n }\n }\n }\n cachedBreakpoint = null;\n };\n}\n\n/**\n * `getSnapshot` must return a referentially stable value between changes, so it\n * reads the cache that `handleChange` maintains rather than recomputing.\n */\nfunction getSnapshot(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n cachedBreakpoint ??= computeBreakpoint();\n return cachedBreakpoint;\n}\n\nfunction getServerSnapshot(): Breakpoint {\n return 'initial';\n}\n\n/**\n * The breakpoint right now, outside React's render. For an effect that needs\n * the answer at the moment it runs rather than the one its render saw.\n */\nexport function readBreakpoint(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n return computeBreakpoint();\n}\n\nconst getReadySnapshot = () => true;\nconst getReadyServerSnapshot = () => false;\n\nconst noopSubscribe = () => () => {};\nconst getInitialSnapshot = (): Breakpoint => 'initial';\n\n/**\n * The current breakpoint, and whether it has been resolved against a real\n * viewport yet (`false` on the server and during hydration).\n *\n * Reads through `useSyncExternalStore` rather than settling into state from an\n * effect. On a client render the very first pass already has the real\n * breakpoint, instead of rendering the whole shell at `initial` and correcting\n * it after the browser has painted.\n *\n * Pass `enabled = false` to skip the subscription (the breakpoint then reads as\n * `initial`).\n */\nexport function useBreakpoint(enabled = true): { breakpoint: Breakpoint; ready: boolean } {\n // Callers with a non-responsive value pass `enabled = false` so they neither\n // subscribe to the media queries nor re-render when the viewport crosses one.\n const breakpoint = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n enabled ? getSnapshot : getInitialSnapshot,\n getServerSnapshot,\n );\n const ready = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n getReadySnapshot,\n getReadyServerSnapshot,\n );\n\n return React.useMemo(() => ({ breakpoint, ready }), [breakpoint, ready]);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Off the frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type FramePaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellFrameContext = React.createContext<{\n registerOffFrame: (id: FramePaneId) => void;\n unregisterOffFrame: (id: FramePaneId) => void;\n} | null>(null);\n\n/** Tells the Root a pane is off the frame (`flush={false}`); the Rail's card moves a floating Panel over. */\nexport function useFrameRegistration(id: FramePaneId, flush: boolean) {\n const ctx = React.useContext(ShellFrameContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerOffFrame, unregisterOffFrame } = ctx;\n useLayoutEffect(() => {\n if (flush) return;\n registerOffFrame(id);\n return () => unregisterOffFrame(id);\n }, [id, flush, registerOffFrame, unregisterOffFrame]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n"],
5
5
  "mappings": ";ukBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,cAAAE,GAAA,mBAAAC,KAAA,eAAAC,EAAAJ,IAQA,IAAAK,EAAuB,oBCNvB,IAAAC,EAAuB,oBCqDhB,IAAMC,EAAe,CAC1B,GAAI,qBACJ,GAAI,qBACJ,GAAI,sBACJ,GAAI,sBACJ,GAAI,qBACN,EAKaC,EAA2C,CAAC,UAAW,KAAM,KAAM,KAAM,KAAM,IAAI,ED7DhG,IAAMC,EAAU,OAAO,QAAQC,CAAY,EASvCC,EAA8D,KAC5DC,EAAY,IAAI,IAClBC,EAAsC,KAE1C,SAASC,GAAqB,CAC5B,OAAAH,MAAoBF,EAA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POINTS", "SHELL_BREAKPOINTS", "QUERIES", "_BREAKPOINTS", "mediaQueryLists", "listeners", "cachedBreakpoint", "getMediaQueryLists", "name", "query", "computeBreakpoint", "matched", "mql", "handleChange", "next", "listener", "subscribe", "getSnapshot", "getServerSnapshot", "getReadySnapshot", "getReadyServerSnapshot", "noopSubscribe", "getInitialSnapshot", "useBreakpoint", "enabled", "breakpoint", "subscribe", "getSnapshot", "getServerSnapshot", "ready", "React", "import_internal", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "notifyShellStore", "store", "listener", "subscribeShellStore", "setShellPeek", "peek", "ShellStoreContext", "useShellStore", "part", "ShellInsetContext", "toSidebarMode", "value", "fromSidebarMode", "mode", "toPaneMode", "paneName", "target", "useStoreVersion", "store", "subscribe", "listener", "subscribeShellStore", "useSidebarMode", "useShellStore", "setSidebarMode", "noop", "useShell", "breakpoint", "ready", "useBreakpoint", "actions", "setMode", "name", "setPeekTarget", "setShellPeek", "rail"]
6
+ "names": ["shell_context_exports", "__export", "useShell", "useSidebarMode", "__toCommonJS", "React", "React", "_BREAKPOINTS", "SHELL_BREAKPOINTS", "QUERIES", "_BREAKPOINTS", "mediaQueryLists", "listeners", "cachedBreakpoint", "getMediaQueryLists", "name", "query", "computeBreakpoint", "matched", "mql", "handleChange", "next", "listener", "subscribe", "getSnapshot", "getServerSnapshot", "getReadySnapshot", "getReadyServerSnapshot", "noopSubscribe", "getInitialSnapshot", "useBreakpoint", "enabled", "breakpoint", "subscribe", "getSnapshot", "getServerSnapshot", "ready", "React", "import_internal", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "notifyShellStore", "store", "listener", "subscribeShellStore", "setShellPeek", "peek", "ShellStoreContext", "useShellStore", "part", "ShellFrameContext", "toSidebarMode", "value", "fromSidebarMode", "mode", "toPaneMode", "paneName", "target", "useStoreVersion", "store", "subscribe", "listener", "subscribeShellStore", "useSidebarMode", "useShellStore", "setSidebarMode", "noop", "useShell", "breakpoint", "ready", "useBreakpoint", "actions", "setMode", "name", "setPeekTarget", "setShellPeek", "rail"]
7
7
  }
@@ -30,6 +30,11 @@ export interface ShellRootProps extends React.ComponentPropsWithoutRef<'div'> {
30
30
  declare const Root: React.ForwardRefExoticComponent<ShellRootProps & React.RefAttributes<HTMLDivElement>>;
31
31
  interface ShellHeaderProps extends React.ComponentPropsWithoutRef<'header'> {
32
32
  height?: number;
33
+ /**
34
+ * Sets whether the header joins the app frame. The default is `true`: a hairline under it. Set
35
+ * `flush={false}` to make it a card off the frame.
36
+ */
37
+ flush?: boolean;
33
38
  }
34
39
  declare const Header: React.ForwardRefExoticComponent<ShellHeaderProps & React.RefAttributes<HTMLElement>>;
35
40
  interface LeftProps extends React.ComponentPropsWithoutRef<'div'> {
@@ -42,7 +47,6 @@ interface LeftProps extends React.ComponentPropsWithoutRef<'div'> {
42
47
  collapsible?: boolean;
43
48
  onExpand?: () => void;
44
49
  onCollapse?: () => void;
45
- inset?: boolean;
46
50
  }
47
51
  /**
48
52
  * @deprecated The Root no longer wraps the Rail and Panel in a Left
@@ -71,8 +75,13 @@ type RailProps = React.ComponentPropsWithoutRef<'div'> & {
71
75
  onExpand?: () => void;
72
76
  /** @deprecated Use `onOpenChange`. */
73
77
  onCollapse?: () => void;
74
- /** When true, adds margin and triggers the gray backdrop on the Shell. */
75
- inset?: boolean;
78
+ /**
79
+ * Sets whether this pane joins the app frame. The default is `true`: the pane sits against its
80
+ * neighbours with one hairline between them. Set `flush={false}` to pull it off the frame as a
81
+ * card. It then floats over the content if the content is flush, and otherwise sits on the
82
+ * Shell's background beside a card content.
83
+ */
84
+ flush?: boolean;
76
85
  } & (RailControlledProps | RailUncontrolledProps);
77
86
  declare const Rail: React.ForwardRefExoticComponent<RailProps & React.RefAttributes<HTMLDivElement>>;
78
87
  type HandleComponent = React.ForwardRefExoticComponent<React.ComponentPropsWithoutRef<'div'> & React.RefAttributes<HTMLDivElement>>;
@@ -104,8 +113,13 @@ type PanelPublicProps = PaneBaseProps & (PanelControlledProps | PanelUncontrolle
104
113
  onSizeChange?: (size: number, meta: PanelSizeChangeMeta) => void;
105
114
  sizeUpdate?: 'throttle' | 'debounce';
106
115
  sizeUpdateMs?: number;
107
- /** When true, adds margin and triggers the gray backdrop on the Shell. */
108
- inset?: boolean;
116
+ /**
117
+ * Sets whether this pane joins the app frame. The default is `true`: the pane sits against its
118
+ * neighbours with one hairline between them. Set `flush={false}` to pull it off the frame as a
119
+ * card. It then floats over the content if the content is flush, and otherwise sits on the
120
+ * Shell's background beside a card content.
121
+ */
122
+ flush?: boolean;
109
123
  };
110
124
  type PanelComponent = React.ForwardRefExoticComponent<PanelPublicProps & React.RefAttributes<HTMLDivElement>> & {
111
125
  Handle: HandleComponent;
@@ -118,8 +132,12 @@ type PanelComponent = React.ForwardRefExoticComponent<PanelPublicProps & React.R
118
132
  */
119
133
  declare const Panel: PanelComponent;
120
134
  interface ShellContentProps extends React.ComponentPropsWithoutRef<'main'> {
121
- /** When true, adds margin and triggers the gray backdrop on the Shell. */
122
- inset?: boolean;
135
+ /**
136
+ * Sets whether the work area joins the app frame. The default is `true`. Set `flush={false}`
137
+ * to make it a card on the Shell's background; the panes beside it then sit on that background
138
+ * too, and draw no hairline toward it.
139
+ */
140
+ flush?: boolean;
123
141
  }
124
142
  /**
125
143
  * The work area. It scrolls as it is; with a `Shell.Scroll` child it becomes a column and the
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/components/shell.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,KA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AClB,KAAK,cAAc,IAAI,SAAS,EAChC,KAAK,gBAAgB,IAAI,WAAW,EACpC,KAAK,SAAS,EACd,KAAK,gBAAgB,IAAI,UAAU,EACnC,KAAK,kBAAkB,IAAI,YAAY,EACvC,KAAK,iBAAiB,IAAI,YAAY,EACtC,KAAK,oBAAoB,IAAI,cAAc,EAC3C,KAAK,iBAAiB,IAAI,WAAW,EACrC,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,GACjB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- "use strict";var T=Object.create;var p=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of B(t))!I.call(e,r)&&r!==n&&p(e,r,{get:()=>t[r],enumerable:!(i=E(t,r))||i.enumerable});return e};var d=(e,t,n)=>(n=e!=null?T(w(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),L=e=>y(p({},"__esModule",{value:!0}),e);var $={};C($,{useResponsivePresentation:()=>K});module.exports=L($);var k=d(require("react"));var l=d(require("react"));var P={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},b=["initial","xs","sm","md","lg","xl"];var M=Object.entries(P),c=null,s=new Set,o=null;function f(){return c??(c=M.map(([e,t])=>[e,window.matchMedia(t)])),c}function m(){let e="initial";for(let[t,n]of f())n.matches&&(e=t);return e}function u(){let e=m();e!==o&&(o=e,s.forEach(t=>t()))}function R(e){if(typeof window>"u")return()=>{};if(s.size===0){o=m();for(let[,t]of f())typeof t.addEventListener=="function"?t.addEventListener("change",u):t.addListener?.(u)}return s.add(e),()=>{if(s.delete(e),!(s.size>0)){for(let[,t]of f())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",u):t.removeListener?.(u)}catch{}o=null}}}function N(){return typeof window>"u"?"initial":(o??(o=m()),o)}function O(){return"initial"}var V=()=>!0,z=()=>!1,h=()=>()=>{},A=()=>"initial";function g(e=!0){let t=l.useSyncExternalStore(e?R:h,e?N:A,O),n=l.useSyncExternalStore(e?R:h,V,z);return l.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var a=d(require("react")),_=require("radix-ui/internal");function v(e){return typeof e=="object"&&e!==null}function S(e,t){let n={},i=null;for(let r of b){if(e!==void 0&&!v(e)){n[r]=e;continue}let x=v(e)?e[r]:void 0;x!==void 0&&(i={value:x}),n[r]=i?i.value:t(r)}return n}var W=S("fixed",()=>"fixed");var F=a.createContext(null);var J=a.createContext(null);function K(e){k.useEffect(()=>{},[]);let{breakpoint:t}=g(typeof e!="string");return S(e,()=>"fixed")[t]}
2
+ "use strict";var T=Object.create;var p=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of B(t))!C.call(e,r)&&r!==n&&p(e,r,{get:()=>t[r],enumerable:!(i=E(t,r))||i.enumerable});return e};var d=(e,t,n)=>(n=e!=null?T(w(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)),L=e=>y(p({},"__esModule",{value:!0}),e);var K={};O(K,{useResponsivePresentation:()=>_});module.exports=L(K);var k=d(require("react"));var l=d(require("react"));var P={xs:"(min-width: 520px)",sm:"(min-width: 768px)",md:"(min-width: 1024px)",lg:"(min-width: 1280px)",xl:"(min-width: 1640px)"},b=["initial","xs","sm","md","lg","xl"];var M=Object.entries(P),c=null,s=new Set,o=null;function f(){return c??(c=M.map(([e,t])=>[e,window.matchMedia(t)])),c}function m(){let e="initial";for(let[t,n]of f())n.matches&&(e=t);return e}function u(){let e=m();e!==o&&(o=e,s.forEach(t=>t()))}function R(e){if(typeof window>"u")return()=>{};if(s.size===0){o=m();for(let[,t]of f())typeof t.addEventListener=="function"?t.addEventListener("change",u):t.addListener?.(u)}return s.add(e),()=>{if(s.delete(e),!(s.size>0)){for(let[,t]of f())try{typeof t.removeEventListener=="function"?t.removeEventListener("change",u):t.removeListener?.(u)}catch{}o=null}}}function N(){return typeof window>"u"?"initial":(o??(o=m()),o)}function V(){return"initial"}var z=()=>!0,I=()=>!1,h=()=>()=>{},F=()=>"initial";function g(e=!0){let t=l.useSyncExternalStore(e?R:h,e?N:F,V),n=l.useSyncExternalStore(e?R:h,z,I);return l.useMemo(()=>({breakpoint:t,ready:n}),[t,n])}var a=d(require("react")),A=require("radix-ui/internal");function v(e){return typeof e=="object"&&e!==null}function S(e,t){let n={},i=null;for(let r of b){if(e!==void 0&&!v(e)){n[r]=e;continue}let x=v(e)?e[r]:void 0;x!==void 0&&(i={value:x}),n[r]=i?i.value:t(r)}return n}var H=S("fixed",()=>"fixed");var W=a.createContext(null);var J=a.createContext(null);function _(e){k.useEffect(()=>{},[]);let{breakpoint:t}=g(typeof e!="string");return S(e,()=>"fixed")[t]}
3
3
  //# sourceMappingURL=shell.hooks.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/shell.hooks.ts", "../../../src/hooks/use-breakpoint.ts", "../../../src/components/shell.types.ts", "../../../src/components/_internal/shell-store.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { useBreakpoint } from '../hooks/use-breakpoint.js';\nimport type { PresentationValue, ResponsivePresentation } from './shell.types.js';\nimport { tableOf, warnOnce } from './_internal/shell-store.js';\n\n/**\n * @deprecated Since 0.8.0 the Shell resolves a responsive `presentation` in\n * its stylesheet, so the pane is placed before any script runs. This hook\n * resolves it in JS after mount, which is the behaviour the Shell left\n * behind. It keeps working until 1.0.\n */\nfunction useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue {\n React.useEffect(() => {\n warnOnce('Shell.useResponsivePresentation is deprecated and is removed in 1.0. The Shell resolves presentation in CSS.');\n }, []);\n const { breakpoint } = useBreakpoint(typeof presentation !== 'string');\n return tableOf<PresentationValue>(presentation, () => 'fixed')[breakpoint];\n}\n\nexport { useResponsivePresentation };\n", "'use client';\n\nimport * as React from 'react';\nimport { _BREAKPOINTS, type Breakpoint } from '../components/shell.types.js';\n\nconst QUERIES = Object.entries(_BREAKPOINTS) as Array<[Breakpoint, string]>;\n\ntype Listener = () => void;\n\n/**\n * One set of `MediaQueryList`s and one set of listeners for the whole\n * application. Every component that asks for the breakpoint used to create and\n * subscribe to its own copy of all five queries.\n */\nlet mediaQueryLists: Array<[Breakpoint, MediaQueryList]> | null = null;\nconst listeners = new Set<Listener>();\nlet cachedBreakpoint: Breakpoint | null = null;\n\nfunction getMediaQueryLists() {\n mediaQueryLists ??= QUERIES.map(([name, query]) => [name, window.matchMedia(query)] as [Breakpoint, MediaQueryList]);\n return mediaQueryLists;\n}\n\nfunction computeBreakpoint(): Breakpoint {\n // The largest matching query wins; `_BREAKPOINTS` is ordered smallest first.\n let matched: Breakpoint = 'initial';\n for (const [name, mql] of getMediaQueryLists()) {\n if (mql.matches) matched = name;\n }\n return matched;\n}\n\nfunction handleChange() {\n const next = computeBreakpoint();\n if (next === cachedBreakpoint) return;\n cachedBreakpoint = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: Listener) {\n if (typeof window === 'undefined') return () => {};\n\n if (listeners.size === 0) {\n cachedBreakpoint = computeBreakpoint();\n for (const [, mql] of getMediaQueryLists()) {\n // Safari below 14 only has the deprecated listener API.\n if (typeof mql.addEventListener === 'function') mql.addEventListener('change', handleChange);\n else mql.addListener?.(handleChange);\n }\n }\n\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size > 0) return;\n\n for (const [, mql] of getMediaQueryLists()) {\n try {\n if (typeof mql.removeEventListener === 'function') mql.removeEventListener('change', handleChange);\n else mql.removeListener?.(handleChange);\n } catch (error) {\n // Removal can throw in edge cases, e.g. the list was already torn down.\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[useBreakpoint] MediaQueryList cleanup warning:', error);\n }\n }\n }\n cachedBreakpoint = null;\n };\n}\n\n/**\n * `getSnapshot` must return a referentially stable value between changes, so it\n * reads the cache that `handleChange` maintains rather than recomputing.\n */\nfunction getSnapshot(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n cachedBreakpoint ??= computeBreakpoint();\n return cachedBreakpoint;\n}\n\nfunction getServerSnapshot(): Breakpoint {\n return 'initial';\n}\n\n/**\n * The breakpoint right now, outside React's render. For an effect that needs\n * the answer at the moment it runs rather than the one its render saw.\n */\nexport function readBreakpoint(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n return computeBreakpoint();\n}\n\nconst getReadySnapshot = () => true;\nconst getReadyServerSnapshot = () => false;\n\nconst noopSubscribe = () => () => {};\nconst getInitialSnapshot = (): Breakpoint => 'initial';\n\n/**\n * The current breakpoint, and whether it has been resolved against a real\n * viewport yet (`false` on the server and during hydration).\n *\n * Reads through `useSyncExternalStore` rather than settling into state from an\n * effect. On a client render the very first pass already has the real\n * breakpoint, instead of rendering the whole shell at `initial` and correcting\n * it after the browser has painted.\n *\n * Pass `enabled = false` to skip the subscription (the breakpoint then reads as\n * `initial`).\n */\nexport function useBreakpoint(enabled = true): { breakpoint: Breakpoint; ready: boolean } {\n // Callers with a non-responsive value pass `enabled = false` so they neither\n // subscribe to the media queries nor re-render when the viewport crosses one.\n const breakpoint = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n enabled ? getSnapshot : getInitialSnapshot,\n getServerSnapshot,\n );\n const ready = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n getReadySnapshot,\n getReadyServerSnapshot,\n );\n\n return React.useMemo(() => ({ breakpoint, ready }), [breakpoint, ready]);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Inset \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type InsetPaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellInsetContext = React.createContext<{\n registerInset: (id: InsetPaneId) => void;\n unregisterInset: (id: InsetPaneId) => void;\n} | null>(null);\n\n/** Registers a pane's `inset` with the Root, which paints the backdrop while any pane is inset. */\nexport function useInsetRegistration(id: InsetPaneId, inset: boolean | undefined) {\n const ctx = React.useContext(ShellInsetContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerInset, unregisterInset } = ctx;\n useLayoutEffect(() => {\n if (!inset) return;\n registerInset(id);\n return () => unregisterInset(id);\n }, [id, inset, registerInset, unregisterInset]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport { useBreakpoint } from '../hooks/use-breakpoint.js';\nimport type { PresentationValue, ResponsivePresentation } from './shell.types.js';\nimport { tableOf, warnOnce } from './_internal/shell-store.js';\n\n/**\n * @deprecated Since 0.8.0 the Shell resolves a responsive `presentation` in\n * its stylesheet, so the pane is placed before any script runs. This hook\n * resolves it in JS after mount, which is the behaviour the Shell left\n * behind. It keeps working until 1.0.\n */\nfunction useResponsivePresentation(presentation: ResponsivePresentation): PresentationValue {\n React.useEffect(() => {\n warnOnce('Shell.useResponsivePresentation is deprecated and is removed in 1.0. The Shell resolves presentation in CSS.');\n }, []);\n const { breakpoint } = useBreakpoint(typeof presentation !== 'string');\n return tableOf<PresentationValue>(presentation, () => 'fixed')[breakpoint];\n}\n\nexport { useResponsivePresentation };\n", "'use client';\n\nimport * as React from 'react';\nimport { _BREAKPOINTS, type Breakpoint } from '../components/shell.types.js';\n\nconst QUERIES = Object.entries(_BREAKPOINTS) as Array<[Breakpoint, string]>;\n\ntype Listener = () => void;\n\n/**\n * One set of `MediaQueryList`s and one set of listeners for the whole\n * application. Every component that asks for the breakpoint used to create and\n * subscribe to its own copy of all five queries.\n */\nlet mediaQueryLists: Array<[Breakpoint, MediaQueryList]> | null = null;\nconst listeners = new Set<Listener>();\nlet cachedBreakpoint: Breakpoint | null = null;\n\nfunction getMediaQueryLists() {\n mediaQueryLists ??= QUERIES.map(([name, query]) => [name, window.matchMedia(query)] as [Breakpoint, MediaQueryList]);\n return mediaQueryLists;\n}\n\nfunction computeBreakpoint(): Breakpoint {\n // The largest matching query wins; `_BREAKPOINTS` is ordered smallest first.\n let matched: Breakpoint = 'initial';\n for (const [name, mql] of getMediaQueryLists()) {\n if (mql.matches) matched = name;\n }\n return matched;\n}\n\nfunction handleChange() {\n const next = computeBreakpoint();\n if (next === cachedBreakpoint) return;\n cachedBreakpoint = next;\n listeners.forEach((listener) => listener());\n}\n\nfunction subscribe(listener: Listener) {\n if (typeof window === 'undefined') return () => {};\n\n if (listeners.size === 0) {\n cachedBreakpoint = computeBreakpoint();\n for (const [, mql] of getMediaQueryLists()) {\n // Safari below 14 only has the deprecated listener API.\n if (typeof mql.addEventListener === 'function') mql.addEventListener('change', handleChange);\n else mql.addListener?.(handleChange);\n }\n }\n\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n if (listeners.size > 0) return;\n\n for (const [, mql] of getMediaQueryLists()) {\n try {\n if (typeof mql.removeEventListener === 'function') mql.removeEventListener('change', handleChange);\n else mql.removeListener?.(handleChange);\n } catch (error) {\n // Removal can throw in edge cases, e.g. the list was already torn down.\n if (process.env.NODE_ENV !== 'production') {\n console.warn('[useBreakpoint] MediaQueryList cleanup warning:', error);\n }\n }\n }\n cachedBreakpoint = null;\n };\n}\n\n/**\n * `getSnapshot` must return a referentially stable value between changes, so it\n * reads the cache that `handleChange` maintains rather than recomputing.\n */\nfunction getSnapshot(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n cachedBreakpoint ??= computeBreakpoint();\n return cachedBreakpoint;\n}\n\nfunction getServerSnapshot(): Breakpoint {\n return 'initial';\n}\n\n/**\n * The breakpoint right now, outside React's render. For an effect that needs\n * the answer at the moment it runs rather than the one its render saw.\n */\nexport function readBreakpoint(): Breakpoint {\n if (typeof window === 'undefined') return 'initial';\n return computeBreakpoint();\n}\n\nconst getReadySnapshot = () => true;\nconst getReadyServerSnapshot = () => false;\n\nconst noopSubscribe = () => () => {};\nconst getInitialSnapshot = (): Breakpoint => 'initial';\n\n/**\n * The current breakpoint, and whether it has been resolved against a real\n * viewport yet (`false` on the server and during hydration).\n *\n * Reads through `useSyncExternalStore` rather than settling into state from an\n * effect. On a client render the very first pass already has the real\n * breakpoint, instead of rendering the whole shell at `initial` and correcting\n * it after the browser has painted.\n *\n * Pass `enabled = false` to skip the subscription (the breakpoint then reads as\n * `initial`).\n */\nexport function useBreakpoint(enabled = true): { breakpoint: Breakpoint; ready: boolean } {\n // Callers with a non-responsive value pass `enabled = false` so they neither\n // subscribe to the media queries nor re-render when the viewport crosses one.\n const breakpoint = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n enabled ? getSnapshot : getInitialSnapshot,\n getServerSnapshot,\n );\n const ready = React.useSyncExternalStore(\n enabled ? subscribe : noopSubscribe,\n getReadySnapshot,\n getReadyServerSnapshot,\n );\n\n return React.useMemo(() => ({ breakpoint, ready }), [breakpoint, ready]);\n}\n", "import type * as React from 'react';\n\nexport type PresentationValue = 'fixed' | 'overlay' | 'stacked';\n\nexport type ResponsivePresentation = PresentationValue | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PresentationValue>>;\n\nexport type PaneMode = 'expanded' | 'collapsed';\nexport type SidebarMode = 'collapsed' | 'expanded';\n\nexport type ResponsiveMode = PaneMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', PaneMode>>;\n\nexport type ResponsiveSidebarMode = SidebarMode | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', SidebarMode>>;\n\nexport type Responsive<T> = T | Partial<Record<'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', T>>;\n\nexport type PaneSizePersistence = {\n load?: () => number | Promise<number | undefined> | undefined;\n save?: (size: number) => void | Promise<void>;\n};\n\n/**\n * Why a pane's open state changed. Since 0.8.0 only a user action is reported:\n * `toggle` for a Trigger, a handle double-click or a drag past\n * `collapseThreshold`, and `dismiss` for Escape or a press on the scrim.\n * `init`, `responsive`, `panel` and `left` are kept in the types for\n * compatibility and are never sent.\n */\nexport type PaneOpenChangeReason = 'toggle' | 'dismiss' | 'init' | 'responsive';\n\nexport interface PaneBaseProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onExpand?: () => void;\n /** @deprecated Use `onOpenChange`. Still called when a user's toggle or a controlled prop changes whether the pane is shown; never on mount or when the window crosses a breakpoint. */\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n /** @deprecated Removed in 1.0. Snap in your own `onSizeChange` and pass `size`. */\n snapPoints?: number[];\n /** @deprecated Removed in 1.0, with `snapPoints`. */\n snapTolerance?: number;\n /** @deprecated Removed in 1.0. Close the pane from your own `onResizeEnd`. */\n collapseThreshold?: number;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n paneId?: string;\n /** @deprecated Removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`. */\n persistence?: PaneSizePersistence;\n}\n\nexport const _BREAKPOINTS = {\n xs: '(min-width: 520px)',\n sm: '(min-width: 768px)',\n md: '(min-width: 1024px)',\n lg: '(min-width: 1280px)',\n xl: '(min-width: 1640px)',\n} as const;\n\nexport type Breakpoint = 'initial' | keyof typeof _BREAKPOINTS;\n\n/** Every breakpoint, smallest first. The stylesheet's @media blocks follow this order. */\nexport const SHELL_BREAKPOINTS: readonly Breakpoint[] = ['initial', 'xs', 'sm', 'md', 'lg', 'xl'];\n\nexport type PaneTarget = 'left' | 'rail' | 'panel' | 'sidebar' | 'inspector' | 'bottom';\n\n/** The panes a Trigger can drive. `left` is the deprecated name for `rail`. */\nexport type PaneName = Exclude<PaneTarget, 'left'>;\n\n/**\n * CSS custom property key type for type-safe style objects.\n * Allows any string prefixed with '--'.\n */\nexport type CSSCustomProperty = `--${string}`;\n\n/**\n * Style object that supports CSS custom properties.\n */\nexport type CSSPropertiesWithVars = React.CSSProperties & {\n [key: CSSCustomProperty]: string | number | undefined;\n};\n", "'use client';\n\n/**\n * The Shell's state model (0.8.0), ported from kookie-ui-v2's Shell.\n *\n * - State lives on the pane. Each pane holds `auto | open | closed`.\n * `auto` means untouched: the stylesheet decides what\n * it shows at each breakpoint, so first paint is right with no script, the\n * server and the client render the same markup, and no open-state callback\n * can fire on mount or on a resize.\n * - The one thing that crosses the Shell is a registry keyed by pane name.\n * Each pane registers what it is and how to drive it; a Trigger looks its\n * pane up, and the Root reads the set of live overlays. Nothing scans\n * children and nothing checks `displayName`.\n * - The responsive props are resolved into a table with one value per\n * breakpoint, from the props alone, with no window. The table is written to\n * the DOM as data attributes for the stylesheet, and read again in JS by the\n * mirror that sets `aria-expanded`. One table, two readers, so they agree by\n * construction.\n */\nimport * as React from 'react';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { SHELL_BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneName, PresentationValue } from '../shell.types.js';\n\n/* \u2500\u2500 Breakpoint tables \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type Table<T> = Record<Breakpoint, T>;\n\n/** What a pane shows: open or closed. */\nexport type PaneValue = 'open' | 'closed';\n\ntype ResponsiveInput<T> = T | Partial<Record<Breakpoint, T>> | undefined;\n\nfunction isMap<T>(value: ResponsiveInput<T>): value is Partial<Record<Breakpoint, T>> {\n return typeof value === 'object' && value !== null;\n}\n\n/**\n * A responsive value at every breakpoint. A breakpoint takes the largest key\n * at or below it, the same fallback `useResponsiveValue` used; a breakpoint\n * below every key takes `fallback`.\n */\nexport function tableOf<T>(value: ResponsiveInput<T>, fallback: (bp: Breakpoint) => T): Table<T> {\n const table = {} as Table<T>;\n let carried: { value: T } | null = null;\n for (const bp of SHELL_BREAKPOINTS) {\n if (value !== undefined && !isMap(value)) {\n table[bp] = value;\n continue;\n }\n const entry = isMap(value) ? value[bp] : undefined;\n if (entry !== undefined) carried = { value: entry };\n table[bp] = carried ? carried.value : fallback(bp);\n }\n return table;\n}\n\n/** The table's one value, when it has only one. */\nexport function constantOf<T>(table: Table<T>): T | undefined {\n const first = table.initial;\n return SHELL_BREAKPOINTS.every((bp) => table[bp] === first) ? first : undefined;\n}\n\n/**\n * The table as data attributes: `data-<name>` when it holds one value, one\n * `data-<name>-<bp>` per breakpoint when it holds several. The stylesheet has\n * a rule for each spelling.\n */\nexport function tableAttributes(name: string, table: Table<string>): Record<string, string> {\n const constant = constantOf(table);\n if (constant !== undefined) return { [`data-${name}`]: constant };\n const attributes: Record<string, string> = {};\n for (const bp of SHELL_BREAKPOINTS) attributes[`data-${name}-${bp}`] = table[bp];\n return attributes;\n}\n\n/**\n * A responsive prop object is usually an inline literal, a new identity every\n * render. Keying memoisation on its contents keeps the tables, and so the\n * registry entries, stable across renders that change nothing.\n */\nexport function useStableKey(value: unknown): string {\n return typeof value === 'object' && value !== null ? JSON.stringify(value) : String(value);\n}\n\nexport const FIXED_TABLE: Table<PresentationValue> = tableOf<PresentationValue>('fixed', () => 'fixed');\n\n/* \u2500\u2500 The registry \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type OpenChangeReason = 'toggle' | 'dismiss';\n\nexport type PaneEntry = {\n name: PaneName;\n id: string;\n el: HTMLElement | null;\n /** What the pane shows now; `undefined` while an untouched pane cannot know (before the breakpoint is known). */\n value: PaneValue | undefined;\n /** How the pane is presented now, when known. */\n presentation: PresentationValue | undefined;\n /** The pane's own presentation at every breakpoint. A Panel with none of its own follows the Rail's. */\n presentationTable: Table<PresentationValue>;\n /** Open and presented as an overlay: what the scrim and Escape close, and what containment exempts. */\n overlayLive: boolean;\n /** The pane's designed open width, for panes that sit beside it when floating. */\n size: number;\n setValue: (value: PaneValue, reason: OpenChangeReason) => void;\n toggle: (reason: OpenChangeReason) => void;\n};\n\nexport type ShellStore = {\n entries: Map<PaneName, PaneEntry>;\n listeners: Set<() => void>;\n /**\n * What a subscriber reads. useSyncExternalStore needs a value that is stable\n * between notifications, and a number is; the Map, or anything derived from\n * it, would be a new identity on every read.\n */\n version: number;\n /** The pane a hovered Trigger is previewing, if any. Layout only. */\n peek: PaneName | null;\n};\n\nexport function createShellStore(): ShellStore {\n return { entries: new Map(), listeners: new Set(), version: 0, peek: null };\n}\n\nexport function notifyShellStore(store: ShellStore) {\n store.version += 1;\n for (const listener of store.listeners) listener();\n}\n\nexport function subscribeShellStore(store: ShellStore, listener: () => void) {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n}\n\nexport function setShellPeek(store: ShellStore, peek: PaneName | null) {\n if (store.peek === peek) return;\n store.peek = peek;\n notifyShellStore(store);\n}\n\nexport const ShellStoreContext = React.createContext<ShellStore | null>(null);\n\nexport function useShellStore(part: string): ShellStore {\n const store = React.useContext(ShellStoreContext);\n if (!store) throw new Error(`${part} must be used within <Shell.Root>`);\n return store;\n}\n\n/** One pane's registry entry. Re-renders only when that entry is replaced. */\nexport function usePaneEntry(store: ShellStore, name: PaneName): PaneEntry | undefined {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n const getSnapshot = React.useCallback(() => store.entries.get(name), [store, name]);\n return React.useSyncExternalStore(subscribe, getSnapshot, () => undefined);\n}\n\n/**\n * Whether this pane is the one being previewed. A boolean per pane rather than\n * the peek target itself, so hovering one Trigger re-renders one pane, not all.\n */\nexport function usePeeking(store: ShellStore, name: PaneName): boolean {\n const subscribe = React.useCallback((listener: () => void) => subscribeShellStore(store, listener), [store]);\n return React.useSyncExternalStore(\n subscribe,\n () => store.peek === name,\n () => false,\n );\n}\n\n/* \u2500\u2500 Off the frame \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nexport type FramePaneId = 'rail' | 'panel' | 'sidebar' | 'content' | 'inspector' | 'bottom';\n\nexport const ShellFrameContext = React.createContext<{\n registerOffFrame: (id: FramePaneId) => void;\n unregisterOffFrame: (id: FramePaneId) => void;\n} | null>(null);\n\n/** Tells the Root a pane is off the frame (`flush={false}`); the Rail's card moves a floating Panel over. */\nexport function useFrameRegistration(id: FramePaneId, flush: boolean) {\n const ctx = React.useContext(ShellFrameContext);\n if (!ctx) throw new Error('Shell panes must be used within <Shell.Root>');\n const { registerOffFrame, unregisterOffFrame } = ctx;\n useLayoutEffect(() => {\n if (flush) return;\n registerOffFrame(id);\n return () => unregisterOffFrame(id);\n }, [id, flush, registerOffFrame, unregisterOffFrame]);\n}\n\n/* \u2500\u2500 Development warnings \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n\nconst warned = new Set<string>();\n\n/** A deprecation warning, once per message per page load. Development only. */\nexport function warnOnce(message: string) {\n if (process.env.NODE_ENV === 'production') return;\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[kookie-ui] ${message}`);\n}\n"],
5
5
  "mappings": ";0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBCEvB,IAAAC,EAAuB,oBCqDhB,IAAMC,EAAe,CAC1B,GAAI,qBACJ,GAAI,qBACJ,GAAI,sBACJ,GAAI,sBACJ,GAAI,qBACN,EAKaC,EAA2C,CAAC,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AMC,EAAmB,IAAM,GACzBC,EAAyB,IAAM,GAE/BC,EAAgB,IAAM,IAAM,CAAC,EAC7BC,EAAqB,IAAkB,UActC,SAASC,EAAcC,EAAU,GAAkD,CAGxF,IAAMC,EAAmB,uBACvBD,EAAUE,EAAYL,EACtBG,EAAUG,EAAcL,EACxBM,CACF,EACMC,EAAc,uBAClBL,EAAUE,EAAYL,EACtBF,EACAC,CACF,EAEA,OAAa,UAAQ,KAAO,CAAE,WAAAK,EAAY,MAAAI,CAAM,GAAI,CAACJ,EAAYI,CAAK,CAAC,CACzE,CE5GA,IAAAC,EAAuB,oBACvBC,EAAgC,6BAahC,SAASC,EAASC,EAAoE,CACpF,OAAO,OAAOA,GAAU,UAAYA,IAAU,IAChD,CAOO,SAASC,EAAWD,EAA2BE,EAA2C,CAC/F,IAAMC,EAAQ,CAAC,EACXC,EAA+B,KACnC,QAAWC,KAAMC,EAAmB,CAClC,GAAIN,IAAU,QAAa,CAACD,EAAMC,CAAK,EAAG,CACxCG,EAAME,CAAE,EAAIL,EACZ,QACF,CACA,IAAMO,EAAQR,EAAMC,CAAK,EAAIA,EAAMK,CAAE,EAAI,OACrCE,IAAU,SAAWH,EAAU,CAAE,MAAOG,CAAM,GAClDJ,EAAME,CAAE,EAAID,EAAUA,EAAQ,MAAQF,EAASG,CAAE,CACnD,CACA,OAAOF,CACT,CA8BO,IAAMK,EAAwCC,EAA2B,QAAS,IAAM,OAAO,EA2D/F,IAAMC,EAA0B,gBAAiC,IAAI,EAgCrE,IAAMC,EAA0B,gBAG7B,IAAI,EHzKd,SAASC,EAA0BC,EAAyD,CACpF,YAAU,IAAM,CAEtB,EAAG,CAAC,CAAC,EACL,GAAM,CAAE,WAAAC,CAAW,EAAIC,EAAc,OAAOF,GAAiB,QAAQ,EACrE,OAAOG,EAA2BH,EAAc,IAAM,OAAO,EAAEC,CAAU,CAC3E",
6
- "names": ["shell_hooks_exports", "__export", "useResponsivePresentation", "__toCommonJS", "React", "React", "_BREAKPOINTS", "SHELL_BREAKPOINTS", "QUERIES", "_BREAKPOINTS", "mediaQueryLists", "listeners", "cachedBreakpoint", "getMediaQueryLists", "name", "query", "computeBreakpoint", "matched", "mql", "handleChange", "next", "listener", "subscribe", "getSnapshot", "getServerSnapshot", "getReadySnapshot", "getReadyServerSnapshot", "noopSubscribe", "getInitialSnapshot", "useBreakpoint", "enabled", "breakpoint", "subscribe", "getSnapshot", "getServerSnapshot", "ready", "React", "import_internal", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "ShellStoreContext", "ShellInsetContext", "useResponsivePresentation", "presentation", "breakpoint", "useBreakpoint", "tableOf"]
6
+ "names": ["shell_hooks_exports", "__export", "useResponsivePresentation", "__toCommonJS", "React", "React", "_BREAKPOINTS", "SHELL_BREAKPOINTS", "QUERIES", "_BREAKPOINTS", "mediaQueryLists", "listeners", "cachedBreakpoint", "getMediaQueryLists", "name", "query", "computeBreakpoint", "matched", "mql", "handleChange", "next", "listener", "subscribe", "getSnapshot", "getServerSnapshot", "getReadySnapshot", "getReadyServerSnapshot", "noopSubscribe", "getInitialSnapshot", "useBreakpoint", "enabled", "breakpoint", "subscribe", "getSnapshot", "getServerSnapshot", "ready", "React", "import_internal", "isMap", "value", "tableOf", "fallback", "table", "carried", "bp", "SHELL_BREAKPOINTS", "entry", "FIXED_TABLE", "tableOf", "ShellStoreContext", "ShellFrameContext", "useResponsivePresentation", "presentation", "breakpoint", "useBreakpoint", "tableOf"]
7
7
  }