@dashfoo/react 0.6.4 → 0.7.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/dist/index.d.ts +44 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +635 -557
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Action, Dashfoo, DockLocation, DragSubject, DropIntent, FloatNode, GlobalAttributes, Orientation, RowNode, SnapConfig, TabNode, TabsetNode } from "@dashfoo/core";
|
|
1
|
+
import { Action, Dashfoo, DockLocation, DragSubject, DropIntent, FloatNode, GlobalAttributes, Orientation, RowNode, SnapConfig, TabNode, TabsetNode, dragDockMachine } from "@dashfoo/core";
|
|
2
2
|
import { ComponentProps, ComponentType, ReactNode, Ref } from "react";
|
|
3
3
|
import { DragDropManager } from "@dnd-kit/dom";
|
|
4
4
|
import "zustand";
|
|
5
|
+
import "xstate";
|
|
5
6
|
//#region src/hooks/persistence.d.ts
|
|
6
7
|
type StorageAdapter = {
|
|
7
8
|
getItem: (key: string) => string | null;
|
|
@@ -94,6 +95,13 @@ type ExternalTabSourceOptions = {
|
|
|
94
95
|
declare const useExternalTabSource: ({ createTab, disabled, label }: ExternalTabSourceOptions) => {
|
|
95
96
|
ref: (element: Element | null) => void;
|
|
96
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Both drag readers are documented as working anywhere under the provider, which
|
|
100
|
+
* includes a custom overlay mounted beside the layout rather than inside a drag
|
|
101
|
+
* layer, so they read the root's actor. Outside a provider entirely there is no
|
|
102
|
+
* actor to read and they report the empty state instead of throwing: a component
|
|
103
|
+
* that renders both inside and outside a layout should not crash in one of them.
|
|
104
|
+
*/
|
|
97
105
|
declare const useDragSubject: () => DragSubject | null;
|
|
98
106
|
declare const useDropIntent: () => DropIntent | null;
|
|
99
107
|
//#endregion
|
|
@@ -108,9 +116,38 @@ type DragProviderProps = {
|
|
|
108
116
|
type FloatLayerProps = {
|
|
109
117
|
children: ReactNode;
|
|
110
118
|
floats: Array<FloatNode>;
|
|
111
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Accepted for backwards compatibility only. Floating panels now inherit
|
|
121
|
+
* every global-derived capability from the layout store above them, so this
|
|
122
|
+
* is no longer read; it disappears in the next major.
|
|
123
|
+
*/
|
|
124
|
+
global?: GlobalAttributes;
|
|
112
125
|
};
|
|
113
126
|
//#endregion
|
|
127
|
+
//#region src/hooks/layout-store.d.ts
|
|
128
|
+
type LayoutState = {
|
|
129
|
+
closableTabs: boolean;
|
|
130
|
+
dispatch: (action: Action) => void;
|
|
131
|
+
draggableTabs: boolean;
|
|
132
|
+
draggableTabsets: boolean;
|
|
133
|
+
editable: boolean;
|
|
134
|
+
floatable: boolean;
|
|
135
|
+
keepMounted: boolean;
|
|
136
|
+
maximizable: boolean;
|
|
137
|
+
maximizedTabsetId: string | undefined;
|
|
138
|
+
renamableTabs: boolean;
|
|
139
|
+
renderTab: (tab: TabNode) => ReactNode;
|
|
140
|
+
renderTabLabel: ((tab: TabNode) => ReactNode) | undefined;
|
|
141
|
+
renderTabsetToolbar: ((tabset: TabsetNode) => ReactNode) | undefined;
|
|
142
|
+
resizableSplits: boolean;
|
|
143
|
+
snap: SnapConfig | null;
|
|
144
|
+
splitDock: boolean;
|
|
145
|
+
tabLocation: "bottom" | "top";
|
|
146
|
+
tabsetMinSize: number;
|
|
147
|
+
tabStripEnabled: boolean;
|
|
148
|
+
};
|
|
149
|
+
declare const useLayout: <T>(selector: (state: LayoutState) => T) => T;
|
|
150
|
+
//#endregion
|
|
114
151
|
//#region src/components/layout-root.d.ts
|
|
115
152
|
type LayoutRootProps = Omit<ComponentProps<"div">, "children"> & {
|
|
116
153
|
children: ReactNode;
|
|
@@ -128,6 +165,8 @@ type LayoutRootProps = Omit<ComponentProps<"div">, "children"> & {
|
|
|
128
165
|
renderTabLabel?: (tab: TabNode) => ReactNode;
|
|
129
166
|
renderTabsetToolbar?: (tabset: TabsetNode) => ReactNode;
|
|
130
167
|
resizableSplits?: boolean;
|
|
168
|
+
/** When false, the tree itself is frozen: no dragging, splitting or floating. Tabs stay closable and renamable. */
|
|
169
|
+
restructurable?: boolean;
|
|
131
170
|
rootRef?: Ref<HTMLDivElement>;
|
|
132
171
|
snap?: SnapConfig;
|
|
133
172
|
};
|
|
@@ -145,9 +184,9 @@ type TabsetViewProps = {
|
|
|
145
184
|
//#endregion
|
|
146
185
|
//#region src/components/layout.d.ts
|
|
147
186
|
declare const Layout: {
|
|
148
|
-
readonly DragLayer: (
|
|
149
|
-
readonly FloatLayer: ({ children, floats
|
|
150
|
-
readonly Root: ({ children, closableTabs, dispatch, draggableTabs, draggableTabsets, editable, floatable, keepMounted, maximizable, model, renamableTabs, renderTab, renderTabLabel, renderTabsetToolbar, resizableSplits, rootRef, snap, style, ...props }: LayoutRootProps) => import("react").ReactNode;
|
|
187
|
+
readonly DragLayer: (props: DragProviderProps) => import("react").ReactNode;
|
|
188
|
+
readonly FloatLayer: ({ children, floats }: FloatLayerProps) => import("react").ReactNode;
|
|
189
|
+
readonly Root: ({ children, closableTabs, dispatch, draggableTabs, draggableTabsets, editable, floatable, keepMounted, maximizable, model, renamableTabs, renderTab, renderTabLabel, renderTabsetToolbar, resizableSplits, restructurable, rootRef, snap, style, ...props }: LayoutRootProps) => import("react").ReactNode;
|
|
151
190
|
readonly Rows: ({ node, renderTabset }: RowViewProps) => import("react").ReactNode;
|
|
152
191
|
readonly Tabset: ({ node }: TabsetViewProps) => import("react").ReactNode;
|
|
153
192
|
};
|
|
@@ -256,30 +295,6 @@ type TabContextValue = {
|
|
|
256
295
|
};
|
|
257
296
|
declare const useTab: () => TabContextValue;
|
|
258
297
|
//#endregion
|
|
259
|
-
//#region src/hooks/layout-store.d.ts
|
|
260
|
-
type LayoutState = {
|
|
261
|
-
closableTabs: boolean;
|
|
262
|
-
dispatch: (action: Action) => void;
|
|
263
|
-
draggableTabs: boolean;
|
|
264
|
-
draggableTabsets: boolean;
|
|
265
|
-
editable: boolean;
|
|
266
|
-
floatable: boolean;
|
|
267
|
-
keepMounted: boolean;
|
|
268
|
-
maximizable: boolean;
|
|
269
|
-
maximizedTabsetId: string | undefined;
|
|
270
|
-
renamableTabs: boolean;
|
|
271
|
-
renderTab: (tab: TabNode) => ReactNode;
|
|
272
|
-
renderTabLabel: ((tab: TabNode) => ReactNode) | undefined;
|
|
273
|
-
renderTabsetToolbar: ((tabset: TabsetNode) => ReactNode) | undefined;
|
|
274
|
-
resizableSplits: boolean;
|
|
275
|
-
snap: SnapConfig | null;
|
|
276
|
-
splitDock: boolean;
|
|
277
|
-
tabLocation: "bottom" | "top";
|
|
278
|
-
tabsetMinSize: number;
|
|
279
|
-
tabStripEnabled: boolean;
|
|
280
|
-
};
|
|
281
|
-
declare const useLayout: <T>(selector: (state: LayoutState) => T) => T;
|
|
282
|
-
//#endregion
|
|
283
298
|
//#region src/hooks/responsive.d.ts
|
|
284
299
|
type Breakpoint = {
|
|
285
300
|
compact?: boolean;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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/float-layer.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/
|
|
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/float-layer.tsx","../src/hooks/layout-store.ts","../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/responsive.ts","../src/hooks/store.ts"],"mappings":";;;;;;KAMK;EACH,UAAU;EACV,aAAa;EACb,UAAU,aAAa;;cAGnB,4BAA2B;cAa3B,qBAAqB;KAkCtB;EACH;EACA;EACA,SAAS;;KAGN;EACH;EAEA,cAAc;EACd,OAAO,OAAO;;cAGV,iBACJ,QAAQ,sBACR,cAAc,wBACb;;;KCjDE;EAA0B;EAAqB;EAAa,UAAU;;KAmBtE,eAAe;EAAgB,MAAM;;KAIrC;EACH,SACE,KAAK,SACL;IAAU;IAAgB,WAAW;IAAc;;EAErD;EACA;EACA,WAAW;EACX,WAAW,QAAQ;EAEnB,YAAY;EAEZ,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB;EACA,YAAY,eAAe;EAE3B;EACA,YAAY,kBAAkB;EAC9B;;KAGG;EACH;EACA,aAAa,eAAe;EAC5B,eAAe;EACf;EACA;EAEA;EACA,WAAW,KAAK,YAAY;EAE5B;EACA;EACA;EACA,QAAQ;EACR,YAAY,QAAQ,WAAW;EAC/B,wBAAwB;EACxB,2BAA2B;EAC3B,iBAAiB,OAAO,SAAS,SAAS;EAC1C,UAAU;EACV;EACA,kBAAkB,KAAK,YAAY;EACnC,uBAAuB,QAAQ,eAAe;EAE9C;EACA;IAAe;IAAkB,cAAc;;EAE/C,OAAO;;cAGH,+BAAa,0BAA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