@kushagradhawan/kookie-ui 0.1.49 → 0.1.51
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/components.css +880 -243
- package/dist/cjs/components/_internal/shell-bottom.d.ts +31 -5
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-handles.js +1 -1
- package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts +23 -5
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts +24 -6
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/chatbar.d.ts +9 -2
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +3 -3
- package/dist/cjs/components/shell.context.d.ts +88 -0
- package/dist/cjs/components/shell.context.d.ts.map +1 -1
- package/dist/cjs/components/shell.context.js +1 -1
- package/dist/cjs/components/shell.context.js.map +3 -3
- package/dist/cjs/components/shell.d.ts +51 -13
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.hooks.d.ts +7 -1
- package/dist/cjs/components/shell.hooks.d.ts.map +1 -1
- package/dist/cjs/components/shell.hooks.js +1 -1
- package/dist/cjs/components/shell.hooks.js.map +3 -3
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/shell.types.d.ts +1 -0
- package/dist/cjs/components/shell.types.d.ts.map +1 -1
- package/dist/cjs/components/shell.types.js +1 -1
- package/dist/cjs/components/shell.types.js.map +2 -2
- package/dist/cjs/components/sidebar.d.ts +7 -1
- package/dist/cjs/components/sidebar.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +3 -3
- package/dist/esm/components/_internal/shell-bottom.d.ts +31 -5
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
- package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-handles.js +1 -1
- package/dist/esm/components/_internal/shell-handles.js.map +3 -3
- package/dist/esm/components/_internal/shell-inspector.d.ts +23 -5
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
- package/dist/esm/components/_internal/shell-sidebar.d.ts +24 -6
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/esm/components/chatbar.d.ts +9 -2
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/chatbar.js.map +3 -3
- package/dist/esm/components/shell.context.d.ts +88 -0
- package/dist/esm/components/shell.context.d.ts.map +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.context.js.map +3 -3
- package/dist/esm/components/shell.d.ts +51 -13
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.hooks.d.ts +7 -1
- package/dist/esm/components/shell.hooks.d.ts.map +1 -1
- package/dist/esm/components/shell.hooks.js +1 -1
- package/dist/esm/components/shell.hooks.js.map +3 -3
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.js.map +3 -3
- package/dist/esm/components/shell.types.d.ts +1 -0
- package/dist/esm/components/shell.types.d.ts.map +1 -1
- package/dist/esm/components/shell.types.js.map +2 -2
- package/dist/esm/components/sidebar.d.ts +7 -1
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/sidebar.js.map +3 -3
- package/package.json +14 -3
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/base-menu.css +17 -18
- package/src/components/_internal/base-sidebar-menu.css +23 -21
- package/src/components/_internal/base-sidebar.css +20 -0
- package/src/components/_internal/shell-bottom.tsx +176 -49
- package/src/components/_internal/shell-handles.tsx +29 -4
- package/src/components/_internal/shell-inspector.tsx +175 -43
- package/src/components/_internal/shell-sidebar.tsx +176 -69
- package/src/components/chatbar.css +240 -21
- package/src/components/chatbar.tsx +246 -290
- package/src/components/sheet.css +8 -16
- package/src/components/shell.context.tsx +79 -0
- package/src/components/shell.css +28 -2
- package/src/components/shell.hooks.ts +35 -0
- package/src/components/shell.tsx +574 -214
- package/src/components/shell.types.ts +2 -0
- package/src/components/sidebar.css +233 -33
- package/src/components/sidebar.tsx +247 -213
- package/styles.css +841 -204
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BottomHandle } from './shell-handles.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Breakpoint, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';
|
|
4
4
|
interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
presentation?: ResponsivePresentation;
|
|
6
|
-
mode?: PaneMode;
|
|
7
|
-
defaultMode?: any;
|
|
8
|
-
onModeChange?: (mode: PaneMode) => void;
|
|
9
6
|
expandedSize?: number;
|
|
10
7
|
minSize?: number;
|
|
11
8
|
maxSize?: number;
|
|
@@ -23,7 +20,36 @@ interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
23
20
|
paneId?: string;
|
|
24
21
|
persistence?: PaneSizePersistence;
|
|
25
22
|
}
|
|
26
|
-
type
|
|
23
|
+
type BottomOpenChangeMeta = {
|
|
24
|
+
reason: 'init' | 'toggle' | 'responsive';
|
|
25
|
+
};
|
|
26
|
+
type BottomControlledProps = {
|
|
27
|
+
open: boolean | Partial<Record<Breakpoint, boolean>>;
|
|
28
|
+
onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void;
|
|
29
|
+
defaultOpen?: never;
|
|
30
|
+
};
|
|
31
|
+
type BottomUncontrolledProps = {
|
|
32
|
+
defaultOpen?: boolean;
|
|
33
|
+
onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void;
|
|
34
|
+
open?: never;
|
|
35
|
+
};
|
|
36
|
+
type BottomSizeControlledProps = {
|
|
37
|
+
size: number | string;
|
|
38
|
+
defaultSize?: never;
|
|
39
|
+
};
|
|
40
|
+
type BottomSizeUncontrolledProps = {
|
|
41
|
+
defaultSize?: number | string;
|
|
42
|
+
size?: never;
|
|
43
|
+
};
|
|
44
|
+
type BottomSizeChangeMeta = {
|
|
45
|
+
reason: 'init' | 'resize' | 'controlled';
|
|
46
|
+
};
|
|
47
|
+
type BottomPublicProps = PaneProps & (BottomControlledProps | BottomUncontrolledProps) & (BottomSizeControlledProps | BottomSizeUncontrolledProps) & {
|
|
48
|
+
onSizeChange?: (size: number, meta: BottomSizeChangeMeta) => void;
|
|
49
|
+
sizeUpdate?: 'throttle' | 'debounce';
|
|
50
|
+
sizeUpdateMs?: number;
|
|
51
|
+
};
|
|
52
|
+
type BottomComponent = React.ForwardRefExoticComponent<BottomPublicProps & React.RefAttributes<HTMLDivElement>> & {
|
|
27
53
|
Handle: typeof BottomHandle;
|
|
28
54
|
};
|
|
29
55
|
export declare const Bottom: BottomComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-bottom.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-bottom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"shell-bottom.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-bottom.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,YAAY,EAAc,MAAM,oBAAoB,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAY,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3G,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAEtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,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AK,IAAI,CAAC;IAClE,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEJ,KAAK,eAAe,GAAG,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,YAAY,CAAA;CAAE,CAAC;AAElJ,eAAO,MAAM,MAAM,EAuUd,eAAe,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var fe=Object.create;var C=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var be=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var he=(s,l)=>{for(var i in l)C(s,i,{get:l[i],enumerable:!0})},G=(s,l,i,a)=>{if(l&&typeof l=="object"||typeof l=="function")for(let m of pe(l))!ye.call(s,m)&&m!==i&&C(s,m,{get:()=>l[m],enumerable:!(a=ce(l,m))||a.enumerable});return s};var H=(s,l,i)=>(i=s!=null?fe(be(s)):{},G(l||!s||!s.__esModule?C(i,"default",{value:s,enumerable:!0}):i,s)),ze=s=>G(C({},"__esModule",{value:!0}),s);var Pe={};he(Pe,{Bottom:()=>F});module.exports=ze(Pe);var t=H(require("react")),J=H(require("classnames")),U=H(require("../sheet.js")),Q=require("../visually-hidden.js"),X=require("../shell.context.js"),z=require("../shell.hooks.js"),Y=require("./shell-resize.js"),y=require("./shell-handles.js"),Ne=require("../shell.types.js");const F=t.forwardRef(({className:s,presentation:l="fixed",defaultOpen:i,open:a,onOpenChange:m,expandedSize:R=200,minSize:c=100,maxSize:p=400,resizable:S=!1,collapsible:Z=!0,onExpand:I,onCollapse:_,onResize:v,onResizeStart:ee,onResizeEnd:te,snapPoints:ne,snapTolerance:oe,collapseThreshold:re,paneId:x,persistence:E,children:se,style:ie,...u},h)=>{const o=(0,X.useShell)(),N=(0,z.useResponsivePresentation)(l),P=N==="overlay",ae=N==="stacked",f=t.useRef(null),de=t.useCallback(e=>{f.current=e,typeof h=="function"?h(e):h&&(h.current=e)},[h]),$=t.Children.toArray(se),V=$.filter(e=>t.isValidElement(e)&&e.type===y.BottomHandle),A=$.filter(e=>!(t.isValidElement(e)&&e.type===y.BottomHandle)),g=t.useMemo(()=>{const e=u.onSizeChange,n=u.sizeUpdate,d=u.sizeUpdateMs??50;if(!e)return()=>{};if(n==="debounce"){let r=null;return(b,D)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(b,D)},d)}}if(n==="throttle"){let r=0;return(b,D)=>{const K=Date.now();K-r>=d&&(r=K,e(b,D))}}return(r,b)=>e(r,b)},[u.onSizeChange,u.sizeUpdate,u.sizeUpdateMs]),L=t.useRef(!1),le=t.useRef(!1),W=(0,z.useResponsiveValue)(i);t.useEffect(()=>{if(!L.current&&o.currentBreakpointReady&&(L.current=!0,typeof a>"u"&&typeof i<"u")){const e=!!W;o.setBottomMode(e?"expanded":"collapsed"),le.current=!0}},[o.currentBreakpointReady,a,i,W]);const B=t.useRef(null);t.useEffect(()=>{const e=typeof a<"u";if(B.current===null){B.current=e;return}B.current!==e&&(console.warn("Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported."),B.current=e)},[a]),t.useEffect(()=>{typeof a>"u"||o.setBottomMode(a?"expanded":"collapsed")},[a]);const j=t.useRef(!1),w=(0,z.useResponsiveValue)(a);t.useEffect(()=>{if(typeof w>"u")return;const e=!!w;o.setBottomMode(e?"expanded":"collapsed")},[w]);const q=t.useRef(!1),O=t.useRef(null);t.useEffect(()=>{!q.current&&typeof a>"u"&&i&&o.bottomMode==="expanded"&&(m?.(!0,{reason:"init"}),q.current=!0),typeof a>"u"&&(O.current!==null&&O.current!==o.bottomMode&&(j.current||m?.(o.bottomMode==="expanded",{reason:"toggle"}),j.current=!1),O.current=o.bottomMode)},[o.bottomMode,a,i,m]),t.useEffect(()=>{o.bottomMode==="expanded"?I?.():_?.()},[o.bottomMode,I,_]);const k=o.bottomMode==="expanded",M=t.useMemo(()=>{if(!x||E)return E;const e=`kookie-ui:shell:bottom:${x}`;return{load:()=>{if(typeof window>"u")return;const d=window.localStorage.getItem(e);return d?Number(d):void 0},save:d=>{typeof window>"u"||window.localStorage.setItem(e,String(d))}}},[x,E]);t.useEffect(()=>{let e=!0;return(async()=>{if(!S||!M?.load||P)return;const n=await M.load();e&&typeof n=="number"&&f.current&&(f.current.style.setProperty("--bottom-size",`${n}px`),v?.(n))})(),()=>{e=!1}},[S,M,v,P]);const ue=S&&!P&&k?t.createElement(Y.PaneResizeContext.Provider,{value:{containerRef:f,cssVarName:"--bottom-size",minSize:c,maxSize:p,defaultSize:R,orientation:"horizontal",edge:"start",computeNext:(e,n,d)=>{const r=e-n;return d-r},onResize:v,onResizeStart:ee,onResizeEnd:e=>{te?.(e),g(e,{reason:"resize"}),M?.save?.(e)},target:"bottom",collapsible:Z,snapPoints:ne,snapTolerance:oe??8,collapseThreshold:re,requestCollapse:()=>o.setBottomMode("collapsed"),requestToggle:()=>o.togglePane("bottom")}},V.length>0?V.map((e,n)=>t.cloneElement(e,{key:e.key??n})):t.createElement(y.PaneHandle,null)):null,{defaultOpen:ge,open:Be,onOpenChange:Me,size:Ce,defaultSize:Re,onSizeChange:Se,sizeUpdate:ve,sizeUpdateMs:xe,...me}=u,T=t.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const n=String(e).trim();if(!n)return;if(n.endsWith("px"))return Number.parseFloat(n);if(n.endsWith("rem")){const r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(n)*r}if(n.endsWith("%")){const r=Number.parseFloat(n),b=document.documentElement.clientHeight||window.innerHeight||0;return r/100*b}const d=Number.parseFloat(n);return Number.isFinite(d)?d:void 0},[]);if(t.useEffect(()=>{if(f.current&&typeof u.size>"u"&&typeof u.defaultSize<"u"){const e=T(u.defaultSize);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof p=="number"?p:void 0)??e,Math.max((typeof c=="number"?c:void 0)??e,e));f.current.style.setProperty("--bottom-size",`${r}px`),g(r,{reason:"init"})}}},[]),t.useEffect(()=>{if(!f.current||typeof u.size>"u")return;const e=T(u.size);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof p=="number"?p:void 0)??e,Math.max((typeof c=="number"?c:void 0)??e,e));f.current.style.setProperty("--bottom-size",`${r}px`),g(r,{reason:"controlled"})}},[u.size,c,p,T,g]),P){const e=o.bottomMode==="expanded";return t.createElement(U.Root,{open:e,onOpenChange:n=>o.setBottomMode(n?"expanded":"collapsed")},t.createElement(U.Content,{side:"bottom",style:{padding:0},height:{initial:`${R}px`}},t.createElement(Q.VisuallyHidden,null,t.createElement(U.Title,null,"Bottom panel")),A))}return t.createElement("div",{...me,ref:de,className:(0,J.default)("rt-ShellBottom",s),"data-mode":o.bottomMode,"data-peek":o.peekTarget==="bottom"||void 0,"data-presentation":o.currentBreakpointReady?N:void 0,"data-open":o.currentBreakpointReady&&ae&&k||void 0,style:{...ie,"--bottom-size":`${R}px`,"--bottom-min-size":`${c}px`,"--bottom-max-size":`${p}px`}},t.createElement("div",{className:"rt-ShellBottomContent","data-visible":k||void 0},A),ue)});F.displayName="Shell.Bottom",F.Handle=y.BottomHandle;
|
|
2
2
|
//# sourceMappingURL=shell-bottom.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/shell-bottom.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { BottomHandle, PaneHandle } from './shell-handles.js';\nimport { BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n mode?: PaneMode;\n defaultMode?: any;\n onModeChange?: (mode: PaneMode) => void;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype BottomComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof BottomHandle };\n\nexport const Bottom = React.forwardRef<HTMLDivElement, PaneProps>(\n (\n {\n className,\n presentation = 'fixed',\n mode,\n defaultMode = 'collapsed',\n onModeChange,\n expandedSize = 200,\n minSize = 100,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === BottomHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === BottomHandle));\n\n const resolveResponsiveMode = React.useCallback((): PaneMode => {\n if (typeof defaultMode === 'string') return defaultMode as PaneMode;\n const dm = defaultMode as Partial<Record<Breakpoint, PaneMode>> | undefined;\n if (dm && dm[shell.currentBreakpoint as Breakpoint]) {\n return dm[shell.currentBreakpoint as Breakpoint] as PaneMode;\n }\n const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;\n const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);\n const startIdx = order.indexOf(shell.currentBreakpoint as Breakpoint);\n for (let i = startIdx + 1; i < order.length; i++) {\n const bp = order[i];\n if (dm && dm[bp]) {\n return dm[bp] as PaneMode;\n }\n }\n return 'collapsed';\n }, [defaultMode, shell.currentBreakpoint]);\n\n const didInitRef = React.useRef(false);\n React.useEffect(() => {\n if (didInitRef.current) return;\n didInitRef.current = true;\n if (mode === undefined) {\n const initial = resolveResponsiveMode();\n if (shell.bottomMode !== initial) shell.setBottomMode(initial);\n }\n }, []);\n\n const lastBottomBpRef = React.useRef<Breakpoint | null>(null);\n const lastResolvedBottomRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n if (mode !== undefined) return;\n if (!shell.currentBreakpointReady) return;\n if (lastBottomBpRef.current === shell.currentBreakpoint) return;\n lastBottomBpRef.current = shell.currentBreakpoint as Breakpoint;\n const next = resolveResponsiveMode();\n if (lastResolvedBottomRef.current === next) return;\n lastResolvedBottomRef.current = next;\n if (next !== shell.bottomMode) shell.setBottomMode(next);\n }, [mode, shell.currentBreakpoint, shell.currentBreakpointReady, resolveResponsiveMode, shell.bottomMode, shell.setBottomMode]);\n\n React.useEffect(() => {\n if (mode !== undefined && shell.bottomMode !== mode) {\n shell.setBottomMode(mode);\n }\n }, [mode, shell]);\n\n React.useEffect(() => {\n if (mode === undefined) {\n onModeChange?.(shell.bottomMode);\n }\n }, [shell.bottomMode, mode, onModeChange]);\n\n React.useEffect(() => {\n if (shell.bottomMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.bottomMode, onExpand, onCollapse]);\n\n const isExpanded = shell.bottomMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:bottom:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--bottom-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--bottom-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'horizontal',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const delta = client - startClient;\n return startSize - delta;\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n persistenceAdapter?.save?.(size);\n },\n target: 'bottom',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setBottomMode('collapsed'),\n requestToggle: () => shell.togglePane('bottom'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n if (isOverlay) {\n const open = shell.bottomMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setBottomMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"bottom\" style={{ padding: 0 }} height={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Bottom panel</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...props}\n ref={setRef}\n className={classNames('rt-ShellBottom', className)}\n data-mode={shell.bottomMode}\n data-peek={shell.peekTarget === 'bottom' || undefined}\n data-presentation={resolvedPresentation}\n data-open={(isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--bottom-size' as any]: `${expandedSize}px`,\n ['--bottom-min-size' as any]: `${minSize}px`,\n ['--bottom-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellBottomContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAuB,0BACvBC,EAA+B,iCAC/BC,EAAyB,+BACzBC,
|
|
6
|
-
"names": ["shell_bottom_exports", "__export", "Bottom", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "className", "presentation", "
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation, useResponsiveValue } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { BottomHandle, PaneHandle } from './shell-handles.js';\nimport { BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n // legacy mode removed\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype BottomOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' };\ntype BottomControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void; defaultOpen?: never };\ntype BottomUncontrolledProps = { defaultOpen?: boolean; onOpenChange?: (open: boolean, meta: BottomOpenChangeMeta) => void; open?: never };\ntype BottomSizeControlledProps = { size: number | string; defaultSize?: never };\ntype BottomSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype BottomSizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\ntype BottomPublicProps = PaneProps &\n (BottomControlledProps | BottomUncontrolledProps) &\n (BottomSizeControlledProps | BottomSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: BottomSizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n };\n\ntype BottomComponent = React.ForwardRefExoticComponent<BottomPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof BottomHandle };\n\nexport const Bottom = React.forwardRef<HTMLDivElement, BottomPublicProps>(\n (\n {\n className,\n presentation = 'fixed',\n // removed legacy props\n // new API\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 200,\n minSize = 100,\n maxSize = 400,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === BottomHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === BottomHandle));\n\n // Throttled/debounced emitter for onSizeChange\n const emitSizeChange = React.useMemo(() => {\n const cb = (props as any).onSizeChange as undefined | ((s: number, meta: BottomSizeChangeMeta) => void);\n const strategy = (props as any).sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = (props as any).sizeUpdateMs ?? 50;\n if (!cb) return () => {};\n if (strategy === 'debounce') {\n let t: any = null;\n return (s: number, meta: BottomSizeChangeMeta) => {\n if (t) clearTimeout(t);\n t = setTimeout(() => {\n cb(s, meta);\n }, ms);\n };\n }\n if (strategy === 'throttle') {\n let last = 0;\n return (s: number, meta: BottomSizeChangeMeta) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n cb(s, meta);\n }\n };\n }\n return (s: number, meta: BottomSizeChangeMeta) => cb(s, meta);\n }, [(props as any).onSizeChange, (props as any).sizeUpdate, (props as any).sizeUpdateMs]);\n\n const didInitRef = React.useRef(false);\n const didInitFromDefaultOpenRef = React.useRef(false);\n const resolvedDefaultOpen = useResponsiveValue(defaultOpen as any);\n React.useEffect(() => {\n if (didInitRef.current) return;\n if (!shell.currentBreakpointReady) return;\n didInitRef.current = true;\n if (typeof open === 'undefined' && typeof defaultOpen !== 'undefined') {\n const initial = Boolean(resolvedDefaultOpen);\n shell.setBottomMode(initial ? 'expanded' : 'collapsed');\n didInitFromDefaultOpenRef.current = true;\n }\n }, [shell.currentBreakpointReady, open, defaultOpen, resolvedDefaultOpen]);\n\n // Dev guards\n const wasControlledRef = React.useRef<boolean | null>(null);\n if (process.env.NODE_ENV !== 'production') {\n if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {\n // eslint-disable-next-line no-console\n console.error('Shell.Bottom: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n if (typeof (props as any).size !== 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n // eslint-disable-next-line no-console\n console.error('Shell.Bottom: Do not pass both `size` and `defaultSize`. Choose one.');\n }\n }\n\n React.useEffect(() => {\n const isControlled = typeof open !== 'undefined';\n if (wasControlledRef.current === null) {\n wasControlledRef.current = isControlled;\n return;\n }\n if (wasControlledRef.current !== isControlled) {\n // eslint-disable-next-line no-console\n console.warn('Shell.Bottom: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n // Controlled sync (responsive handled below)\n React.useEffect(() => {\n if (typeof open === 'undefined') return;\n shell.setBottomMode(open ? 'expanded' : 'collapsed');\n }, [open]);\n\n const responsiveNotifiedRef = React.useRef(false);\n\n // Controlled responsive open\n const resolvedOpen = useResponsiveValue(open);\n React.useEffect(() => {\n if (typeof resolvedOpen === 'undefined') return;\n const shouldExpand = Boolean(resolvedOpen);\n shell.setBottomMode(shouldExpand ? 'expanded' : 'collapsed');\n }, [resolvedOpen]);\n\n const initNotifiedRef = React.useRef(false);\n const lastBottomModeRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n if (!initNotifiedRef.current && typeof open === 'undefined' && defaultOpen && shell.bottomMode === 'expanded') {\n onOpenChange?.(true, { reason: 'init' });\n initNotifiedRef.current = true;\n }\n if (typeof open === 'undefined') {\n if (lastBottomModeRef.current !== null && lastBottomModeRef.current !== shell.bottomMode) {\n if (!responsiveNotifiedRef.current) {\n onOpenChange?.(shell.bottomMode === 'expanded', { reason: 'toggle' });\n }\n responsiveNotifiedRef.current = false;\n }\n lastBottomModeRef.current = shell.bottomMode;\n }\n }, [shell.bottomMode, open, defaultOpen, onOpenChange]);\n\n React.useEffect(() => {\n if (shell.bottomMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.bottomMode, onExpand, onCollapse]);\n\n const isExpanded = shell.bottomMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:bottom:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--bottom-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--bottom-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'horizontal',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const delta = client - startClient;\n return startSize - delta;\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n emitSizeChange(size, { reason: 'resize' });\n persistenceAdapter?.save?.(size);\n },\n target: 'bottom',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setBottomMode('collapsed'),\n requestToggle: () => shell.togglePane('bottom'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n // Strip control/size props from DOM spread (moved above overlay return to keep hook order consistent)\n const {\n defaultOpen: _bottomDefaultOpenIgnored,\n open: _bottomOpenIgnored,\n onOpenChange: _bottomOnOpenChangeIgnored,\n size: _bottomSizeIgnored,\n defaultSize: _bottomDefaultSizeIgnored,\n onSizeChange: _bottomOnSizeChangeIgnored,\n sizeUpdate: _szu,\n sizeUpdateMs: _szums,\n ...bottomDomProps\n } = props as any;\n\n // Normalize CSS lengths to px (moved above overlay return to keep hook order consistent)\n const normalizeToPx = React.useCallback((value: number | string | undefined): number | undefined => {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n const str = String(value).trim();\n if (!str) return undefined;\n if (str.endsWith('px')) return Number.parseFloat(str);\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base = document.documentElement.clientHeight || window.innerHeight || 0;\n return (pct / 100) * base;\n }\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n }, []);\n\n // Apply defaultSize on mount when uncontrolled (moved above overlay return)\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof (props as any).size === 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n const px = normalizeToPx((props as any).defaultSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--bottom-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'init' });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size sync (moved above overlay return)\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof (props as any).size === 'undefined') return;\n const px = normalizeToPx((props as any).size);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--bottom-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'controlled' });\n }\n }, [(props as any).size, minSize, maxSize, normalizeToPx, emitSizeChange]);\n\n if (isOverlay) {\n const open = shell.bottomMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setBottomMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"bottom\" style={{ padding: 0 }} height={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Bottom panel</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...bottomDomProps}\n ref={setRef}\n className={classNames('rt-ShellBottom', className)}\n data-mode={shell.bottomMode}\n data-peek={shell.peekTarget === 'bottom' || undefined}\n data-presentation={shell.currentBreakpointReady ? resolvedPresentation : undefined}\n data-open={(shell.currentBreakpointReady && isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--bottom-size' as any]: `${expandedSize}px`,\n ['--bottom-min-size' as any]: `${minSize}px`,\n ['--bottom-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellBottomContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as BottomComponent;\nBottom.displayName = 'Shell.Bottom';\nBottom.Handle = BottomHandle;\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,YAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAuB,0BACvBC,EAA+B,iCAC/BC,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CACH,EACC4B,EACH,CAEJ,CACF,EACAzE,EAAO,YAAc,eACrBA,EAAO,OAAS",
|
|
6
|
+
"names": ["shell_bottom_exports", "__export", "Bottom", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "didInitRef", "didInitFromDefaultOpenRef", "resolvedDefaultOpen", "initial", "wasControlledRef", "isControlled", "responsiveNotifiedRef", "resolvedOpen", "shouldExpand", "initNotifiedRef", "lastBottomModeRef", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "delta", "i", "_bottomDefaultOpenIgnored", "_bottomOpenIgnored", "_bottomOnOpenChangeIgnored", "_bottomSizeIgnored", "_bottomDefaultSizeIgnored", "_bottomOnSizeChangeIgnored", "_szu", "_szums", "bottomDomProps", "normalizeToPx", "value", "str", "rem", "pct", "base", "n", "px", "clamped", "o", "classNames"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-handles.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-handles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"shell-handles.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-handles.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,UAAU,mKAwMrB,CAAC;AAGH,eAAO,MAAM,WAAW,mKAA+H,CAAC;AAGxJ,eAAO,MAAM,aAAa,mKAA+H,CAAC;AAG1J,eAAO,MAAM,eAAe,mKAA+H,CAAC;AAG5J,eAAO,MAAM,YAAY,mKAA+H,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _=Object.create;var
|
|
1
|
+
"use strict";var _=Object.create;var A=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var oe=(e,t)=>{for(var u in t)A(e,u,{get:t[u],enumerable:!0})},K=(e,t,u,H)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of te(t))!re.call(e,p)&&p!==u&&A(e,p,{get:()=>t[p],enumerable:!(H=ee(t,p))||H.enumerable});return e};var V=(e,t,u)=>(u=e!=null?_(ne(e)):{},K(t||!e||!e.__esModule?A(u,"default",{value:e,enumerable:!0}):u,e)),ae=e=>K(A({},"__esModule",{value:!0}),e);var se={};oe(se,{BottomHandle:()=>O,InspectorHandle:()=>Y,PaneHandle:()=>g,PanelHandle:()=>B,SidebarHandle:()=>X});module.exports=ae(se);var c=V(require("react")),U=V(require("classnames")),q=require("./shell-resize.js");const g=c.forwardRef(({className:e,children:t,...u},H)=>{const{containerRef:p,cssVarName:m,minSize:C,maxSize:M,defaultSize:D,orientation:w,edge:N,computeNext:j,onResize:b,onResizeStart:T,onResizeEnd:P,snapPoints:z,snapTolerance:G,collapseThreshold:k,collapsible:$,target:ie,requestCollapse:J,requestToggle:Q}=(0,q.usePaneResize)(),R=c.useRef(null);c.useEffect(()=>()=>{try{R.current?.()}catch{}R.current=null},[]);const Z=w;return c.createElement("div",{...u,ref:H,className:(0,U.default)("rt-ShellResizer",e),"data-orientation":w,"data-edge":N,role:"slider","aria-orientation":Z,"aria-valuemin":C,"aria-valuemax":M,"aria-valuenow":D,tabIndex:0,onPointerDown:n=>{if(!p.current)return;n.preventDefault();const o=p.current,d=n.currentTarget,x=n.pointerId;try{R.current?.()}catch{}o.setAttribute("data-resizing","");try{d.setPointerCapture(x)}catch{}const L=w==="vertical"?n.clientX:n.clientY,v=parseFloat(getComputedStyle(o).getPropertyValue(m)||`${D}`),y=l=>Math.min(Math.max(l,C),M),a=document.body,r=a.style.cursor,f=a.style.userSelect;a.style.cursor=w==="vertical"?"col-resize":"row-resize",a.style.userSelect="none",T?.(v);const i=l=>{const E=w==="vertical"?l.clientX:l.clientY,S=y(j(E,L,v));o.style.setProperty(m,`${S}px`),d.setAttribute("aria-valuenow",String(S)),b?.(S)},h=()=>{try{d.releasePointerCapture(x)}catch{}window.removeEventListener("pointermove",i),document.removeEventListener("pointermove",i),window.removeEventListener("mousemove",i),document.removeEventListener("mousemove",i),d.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),document.removeEventListener("pointerup",s),window.removeEventListener("mouseup",s),document.removeEventListener("mouseup",s),window.removeEventListener("pointercancel",s),document.removeEventListener("pointercancel",s),window.removeEventListener("keydown",I),d.removeEventListener("lostpointercapture",s),o.removeAttribute("data-resizing"),a.style.cursor=r,a.style.userSelect=f,R.current=null},s=()=>{const l=parseFloat(getComputedStyle(o).getPropertyValue(m)||`${D}`);let E=l;if(z&&z.length){const S=z.reduce((W,F)=>Math.abs(F-l)<Math.abs(W-l)?F:W,z[0]);Math.abs(S-l)<=(G??8)&&(E=S,o.style.setProperty(m,`${E}px`),d.setAttribute("aria-valuenow",String(E)),b?.(E))}$&&typeof k=="number"&&l<=k&&J?.(),P?.(E),h()},I=l=>{l.key==="Escape"&&(o.style.setProperty(m,`${v}px`),d.setAttribute("aria-valuenow",String(v)),P?.(v),h())};window.addEventListener("pointermove",i),document.addEventListener("pointermove",i),window.addEventListener("mousemove",i),document.addEventListener("mousemove",i),d.addEventListener("pointermove",i),window.addEventListener("pointerup",s),document.addEventListener("pointerup",s),window.addEventListener("mouseup",s),document.addEventListener("mouseup",s),window.addEventListener("pointercancel",s),document.addEventListener("pointercancel",s),window.addEventListener("keydown",I),d.addEventListener("lostpointercapture",s),R.current=h},onDoubleClick:()=>{$&&Q?.()},onKeyDown:n=>{if(!p.current)return;const o=p.current,d=getComputedStyle(o).getPropertyValue(m),x=Number.parseFloat(d.trim()),L=Number.isFinite(x)?x:D,v=r=>Math.min(Math.max(r,C),M),y=n.shiftKey?32:8;let a=0;if(w==="vertical"){const r=typeof document<"u"?document.dir:void 0,f=getComputedStyle(o).direction,i=!!(o.closest&&o.closest('[dir="rtl"]')),h=r==="rtl"||f==="rtl"||i;n.key==="ArrowRight"?a=h?-y:y:n.key==="ArrowLeft"&&(a=h?y:-y)}else n.key==="ArrowDown"?a=y:n.key==="ArrowUp"&&(a=-y);if(n.key==="Home"){n.preventDefault(),T?.(L);const r=v(C);o.style.setProperty(m,`${r}px`),n.currentTarget.setAttribute("aria-valuenow",String(r)),b?.(r),P?.(r);return}if(n.key==="End"){n.preventDefault(),T?.(L);const r=v(M);o.style.setProperty(m,`${r}px`),n.currentTarget.setAttribute("aria-valuenow",String(r)),b?.(r),P?.(r);return}if(a!==0){n.preventDefault(),T?.(L);const r=w==="vertical"&&N==="start"?-a:a,f=v(L+r);o.style.setProperty(m,`${f}px`),n.currentTarget.setAttribute("aria-valuenow",String(f)),b?.(f),P?.(f)}}},t)});g.displayName="Shell.Handle";const B=c.forwardRef((e,t)=>c.createElement(g,{...e,ref:t}));B.displayName="Shell.Panel.Handle";const X=c.forwardRef((e,t)=>c.createElement(g,{...e,ref:t}));X.displayName="Shell.Sidebar.Handle";const Y=c.forwardRef((e,t)=>c.createElement(g,{...e,ref:t}));Y.displayName="Shell.Inspector.Handle";const O=c.forwardRef((e,t)=>c.createElement(g,{...e,ref:t}));O.displayName="Shell.Bottom.Handle";
|
|
2
2
|
//# sourceMappingURL=shell-handles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/shell-handles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { usePaneResize } from './shell-resize.js';\n\nexport const PaneHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(({ className, children, ...props }, ref) => {\n const {\n containerRef,\n cssVarName,\n minSize,\n maxSize,\n defaultSize,\n orientation,\n edge,\n computeNext,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n collapsible,\n target,\n requestCollapse,\n requestToggle,\n } = usePaneResize();\n\n const activeCleanupRef = React.useRef<(() => void) | null>(null);\n React.useEffect(\n () => () => {\n try {\n activeCleanupRef.current?.();\n } catch {}\n activeCleanupRef.current = null;\n },\n [],\n );\n\n const ariaOrientation = orientation;\n\n return (\n <div\n {...props}\n ref={ref}\n className={classNames('rt-ShellResizer', className)}\n data-orientation={orientation}\n data-edge={edge}\n role=\"slider\"\n aria-orientation={ariaOrientation}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={defaultSize}\n tabIndex={0}\n onPointerDown={(e) => {\n if (!containerRef.current) return;\n e.preventDefault();\n const container = containerRef.current;\n const handleEl = e.currentTarget as HTMLElement;\n const pointerId = e.pointerId;\n try {\n activeCleanupRef.current?.();\n } catch {}\n container.setAttribute('data-resizing', '');\n try {\n handleEl.setPointerCapture(pointerId);\n } catch {}\n const startClient = orientation === 'vertical' ? e.clientX : e.clientY;\n const startSize = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n const clamp = (v: number) => Math.min(Math.max(v, minSize), maxSize);\n const body = document.body;\n const prevCursor = body.style.cursor;\n const prevUserSelect = body.style.userSelect;\n body.style.cursor = orientation === 'vertical' ? 'col-resize' : 'row-resize';\n body.style.userSelect = 'none';\n onResizeStart?.(startSize);\n const handleMove = (ev: PointerEvent) => {\n const client = orientation === 'vertical' ? ev.clientX : ev.clientY;\n const next = clamp(computeNext(client, startClient, startSize));\n container.style.setProperty(cssVarName, `${next}px`);\n handleEl.setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n };\n const cleanup = () => {\n try {\n handleEl.releasePointerCapture(pointerId);\n } catch {}\n window.removeEventListener('pointermove', handleMove as any);\n window.removeEventListener('pointerup', handleUp as any);\n window.removeEventListener('pointercancel', handleUp as any);\n window.removeEventListener('keydown', handleKey as any);\n handleEl.removeEventListener('lostpointercapture', handleUp as any);\n container.removeAttribute('data-resizing');\n body.style.cursor = prevCursor;\n body.style.userSelect = prevUserSelect;\n activeCleanupRef.current = null;\n };\n const handleUp = () => {\n const finalSize = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n let snapped = finalSize;\n if (snapPoints && snapPoints.length) {\n const nearest = snapPoints.reduce((acc, p) => (Math.abs(p - finalSize) < Math.abs(acc - finalSize) ? p : acc), snapPoints[0]);\n if (Math.abs(nearest - finalSize) <= (snapTolerance ?? 8)) {\n snapped = nearest;\n container.style.setProperty(cssVarName, `${snapped}px`);\n handleEl.setAttribute('aria-valuenow', String(snapped));\n onResize?.(snapped);\n }\n }\n if (collapsible && typeof collapseThreshold === 'number' && finalSize <= collapseThreshold) {\n requestCollapse?.();\n }\n onResizeEnd?.(snapped);\n cleanup();\n };\n const handleKey = (kev: KeyboardEvent) => {\n if (kev.key === 'Escape') {\n container.style.setProperty(cssVarName, `${startSize}px`);\n handleEl.setAttribute('aria-valuenow', String(startSize));\n onResizeEnd?.(startSize);\n cleanup();\n }\n };\n window.addEventListener('pointermove', handleMove as any);\n window.addEventListener('pointerup', handleUp as any);\n window.addEventListener('pointercancel', handleUp as any);\n window.addEventListener('keydown', handleKey as any);\n handleEl.addEventListener('lostpointercapture', handleUp as any);\n activeCleanupRef.current = cleanup;\n }}\n onDoubleClick={() => {\n if (collapsible) requestToggle?.();\n }}\n onKeyDown={(e) => {\n if (!containerRef.current) return;\n const container = containerRef.current;\n const
|
|
5
|
-
"mappings": "okBAAA,I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,EAAI,KAAK,IAAIG,EAAMH,CAAS,EAAII,EAAID,EAAM/B,EAAW,CAAC,CAAC,EACxH,KAAK,IAAI8B,EAAUF,CAAS,IAAM3B,GAAiB,KACrD4B,EAAUC,EACVnB,EAAU,MAAM,YAAYrB,EAAY,GAAGuC,CAAO,IAAI,EACtDjB,EAAS,aAAa,gBAAiB,OAAOiB,CAAO,CAAC,EACtDhC,IAAWgC,CAAO,EAEtB,CACI1B,GAAe,OAAOD,GAAsB,UAAY0B,GAAa1B,GACvEG,IAAkB,EAEpBN,IAAc8B,CAAO,EACrBJ,EAAQ,CACV,EACME,EAAaM,GAAuB,CACpCA,EAAI,MAAQ,WACdtB,EAAU,MAAM,YAAYrB,EAAY,GAAGyB,CAAS,IAAI,EACxDH,EAAS,aAAa,gBAAiB,OAAOG,CAAS,CAAC,EACxDhB,IAAcgB,CAAS,EACvBU,EAAQ,EAEZ,EACA,OAAO,iBAAiB,cAAeJ,CAAiB,EACxD,OAAO,iBAAiB,YAAaK,CAAe,EACpD,OAAO,iBAAiB,gBAAiBA,CAAe,EACxD,OAAO,iBAAiB,UAAWC,CAAgB,EACnDf,EAAS,iBAAiB,qBAAsBc,CAAe,EAC/DnB,EAAiB,QAAUkB,CAC7B,EACA,cAAe,IAAM,CACftB,GAAaG,IAAgB,CACnC,EACA,UAAYI,GAAM,CAChB,GAAI,CAACrB,EAAa,QAAS,OAC3B,MAAMsB,EAAYtB,EAAa,QACzB6C,
|
|
6
|
-
"names": ["shell_handles_exports", "__export", "BottomHandle", "InspectorHandle", "PaneHandle", "PanelHandle", "SidebarHandle", "__toCommonJS", "React", "import_classnames", "import_shell_resize", "className", "children", "props", "ref", "containerRef", "cssVarName", "minSize", "maxSize", "defaultSize", "orientation", "edge", "computeNext", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "collapsible", "target", "requestCollapse", "requestToggle", "activeCleanupRef", "ariaOrientation", "classNames", "e", "container", "handleEl", "pointerId", "startClient", "startSize", "clamp", "v", "body", "prevCursor", "prevUserSelect", "handleMove", "ev", "client", "next", "cleanup", "handleUp", "handleKey", "finalSize", "snapped", "nearest", "acc", "p", "kev", "current", "step", "delta"]
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { usePaneResize } from './shell-resize.js';\n\nexport const PaneHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(({ className, children, ...props }, ref) => {\n const {\n containerRef,\n cssVarName,\n minSize,\n maxSize,\n defaultSize,\n orientation,\n edge,\n computeNext,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n collapsible,\n target,\n requestCollapse,\n requestToggle,\n } = usePaneResize();\n\n const activeCleanupRef = React.useRef<(() => void) | null>(null);\n React.useEffect(\n () => () => {\n try {\n activeCleanupRef.current?.();\n } catch {}\n activeCleanupRef.current = null;\n },\n [],\n );\n\n const ariaOrientation = orientation;\n\n return (\n <div\n {...props}\n ref={ref}\n className={classNames('rt-ShellResizer', className)}\n data-orientation={orientation}\n data-edge={edge}\n role=\"slider\"\n aria-orientation={ariaOrientation}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={defaultSize}\n tabIndex={0}\n onPointerDown={(e) => {\n if (!containerRef.current) return;\n e.preventDefault();\n const container = containerRef.current;\n const handleEl = e.currentTarget as HTMLElement;\n const pointerId = e.pointerId;\n try {\n activeCleanupRef.current?.();\n } catch {}\n container.setAttribute('data-resizing', '');\n try {\n handleEl.setPointerCapture(pointerId);\n } catch {}\n const startClient = orientation === 'vertical' ? e.clientX : e.clientY;\n const startSize = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n const clamp = (v: number) => Math.min(Math.max(v, minSize), maxSize);\n const body = document.body;\n const prevCursor = body.style.cursor;\n const prevUserSelect = body.style.userSelect;\n body.style.cursor = orientation === 'vertical' ? 'col-resize' : 'row-resize';\n body.style.userSelect = 'none';\n onResizeStart?.(startSize);\n const handleMove = (ev: PointerEvent) => {\n const client = orientation === 'vertical' ? ev.clientX : ev.clientY;\n const next = clamp(computeNext(client, startClient, startSize));\n container.style.setProperty(cssVarName, `${next}px`);\n handleEl.setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n };\n const cleanup = () => {\n try {\n handleEl.releasePointerCapture(pointerId);\n } catch {}\n window.removeEventListener('pointermove', handleMove as any);\n document.removeEventListener('pointermove', handleMove as any);\n window.removeEventListener('mousemove', handleMove as any);\n document.removeEventListener('mousemove', handleMove as any);\n handleEl.removeEventListener('pointermove', handleMove as any);\n window.removeEventListener('pointerup', handleUp as any);\n document.removeEventListener('pointerup', handleUp as any);\n window.removeEventListener('mouseup', handleUp as any);\n document.removeEventListener('mouseup', handleUp as any);\n window.removeEventListener('pointercancel', handleUp as any);\n document.removeEventListener('pointercancel', handleUp as any);\n window.removeEventListener('keydown', handleKey as any);\n handleEl.removeEventListener('lostpointercapture', handleUp as any);\n container.removeAttribute('data-resizing');\n body.style.cursor = prevCursor;\n body.style.userSelect = prevUserSelect;\n activeCleanupRef.current = null;\n };\n const handleUp = () => {\n const finalSize = parseFloat(getComputedStyle(container).getPropertyValue(cssVarName) || `${defaultSize}`);\n let snapped = finalSize;\n if (snapPoints && snapPoints.length) {\n const nearest = snapPoints.reduce((acc, p) => (Math.abs(p - finalSize) < Math.abs(acc - finalSize) ? p : acc), snapPoints[0]);\n if (Math.abs(nearest - finalSize) <= (snapTolerance ?? 8)) {\n snapped = nearest;\n container.style.setProperty(cssVarName, `${snapped}px`);\n handleEl.setAttribute('aria-valuenow', String(snapped));\n onResize?.(snapped);\n }\n }\n if (collapsible && typeof collapseThreshold === 'number' && finalSize <= collapseThreshold) {\n requestCollapse?.();\n }\n onResizeEnd?.(snapped);\n cleanup();\n };\n const handleKey = (kev: KeyboardEvent) => {\n if (kev.key === 'Escape') {\n container.style.setProperty(cssVarName, `${startSize}px`);\n handleEl.setAttribute('aria-valuenow', String(startSize));\n onResizeEnd?.(startSize);\n cleanup();\n }\n };\n window.addEventListener('pointermove', handleMove as any);\n document.addEventListener('pointermove', handleMove as any);\n // Fallbacks for environments that don't fully support PointerEvent on window\n window.addEventListener('mousemove', handleMove as any);\n document.addEventListener('mousemove', handleMove as any);\n handleEl.addEventListener('pointermove', handleMove as any);\n window.addEventListener('pointerup', handleUp as any);\n document.addEventListener('pointerup', handleUp as any);\n window.addEventListener('mouseup', handleUp as any);\n document.addEventListener('mouseup', handleUp as any);\n window.addEventListener('pointercancel', handleUp as any);\n document.addEventListener('pointercancel', handleUp as any);\n window.addEventListener('keydown', handleKey as any);\n handleEl.addEventListener('lostpointercapture', handleUp as any);\n activeCleanupRef.current = cleanup;\n }}\n onDoubleClick={() => {\n if (collapsible) requestToggle?.();\n }}\n onKeyDown={(e) => {\n if (!containerRef.current) return;\n const container = containerRef.current;\n const rawCurrent = getComputedStyle(container).getPropertyValue(cssVarName);\n const parsedCurrent = Number.parseFloat(rawCurrent.trim());\n const current = Number.isFinite(parsedCurrent) ? parsedCurrent : defaultSize;\n const clamp = (v: number) => Math.min(Math.max(v, minSize), maxSize);\n const step = e.shiftKey ? 32 : 8;\n let delta = 0;\n if (orientation === 'vertical') {\n const docDir = typeof document !== 'undefined' ? document.dir : undefined;\n const cssDir = getComputedStyle(container).direction;\n const hasRtlAncestor = !!(container.closest && container.closest('[dir=\"rtl\"]'));\n const isRtl = docDir === 'rtl' || cssDir === 'rtl' || hasRtlAncestor;\n if (e.key === 'ArrowRight')\n delta = isRtl ? -step : step; // inline-end\n else if (e.key === 'ArrowLeft') delta = isRtl ? step : -step; // inline-start\n } else {\n if (e.key === 'ArrowDown') delta = step;\n else if (e.key === 'ArrowUp') delta = -step;\n }\n if (e.key === 'Home') {\n e.preventDefault();\n onResizeStart?.(current);\n const next = clamp(minSize);\n container.style.setProperty(cssVarName, `${next}px`);\n (e.currentTarget as HTMLElement).setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n onResizeEnd?.(next);\n return;\n }\n if (e.key === 'End') {\n e.preventDefault();\n onResizeStart?.(current);\n const next = clamp(maxSize);\n container.style.setProperty(cssVarName, `${next}px`);\n (e.currentTarget as HTMLElement).setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n onResizeEnd?.(next);\n return;\n }\n if (delta !== 0) {\n e.preventDefault();\n onResizeStart?.(current);\n const signedDelta = orientation === 'vertical' ? (edge === 'start' ? -delta : delta) : delta;\n const next = clamp(current + signedDelta);\n container.style.setProperty(cssVarName, `${next}px`);\n (e.currentTarget as HTMLElement).setAttribute('aria-valuenow', String(next));\n onResize?.(next);\n onResizeEnd?.(next);\n }\n }}\n >\n {children}\n </div>\n );\n});\nPaneHandle.displayName = 'Shell.Handle';\n\nexport const PanelHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nPanelHandle.displayName = 'Shell.Panel.Handle';\n\nexport const SidebarHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nSidebarHandle.displayName = 'Shell.Sidebar.Handle';\n\nexport const InspectorHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nInspectorHandle.displayName = 'Shell.Inspector.Handle';\n\nexport const BottomHandle = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>((props, ref) => <PaneHandle {...props} ref={ref} />);\nBottomHandle.displayName = 'Shell.Bottom.Handle';\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,EAAA,oBAAAC,EAAA,eAAAC,EAAA,gBAAAC,EAAA,kBAAAC,IAAA,eAAAC,GAAAP,IAAA,IAAAQ,EAAuB,oBACvBC,EAAuB,yBACvBC,EAA8B,6BAEvB,MAAMN,EAAaI,EAAM,WAAkE,CAAC,CAAE,UAAAG,EAAW,SA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B,CAAI,EAClB,MACF,CACA,GAAIc,IAAU,EAAG,CACf5B,EAAE,eAAe,EACjBZ,IAAgBsC,CAAO,EACvB,MAAMO,EAAcjD,IAAgB,YAAcC,IAAS,QAAU,CAAC2C,EAAiBA,EACjFd,EAAOR,EAAMoB,EAAUO,CAAW,EACxChC,EAAU,MAAM,YAAYrB,EAAY,GAAGkC,CAAI,IAAI,EAClDd,EAAE,cAA8B,aAAa,gBAAiB,OAAOc,CAAI,CAAC,EAC3E3B,IAAW2B,CAAI,EACfzB,IAAcyB,CAAI,CACpB,CACF,GAECtC,CACH,CAEJ,CAAC,EACDR,EAAW,YAAc,eAElB,MAAMC,EAAcG,EAAM,WAAkE,CAACK,EAAOC,IAAQN,EAAA,cAACJ,EAAA,CAAY,GAAGS,EAAO,IAAKC,EAAK,CAAE,EACtJT,EAAY,YAAc,qBAEnB,MAAMC,EAAgBE,EAAM,WAAkE,CAACK,EAAOC,IAAQN,EAAA,cAACJ,EAAA,CAAY,GAAGS,EAAO,IAAKC,EAAK,CAAE,EACxJR,EAAc,YAAc,uBAErB,MAAMH,EAAkBK,EAAM,WAAkE,CAACK,EAAOC,IAAQN,EAAA,cAACJ,EAAA,CAAY,GAAGS,EAAO,IAAKC,EAAK,CAAE,EAC1JX,EAAgB,YAAc,yBAEvB,MAAMD,EAAeM,EAAM,WAAkE,CAACK,EAAOC,IAAQN,EAAA,cAACJ,EAAA,CAAY,GAAGS,EAAO,IAAKC,EAAK,CAAE,EACvJZ,EAAa,YAAc",
|
|
6
|
+
"names": ["shell_handles_exports", "__export", "BottomHandle", "InspectorHandle", "PaneHandle", "PanelHandle", "SidebarHandle", "__toCommonJS", "React", "import_classnames", "import_shell_resize", "className", "children", "props", "ref", "containerRef", "cssVarName", "minSize", "maxSize", "defaultSize", "orientation", "edge", "computeNext", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "collapsible", "target", "requestCollapse", "requestToggle", "activeCleanupRef", "ariaOrientation", "classNames", "e", "container", "handleEl", "pointerId", "startClient", "startSize", "clamp", "v", "body", "prevCursor", "prevUserSelect", "handleMove", "ev", "client", "next", "cleanup", "handleUp", "handleKey", "finalSize", "snapped", "nearest", "acc", "p", "kev", "rawCurrent", "parsedCurrent", "current", "step", "delta", "docDir", "cssDir", "hasRtlAncestor", "isRtl", "signedDelta"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { InspectorHandle } from './shell-handles.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Breakpoint, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';
|
|
4
4
|
interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
presentation?: ResponsivePresentation;
|
|
6
|
-
mode?: PaneMode;
|
|
7
|
-
defaultMode?: any;
|
|
8
|
-
onModeChange?: (mode: PaneMode) => void;
|
|
9
6
|
expandedSize?: number;
|
|
10
7
|
minSize?: number;
|
|
11
8
|
maxSize?: number;
|
|
@@ -23,7 +20,28 @@ interface PaneProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
23
20
|
paneId?: string;
|
|
24
21
|
persistence?: PaneSizePersistence;
|
|
25
22
|
}
|
|
26
|
-
type
|
|
23
|
+
type InspectorOpenChangeMeta = {
|
|
24
|
+
reason: 'init' | 'toggle' | 'responsive';
|
|
25
|
+
};
|
|
26
|
+
type InspectorControlledProps = {
|
|
27
|
+
open: boolean | Partial<Record<Breakpoint, boolean>>;
|
|
28
|
+
onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void;
|
|
29
|
+
defaultOpen?: never;
|
|
30
|
+
};
|
|
31
|
+
type InspectorUncontrolledProps = {
|
|
32
|
+
defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>;
|
|
33
|
+
onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void;
|
|
34
|
+
open?: never;
|
|
35
|
+
};
|
|
36
|
+
type InspectorSizeChangeMeta = {
|
|
37
|
+
reason: 'init' | 'resize' | 'controlled';
|
|
38
|
+
};
|
|
39
|
+
type InspectorPublicProps = PaneProps & (InspectorControlledProps | InspectorUncontrolledProps) & {
|
|
40
|
+
onSizeChange?: (size: number, meta: InspectorSizeChangeMeta) => void;
|
|
41
|
+
sizeUpdate?: 'throttle' | 'debounce';
|
|
42
|
+
sizeUpdateMs?: number;
|
|
43
|
+
};
|
|
44
|
+
type InspectorComponent = React.ForwardRefExoticComponent<InspectorPublicProps & React.RefAttributes<HTMLDivElement>> & {
|
|
27
45
|
Handle: typeof InspectorHandle;
|
|
28
46
|
};
|
|
29
47
|
export declare const Inspector: InspectorComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-inspector.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,eAAe,EAAc,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"shell-inspector.d.ts","sourceRoot":"","sources":["../../../../src/components/_internal/shell-inspector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAE,eAAe,EAAc,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAY,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE3G,UAAU,SAAU,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/D,YAAY,CAAC,EAAE,sBAAsB,CAAC;IAEtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC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AAK,oBAAoB,GAAG,SAAS,GACnC,CAAC,wBAAwB,GAAG,0BAA0B,CAAC,GAAG;IACxD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC;IACrE,UAAU,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEJ,KAAK,kBAAkB,GAAG,KAAK,CAAC,yBAAyB,CAAC,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,OAAO,eAAe,CAAA;CAAE,CAAC;AAE3J,eAAO,MAAM,SAAS,EAqUjB,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var ue=Object.create;var I=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var be=(s,d)=>{for(var i in d)I(s,i,{get:d[i],enumerable:!0})},G=(s,d,i,l)=>{if(d&&typeof d=="object"||typeof d=="function")for(let u of fe(d))!ye.call(s,u)&&u!==i&&I(s,u,{get:()=>d[u],enumerable:!(l=pe(d,u))||l.enumerable});return s};var H=(s,d,i)=>(i=s!=null?ue(me(s)):{},G(d||!s||!s.__esModule?I(i,"default",{value:s,enumerable:!0}):i,s)),he=s=>G(I({},"__esModule",{value:!0}),s);var Pe={};be(Pe,{Inspector:()=>B});module.exports=he(Pe);var n=H(require("react")),J=H(require("classnames")),F=H(require("../sheet.js")),Q=require("../visually-hidden.js"),X=require("../shell.context.js"),P=require("../shell.hooks.js"),Y=require("./shell-resize.js"),b=require("./shell-handles.js"),Se=require("../shell.types.js");const B=n.forwardRef(({className:s,presentation:d={initial:"overlay",lg:"fixed"},defaultOpen:i,open:l,onOpenChange:u,expandedSize:v=320,minSize:m=200,maxSize:y=500,resizable:x=!1,collapsible:Z=!0,onExpand:U,onCollapse:_,onResize:C,onResizeStart:ee,onResizeEnd:ne,snapPoints:te,snapTolerance:oe,collapseThreshold:re,paneId:E,persistence:S,children:se,style:ie,...c},h)=>{const t=(0,X.useShell)(),N=(0,P.useResponsivePresentation)(d),M=N==="overlay",ae=N==="stacked",f=n.useRef(null),de=n.useCallback(e=>{f.current=e,typeof h=="function"?h(e):h&&(h.current=e)},[h]),$=n.Children.toArray(se),V=$.filter(e=>n.isValidElement(e)&&e.type===b.InspectorHandle),W=$.filter(e=>!(n.isValidElement(e)&&e.type===b.InspectorHandle)),g=n.useMemo(()=>{const e=c.onSizeChange,o=c.sizeUpdate,a=c.sizeUpdateMs??50;if(!e)return()=>{};if(o==="debounce"){let r=null;return(p,D)=>{r&&clearTimeout(r),r=setTimeout(()=>{e(p,D)},a)}}if(o==="throttle"){let r=0;return(p,D)=>{const K=Date.now();K-r>=a&&(r=K,e(p,D))}}return(r,p)=>e(r,p)},[c.onSizeChange,c.sizeUpdate,c.sizeUpdateMs]),R=n.useRef(null);n.useEffect(()=>{const e=typeof l<"u";if(R.current===null){R.current=e;return}R.current!==e&&(console.warn("Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported."),R.current=e)},[l]);const A=n.useRef(!1),L=n.useRef(!1),j=(0,P.useResponsiveValue)(i);n.useEffect(()=>{if(!t.currentBreakpointReady||L.current||typeof l<"u"||typeof i>"u")return;const e=!!j;t.setInspectorMode(e?"expanded":"collapsed"),e&&u?.(!0,{reason:"init"}),L.current=!0},[t.currentBreakpointReady,j,i,l,u]);const w=(0,P.useResponsiveValue)(l);n.useEffect(()=>{if(typeof w>"u")return;const e=!!w;e&&t.inspectorMode!=="expanded"&&t.setInspectorMode("expanded"),!e&&t.inspectorMode!=="collapsed"&&t.setInspectorMode("collapsed")},[w,t.inspectorMode]);const q=n.useRef(!1),k=n.useRef(null);n.useEffect(()=>{!q.current&&typeof l>"u"&&i&&t.inspectorMode==="expanded"&&(u?.(!0,{reason:"init"}),q.current=!0),typeof l>"u"&&(k.current!==null&&k.current!==t.inspectorMode&&(A.current||u?.(t.inspectorMode==="expanded",{reason:"toggle"}),A.current=!1),k.current=t.inspectorMode)},[t.inspectorMode,l,i,u]),n.useEffect(()=>{t.inspectorMode==="expanded"?U?.():_?.()},[t.inspectorMode,U,_]);const O=t.inspectorMode==="expanded",z=n.useMemo(()=>{if(!E||S)return S;const e=`kookie-ui:shell:inspector:${E}`;return{load:()=>{if(typeof window>"u")return;const a=window.localStorage.getItem(e);return a?Number(a):void 0},save:a=>{typeof window>"u"||window.localStorage.setItem(e,String(a))}}},[E,S]);n.useEffect(()=>{let e=!0;return(async()=>{if(!x||!z?.load||M)return;const o=await z.load();e&&typeof o=="number"&&f.current&&(f.current.style.setProperty("--inspector-size",`${o}px`),C?.(o))})(),()=>{e=!1}},[x,z,C,M]);const ce=x&&!M&&O?n.createElement(Y.PaneResizeContext.Provider,{value:{containerRef:f,cssVarName:"--inspector-size",minSize:m,maxSize:y,defaultSize:v,orientation:"vertical",edge:"start",computeNext:(e,o,a)=>{const r=getComputedStyle(f.current).direction==="rtl",p=e-o;return a+(r?p:-p)},onResize:C,onResizeStart:ee,onResizeEnd:e=>{ne?.(e),g(e,{reason:"resize"}),z?.save?.(e)},target:"inspector",collapsible:Z,snapPoints:te,snapTolerance:oe??8,collapseThreshold:re,requestCollapse:()=>t.setInspectorMode("collapsed"),requestToggle:()=>t.togglePane("inspector")}},V.length>0?V.map((e,o)=>n.cloneElement(e,{key:e.key??o})):n.createElement(b.PaneHandle,null)):null,T=n.useCallback(e=>{if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const o=String(e).trim();if(!o)return;if(o.endsWith("px"))return Number.parseFloat(o);if(o.endsWith("rem")){const r=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16")||16;return Number.parseFloat(o)*r}if(o.endsWith("%")){const r=Number.parseFloat(o),p=document.documentElement.clientWidth||window.innerWidth||0;return r/100*p}const a=Number.parseFloat(o);return Number.isFinite(a)?a:void 0},[]);if(n.useEffect(()=>{if(f.current&&typeof c.size>"u"&&typeof c.defaultSize<"u"){const e=T(c.defaultSize);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof y=="number"?y:void 0)??e,Math.max((typeof m=="number"?m:void 0)??e,e));f.current.style.setProperty("--inspector-size",`${r}px`),g(r,{reason:"init"})}}},[]),n.useEffect(()=>{if(!f.current||typeof c.size>"u")return;const e=T(c.size);if(typeof e=="number"&&Number.isFinite(e)){const r=Math.min((typeof y=="number"?y:void 0)??e,Math.max((typeof m=="number"?m:void 0)??e,e));f.current.style.setProperty("--inspector-size",`${r}px`),g(r,{reason:"controlled"})}},[c.size,m,y,T,g]),M){const e=t.inspectorMode==="expanded";return n.createElement(F.Root,{open:e,onOpenChange:o=>t.setInspectorMode(o?"expanded":"collapsed")},n.createElement(F.Content,{side:"end",style:{padding:0},width:{initial:`${v}px`}},n.createElement(Q.VisuallyHidden,null,n.createElement(F.Title,null,"Inspector")),W))}const{defaultOpen:Me,open:ge,onOpenChange:Re,size:ze,defaultSize:Ie,onSizeChange:ve,sizeUpdate:xe,sizeUpdateMs:Ce,...le}=c;return n.createElement("div",{...le,ref:de,className:(0,J.default)("rt-ShellInspector",s),"data-mode":t.inspectorMode,"data-peek":t.peekTarget==="inspector"||void 0,"data-presentation":t.currentBreakpointReady?N:void 0,"data-open":t.currentBreakpointReady&&ae&&O||void 0,style:{...ie,"--inspector-size":`${v}px`,"--inspector-min-size":`${m}px`,"--inspector-max-size":`${y}px`}},n.createElement("div",{className:"rt-ShellInspectorContent","data-visible":O||void 0},W),ce)});B.displayName="Shell.Inspector",B.Handle=b.InspectorHandle;
|
|
2
2
|
//# sourceMappingURL=shell-inspector.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/_internal/shell-inspector.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n mode?: PaneMode;\n defaultMode?: any;\n onModeChange?: (mode: PaneMode) => void;\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype InspectorComponent = React.ForwardRefExoticComponent<PaneProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nexport const Inspector = React.forwardRef<HTMLDivElement, PaneProps>(\n (\n {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n mode,\n defaultMode = 'collapsed',\n onModeChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === InspectorHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === InspectorHandle));\n\n const resolveResponsiveMode = React.useCallback((): PaneMode => {\n if (typeof defaultMode === 'string') return defaultMode as PaneMode;\n const dm = defaultMode as Partial<Record<Breakpoint, PaneMode>> | undefined;\n if (dm && dm[shell.currentBreakpoint as Breakpoint]) {\n return dm[shell.currentBreakpoint as Breakpoint] as PaneMode;\n }\n const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;\n const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);\n const startIdx = order.indexOf(shell.currentBreakpoint as Breakpoint);\n for (let i = startIdx + 1; i < order.length; i++) {\n const bp = order[i];\n if (dm && dm[bp]) {\n return dm[bp] as PaneMode;\n }\n }\n return 'collapsed';\n }, [defaultMode, shell.currentBreakpoint]);\n\n const lastInspectorBpRef = React.useRef<Breakpoint | null>(null);\n React.useEffect(() => {\n if (mode !== undefined) return;\n if (!shell.currentBreakpointReady) return;\n if (lastInspectorBpRef.current === shell.currentBreakpoint) return;\n lastInspectorBpRef.current = shell.currentBreakpoint as Breakpoint;\n const next = resolveResponsiveMode();\n if (next !== shell.inspectorMode) {\n shell.setInspectorMode(next);\n }\n }, [mode, shell.currentBreakpoint, shell.currentBreakpointReady, resolveResponsiveMode, shell.inspectorMode, shell.setInspectorMode]);\n\n React.useEffect(() => {\n if (mode !== undefined && shell.inspectorMode !== mode) {\n shell.setInspectorMode(mode);\n }\n }, [mode, shell]);\n\n React.useEffect(() => {\n if (mode === undefined) {\n onModeChange?.(shell.inspectorMode);\n }\n }, [shell.inspectorMode, mode, onModeChange]);\n\n React.useEffect(() => {\n if (shell.inspectorMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.inspectorMode, onExpand, onCollapse]);\n\n const isExpanded = shell.inspectorMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:inspector:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--inspector-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--inspector-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'vertical',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const isRtl = getComputedStyle(localRef.current!).direction === 'rtl';\n const delta = client - startClient;\n return startSize + (isRtl ? delta : -delta);\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n persistenceAdapter?.save?.(size);\n },\n target: 'inspector',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setInspectorMode('collapsed'),\n requestToggle: () => shell.togglePane('inspector'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n if (isOverlay) {\n const open = shell.inspectorMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setInspectorMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"end\" style={{ padding: 0 }} width={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Inspector</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n return (\n <div\n {...props}\n ref={setRef}\n className={classNames('rt-ShellInspector', className)}\n data-mode={shell.inspectorMode}\n data-peek={shell.peekTarget === 'inspector' || undefined}\n data-presentation={resolvedPresentation}\n data-open={(isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--inspector-size' as any]: `${expandedSize}px`,\n ['--inspector-min-size' as any]: `${minSize}px`,\n ['--inspector-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellInspectorContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,eAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB,oBACvBC,EAAuB,yBACvBC,EAAuB,0BACvBC,EAA+B,iCAC/BC,EAAyB,+BACzBC,
|
|
6
|
-
"names": ["shell_inspector_exports", "__export", "Inspector", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "className", "presentation", "
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport * as Sheet from '../sheet.js';\nimport { VisuallyHidden } from '../visually-hidden.js';\nimport { useShell } from '../shell.context.js';\nimport { useResponsivePresentation, useResponsiveValue } from '../shell.hooks.js';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { BREAKPOINTS } from '../shell.types.js';\nimport type { Breakpoint, PaneMode, PaneSizePersistence, ResponsivePresentation } from '../shell.types.js';\n\ninterface PaneProps extends React.ComponentPropsWithoutRef<'div'> {\n presentation?: ResponsivePresentation;\n // legacy mode removed\n expandedSize?: number;\n minSize?: number;\n maxSize?: number;\n resizable?: boolean;\n collapsible?: boolean;\n onExpand?: () => void;\n onCollapse?: () => void;\n onResize?: (size: number) => void;\n resizer?: React.ReactNode;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n snapPoints?: number[];\n snapTolerance?: number;\n collapseThreshold?: number;\n paneId?: string;\n persistence?: PaneSizePersistence;\n}\n\ntype InspectorOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' };\ntype InspectorControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; defaultOpen?: never };\ntype InspectorUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; open?: never };\ntype InspectorSizeChangeMeta = { reason: 'init' | 'resize' | 'controlled' };\ntype InspectorPublicProps = PaneProps &\n (InspectorControlledProps | InspectorUncontrolledProps) & {\n onSizeChange?: (size: number, meta: InspectorSizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n };\n\ntype InspectorComponent = React.ForwardRefExoticComponent<InspectorPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>(\n (\n {\n className,\n presentation = { initial: 'overlay', lg: 'fixed' },\n // removed legacy props\n // new API\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n ...props\n },\n ref,\n ) => {\n const shell = useShell();\n const resolvedPresentation = useResponsivePresentation(presentation);\n const isOverlay = resolvedPresentation === 'overlay';\n const isStacked = resolvedPresentation === 'stacked';\n const localRef = React.useRef<HTMLDivElement | null>(null);\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n localRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n const childArray = React.Children.toArray(children) as React.ReactElement[];\n const handleChildren = childArray.filter((el: React.ReactElement) => React.isValidElement(el) && el.type === InspectorHandle);\n const contentChildren = childArray.filter((el: React.ReactElement) => !(React.isValidElement(el) && el.type === InspectorHandle));\n\n // Throttled/debounced emitter for onSizeChange\n const emitSizeChange = React.useMemo(() => {\n const cb = (props as any).onSizeChange as undefined | ((s: number, meta: InspectorSizeChangeMeta) => void);\n const strategy = (props as any).sizeUpdate as undefined | 'throttle' | 'debounce';\n const ms = (props as any).sizeUpdateMs ?? 50;\n if (!cb) return () => {};\n if (strategy === 'debounce') {\n let t: any = null;\n return (s: number, meta: InspectorSizeChangeMeta) => {\n if (t) clearTimeout(t);\n t = setTimeout(() => {\n cb(s, meta);\n }, ms);\n };\n }\n if (strategy === 'throttle') {\n let last = 0;\n return (s: number, meta: InspectorSizeChangeMeta) => {\n const now = Date.now();\n if (now - last >= ms) {\n last = now;\n cb(s, meta);\n }\n };\n }\n return (s: number, meta: InspectorSizeChangeMeta) => cb(s, meta);\n }, [(props as any).onSizeChange, (props as any).sizeUpdate, (props as any).sizeUpdateMs]);\n\n // Dev guards\n const wasControlledRef = React.useRef<boolean | null>(null);\n if (process.env.NODE_ENV !== 'production') {\n if (typeof open !== 'undefined' && typeof defaultOpen !== 'undefined') {\n // eslint-disable-next-line no-console\n console.error('Shell.Inspector: Do not pass both `open` and `defaultOpen`. Choose one.');\n }\n }\n\n // Warn on controlled/uncontrolled mode switch\n React.useEffect(() => {\n const isControlled = typeof open !== 'undefined';\n if (wasControlledRef.current === null) {\n wasControlledRef.current = isControlled;\n return;\n }\n if (wasControlledRef.current !== isControlled) {\n // eslint-disable-next-line no-console\n console.warn('Shell.Inspector: Switching between controlled and uncontrolled `open` is not supported.');\n wasControlledRef.current = isControlled;\n }\n }, [open]);\n\n const responsiveNotifiedRef = React.useRef(false);\n const didInitFromDefaultOpenRef = React.useRef(false);\n const resolvedDefaultOpen = useResponsiveValue(defaultOpen);\n React.useEffect(() => {\n if (!shell.currentBreakpointReady) return;\n if (didInitFromDefaultOpenRef.current) return;\n if (typeof open !== 'undefined') return; // controlled ignores default\n if (typeof defaultOpen === 'undefined') return;\n const initialOpen = Boolean(resolvedDefaultOpen);\n shell.setInspectorMode(initialOpen ? 'expanded' : 'collapsed');\n if (initialOpen) onOpenChange?.(true, { reason: 'init' });\n didInitFromDefaultOpenRef.current = true;\n }, [shell.currentBreakpointReady, resolvedDefaultOpen, defaultOpen, open, onOpenChange]);\n\n // Controlled responsive open\n const resolvedOpen = useResponsiveValue(open);\n React.useEffect(() => {\n if (typeof resolvedOpen === 'undefined') return;\n const shouldExpand = Boolean(resolvedOpen);\n if (shouldExpand && shell.inspectorMode !== 'expanded') shell.setInspectorMode('expanded');\n if (!shouldExpand && shell.inspectorMode !== 'collapsed') shell.setInspectorMode('collapsed');\n }, [resolvedOpen, shell.inspectorMode]);\n\n // Removed boolean-only mount init; handled in responsive init effect above\n\n // Removed: boolean-only controlled sync. Use responsive-resolved effect below instead.\n\n const initNotifiedRef = React.useRef(false);\n const lastInspectorModeRef = React.useRef<PaneMode | null>(null);\n React.useEffect(() => {\n // Notify init open\n if (!initNotifiedRef.current && typeof open === 'undefined' && defaultOpen && shell.inspectorMode === 'expanded') {\n onOpenChange?.(true, { reason: 'init' });\n initNotifiedRef.current = true;\n }\n\n // Notify toggles when uncontrolled (avoid double-notify after responsive change)\n if (typeof open === 'undefined') {\n if (lastInspectorModeRef.current !== null && lastInspectorModeRef.current !== shell.inspectorMode) {\n if (!responsiveNotifiedRef.current) {\n onOpenChange?.(shell.inspectorMode === 'expanded', { reason: 'toggle' });\n }\n responsiveNotifiedRef.current = false;\n }\n lastInspectorModeRef.current = shell.inspectorMode;\n }\n }, [shell.inspectorMode, open, defaultOpen, onOpenChange]);\n\n React.useEffect(() => {\n if (shell.inspectorMode === 'expanded') {\n onExpand?.();\n } else {\n onCollapse?.();\n }\n }, [shell.inspectorMode, onExpand, onCollapse]);\n\n const isExpanded = shell.inspectorMode === 'expanded';\n\n const persistenceAdapter = React.useMemo(() => {\n if (!paneId || persistence) return persistence;\n const key = `kookie-ui:shell:inspector:${paneId}`;\n const adapter: PaneSizePersistence = {\n load: () => {\n if (typeof window === 'undefined') return undefined;\n const v = window.localStorage.getItem(key);\n return v ? Number(v) : undefined;\n },\n save: (size: number) => {\n if (typeof window === 'undefined') return;\n window.localStorage.setItem(key, String(size));\n },\n };\n return adapter;\n }, [paneId, persistence]);\n\n React.useEffect(() => {\n let mounted = true;\n (async () => {\n if (!resizable || !persistenceAdapter?.load || isOverlay) return;\n const loaded = await persistenceAdapter.load();\n if (mounted && typeof loaded === 'number' && localRef.current) {\n localRef.current.style.setProperty('--inspector-size', `${loaded}px`);\n onResize?.(loaded);\n }\n })();\n return () => {\n mounted = false;\n };\n }, [resizable, persistenceAdapter, onResize, isOverlay]);\n\n const handleEl =\n resizable && !isOverlay && isExpanded ? (\n <PaneResizeContext.Provider\n value={{\n containerRef: localRef,\n cssVarName: '--inspector-size',\n minSize,\n maxSize,\n defaultSize: expandedSize,\n orientation: 'vertical',\n edge: 'start',\n computeNext: (client, startClient, startSize) => {\n const isRtl = getComputedStyle(localRef.current!).direction === 'rtl';\n const delta = client - startClient;\n return startSize + (isRtl ? delta : -delta);\n },\n onResize,\n onResizeStart,\n onResizeEnd: (size) => {\n onResizeEnd?.(size);\n emitSizeChange(size, { reason: 'resize' });\n persistenceAdapter?.save?.(size);\n },\n target: 'inspector',\n collapsible,\n snapPoints,\n snapTolerance: snapTolerance ?? 8,\n collapseThreshold,\n requestCollapse: () => shell.setInspectorMode('collapsed'),\n requestToggle: () => shell.togglePane('inspector'),\n }}\n >\n {handleChildren.length > 0 ? handleChildren.map((el, i) => React.cloneElement(el, { key: el.key ?? i })) : <PaneHandle />}\n </PaneResizeContext.Provider>\n ) : null;\n\n // Normalize CSS lengths to px\n const normalizeToPx = React.useCallback((value: number | string | undefined): number | undefined => {\n if (value == null) return undefined;\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n const str = String(value).trim();\n if (!str) return undefined;\n if (str.endsWith('px')) return Number.parseFloat(str);\n if (str.endsWith('rem')) {\n const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize || '16') || 16;\n return Number.parseFloat(str) * rem;\n }\n if (str.endsWith('%')) {\n const pct = Number.parseFloat(str);\n const base = document.documentElement.clientWidth || window.innerWidth || 0;\n return (pct / 100) * base;\n }\n const n = Number.parseFloat(str);\n return Number.isFinite(n) ? n : undefined;\n }, []);\n\n // Apply defaultSize on mount when uncontrolled\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof (props as any).size === 'undefined' && typeof (props as any).defaultSize !== 'undefined') {\n const px = normalizeToPx((props as any).defaultSize);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--inspector-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'init' });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Controlled size sync\n React.useEffect(() => {\n if (!localRef.current) return;\n if (typeof (props as any).size === 'undefined') return;\n const px = normalizeToPx((props as any).size);\n if (typeof px === 'number' && Number.isFinite(px)) {\n const minPx = typeof minSize === 'number' ? minSize : undefined;\n const maxPx = typeof maxSize === 'number' ? maxSize : undefined;\n const clamped = Math.min(maxPx ?? px, Math.max(minPx ?? px, px));\n localRef.current.style.setProperty('--inspector-size', `${clamped}px`);\n emitSizeChange(clamped, { reason: 'controlled' });\n }\n }, [(props as any).size, minSize, maxSize, normalizeToPx, emitSizeChange]);\n\n if (isOverlay) {\n const open = shell.inspectorMode === 'expanded';\n return (\n <Sheet.Root open={open} onOpenChange={(o) => shell.setInspectorMode(o ? 'expanded' : 'collapsed')}>\n <Sheet.Content side=\"end\" style={{ padding: 0 }} width={{ initial: `${expandedSize}px` }}>\n <VisuallyHidden>\n <Sheet.Title>Inspector</Sheet.Title>\n </VisuallyHidden>\n {contentChildren}\n </Sheet.Content>\n </Sheet.Root>\n );\n }\n\n // Strip control/size props from DOM spread\n const {\n defaultOpen: _inspectorDefaultOpenIgnored,\n open: _inspectorOpenIgnored,\n onOpenChange: _inspectorOnOpenChangeIgnored,\n size: _sz,\n defaultSize: _dsz,\n onSizeChange: _osc,\n sizeUpdate: _szu,\n sizeUpdateMs: _szums,\n ...inspectorDomProps\n } = props as any;\n\n return (\n <div\n {...inspectorDomProps}\n ref={setRef}\n className={classNames('rt-ShellInspector', className)}\n data-mode={shell.inspectorMode}\n data-peek={shell.peekTarget === 'inspector' || undefined}\n data-presentation={shell.currentBreakpointReady ? resolvedPresentation : undefined}\n data-open={(shell.currentBreakpointReady && isStacked && isExpanded) || undefined}\n style={{\n ...style,\n ['--inspector-size' as any]: `${expandedSize}px`,\n ['--inspector-min-size' as any]: `${minSize}px`,\n ['--inspector-max-size' as any]: `${maxSize}px`,\n }}\n >\n <div className=\"rt-ShellInspectorContent\" data-visible={isExpanded || undefined}>\n {contentChildren}\n </div>\n {handleEl}\n </div>\n );\n },\n) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,eAAAE,IAAA,eAAAC,GAAAH,IAAA,IAAAI,EAAuB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0BG,IAAa2B,GAAe,OACxE,MAAO,CACL,GAAGjC,GACF,mBAA4B,GAAGhB,CAAY,KAC3C,uBAAgC,GAAGC,CAAO,KAC1C,uBAAgC,GAAGC,CAAO,IAC7C,GAEAhB,EAAA,cAAC,OAAI,UAAU,2BAA2B,eAAc+D,GAAc,QACnEpB,CACH,EACC2B,EACH,CAEJ,CACF,EAEAxE,EAAU,YAAc,kBACxBA,EAAU,OAAS",
|
|
6
|
+
"names": ["shell_inspector_exports", "__export", "Inspector", "__toCommonJS", "React", "import_classnames", "Sheet", "import_visually_hidden", "import_shell_context", "import_shell_hooks", "import_shell_resize", "import_shell_handles", "import_shell_types", "className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "props", "ref", "shell", "resolvedPresentation", "isOverlay", "isStacked", "localRef", "setRef", "node", "childArray", "handleChildren", "el", "contentChildren", "emitSizeChange", "cb", "strategy", "ms", "t", "s", "meta", "last", "now", "wasControlledRef", "isControlled", "responsiveNotifiedRef", "didInitFromDefaultOpenRef", "resolvedDefaultOpen", "initialOpen", "resolvedOpen", "shouldExpand", "initNotifiedRef", "lastInspectorModeRef", "isExpanded", "persistenceAdapter", "key", "v", "size", "mounted", "loaded", "handleEl", "client", "startClient", "startSize", "isRtl", "delta", "i", "normalizeToPx", "value", "str", "rem", "pct", "base", "n", "px", "clamped", "_inspectorDefaultOpenIgnored", "_inspectorOpenIgnored", "_inspectorOnOpenChangeIgnored", "_sz", "_dsz", "_osc", "_szu", "_szums", "inspectorDomProps", "classNames"]
|
|
7
7
|
}
|