dockview-core 8.3.0 → 8.4.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.
Files changed (33) hide show
  1. package/dist/cjs/api/component.api.d.ts +26 -1
  2. package/dist/cjs/dismissableLayer.d.ts +19 -7
  3. package/dist/cjs/dnd/droptarget.d.ts +11 -0
  4. package/dist/cjs/dnd/ghost.d.ts +3 -0
  5. package/dist/cjs/dnd/pointer/pointerDragController.d.ts +1 -0
  6. package/dist/cjs/dnd/pointer/pointerDragSource.d.ts +1 -0
  7. package/dist/cjs/dnd/pointer/pointerDropTarget.d.ts +3 -0
  8. package/dist/cjs/dnd/pointer/pointerGhost.d.ts +6 -2
  9. package/dist/cjs/dnd/pointer/types.d.ts +5 -0
  10. package/dist/cjs/dockview/components/titlebar/tabGroups.d.ts +12 -3
  11. package/dist/cjs/dockview/components/titlebar/tabReorderController.d.ts +52 -21
  12. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +4 -0
  13. package/dist/cjs/dockview/dndCapabilities.d.ts +3 -4
  14. package/dist/cjs/dockview/dockviewComponent.d.ts +31 -16
  15. package/dist/cjs/dockview/dockviewShell.d.ts +12 -0
  16. package/dist/cjs/dockview/options.d.ts +13 -0
  17. package/dist/cjs/dockview/popoutWindowService.d.ts +8 -2
  18. package/dist/cjs/dom.d.ts +61 -1
  19. package/dist/cjs/gridview/branchNode.d.ts +2 -1
  20. package/dist/cjs/gridview/gridview.d.ts +2 -1
  21. package/dist/cjs/index.d.ts +5 -1
  22. package/dist/cjs/popoutWindow.d.ts +57 -12
  23. package/dist/cjs/resizable.d.ts +12 -0
  24. package/dist/cjs/splitview/splitview.d.ts +3 -1
  25. package/dist/dockview-core.js +880 -390
  26. package/dist/dockview-core.min.js +29 -4
  27. package/dist/dockview-core.min.noStyle.js +2 -2
  28. package/dist/dockview-core.noStyle.js +879 -389
  29. package/dist/package/main.cjs.js +879 -389
  30. package/dist/package/main.cjs.min.js +2 -2
  31. package/dist/package/main.esm.min.mjs +2 -2
  32. package/dist/package/main.esm.mjs +878 -390
  33. package/package.json +1 -1
@@ -5,7 +5,6 @@ import { Node } from './types';
5
5
  import { CompositeDisposable } from '../lifecycle';
6
6
  export declare class BranchNode extends CompositeDisposable implements IView {
7
7
  readonly orientation: Orientation;
8
- readonly proportionalLayout: boolean;
9
8
  readonly styles: ISplitviewStyles | undefined;
10
9
  readonly element: HTMLElement;
11
10
  private readonly splitview;
@@ -55,6 +54,8 @@ export declare class BranchNode extends CompositeDisposable implements IView {
55
54
  set disabled(value: boolean);
56
55
  get margin(): number;
57
56
  set margin(value: number);
57
+ get proportionalLayout(): boolean;
58
+ set proportionalLayout(value: boolean);
58
59
  constructor(orientation: Orientation, proportionalLayout: boolean, styles: ISplitviewStyles | undefined, size: number, orthogonalSize: number, disabled: boolean, margin: number | undefined, childDescriptors?: INodeDescriptor[]);
59
60
  setVisible(_visible: boolean): void;
60
61
  isChildVisible(index: number): boolean;
@@ -94,7 +94,6 @@ export interface MaximizedViewChanged {
94
94
  isMaximized: boolean;
95
95
  }
96
96
  export declare class Gridview implements IDisposable {
97
- readonly proportionalLayout: boolean;
98
97
  readonly styles: ISplitviewStyles | undefined;
99
98
  readonly element: HTMLElement;
100
99
  private _root;
@@ -148,6 +147,8 @@ export declare class Gridview implements IDisposable {
148
147
  getView(location?: number[]): GridNode<IGridView>;
149
148
  private _getViews;
150
149
  private progmaticSelect;
150
+ get proportionalLayout(): boolean;
151
+ set proportionalLayout(value: boolean);
151
152
  constructor(proportionalLayout: boolean, styles: ISplitviewStyles | undefined, orientation: Orientation, locked?: boolean, margin?: number);
152
153
  isViewVisible(location: number[]): boolean;
153
154
  setViewVisible(location: number[], visible: boolean): void;
@@ -7,6 +7,10 @@ export { getPaneData, getPanelData, LocalSelectionTransfer, PaneTransfer, PanelT
7
7
  export { Emitter as DockviewEmitter, Event as DockviewEvent } from './events';
8
8
  export { type IDisposable as DockviewIDisposable, MutableDisposable as DockviewMutableDisposable, CompositeDisposable as DockviewCompositeDisposable, Disposable as DockviewDisposable, } from './lifecycle';
9
9
  export * from './panel/types';
10
+ /** The popout URL guard, so an application can check a `popoutUrl` itself. */
11
+ export { getPopoutUrlError, type PopoutWindowEvent, type PopoutWindowFailure, type PopoutWindowFailureReason, } from './popoutWindow';
12
+ /** Readable through `api.dndCapabilities`. */
13
+ export { type DndCapabilities } from './dockview/dndCapabilities';
10
14
  export * from './splitview/splitview';
11
15
  export { type SplitviewComponentOptions, type PanelViewInitParameters, type SplitviewOptions, type SplitviewFrameworkOptions, PROPERTY_KEYS_SPLITVIEW, } from './splitview/options';
12
16
  export * from './paneview/paneview';
@@ -53,7 +57,7 @@ export { createDockview, createGridview, createPaneview, createSplitview, } from
53
57
  export { registerModules, getRegisteredModules, clearRegisteredModules, defineModule, type DockviewModule, type ServiceCollection, } from './dockview/modules';
54
58
  export { type IKeyboardNavigationHost, type IKeyboardNavigationService, type IAdvancedDnDHost, type IAdvancedDnDService, type IAutoHideEdgeGroupHost, type IAutoHideEdgeGroupService, type IAutoEdgeGroupHost, type IAutoEdgeGroupService, type IContextMenuHost, type IContextMenuService, type IDndCompassHost, type IDndCompassService, type IKeyboardDockingService, type ILayoutHistoryHost, type ILayoutHistoryService, type LayoutHistoryChangeEvent, type LayoutHistoryKind, type IMultiRowTabsHost, type IMultiRowTabsService, type ISmartGuidesHost, type ISmartGuidesService, type SmartGuidesSnapPosition, type SmartGuidesSnapEvent, type SmartGuidesSnapTogetherEvent, type ITabGroupChipsHost, type ITabGroupChipsService, type IPinnedTabsHost, type IPinnedTabsService, type IAdvancedOverflowHost, type IAdvancedOverflowService, type IAdvancedOverflowRenderContext, type AdvancedOverflowRenderParams, type IOverflowRow, } from './dockview/moduleContracts';
55
59
  export { resolveMessages } from './dockview/accessibilityMessages';
56
- export { findRelativeZIndexParent, prefersReducedMotion, resolveOpaqueBackground, } from './dom';
60
+ export { findRelativeZIndexParent, getActiveElement, prefersReducedMotion, resolveOpaqueBackground, } from './dom';
57
61
  export { createDismissableLayer, type DismissableLayerOptions, } from './dismissableLayer';
58
62
  export { type IDragGhostSpec } from './dnd/backend';
59
63
  export { LiveRegionModule } from './dockview/liveRegionService';
@@ -1,25 +1,60 @@
1
1
  import { CspNonceProvider } from './dom';
2
2
  import { CompositeDisposable } from './lifecycle';
3
3
  import { Box } from './types';
4
+ /**
5
+ * A popout window at a lifecycle boundary. `id` is the target name dockview
6
+ * passed to `window.open`; `window` is the live handle.
7
+ */
8
+ export interface PopoutWindowEvent {
9
+ readonly id: string;
10
+ readonly window: Window;
11
+ }
12
+ /**
13
+ * Why a popout window could not be used:
14
+ *
15
+ * - `url-refused`: the URL failed {@link getPopoutUrlError}.
16
+ * - `blocked`: `window.open` returned nothing, the browser's popup blocker
17
+ * being the usual reason.
18
+ * - `unscriptable`: a window opened, but the opener cannot reach its document,
19
+ * so panel DOM cannot be moved into it. Hosts that answer `window.open`
20
+ * themselves can do this.
21
+ * - `closed`: the window went away before it finished loading.
22
+ */
23
+ export type PopoutWindowFailureReason = 'url-refused' | 'blocked' | 'unscriptable' | 'closed';
24
+ export interface PopoutWindowFailure {
25
+ readonly reason: PopoutWindowFailureReason;
26
+ /** The refusal itself, where there was one. */
27
+ readonly error?: Error;
28
+ }
4
29
  export type PopoutWindowOptions = {
5
30
  url: string;
6
- onDidOpen?: (event: {
7
- id: string;
8
- window: Window;
9
- }) => void;
10
- onWillClose?: (event: {
11
- id: string;
12
- window: Window;
13
- }) => void;
31
+ onDidOpen?: (event: PopoutWindowEvent) => void;
32
+ onWillClose?: (event: PopoutWindowEvent) => void;
14
33
  nonce?: CspNonceProvider;
34
+ /** The root node dockview is mounted in, read when the popout loads.
35
+ * When it is a shadow root its stylesheets are copied too, since they are
36
+ * not in `document.styleSheets`. Rules that target the shadow host
37
+ * (`:host`, `::slotted`) match nothing in the popout. */
38
+ styleRoot?: () => Node;
15
39
  } & Box;
16
40
  /**
17
- * Reject popout URLs that aren't same-origin http(s). Blocks `javascript:`,
18
- * `data:`, `blob:`, `vbscript:`, and cross-origin URLs that would otherwise
19
- * execute in a context the browser still associates with the opener via
20
- * `window.opener`.
41
+ * Throwing form of {@link getPopoutUrlError}, for callers with no way to
42
+ * recover from a refused URL.
21
43
  */
22
44
  export declare function assertSameOriginPopoutUrl(url: string): void;
45
+ /**
46
+ * The reason `url` is unusable as a popout target, or `undefined` if it is
47
+ * allowed. Rejects anything that isn't same-origin with the page (scheme and
48
+ * host, so a packaged webview's own scheme such as `tauri://` qualifies), and
49
+ * the `javascript:`, `data:`, `blob:`, `vbscript:` and `file:` schemes that
50
+ * would otherwise execute in a context the browser still associates with the
51
+ * opener via `window.opener`.
52
+ *
53
+ * Callers that can recover from a refusal use this rather than catching, so it
54
+ * can be handled without a rejected promise. `page` is what the URL resolves
55
+ * against, and defaults to this page.
56
+ */
57
+ export declare function getPopoutUrlError(url: string, page?: Pick<Location, 'href' | 'protocol' | 'host'>): Error | undefined;
23
58
  export declare class PopoutWindow extends CompositeDisposable {
24
59
  private readonly target;
25
60
  private readonly className;
@@ -29,10 +64,20 @@ export declare class PopoutWindow extends CompositeDisposable {
29
64
  private readonly _onDidClose;
30
65
  readonly onDidClose: import("./events").Event<void>;
31
66
  private _window;
67
+ private _failure;
32
68
  get window(): Window | null;
69
+ /** Set when {@link open} resolved `null`, saying which way it failed. */
70
+ get failure(): PopoutWindowFailure | undefined;
33
71
  constructor(target: string, className: string, options: PopoutWindowOptions);
34
72
  dimensions(): Box | null;
35
73
  close(): void;
36
74
  open(): Promise<HTMLElement | null>;
75
+ /**
76
+ * Backstop for the `beforeunload` signal, which a window torn down without
77
+ * running its unload handlers never sends: a native shell destroying the
78
+ * webview, or a browser discarding the page. `closed` is readable on any
79
+ * handle, cross-origin included. Whichever signal arrives first wins.
80
+ */
81
+ private watchForClose;
37
82
  private createPopoutWindowContainer;
38
83
  }
@@ -8,5 +8,17 @@ export declare abstract class Resizable extends CompositeDisposable {
8
8
  get disableResizing(): boolean;
9
9
  set disableResizing(value: boolean);
10
10
  constructor(parentElement: HTMLElement, disableResizing?: boolean);
11
+ /**
12
+ * Lay out from the element's current size.
13
+ *
14
+ * The ResizeObserver above only reports asynchronously, so between
15
+ * construction and its first callback the component believes it has no
16
+ * size - and anything built in that window (panels added right after
17
+ * `createDockview`, say) resolves its sizes against zero and collapses to
18
+ * minimums. Concrete components call this once they are fully constructed
19
+ * so that work sees the real size. The same guards as the observer apply:
20
+ * a detached or hidden element has no size worth propagating.
21
+ */
22
+ protected layoutFromElement(): void;
11
23
  abstract layout(width: number, height: number): void;
12
24
  }
@@ -77,7 +77,7 @@ export declare class Splitview {
77
77
  private _orthogonalSize;
78
78
  private _contentSize;
79
79
  private _proportions;
80
- private readonly proportionalLayout;
80
+ private _proportionalLayout;
81
81
  private _startSnappingEnabled;
82
82
  private _endSnappingEnabled;
83
83
  private _disabled;
@@ -95,6 +95,8 @@ export declare class Splitview {
95
95
  set orthogonalSize(value: number);
96
96
  get length(): number;
97
97
  get proportions(): (number | undefined)[] | undefined;
98
+ get proportionalLayout(): boolean;
99
+ set proportionalLayout(value: boolean);
98
100
  get orientation(): Orientation;
99
101
  set orientation(value: Orientation);
100
102
  get minimumSize(): number;