@dashfoo/react 0.1.0 → 0.2.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/README.md +171 -21
- package/dist/index.d.ts +238 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -200,6 +200,50 @@ Rows and tabsets can carry `min` and `max` dimensions from `@dashfoo/core`.
|
|
|
200
200
|
tabset has no node-level `min`, it uses `global.tabSetMinSize`; when that global
|
|
201
201
|
is omitted, the React adapter falls back to `320px`.
|
|
202
202
|
|
|
203
|
+
## External drag sources
|
|
204
|
+
|
|
205
|
+
Tabs normally move within a layout. To drag new content in from outside it — a
|
|
206
|
+
widget list, a palette, a marketplace — wrap both sides in `DashfooDragProvider`
|
|
207
|
+
and register each source with `useExternalTabSource`. Dropping a source on the
|
|
208
|
+
layout inserts the tab it creates (stacking on a strip or body, splitting on an
|
|
209
|
+
edge), exactly like an internal tab drop. A drop outside any tabset is a no-op.
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { createTabId, tab } from "@dashfoo/core";
|
|
213
|
+
import { DashfooDragProvider, DashfooLayout, useExternalTabSource } from "@dashfoo/react";
|
|
214
|
+
|
|
215
|
+
const WidgetCard = ({ component, name }: { component: string; name: string }) => {
|
|
216
|
+
const { ref } = useExternalTabSource({
|
|
217
|
+
createTab: () => tab(component, name, { id: createTabId() }),
|
|
218
|
+
label: name,
|
|
219
|
+
});
|
|
220
|
+
return <div ref={ref}>{name}</div>;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const App = () => (
|
|
224
|
+
<DashfooDragProvider>
|
|
225
|
+
<WidgetCard component="metrics" name="Metrics" />
|
|
226
|
+
<DashfooLayout defaultModel={model} components={registry} />
|
|
227
|
+
</DashfooDragProvider>
|
|
228
|
+
);
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
`createTab` runs at drag start and must return a fresh `TabNode` with a unique
|
|
232
|
+
id per call (`createNodeId` / `createTabId` from `@dashfoo/core` mint one). The
|
|
233
|
+
returned node is validated against the model schema; an invalid tab warns and
|
|
234
|
+
cancels the drag. `DashfooDragProvider` is optional everywhere else — a
|
|
235
|
+
standalone layout needs no provider. Pointer drag is the only drag input, so
|
|
236
|
+
offer a click-to-add path (e.g. `ref.addTab(...)`) alongside the drag for
|
|
237
|
+
keyboard access.
|
|
238
|
+
|
|
239
|
+
`useExternalTabSource` options:
|
|
240
|
+
|
|
241
|
+
| Option | Type | Default | Description |
|
|
242
|
+
| ----------- | --------------- | ------------ | ------------------------------------------ |
|
|
243
|
+
| `createTab` | `() => TabNode` | — (required) | Builds the tab to insert; called per drag. |
|
|
244
|
+
| `label` | `string` | `""` | The drag preview chip text. |
|
|
245
|
+
| `disabled` | `boolean` | `false` | Unregisters the source while true. |
|
|
246
|
+
|
|
203
247
|
## Persistence
|
|
204
248
|
|
|
205
249
|
The `persist` prop saves an uncontrolled layout and restores it on load. It loads
|
|
@@ -228,8 +272,10 @@ const Layout = () => {
|
|
|
228
272
|
|
|
229
273
|
`persist` accepts a bare localStorage key or `{ key, storage?, debounceMs? }` for
|
|
230
274
|
a custom store (sessionStorage, in-memory, your own). A pending save flushes on
|
|
231
|
-
unmount
|
|
232
|
-
|
|
275
|
+
unmount and on page hide (reload, tab close, navigation, the page going to the
|
|
276
|
+
background), so the last change is never lost — even inside the debounce window.
|
|
277
|
+
It applies to uncontrolled mode only; in controlled mode, save the model yourself
|
|
278
|
+
in `onModelChange`.
|
|
233
279
|
|
|
234
280
|
The lower-level `usePersistence` load/save primitive (that `persist` is built on)
|
|
235
281
|
is also exported, for hosts that drive the store directly. See the
|
|
@@ -299,7 +345,7 @@ you.
|
|
|
299
345
|
| `tabset-grip` | `button` | Drags the whole tabset. `aria-label="Move tabset"`; shown when `draggableTabsets` is on and the tabset is not maximized. |
|
|
300
346
|
| `tabset-maximize` | `button` | Maximize/restore toggle. `aria-pressed` reflects state. |
|
|
301
347
|
| `tabcontent` | `div` | `role="tabpanel"`, the active tab's content (or empty when none). |
|
|
302
|
-
| `dock-indicator` | `div` | The drag preview overlay (
|
|
348
|
+
| `dock-indicator` | `div` | The drag preview overlay (ghost tab or zone pane). `pointer-events: none`. |
|
|
303
349
|
| `drag-preview` | `div` | The chip that follows the pointer during a drag, showing the dragged label. |
|
|
304
350
|
| `separator` | rrp `Separator` | rrp emits `data-separator` with `aria-orientation`; style splitters here. |
|
|
305
351
|
|
|
@@ -314,15 +360,14 @@ The `[data-dashfoo="dock-indicator"]` overlay positions itself inline, but every
|
|
|
314
360
|
visual property reads from a CSS variable with a neutral fallback. Override them
|
|
315
361
|
to theme the drag preview without touching layout.
|
|
316
362
|
|
|
317
|
-
| Variable | Used for
|
|
318
|
-
| ----------------------------- |
|
|
319
|
-
| `--dashfoo-dock-fill` |
|
|
320
|
-
| `--dashfoo-dock-border` |
|
|
321
|
-
| `--dashfoo-dock-border-width` |
|
|
322
|
-
| `--dashfoo-dock-radius` |
|
|
323
|
-
| `--dashfoo-dock-
|
|
324
|
-
| `--dashfoo-dock-
|
|
325
|
-
| `--dashfoo-dock-transition` | indicator move animation | `left 60ms, top 60ms, width 60ms, height 60ms` |
|
|
363
|
+
| Variable | Used for | Fallback |
|
|
364
|
+
| ----------------------------- | ------------------------ | ---------------------------------------------- |
|
|
365
|
+
| `--dashfoo-dock-fill` | indicator fill | `oklch(0.556 0 0 / 0.18)` |
|
|
366
|
+
| `--dashfoo-dock-border` | indicator border color | `oklch(0.708 0 0 / 0.75)` |
|
|
367
|
+
| `--dashfoo-dock-border-width` | indicator border width | `1px` |
|
|
368
|
+
| `--dashfoo-dock-radius` | indicator corner radius | `6px` |
|
|
369
|
+
| `--dashfoo-dock-tab-radius` | insertion-ghost radius | `var(--dashfoo-dock-radius, 6px)` |
|
|
370
|
+
| `--dashfoo-dock-transition` | indicator move animation | `left 60ms, top 60ms, width 60ms, height 60ms` |
|
|
326
371
|
|
|
327
372
|
Set `--dashfoo-dock-transition: none` to disable the indicator animation.
|
|
328
373
|
|
|
@@ -330,7 +375,6 @@ Set `--dashfoo-dock-transition: none` to disable the indicator animation.
|
|
|
330
375
|
:root {
|
|
331
376
|
--dashfoo-dock-fill: rgba(255, 255, 255, 0.1);
|
|
332
377
|
--dashfoo-dock-border: rgba(255, 255, 255, 0.4);
|
|
333
|
-
--dashfoo-dock-line: rgba(255, 255, 255, 0.85);
|
|
334
378
|
}
|
|
335
379
|
```
|
|
336
380
|
|
|
@@ -348,8 +392,96 @@ It binds an XState actor to React, normalizes the incoming model, and exposes
|
|
|
348
392
|
`dispatch` plus undo/redo. Uncontrolled mode gives full history; controlled mode
|
|
349
393
|
routes changes through `onModelChange` and keeps the actor in sync.
|
|
350
394
|
|
|
351
|
-
|
|
352
|
-
|
|
395
|
+
Three selector hooks read the scoped stores the primitives coordinate through.
|
|
396
|
+
Each takes a selector and re-renders only when the selected slice changes:
|
|
397
|
+
|
|
398
|
+
```ts
|
|
399
|
+
const dispatch = useLayout((state) => state.dispatch); // layout-wide config + dispatch; throws outside <DashfooLayout>/<Layout.Root>
|
|
400
|
+
const node = useTabset((state) => state.node); // per-tabset state; throws outside <Tabset.Root>
|
|
401
|
+
const { index, tab } = useTab(); // which tab a part belongs to; throws outside <Tabset.Tab>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
`useDragSubject()` returns the live drag subject (`{ kind, id }` for a tab or
|
|
405
|
+
tabset being dragged) or `null` — including outside a drag layer — for
|
|
406
|
+
drag-aware styling in custom parts.
|
|
407
|
+
|
|
408
|
+
## Build your own layout
|
|
409
|
+
|
|
410
|
+
`DashfooLayout` is a thin assembly of exported primitives — you can compose the
|
|
411
|
+
same parts yourself when you need custom chrome. Two compound namespaces, same
|
|
412
|
+
pattern as `Panel`:
|
|
413
|
+
|
|
414
|
+
| Part | Element | Role |
|
|
415
|
+
| ----------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
416
|
+
| `Layout.Root` | `div[data-dashfoo="layout"]` | Creates the layout store. Takes `model`, `dispatch`, `renderTab`, and the chrome flags `DashfooLayout` accepts. |
|
|
417
|
+
| `Layout.DragLayer` | none (overlays) | Opts the tree into drag-dock. Omit it and everything else still works, just without dragging. |
|
|
418
|
+
| `Layout.Rows` | rrp split tree | Renders a `RowNode` recursively. `renderTabset` swaps in a custom tabset composition at every leaf. |
|
|
419
|
+
| `Layout.Tabset` | — | The stock tabset composition, for leaves that don't need custom chrome. |
|
|
420
|
+
| `Tabset.Root` | `div[data-dashfoo="tabset"]` | Creates the per-tabset store; owns drop registration, overflow measurement, and focus restore after close. |
|
|
421
|
+
| `Tabset.TabStrip` | `div[data-dashfoo="tabstrip"]` | The strip row (drag hit-testing targets this attribute). |
|
|
422
|
+
| `Tabset.Tablist` | `div[data-dashfoo="tablist"]` | `role="tablist"` + roving-tabindex arrow/Home/End navigation. |
|
|
423
|
+
| `Tabset.Tab` | `span[data-dashfoo="tab-item"]` | Per-tab wrapper; provides identity to the parts inside. |
|
|
424
|
+
| `Tabset.Trigger` | `button[data-dashfoo="tab"]` | The tab button: select on click, rename on double-click, draggable. Children override the label. |
|
|
425
|
+
| `Tabset.RenameInput` | `input[data-dashfoo="tab-rename"]` | Inline rename editor; renders only while its tab is being renamed. |
|
|
426
|
+
| `Tabset.CloseButton` | `button[data-dashfoo="tab-close"]` | Closes the tab with focus restore; hides when the tab isn't closable. |
|
|
427
|
+
| `Tabset.Content` | `div[data-dashfoo="tabcontent"]` | The `role="tabpanel"` pane(s); honors `keepMounted`. Children render-prop overrides `renderTab`. |
|
|
428
|
+
| `Tabset.Toolbar` | `div[data-dashfoo="tabset-toolbar"]` | Trailing toolbar container. |
|
|
429
|
+
| `Tabset.OverflowMenu` | menu button | Lists clipped tabs; hides when nothing overflows. |
|
|
430
|
+
| `Tabset.Grip` | `button[data-dashfoo="tabset-grip"]` | Drag handle for the whole tabset; hides when tabset dragging is off. |
|
|
431
|
+
| `Tabset.MaximizeButton` | `button[data-dashfoo="tabset-maximize"]` | Maximize/restore toggle; hides when maximize is off. |
|
|
432
|
+
|
|
433
|
+
All parts spread native props (`className`, `style`, handlers) like `Panel`;
|
|
434
|
+
the structural attributes (`role`, ids, `data-dashfoo`) are applied after the
|
|
435
|
+
spread because drag hit-testing and overflow measurement query them.
|
|
436
|
+
|
|
437
|
+
```tsx
|
|
438
|
+
import { Layout, Tabset, useDashfooStore, useTab } from "@dashfoo/react";
|
|
439
|
+
|
|
440
|
+
const MyTabset = ({ node }: { node: TabsetNode }) => (
|
|
441
|
+
<Tabset.Root node={node}>
|
|
442
|
+
<Tabset.TabStrip>
|
|
443
|
+
<Tabset.Tablist>
|
|
444
|
+
{node.children.map((tab) => (
|
|
445
|
+
<Tabset.Tab key={tab.id} tab={tab}>
|
|
446
|
+
<Tabset.Trigger>
|
|
447
|
+
<MyLabel /> {/* reads useTab()/useTabset() */}
|
|
448
|
+
</Tabset.Trigger>
|
|
449
|
+
<Tabset.RenameInput />
|
|
450
|
+
<Tabset.CloseButton />
|
|
451
|
+
</Tabset.Tab>
|
|
452
|
+
))}
|
|
453
|
+
</Tabset.Tablist>
|
|
454
|
+
<Tabset.Toolbar>
|
|
455
|
+
<Tabset.OverflowMenu />
|
|
456
|
+
<Tabset.MaximizeButton />
|
|
457
|
+
<Tabset.Grip />
|
|
458
|
+
</Tabset.Toolbar>
|
|
459
|
+
</Tabset.TabStrip>
|
|
460
|
+
<Tabset.Content />
|
|
461
|
+
</Tabset.Root>
|
|
462
|
+
);
|
|
463
|
+
|
|
464
|
+
const MyLayout = () => {
|
|
465
|
+
const store = useDashfooStore({ defaultModel });
|
|
466
|
+
return (
|
|
467
|
+
<Layout.Root dispatch={store.dispatch} model={store.model} renderTab={renderTab}>
|
|
468
|
+
<Layout.DragLayer>
|
|
469
|
+
<Layout.Rows node={store.model.layout} renderTabset={(node) => <MyTabset node={node} />} />
|
|
470
|
+
</Layout.DragLayer>
|
|
471
|
+
</Layout.Root>
|
|
472
|
+
);
|
|
473
|
+
};
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Maximize is the host's concern in a hand-built layout: when
|
|
477
|
+
`model.maximizedTabsetId` is set, render that tabset alone (via `findTabset`
|
|
478
|
+
from `@dashfoo/core`) instead of `Layout.Rows` — that's all `DashfooLayout`
|
|
479
|
+
does. The demo's "Raw primitives" page (`apps/demo-vite/src/pages/raw.tsx`) is
|
|
480
|
+
a complete working reference.
|
|
481
|
+
|
|
482
|
+
Misuse is never silent: parts outside their provider throw, and soft mistakes
|
|
483
|
+
(two `Tablist`s, a `Tab` whose node isn't in the tabset, renaming without a
|
|
484
|
+
`RenameInput`) warn with `[dashfoo]` and degrade gracefully.
|
|
353
485
|
|
|
354
486
|
## Exports
|
|
355
487
|
|
|
@@ -371,15 +503,33 @@ type PanelIconProps;
|
|
|
371
503
|
type PanelRootProps;
|
|
372
504
|
type PanelTitleProps;
|
|
373
505
|
|
|
374
|
-
//
|
|
506
|
+
// Layout primitives (build your own layout)
|
|
507
|
+
Layout; // Layout.Root / Layout.DragLayer / Layout.Rows / Layout.Tabset
|
|
508
|
+
type LayoutRootProps;
|
|
509
|
+
type LayoutDragLayerProps;
|
|
510
|
+
type LayoutRowsProps;
|
|
511
|
+
type LayoutTabsetProps;
|
|
512
|
+
|
|
513
|
+
// Tabset primitives
|
|
514
|
+
Tabset; // Tabset.Root / .TabStrip / .Tablist / .Tab / .Trigger / .RenameInput / .CloseButton / .Content / .Toolbar / .OverflowMenu / .Grip / .MaximizeButton
|
|
515
|
+
type TabsetRootProps; // …and a Props type per part
|
|
516
|
+
|
|
517
|
+
// Store + selector hooks
|
|
375
518
|
useDashfooStore;
|
|
376
519
|
type DashfooStore;
|
|
377
520
|
type UseDashfooStoreOptions;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
521
|
+
useLayout; // select from the layout store (throws outside Layout.Root/DashfooLayout)
|
|
522
|
+
type LayoutState;
|
|
523
|
+
useTabset; // select from the enclosing tabset store (throws outside Tabset.Root)
|
|
524
|
+
type TabsetState;
|
|
525
|
+
useTab; // { tab, index } identity (throws outside Tabset.Tab)
|
|
526
|
+
type TabContextValue;
|
|
527
|
+
useDragSubject; // the live drag subject, or null
|
|
528
|
+
|
|
529
|
+
// External drag sources
|
|
530
|
+
DashfooDragProvider; // shares one drag manager between a layout and outside sources
|
|
531
|
+
useExternalTabSource;
|
|
532
|
+
type ExternalTabSourceOptions;
|
|
383
533
|
|
|
384
534
|
// Persistence
|
|
385
535
|
usePersistence; // load/save primitive (the `persist` prop builds on this)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,6 @@
|
|
|
1
|
+
import { Action, Dashfoo, DockLocation, DragSubject, RowNode, TabNode, TabsetNode } from "@dashfoo/core";
|
|
1
2
|
import { ComponentProps, ComponentType, ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
//#region src/hooks/context.d.ts
|
|
5
|
-
type DashfooContextValue = {
|
|
6
|
-
closableTabs: boolean;
|
|
7
|
-
dispatch: (action: Action) => void;
|
|
8
|
-
draggableTabsets: boolean;
|
|
9
|
-
keepMounted: boolean;
|
|
10
|
-
maximizable: boolean;
|
|
11
|
-
maximizedTabsetId?: string;
|
|
12
|
-
renamableTabs: boolean;
|
|
13
|
-
renderTab: (tab: TabNode) => ReactNode;
|
|
14
|
-
renderTabLabel?: (tab: TabNode) => ReactNode;
|
|
15
|
-
renderTabsetToolbar?: (tabset: TabsetNode) => ReactNode;
|
|
16
|
-
tabLocation: "bottom" | "top";
|
|
17
|
-
tabsetMinSize: number;
|
|
18
|
-
tabStripEnabled: boolean;
|
|
19
|
-
};
|
|
20
|
-
declare const DashfooContext: import("react").Context<DashfooContextValue | null>;
|
|
21
|
-
declare const useDashfooContext: () => DashfooContextValue;
|
|
22
|
-
//#endregion
|
|
3
|
+
import { DragDropManager } from "@dnd-kit/dom";
|
|
23
4
|
//#region src/hooks/persistence.d.ts
|
|
24
5
|
type StorageAdapter = {
|
|
25
6
|
getItem: (key: string) => string | null;
|
|
@@ -87,6 +68,92 @@ type DashfooLayoutProps = {
|
|
|
87
68
|
};
|
|
88
69
|
declare const DashfooLayout: import("react").ForwardRefExoticComponent<DashfooLayoutProps & import("react").RefAttributes<DashfooHandle>>;
|
|
89
70
|
//#endregion
|
|
71
|
+
//#region src/components/drag-root.d.ts
|
|
72
|
+
declare const DashfooDragProvider: ({
|
|
73
|
+
children
|
|
74
|
+
}: {
|
|
75
|
+
children: ReactNode;
|
|
76
|
+
}) => ReactNode;
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/hooks/drag-hooks.d.ts
|
|
79
|
+
type ExternalTabSourceOptions = {
|
|
80
|
+
createTab: () => TabNode;
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
label?: string;
|
|
83
|
+
};
|
|
84
|
+
declare const useExternalTabSource: ({
|
|
85
|
+
createTab,
|
|
86
|
+
disabled,
|
|
87
|
+
label
|
|
88
|
+
}: ExternalTabSourceOptions) => {
|
|
89
|
+
ref: (element: Element | null) => void;
|
|
90
|
+
};
|
|
91
|
+
declare const useDragSubject: () => DragSubject | null;
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/components/drag-adapter.d.ts
|
|
94
|
+
type DragProviderProps = {
|
|
95
|
+
children: ReactNode;
|
|
96
|
+
onCommit?: (action: Action) => void;
|
|
97
|
+
splitDock?: boolean;
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/layout-root.d.ts
|
|
101
|
+
type LayoutRootProps = Omit<ComponentProps<"div">, "children"> & {
|
|
102
|
+
children: ReactNode;
|
|
103
|
+
closableTabs?: boolean;
|
|
104
|
+
dispatch: (action: Action) => void;
|
|
105
|
+
draggableTabsets?: boolean;
|
|
106
|
+
keepMounted?: boolean;
|
|
107
|
+
maximizable?: boolean;
|
|
108
|
+
model: Dashfoo;
|
|
109
|
+
renamableTabs?: boolean;
|
|
110
|
+
renderTab: (tab: TabNode) => ReactNode;
|
|
111
|
+
renderTabLabel?: (tab: TabNode) => ReactNode;
|
|
112
|
+
renderTabsetToolbar?: (tabset: TabsetNode) => ReactNode;
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/components/row-view.d.ts
|
|
116
|
+
type RowViewProps = {
|
|
117
|
+
node: RowNode;
|
|
118
|
+
renderTabset?: (node: TabsetNode) => ReactNode;
|
|
119
|
+
};
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/components/tabset/tabset-view.d.ts
|
|
122
|
+
type TabsetViewProps = {
|
|
123
|
+
node: TabsetNode;
|
|
124
|
+
};
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/components/layout.d.ts
|
|
127
|
+
declare const Layout: {
|
|
128
|
+
readonly DragLayer: ({
|
|
129
|
+
children,
|
|
130
|
+
onCommit,
|
|
131
|
+
splitDock
|
|
132
|
+
}: DragProviderProps) => import("react").ReactNode;
|
|
133
|
+
readonly Root: ({
|
|
134
|
+
children,
|
|
135
|
+
closableTabs,
|
|
136
|
+
dispatch,
|
|
137
|
+
draggableTabsets,
|
|
138
|
+
keepMounted,
|
|
139
|
+
maximizable,
|
|
140
|
+
model,
|
|
141
|
+
renamableTabs,
|
|
142
|
+
renderTab,
|
|
143
|
+
renderTabLabel,
|
|
144
|
+
renderTabsetToolbar,
|
|
145
|
+
style,
|
|
146
|
+
...props
|
|
147
|
+
}: LayoutRootProps) => import("react").ReactNode;
|
|
148
|
+
readonly Rows: ({
|
|
149
|
+
node,
|
|
150
|
+
renderTabset
|
|
151
|
+
}: RowViewProps) => import("react").ReactNode;
|
|
152
|
+
readonly Tabset: ({
|
|
153
|
+
node
|
|
154
|
+
}: TabsetViewProps) => import("react").ReactNode;
|
|
155
|
+
};
|
|
156
|
+
//#endregion
|
|
90
157
|
//#region src/components/panel.d.ts
|
|
91
158
|
type PanelRootProps = ComponentProps<"div">;
|
|
92
159
|
type PanelHeaderProps = ComponentProps<"div">;
|
|
@@ -103,6 +170,155 @@ declare const Panel: {
|
|
|
103
170
|
readonly Title: (props: PanelTitleProps) => ReactNode;
|
|
104
171
|
};
|
|
105
172
|
//#endregion
|
|
173
|
+
//#region src/components/tabset/tabset-tab-controls.d.ts
|
|
174
|
+
type TabsetRenameInputProps = ComponentProps<"input">;
|
|
175
|
+
type TabsetCloseButtonProps = ComponentProps<"button">;
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/components/tabset/tabset-content.d.ts
|
|
178
|
+
type TabsetContentProps = Omit<ComponentProps<"div">, "children"> & {
|
|
179
|
+
children?: (tab: TabNode) => ReactNode;
|
|
180
|
+
};
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/components/tabset/tabset-toolbar.d.ts
|
|
183
|
+
type TabsetToolbarProps = ComponentProps<"div">;
|
|
184
|
+
type TabsetGripProps = ComponentProps<"button">;
|
|
185
|
+
type TabsetMaximizeButtonProps = ComponentProps<"button">;
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/components/tabset/tabset-root.d.ts
|
|
188
|
+
type TabsetRootProps = ComponentProps<"div"> & {
|
|
189
|
+
node: TabsetNode;
|
|
190
|
+
};
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/components/tabset/tabset-tab.d.ts
|
|
193
|
+
type TabsetTabProps = ComponentProps<"span"> & {
|
|
194
|
+
tab: TabNode;
|
|
195
|
+
};
|
|
196
|
+
type TabsetTriggerProps = ComponentProps<"button">;
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/components/tabset/tabset-tablist.d.ts
|
|
199
|
+
type TabsetTabStripProps = ComponentProps<"div">;
|
|
200
|
+
type TabsetTablistProps = ComponentProps<"div">;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/components/tabset/tabset.d.ts
|
|
203
|
+
declare const Tabset: {
|
|
204
|
+
readonly CloseButton: ({
|
|
205
|
+
children,
|
|
206
|
+
onClick,
|
|
207
|
+
...props
|
|
208
|
+
}: TabsetCloseButtonProps) => import("react").ReactNode;
|
|
209
|
+
readonly Content: ({
|
|
210
|
+
children,
|
|
211
|
+
style,
|
|
212
|
+
...props
|
|
213
|
+
}: TabsetContentProps) => import("react").ReactNode;
|
|
214
|
+
readonly Grip: ({
|
|
215
|
+
children,
|
|
216
|
+
ref: userRef,
|
|
217
|
+
...props
|
|
218
|
+
}: TabsetGripProps) => import("react").ReactNode;
|
|
219
|
+
readonly MaximizeButton: ({
|
|
220
|
+
children,
|
|
221
|
+
onClick,
|
|
222
|
+
...props
|
|
223
|
+
}: TabsetMaximizeButtonProps) => import("react").ReactNode;
|
|
224
|
+
readonly OverflowMenu: () => import("react").ReactNode;
|
|
225
|
+
readonly RenameInput: (props: TabsetRenameInputProps) => import("react").ReactNode;
|
|
226
|
+
readonly Root: ({
|
|
227
|
+
children,
|
|
228
|
+
node,
|
|
229
|
+
ref: userRef,
|
|
230
|
+
style,
|
|
231
|
+
...props
|
|
232
|
+
}: TabsetRootProps) => import("react").ReactNode;
|
|
233
|
+
readonly Tab: ({
|
|
234
|
+
children,
|
|
235
|
+
ref: userRef,
|
|
236
|
+
tab,
|
|
237
|
+
...props
|
|
238
|
+
}: TabsetTabProps) => import("react").ReactNode;
|
|
239
|
+
readonly Tablist: ({
|
|
240
|
+
onKeyDown,
|
|
241
|
+
ref: userRef,
|
|
242
|
+
style,
|
|
243
|
+
...props
|
|
244
|
+
}: TabsetTablistProps) => import("react").ReactNode;
|
|
245
|
+
readonly TabStrip: ({
|
|
246
|
+
style,
|
|
247
|
+
...props
|
|
248
|
+
}: TabsetTabStripProps) => import("react").ReactNode;
|
|
249
|
+
readonly Toolbar: ({
|
|
250
|
+
style,
|
|
251
|
+
...props
|
|
252
|
+
}: TabsetToolbarProps) => import("react").ReactNode;
|
|
253
|
+
readonly Trigger: ({
|
|
254
|
+
children,
|
|
255
|
+
onClick,
|
|
256
|
+
onDoubleClick,
|
|
257
|
+
ref: userRef,
|
|
258
|
+
...props
|
|
259
|
+
}: TabsetTriggerProps) => import("react").ReactNode;
|
|
260
|
+
};
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/components/tab-overflow.d.ts
|
|
263
|
+
type OverflowItem = {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
};
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/components/tabset/tabset-store.d.ts
|
|
269
|
+
type TabsetState = {
|
|
270
|
+
activeTab: TabNode | undefined;
|
|
271
|
+
cancelRename: () => void;
|
|
272
|
+
closeTab: (tabId: string) => void;
|
|
273
|
+
commitRename: (tabId: string, value: string) => void;
|
|
274
|
+
dispatch: (action: Action) => void;
|
|
275
|
+
editingTabId: string | null;
|
|
276
|
+
isMaximized: boolean;
|
|
277
|
+
node: TabsetNode;
|
|
278
|
+
overflowItems: Array<OverflowItem>;
|
|
279
|
+
registerRenameInput: () => () => void;
|
|
280
|
+
registerTablist: (element: HTMLDivElement | null) => void;
|
|
281
|
+
renameInputCount: number;
|
|
282
|
+
renameTab: (tabId: string, name: string) => void;
|
|
283
|
+
restoreFocus: boolean;
|
|
284
|
+
selectOverflowTab: (tabId: string) => void;
|
|
285
|
+
selectTab: (index: number, options?: {
|
|
286
|
+
focus?: boolean;
|
|
287
|
+
}) => void;
|
|
288
|
+
showMaximize: boolean;
|
|
289
|
+
startEditing: (tabId: string) => void;
|
|
290
|
+
tablistElement: HTMLDivElement | null;
|
|
291
|
+
tabsClosable: boolean;
|
|
292
|
+
tabsRenamable: boolean;
|
|
293
|
+
toggleMaximize: () => void;
|
|
294
|
+
visualSelected: number;
|
|
295
|
+
};
|
|
296
|
+
declare const useTabset: <T>(selector: (state: TabsetState) => T) => T;
|
|
297
|
+
type TabContextValue = {
|
|
298
|
+
index: number;
|
|
299
|
+
tab: TabNode;
|
|
300
|
+
};
|
|
301
|
+
declare const useTab: () => TabContextValue;
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/hooks/layout-store.d.ts
|
|
304
|
+
type LayoutState = {
|
|
305
|
+
closableTabs: boolean;
|
|
306
|
+
dispatch: (action: Action) => void;
|
|
307
|
+
draggableTabsets: boolean;
|
|
308
|
+
keepMounted: boolean;
|
|
309
|
+
maximizable: boolean;
|
|
310
|
+
maximizedTabsetId: string | undefined;
|
|
311
|
+
renamableTabs: boolean;
|
|
312
|
+
renderTab: (tab: TabNode) => ReactNode;
|
|
313
|
+
renderTabLabel: ((tab: TabNode) => ReactNode) | undefined;
|
|
314
|
+
renderTabsetToolbar: ((tabset: TabsetNode) => ReactNode) | undefined;
|
|
315
|
+
splitDock: boolean;
|
|
316
|
+
tabLocation: "bottom" | "top";
|
|
317
|
+
tabsetMinSize: number;
|
|
318
|
+
tabStripEnabled: boolean;
|
|
319
|
+
};
|
|
320
|
+
declare const useLayout: <T>(selector: (state: LayoutState) => T) => T;
|
|
321
|
+
//#endregion
|
|
106
322
|
//#region src/hooks/responsive.d.ts
|
|
107
323
|
type Breakpoint = {
|
|
108
324
|
id: string;
|
|
@@ -148,5 +364,5 @@ type UseDashfooStoreOptions = {
|
|
|
148
364
|
};
|
|
149
365
|
declare const useDashfooStore: (options: UseDashfooStoreOptions) => DashfooStore;
|
|
150
366
|
//#endregion
|
|
151
|
-
export { type Breakpoint,
|
|
367
|
+
export { type Breakpoint, DashfooDragProvider, type DashfooHandle, DashfooLayout, type DashfooLayoutProps, type DashfooStore, type ExternalTabSourceOptions, Layout, type DragProviderProps as LayoutDragLayerProps, type LayoutRootProps, type RowViewProps as LayoutRowsProps, type LayoutState, type TabsetViewProps as LayoutTabsetProps, Panel, type PanelBadgeProps, type PanelBodyProps, type PanelHeaderProps, type PanelIconProps, type PanelRootProps, type PanelTitleProps, type PersistConfig, type Persistence, type ResponsiveModel, type StorageAdapter, type TabComponent, type TabContextValue, Tabset, type TabsetCloseButtonProps, type TabsetContentProps, type TabsetGripProps, type TabsetMaximizeButtonProps, type TabsetRenameInputProps, type TabsetRootProps, type TabsetState, type TabsetTabProps, type TabsetTabStripProps, type TabsetTablistProps, type TabsetToolbarProps, type TabsetTriggerProps, type UseDashfooStoreOptions, type UseResponsiveModelOptions, activeBreakpoint, localStorageAdapter, matchBreakpoint, memoryStorageAdapter, useDashfooStore, useDragSubject, useExternalTabSource, useLayout, usePersistence, useResponsiveModel, useTab, useTabset };
|
|
152
368
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/hooks/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/hooks/persistence.ts","../src/components/dashfoo-layout.tsx","../src/components/drag-root.tsx","../src/hooks/drag-hooks.tsx","../src/components/drag-adapter.tsx","../src/components/layout-root.tsx","../src/components/row-view.tsx","../src/components/tabset/tabset-view.tsx","../src/components/layout.tsx","../src/components/panel.tsx","../src/components/tabset/tabset-tab-controls.tsx","../src/components/tabset/tabset-content.tsx","../src/components/tabset/tabset-toolbar.tsx","../src/components/tabset/tabset-root.tsx","../src/components/tabset/tabset-tab.tsx","../src/components/tabset/tabset-tablist.tsx","../src/components/tabset/tabset.ts","../src/components/tab-overflow.tsx","../src/components/tabset/tabset-store.ts","../src/hooks/layout-store.ts","../src/hooks/responsive.ts","../src/hooks/store.ts"],"mappings":";;;;KAQK,cAAA;EACH,OAAA,GAAU,GAAA;EACV,UAAA,GAAa,GAAA;EACb,OAAA,GAAU,GAAA,UAAa,KAAA;AAAA;AAAA,cAGnB,oBAAA,QAA2B,cAWhC;AAAA,cAIK,mBAAA,EAAqB,cAiC1B;AAAA,KAII,aAAA;EACH,UAAA;EACA,GAAA;EACA,OAAA,EAAS,cAAc;AAAA;AAAA,KAGpB,WAAA;EACH,KAAA;EAEA,YAAA,EAAc,OAAA;EACd,IAAA,GAAO,KAAA,EAAO,OAAO;AAAA;AAAA,cASjB,cAAA,GACJ,MAAA,EAAQ,aAAA,SACR,YAAA,EAAc,OAAA,iBACb,WAAA;;;KCtEE,YAAA;EAA0B,UAAA;EAAqB,GAAA;E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