@pasquelin/panels 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/components/Band.d.ts +13 -0
- package/dist/components/Center.d.ts +18 -0
- package/dist/components/IconButton.d.ts +20 -0
- package/dist/components/Panel.d.ts +31 -0
- package/dist/components/PanelFrame.d.ts +23 -0
- package/dist/components/PanelHeader.d.ts +15 -0
- package/dist/components/Panels.d.ts +30 -0
- package/dist/components/Rail.d.ts +23 -0
- package/dist/components/ResizeHandle.d.ts +37 -0
- package/dist/components/Separator.d.ts +6 -0
- package/dist/components/Surface.d.ts +9 -0
- package/dist/components/ZoneEdge.d.ts +17 -0
- package/dist/components/content.d.ts +9 -0
- package/dist/components/labels.d.ts +12 -0
- package/dist/core/clamps.d.ts +55 -0
- package/dist/core/context.d.ts +39 -0
- package/dist/core/cx.d.ts +5 -0
- package/dist/core/hooks/useArrangement.d.ts +36 -0
- package/dist/core/hooks/useContainerFit.d.ts +9 -0
- package/dist/core/hooks/usePanels.d.ts +26 -0
- package/dist/core/hooks/usePointerDrag.d.ts +21 -0
- package/dist/core/hooks/useZone.d.ts +28 -0
- package/dist/core/layoutEffect.d.ts +10 -0
- package/dist/core/persistence.d.ts +30 -0
- package/dist/core/store.d.ts +86 -0
- package/dist/core/types.d.ts +88 -0
- package/dist/cx-CcykAxZN.js +6 -0
- package/dist/cx-YyuC5RtB.cjs +1 -0
- package/dist/dockview/DockviewCenter.d.ts +37 -0
- package/dist/dockview/index.d.ts +3 -0
- package/dist/dockview.cjs +1 -0
- package/dist/dockview.js +39 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +935 -0
- package/dist/styles.css +1 -0
- package/llms-full.txt +1242 -0
- package/llms.txt +150 -0
- package/package.json +99 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
export type Dragging<T> = T & {
|
|
3
|
+
pointerId: number;
|
|
4
|
+
};
|
|
5
|
+
export type PointerDrag<T> = {
|
|
6
|
+
/** Captures the pointer, so the gesture survives a cursor leaving the element it began on. */
|
|
7
|
+
start: (event: ReactPointerEvent<Element>, held: T) => void;
|
|
8
|
+
/**
|
|
9
|
+
* The drag this event belongs to, or `null`. A mouse has no implicit capture, so a move with
|
|
10
|
+
* the button held from elsewhere reaches us too, and would be read from a stale origin.
|
|
11
|
+
*/
|
|
12
|
+
matching: (event: ReactPointerEvent<Element>) => Dragging<T> | null;
|
|
13
|
+
/** Ends it whatever the pointer, releasing nothing — for a capture the platform took back. */
|
|
14
|
+
cancel: () => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* One drag, held against the pointer that opened it. What a gesture MEANS stays with its caller;
|
|
18
|
+
* this holds the pointer, the identity guard and the capture. Stable across renders, so a caller
|
|
19
|
+
* may put it in the deps of a memoised handler.
|
|
20
|
+
*/
|
|
21
|
+
export declare function usePointerDrag<T extends object>(): PointerDrag<T>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type PanelSpec, type Slot, type Zone } from '../types';
|
|
2
|
+
export type ZoneView<Id extends string> = {
|
|
3
|
+
/** What each half actually DRAWS — not what it holds: a `solo` panel silences the other. */
|
|
4
|
+
primary?: PanelSpec<Id>;
|
|
5
|
+
secondary?: PanelSpec<Id>;
|
|
6
|
+
/** Whether the zone draws at all. An empty one takes neither room nor handle. */
|
|
7
|
+
draws: boolean;
|
|
8
|
+
/** The zone's length along its own axis, already bounded so the centre keeps its floor. */
|
|
9
|
+
size: number;
|
|
10
|
+
/** Where the divider between the two halves stands. Undefined means CSS divides them evenly. */
|
|
11
|
+
split: number | undefined;
|
|
12
|
+
focused: boolean;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Everything one zone needs to draw itself.
|
|
16
|
+
*
|
|
17
|
+
* The size it answers is BOUNDED, not merely stored: two untouched columns asking for 320 and
|
|
18
|
+
* 380 leave a 900 px container 104 px of centre, well under its floor, and nothing in the stored
|
|
19
|
+
* lengths would have caught it — there is nothing stored at all. `sharedSizes` settles that,
|
|
20
|
+
* against the opposite zone and the room actually measured.
|
|
21
|
+
*
|
|
22
|
+
* 🛑 The selectors are SCALAR on purpose. Subscribing to `lengths` or to `available` as objects
|
|
23
|
+
* woke every mounted zone on each `pointermove` of a drag, because both are replaced wholesale
|
|
24
|
+
* on every write — five re-renders a frame where two are owed.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useZone<Id extends string = string>(zone: Zone): ZoneView<Id>;
|
|
27
|
+
/** The panels a rail draws for that zone, cut the way the zone itself is cut. */
|
|
28
|
+
export declare function useZonePanels<Id extends string = string>(zone: Zone): [Slot, PanelSpec<Id>[]][];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `useLayoutEffect` in a browser, `useEffect` anywhere else.
|
|
4
|
+
*
|
|
5
|
+
* The chassis settles its arrangement and measures its container before the first paint — done
|
|
6
|
+
* in a plain effect, the first frame shows every zone closed and the second shows them open.
|
|
7
|
+
* On a server there is nothing to measure, and React warns about the layout variant, so it
|
|
8
|
+
* falls back rather than shouting.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Lengths, type OpenByZone } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Where a layout is kept. `localStorage` by default, so the library works the moment it is
|
|
4
|
+
* installed; a project that stores elsewhere — a file, an API, `electron-store` — passes its own.
|
|
5
|
+
*/
|
|
6
|
+
export type LayoutStorage = {
|
|
7
|
+
read: (key: string) => string | null;
|
|
8
|
+
write: (key: string, value: string) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const memoryStorage: () => LayoutStorage;
|
|
11
|
+
/**
|
|
12
|
+
* The browser's own, guarded: a private window, a disabled store or a full quota all throw, and
|
|
13
|
+
* a layout that cannot be saved is not a reason to take the application down.
|
|
14
|
+
*/
|
|
15
|
+
export declare const browserStorage: () => LayoutStorage;
|
|
16
|
+
/** Bumped when the stored shape stops being one this build can restore. */
|
|
17
|
+
export declare const LAYOUT_VERSION = 1;
|
|
18
|
+
/**
|
|
19
|
+
* Reads a stored layout back, dropping anything this build cannot make sense of. Returns
|
|
20
|
+
* `undefined` rather than a partial answer: a half-read layout is worse than none, since the
|
|
21
|
+
* project's own defaults are a deliberate arrangement and a corrupted one is not.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readLayout<Id extends string>(storage: LayoutStorage, key: string): {
|
|
24
|
+
open: OpenByZone<Id>;
|
|
25
|
+
lengths: Lengths;
|
|
26
|
+
} | undefined;
|
|
27
|
+
export declare function writeLayout<Id extends string>(storage: LayoutStorage, key: string, layout: {
|
|
28
|
+
open: OpenByZone<Id>;
|
|
29
|
+
lengths: Lengths;
|
|
30
|
+
}): void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type StoreApi } from 'zustand/vanilla';
|
|
2
|
+
import { type Lengths, type OpenByZone, type PanelSpec, type Slot, type Zone, type ZoneSlots } from './types';
|
|
3
|
+
export type PanelsState<Id extends string = string> = {
|
|
4
|
+
/** Panels declared by the project, in the order they mounted. The rail reads this. */
|
|
5
|
+
registry: PanelSpec<Id>[];
|
|
6
|
+
open: OpenByZone<Id>;
|
|
7
|
+
lengths: Lengths;
|
|
8
|
+
/** Last clicked zone: the one whose rail icon gets accented. */
|
|
9
|
+
focusedZone: Zone | null;
|
|
10
|
+
/**
|
|
11
|
+
* What a zone held before a `solo` panel took it whole. Never persisted: a column reopening
|
|
12
|
+
* by itself days later, on an arrangement nobody remembers making, is not a restoration.
|
|
13
|
+
*/
|
|
14
|
+
stashed: Partial<Record<Zone, ZoneSlots<Id>>>;
|
|
15
|
+
/** Whether the opening arrangement has been settled — see `settle`. */
|
|
16
|
+
settled: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The room the zones and the centre share, as last measured. Held in the store rather than
|
|
19
|
+
* read per component: every zone has to be bounded against the SAME number, and against what
|
|
20
|
+
* the opposite zone is taking out of it.
|
|
21
|
+
*/
|
|
22
|
+
available: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
register: (spec: PanelSpec<Id>) => void;
|
|
27
|
+
unregister: (id: Id) => void;
|
|
28
|
+
/** Opens each untouched half on the first panel declared for it. Runs once. */
|
|
29
|
+
settle: (defaults?: OpenByZone<Id>) => void;
|
|
30
|
+
show: (id: Id) => void;
|
|
31
|
+
close: (zone: Zone, slot: Slot) => void;
|
|
32
|
+
toggle: (id: Id) => void;
|
|
33
|
+
focus: (zone: Zone | null) => void;
|
|
34
|
+
/** `available`: the container's dimension along the zone's axis. */
|
|
35
|
+
resize: (zone: Zone, size: number, available: number) => void;
|
|
36
|
+
/** Moves the divider between a zone's two halves. */
|
|
37
|
+
resplit: (zone: Zone, size: number, available: number) => void;
|
|
38
|
+
/** Moves the divider BETWEEN the band's two zones, which is a width. */
|
|
39
|
+
resplitBand: (size: number, available: number) => void;
|
|
40
|
+
/** Re-clamps every length after the container changed size. */
|
|
41
|
+
fit: (width: number, height: number) => void;
|
|
42
|
+
reset: () => void;
|
|
43
|
+
};
|
|
44
|
+
export type PanelsStore<Id extends string = string> = StoreApi<PanelsState<Id>>;
|
|
45
|
+
/**
|
|
46
|
+
* A panel by its id. Exported because four sites had written this same lookup for want of it,
|
|
47
|
+
* and one of them had already drifted on how it treated `undefined`. It is also the single place
|
|
48
|
+
* to change the day the registry stops being a list and becomes a `Map`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function specOf<Id extends string>(registry: PanelSpec<Id>[], id: Id | undefined): PanelSpec<Id> | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Both halves at once, because one can silence the other: a `solo` panel takes the zone WHOLE.
|
|
53
|
+
* Resolved here rather than in each reader, which would contradict it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function shownIn<Id extends string>(state: Pick<PanelsState<Id>, 'registry' | 'open'>, zone: Zone): {
|
|
56
|
+
primary?: Id;
|
|
57
|
+
secondary?: Id;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Whether the zone takes room off the axis it shares with its opposite.
|
|
61
|
+
*
|
|
62
|
+
* 🛑 NOT the same question as `zoneDraws`, and the band is the whole difference: its two halves
|
|
63
|
+
* share ONE height, so either of them drawing means the strip is taking that height. Asked per
|
|
64
|
+
* half, the top zone was told nothing faced it whenever `bottomRight` happened to be the closed
|
|
65
|
+
* one — and it could then be dragged over the height `bottomLeft` was already drawing in.
|
|
66
|
+
*/
|
|
67
|
+
export declare function zoneTakesRoom<Id extends string>(state: Pick<PanelsState<Id>, 'registry' | 'open'>, zone: Zone): boolean;
|
|
68
|
+
/** Whether the zone draws at all — an empty one takes neither room nor handle. */
|
|
69
|
+
export declare function zoneDraws<Id extends string>(state: Pick<PanelsState<Id>, 'registry' | 'open'>, zone: Zone): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The size a zone opens at, given the panel leading it. A panel may ask for more than the zone's
|
|
72
|
+
* own default — a conversation at 260 wraps every sentence onto three lines.
|
|
73
|
+
*
|
|
74
|
+
* Takes the LEADING panel rather than resolving it: every caller has already asked `shownIn`,
|
|
75
|
+
* and resolving it again here was a second pass over the registry per zone, per drag frame.
|
|
76
|
+
*/
|
|
77
|
+
export declare function undraggedSizeOf<Id extends string>(registry: PanelSpec<Id>[], zone: Zone, leading: Id | undefined): number;
|
|
78
|
+
export declare const EMPTY_LENGTHS: Lengths;
|
|
79
|
+
export type CreatePanelsStoreOptions<Id extends string> = {
|
|
80
|
+
/** Restored layout, if any. Halves it names are taken as chosen and `settle` leaves them be. */
|
|
81
|
+
initial?: Partial<{
|
|
82
|
+
open: OpenByZone<Id>;
|
|
83
|
+
lengths: Lengths;
|
|
84
|
+
}>;
|
|
85
|
+
};
|
|
86
|
+
export declare function createPanelsStore<Id extends string = string>(options?: CreatePanelsStoreOptions<Id>): PanelsStore<Id>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The vocabulary of the chassis, and nothing else. No domain, no surfaces, no capabilities:
|
|
4
|
+
* a project declares the panels it wants and this describes only WHERE they hang.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Where a panel hangs. The bottom band is TWO zones sharing one height: whichever of them is
|
|
8
|
+
* alone runs under the opposite column, and together they split the width between them.
|
|
9
|
+
*/
|
|
10
|
+
export type Zone = 'left' | 'right' | 'top' | 'bottomLeft' | 'bottomRight';
|
|
11
|
+
export declare const ZONES: readonly Zone[];
|
|
12
|
+
/**
|
|
13
|
+
* A zone is cut in two, and each half shows one panel at a time. The rail draws the same cut as
|
|
14
|
+
* a separator: icons above it open in the first half, icons below in the second.
|
|
15
|
+
*
|
|
16
|
+
* `primary` is the half nearest the window edge the zone hangs from — the top of a side column,
|
|
17
|
+
* the left of the bottom strip.
|
|
18
|
+
*/
|
|
19
|
+
export type Slot = 'primary' | 'secondary';
|
|
20
|
+
export declare const SLOTS: readonly Slot[];
|
|
21
|
+
/** The band's two halves, in the order they are drawn. */
|
|
22
|
+
export declare const BOTTOM_ZONES: readonly Zone[];
|
|
23
|
+
/** Whether the zone is one of the band's halves, which share a height and a resize handle. */
|
|
24
|
+
export declare function isBottom(zone: Zone): boolean;
|
|
25
|
+
/** Horizontal zones: their size is set as a height, not a width. */
|
|
26
|
+
export declare function isHorizontal(zone: Zone): boolean;
|
|
27
|
+
/** Which edge a zone hangs from. The band's two halves take the side their name gives. */
|
|
28
|
+
export type Side = 'left' | 'right';
|
|
29
|
+
/**
|
|
30
|
+
* The zones each rail carries, in the order it stacks them: the column's own at the top, its
|
|
31
|
+
* half of the bottom band at the foot.
|
|
32
|
+
*
|
|
33
|
+
* Stated here rather than inside the rail, because the frame lays itself out on the same
|
|
34
|
+
* knowledge — which column runs to the foot, which half of the band sits under it. Written in
|
|
35
|
+
* both places, the two could disagree about who is on the left with nothing to catch it.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ZONES_BY_SIDE: Record<Side, {
|
|
38
|
+
column: Zone[];
|
|
39
|
+
band: Zone;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Zones whose panel sits before its resize handle. The opposite zones grow backwards, which
|
|
43
|
+
* is also why their drag direction is inverted.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isLeading(zone: Zone): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* What a project registers for one panel. The content itself never passes through here — it is
|
|
48
|
+
* rendered by `<Panel>` where it was declared, and this is only what the rail and the frame
|
|
49
|
+
* need to know before the panel is on screen.
|
|
50
|
+
*/
|
|
51
|
+
export type PanelSpec<Id extends string = string> = {
|
|
52
|
+
id: Id;
|
|
53
|
+
zone: Zone;
|
|
54
|
+
slot: Slot;
|
|
55
|
+
/** Accessible name and header title. Already translated — the library carries no i18n. */
|
|
56
|
+
title: string;
|
|
57
|
+
/** Free-form: an icon component, an SVG, an image. The library imposes no icon set. */
|
|
58
|
+
icon?: ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* What the zone opens at while this panel leads it, where the zone's own size does not suit
|
|
61
|
+
* it. A size the reader dragged always wins over this.
|
|
62
|
+
*/
|
|
63
|
+
opens?: number;
|
|
64
|
+
/** Takes the zone WHOLE: shown, the other half draws nothing. `primary` only. */
|
|
65
|
+
solo?: boolean;
|
|
66
|
+
};
|
|
67
|
+
/** Which panel each half of each zone currently shows. Absent means the half is closed. */
|
|
68
|
+
export type ZoneSlots<Id extends string = string> = Partial<Record<Slot, Id>>;
|
|
69
|
+
export type OpenByZone<Id extends string = string> = Partial<Record<Zone, ZoneSlots<Id>>>;
|
|
70
|
+
export type SizesByZone = Partial<Record<Zone, number>>;
|
|
71
|
+
/**
|
|
72
|
+
* How wide and how tall the frame is. `sizes` is the zone's own length — a width for the side
|
|
73
|
+
* columns, a height for the strips; `splits` is what the second half takes inside its zone.
|
|
74
|
+
*/
|
|
75
|
+
export type Lengths = {
|
|
76
|
+
sizes: SizesByZone;
|
|
77
|
+
splits: SizesByZone;
|
|
78
|
+
/**
|
|
79
|
+
* Width the band's LEFT zone takes while both halves draw. Unset means half each — a fraction
|
|
80
|
+
* would have to be re-read on every resize, where a length is what the handle drags.
|
|
81
|
+
*/
|
|
82
|
+
bandSplit?: number;
|
|
83
|
+
};
|
|
84
|
+
/** The layout as it is stored and restored. This is the whole of what persistence carries. */
|
|
85
|
+
export type LayoutState<Id extends string = string> = {
|
|
86
|
+
open: OpenByZone<Id>;
|
|
87
|
+
lengths: Lengths;
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function t(...n){return n.filter(Boolean).join(" ")}exports.cx=t;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type DockviewApi, type IDockviewPanelProps } from 'dockview-react';
|
|
2
|
+
import { type FunctionComponent } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* What each kind of document renders, keyed by the component name a panel asks for.
|
|
5
|
+
*
|
|
6
|
+
* Dockview's own prop shape rather than a narrowed one: it hands a panel its api and its
|
|
7
|
+
* params, and a project that wants either would otherwise have to cast to reach them.
|
|
8
|
+
*/
|
|
9
|
+
export type DocumentTabs = Record<string, FunctionComponent<IDockviewPanelProps>>;
|
|
10
|
+
export type DockviewCenterProps = {
|
|
11
|
+
documents: DocumentTabs;
|
|
12
|
+
/**
|
|
13
|
+
* A layout to restore, as `api.toJSON()` gave it. Dockview throws on a layout naming a
|
|
14
|
+
* component this build cannot find, so a refused one is dropped rather than kept — it would
|
|
15
|
+
* fail again at every launch.
|
|
16
|
+
*/
|
|
17
|
+
layout?: unknown;
|
|
18
|
+
/** Called whenever the arrangement changes, with what to store. */
|
|
19
|
+
onLayout?: (layout: unknown) => void;
|
|
20
|
+
/** The api, once Dockview is ready — for opening documents from outside. */
|
|
21
|
+
onReady?: (api: DockviewApi) => void;
|
|
22
|
+
/** Drawn while no document is open. Without one, Dockview shows a bare watermark. */
|
|
23
|
+
empty?: FunctionComponent;
|
|
24
|
+
className?: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Document tabs for the centre, on Dockview.
|
|
28
|
+
*
|
|
29
|
+
* A SEPARATE entry point (`@pasquelin/panels/dockview`) on purpose: Dockview is a large
|
|
30
|
+
* dependency, and the centre is a free slot for every project that only wants to put a router
|
|
31
|
+
* outlet or a canvas there. Importing this is how a project opts into paying for it.
|
|
32
|
+
*
|
|
33
|
+
* 🛑 Tool panels never enter here. The centre takes documents — things with a name, that a
|
|
34
|
+
* person opens and closes. Panels live on the edges and are switched from the rail, which is why
|
|
35
|
+
* they wear an icon and not a tab.
|
|
36
|
+
*/
|
|
37
|
+
export declare function DockviewCenter({ documents, layout, onLayout, onReady, empty, className, }: DockviewCenterProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),p=require("dockview-react"),o=require("react"),f=require("./cx-YyuC5RtB.cjs");function k({documents:n,layout:c,onLayout:e,onReady:i,empty:s,className:a}){const t=o.useRef(!1),u=o.useCallback(r=>{if(c!==void 0&&!t.current){t.current=!0;try{r.api.fromJSON(c)}catch{e?.(void 0)}}i?.(r.api),e&&r.api.onDidLayoutChange(()=>e(r.api.toJSON()))},[c,e,i]);return d.jsx(p.DockviewReact,{className:f.cx("pnl-dockview",a),components:n,watermarkComponent:s,onReady:u})}exports.DockviewCenter=k;
|
package/dist/dockview.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { DockviewReact as f } from "dockview-react";
|
|
3
|
+
import { useRef as n, useCallback as d } from "react";
|
|
4
|
+
import { c as k } from "./cx-CcykAxZN.js";
|
|
5
|
+
function x({
|
|
6
|
+
documents: t,
|
|
7
|
+
layout: e,
|
|
8
|
+
onLayout: r,
|
|
9
|
+
onReady: i,
|
|
10
|
+
empty: m,
|
|
11
|
+
className: a
|
|
12
|
+
}) {
|
|
13
|
+
const c = n(!1), p = d(
|
|
14
|
+
(o) => {
|
|
15
|
+
if (e !== void 0 && !c.current) {
|
|
16
|
+
c.current = !0;
|
|
17
|
+
try {
|
|
18
|
+
o.api.fromJSON(e);
|
|
19
|
+
} catch {
|
|
20
|
+
r?.(void 0);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
i?.(o.api), r && o.api.onDidLayoutChange(() => r(o.api.toJSON()));
|
|
24
|
+
},
|
|
25
|
+
[e, r, i]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ s(
|
|
28
|
+
f,
|
|
29
|
+
{
|
|
30
|
+
className: k("pnl-dockview", a),
|
|
31
|
+
components: t,
|
|
32
|
+
watermarkComponent: m,
|
|
33
|
+
onReady: p
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
x as DockviewCenter
|
|
39
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),x=require("./cx-YyuC5RtB.cjs"),ie=e=>{let n;const t=new Set,o=(d,u)=>{const p=typeof d=="function"?d(n):d;if(!Object.is(p,n)){const h=n;n=u??(typeof p!="object"||p===null)?p:Object.assign({},n,p),t.forEach(m=>m(n,h))}},r=()=>n,c={setState:o,getState:r,getInitialState:()=>a,subscribe:d=>(t.add(d),()=>t.delete(d))},a=n=e(o,r,c);return c},Be=(e=>e?ie(e):ie),Fe=e=>e;function Ae(e,n=Fe){const t=f.useSyncExternalStore(e.subscribe,f.useCallback(()=>n(e.getState()),[e,n]),f.useCallback(()=>n(e.getInitialState()),[e,n]));return f.useDebugValue(t),t}const E=["left","right","top","bottomLeft","bottomRight"],B=["primary","secondary"],ue=["bottomLeft","bottomRight"];function k(e){return e==="bottomLeft"||e==="bottomRight"}function C(e){return e==="top"||k(e)}const F={left:{column:["left","top"],band:"bottomLeft"},right:{column:["right"],band:"bottomRight"}};function G(e){return e==="left"||e==="top"}const L=140,ee=240,Z=100,de={left:320,right:260,top:180,bottomLeft:240,bottomRight:240},fe="bottomRight";function O(e){return k(e)?fe:e}const M={left:"right",right:"left",top:fe,bottomLeft:"top",bottomRight:"top"};function pe(e,n,t){return Math.min(Math.max(e,n),t)}function ne(e,n,t){const o=Math.max(L,Math.round(n-t-ee));return pe(Math.round(e),L,o)}function T(e,n){const t=Math.max(Z,Math.round(n-Z));return pe(Math.round(e),Z,t)}function A(e,n){const t=e[n];return t!==void 0&&(t.primary!==void 0||t.secondary!==void 0)}function De(e){return A(e,"bottomLeft")||A(e,"bottomRight")}function he(e,n,t,o){return(k(t)?De(n):A(n,t))?e.sizes[O(t)]??o(t):0}function He(e,n,t,o,r){const s={...e.sizes},i={...e.splits};for(const a of E){const d=s[a];if(d===void 0)continue;const u=C(a)?o:t;s[a]=ne(d,u,he(e,n,M[a],r));const p=i[a];p!==void 0&&(i[a]=T(p,C(a)?t:o))}const c=e.bandSplit===void 0?void 0:T(e.bandSplit,t);return{sizes:s,splits:i,bandSplit:c}}function ge(e,n,t){const o=t-ee,r=e+n;if(r<=o)return[e,n];const s=d=>d===0?0:L,i=s(e)+s(n);if(o<=i)return[Math.min(e,s(e)),Math.min(n,s(n))];const c=o/r,a=Math.max(s(e),Math.round(e*c));return[a,Math.max(s(n),Math.round(o-a))]}function Ue(e,n,t){return e.find(o=>o.zone===n&&o.slot===t)?.id}function S(e,n){return n===void 0?void 0:e.find(t=>t.id===n)}function N(e,n){const t=e.open[n],o=t?.primary;return o!==void 0&&S(e.registry,o)?.solo===!0?{primary:o}:{primary:o,secondary:t?.secondary}}function me(e,n){return k(n)?ue.some(t=>D(e,t)):D(e,n)}function D(e,n){const t=N(e,n);return t.primary!==void 0||t.secondary!==void 0}function H(e,n,t){return Math.max(de[n],S(e,t)?.opens??0)}function Ye(e,n,t,o){const r=e.open[n]??{},s={...e.stashed};if(S(e.registry,o)?.solo===!0)return s[n]=r,[{[t]:o},s];const i=r.primary;if(!(i!==void 0&&S(e.registry,i)?.solo===!0))return[{...r,[t]:o},e.stashed];const a=s[n]??{};return delete s[n],[{...a,[t]:o},s]}function Ve(e,n,t){const o=e.open[n]??{},r=o[t],s=e.stashed[n];if(s&&r!==void 0&&S(e.registry,r)?.solo===!0){const c={...e.stashed};return delete c[n],[s,c]}const i={...o};return delete i[t],[i,e.stashed]}const ce={sizes:{},splits:{}};function be(e={}){const n=e.initial;return Be()((t,o)=>({registry:[],open:n?.open??{},lengths:n?.lengths??ce,focusedZone:null,stashed:{},settled:n?.open!==void 0,available:{width:0,height:0},register:r=>t(s=>({registry:[...s.registry.filter(c=>c.id!==r.id),r]})),unregister:r=>t(s=>{const i={...s.open};for(const c of E){const a=i[c];if(a)for(const d of B){if(a[d]!==r)continue;const u={...a};delete u[d],i[c]=u}}return{registry:s.registry.filter(c=>c.id!==r),open:i}}),settle:r=>t(s=>{if(s.settled)return s;const i={...r??{}};for(const c of E)for(const a of B){if(i[c]?.[a]!==void 0)continue;const d=Ue(s.registry,c,a);d!==void 0&&(i[c]={...i[c]??{},[a]:d})}return{open:i,settled:!0}}),show:r=>t(s=>{const i=S(s.registry,r);if(!i)return s;const{zone:c,slot:a}=i;if(s.open[c]?.[a]===r)return{focusedZone:c};const[d,u]=Ye(s,c,a,r);return{open:{...s.open,[c]:d},stashed:u,focusedZone:c}}),close:(r,s)=>t(i=>{const[c,a]=Ve(i,r,s),d={...i.open,[r]:c};return{open:d,stashed:a,focusedZone:!A(d,r)&&i.focusedZone===r?null:i.focusedZone}}),toggle:r=>{const s=o(),i=S(s.registry,r);if(!i)return;N(s,i.zone)[i.slot]===r?s.close(i.zone,i.slot):s.show(r)},focus:r=>t(s=>s.focusedZone===r?s:{focusedZone:r}),resize:(r,s,i)=>t(c=>{const a=he(c.lengths,c.open,M[r],p=>H(c.registry,p,N(c,p).primary)),d=ne(s,i,a),u=O(r);return d===c.lengths.sizes[u]?c:{lengths:{...c.lengths,sizes:{...c.lengths.sizes,[u]:d}}}}),resplit:(r,s,i)=>t(c=>{const a=T(s,i);return a===c.lengths.splits[r]?c:{lengths:{...c.lengths,splits:{...c.lengths.splits,[r]:a}}}}),resplitBand:(r,s)=>t(i=>{const c=T(r,s);return c===i.lengths.bandSplit?i:{lengths:{...i.lengths,bandSplit:c}}}),fit:(r,s)=>t(i=>({available:{width:r,height:s},lengths:He(i.lengths,i.open,r,s,c=>H(i.registry,c,N(i,c).primary))})),reset:()=>t(r=>({open:{},lengths:ce,focusedZone:null,stashed:{},settled:!1,registry:r.registry}))}))}const $e=()=>{const e=new Map;return{read:n=>e.get(n)??null,write:(n,t)=>{e.set(n,t)}}},xe=()=>({read:e=>{try{return globalThis.localStorage?.getItem(e)??null}catch{return null}},write:(e,n)=>{try{globalThis.localStorage?.setItem(e,n)}catch{}}}),te=1;function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qe(e){const n={};for(const t of E){const o=e[t];if(_(o))for(const r of B){const s=o[r];typeof s=="string"&&(n[t]={...n[t],[r]:s})}}return n}function le(e){const n={};for(const t of E){const o=e[t];typeof o=="number"&&Number.isFinite(o)&&(n[t]=o)}return n}function ye(e,n){const t=e.read(n);if(t===null)return;let o;try{o=JSON.parse(t)}catch{return}if(!_(o)||o.version!==te||!_(o.open)||!_(o.lengths))return;const r=o.lengths;if(!_(r.sizes)||!_(r.splits))return;const s=r.bandSplit;return{open:qe(o.open),lengths:{sizes:le(r.sizes),splits:le(r.splits),bandSplit:typeof s=="number"&&Number.isFinite(s)?s:void 0}}}function ve(e,n,t){const o={version:te,...t};e.write(n,JSON.stringify(o))}const Se=typeof globalThis.document>"u"?f.useEffect:f.useLayoutEffect,je=f.createContext(null);function we({store:e,storageKey:n="panels:layout",storage:t,defaultOpen:o,children:r}){const[s]=f.useState(()=>t===null?null:t??xe()),[i]=f.useState(()=>e??be({initial:s?ye(s,n):void 0}));return Se(()=>{i.getState().settle(o)},[i,o]),f.useEffect(()=>{if(s)return i.subscribe(c=>{c.settled&&ve(s,n,{open:c.open,lengths:c.lengths})})},[s,i,n]),l.jsx(je.Provider,{value:i,children:r})}function I(){const e=f.useContext(je);if(!e)throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");return e}function v(e){const n=I();return Ae(n,e)}function z(){const e=I();return f.useMemo(()=>{const{show:n,close:t,toggle:o,focus:r,resize:s,resplit:i,resplitBand:c,fit:a,reset:d}=e.getState();return{show:n,close:t,toggle:o,focus:r,resize:s,resplit:i,resplitBand:c,fit:a,reset:d}},[e])}function Pe(e){const n=I();f.useEffect(()=>{const t=e.current;if(!t)return;const o=()=>{const{clientWidth:s,clientHeight:i}=t;s===0||i===0||n.getState().fit(s,i)};if(o(),typeof ResizeObserver>"u")return;const r=new ResizeObserver(o);return r.observe(t),()=>r.disconnect()},[e,n])}function R(){const e=v(t=>t.registry),n=v(t=>t.open);return f.useMemo(()=>({registry:e,open:n}),[e,n])}function U(e){const n=R();return f.useMemo(()=>N(n,e),[n,e])}function J(e){const n=R();return f.useMemo(()=>D(n,e),[n,e])}function Ne(e){const n=R();return f.useMemo(()=>me(n,e),[n,e])}function _e(){return{left:J(F.left.band),right:J(F.right.band)}}function Me(){const e=f.useRef(null);return f.useMemo(()=>({start:(t,o)=>{t.currentTarget.setPointerCapture(t.pointerId),e.current={...o,pointerId:t.pointerId}},matching:t=>e.current?.pointerId===t.pointerId?e.current:null,cancel:()=>{e.current=null}}),[])}function Y({axis:e,invert:n=!1,size:t,onSize:o,measure:r,label:s,min:i,max:c,step:a=16,className:d}){const u=Me(),p=f.useRef(null),h=e==="vertical",m=f.useCallback(g=>(h?g?.clientHeight:g?.clientWidth)??0,[h]),b=f.useCallback(g=>{const y=u.matching(g);if(!y)return;const W=(h?g.clientY:g.clientX)-y.position;o(y.size+W*(n?-1:1),y.available)},[u,n,h,o]),j=f.useCallback(g=>{const y=h?"ArrowUp":"ArrowLeft",w=h?"ArrowDown":"ArrowRight";if(g.key!==y&&g.key!==w)return;const W=m(p.current?.parentElement),Te=t??r?.()??0,ke=g.key===w?1:-1;g.preventDefault(),o(Te+a*ke*(n?-1:1),W)},[n,h,r,o,m,t,a]);return l.jsx("div",{ref:p,role:"separator",tabIndex:0,"aria-label":s,"aria-orientation":h?"horizontal":"vertical","aria-valuenow":t===void 0?void 0:Math.round(t),"aria-valuemin":i,"aria-valuemax":c,onPointerDown:g=>{u.start(g,{position:h?g.clientY:g.clientX,size:t??r?.()??0,available:m(g.currentTarget.parentElement)})},onPointerMove:b,onPointerUp:u.cancel,onPointerCancel:u.cancel,onLostPointerCapture:u.cancel,onKeyDown:j,className:x.cx("pnl-handle",h?"pnl-handle--row":"pnl-handle--col",d)})}function ae(e,n,t,o,r){return r?t??H(e,o,n):0}function Ze(e){const n=R(),t=U(e),o=U(M[e]),r=Ne(M[e]),s=v(u=>u.lengths.sizes[O(e)]),i=v(u=>u.lengths.sizes[O(M[e])]),c=v(u=>u.lengths.splits[e]),a=v(u=>C(e)?u.available.height:u.available.width),d=v(u=>u.focusedZone===e);return f.useMemo(()=>{const{registry:u}=n,p=S(u,t.primary),h=S(u,t.secondary),m=p!==void 0||h!==void 0,b=ae(u,t.primary,s,e,m),j=ae(u,o.primary,i,M[e],r);return{primary:p,secondary:h,draws:m,size:a===0?b:ge(b,j,a)[0],split:c,focused:d}},[n,t,o,r,s,i,a,c,d,e])}function Ee(e){const n=v(t=>t.registry);return f.useMemo(()=>[["primary",n.filter(o=>o.zone===e&&o.slot==="primary")],["secondary",n.filter(o=>o.zone===e&&o.slot==="secondary")]].filter(([,o])=>o.length>0),[n,e])}const Ce=f.createContext(new Map),Ie=Ce.Provider;function ze(e){return f.useContext(Ce).get(e)}function Re({title:e,children:n,fillActions:t,trailing:o,className:r}){return l.jsxs("header",{className:x.cx("pnl-header",r),children:[l.jsx("span",{className:x.cx("pnl-header__title",t&&"pnl-header__title--fixed"),children:e}),l.jsx("span",{className:x.cx("pnl-header__actions",t&&"pnl-header__actions--fill"),children:n}),l.jsx("span",{className:"pnl-header__trailing",children:o})]})}function V({orientation:e="vertical",className:n}){return l.jsx("span",{"aria-hidden":"true",className:x.cx("pnl-separator",`pnl-separator--${e}`,n)})}function oe({children:e,className:n,...t}){return l.jsx("section",{className:x.cx("pnl-surface",n),...t,children:e})}function se({icon:e,label:n,active:t,accented:o,acts:r,className:s,children:i,ref:c,...a}){return l.jsxs("button",{type:"button",ref:c,"aria-label":n,"aria-pressed":r?void 0:t,className:x.cx("pnl-icon-button",t&&"pnl-icon-button--active",o&&"pnl-icon-button--accented",s),...a,children:[e!==void 0&&l.jsx("span",{className:"pnl-icon-button__glyph",children:e}),i]})}function We({panel:e,length:n,closeLabel:t,onFocus:o}){const{close:r}=z(),s=ze(e.id);return l.jsxs(oe,{"aria-label":e.title,onPointerDownCapture:o,className:n===void 0?"pnl-surface--fill":"pnl-surface--give",style:n===void 0?void 0:{flexBasis:n},children:[l.jsx(Re,{title:e.title,fillActions:s?.actions!==void 0&&C(e.zone),trailing:l.jsxs(l.Fragment,{children:[s?.actions!==void 0&&l.jsx(V,{}),l.jsx(se,{label:t,acts:!0,onClick:()=>r(e.zone,e.slot),className:"pnl-icon-button--header",icon:l.jsx(Ge,{})})]}),children:s?.actions}),l.jsx("div",{className:x.cx("pnl-body"),children:s?.content})]})}const K=f.memo(We);function Ge(){return l.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",focusable:"false",children:l.jsx("path",{fill:"currentColor",d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})})}function Je({zone:e,labels:n}){const t=Ze(e),{focus:o,resize:r,resplit:s}=z(),i=f.useRef(null),c=f.useCallback(()=>o(e),[o,e]),a=C(e),d=f.useCallback(()=>a?i.current?.clientHeight??0:i.current?.clientWidth??0,[a]);if(!t.draws)return null;const{primary:u,secondary:p,size:h,split:m}=t,b=l.jsxs("div",{ref:i,className:x.cx("pnl-zone",a?"pnl-zone--row":"pnl-zone--col"),style:{[a?"height":"width"]:h},children:[u&&l.jsx(K,{panel:u,closeLabel:n.closePanel,onFocus:c}),u&&p&&l.jsx(Y,{axis:a?"horizontal":"vertical",invert:!0,size:m,min:Z,label:n.resizeSplit,onSize:(g,y)=>s(e,g,y)}),p&&l.jsx(K,{panel:p,length:u&&m!==void 0?m:void 0,closeLabel:n.closePanel,onFocus:c})]}),j=l.jsx(Y,{axis:a?"vertical":"horizontal",invert:!G(e),size:h,min:L,measure:d,label:n.resizeZone,onSize:(g,y)=>r(e,g,y)});return G(e)?l.jsxs(l.Fragment,{children:[b,j]}):l.jsxs(l.Fragment,{children:[j,b]})}const P=f.memo(Je);function Le({left:e,right:n,labels:t}){const o=v(i=>i.lengths.bandSplit),{resplitBand:r}=z(),s=f.useCallback((i,c)=>r(i,c),[r]);return!e&&!n?null:!e||!n?l.jsx(P,{zone:e?"bottomLeft":"bottomRight",labels:t}):l.jsxs("div",{className:"pnl-band",children:[l.jsx("div",{className:x.cx("pnl-band__half",o===void 0&&"pnl-band__half--even"),style:o===void 0?void 0:{width:o},children:l.jsx(P,{zone:"bottomLeft",labels:t})}),l.jsx(Y,{axis:"horizontal",size:o,min:Z,label:t.resizeBand,onSize:s}),l.jsx("div",{className:"pnl-band__half pnl-band__half--rest",children:l.jsx(P,{zone:"bottomRight",labels:t})})]})}function $(e){return null}$.displayName="Panels.Center";const Oe={closePanel:"Close panel",resizeZone:"Resize panel area",resizeSplit:"Resize the two panels",resizeBand:"Resize the bottom panels"};function q(e){return null}q.displayName="Panels.Panel";function X({side:e,header:n,className:t}){const{column:o,band:r}=F[e];return l.jsxs("div",{role:"toolbar","aria-orientation":"vertical",className:x.cx("pnl-rail",`pnl-rail--${e}`,t),children:[l.jsxs("div",{className:"pnl-rail__group",children:[n!==void 0&&l.jsxs(l.Fragment,{children:[n,l.jsx(V,{orientation:"horizontal"})]}),o.map(s=>l.jsx(Q,{zone:s},s))]}),l.jsx(Q,{zone:r})]})}function Q({zone:e}){const n=Ee(e),t=U(e),o=v(s=>s.focusedZone===e),{toggle:r}=z();return n.length===0?null:l.jsx("div",{className:"pnl-rail__group",children:n.map(([s,i],c)=>l.jsxs(f.Fragment,{children:[c>0&&l.jsx(V,{orientation:"horizontal"}),i.map(a=>{const d=t[s]===a.id;return l.jsx(se,{icon:a.icon,label:a.title,active:d,accented:d&&o,onClick:()=>r(a.id),className:"pnl-rail__button"},a.id)})]},`${e}:${s}`))})}function Ke(e){const n=[],t=new Map,o=[];let r=null;for(const s of f.Children.toArray(e)){if(!f.isValidElement(s)){o.push(s);continue}if(s.type===$){r=s;continue}if(s.type!==q){o.push(s);continue}const i=s.props,{id:c,zone:a,slot:d="primary",title:u,icon:p,opens:h,solo:m,actions:b,children:j}=i;n.push({id:c,zone:a,slot:d,title:u,icon:p,opens:h,solo:m}),t.set(c,{content:j,actions:b})}return{specs:n,content:t,centre:r,loose:o}}function re({header:e,footer:n,railHeader:t,labels:o,theme:r,className:s,children:i,...c}){return l.jsx(we,{...c,children:l.jsx(Xe,{header:e,footer:n,railHeader:t,labels:o,theme:r,className:s,children:i})})}function Xe({header:e,footer:n,railHeader:t,labels:o,theme:r,className:s,children:i}){const c=I(),a=f.useRef(null);Pe(a);const{specs:d,content:u,centre:p,loose:h}=f.useMemo(()=>Ke(i),[i]),m=f.useMemo(()=>({...Oe,...o}),[o]);Se(()=>{const{register:j,unregister:g}=c.getState();for(const w of d)j(w);const y=new Set(d.map(w=>w.id));for(const w of c.getState().registry)y.has(w.id)||g(w.id)},[c,d]);const b=_e();return l.jsx(Ie,{value:u,children:l.jsxs("div",{"data-pnl-theme":r,className:x.cx("pnl-root",s),children:[e,l.jsxs("div",{className:"pnl-middle",children:[l.jsx(X,{side:"left",header:t}),l.jsxs("div",{ref:a,className:"pnl-columns",children:[l.jsx(P,{zone:"top",labels:m}),l.jsxs("div",{className:"pnl-row",children:[!b.left&&l.jsx(P,{zone:"left",labels:m}),l.jsxs("div",{className:"pnl-stack",children:[l.jsxs("div",{className:"pnl-row",children:[b.left&&l.jsx(P,{zone:"left",labels:m}),l.jsx(oe,{className:"pnl-centre",children:p?.props.children}),b.right&&l.jsx(P,{zone:"right",labels:m})]}),l.jsx(Le,{left:b.left,right:b.right,labels:m})]}),!b.right&&l.jsx(P,{zone:"right",labels:m})]})]}),l.jsx(X,{side:"right"})]}),n,h]})})}re.Panel=q;re.Center=$;function Qe(){const e=I(),n=R(),t=v(i=>i.focusedZone),o=z(),r=f.useCallback(i=>{const c=S(n.registry,i);return c!==void 0&&N(n,c.zone)[c.slot]===i},[n]),s=f.useCallback(i=>{const c=S(n.registry,i);!c||N(n,c.zone)[c.slot]!==i||e.getState().close(c.zone,c.slot)},[n,e]);return f.useMemo(()=>({panels:n.registry,reveal:o.show,close:s,toggle:o.toggle,isShown:r,focusedZone:t,reset:o.reset}),[n,o.show,o.toggle,o.reset,s,r,t])}exports.cx=x.cx;exports.BOTTOM_ZONES=ue;exports.Band=Le;exports.Center=$;exports.ContentProvider=Ie;exports.DEFAULT_LABELS=Oe;exports.DEFAULT_SIZES=de;exports.IconButton=se;exports.LAYOUT_VERSION=te;exports.MIN_CENTER=ee;exports.MIN_SIZE=L;exports.MIN_SPLIT=Z;exports.Panel=q;exports.PanelFrame=K;exports.PanelHeader=Re;exports.Panels=re;exports.PanelsProvider=we;exports.Rail=X;exports.RailZone=Q;exports.ResizeHandle=Y;exports.SLOTS=B;exports.Separator=V;exports.Surface=oe;exports.ZONES=E;exports.ZONES_BY_SIDE=F;exports.ZoneEdge=P;exports.browserStorage=xe;exports.createPanelsStore=be;exports.fitSplit=T;exports.fitZoneSize=ne;exports.isBottom=k;exports.isHorizontal=C;exports.isLeading=G;exports.memoryStorage=$e;exports.readLayout=ye;exports.sharedSizes=ge;exports.shownIn=N;exports.sizeKeyOf=O;exports.specOf=S;exports.undraggedSizeOf=H;exports.useArrangement=R;exports.useBandHalves=_e;exports.useContainerFit=Pe;exports.usePanelContent=ze;exports.usePanels=Qe;exports.usePanelsActions=z;exports.usePanelsState=v;exports.usePanelsStore=I;exports.usePointerDrag=Me;exports.useShownIn=U;exports.useZone=Ze;exports.useZoneDraws=J;exports.useZonePanels=Ee;exports.useZoneTakesRoom=Ne;exports.writeLayout=ve;exports.zoneDraws=D;exports.zoneTakesRoom=me;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import './styles/panels.css';
|
|
2
|
+
export { Panels, type PanelsProps } from './components/Panels';
|
|
3
|
+
export { Panel, type PanelProps } from './components/Panel';
|
|
4
|
+
export { Center, type CenterProps } from './components/Center';
|
|
5
|
+
export { Rail, RailZone, type RailProps } from './components/Rail';
|
|
6
|
+
export { ZoneEdge, type ZoneEdgeProps } from './components/ZoneEdge';
|
|
7
|
+
export { Band, type BandProps } from './components/Band';
|
|
8
|
+
export { PanelFrame, type PanelFrameProps } from './components/PanelFrame';
|
|
9
|
+
export { Surface } from './components/Surface';
|
|
10
|
+
export { PanelHeader, type PanelHeaderProps } from './components/PanelHeader';
|
|
11
|
+
export { IconButton, type IconButtonProps } from './components/IconButton';
|
|
12
|
+
export { Separator, type SeparatorProps } from './components/Separator';
|
|
13
|
+
export { ResizeHandle, type ResizeHandleProps } from './components/ResizeHandle';
|
|
14
|
+
export { DEFAULT_LABELS, type PanelsLabels } from './components/labels';
|
|
15
|
+
export { usePanelContent, ContentProvider, type PanelContent } from './components/content';
|
|
16
|
+
export { PanelsProvider, usePanelsStore, usePanelsState, usePanelsActions, type PanelsProviderProps, } from './core/context';
|
|
17
|
+
export { usePanels, type PanelsApi } from './core/hooks/usePanels';
|
|
18
|
+
export { useArrangement, useBandHalves, useShownIn, useZoneDraws, useZoneTakesRoom, } from './core/hooks/useArrangement';
|
|
19
|
+
export { useZone, useZonePanels, type ZoneView } from './core/hooks/useZone';
|
|
20
|
+
export { useContainerFit } from './core/hooks/useContainerFit';
|
|
21
|
+
export { usePointerDrag, type PointerDrag } from './core/hooks/usePointerDrag';
|
|
22
|
+
export { createPanelsStore, shownIn, specOf, zoneDraws, zoneTakesRoom, undraggedSizeOf, type PanelsState, type PanelsStore, } from './core/store';
|
|
23
|
+
export { browserStorage, memoryStorage, readLayout, writeLayout, LAYOUT_VERSION, type LayoutStorage, } from './core/persistence';
|
|
24
|
+
export { MIN_SIZE, MIN_CENTER, MIN_SPLIT, DEFAULT_SIZES, fitZoneSize, fitSplit, sharedSizes, sizeKeyOf, } from './core/clamps';
|
|
25
|
+
export { ZONES, SLOTS, BOTTOM_ZONES, ZONES_BY_SIDE, type Side, isBottom, isHorizontal, isLeading, type Zone, type Slot, type PanelSpec, type ZoneSlots, type OpenByZone, type SizesByZone, type Lengths, type LayoutState, } from './core/types';
|
|
26
|
+
export { cx } from './core/cx';
|