@kodiak-finance/orderly-layout-split 2.9.2-alpha.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.mts +506 -0
- package/dist/index.d.ts +506 -0
- package/dist/index.js +3385 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3326 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
import React, { PropsWithChildren, FC } from 'react';
|
|
2
|
+
import { PanelRegistry, LayoutRendererProps, LayoutStrategy } from '@kodiak-finance/orderly-layout-core';
|
|
3
|
+
import { OrderlySDK } from '@kodiak-finance/orderly-ui';
|
|
4
|
+
import { DesktopLayoutProps } from '@kodiak-finance/orderly-trading-next';
|
|
5
|
+
export { DesktopLayoutProps } from '@kodiak-finance/orderly-trading-next';
|
|
6
|
+
import Split, { SplitProps } from '@uiw/react-split';
|
|
7
|
+
|
|
8
|
+
/** Breakpoint keys for responsive split layout (viewport-based). */
|
|
9
|
+
type SplitLayoutBreakpointKey = "lg" | "md" | "sm" | "xs";
|
|
10
|
+
/**
|
|
11
|
+
* Constraints shared by panel and split-child nodes (size per child).
|
|
12
|
+
* minSize/maxSize use "%" format, e.g. "20%", "80%".
|
|
13
|
+
*/
|
|
14
|
+
interface SplitLayoutChildConstraints {
|
|
15
|
+
/** Default size, e.g. "40%", "auto" */
|
|
16
|
+
size?: string;
|
|
17
|
+
/** Minimum size in "%" format, e.g. "20%" */
|
|
18
|
+
minSize?: string;
|
|
19
|
+
/** Maximum size in "%" format, e.g. "80%" */
|
|
20
|
+
maxSize?: string;
|
|
21
|
+
/** When true, panel cannot be resized (maps to ResizablePanel disabled) */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** When true, panel can be collapsed/expanded by user */
|
|
24
|
+
collapsible?: boolean;
|
|
25
|
+
/** When true, panel is initially collapsed */
|
|
26
|
+
defaultCollapsed?: boolean;
|
|
27
|
+
/** Panel title displayed in collapsible header */
|
|
28
|
+
title?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Split layout node: single panel, split container, or sort container.
|
|
32
|
+
* Panel identifier is kept as `id` with no conversion.
|
|
33
|
+
*/
|
|
34
|
+
type SplitLayoutNode$1 = ({
|
|
35
|
+
type: "panel";
|
|
36
|
+
/** Panel ID */
|
|
37
|
+
id: string;
|
|
38
|
+
/** Optional class name applied to the outer panel wrapper. */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Optional inline style applied to the outer panel wrapper. */
|
|
41
|
+
style?: React.CSSProperties;
|
|
42
|
+
} & SplitLayoutChildConstraints) | ({
|
|
43
|
+
type: "split";
|
|
44
|
+
orientation: "horizontal" | "vertical";
|
|
45
|
+
/** Children; each has size/minSize/maxSize/disabled. */
|
|
46
|
+
children: SplitLayoutNode$1[];
|
|
47
|
+
/** Size of this split when used as a child (e.g. "30%", "auto"). Used by parent SplitLayout for ResizablePanel. */
|
|
48
|
+
size?: string;
|
|
49
|
+
/** Optional class name applied to the ResizablePanelGroup wrapper. */
|
|
50
|
+
className?: string;
|
|
51
|
+
/** Optional inline style applied to the ResizablePanelGroup wrapper. */
|
|
52
|
+
style?: React.CSSProperties;
|
|
53
|
+
} & Partial<SplitLayoutChildConstraints>) | ({
|
|
54
|
+
type: "sort";
|
|
55
|
+
/** Layout orientation for the sortable list (vertical = list, horizontal = row). */
|
|
56
|
+
orientation: "horizontal" | "vertical";
|
|
57
|
+
/** Sortable panel children; order can be changed via drag-and-drop. */
|
|
58
|
+
children: SplitLayoutNode$1[];
|
|
59
|
+
/** Size of this sort when used as a child (e.g. "30%", "auto"). Used by parent SplitLayout for ResizablePanel. */
|
|
60
|
+
size?: string;
|
|
61
|
+
/** Optional class name applied to the sort container wrapper. */
|
|
62
|
+
className?: string;
|
|
63
|
+
/** Optional inline style applied to the sort container wrapper. */
|
|
64
|
+
style?: React.CSSProperties;
|
|
65
|
+
} & Partial<SplitLayoutChildConstraints>);
|
|
66
|
+
/** Breakpoint width map (min width for each key). */
|
|
67
|
+
interface SplitLayoutBreakpoints {
|
|
68
|
+
lg: number;
|
|
69
|
+
md: number;
|
|
70
|
+
sm: number;
|
|
71
|
+
xs: number;
|
|
72
|
+
}
|
|
73
|
+
/** Plugin classNames applied to panel group, panel, and handle. */
|
|
74
|
+
type SplitLayoutClassNames = {
|
|
75
|
+
panelGroup?: string;
|
|
76
|
+
panel?: string;
|
|
77
|
+
handle?: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Split layout model for backward compatibility.
|
|
81
|
+
* In the fixed layout approach, this is less relevant but kept for plugin API compatibility.
|
|
82
|
+
*/
|
|
83
|
+
interface SplitLayoutModel {
|
|
84
|
+
layouts: {
|
|
85
|
+
lg: SplitLayoutNode$1;
|
|
86
|
+
md: SplitLayoutNode$1;
|
|
87
|
+
sm: SplitLayoutNode$1;
|
|
88
|
+
xs: SplitLayoutNode$1;
|
|
89
|
+
};
|
|
90
|
+
breakpoints: SplitLayoutBreakpoints;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Per-panel constraints for minSize, maxSize (both "%" format), and fixed. */
|
|
94
|
+
interface PanelConstraints {
|
|
95
|
+
minSize?: string;
|
|
96
|
+
maxSize?: string;
|
|
97
|
+
/** When true, panel cannot be resized (ResizablePanel disabled) */
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Props for SplitLayout component.
|
|
102
|
+
* Uses Resizable (react-resizable-panels); no dependency on @uiw/react-split.
|
|
103
|
+
*/
|
|
104
|
+
interface SplitLayoutProps extends PropsWithChildren {
|
|
105
|
+
/** Layout orientation: horizontal or vertical */
|
|
106
|
+
orientation: "horizontal" | "vertical";
|
|
107
|
+
/** Optional initial sizes per panel (e.g. ["40%", "60%"], "auto" for equal share, "fixed" for non-resizable content) */
|
|
108
|
+
sizes?: string[];
|
|
109
|
+
/** Optional per-panel constraints (minSize, maxSize in "%", disabled for fixed) */
|
|
110
|
+
panelConstraints?: PanelConstraints[];
|
|
111
|
+
/** Callback when panel sizes change (full array of percentage strings) */
|
|
112
|
+
onSizeChange?: (sizes: string[]) => void;
|
|
113
|
+
/** Optional class name for the group container */
|
|
114
|
+
className?: string;
|
|
115
|
+
/** Optional inline style for the group container */
|
|
116
|
+
style?: React.CSSProperties;
|
|
117
|
+
/** Optional classNames for panel group, panel, and handle (from plugin options). */
|
|
118
|
+
classNames?: SplitLayoutClassNames;
|
|
119
|
+
/** Optional gap between panels in px (total; handle margin = gap/2 each side). Undefined preserves default 3px per side. */
|
|
120
|
+
gap?: number;
|
|
121
|
+
}
|
|
122
|
+
declare function SplitLayout({ orientation, sizes, panelConstraints, onSizeChange, children, className, style, classNames, gap, }: SplitLayoutProps): React.ReactElement;
|
|
123
|
+
declare namespace SplitLayout {
|
|
124
|
+
var displayName: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Returns a stable sortable id for a child node (panel uses id, others use path).
|
|
129
|
+
* Never returns empty string to avoid React duplicate key warnings when id is missing.
|
|
130
|
+
*/
|
|
131
|
+
declare function getSortableIdForChild(child: SplitLayoutNode$1, path: number[], index: number): string;
|
|
132
|
+
/**
|
|
133
|
+
* Reorders children at the given path and returns the updated root.
|
|
134
|
+
* Used when user drags to reorder within a sort container.
|
|
135
|
+
*/
|
|
136
|
+
declare function updateOrderAtPath(node: SplitLayoutNode$1, path: number[], newOrder: SplitLayoutNode$1[]): SplitLayoutNode$1;
|
|
137
|
+
/**
|
|
138
|
+
* Creates default split layout for given panel IDs (strategy.defaultLayout).
|
|
139
|
+
* This is a fallback when getInitialLayout is not provided.
|
|
140
|
+
* Same simple horizontal tree for all breakpoints.
|
|
141
|
+
*
|
|
142
|
+
* @param panelIds - Panel IDs to include
|
|
143
|
+
* @returns Split layout model with layouts and breakpoints
|
|
144
|
+
*/
|
|
145
|
+
declare function createDefaultSplitLayout(panelIds: string[]): SplitLayoutModel;
|
|
146
|
+
/**
|
|
147
|
+
* Serializes split layout model to JSON (layouts + breakpoints only).
|
|
148
|
+
*/
|
|
149
|
+
declare function serializeSplitLayout(layout: SplitLayoutModel): string;
|
|
150
|
+
/**
|
|
151
|
+
* Deserializes JSON to split layout model; validates layouts and breakpoints.
|
|
152
|
+
* No conversion: panel nodes keep `id` as stored.
|
|
153
|
+
*/
|
|
154
|
+
declare function deserializeSplitLayout(json: string): SplitLayoutModel;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Context for split layout configuration (panels, layout, breakpoint, callbacks).
|
|
158
|
+
* Provides configuration to SplitNodeRenderer without prop drilling.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
interface SplitLayoutConfigValue {
|
|
162
|
+
/** Registry of panel components (id -> React.ReactNode). */
|
|
163
|
+
panels: PanelRegistry;
|
|
164
|
+
/** Current layout model with breakpoint roots. */
|
|
165
|
+
layout: SplitLayoutModel;
|
|
166
|
+
/** Current breakpoint key (e.g. "md", "sm"). */
|
|
167
|
+
breakpoint: keyof SplitLayoutModel["layouts"];
|
|
168
|
+
/** Callback when layout model changes. */
|
|
169
|
+
onLayoutChange: (layout: SplitLayoutModel) => void;
|
|
170
|
+
/** Callback when panel sizes change at a path. */
|
|
171
|
+
onSizeChange: (path: number[], sizes: string[]) => void;
|
|
172
|
+
/** Callback when panel sizes should be persisted (e.g., on resize end). */
|
|
173
|
+
onSizePersist?: (path: number[], sizes: string[]) => void;
|
|
174
|
+
/** Optional classNames for panel group, panel, and handle (from plugin options). */
|
|
175
|
+
classNames?: SplitLayoutClassNames;
|
|
176
|
+
/** Optional gap between panels in px (from plugin options). */
|
|
177
|
+
gap?: number;
|
|
178
|
+
/** Set of collapsed panel IDs. */
|
|
179
|
+
collapsedPanels: Set<string>;
|
|
180
|
+
/** Toggle collapse state for a panel. */
|
|
181
|
+
togglePanelCollapse: (panelId: string) => void;
|
|
182
|
+
/** Check if a panel is collapsed. */
|
|
183
|
+
isPanelCollapsed: (panelId: string) => boolean;
|
|
184
|
+
/** Map of panel IDs that are collapsible. */
|
|
185
|
+
collapsiblePanels: Map<string, boolean>;
|
|
186
|
+
/** Check if a panel is collapsible. */
|
|
187
|
+
isPanelCollapsible: (panelId: string) => boolean;
|
|
188
|
+
}
|
|
189
|
+
interface SplitLayoutConfigProviderProps {
|
|
190
|
+
/** Registry of panel components. */
|
|
191
|
+
panels: PanelRegistry;
|
|
192
|
+
/** Current layout model. */
|
|
193
|
+
layout: SplitLayoutModel;
|
|
194
|
+
/** Current breakpoint key. */
|
|
195
|
+
breakpoint: keyof SplitLayoutModel["layouts"];
|
|
196
|
+
/** Callback when layout model changes. */
|
|
197
|
+
onLayoutChange: (layout: SplitLayoutModel) => void;
|
|
198
|
+
/** Callback when panel sizes change. */
|
|
199
|
+
onSizeChange: (path: number[], sizes: string[]) => void;
|
|
200
|
+
/** Callback when panel sizes should be persisted. */
|
|
201
|
+
onSizePersist?: (path: number[], sizes: string[]) => void;
|
|
202
|
+
/** Optional classNames for panel group, panel, and handle. */
|
|
203
|
+
classNames?: SplitLayoutClassNames;
|
|
204
|
+
/** Optional gap between panels in px. */
|
|
205
|
+
gap?: number;
|
|
206
|
+
/** Set of collapsed panel IDs. */
|
|
207
|
+
collapsedPanels: Set<string>;
|
|
208
|
+
/** Toggle collapse state for a panel. */
|
|
209
|
+
togglePanelCollapse: (panelId: string) => void;
|
|
210
|
+
/** Check if a panel is collapsed. */
|
|
211
|
+
isPanelCollapsed: (panelId: string) => boolean;
|
|
212
|
+
/** Map of panel IDs that are collapsible. */
|
|
213
|
+
collapsiblePanels: Map<string, boolean>;
|
|
214
|
+
/** Check if a panel is collapsible. */
|
|
215
|
+
isPanelCollapsible: (panelId: string) => boolean;
|
|
216
|
+
children: React.ReactNode;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Provides layout configuration to SplitNodeRenderer.
|
|
220
|
+
* Use at the root of the split layout renderer.
|
|
221
|
+
*/
|
|
222
|
+
declare function SplitLayoutConfigProvider({ panels, layout, breakpoint, onLayoutChange, onSizeChange, onSizePersist, classNames, gap, collapsedPanels, togglePanelCollapse, isPanelCollapsed, collapsiblePanels, isPanelCollapsible, children, }: SplitLayoutConfigProviderProps): React.ReactElement;
|
|
223
|
+
/**
|
|
224
|
+
* Hook to read layout config from context.
|
|
225
|
+
* Throws if used outside SplitLayoutConfigProvider.
|
|
226
|
+
*/
|
|
227
|
+
declare function useSplitLayoutConfig(): SplitLayoutConfigValue;
|
|
228
|
+
|
|
229
|
+
/** Plugin registration options */
|
|
230
|
+
interface LayoutSplitPluginOptions {
|
|
231
|
+
gap?: number;
|
|
232
|
+
classNames?: {
|
|
233
|
+
panelGroup?: string;
|
|
234
|
+
panel?: string;
|
|
235
|
+
handle?: string;
|
|
236
|
+
container?: string;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Registers the split trading layout plugin.
|
|
241
|
+
*
|
|
242
|
+
* Intercepts `Trading.Layout.Desktop` and injects `layoutStrategy` into the
|
|
243
|
+
* original DesktopLayout component — exactly like GridDesktopInjector.
|
|
244
|
+
* DesktopLayout calls LayoutHost, which calls splitTradingStrategy.Renderer
|
|
245
|
+
* (SplitTradingLayout) with the PanelRegistry built by trading-next.
|
|
246
|
+
*/
|
|
247
|
+
declare function registerLayoutSplitPlugin(options?: LayoutSplitPluginOptions): (SDK: OrderlySDK) => void;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Split layout chrome: DnD for order-entry sortable, Flex wrapper.
|
|
251
|
+
* Wraps the minimal desktop layout (Trading’s DesktopLayout); strategy is injected by the plugin.
|
|
252
|
+
*/
|
|
253
|
+
|
|
254
|
+
interface SplitTradingDesktopChromeProps extends DesktopLayoutProps {
|
|
255
|
+
/** The minimal desktop layout (panels + LayoutHost) to wrap */
|
|
256
|
+
children: React.ReactNode;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Wraps Trading’s minimal desktop layout with split-specific chrome:
|
|
260
|
+
* DnD (order-entry sortable), Flex structure. Markets rendered by LayoutHost from rule tree.
|
|
261
|
+
*/
|
|
262
|
+
declare function SplitTradingDesktopChrome(props: SplitTradingDesktopChromeProps): React.ReactElement;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* SplitInlinedLayout - Legacy component kept for backward compatibility.
|
|
266
|
+
*
|
|
267
|
+
* The split plugin no longer uses this component (plugin.tsx now renders
|
|
268
|
+
* SplitTradingLayout directly). Kept exported so external consumers are not broken.
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
/** @deprecated Use SplitTradingLayout directly. */
|
|
272
|
+
declare function SplitInlinedLayout({ Original, props, }: {
|
|
273
|
+
Original: React.ComponentType<DesktopLayoutProps>;
|
|
274
|
+
props: DesktopLayoutProps;
|
|
275
|
+
}): React.ReactElement;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* SplitTradingLayout - LayoutStrategy Renderer for the split trading desktop layout.
|
|
279
|
+
*
|
|
280
|
+
* Implements LayoutRendererProps<Record<string, unknown>> so it can be used as
|
|
281
|
+
* the Renderer in splitTradingStrategy. Receives the PanelRegistry from LayoutHost
|
|
282
|
+
* (populated by trading-next's createTradingPanelRegistry) and all layout state
|
|
283
|
+
* comes from useSplitLayout internally.
|
|
284
|
+
*
|
|
285
|
+
* This mirrors the JSX structure of trading.ui.desktop.tsx but all panel content
|
|
286
|
+
* is sourced from the panels registry - no direct widget imports.
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
/** @deprecated Use PanelRegistry from @kodiak-finance/orderly-layout-core instead. */
|
|
290
|
+
type SplitLayoutPanelRegistryEntry = {
|
|
291
|
+
node: React.ReactNode;
|
|
292
|
+
props?: Record<string, unknown>;
|
|
293
|
+
};
|
|
294
|
+
/** @deprecated Use PanelRegistry from @kodiak-finance/orderly-layout-core instead. */
|
|
295
|
+
type SplitLayoutPanelRegistry = PanelRegistry;
|
|
296
|
+
/**
|
|
297
|
+
* SplitTradingLayout implements LayoutRendererProps so it works as the Renderer
|
|
298
|
+
* in splitTradingStrategy. The panels registry is built by trading-next's
|
|
299
|
+
* DesktopLayout and passed through LayoutHost.
|
|
300
|
+
*/
|
|
301
|
+
type SplitTradingLayoutProps = LayoutRendererProps<Record<string, unknown>>;
|
|
302
|
+
/**
|
|
303
|
+
* Full trading desktop layout that implements LayoutRendererProps.
|
|
304
|
+
*
|
|
305
|
+
* Receives the PanelRegistry from LayoutHost (populated by trading-next's
|
|
306
|
+
* createTradingPanelRegistry). All layout state is managed by useSplitLayout
|
|
307
|
+
* and local hooks — no dependency on DesktopLayoutProps.
|
|
308
|
+
*/
|
|
309
|
+
declare function SplitTradingLayout(props: SplitTradingLayoutProps): React.ReactElement;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Split trading layout strategy.
|
|
313
|
+
*
|
|
314
|
+
* Implements the full trading desktop layout (chart, orderbook, order entry,
|
|
315
|
+
* data list, markets) with resizable split panels and drag-to-reorder order
|
|
316
|
+
* entry sub-panels. All state is managed internally by the Renderer.
|
|
317
|
+
*
|
|
318
|
+
* Pass this as `layoutStrategy` to DesktopLayout (via the interceptor in
|
|
319
|
+
* registerLayoutSplitPlugin) so LayoutHost calls SplitTradingLayout as the
|
|
320
|
+
* Renderer with the PanelRegistry built by trading-next.
|
|
321
|
+
*/
|
|
322
|
+
declare const splitTradingStrategy: LayoutStrategy<Record<string, unknown>>;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* React Context for trading desktop props passed from TradingWidget via SplitTradingDesktopChrome.
|
|
326
|
+
* Any component under SplitTradingDesktopChrome (e.g. SplitNodeRenderer, SortNodeRenderer, panel content)
|
|
327
|
+
* can use useSplitTradingDesktopContext() to access TradingState and layout-related props without prop drilling.
|
|
328
|
+
*/
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Hook to read trading desktop props from context.
|
|
332
|
+
* Returns null when used outside SplitTradingDesktopChrome (e.g. in tests or non-split layout).
|
|
333
|
+
* @returns DesktopLayoutProps or null
|
|
334
|
+
*/
|
|
335
|
+
declare function useSplitTradingDesktopContext(): DesktopLayoutProps | null;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* TradingSplitLayout - @uiw/react-split wrapper for trading layout.
|
|
339
|
+
*
|
|
340
|
+
* Ported from packages/trading-next/src/components/desktop/layout/splitLayout/.
|
|
341
|
+
* Keeps all layout logic inside layout-split; trading-next only provides panels.
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Thin forwardRef wrapper around @uiw/react-split with a styled SplitLineBar.
|
|
346
|
+
* API matches the internal splitLayout used in trading.ui.desktop.tsx.
|
|
347
|
+
*/
|
|
348
|
+
declare const TradingSplitLayout: React.ForwardRefExoticComponent<SplitProps & {
|
|
349
|
+
children?: React.ReactNode | undefined;
|
|
350
|
+
} & {
|
|
351
|
+
/** Called with the pixel width/height string of the first panel on drag end. */
|
|
352
|
+
onSizeChange?: (size: string) => void;
|
|
353
|
+
} & React.RefAttributes<Split>>;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* TradingSortablePanel - Drag-and-drop sortable panel for order-entry column.
|
|
357
|
+
*
|
|
358
|
+
* Ported from packages/trading-next/src/components/desktop/layout/sortablePanel.tsx.
|
|
359
|
+
* Uses @dnd-kit/sortable (already a layout-split dep). Renders a drag-indicator
|
|
360
|
+
* button when showIndicator is true and a placeholder while the item is being dragged.
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
type TradingSortablePanelProps = {
|
|
364
|
+
/** Unique DnD id for this panel (matches SortableContext items array). */
|
|
365
|
+
id: string;
|
|
366
|
+
/** Additional class name for the outer box. */
|
|
367
|
+
className?: string;
|
|
368
|
+
/**
|
|
369
|
+
* When true, shows the vertical drag-handle indicator button.
|
|
370
|
+
* Typically set when the user can trade (canTrade && !isFirstTimeDeposit).
|
|
371
|
+
*/
|
|
372
|
+
showIndicator: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* When true, renders the drag-overlay variant (slightly scaled down).
|
|
375
|
+
* Pass this when rendering inside DragOverlay.
|
|
376
|
+
*/
|
|
377
|
+
dragOverlay?: boolean;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Sortable panel that wraps order-entry widgets (margin, assets, order form).
|
|
381
|
+
* While actively dragging, renders a fixed-size placeholder with a hatched border
|
|
382
|
+
* so the layout doesn't collapse; the real content is rendered in DragOverlay.
|
|
383
|
+
*/
|
|
384
|
+
declare const TradingSortablePanel: FC<PropsWithChildren<TradingSortablePanelProps>>;
|
|
385
|
+
|
|
386
|
+
/** @deprecated Use BREAKPOINT_KEYS */
|
|
387
|
+
declare const SPLIT_BREAKPOINT_ORDER: SplitLayoutBreakpointKey[];
|
|
388
|
+
/** @deprecated Use BREAKPOINT_VALUES */
|
|
389
|
+
declare const DEFAULT_SPLIT_BREAKPOINTS: SplitLayoutBreakpoints;
|
|
390
|
+
/** Viewport-based breakpoint keys for responsive split layout. */
|
|
391
|
+
type ViewportBreakpointKey = SplitLayoutBreakpointKey;
|
|
392
|
+
/** Viewport breakpoint values (max width in px). */
|
|
393
|
+
declare const VIEWPORT_BREAKPOINTS: SplitLayoutBreakpoints;
|
|
394
|
+
/** @deprecated Use BREAKPOINT_KEYS */
|
|
395
|
+
declare const VIEWPORT_BREAKPOINT_ORDER: SplitLayoutBreakpointKey[];
|
|
396
|
+
|
|
397
|
+
interface UseViewportBreakpointOptions {
|
|
398
|
+
/** Breakpoint map; defaults to VIEWPORT_BREAKPOINTS. */
|
|
399
|
+
breakpoints?: typeof VIEWPORT_BREAKPOINTS;
|
|
400
|
+
/** Initial width when ref not yet mounted. */
|
|
401
|
+
fallbackWidth?: number;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Observes viewport width and returns current breakpoint key.
|
|
405
|
+
* Uses ResizeObserver on document.documentElement; before mount uses fallbackWidth.
|
|
406
|
+
*
|
|
407
|
+
* @param options - Optional breakpoints and fallbackWidth
|
|
408
|
+
* @returns Current breakpoint key (lg | md | sm | xs)
|
|
409
|
+
*/
|
|
410
|
+
declare function useViewportBreakpoint(options?: UseViewportBreakpointOptions): ViewportBreakpointKey;
|
|
411
|
+
|
|
412
|
+
declare const ORDER_ENTRY_MIN_WIDTH = 280;
|
|
413
|
+
declare const ORDER_ENTRY_MAX_WIDTH = 360;
|
|
414
|
+
declare const ORDERBOOK_MIN_WIDTH = 280;
|
|
415
|
+
declare const ORDERBOOK_MAX_WIDTH = 732;
|
|
416
|
+
declare const ORDERBOOK_MIN_HEIGHT = 464;
|
|
417
|
+
declare const ORDERBOOK_MAX_HEIGHT = 728;
|
|
418
|
+
declare const TRADINGVIEW_MIN_HEIGHT = 320;
|
|
419
|
+
declare const TRADINGVIEW_MIN_WIDTH = 540;
|
|
420
|
+
declare const DATA_LIST_MAX_HEIGHT = 800;
|
|
421
|
+
declare const DATA_LIST_INITIAL_HEIGHT = 350;
|
|
422
|
+
declare const SPACE = 8;
|
|
423
|
+
declare const SYMBOL_INFO_BAR_HEIGHT = 54;
|
|
424
|
+
type MarketLayoutPosition = "left" | "top" | "bottom" | "hide";
|
|
425
|
+
type PanelSize = "small" | "middle" | "large";
|
|
426
|
+
interface UseSplitLayoutOptions {
|
|
427
|
+
symbol?: string;
|
|
428
|
+
/** Initial layout side (order entry left/right) */
|
|
429
|
+
initialLayout?: "left" | "right";
|
|
430
|
+
/** Initial market layout position */
|
|
431
|
+
initialMarketLayout?: MarketLayoutPosition;
|
|
432
|
+
/** Whether user can trade */
|
|
433
|
+
canTrade?: boolean;
|
|
434
|
+
/** First time depositor */
|
|
435
|
+
isFirstTimeDeposit?: boolean;
|
|
436
|
+
/** Disable features */
|
|
437
|
+
disableFeatures?: Record<string, boolean>;
|
|
438
|
+
/** Navigate callback */
|
|
439
|
+
onRouteChange?: (route: {
|
|
440
|
+
href: string;
|
|
441
|
+
name: string;
|
|
442
|
+
}) => void;
|
|
443
|
+
}
|
|
444
|
+
interface UseSplitLayoutReturn {
|
|
445
|
+
layout: "left" | "right";
|
|
446
|
+
setLayout: (layout: "left" | "right") => void;
|
|
447
|
+
marketLayout: MarketLayoutPosition;
|
|
448
|
+
setMarketLayout: (layout: MarketLayoutPosition) => void;
|
|
449
|
+
breakpoint: SplitLayoutBreakpointKey;
|
|
450
|
+
max2XL: boolean;
|
|
451
|
+
min3XL: boolean;
|
|
452
|
+
max4XL: boolean;
|
|
453
|
+
horizontalDraggable: boolean;
|
|
454
|
+
panelSize: PanelSize;
|
|
455
|
+
setPanelSize: (size: PanelSize) => void;
|
|
456
|
+
marketsWidth: number;
|
|
457
|
+
mainSplitSize: string;
|
|
458
|
+
setMainSplitSize: (size: string) => void;
|
|
459
|
+
orderBookSplitSize: string;
|
|
460
|
+
setOrderbookSplitSize: (size: string) => void;
|
|
461
|
+
dataListSplitSize: string;
|
|
462
|
+
setDataListSplitSize: (size: string) => void;
|
|
463
|
+
dataListSplitHeightSM: string;
|
|
464
|
+
setDataListSplitHeightSM: (size: string) => void;
|
|
465
|
+
orderBookSplitHeightSM: string;
|
|
466
|
+
setOrderbookSplitHeightSM: (size: string) => void;
|
|
467
|
+
extraHeight: number;
|
|
468
|
+
setExtraHeight: (height: number) => void;
|
|
469
|
+
dataListHeight: number;
|
|
470
|
+
tradingviewMaxHeight: number;
|
|
471
|
+
layoutTree: SplitLayoutNode;
|
|
472
|
+
symbolInfoBarHeight: number;
|
|
473
|
+
space: number;
|
|
474
|
+
orderbookMinWidth: number;
|
|
475
|
+
orderbookMaxWidth: number;
|
|
476
|
+
orderbookMinHeight: number;
|
|
477
|
+
orderbookMaxHeight: number;
|
|
478
|
+
tradingviewMinHeight: number;
|
|
479
|
+
orderEntryMinWidth: number;
|
|
480
|
+
orderEntryMaxWidth: number;
|
|
481
|
+
}
|
|
482
|
+
/** Simplified split layout node for backward compat */
|
|
483
|
+
type SplitLayoutNode = {
|
|
484
|
+
type: "panel";
|
|
485
|
+
id: string;
|
|
486
|
+
size?: string;
|
|
487
|
+
minSize?: string;
|
|
488
|
+
maxSize?: string;
|
|
489
|
+
disabled?: boolean;
|
|
490
|
+
} | {
|
|
491
|
+
type: "split";
|
|
492
|
+
orientation: "horizontal" | "vertical";
|
|
493
|
+
children: SplitLayoutNode[];
|
|
494
|
+
size?: string;
|
|
495
|
+
} | {
|
|
496
|
+
type: "sort";
|
|
497
|
+
orientation: "horizontal" | "vertical";
|
|
498
|
+
children: SplitLayoutNode[];
|
|
499
|
+
size?: string;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* Hook for computing split layout state and sizes
|
|
503
|
+
*/
|
|
504
|
+
declare function useSplitLayout(options?: UseSplitLayoutOptions): UseSplitLayoutReturn;
|
|
505
|
+
|
|
506
|
+
export { DATA_LIST_INITIAL_HEIGHT, DATA_LIST_MAX_HEIGHT, DEFAULT_SPLIT_BREAKPOINTS, type LayoutSplitPluginOptions, type MarketLayoutPosition, ORDERBOOK_MAX_HEIGHT, ORDERBOOK_MAX_WIDTH, ORDERBOOK_MIN_HEIGHT, ORDERBOOK_MIN_WIDTH, ORDER_ENTRY_MAX_WIDTH, ORDER_ENTRY_MIN_WIDTH, type PanelConstraints, type PanelSize, SPACE, SPLIT_BREAKPOINT_ORDER, SYMBOL_INFO_BAR_HEIGHT, SplitInlinedLayout, SplitLayout, type SplitLayoutBreakpointKey, type SplitLayoutBreakpoints, type SplitLayoutChildConstraints, SplitLayoutConfigProvider, type SplitLayoutConfigProviderProps, type SplitLayoutConfigValue, type SplitLayoutModel, type SplitLayoutNode$1 as SplitLayoutNode, type SplitLayoutPanelRegistry, type SplitLayoutPanelRegistryEntry, type SplitLayoutProps, SplitTradingDesktopChrome, type SplitTradingDesktopChromeProps, SplitTradingLayout, type SplitTradingLayoutProps, TRADINGVIEW_MIN_HEIGHT, TRADINGVIEW_MIN_WIDTH, TradingSortablePanel, type TradingSortablePanelProps, TradingSplitLayout, type UseSplitLayoutOptions, type UseSplitLayoutReturn, VIEWPORT_BREAKPOINTS, VIEWPORT_BREAKPOINT_ORDER, type ViewportBreakpointKey, createDefaultSplitLayout, deserializeSplitLayout, getSortableIdForChild, registerLayoutSplitPlugin, serializeSplitLayout, splitTradingStrategy, updateOrderAtPath, useSplitLayout, useSplitLayoutConfig, useSplitTradingDesktopContext, useViewportBreakpoint };
|