@pasquelin/panels 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +247 -237
- package/llms-full.txt +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to `@pasquelin/panels`.
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
6
6
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.2] — 2026-09-02
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **A declaration that says the same thing writes nothing.** A project builds its panel list in
|
|
13
|
+
its render, so the list arrives rebuilt whenever anything else in that component moves — and
|
|
14
|
+
`declare` wrote it through, notifying every rail, every zone and every frame for a list
|
|
15
|
+
identical to the one they already held. Measured in a real application: five rewrites for five
|
|
16
|
+
renders that had nothing to do with the panels. The specs are now compared field by field.
|
|
17
|
+
|
|
8
18
|
## [0.3.1] — 2026-09-02
|
|
9
19
|
|
|
10
20
|
### Fixed
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("react"),b=require("./cx-YyuC5RtB.cjs"),fe=e=>{let n;const t=new Set,s=(u,f)=>{const h=typeof u=="function"?u(n):u;if(!Object.is(h,n)){const m=n;n=f??(typeof h!="object"||h===null)?h:Object.assign({},n,h),t.forEach(g=>g(n,m))}},l=()=>n,o={setState:s,getState:l,getInitialState:()=>c,subscribe:u=>(t.add(u),()=>t.delete(u))},c=n=e(s,l,o);return o},$e=(e=>e?fe(e):fe),qe=e=>e;function Ge(e,n=qe){const t=d.useSyncExternalStore(e.subscribe,d.useCallback(()=>n(e.getState()),[e,n]),d.useCallback(()=>n(e.getInitialState()),[e,n]));return d.useDebugValue(t),t}const O=["left","right","top","bottomLeft","bottomRight"],re=["primary","secondary"],Y="default",be=["bottomLeft","bottomRight"];function $(e){return e==="bottomLeft"||e==="bottomRight"}function L(e){return e==="top"||$(e)}const U={left:{column:["left","top"],band:"bottomLeft"},right:{column:["right"],band:"bottomRight"}};function X(e){return e==="left"||e==="top"}const F=140,ie=240,M=100,xe={left:320,right:260,top:180,bottomLeft:240,bottomRight:240},Se="bottomRight";function A(e){return $(e)?Se:e}const I={left:"right",right:"left",top:Se,bottomLeft:"top",bottomRight:"top"};function we(e,n,t){return Math.min(Math.max(e,n),t)}function ce(e,n,t){const s=Math.max(F,Math.round(n-t-ie));return we(Math.round(e),F,s)}function B(e,n){const t=Math.max(M,Math.round(n-M));return we(Math.round(e),M,t)}function ye(e,n,t,s){return t(n)?e.sizes[A(n)]??s(n):0}function Je(e,n,t,s,l){const r={...e.sizes},i={...e.splits};for(const c of O){const u=r[c];if(u!==void 0){const h=L(c)?t:n,m=ye(e,I[c],s,l);r[c]=ce(u,h,m)}const f=i[c];f!==void 0&&(i[c]=B(f,L(c)?n:t))}const o=e.bandSplit===void 0?void 0:B(e.bandSplit,n);return{sizes:r,splits:i,bandSplit:o}}function je(e,n,t){const s=t-ie,l=e+n;if(l<=s)return[e,n];const r=u=>u===0?0:F,i=r(e)+r(n);if(s<=i)return[Math.min(e,r(e)),Math.min(n,r(n))];const o=s/l,c=Math.max(r(e),Math.round(e*o));return[c,Math.max(r(n),Math.round(s-c))]}function Z(e){return e.views[e.view]??{}}function K(e,n){const t={...n??{}};for(const s of O)for(const l of re)t[s]?.[l]===void 0&&Pe(e,s,l)!==void 0&&(t[s]={...t[s],[l]:null});return t}function Q(e,n){return Object.hasOwn(e.views,n)}function Pe(e,n,t){return e.find(s=>s.zone===n&&s.slot===t)}function E(e,n){return n==null?void 0:e.find(t=>t.id===n)}function he(e,n,t){const s=Z(e)[n];if(!s||!(t in s))return;const l=E(e.registry,s[t]);return l?.zone===n&&l.slot===t?l:Pe(e.registry,n,t)}function N(e,n){const t=he(e,n,"primary");return t?.solo===!0?{primary:t}:{primary:t,secondary:he(e,n,"secondary")}}function R(e,n){const{primary:t,secondary:s}=N(e,n);return{primary:t?.id,secondary:s?.id}}function D(e,n){return $(n)?be.some(t=>H(e,t)):H(e,n)}function H(e,n){const t=R(e,n);return t.primary!==void 0||t.secondary!==void 0}function V(e,n){return Math.max(xe[e],n?.opens??0)}function Ke(e,n,t,s){const{slot:l,id:r}=t,i=Z(e)[n]??{},o={...e.stashed};if(t.solo===!0&&l==="primary")return o[n]=i,[{[l]:r},o];if(s?.solo!==!0)return[{...i,[l]:r},e.stashed];const c=o[n];if(delete o[n],c)return[{...c,[l]:r},o];const u={...i,[l]:r};return l!==s.slot&&delete u[s.slot],[u,o]}function Xe(e,n,t){const s=Z(e)[n]??{},l=s[t],r=e.stashed[n];if(r&&l!==void 0&&E(e.registry,l)?.solo===!0){const o={...e.stashed};return delete o[n],[r,o]}const i={...s};return delete i[t],[i,e.stashed]}const pe={sizes:{},splits:{}};function Qe(e,n){return e.bandSplit!==n.bandSplit?!1:O.every(t=>e.sizes[t]===n.sizes[t]&&e.splits[t]===n.splits[t])}function Ne(e={}){const n=e.initial,t=(s,l)=>({...s.views,[s.view]:l});return $e()((s,l)=>({registry:[],view:e.view??Y,views:n?.views??{},lengths:n?.lengths??pe,focusedZone:null,stashed:{},available:{width:0,height:0},declare:r=>s({registry:r}),settle:r=>s(i=>{const o=r??i.defaults;return Q(i,i.view)?o===i.defaults?i:{defaults:o}:{views:t(i,K(i.registry,o)),defaults:o}}),setView:r=>s(i=>i.view===r?i:{view:r,views:Q(i,r)?i.views:{...i.views,[r]:K(i.registry,i.defaults)},focusedZone:null,stashed:{}}),show:r=>s(i=>{const o=E(i.registry,r);if(!o)return i;const{zone:c}=o,u=N(i,c);if(u[o.slot]?.id===r)return{focusedZone:c};const[f,h]=Ke(i,c,o,u.primary);return{views:t(i,{...Z(i),[c]:f}),stashed:h,focusedZone:c}}),close:(r,i)=>s(o=>{const[c,u]=Xe(o,r,i),f=t(o,{...Z(o),[r]:c}),h=H({registry:o.registry,view:o.view,views:f},r);return{views:f,stashed:u,focusedZone:!h&&o.focusedZone===r?null:o.focusedZone}}),toggle:r=>{const i=l(),o=E(i.registry,r);o&&(R(i,o.zone)[o.slot]===r?i.close(o.zone,o.slot):i.show(r))},focus:r=>s(i=>i.focusedZone===r?i:{focusedZone:r}),resize:(r,i,o)=>s(c=>{const u=ye(c.lengths,I[r],m=>D(c,m),m=>V(m,N(c,m).primary)),f=ce(i,o,u),h=A(r);return f===c.lengths.sizes[h]?c:{lengths:{...c.lengths,sizes:{...c.lengths.sizes,[h]:f}}}}),resplit:(r,i,o)=>s(c=>{const u=B(i,o);return u===c.lengths.splits[r]?c:{lengths:{...c.lengths,splits:{...c.lengths.splits,[r]:u}}}}),resplitBand:(r,i)=>s(o=>{const c=B(r,i);return c===o.lengths.bandSplit?o:{lengths:{...o.lengths,bandSplit:c}}}),fit:(r,i)=>s(o=>{const c=Je(o.lengths,r,i,h=>D(o,h),h=>V(h,N(o,h).primary)),u=Qe(o.lengths,c)?o.lengths:c,{available:f}=o;return u===o.lengths&&f.width===r&&f.height===i?o:{available:{width:r,height:i},lengths:u}}),reset:()=>s(r=>({views:r.registry.length===0?{}:{[r.view]:K(r.registry,r.defaults)},lengths:pe,focusedZone:null,stashed:{},registry:r.registry}))}))}const en=()=>{const e=new Map;return{read:n=>e.get(n)??null,write:(n,t)=>{e.set(n,t)}}},Ee=()=>({read:e=>{try{return globalThis.localStorage?.getItem(e)??null}catch{return null}},write:(e,n)=>{try{globalThis.localStorage?.setItem(e,n)}catch{}}}),le=2;function P(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function me(e){const n={};for(const t of O){const s=e[t];if(P(s))for(const l of re){const r=s[l];r!==null&&typeof r!="string"||(n[t]={...n[t],[l]:r})}}return n}function ge(e){const n={};for(const t of O){const s=e[t];typeof s=="number"&&Number.isFinite(s)&&(n[t]=s)}return n}function nn(e,n){if(e.version===1)return P(e.open)?{[n]:me(e.open)}:void 0;if(e.version!==le||!P(e.views))return;const t=Object.create(null);for(const[s,l]of Object.entries(e.views))P(l)&&(t[s]=me(l));return t}function _e(e,n,t=Y){const s=e.read(n);if(s===null)return;let l;try{l=JSON.parse(s)}catch{return}if(!P(l)||!P(l.lengths))return;const r=nn(l,t);if(!r)return;const i=l.lengths;if(!P(i.sizes)||!P(i.splits))return;const o=i.bandSplit;return{views:r,lengths:{sizes:ge(i.sizes),splits:ge(i.splits),bandSplit:typeof o=="number"&&Number.isFinite(o)?o:void 0}}}function Ce(e,n,t){const s={version:le,views:t.views,lengths:t.lengths};e.write(n,JSON.stringify(s))}const Ie=typeof globalThis.document>"u"?d.useEffect:d.useLayoutEffect,Me=d.createContext(null),tn=250;function Le({store:e,storageKey:n="panels:layout",storage:t,defaultOpen:s,view:l,children:r}){const[i]=d.useState(()=>t===null?null:t??Ee()),[o]=d.useState(()=>{const c=l??Y,u=i?_e(i,n,c):void 0;return e?(u&&e.setState(u),e):Ne({view:c,initial:u})});return Ie(()=>{const c=o.getState();l!==void 0&&c.setView(l),c.settle(s)}),d.useEffect(()=>{if(!i)return;let c,u,f;const h=()=>{f!==void 0&&clearTimeout(f),f=void 0,u&&(c=u,u=void 0,Ce(i,n,c))},m=o.subscribe(g=>{if(!Q(g,g.view))return;const S=u??c;S?.views===g.views&&S.lengths===g.lengths||(u={views:g.views,lengths:g.lengths},f??=setTimeout(h,tn))});return globalThis.addEventListener?.("pagehide",h),()=>{m(),globalThis.removeEventListener?.("pagehide",h),h()}},[i,o,n]),a.jsx(Me.Provider,{value:o,children:r})}function T(){const e=d.useContext(Me);if(!e)throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");return e}function v(e){const n=T();return Ge(n,e)}function z(){const e=T();return d.useMemo(()=>{const{show:n,close:t,toggle:s,focus:l,resize:r,resplit:i,resplitBand:o,fit:c,reset:u}=e.getState();return{show:n,close:t,toggle:s,focus:l,resize:r,resplit:i,resplitBand:o,fit:c,reset:u}},[e])}function Ze({icon:e,label:n,active:t,accented:s,acts:l,className:r,children:i,ref:o,...c}){return a.jsxs("button",{type:"button",ref:o,"aria-label":n,"aria-pressed":l?void 0:t,className:b.cx("pnl-icon-button",t&&"pnl-icon-button--active",s&&"pnl-icon-button--accented",r),...c,children:[e!==void 0&&a.jsx("span",{className:"pnl-icon-button__glyph",children:e}),i]})}const ee={IconButton:Ze},Re=d.createContext(ee),sn=Re.Provider;function ae(){return d.useContext(Re)}function on(e){return e===void 0?ee:{...ee,...e}}function Oe(e){const n=T();d.useEffect(()=>{const t=e.current;if(!t)return;const s=()=>{const{clientWidth:r,clientHeight:i}=t;r===0||i===0||n.getState().fit(r,i)};if(s(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(s);return l.observe(t),()=>l.disconnect()},[e,n])}function _(){const e=v(s=>s.registry),n=v(s=>s.view),t=v(s=>s.views[s.view]);return d.useMemo(()=>({registry:e,view:n,views:t===void 0?{}:{[n]:t}}),[e,n,t])}function Te(e){const n=_();return d.useMemo(()=>R(n,e),[n,e])}function rn(e){const n=_();return d.useMemo(()=>N(n,e),[n,e])}function ne(e){const n=_();return d.useMemo(()=>H(n,e),[n,e])}function cn(e){const n=_();return d.useMemo(()=>D(n,e),[n,e])}function ze(){return{left:ne(U.left.band),right:ne(U.right.band)}}function ke(){const e=d.useRef(null);return d.useMemo(()=>({start:(t,s)=>{t.currentTarget.setPointerCapture(t.pointerId),e.current={...s,pointerId:t.pointerId}},matching:t=>e.current?.pointerId===t.pointerId?e.current:null,cancel:()=>{e.current=null}}),[])}function W({axis:e,invert:n=!1,size:t,onSize:s,measure:l,label:r,min:i,max:o,step:c=16,className:u}){const f=ke(),h=d.useRef(null),m=e==="vertical",g=d.useCallback(p=>(m?p?.clientHeight:p?.clientWidth)??0,[m]),S=d.useCallback(p=>{const y=f.matching(p);if(!y)return;const w=(m?p.clientY:p.clientX)-y.position;s(y.size+w*(n?-1:1),y.available)},[f,n,m,s]),x=d.useCallback(p=>{const y=m?"ArrowUp":"ArrowLeft",C=m?"ArrowDown":"ArrowRight";if(p.key!==y&&p.key!==C)return;const w=g(h.current?.parentElement),k=t??l?.()??0,Ye=p.key===C?1:-1;p.preventDefault(),s(k+c*Ye*(n?-1:1),w)},[n,m,l,s,g,t,c]);return a.jsx("div",{ref:h,role:"separator",tabIndex:0,"aria-label":r,"aria-orientation":m?"horizontal":"vertical","aria-valuenow":t===void 0?void 0:Math.round(t),"aria-valuemin":i,"aria-valuemax":o,onPointerDown:p=>{p.button!==0||!p.isPrimary||f.start(p,{position:m?p.clientY:p.clientX,size:t??l?.()??0,available:g(p.currentTarget.parentElement)})},onPointerMove:S,onPointerUp:f.cancel,onPointerCancel:f.cancel,onLostPointerCapture:f.cancel,onKeyDown:x,className:b.cx("pnl-handle",m?"pnl-handle--row":"pnl-handle--col",u)})}function ve(e,n,t,s){return s?n??V(t,e):0}function Fe(e){const n=_(),t=v(o=>o.lengths.sizes[A(e)]),s=v(o=>o.lengths.sizes[A(I[e])]),l=v(o=>o.lengths.splits[e]),r=v(o=>L(e)?o.available.height:o.available.width),i=v(o=>o.focusedZone===e);return d.useMemo(()=>{const{primary:o,secondary:c}=N(n,e),u=o!==void 0||c!==void 0,f=N(n,I[e]),h=D(n,I[e]),m=ve(o,t,e,u),g=ve(f.primary,s,I[e],h);return{primary:o,secondary:c,draws:u,size:r===0?m:je(m,g,r)[0],split:l,focused:i}},[n,t,s,r,l,i,e])}function Ae(e){const n=v(t=>t.registry);return d.useMemo(()=>[["primary",n.filter(s=>s.zone===e&&s.slot==="primary")],["secondary",n.filter(s=>s.zone===e&&s.slot==="secondary")]].filter(([,s])=>s.length>0),[n,e])}const Be=d.createContext(new Map),De=Be.Provider;function He(e){return d.useContext(Be).get(e)}function Ue({title:e,children:n,fillActions:t,trailing:s,className:l}){return a.jsxs("header",{className:b.cx("pnl-header",l),children:[a.jsx("span",{className:b.cx("pnl-header__title",t&&"pnl-header__title--fixed"),children:e}),a.jsx("span",{className:b.cx("pnl-header__actions",t&&"pnl-header__actions--fill"),children:n}),a.jsx("span",{className:"pnl-header__trailing",children:s})]})}function q({orientation:e="vertical",className:n}){return a.jsx("span",{"aria-hidden":"true",className:b.cx("pnl-separator",`pnl-separator--${e}`,n)})}function ue({children:e,className:n,...t}){return a.jsx("section",{className:b.cx("pnl-surface",n),...t,children:e})}function ln({panel:e,length:n,closeLabel:t,onFocus:s,ref:l}){const{close:r}=z(),{IconButton:i}=ae(),o=He(e.id);return a.jsxs(ue,{ref:l,"aria-label":e.title,onPointerDownCapture:s,className:n===void 0?"pnl-surface--fill":"pnl-surface--give",style:n===void 0?void 0:{flexBasis:n},children:[a.jsx(Ue,{title:e.title,fillActions:e.fillActions??(o?.actions!==void 0&&L(e.zone)),trailing:a.jsxs(a.Fragment,{children:[o?.actions!==void 0&&a.jsx(q,{}),a.jsx(i,{label:t,acts:!0,onClick:()=>r(e.zone,e.slot),className:"pnl-icon-button--header",icon:a.jsx(an,{})})]}),children:o?.actions}),a.jsx("div",{className:b.cx("pnl-body"),children:o?.content})]})}const te=d.memo(ln);function an(){return a.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",focusable:"false",children:a.jsx("path",{fill:"currentColor",d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}function un({zone:e,labels:n}){const t=Fe(e),{focus:s,resize:l,resplit:r}=z(),i=d.useRef(null),o=d.useRef(null),c=L(e),u=v(w=>c?w.available.height:w.available.width),f=d.useCallback(()=>s(e),[s,e]),h=d.useCallback(()=>c?i.current?.clientHeight??0:i.current?.clientWidth??0,[c]),m=d.useCallback(()=>c?o.current?.clientWidth??0:o.current?.clientHeight??0,[c]);if(!t.draws)return null;const{primary:g,secondary:S,size:x,split:p}=t,y=a.jsxs("div",{ref:i,className:b.cx("pnl-zone",c?"pnl-zone--row":"pnl-zone--col"),style:{[c?"height":"width"]:x},children:[g&&a.jsx(te,{panel:g,closeLabel:n.closePanel,onFocus:f}),g&&S&&a.jsx(W,{axis:c?"horizontal":"vertical",invert:!0,size:p,min:M,measure:m,label:n.resizeSplit,onSize:(w,k)=>r(e,w,k)}),S&&a.jsx(te,{ref:o,panel:S,length:g&&p!==void 0?p:void 0,closeLabel:n.closePanel,onFocus:f})]}),C=a.jsx(W,{axis:c?"vertical":"horizontal",invert:!X(e),size:x,min:F,measure:h,label:n.resizeZone,onSize:(w,k)=>l(e,w,u||k)});return X(e)?a.jsxs(a.Fragment,{children:[y,C]}):a.jsxs(a.Fragment,{children:[C,y]})}const j=d.memo(un);function Ve({left:e,right:n,labels:t}){const s=v(c=>c.lengths.bandSplit),{resplitBand:l}=z(),r=d.useRef(null),i=d.useCallback((c,u)=>l(c,u),[l]),o=d.useCallback(()=>r.current?.clientWidth??0,[]);return!e&&!n?null:!e||!n?a.jsx(j,{zone:e?"bottomLeft":"bottomRight",labels:t}):a.jsxs("div",{className:"pnl-band",children:[a.jsx("div",{ref:r,className:b.cx("pnl-band__half",s===void 0&&"pnl-band__half--even"),style:s===void 0?void 0:{width:s},children:a.jsx(j,{zone:"bottomLeft",labels:t})}),a.jsx(W,{axis:"horizontal",size:s,min:M,measure:o,label:t.resizeBand,onSize:i}),a.jsx("div",{className:"pnl-band__half pnl-band__half--rest",children:a.jsx(j,{zone:"bottomRight",labels:t})})]})}function G(e){return null}G.displayName="Panels.Center";const We={closePanel:"Close panel",resizeZone:"Resize panel area",resizeSplit:"Resize the two panels",resizeBand:"Resize the bottom panels"};function J(e){return null}J.displayName="Panels.Panel";function se({side:e,header:n,className:t}){const{column:s,band:l}=U[e];return a.jsxs("div",{role:"toolbar","aria-orientation":"vertical",className:b.cx("pnl-rail",`pnl-rail--${e}`,t),children:[a.jsxs("div",{className:"pnl-rail__group",children:[n!==void 0&&a.jsxs(a.Fragment,{children:[n,a.jsx(q,{orientation:"horizontal"})]}),s.map(r=>a.jsx(oe,{zone:r},r))]}),a.jsx(oe,{zone:l})]})}function oe({zone:e}){const n=Ae(e),t=Te(e),s=v(i=>i.focusedZone===e),{toggle:l}=z(),{IconButton:r}=ae();return n.length===0?null:a.jsx("div",{className:"pnl-rail__group",children:n.map(([i,o],c)=>a.jsxs(d.Fragment,{children:[c>0&&a.jsx(q,{orientation:"horizontal"}),o.map(u=>{const f=t[i]===u.id;return a.jsx(r,{icon:u.icon,label:u.title,active:f,accented:f&&s,onClick:()=>l(u.id),className:"pnl-rail__button"},u.id)})]},`${e}:${i}`))})}function dn(e){const n=[],t=new Map,s=[];let l=null;for(const r of d.Children.toArray(e)){if(!d.isValidElement(r)){s.push(r);continue}if(r.type===G){l=r;continue}if(r.type!==J){s.push(r);continue}const i=r.props,{actions:o,children:c,slot:u="primary",...f}=i;n.push({...f,slot:u}),t.set(f.id,{content:c,actions:o})}return{specs:n,content:t,centre:l,loose:s}}function de({header:e,footer:n,railHeader:t,labels:s,theme:l,className:r,components:i,children:o,...c}){return a.jsx(Le,{...c,children:a.jsx(fn,{header:e,footer:n,railHeader:t,labels:s,theme:l,className:r,components:i,children:o})})}function fn({header:e,footer:n,railHeader:t,labels:s,theme:l,className:r,components:i,children:o}){const c=T(),u=d.useRef(null);Oe(u);const[f]=d.useState(()=>on(i)),{specs:h,content:m,centre:g,loose:S}=d.useMemo(()=>dn(o),[o]),x=d.useMemo(()=>({...We,...s}),[s]);Ie(()=>{c.getState().declare(h)},[c,h]);const p=ze();return a.jsx(sn,{value:f,children:a.jsx(De,{value:m,children:a.jsxs("div",{"data-pnl-theme":l,className:b.cx("pnl-root",r),children:[e,a.jsxs("div",{className:"pnl-middle",children:[a.jsx(se,{side:"left",header:t}),a.jsxs("div",{ref:u,className:"pnl-columns",children:[a.jsx(j,{zone:"top",labels:x}),a.jsxs("div",{className:"pnl-row",children:[!p.left&&a.jsx(j,{zone:"left",labels:x}),a.jsxs("div",{className:"pnl-stack",children:[a.jsxs("div",{className:"pnl-row",children:[p.left&&a.jsx(j,{zone:"left",labels:x}),a.jsx(ue,{className:"pnl-centre",children:g?.props.children}),p.right&&a.jsx(j,{zone:"right",labels:x})]}),a.jsx(Ve,{left:p.left,right:p.right,labels:x})]}),!p.right&&a.jsx(j,{zone:"right",labels:x})]})]}),a.jsx(se,{side:"right"})]}),n,S]})})})}de.Panel=J;de.Center=G;function hn(){const e=T(),n=_(),t=v(i=>i.focusedZone),s=z(),l=d.useCallback(i=>{const o=E(n.registry,i);return o!==void 0&&R(n,o.zone)[o.slot]===i},[n]),r=d.useCallback(i=>{const o=E(n.registry,i);!o||R(n,o.zone)[o.slot]!==i||e.getState().close(o.zone,o.slot)},[n,e]);return d.useMemo(()=>({panels:n.registry,reveal:s.show,close:r,toggle:s.toggle,isShown:l,focusedZone:t,reset:s.reset}),[n,s.show,s.toggle,s.reset,r,l,t])}exports.cx=b.cx;exports.BOTTOM_ZONES=be;exports.Band=Ve;exports.Center=G;exports.ContentProvider=De;exports.DEFAULT_LABELS=We;exports.DEFAULT_SIZES=xe;exports.DEFAULT_VIEW=Y;exports.IconButton=Ze;exports.LAYOUT_VERSION=le;exports.MIN_CENTER=ie;exports.MIN_SIZE=F;exports.MIN_SPLIT=M;exports.Panel=J;exports.PanelFrame=te;exports.PanelHeader=Ue;exports.Panels=de;exports.PanelsProvider=Le;exports.Rail=se;exports.RailZone=oe;exports.ResizeHandle=W;exports.SLOTS=re;exports.Separator=q;exports.Surface=ue;exports.ZONES=O;exports.ZONES_BY_SIDE=U;exports.ZoneEdge=j;exports.browserStorage=Ee;exports.createPanelsStore=Ne;exports.fitSplit=B;exports.fitZoneSize=ce;exports.isBottom=$;exports.isHorizontal=L;exports.isLeading=X;exports.memoryStorage=en;exports.openOf=Z;exports.readLayout=_e;exports.sharedSizes=je;exports.shownIn=R;exports.shownSpecsIn=N;exports.sizeKeyOf=A;exports.specOf=E;exports.undraggedSizeOf=V;exports.useArrangement=_;exports.useBandHalves=ze;exports.useContainerFit=Oe;exports.usePanelContent=He;exports.usePanels=hn;exports.usePanelsActions=z;exports.usePanelsComponents=ae;exports.usePanelsState=v;exports.usePanelsStore=T;exports.usePointerDrag=ke;exports.useShownIn=Te;exports.useShownSpecsIn=rn;exports.useZone=Fe;exports.useZoneDraws=ne;exports.useZonePanels=Ae;exports.useZoneTakesRoom=cn;exports.writeLayout=Ce;exports.zoneDraws=H;exports.zoneTakesRoom=D;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),d=require("react"),b=require("./cx-YyuC5RtB.cjs"),fe=e=>{let n;const t=new Set,s=(u,f)=>{const h=typeof u=="function"?u(n):u;if(!Object.is(h,n)){const m=n;n=f??(typeof h!="object"||h===null)?h:Object.assign({},n,h),t.forEach(g=>g(n,m))}},c=()=>n,o={setState:s,getState:c,getInitialState:()=>l,subscribe:u=>(t.add(u),()=>t.delete(u))},l=n=e(s,c,o);return o},$e=(e=>e?fe(e):fe),qe=e=>e;function Ge(e,n=qe){const t=d.useSyncExternalStore(e.subscribe,d.useCallback(()=>n(e.getState()),[e,n]),d.useCallback(()=>n(e.getInitialState()),[e,n]));return d.useDebugValue(t),t}const O=["left","right","top","bottomLeft","bottomRight"],re=["primary","secondary"],Y="default",be=["bottomLeft","bottomRight"];function $(e){return e==="bottomLeft"||e==="bottomRight"}function L(e){return e==="top"||$(e)}const U={left:{column:["left","top"],band:"bottomLeft"},right:{column:["right"],band:"bottomRight"}};function X(e){return e==="left"||e==="top"}const A=140,ie=240,M=100,xe={left:320,right:260,top:180,bottomLeft:240,bottomRight:240},Se="bottomRight";function F(e){return $(e)?Se:e}const I={left:"right",right:"left",top:Se,bottomLeft:"top",bottomRight:"top"};function we(e,n,t){return Math.min(Math.max(e,n),t)}function ce(e,n,t){const s=Math.max(A,Math.round(n-t-ie));return we(Math.round(e),A,s)}function B(e,n){const t=Math.max(M,Math.round(n-M));return we(Math.round(e),M,t)}function ye(e,n,t,s){return t(n)?e.sizes[F(n)]??s(n):0}function Je(e,n,t,s,c){const r={...e.sizes},i={...e.splits};for(const l of O){const u=r[l];if(u!==void 0){const h=L(l)?t:n,m=ye(e,I[l],s,c);r[l]=ce(u,h,m)}const f=i[l];f!==void 0&&(i[l]=B(f,L(l)?n:t))}const o=e.bandSplit===void 0?void 0:B(e.bandSplit,n);return{sizes:r,splits:i,bandSplit:o}}function je(e,n,t){const s=t-ie,c=e+n;if(c<=s)return[e,n];const r=u=>u===0?0:A,i=r(e)+r(n);if(s<=i)return[Math.min(e,r(e)),Math.min(n,r(n))];const o=s/c,l=Math.max(r(e),Math.round(e*o));return[l,Math.max(r(n),Math.round(s-l))]}function Z(e){return e.views[e.view]??{}}function K(e,n){const t={...n??{}};for(const s of O)for(const c of re)t[s]?.[c]===void 0&&Pe(e,s,c)!==void 0&&(t[s]={...t[s],[c]:null});return t}function Q(e,n){return Object.hasOwn(e.views,n)}function Ke(e,n){return e.length===n.length&&e.every((t,s)=>{const c=n[s];return c!==void 0&&t.id===c.id&&t.zone===c.zone&&t.slot===c.slot&&t.title===c.title&&t.opens===c.opens&&t.solo===c.solo&&t.fillActions===c.fillActions&&t.icon===c.icon})}function Pe(e,n,t){return e.find(s=>s.zone===n&&s.slot===t)}function E(e,n){return n==null?void 0:e.find(t=>t.id===n)}function he(e,n,t){const s=Z(e)[n];if(!s||!(t in s))return;const c=E(e.registry,s[t]);return c?.zone===n&&c.slot===t?c:Pe(e.registry,n,t)}function N(e,n){const t=he(e,n,"primary");return t?.solo===!0?{primary:t}:{primary:t,secondary:he(e,n,"secondary")}}function R(e,n){const{primary:t,secondary:s}=N(e,n);return{primary:t?.id,secondary:s?.id}}function D(e,n){return $(n)?be.some(t=>H(e,t)):H(e,n)}function H(e,n){const t=R(e,n);return t.primary!==void 0||t.secondary!==void 0}function V(e,n){return Math.max(xe[e],n?.opens??0)}function Xe(e,n,t,s){const{slot:c,id:r}=t,i=Z(e)[n]??{},o={...e.stashed};if(t.solo===!0&&c==="primary")return o[n]=i,[{[c]:r},o];if(s?.solo!==!0)return[{...i,[c]:r},e.stashed];const l=o[n];if(delete o[n],l)return[{...l,[c]:r},o];const u={...i,[c]:r};return c!==s.slot&&delete u[s.slot],[u,o]}function Qe(e,n,t){const s=Z(e)[n]??{},c=s[t],r=e.stashed[n];if(r&&c!==void 0&&E(e.registry,c)?.solo===!0){const o={...e.stashed};return delete o[n],[r,o]}const i={...s};return delete i[t],[i,e.stashed]}const pe={sizes:{},splits:{}};function en(e,n){return e.bandSplit!==n.bandSplit?!1:O.every(t=>e.sizes[t]===n.sizes[t]&&e.splits[t]===n.splits[t])}function Ne(e={}){const n=e.initial,t=(s,c)=>({...s.views,[s.view]:c});return $e()((s,c)=>({registry:[],view:e.view??Y,views:n?.views??{},lengths:n?.lengths??pe,focusedZone:null,stashed:{},available:{width:0,height:0},declare:r=>s(i=>Ke(i.registry,r)?i:{registry:r}),settle:r=>s(i=>{const o=r??i.defaults;return Q(i,i.view)?o===i.defaults?i:{defaults:o}:{views:t(i,K(i.registry,o)),defaults:o}}),setView:r=>s(i=>i.view===r?i:{view:r,views:Q(i,r)?i.views:{...i.views,[r]:K(i.registry,i.defaults)},focusedZone:null,stashed:{}}),show:r=>s(i=>{const o=E(i.registry,r);if(!o)return i;const{zone:l}=o,u=N(i,l);if(u[o.slot]?.id===r)return{focusedZone:l};const[f,h]=Xe(i,l,o,u.primary);return{views:t(i,{...Z(i),[l]:f}),stashed:h,focusedZone:l}}),close:(r,i)=>s(o=>{const[l,u]=Qe(o,r,i),f=t(o,{...Z(o),[r]:l}),h=H({registry:o.registry,view:o.view,views:f},r);return{views:f,stashed:u,focusedZone:!h&&o.focusedZone===r?null:o.focusedZone}}),toggle:r=>{const i=c(),o=E(i.registry,r);o&&(R(i,o.zone)[o.slot]===r?i.close(o.zone,o.slot):i.show(r))},focus:r=>s(i=>i.focusedZone===r?i:{focusedZone:r}),resize:(r,i,o)=>s(l=>{const u=ye(l.lengths,I[r],m=>D(l,m),m=>V(m,N(l,m).primary)),f=ce(i,o,u),h=F(r);return f===l.lengths.sizes[h]?l:{lengths:{...l.lengths,sizes:{...l.lengths.sizes,[h]:f}}}}),resplit:(r,i,o)=>s(l=>{const u=B(i,o);return u===l.lengths.splits[r]?l:{lengths:{...l.lengths,splits:{...l.lengths.splits,[r]:u}}}}),resplitBand:(r,i)=>s(o=>{const l=B(r,i);return l===o.lengths.bandSplit?o:{lengths:{...o.lengths,bandSplit:l}}}),fit:(r,i)=>s(o=>{const l=Je(o.lengths,r,i,h=>D(o,h),h=>V(h,N(o,h).primary)),u=en(o.lengths,l)?o.lengths:l,{available:f}=o;return u===o.lengths&&f.width===r&&f.height===i?o:{available:{width:r,height:i},lengths:u}}),reset:()=>s(r=>({views:r.registry.length===0?{}:{[r.view]:K(r.registry,r.defaults)},lengths:pe,focusedZone:null,stashed:{},registry:r.registry}))}))}const nn=()=>{const e=new Map;return{read:n=>e.get(n)??null,write:(n,t)=>{e.set(n,t)}}},Ee=()=>({read:e=>{try{return globalThis.localStorage?.getItem(e)??null}catch{return null}},write:(e,n)=>{try{globalThis.localStorage?.setItem(e,n)}catch{}}}),le=2;function P(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function me(e){const n={};for(const t of O){const s=e[t];if(P(s))for(const c of re){const r=s[c];r!==null&&typeof r!="string"||(n[t]={...n[t],[c]:r})}}return n}function ge(e){const n={};for(const t of O){const s=e[t];typeof s=="number"&&Number.isFinite(s)&&(n[t]=s)}return n}function tn(e,n){if(e.version===1)return P(e.open)?{[n]:me(e.open)}:void 0;if(e.version!==le||!P(e.views))return;const t=Object.create(null);for(const[s,c]of Object.entries(e.views))P(c)&&(t[s]=me(c));return t}function _e(e,n,t=Y){const s=e.read(n);if(s===null)return;let c;try{c=JSON.parse(s)}catch{return}if(!P(c)||!P(c.lengths))return;const r=tn(c,t);if(!r)return;const i=c.lengths;if(!P(i.sizes)||!P(i.splits))return;const o=i.bandSplit;return{views:r,lengths:{sizes:ge(i.sizes),splits:ge(i.splits),bandSplit:typeof o=="number"&&Number.isFinite(o)?o:void 0}}}function Ce(e,n,t){const s={version:le,views:t.views,lengths:t.lengths};e.write(n,JSON.stringify(s))}const Ie=typeof globalThis.document>"u"?d.useEffect:d.useLayoutEffect,Me=d.createContext(null),sn=250;function Le({store:e,storageKey:n="panels:layout",storage:t,defaultOpen:s,view:c,children:r}){const[i]=d.useState(()=>t===null?null:t??Ee()),[o]=d.useState(()=>{const l=c??Y,u=i?_e(i,n,l):void 0;return e?(u&&e.setState(u),e):Ne({view:l,initial:u})});return Ie(()=>{const l=o.getState();c!==void 0&&l.setView(c),l.settle(s)}),d.useEffect(()=>{if(!i)return;let l,u,f;const h=()=>{f!==void 0&&clearTimeout(f),f=void 0,u&&(l=u,u=void 0,Ce(i,n,l))},m=o.subscribe(g=>{if(!Q(g,g.view))return;const S=u??l;S?.views===g.views&&S.lengths===g.lengths||(u={views:g.views,lengths:g.lengths},f??=setTimeout(h,sn))});return globalThis.addEventListener?.("pagehide",h),()=>{m(),globalThis.removeEventListener?.("pagehide",h),h()}},[i,o,n]),a.jsx(Me.Provider,{value:o,children:r})}function T(){const e=d.useContext(Me);if(!e)throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");return e}function v(e){const n=T();return Ge(n,e)}function z(){const e=T();return d.useMemo(()=>{const{show:n,close:t,toggle:s,focus:c,resize:r,resplit:i,resplitBand:o,fit:l,reset:u}=e.getState();return{show:n,close:t,toggle:s,focus:c,resize:r,resplit:i,resplitBand:o,fit:l,reset:u}},[e])}function Ze({icon:e,label:n,active:t,accented:s,acts:c,className:r,children:i,ref:o,...l}){return a.jsxs("button",{type:"button",ref:o,"aria-label":n,"aria-pressed":c?void 0:t,className:b.cx("pnl-icon-button",t&&"pnl-icon-button--active",s&&"pnl-icon-button--accented",r),...l,children:[e!==void 0&&a.jsx("span",{className:"pnl-icon-button__glyph",children:e}),i]})}const ee={IconButton:Ze},Re=d.createContext(ee),on=Re.Provider;function ae(){return d.useContext(Re)}function rn(e){return e===void 0?ee:{...ee,...e}}function Oe(e){const n=T();d.useEffect(()=>{const t=e.current;if(!t)return;const s=()=>{const{clientWidth:r,clientHeight:i}=t;r===0||i===0||n.getState().fit(r,i)};if(s(),typeof ResizeObserver>"u")return;const c=new ResizeObserver(s);return c.observe(t),()=>c.disconnect()},[e,n])}function _(){const e=v(s=>s.registry),n=v(s=>s.view),t=v(s=>s.views[s.view]);return d.useMemo(()=>({registry:e,view:n,views:t===void 0?{}:{[n]:t}}),[e,n,t])}function Te(e){const n=_();return d.useMemo(()=>R(n,e),[n,e])}function cn(e){const n=_();return d.useMemo(()=>N(n,e),[n,e])}function ne(e){const n=_();return d.useMemo(()=>H(n,e),[n,e])}function ln(e){const n=_();return d.useMemo(()=>D(n,e),[n,e])}function ze(){return{left:ne(U.left.band),right:ne(U.right.band)}}function ke(){const e=d.useRef(null);return d.useMemo(()=>({start:(t,s)=>{t.currentTarget.setPointerCapture(t.pointerId),e.current={...s,pointerId:t.pointerId}},matching:t=>e.current?.pointerId===t.pointerId?e.current:null,cancel:()=>{e.current=null}}),[])}function W({axis:e,invert:n=!1,size:t,onSize:s,measure:c,label:r,min:i,max:o,step:l=16,className:u}){const f=ke(),h=d.useRef(null),m=e==="vertical",g=d.useCallback(p=>(m?p?.clientHeight:p?.clientWidth)??0,[m]),S=d.useCallback(p=>{const y=f.matching(p);if(!y)return;const w=(m?p.clientY:p.clientX)-y.position;s(y.size+w*(n?-1:1),y.available)},[f,n,m,s]),x=d.useCallback(p=>{const y=m?"ArrowUp":"ArrowLeft",C=m?"ArrowDown":"ArrowRight";if(p.key!==y&&p.key!==C)return;const w=g(h.current?.parentElement),k=t??c?.()??0,Ye=p.key===C?1:-1;p.preventDefault(),s(k+l*Ye*(n?-1:1),w)},[n,m,c,s,g,t,l]);return a.jsx("div",{ref:h,role:"separator",tabIndex:0,"aria-label":r,"aria-orientation":m?"horizontal":"vertical","aria-valuenow":t===void 0?void 0:Math.round(t),"aria-valuemin":i,"aria-valuemax":o,onPointerDown:p=>{p.button!==0||!p.isPrimary||f.start(p,{position:m?p.clientY:p.clientX,size:t??c?.()??0,available:g(p.currentTarget.parentElement)})},onPointerMove:S,onPointerUp:f.cancel,onPointerCancel:f.cancel,onLostPointerCapture:f.cancel,onKeyDown:x,className:b.cx("pnl-handle",m?"pnl-handle--row":"pnl-handle--col",u)})}function ve(e,n,t,s){return s?n??V(t,e):0}function Ae(e){const n=_(),t=v(o=>o.lengths.sizes[F(e)]),s=v(o=>o.lengths.sizes[F(I[e])]),c=v(o=>o.lengths.splits[e]),r=v(o=>L(e)?o.available.height:o.available.width),i=v(o=>o.focusedZone===e);return d.useMemo(()=>{const{primary:o,secondary:l}=N(n,e),u=o!==void 0||l!==void 0,f=N(n,I[e]),h=D(n,I[e]),m=ve(o,t,e,u),g=ve(f.primary,s,I[e],h);return{primary:o,secondary:l,draws:u,size:r===0?m:je(m,g,r)[0],split:c,focused:i}},[n,t,s,r,c,i,e])}function Fe(e){const n=v(t=>t.registry);return d.useMemo(()=>[["primary",n.filter(s=>s.zone===e&&s.slot==="primary")],["secondary",n.filter(s=>s.zone===e&&s.slot==="secondary")]].filter(([,s])=>s.length>0),[n,e])}const Be=d.createContext(new Map),De=Be.Provider;function He(e){return d.useContext(Be).get(e)}function Ue({title:e,children:n,fillActions:t,trailing:s,className:c}){return a.jsxs("header",{className:b.cx("pnl-header",c),children:[a.jsx("span",{className:b.cx("pnl-header__title",t&&"pnl-header__title--fixed"),children:e}),a.jsx("span",{className:b.cx("pnl-header__actions",t&&"pnl-header__actions--fill"),children:n}),a.jsx("span",{className:"pnl-header__trailing",children:s})]})}function q({orientation:e="vertical",className:n}){return a.jsx("span",{"aria-hidden":"true",className:b.cx("pnl-separator",`pnl-separator--${e}`,n)})}function ue({children:e,className:n,...t}){return a.jsx("section",{className:b.cx("pnl-surface",n),...t,children:e})}function an({panel:e,length:n,closeLabel:t,onFocus:s,ref:c}){const{close:r}=z(),{IconButton:i}=ae(),o=He(e.id);return a.jsxs(ue,{ref:c,"aria-label":e.title,onPointerDownCapture:s,className:n===void 0?"pnl-surface--fill":"pnl-surface--give",style:n===void 0?void 0:{flexBasis:n},children:[a.jsx(Ue,{title:e.title,fillActions:e.fillActions??(o?.actions!==void 0&&L(e.zone)),trailing:a.jsxs(a.Fragment,{children:[o?.actions!==void 0&&a.jsx(q,{}),a.jsx(i,{label:t,acts:!0,onClick:()=>r(e.zone,e.slot),className:"pnl-icon-button--header",icon:a.jsx(un,{})})]}),children:o?.actions}),a.jsx("div",{className:b.cx("pnl-body"),children:o?.content})]})}const te=d.memo(an);function un(){return a.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",focusable:"false",children:a.jsx("path",{fill:"currentColor",d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}function dn({zone:e,labels:n}){const t=Ae(e),{focus:s,resize:c,resplit:r}=z(),i=d.useRef(null),o=d.useRef(null),l=L(e),u=v(w=>l?w.available.height:w.available.width),f=d.useCallback(()=>s(e),[s,e]),h=d.useCallback(()=>l?i.current?.clientHeight??0:i.current?.clientWidth??0,[l]),m=d.useCallback(()=>l?o.current?.clientWidth??0:o.current?.clientHeight??0,[l]);if(!t.draws)return null;const{primary:g,secondary:S,size:x,split:p}=t,y=a.jsxs("div",{ref:i,className:b.cx("pnl-zone",l?"pnl-zone--row":"pnl-zone--col"),style:{[l?"height":"width"]:x},children:[g&&a.jsx(te,{panel:g,closeLabel:n.closePanel,onFocus:f}),g&&S&&a.jsx(W,{axis:l?"horizontal":"vertical",invert:!0,size:p,min:M,measure:m,label:n.resizeSplit,onSize:(w,k)=>r(e,w,k)}),S&&a.jsx(te,{ref:o,panel:S,length:g&&p!==void 0?p:void 0,closeLabel:n.closePanel,onFocus:f})]}),C=a.jsx(W,{axis:l?"vertical":"horizontal",invert:!X(e),size:x,min:A,measure:h,label:n.resizeZone,onSize:(w,k)=>c(e,w,u||k)});return X(e)?a.jsxs(a.Fragment,{children:[y,C]}):a.jsxs(a.Fragment,{children:[C,y]})}const j=d.memo(dn);function Ve({left:e,right:n,labels:t}){const s=v(l=>l.lengths.bandSplit),{resplitBand:c}=z(),r=d.useRef(null),i=d.useCallback((l,u)=>c(l,u),[c]),o=d.useCallback(()=>r.current?.clientWidth??0,[]);return!e&&!n?null:!e||!n?a.jsx(j,{zone:e?"bottomLeft":"bottomRight",labels:t}):a.jsxs("div",{className:"pnl-band",children:[a.jsx("div",{ref:r,className:b.cx("pnl-band__half",s===void 0&&"pnl-band__half--even"),style:s===void 0?void 0:{width:s},children:a.jsx(j,{zone:"bottomLeft",labels:t})}),a.jsx(W,{axis:"horizontal",size:s,min:M,measure:o,label:t.resizeBand,onSize:i}),a.jsx("div",{className:"pnl-band__half pnl-band__half--rest",children:a.jsx(j,{zone:"bottomRight",labels:t})})]})}function G(e){return null}G.displayName="Panels.Center";const We={closePanel:"Close panel",resizeZone:"Resize panel area",resizeSplit:"Resize the two panels",resizeBand:"Resize the bottom panels"};function J(e){return null}J.displayName="Panels.Panel";function se({side:e,header:n,className:t}){const{column:s,band:c}=U[e];return a.jsxs("div",{role:"toolbar","aria-orientation":"vertical",className:b.cx("pnl-rail",`pnl-rail--${e}`,t),children:[a.jsxs("div",{className:"pnl-rail__group",children:[n!==void 0&&a.jsxs(a.Fragment,{children:[n,a.jsx(q,{orientation:"horizontal"})]}),s.map(r=>a.jsx(oe,{zone:r},r))]}),a.jsx(oe,{zone:c})]})}function oe({zone:e}){const n=Fe(e),t=Te(e),s=v(i=>i.focusedZone===e),{toggle:c}=z(),{IconButton:r}=ae();return n.length===0?null:a.jsx("div",{className:"pnl-rail__group",children:n.map(([i,o],l)=>a.jsxs(d.Fragment,{children:[l>0&&a.jsx(q,{orientation:"horizontal"}),o.map(u=>{const f=t[i]===u.id;return a.jsx(r,{icon:u.icon,label:u.title,active:f,accented:f&&s,onClick:()=>c(u.id),className:"pnl-rail__button"},u.id)})]},`${e}:${i}`))})}function fn(e){const n=[],t=new Map,s=[];let c=null;for(const r of d.Children.toArray(e)){if(!d.isValidElement(r)){s.push(r);continue}if(r.type===G){c=r;continue}if(r.type!==J){s.push(r);continue}const i=r.props,{actions:o,children:l,slot:u="primary",...f}=i;n.push({...f,slot:u}),t.set(f.id,{content:l,actions:o})}return{specs:n,content:t,centre:c,loose:s}}function de({header:e,footer:n,railHeader:t,labels:s,theme:c,className:r,components:i,children:o,...l}){return a.jsx(Le,{...l,children:a.jsx(hn,{header:e,footer:n,railHeader:t,labels:s,theme:c,className:r,components:i,children:o})})}function hn({header:e,footer:n,railHeader:t,labels:s,theme:c,className:r,components:i,children:o}){const l=T(),u=d.useRef(null);Oe(u);const[f]=d.useState(()=>rn(i)),{specs:h,content:m,centre:g,loose:S}=d.useMemo(()=>fn(o),[o]),x=d.useMemo(()=>({...We,...s}),[s]);Ie(()=>{l.getState().declare(h)},[l,h]);const p=ze();return a.jsx(on,{value:f,children:a.jsx(De,{value:m,children:a.jsxs("div",{"data-pnl-theme":c,className:b.cx("pnl-root",r),children:[e,a.jsxs("div",{className:"pnl-middle",children:[a.jsx(se,{side:"left",header:t}),a.jsxs("div",{ref:u,className:"pnl-columns",children:[a.jsx(j,{zone:"top",labels:x}),a.jsxs("div",{className:"pnl-row",children:[!p.left&&a.jsx(j,{zone:"left",labels:x}),a.jsxs("div",{className:"pnl-stack",children:[a.jsxs("div",{className:"pnl-row",children:[p.left&&a.jsx(j,{zone:"left",labels:x}),a.jsx(ue,{className:"pnl-centre",children:g?.props.children}),p.right&&a.jsx(j,{zone:"right",labels:x})]}),a.jsx(Ve,{left:p.left,right:p.right,labels:x})]}),!p.right&&a.jsx(j,{zone:"right",labels:x})]})]}),a.jsx(se,{side:"right"})]}),n,S]})})})}de.Panel=J;de.Center=G;function pn(){const e=T(),n=_(),t=v(i=>i.focusedZone),s=z(),c=d.useCallback(i=>{const o=E(n.registry,i);return o!==void 0&&R(n,o.zone)[o.slot]===i},[n]),r=d.useCallback(i=>{const o=E(n.registry,i);!o||R(n,o.zone)[o.slot]!==i||e.getState().close(o.zone,o.slot)},[n,e]);return d.useMemo(()=>({panels:n.registry,reveal:s.show,close:r,toggle:s.toggle,isShown:c,focusedZone:t,reset:s.reset}),[n,s.show,s.toggle,s.reset,r,c,t])}exports.cx=b.cx;exports.BOTTOM_ZONES=be;exports.Band=Ve;exports.Center=G;exports.ContentProvider=De;exports.DEFAULT_LABELS=We;exports.DEFAULT_SIZES=xe;exports.DEFAULT_VIEW=Y;exports.IconButton=Ze;exports.LAYOUT_VERSION=le;exports.MIN_CENTER=ie;exports.MIN_SIZE=A;exports.MIN_SPLIT=M;exports.Panel=J;exports.PanelFrame=te;exports.PanelHeader=Ue;exports.Panels=de;exports.PanelsProvider=Le;exports.Rail=se;exports.RailZone=oe;exports.ResizeHandle=W;exports.SLOTS=re;exports.Separator=q;exports.Surface=ue;exports.ZONES=O;exports.ZONES_BY_SIDE=U;exports.ZoneEdge=j;exports.browserStorage=Ee;exports.createPanelsStore=Ne;exports.fitSplit=B;exports.fitZoneSize=ce;exports.isBottom=$;exports.isHorizontal=L;exports.isLeading=X;exports.memoryStorage=nn;exports.openOf=Z;exports.readLayout=_e;exports.sharedSizes=je;exports.shownIn=R;exports.shownSpecsIn=N;exports.sizeKeyOf=F;exports.specOf=E;exports.undraggedSizeOf=V;exports.useArrangement=_;exports.useBandHalves=ze;exports.useContainerFit=Oe;exports.usePanelContent=He;exports.usePanels=pn;exports.usePanelsActions=z;exports.usePanelsComponents=ae;exports.usePanelsState=v;exports.usePanelsStore=T;exports.usePointerDrag=ke;exports.useShownIn=Te;exports.useShownSpecsIn=cn;exports.useZone=Ae;exports.useZoneDraws=ne;exports.useZonePanels=Fe;exports.useZoneTakesRoom=ln;exports.writeLayout=Ce;exports.zoneDraws=H;exports.zoneTakesRoom=D;
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const un = (n) => {
|
|
|
9
9
|
const p = t;
|
|
10
10
|
t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((g) => g(t, p));
|
|
11
11
|
}
|
|
12
|
-
},
|
|
12
|
+
}, c = () => t, r = { setState: o, getState: c, getInitialState: () => l, subscribe: (a) => (e.add(a), () => e.delete(a)) }, l = t = n(o, c, r);
|
|
13
13
|
return r;
|
|
14
14
|
}, jn = ((n) => n ? un(n) : un), Un = (n) => n;
|
|
15
15
|
function Vn(n, t = Un) {
|
|
@@ -34,7 +34,7 @@ const X = {
|
|
|
34
34
|
function dn(n) {
|
|
35
35
|
return n === "left" || n === "top";
|
|
36
36
|
}
|
|
37
|
-
const U = 140, Nn = 240,
|
|
37
|
+
const U = 140, Nn = 240, O = 100, Yn = {
|
|
38
38
|
left: 320,
|
|
39
39
|
right: 260,
|
|
40
40
|
top: 180,
|
|
@@ -60,91 +60,97 @@ function En(n, t, e) {
|
|
|
60
60
|
return In(Math.round(n), U, o);
|
|
61
61
|
}
|
|
62
62
|
function W(n, t) {
|
|
63
|
-
const e = Math.max(
|
|
64
|
-
return In(Math.round(n),
|
|
63
|
+
const e = Math.max(O, Math.round(t - O));
|
|
64
|
+
return In(Math.round(n), O, e);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Ln(n, t, e, o) {
|
|
67
67
|
return e(t) ? n.sizes[V(t)] ?? o(t) : 0;
|
|
68
68
|
}
|
|
69
|
-
function $n(n, t, e, o,
|
|
69
|
+
function $n(n, t, e, o, c) {
|
|
70
70
|
const s = { ...n.sizes }, i = { ...n.splits };
|
|
71
|
-
for (const
|
|
72
|
-
const a = s[
|
|
71
|
+
for (const l of B) {
|
|
72
|
+
const a = s[l];
|
|
73
73
|
if (a !== void 0) {
|
|
74
|
-
const f = T(
|
|
75
|
-
s[
|
|
74
|
+
const f = T(l) ? e : t, p = Ln(n, C[l], o, c);
|
|
75
|
+
s[l] = En(a, f, p);
|
|
76
76
|
}
|
|
77
|
-
const d = i[
|
|
78
|
-
d !== void 0 && (i[
|
|
77
|
+
const d = i[l];
|
|
78
|
+
d !== void 0 && (i[l] = W(d, T(l) ? t : e));
|
|
79
79
|
}
|
|
80
80
|
const r = n.bandSplit === void 0 ? void 0 : W(n.bandSplit, t);
|
|
81
81
|
return { sizes: s, splits: i, bandSplit: r };
|
|
82
82
|
}
|
|
83
83
|
function Gn(n, t, e) {
|
|
84
|
-
const o = e - Nn,
|
|
85
|
-
if (
|
|
84
|
+
const o = e - Nn, c = n + t;
|
|
85
|
+
if (c <= o) return [n, t];
|
|
86
86
|
const s = (a) => a === 0 ? 0 : U, i = s(n) + s(t);
|
|
87
87
|
if (o <= i)
|
|
88
88
|
return [Math.min(n, s(n)), Math.min(t, s(t))];
|
|
89
|
-
const r = o /
|
|
90
|
-
return [
|
|
89
|
+
const r = o / c, l = Math.max(s(n), Math.round(n * r));
|
|
90
|
+
return [l, Math.max(s(t), Math.round(o - l))];
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function A(n) {
|
|
93
93
|
return n.views[n.view] ?? {};
|
|
94
94
|
}
|
|
95
95
|
function G(n, t) {
|
|
96
96
|
const e = { ...t ?? {} };
|
|
97
97
|
for (const o of B)
|
|
98
|
-
for (const
|
|
99
|
-
e[o]?.[
|
|
98
|
+
for (const c of Pn)
|
|
99
|
+
e[o]?.[c] === void 0 && xn(n, o, c) !== void 0 && (e[o] = { ...e[o], [c]: null });
|
|
100
100
|
return e;
|
|
101
101
|
}
|
|
102
102
|
function K(n, t) {
|
|
103
103
|
return Object.hasOwn(n.views, t);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Jn(n, t) {
|
|
106
|
+
return n.length === t.length && n.every((e, o) => {
|
|
107
|
+
const c = t[o];
|
|
108
|
+
return c !== void 0 && e.id === c.id && e.zone === c.zone && e.slot === c.slot && e.title === c.title && e.opens === c.opens && e.solo === c.solo && e.fillActions === c.fillActions && e.icon === c.icon;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function xn(n, t, e) {
|
|
106
112
|
return n.find((o) => o.zone === t && o.slot === e);
|
|
107
113
|
}
|
|
108
114
|
function M(n, t) {
|
|
109
115
|
return t == null ? void 0 : n.find((e) => e.id === t);
|
|
110
116
|
}
|
|
111
117
|
function fn(n, t, e) {
|
|
112
|
-
const o =
|
|
118
|
+
const o = A(n)[t];
|
|
113
119
|
if (!o || !(e in o)) return;
|
|
114
|
-
const
|
|
115
|
-
return
|
|
120
|
+
const c = M(n.registry, o[e]);
|
|
121
|
+
return c?.zone === t && c.slot === e ? c : xn(n.registry, t, e);
|
|
116
122
|
}
|
|
117
|
-
function
|
|
123
|
+
function L(n, t) {
|
|
118
124
|
const e = fn(n, t, "primary");
|
|
119
125
|
return e?.solo === !0 ? { primary: e } : { primary: e, secondary: fn(n, t, "secondary") };
|
|
120
126
|
}
|
|
121
|
-
function
|
|
122
|
-
const { primary: e, secondary: o } =
|
|
127
|
+
function F(n, t) {
|
|
128
|
+
const { primary: e, secondary: o } = L(n, t);
|
|
123
129
|
return { primary: e?.id, secondary: o?.id };
|
|
124
130
|
}
|
|
125
131
|
function Y(n, t) {
|
|
126
132
|
return sn(t) ? Wn.some((e) => $(n, e)) : $(n, t);
|
|
127
133
|
}
|
|
128
134
|
function $(n, t) {
|
|
129
|
-
const e =
|
|
135
|
+
const e = F(n, t);
|
|
130
136
|
return e.primary !== void 0 || e.secondary !== void 0;
|
|
131
137
|
}
|
|
132
138
|
function q(n, t) {
|
|
133
139
|
return Math.max(Yn[n], t?.opens ?? 0);
|
|
134
140
|
}
|
|
135
|
-
function
|
|
136
|
-
const { slot:
|
|
137
|
-
if (e.solo === !0 &&
|
|
138
|
-
return r[t] = i, [{ [
|
|
139
|
-
if (o?.solo !== !0) return [{ ...i, [
|
|
140
|
-
const
|
|
141
|
-
if (delete r[t],
|
|
142
|
-
const a = { ...i, [
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
function
|
|
146
|
-
const o =
|
|
147
|
-
if (s &&
|
|
141
|
+
function Xn(n, t, e, o) {
|
|
142
|
+
const { slot: c, id: s } = e, i = A(n)[t] ?? {}, r = { ...n.stashed };
|
|
143
|
+
if (e.solo === !0 && c === "primary")
|
|
144
|
+
return r[t] = i, [{ [c]: s }, r];
|
|
145
|
+
if (o?.solo !== !0) return [{ ...i, [c]: s }, n.stashed];
|
|
146
|
+
const l = r[t];
|
|
147
|
+
if (delete r[t], l) return [{ ...l, [c]: s }, r];
|
|
148
|
+
const a = { ...i, [c]: s };
|
|
149
|
+
return c !== o.slot && delete a[o.slot], [a, r];
|
|
150
|
+
}
|
|
151
|
+
function Kn(n, t, e) {
|
|
152
|
+
const o = A(n)[t] ?? {}, c = o[e], s = n.stashed[t];
|
|
153
|
+
if (s && c !== void 0 && M(n.registry, c)?.solo === !0) {
|
|
148
154
|
const r = { ...n.stashed };
|
|
149
155
|
return delete r[t], [s, r];
|
|
150
156
|
}
|
|
@@ -152,17 +158,17 @@ function Xn(n, t, e) {
|
|
|
152
158
|
return delete i[e], [i, n.stashed];
|
|
153
159
|
}
|
|
154
160
|
const hn = { sizes: {}, splits: {} };
|
|
155
|
-
function
|
|
161
|
+
function qn(n, t) {
|
|
156
162
|
return n.bandSplit !== t.bandSplit ? !1 : B.every(
|
|
157
163
|
(e) => n.sizes[e] === t.sizes[e] && n.splits[e] === t.splits[e]
|
|
158
164
|
);
|
|
159
165
|
}
|
|
160
|
-
function
|
|
161
|
-
const t = n.initial, e = (o,
|
|
166
|
+
function Qn(n = {}) {
|
|
167
|
+
const t = n.initial, e = (o, c) => ({
|
|
162
168
|
...o.views,
|
|
163
|
-
[o.view]:
|
|
169
|
+
[o.view]: c
|
|
164
170
|
});
|
|
165
|
-
return jn()((o,
|
|
171
|
+
return jn()((o, c) => ({
|
|
166
172
|
registry: [],
|
|
167
173
|
view: n.view ?? rn,
|
|
168
174
|
views: t?.views ?? {},
|
|
@@ -172,7 +178,11 @@ function qn(n = {}) {
|
|
|
172
178
|
available: { width: 0, height: 0 },
|
|
173
179
|
// The arrangement is left ALONE by a panel leaving the list: the half naming it falls back
|
|
174
180
|
// to what is still declared — see `resolve` — and names it again the day it comes back.
|
|
175
|
-
|
|
181
|
+
//
|
|
182
|
+
// 🛑 Compared, not written: a project builds this list in its render, so the identity is new
|
|
183
|
+
// every time an unrelated prop moves. Written through, every rail, every zone and every
|
|
184
|
+
// frame re-rendered for a list identical to the one they already held.
|
|
185
|
+
declare: (s) => o((i) => Jn(i.registry, s) ? i : { registry: s }),
|
|
176
186
|
// Having an entry in `views` IS the record of having been settled. No second field can then
|
|
177
187
|
// disagree about which views have been opened, or fall out of step when a reset clears them.
|
|
178
188
|
settle: (s) => o((i) => {
|
|
@@ -193,17 +203,17 @@ function qn(n = {}) {
|
|
|
193
203
|
show: (s) => o((i) => {
|
|
194
204
|
const r = M(i.registry, s);
|
|
195
205
|
if (!r) return i;
|
|
196
|
-
const { zone:
|
|
197
|
-
if (a[r.slot]?.id === s) return { focusedZone:
|
|
198
|
-
const [d, f] =
|
|
206
|
+
const { zone: l } = r, a = L(i, l);
|
|
207
|
+
if (a[r.slot]?.id === s) return { focusedZone: l };
|
|
208
|
+
const [d, f] = Xn(i, l, r, a.primary);
|
|
199
209
|
return {
|
|
200
|
-
views: e(i, { ...
|
|
210
|
+
views: e(i, { ...A(i), [l]: d }),
|
|
201
211
|
stashed: f,
|
|
202
|
-
focusedZone:
|
|
212
|
+
focusedZone: l
|
|
203
213
|
};
|
|
204
214
|
}),
|
|
205
215
|
close: (s, i) => o((r) => {
|
|
206
|
-
const [
|
|
216
|
+
const [l, a] = Kn(r, s, i), d = e(r, { ...A(r), [s]: l }), f = $({ registry: r.registry, view: r.view, views: d }, s);
|
|
207
217
|
return {
|
|
208
218
|
views: d,
|
|
209
219
|
stashed: a,
|
|
@@ -211,40 +221,40 @@ function qn(n = {}) {
|
|
|
211
221
|
};
|
|
212
222
|
}),
|
|
213
223
|
toggle: (s) => {
|
|
214
|
-
const i =
|
|
215
|
-
r && (
|
|
224
|
+
const i = c(), r = M(i.registry, s);
|
|
225
|
+
r && (F(i, r.zone)[r.slot] === s ? i.close(r.zone, r.slot) : i.show(s));
|
|
216
226
|
},
|
|
217
227
|
focus: (s) => o((i) => i.focusedZone === s ? i : { focusedZone: s }),
|
|
218
228
|
// Guarded: a drag past the ceiling clamps to the same number for as long as the pointer
|
|
219
229
|
// keeps going, and every write notifies every subscriber.
|
|
220
|
-
resize: (s, i, r) => o((
|
|
221
|
-
const a =
|
|
222
|
-
|
|
230
|
+
resize: (s, i, r) => o((l) => {
|
|
231
|
+
const a = Ln(
|
|
232
|
+
l.lengths,
|
|
223
233
|
C[s],
|
|
224
|
-
(p) => Y(
|
|
225
|
-
(p) => q(p,
|
|
234
|
+
(p) => Y(l, p),
|
|
235
|
+
(p) => q(p, L(l, p).primary)
|
|
226
236
|
), d = En(i, r, a), f = V(s);
|
|
227
|
-
return d ===
|
|
237
|
+
return d === l.lengths.sizes[f] ? l : { lengths: { ...l.lengths, sizes: { ...l.lengths.sizes, [f]: d } } };
|
|
228
238
|
}),
|
|
229
|
-
resplit: (s, i, r) => o((
|
|
239
|
+
resplit: (s, i, r) => o((l) => {
|
|
230
240
|
const a = W(i, r);
|
|
231
|
-
return a ===
|
|
241
|
+
return a === l.lengths.splits[s] ? l : { lengths: { ...l.lengths, splits: { ...l.lengths.splits, [s]: a } } };
|
|
232
242
|
}),
|
|
233
243
|
resplitBand: (s, i) => o((r) => {
|
|
234
|
-
const
|
|
235
|
-
return
|
|
244
|
+
const l = W(s, i);
|
|
245
|
+
return l === r.lengths.bandSplit ? r : { lengths: { ...r.lengths, bandSplit: l } };
|
|
236
246
|
}),
|
|
237
247
|
// Guarded like `resize`, and for a heavier reason: the observer fires on every frame of a
|
|
238
248
|
// window resize, and the persistence subscriber compares `lengths` by reference. A fresh
|
|
239
249
|
// object carrying the same numbers had each of those frames re-serialising the whole file.
|
|
240
250
|
fit: (s, i) => o((r) => {
|
|
241
|
-
const
|
|
251
|
+
const l = $n(
|
|
242
252
|
r.lengths,
|
|
243
253
|
s,
|
|
244
254
|
i,
|
|
245
255
|
(f) => Y(r, f),
|
|
246
|
-
(f) => q(f,
|
|
247
|
-
), a =
|
|
256
|
+
(f) => q(f, L(r, f).primary)
|
|
257
|
+
), a = qn(r.lengths, l) ? r.lengths : l, { available: d } = r;
|
|
248
258
|
return a === r.lengths && d.width === s && d.height === i ? r : { available: { width: s, height: i }, lengths: a };
|
|
249
259
|
}),
|
|
250
260
|
// Every view, not just the one in front: a reset the reader asked for must not leave the
|
|
@@ -275,7 +285,7 @@ const xt = () => {
|
|
|
275
285
|
n.set(t, e);
|
|
276
286
|
}
|
|
277
287
|
};
|
|
278
|
-
},
|
|
288
|
+
}, nt = () => ({
|
|
279
289
|
read: (n) => {
|
|
280
290
|
try {
|
|
281
291
|
return globalThis.localStorage?.getItem(n) ?? null;
|
|
@@ -298,9 +308,9 @@ function pn(n) {
|
|
|
298
308
|
for (const e of B) {
|
|
299
309
|
const o = n[e];
|
|
300
310
|
if (E(o))
|
|
301
|
-
for (const
|
|
302
|
-
const s = o[
|
|
303
|
-
s !== null && typeof s != "string" || (t[e] = { ...t[e], [
|
|
311
|
+
for (const c of Pn) {
|
|
312
|
+
const s = o[c];
|
|
313
|
+
s !== null && typeof s != "string" || (t[e] = { ...t[e], [c]: s });
|
|
304
314
|
}
|
|
305
315
|
}
|
|
306
316
|
return t;
|
|
@@ -313,28 +323,28 @@ function gn(n) {
|
|
|
313
323
|
}
|
|
314
324
|
return t;
|
|
315
325
|
}
|
|
316
|
-
function
|
|
326
|
+
function tt(n, t) {
|
|
317
327
|
if (n.version === 1)
|
|
318
328
|
return E(n.open) ? { [t]: pn(n.open) } : void 0;
|
|
319
329
|
if (n.version !== Cn || !E(n.views)) return;
|
|
320
330
|
const e = /* @__PURE__ */ Object.create(null);
|
|
321
|
-
for (const [o,
|
|
322
|
-
E(
|
|
331
|
+
for (const [o, c] of Object.entries(n.views))
|
|
332
|
+
E(c) && (e[o] = pn(c));
|
|
323
333
|
return e;
|
|
324
334
|
}
|
|
325
|
-
function
|
|
335
|
+
function et(n, t, e = rn) {
|
|
326
336
|
const o = n.read(t);
|
|
327
337
|
if (o === null) return;
|
|
328
|
-
let
|
|
338
|
+
let c;
|
|
329
339
|
try {
|
|
330
|
-
|
|
340
|
+
c = JSON.parse(o);
|
|
331
341
|
} catch {
|
|
332
342
|
return;
|
|
333
343
|
}
|
|
334
|
-
if (!E(
|
|
335
|
-
const s =
|
|
344
|
+
if (!E(c) || !E(c.lengths)) return;
|
|
345
|
+
const s = tt(c, e);
|
|
336
346
|
if (!s) return;
|
|
337
|
-
const i =
|
|
347
|
+
const i = c.lengths;
|
|
338
348
|
if (!E(i.sizes) || !E(i.splits)) return;
|
|
339
349
|
const r = i.bandSplit;
|
|
340
350
|
return {
|
|
@@ -346,7 +356,7 @@ function tt(n, t, e = rn) {
|
|
|
346
356
|
}
|
|
347
357
|
};
|
|
348
358
|
}
|
|
349
|
-
function
|
|
359
|
+
function ot(n, t, e) {
|
|
350
360
|
const o = {
|
|
351
361
|
version: Cn,
|
|
352
362
|
views: e.views,
|
|
@@ -354,33 +364,33 @@ function et(n, t, e) {
|
|
|
354
364
|
};
|
|
355
365
|
n.write(t, JSON.stringify(o));
|
|
356
366
|
}
|
|
357
|
-
const Zn = typeof globalThis.document > "u" ? tn : Bn, Mn = on(null),
|
|
358
|
-
function
|
|
367
|
+
const Zn = typeof globalThis.document > "u" ? tn : Bn, Mn = on(null), rt = 250;
|
|
368
|
+
function st({
|
|
359
369
|
store: n,
|
|
360
370
|
storageKey: t = "panels:layout",
|
|
361
371
|
storage: e,
|
|
362
372
|
defaultOpen: o,
|
|
363
|
-
view:
|
|
373
|
+
view: c,
|
|
364
374
|
children: s
|
|
365
375
|
}) {
|
|
366
376
|
const [i] = J(
|
|
367
|
-
() => e === null ? null : e ??
|
|
377
|
+
() => e === null ? null : e ?? nt()
|
|
368
378
|
), [r] = J(() => {
|
|
369
|
-
const
|
|
370
|
-
return n ? (a && n.setState(a), n) :
|
|
379
|
+
const l = c ?? rn, a = i ? et(i, t, l) : void 0;
|
|
380
|
+
return n ? (a && n.setState(a), n) : Qn({ view: l, initial: a });
|
|
371
381
|
});
|
|
372
382
|
return Zn(() => {
|
|
373
|
-
const
|
|
374
|
-
|
|
383
|
+
const l = r.getState();
|
|
384
|
+
c !== void 0 && l.setView(c), l.settle(o);
|
|
375
385
|
}), tn(() => {
|
|
376
386
|
if (!i) return;
|
|
377
|
-
let
|
|
387
|
+
let l, a, d;
|
|
378
388
|
const f = () => {
|
|
379
|
-
d !== void 0 && clearTimeout(d), d = void 0, a && (
|
|
389
|
+
d !== void 0 && clearTimeout(d), d = void 0, a && (l = a, a = void 0, ot(i, t, l));
|
|
380
390
|
}, p = r.subscribe((g) => {
|
|
381
391
|
if (!K(g, g.view)) return;
|
|
382
|
-
const S = a ??
|
|
383
|
-
S?.views === g.views && S.lengths === g.lengths || (a = { views: g.views, lengths: g.lengths }, d ??= setTimeout(f,
|
|
392
|
+
const S = a ?? l;
|
|
393
|
+
S?.views === g.views && S.lengths === g.lengths || (a = { views: g.views, lengths: g.lengths }, d ??= setTimeout(f, rt));
|
|
384
394
|
});
|
|
385
395
|
return globalThis.addEventListener?.("pagehide", f), () => {
|
|
386
396
|
p(), globalThis.removeEventListener?.("pagehide", f), f();
|
|
@@ -399,20 +409,20 @@ function v(n) {
|
|
|
399
409
|
function D() {
|
|
400
410
|
const n = k();
|
|
401
411
|
return w(() => {
|
|
402
|
-
const { show: t, close: e, toggle: o, focus:
|
|
403
|
-
return { show: t, close: e, toggle: o, focus:
|
|
412
|
+
const { show: t, close: e, toggle: o, focus: c, resize: s, resplit: i, resplitBand: r, fit: l, reset: a } = n.getState();
|
|
413
|
+
return { show: t, close: e, toggle: o, focus: c, resize: s, resplit: i, resplitBand: r, fit: l, reset: a };
|
|
404
414
|
}, [n]);
|
|
405
415
|
}
|
|
406
|
-
function
|
|
416
|
+
function it({
|
|
407
417
|
icon: n,
|
|
408
418
|
label: t,
|
|
409
419
|
active: e,
|
|
410
420
|
accented: o,
|
|
411
|
-
acts:
|
|
421
|
+
acts: c,
|
|
412
422
|
className: s,
|
|
413
423
|
children: i,
|
|
414
424
|
ref: r,
|
|
415
|
-
...
|
|
425
|
+
...l
|
|
416
426
|
}) {
|
|
417
427
|
return /* @__PURE__ */ m(
|
|
418
428
|
"button",
|
|
@@ -420,14 +430,14 @@ function st({
|
|
|
420
430
|
type: "button",
|
|
421
431
|
ref: r,
|
|
422
432
|
"aria-label": t,
|
|
423
|
-
"aria-pressed":
|
|
433
|
+
"aria-pressed": c ? void 0 : e,
|
|
424
434
|
className: b(
|
|
425
435
|
"pnl-icon-button",
|
|
426
436
|
e && "pnl-icon-button--active",
|
|
427
437
|
o && "pnl-icon-button--accented",
|
|
428
438
|
s
|
|
429
439
|
),
|
|
430
|
-
...
|
|
440
|
+
...l,
|
|
431
441
|
children: [
|
|
432
442
|
n !== void 0 && /* @__PURE__ */ u("span", { className: "pnl-icon-button__glyph", children: n }),
|
|
433
443
|
i
|
|
@@ -435,14 +445,14 @@ function st({
|
|
|
435
445
|
}
|
|
436
446
|
);
|
|
437
447
|
}
|
|
438
|
-
const Q = { IconButton:
|
|
439
|
-
function
|
|
440
|
-
return en(
|
|
448
|
+
const Q = { IconButton: it }, zn = on(Q), ct = zn.Provider;
|
|
449
|
+
function Rn() {
|
|
450
|
+
return en(zn);
|
|
441
451
|
}
|
|
442
|
-
function
|
|
452
|
+
function lt(n) {
|
|
443
453
|
return n === void 0 ? Q : { ...Q, ...n };
|
|
444
454
|
}
|
|
445
|
-
function
|
|
455
|
+
function at(n) {
|
|
446
456
|
const t = k();
|
|
447
457
|
tn(() => {
|
|
448
458
|
const e = n.current;
|
|
@@ -452,40 +462,40 @@ function lt(n) {
|
|
|
452
462
|
s === 0 || i === 0 || t.getState().fit(s, i);
|
|
453
463
|
};
|
|
454
464
|
if (o(), typeof ResizeObserver > "u") return;
|
|
455
|
-
const
|
|
456
|
-
return
|
|
465
|
+
const c = new ResizeObserver(o);
|
|
466
|
+
return c.observe(e), () => c.disconnect();
|
|
457
467
|
}, [n, t]);
|
|
458
468
|
}
|
|
459
|
-
function
|
|
469
|
+
function z() {
|
|
460
470
|
const n = v((o) => o.registry), t = v((o) => o.view), e = v((o) => o.views[o.view]);
|
|
461
471
|
return w(
|
|
462
472
|
() => ({ registry: n, view: t, views: e === void 0 ? {} : { [t]: e } }),
|
|
463
473
|
[n, t, e]
|
|
464
474
|
);
|
|
465
475
|
}
|
|
466
|
-
function
|
|
467
|
-
const t =
|
|
468
|
-
return w(() =>
|
|
476
|
+
function ut(n) {
|
|
477
|
+
const t = z();
|
|
478
|
+
return w(() => F(t, n), [t, n]);
|
|
469
479
|
}
|
|
470
|
-
function
|
|
471
|
-
const t =
|
|
472
|
-
return w(() =>
|
|
480
|
+
function Ct(n) {
|
|
481
|
+
const t = z();
|
|
482
|
+
return w(() => L(t, n), [t, n]);
|
|
473
483
|
}
|
|
474
484
|
function mn(n) {
|
|
475
|
-
const t =
|
|
485
|
+
const t = z();
|
|
476
486
|
return w(() => $(t, n), [t, n]);
|
|
477
487
|
}
|
|
478
|
-
function
|
|
479
|
-
const t =
|
|
488
|
+
function Zt(n) {
|
|
489
|
+
const t = z();
|
|
480
490
|
return w(() => Y(t, n), [t, n]);
|
|
481
491
|
}
|
|
482
|
-
function
|
|
492
|
+
function dt() {
|
|
483
493
|
return {
|
|
484
494
|
left: mn(X.left.band),
|
|
485
495
|
right: mn(X.right.band)
|
|
486
496
|
};
|
|
487
497
|
}
|
|
488
|
-
function
|
|
498
|
+
function ft() {
|
|
489
499
|
const n = Z(null);
|
|
490
500
|
return w(() => ({
|
|
491
501
|
start: (e, o) => {
|
|
@@ -502,14 +512,14 @@ function nn({
|
|
|
502
512
|
invert: t = !1,
|
|
503
513
|
size: e,
|
|
504
514
|
onSize: o,
|
|
505
|
-
measure:
|
|
515
|
+
measure: c,
|
|
506
516
|
label: s,
|
|
507
517
|
min: i,
|
|
508
518
|
max: r,
|
|
509
|
-
step:
|
|
519
|
+
step: l = 16,
|
|
510
520
|
className: a
|
|
511
521
|
}) {
|
|
512
|
-
const d =
|
|
522
|
+
const d = ft(), f = Z(null), p = n === "vertical", g = N(
|
|
513
523
|
(h) => (p ? h?.clientHeight : h?.clientWidth) ?? 0,
|
|
514
524
|
[p]
|
|
515
525
|
), S = N(
|
|
@@ -522,12 +532,12 @@ function nn({
|
|
|
522
532
|
[d, t, p, o]
|
|
523
533
|
), y = N(
|
|
524
534
|
(h) => {
|
|
525
|
-
const _ = p ? "ArrowUp" : "ArrowLeft",
|
|
526
|
-
if (h.key !== _ && h.key !==
|
|
527
|
-
const P = g(f.current?.parentElement),
|
|
528
|
-
h.preventDefault(), o(
|
|
535
|
+
const _ = p ? "ArrowUp" : "ArrowLeft", x = p ? "ArrowDown" : "ArrowRight";
|
|
536
|
+
if (h.key !== _ && h.key !== x) return;
|
|
537
|
+
const P = g(f.current?.parentElement), R = e ?? c?.() ?? 0, Fn = h.key === x ? 1 : -1;
|
|
538
|
+
h.preventDefault(), o(R + l * Fn * (t ? -1 : 1), P);
|
|
529
539
|
},
|
|
530
|
-
[t, p,
|
|
540
|
+
[t, p, c, o, g, e, l]
|
|
531
541
|
);
|
|
532
542
|
return /* @__PURE__ */ u(
|
|
533
543
|
"div",
|
|
@@ -543,7 +553,7 @@ function nn({
|
|
|
543
553
|
onPointerDown: (h) => {
|
|
544
554
|
h.button !== 0 || !h.isPrimary || d.start(h, {
|
|
545
555
|
position: p ? h.clientY : h.clientX,
|
|
546
|
-
size: e ??
|
|
556
|
+
size: e ?? c?.() ?? 0,
|
|
547
557
|
available: g(h.currentTarget.parentElement)
|
|
548
558
|
});
|
|
549
559
|
},
|
|
@@ -559,47 +569,47 @@ function nn({
|
|
|
559
569
|
function vn(n, t, e, o) {
|
|
560
570
|
return o ? t ?? q(e, n) : 0;
|
|
561
571
|
}
|
|
562
|
-
function
|
|
563
|
-
const t =
|
|
572
|
+
function ht(n) {
|
|
573
|
+
const t = z(), e = v(
|
|
564
574
|
(r) => r.lengths.sizes[V(n)]
|
|
565
575
|
), o = v(
|
|
566
576
|
(r) => r.lengths.sizes[V(C[n])]
|
|
567
|
-
),
|
|
577
|
+
), c = v((r) => r.lengths.splits[n]), s = v(
|
|
568
578
|
(r) => T(n) ? r.available.height : r.available.width
|
|
569
579
|
), i = v((r) => r.focusedZone === n);
|
|
570
580
|
return w(() => {
|
|
571
|
-
const { primary: r, secondary:
|
|
581
|
+
const { primary: r, secondary: l } = L(t, n), a = r !== void 0 || l !== void 0, d = L(t, C[n]), f = Y(t, C[n]), p = vn(r, e, n, a), g = vn(d.primary, o, C[n], f);
|
|
572
582
|
return {
|
|
573
583
|
primary: r,
|
|
574
|
-
secondary:
|
|
584
|
+
secondary: l,
|
|
575
585
|
draws: a,
|
|
576
586
|
// Zero until the container has been measured: bounding against nothing would collapse
|
|
577
587
|
// every zone to its floor on the very first paint.
|
|
578
588
|
size: s === 0 ? p : Gn(p, g, s)[0],
|
|
579
|
-
split:
|
|
589
|
+
split: c,
|
|
580
590
|
focused: i
|
|
581
591
|
};
|
|
582
|
-
}, [t, e, o, s,
|
|
592
|
+
}, [t, e, o, s, c, i, n]);
|
|
583
593
|
}
|
|
584
|
-
function
|
|
594
|
+
function pt(n) {
|
|
585
595
|
const t = v((e) => e.registry);
|
|
586
596
|
return w(() => [
|
|
587
597
|
["primary", t.filter((o) => o.zone === n && o.slot === "primary")],
|
|
588
598
|
["secondary", t.filter((o) => o.zone === n && o.slot === "secondary")]
|
|
589
599
|
].filter(([, o]) => o.length > 0), [t, n]);
|
|
590
600
|
}
|
|
591
|
-
const
|
|
592
|
-
function
|
|
593
|
-
return en(
|
|
601
|
+
const On = on(/* @__PURE__ */ new Map()), gt = On.Provider;
|
|
602
|
+
function mt(n) {
|
|
603
|
+
return en(On).get(n);
|
|
594
604
|
}
|
|
595
|
-
function
|
|
605
|
+
function vt({
|
|
596
606
|
title: n,
|
|
597
607
|
children: t,
|
|
598
608
|
fillActions: e,
|
|
599
609
|
trailing: o,
|
|
600
|
-
className:
|
|
610
|
+
className: c
|
|
601
611
|
}) {
|
|
602
|
-
return /* @__PURE__ */ m("header", { className: b("pnl-header",
|
|
612
|
+
return /* @__PURE__ */ m("header", { className: b("pnl-header", c), children: [
|
|
603
613
|
/* @__PURE__ */ u("span", { className: b("pnl-header__title", e && "pnl-header__title--fixed"), children: n }),
|
|
604
614
|
/* @__PURE__ */ u("span", { className: b("pnl-header__actions", e && "pnl-header__actions--fill"), children: t }),
|
|
605
615
|
/* @__PURE__ */ u("span", { className: "pnl-header__trailing", children: o })
|
|
@@ -617,28 +627,28 @@ function cn({ orientation: n = "vertical", className: t }) {
|
|
|
617
627
|
function Tn({ children: n, className: t, ...e }) {
|
|
618
628
|
return /* @__PURE__ */ u("section", { className: b("pnl-surface", t), ...e, children: n });
|
|
619
629
|
}
|
|
620
|
-
function
|
|
630
|
+
function bt({
|
|
621
631
|
panel: n,
|
|
622
632
|
length: t,
|
|
623
633
|
closeLabel: e,
|
|
624
634
|
onFocus: o,
|
|
625
|
-
ref:
|
|
635
|
+
ref: c
|
|
626
636
|
}) {
|
|
627
|
-
const { close: s } = D(), { IconButton: i } =
|
|
637
|
+
const { close: s } = D(), { IconButton: i } = Rn(), r = mt(n.id);
|
|
628
638
|
return (
|
|
629
639
|
// The zone owns its length: a half given one keeps it, the other takes what is left. Both
|
|
630
640
|
// sized here would make the pair overflow the zone the user dragged.
|
|
631
641
|
/* @__PURE__ */ m(
|
|
632
642
|
Tn,
|
|
633
643
|
{
|
|
634
|
-
ref:
|
|
644
|
+
ref: c,
|
|
635
645
|
"aria-label": n.title,
|
|
636
646
|
onPointerDownCapture: o,
|
|
637
647
|
className: t === void 0 ? "pnl-surface--fill" : "pnl-surface--give",
|
|
638
648
|
style: t === void 0 ? void 0 : { flexBasis: t },
|
|
639
649
|
children: [
|
|
640
650
|
/* @__PURE__ */ u(
|
|
641
|
-
|
|
651
|
+
vt,
|
|
642
652
|
{
|
|
643
653
|
title: n.title,
|
|
644
654
|
fillActions: n.fillActions ?? (r?.actions !== void 0 && T(n.zone)),
|
|
@@ -651,7 +661,7 @@ function vt({
|
|
|
651
661
|
acts: !0,
|
|
652
662
|
onClick: () => s(n.zone, n.slot),
|
|
653
663
|
className: "pnl-icon-button--header",
|
|
654
|
-
icon: /* @__PURE__ */ u(
|
|
664
|
+
icon: /* @__PURE__ */ u(wt, {})
|
|
655
665
|
}
|
|
656
666
|
)
|
|
657
667
|
] }),
|
|
@@ -664,8 +674,8 @@ function vt({
|
|
|
664
674
|
)
|
|
665
675
|
);
|
|
666
676
|
}
|
|
667
|
-
const bn = Sn(
|
|
668
|
-
function
|
|
677
|
+
const bn = Sn(bt);
|
|
678
|
+
function wt() {
|
|
669
679
|
return /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "14", height: "14", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ u(
|
|
670
680
|
"path",
|
|
671
681
|
{
|
|
@@ -674,35 +684,35 @@ function bt() {
|
|
|
674
684
|
}
|
|
675
685
|
) });
|
|
676
686
|
}
|
|
677
|
-
function
|
|
678
|
-
const e =
|
|
679
|
-
(P) =>
|
|
687
|
+
function yt({ zone: n, labels: t }) {
|
|
688
|
+
const e = ht(n), { focus: o, resize: c, resplit: s } = D(), i = Z(null), r = Z(null), l = T(n), a = v(
|
|
689
|
+
(P) => l ? P.available.height : P.available.width
|
|
680
690
|
), d = N(() => o(n), [o, n]), f = N(
|
|
681
|
-
() =>
|
|
682
|
-
[
|
|
691
|
+
() => l ? i.current?.clientHeight ?? 0 : i.current?.clientWidth ?? 0,
|
|
692
|
+
[l]
|
|
683
693
|
), p = N(
|
|
684
|
-
() =>
|
|
685
|
-
[
|
|
694
|
+
() => l ? r.current?.clientWidth ?? 0 : r.current?.clientHeight ?? 0,
|
|
695
|
+
[l]
|
|
686
696
|
);
|
|
687
697
|
if (!e.draws) return null;
|
|
688
698
|
const { primary: g, secondary: S, size: y, split: h } = e, _ = /* @__PURE__ */ m(
|
|
689
699
|
"div",
|
|
690
700
|
{
|
|
691
701
|
ref: i,
|
|
692
|
-
className: b("pnl-zone",
|
|
693
|
-
style: { [
|
|
702
|
+
className: b("pnl-zone", l ? "pnl-zone--row" : "pnl-zone--col"),
|
|
703
|
+
style: { [l ? "height" : "width"]: y },
|
|
694
704
|
children: [
|
|
695
705
|
g && /* @__PURE__ */ u(bn, { panel: g, closeLabel: t.closePanel, onFocus: d }),
|
|
696
706
|
g && S && /* @__PURE__ */ u(
|
|
697
707
|
nn,
|
|
698
708
|
{
|
|
699
|
-
axis:
|
|
709
|
+
axis: l ? "horizontal" : "vertical",
|
|
700
710
|
invert: !0,
|
|
701
711
|
size: h,
|
|
702
|
-
min:
|
|
712
|
+
min: O,
|
|
703
713
|
measure: p,
|
|
704
714
|
label: t.resizeSplit,
|
|
705
|
-
onSize: (P,
|
|
715
|
+
onSize: (P, R) => s(n, P, R)
|
|
706
716
|
}
|
|
707
717
|
),
|
|
708
718
|
S && /* @__PURE__ */ u(
|
|
@@ -717,31 +727,31 @@ function wt({ zone: n, labels: t }) {
|
|
|
717
727
|
)
|
|
718
728
|
]
|
|
719
729
|
}
|
|
720
|
-
),
|
|
730
|
+
), x = /* @__PURE__ */ u(
|
|
721
731
|
nn,
|
|
722
732
|
{
|
|
723
|
-
axis:
|
|
733
|
+
axis: l ? "vertical" : "horizontal",
|
|
724
734
|
invert: !dn(n),
|
|
725
735
|
size: y,
|
|
726
736
|
min: U,
|
|
727
737
|
measure: f,
|
|
728
738
|
label: t.resizeZone,
|
|
729
|
-
onSize: (P,
|
|
739
|
+
onSize: (P, R) => c(n, P, a || R)
|
|
730
740
|
}
|
|
731
741
|
);
|
|
732
742
|
return dn(n) ? /* @__PURE__ */ m(j, { children: [
|
|
733
743
|
_,
|
|
734
|
-
|
|
744
|
+
x
|
|
735
745
|
] }) : /* @__PURE__ */ m(j, { children: [
|
|
736
|
-
|
|
746
|
+
x,
|
|
737
747
|
_
|
|
738
748
|
] });
|
|
739
749
|
}
|
|
740
|
-
const I = Sn(
|
|
741
|
-
function
|
|
742
|
-
const o = v((
|
|
743
|
-
(
|
|
744
|
-
[
|
|
750
|
+
const I = Sn(yt);
|
|
751
|
+
function St({ left: n, right: t, labels: e }) {
|
|
752
|
+
const o = v((l) => l.lengths.bandSplit), { resplitBand: c } = D(), s = Z(null), i = N(
|
|
753
|
+
(l, a) => c(l, a),
|
|
754
|
+
[c]
|
|
745
755
|
), r = N(() => s.current?.clientWidth ?? 0, []);
|
|
746
756
|
return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(I, { zone: n ? "bottomLeft" : "bottomRight", labels: e }) : /* @__PURE__ */ m("div", { className: "pnl-band", children: [
|
|
747
757
|
/* @__PURE__ */ u(
|
|
@@ -758,7 +768,7 @@ function yt({ left: n, right: t, labels: e }) {
|
|
|
758
768
|
{
|
|
759
769
|
axis: "horizontal",
|
|
760
770
|
size: o,
|
|
761
|
-
min:
|
|
771
|
+
min: O,
|
|
762
772
|
measure: r,
|
|
763
773
|
label: e.resizeBand,
|
|
764
774
|
onSize: i
|
|
@@ -771,7 +781,7 @@ function ln(n) {
|
|
|
771
781
|
return null;
|
|
772
782
|
}
|
|
773
783
|
ln.displayName = "Panels.Center";
|
|
774
|
-
const
|
|
784
|
+
const Pt = {
|
|
775
785
|
closePanel: "Close panel",
|
|
776
786
|
resizeZone: "Resize panel area",
|
|
777
787
|
resizeSplit: "Resize the two panels",
|
|
@@ -782,7 +792,7 @@ function an(n) {
|
|
|
782
792
|
}
|
|
783
793
|
an.displayName = "Panels.Panel";
|
|
784
794
|
function wn({ side: n, header: t, className: e }) {
|
|
785
|
-
const { column: o, band:
|
|
795
|
+
const { column: o, band: c } = X[n];
|
|
786
796
|
return /* @__PURE__ */ m(
|
|
787
797
|
"div",
|
|
788
798
|
{
|
|
@@ -797,15 +807,15 @@ function wn({ side: n, header: t, className: e }) {
|
|
|
797
807
|
] }),
|
|
798
808
|
o.map((s) => /* @__PURE__ */ u(yn, { zone: s }, s))
|
|
799
809
|
] }),
|
|
800
|
-
/* @__PURE__ */ u(yn, { zone:
|
|
810
|
+
/* @__PURE__ */ u(yn, { zone: c })
|
|
801
811
|
]
|
|
802
812
|
}
|
|
803
813
|
);
|
|
804
814
|
}
|
|
805
815
|
function yn({ zone: n }) {
|
|
806
|
-
const t =
|
|
807
|
-
return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([i, r],
|
|
808
|
-
|
|
816
|
+
const t = pt(n), e = ut(n), o = v((i) => i.focusedZone === n), { toggle: c } = D(), { IconButton: s } = Rn();
|
|
817
|
+
return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([i, r], l) => /* @__PURE__ */ m(kn, { children: [
|
|
818
|
+
l > 0 && /* @__PURE__ */ u(cn, { orientation: "horizontal" }),
|
|
809
819
|
r.map((a) => {
|
|
810
820
|
const d = e[i] === a.id;
|
|
811
821
|
return /* @__PURE__ */ u(
|
|
@@ -815,7 +825,7 @@ function yn({ zone: n }) {
|
|
|
815
825
|
label: a.title,
|
|
816
826
|
active: d,
|
|
817
827
|
accented: d && o,
|
|
818
|
-
onClick: () =>
|
|
828
|
+
onClick: () => c(a.id),
|
|
819
829
|
className: "pnl-rail__button"
|
|
820
830
|
},
|
|
821
831
|
a.id
|
|
@@ -823,70 +833,70 @@ function yn({ zone: n }) {
|
|
|
823
833
|
})
|
|
824
834
|
] }, `${n}:${i}`)) });
|
|
825
835
|
}
|
|
826
|
-
function
|
|
836
|
+
function Nt(n) {
|
|
827
837
|
const t = [], e = /* @__PURE__ */ new Map(), o = [];
|
|
828
|
-
let
|
|
838
|
+
let c = null;
|
|
829
839
|
for (const s of Dn.toArray(n)) {
|
|
830
840
|
if (!Hn(s)) {
|
|
831
841
|
o.push(s);
|
|
832
842
|
continue;
|
|
833
843
|
}
|
|
834
844
|
if (s.type === ln) {
|
|
835
|
-
|
|
845
|
+
c = s;
|
|
836
846
|
continue;
|
|
837
847
|
}
|
|
838
848
|
if (s.type !== an) {
|
|
839
849
|
o.push(s);
|
|
840
850
|
continue;
|
|
841
851
|
}
|
|
842
|
-
const i = s.props, { actions: r, children:
|
|
843
|
-
t.push({ ...d, slot: a }), e.set(d.id, { content:
|
|
852
|
+
const i = s.props, { actions: r, children: l, slot: a = "primary", ...d } = i;
|
|
853
|
+
t.push({ ...d, slot: a }), e.set(d.id, { content: l, actions: r });
|
|
844
854
|
}
|
|
845
|
-
return { specs: t, content: e, centre:
|
|
855
|
+
return { specs: t, content: e, centre: c, loose: o };
|
|
846
856
|
}
|
|
847
|
-
function
|
|
857
|
+
function An({
|
|
848
858
|
header: n,
|
|
849
859
|
footer: t,
|
|
850
860
|
railHeader: e,
|
|
851
861
|
labels: o,
|
|
852
|
-
theme:
|
|
862
|
+
theme: c,
|
|
853
863
|
className: s,
|
|
854
864
|
components: i,
|
|
855
865
|
children: r,
|
|
856
|
-
...
|
|
866
|
+
...l
|
|
857
867
|
}) {
|
|
858
|
-
return /* @__PURE__ */ u(
|
|
859
|
-
|
|
868
|
+
return /* @__PURE__ */ u(st, { ...l, children: /* @__PURE__ */ u(
|
|
869
|
+
_t,
|
|
860
870
|
{
|
|
861
871
|
header: n,
|
|
862
872
|
footer: t,
|
|
863
873
|
railHeader: e,
|
|
864
874
|
labels: o,
|
|
865
|
-
theme:
|
|
875
|
+
theme: c,
|
|
866
876
|
className: s,
|
|
867
877
|
components: i,
|
|
868
878
|
children: r
|
|
869
879
|
}
|
|
870
880
|
) });
|
|
871
881
|
}
|
|
872
|
-
function
|
|
882
|
+
function _t({
|
|
873
883
|
header: n,
|
|
874
884
|
footer: t,
|
|
875
885
|
railHeader: e,
|
|
876
886
|
labels: o,
|
|
877
|
-
theme:
|
|
887
|
+
theme: c,
|
|
878
888
|
className: s,
|
|
879
889
|
components: i,
|
|
880
890
|
children: r
|
|
881
891
|
}) {
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
const [d] = J(() =>
|
|
892
|
+
const l = k(), a = Z(null);
|
|
893
|
+
at(a);
|
|
894
|
+
const [d] = J(() => lt(i)), { specs: f, content: p, centre: g, loose: S } = w(() => Nt(r), [r]), y = w(() => ({ ...Pt, ...o }), [o]);
|
|
885
895
|
Zn(() => {
|
|
886
|
-
|
|
887
|
-
}, [
|
|
888
|
-
const h =
|
|
889
|
-
return /* @__PURE__ */ u(
|
|
896
|
+
l.getState().declare(f);
|
|
897
|
+
}, [l, f]);
|
|
898
|
+
const h = dt();
|
|
899
|
+
return /* @__PURE__ */ u(ct, { value: d, children: /* @__PURE__ */ u(gt, { value: p, children: /* @__PURE__ */ m("div", { "data-pnl-theme": c, className: b("pnl-root", s), children: [
|
|
890
900
|
n,
|
|
891
901
|
/* @__PURE__ */ m("div", { className: "pnl-middle", children: [
|
|
892
902
|
/* @__PURE__ */ u(wn, { side: "left", header: e }),
|
|
@@ -900,7 +910,7 @@ function Nt({
|
|
|
900
910
|
/* @__PURE__ */ u(Tn, { className: "pnl-centre", children: g?.props.children }),
|
|
901
911
|
h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
|
|
902
912
|
] }),
|
|
903
|
-
/* @__PURE__ */ u(
|
|
913
|
+
/* @__PURE__ */ u(St, { left: h.left, right: h.right, labels: y })
|
|
904
914
|
] }),
|
|
905
915
|
!h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
|
|
906
916
|
] })
|
|
@@ -911,19 +921,19 @@ function Nt({
|
|
|
911
921
|
S
|
|
912
922
|
] }) }) });
|
|
913
923
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
function
|
|
917
|
-
const n = k(), t =
|
|
924
|
+
An.Panel = an;
|
|
925
|
+
An.Center = ln;
|
|
926
|
+
function Mt() {
|
|
927
|
+
const n = k(), t = z(), e = v((i) => i.focusedZone), o = D(), c = N(
|
|
918
928
|
(i) => {
|
|
919
929
|
const r = M(t.registry, i);
|
|
920
|
-
return r !== void 0 &&
|
|
930
|
+
return r !== void 0 && F(t, r.zone)[r.slot] === i;
|
|
921
931
|
},
|
|
922
932
|
[t]
|
|
923
933
|
), s = N(
|
|
924
934
|
(i) => {
|
|
925
935
|
const r = M(t.registry, i);
|
|
926
|
-
!r ||
|
|
936
|
+
!r || F(t, r.zone)[r.slot] !== i || n.getState().close(r.zone, r.slot);
|
|
927
937
|
},
|
|
928
938
|
[t, n]
|
|
929
939
|
);
|
|
@@ -933,31 +943,31 @@ function Zt() {
|
|
|
933
943
|
reveal: o.show,
|
|
934
944
|
close: s,
|
|
935
945
|
toggle: o.toggle,
|
|
936
|
-
isShown:
|
|
946
|
+
isShown: c,
|
|
937
947
|
focusedZone: e,
|
|
938
948
|
reset: o.reset
|
|
939
949
|
}),
|
|
940
|
-
[t, o.show, o.toggle, o.reset, s,
|
|
950
|
+
[t, o.show, o.toggle, o.reset, s, c, e]
|
|
941
951
|
);
|
|
942
952
|
}
|
|
943
953
|
export {
|
|
944
954
|
Wn as BOTTOM_ZONES,
|
|
945
|
-
|
|
955
|
+
St as Band,
|
|
946
956
|
ln as Center,
|
|
947
|
-
|
|
948
|
-
|
|
957
|
+
gt as ContentProvider,
|
|
958
|
+
Pt as DEFAULT_LABELS,
|
|
949
959
|
Yn as DEFAULT_SIZES,
|
|
950
960
|
rn as DEFAULT_VIEW,
|
|
951
|
-
|
|
961
|
+
it as IconButton,
|
|
952
962
|
Cn as LAYOUT_VERSION,
|
|
953
963
|
Nn as MIN_CENTER,
|
|
954
964
|
U as MIN_SIZE,
|
|
955
|
-
|
|
965
|
+
O as MIN_SPLIT,
|
|
956
966
|
an as Panel,
|
|
957
967
|
bn as PanelFrame,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
968
|
+
vt as PanelHeader,
|
|
969
|
+
An as Panels,
|
|
970
|
+
st as PanelsProvider,
|
|
961
971
|
wn as Rail,
|
|
962
972
|
yn as RailZone,
|
|
963
973
|
nn as ResizeHandle,
|
|
@@ -967,8 +977,8 @@ export {
|
|
|
967
977
|
B as ZONES,
|
|
968
978
|
X as ZONES_BY_SIDE,
|
|
969
979
|
I as ZoneEdge,
|
|
970
|
-
|
|
971
|
-
|
|
980
|
+
nt as browserStorage,
|
|
981
|
+
Qn as createPanelsStore,
|
|
972
982
|
b as cx,
|
|
973
983
|
W as fitSplit,
|
|
974
984
|
En as fitZoneSize,
|
|
@@ -976,31 +986,31 @@ export {
|
|
|
976
986
|
T as isHorizontal,
|
|
977
987
|
dn as isLeading,
|
|
978
988
|
xt as memoryStorage,
|
|
979
|
-
|
|
980
|
-
|
|
989
|
+
A as openOf,
|
|
990
|
+
et as readLayout,
|
|
981
991
|
Gn as sharedSizes,
|
|
982
|
-
|
|
983
|
-
|
|
992
|
+
F as shownIn,
|
|
993
|
+
L as shownSpecsIn,
|
|
984
994
|
V as sizeKeyOf,
|
|
985
995
|
M as specOf,
|
|
986
996
|
q as undraggedSizeOf,
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
997
|
+
z as useArrangement,
|
|
998
|
+
dt as useBandHalves,
|
|
999
|
+
at as useContainerFit,
|
|
1000
|
+
mt as usePanelContent,
|
|
1001
|
+
Mt as usePanels,
|
|
992
1002
|
D as usePanelsActions,
|
|
993
|
-
|
|
1003
|
+
Rn as usePanelsComponents,
|
|
994
1004
|
v as usePanelsState,
|
|
995
1005
|
k as usePanelsStore,
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1006
|
+
ft as usePointerDrag,
|
|
1007
|
+
ut as useShownIn,
|
|
1008
|
+
Ct as useShownSpecsIn,
|
|
1009
|
+
ht as useZone,
|
|
1000
1010
|
mn as useZoneDraws,
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1011
|
+
pt as useZonePanels,
|
|
1012
|
+
Zt as useZoneTakesRoom,
|
|
1013
|
+
ot as writeLayout,
|
|
1004
1014
|
$ as zoneDraws,
|
|
1005
1015
|
Y as zoneTakesRoom
|
|
1006
1016
|
};
|
package/llms-full.txt
CHANGED
|
@@ -597,6 +597,12 @@ follows your declarations rather than freezing an answer.
|
|
|
597
597
|
|
|
598
598
|
Focus and the solo stash are session state and are deliberately not written down.
|
|
599
599
|
|
|
600
|
+
**When it is written:** at most once every 250 ms, then when the chassis unmounts and when the
|
|
601
|
+
page is hidden. A drag changes the sizes on every frame, and `localStorage` is synchronous — so
|
|
602
|
+
the writes are held rather than made, and one carries the latest state. A custom `write` is
|
|
603
|
+
therefore called rarely, and reading the storage right after an action may find it not written
|
|
604
|
+
yet.
|
|
605
|
+
|
|
600
606
|
A custom store is two functions:
|
|
601
607
|
|
|
602
608
|
```ts
|
|
@@ -913,6 +919,8 @@ What the chassis does for you:
|
|
|
913
919
|
- every panel is a `<section>` named by its title
|
|
914
920
|
- every handle is a `role="separator"` with `aria-orientation`, `aria-valuenow` and its bounds,
|
|
915
921
|
focusable and driven by the arrow keys
|
|
922
|
+
- a handle takes the main button of the primary pointer and nothing else, and keeps the gesture
|
|
923
|
+
on touch rather than letting the page scroll
|
|
916
924
|
- the focus ring is visible and `prefers-reduced-motion` is respected
|
|
917
925
|
|
|
918
926
|
What is yours: the contrast of your palette, and the accessible names of whatever you put inside
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pasquelin/panels",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Châssis à panneaux React : rails d'icônes, zones redimensionnables, centre libre. Headless + composants par défaut, entièrement surchargeable.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.16.0",
|