@wippy-fe/types-global-proxy 0.0.23 → 0.0.25
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/index.d.ts +187 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,9 +1,125 @@
|
|
|
1
|
+
import { PanelTree, ModalSize, PanelTarget } from '@wippy-fe/layout';
|
|
1
2
|
import { AxiosDefaults, AxiosInstance } from 'axios';
|
|
2
3
|
import { ConfirmationOptions } from 'primevue/confirmationoptions';
|
|
3
4
|
import { ToastMessageOptions } from 'primevue/toast';
|
|
4
5
|
import * as nanoevents from 'nanoevents';
|
|
5
6
|
import * as tailwindcss_types_config from 'tailwindcss/types/config';
|
|
6
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Host-side layout types (Wippy-flavored wrapper around `@wippy-fe/layout`).
|
|
10
|
+
*
|
|
11
|
+
* The pure package speaks in `PanelDef = { component: Component, props? }` —
|
|
12
|
+
* bring-your-own Vue component. The host layer replaces that with a
|
|
13
|
+
* tagged-union where `kind` picks a content resolver:
|
|
14
|
+
*
|
|
15
|
+
* - `page` → renders a Wippy page (WPage double-buffer for `main: true`, single-instance otherwise)
|
|
16
|
+
* - `artifact` → renders a Wippy artifact (WPage with type='artifact')
|
|
17
|
+
* - `component` → renders a registered web component via `tagName`
|
|
18
|
+
* - `builtin` → renders host chrome (nav-sidebar / chat-wrapper / artifact-viewer / session-selector)
|
|
19
|
+
*
|
|
20
|
+
* The host resolver converts this into `@wippy-fe/layout`'s `PanelDef` at
|
|
21
|
+
* construction time and passes it into a `LayoutManager`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
interface HostPanelBase {
|
|
25
|
+
title?: string;
|
|
26
|
+
icon?: string;
|
|
27
|
+
props?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
interface HostPagePanelDef extends HostPanelBase {
|
|
30
|
+
kind: 'page';
|
|
31
|
+
id: string;
|
|
32
|
+
route?: string;
|
|
33
|
+
}
|
|
34
|
+
interface HostArtifactPanelDef extends HostPanelBase {
|
|
35
|
+
kind: 'artifact';
|
|
36
|
+
id: string;
|
|
37
|
+
}
|
|
38
|
+
interface HostComponentPanelDef extends HostPanelBase {
|
|
39
|
+
kind: 'component';
|
|
40
|
+
tagName: string;
|
|
41
|
+
}
|
|
42
|
+
type HostBuiltinId = 'nav-sidebar' | 'chat-wrapper' | 'artifact-viewer' | 'session-selector';
|
|
43
|
+
interface HostBuiltinPanelDef extends HostPanelBase {
|
|
44
|
+
kind: 'builtin';
|
|
45
|
+
id: HostBuiltinId;
|
|
46
|
+
}
|
|
47
|
+
type HostPanelDef = HostPagePanelDef | HostArtifactPanelDef | HostComponentPanelDef | HostBuiltinPanelDef;
|
|
48
|
+
/**
|
|
49
|
+
* Overlay content shape — what kind of thing to render. Mirrors
|
|
50
|
+
* HostPanelDef's discriminant exactly so the same resolver dispatch
|
|
51
|
+
* works for both inline panels and overlays. This makes floating
|
|
52
|
+
* panels and modals declarable in pure JSON config (no Vue component
|
|
53
|
+
* references in the declaration).
|
|
54
|
+
*/
|
|
55
|
+
type HostOverlayContent = {
|
|
56
|
+
kind: 'page';
|
|
57
|
+
id: string;
|
|
58
|
+
route?: string;
|
|
59
|
+
} | {
|
|
60
|
+
kind: 'artifact';
|
|
61
|
+
id: string;
|
|
62
|
+
} | {
|
|
63
|
+
kind: 'component';
|
|
64
|
+
tagName: string;
|
|
65
|
+
} | {
|
|
66
|
+
kind: 'builtin';
|
|
67
|
+
id: HostBuiltinId;
|
|
68
|
+
};
|
|
69
|
+
interface HostOverlayBase {
|
|
70
|
+
title?: string;
|
|
71
|
+
icon?: string;
|
|
72
|
+
props?: Record<string, unknown>;
|
|
73
|
+
dismissable?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Floating window def — absolute-positioned, draggable, resizable.
|
|
77
|
+
* Composition: content kind + window chrome properties.
|
|
78
|
+
*/
|
|
79
|
+
type HostFloatingDef = HostOverlayContent & HostOverlayBase & {
|
|
80
|
+
position: {
|
|
81
|
+
x: number;
|
|
82
|
+
y: number;
|
|
83
|
+
};
|
|
84
|
+
size: {
|
|
85
|
+
width: number;
|
|
86
|
+
height: number;
|
|
87
|
+
};
|
|
88
|
+
minSize?: {
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
};
|
|
92
|
+
maxSize?: {
|
|
93
|
+
width: number;
|
|
94
|
+
height: number;
|
|
95
|
+
};
|
|
96
|
+
minimizable?: boolean;
|
|
97
|
+
maximizable?: boolean;
|
|
98
|
+
zIndex?: number;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Modal def — centered overlay. Size is either a single `ModalSize`
|
|
102
|
+
* or a breakpoint-keyed map (desktop centered / mobile fullscreen).
|
|
103
|
+
*/
|
|
104
|
+
type HostModalDef = HostOverlayContent & HostOverlayBase & {
|
|
105
|
+
size?: ModalSize | Record<string, ModalSize>;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The root layout declaration stored in `AppConfig.hostConfig.layout`.
|
|
109
|
+
* Shape mirrors `@wippy-fe/layout`'s `LayoutDeclaration` but replaces
|
|
110
|
+
* `panels` with a tagged-union `HostPanelDef` map.
|
|
111
|
+
*/
|
|
112
|
+
interface HostLayoutDeclaration {
|
|
113
|
+
layouts: Record<string, PanelTree> & {
|
|
114
|
+
default: PanelTree;
|
|
115
|
+
};
|
|
116
|
+
breakpoints?: Record<string, number>;
|
|
117
|
+
panels: Record<string, HostPanelDef>;
|
|
118
|
+
floating?: Record<string, HostFloatingDef>;
|
|
119
|
+
modals?: Record<string, HostModalDef>;
|
|
120
|
+
dragEnabled?: boolean;
|
|
121
|
+
}
|
|
122
|
+
|
|
7
123
|
declare namespace PageApi {
|
|
8
124
|
interface Page {
|
|
9
125
|
icon: string;
|
|
@@ -278,6 +394,11 @@ interface HostConfig {
|
|
|
278
394
|
type: 'non-persistent' | 'cookie';
|
|
279
395
|
};
|
|
280
396
|
history?: 'browser' | 'hash';
|
|
397
|
+
/**
|
|
398
|
+
* Declarative multi-panel layout for the `managed-layout.html` entry point.
|
|
399
|
+
* Ignored by `iframe.html` / `chat-iframe.html` shells.
|
|
400
|
+
*/
|
|
401
|
+
layout?: HostLayoutDeclaration;
|
|
281
402
|
}
|
|
282
403
|
interface AppContext {
|
|
283
404
|
resourceId: string;
|
|
@@ -289,6 +410,16 @@ interface AppContext {
|
|
|
289
410
|
isNavOwner?: boolean;
|
|
290
411
|
layoutPanelId?: string;
|
|
291
412
|
layoutId?: string;
|
|
413
|
+
/**
|
|
414
|
+
* Initial layout snapshot baked into the child payload by the
|
|
415
|
+
* managed-layout host. Child proxies seed `host.layout.snapshot` from
|
|
416
|
+
* this at boot — so `host.layout.snapshot` is NEVER null inside a
|
|
417
|
+
* managed-layout host, and consumers never have to wait for a
|
|
418
|
+
* round-trip. `undefined` outside a managed-layout host.
|
|
419
|
+
*
|
|
420
|
+
* Updates arrive asynchronously via the `@layout-change` proxy topic.
|
|
421
|
+
*/
|
|
422
|
+
layout?: unknown;
|
|
292
423
|
extensions?: Record<string, unknown>;
|
|
293
424
|
}
|
|
294
425
|
interface AppEnv {
|
|
@@ -770,7 +901,51 @@ interface OtherCommand {
|
|
|
770
901
|
}
|
|
771
902
|
type WsCommand = SessionOpenCommand | SessionCloseCommand | SessionMessageCommand | SessionCommandCommand | ExternalEventCommand;
|
|
772
903
|
|
|
773
|
-
|
|
904
|
+
/**
|
|
905
|
+
* Read-only mirror of the current host `HostLayoutDeclaration`, minus
|
|
906
|
+
* Vue-component references (those can't cross the postMessage boundary).
|
|
907
|
+
* Child iframes use this to reason about the tree — e.g. which panels
|
|
908
|
+
* exist, what their current sizes/collapsed state / routes are — without
|
|
909
|
+
* being coupled to the host's component registry.
|
|
910
|
+
*
|
|
911
|
+
* `null` outside a managed-layout host (compat mode, `iframe.html`, or
|
|
912
|
+
* any standalone/headless entry point).
|
|
913
|
+
*/
|
|
914
|
+
interface LayoutSnapshot {
|
|
915
|
+
layouts: Record<string, unknown>;
|
|
916
|
+
panels: Record<string, unknown>;
|
|
917
|
+
breakpoints?: Record<string, number>;
|
|
918
|
+
floating?: Record<string, unknown>;
|
|
919
|
+
modals?: Record<string, unknown>;
|
|
920
|
+
activeBreakpoint?: string;
|
|
921
|
+
dragEnabled?: boolean;
|
|
922
|
+
}
|
|
923
|
+
interface LayoutApi {
|
|
924
|
+
/**
|
|
925
|
+
* Current layout snapshot — sync property getter, never waits. Returns
|
|
926
|
+
* `null` when the child is NOT inside a managed-layout host. Updates
|
|
927
|
+
* arrive via the `@layout-change` proxy topic; read the property
|
|
928
|
+
* directly inside an `@layout-change` handler to see the fresh value,
|
|
929
|
+
* or subscribe reactively via `@wippy-fe/vue-host`'s `useWippyLayout`.
|
|
930
|
+
*/
|
|
931
|
+
readonly snapshot: LayoutSnapshot | null;
|
|
932
|
+
/** Resize a panel in the active breakpoint layout. */
|
|
933
|
+
resizePanel: (panelId: string, size: string) => void;
|
|
934
|
+
/** Collapse a panel (no-op if not `collapsible`). */
|
|
935
|
+
collapsePanel: (panelId: string) => void;
|
|
936
|
+
/** Expand a collapsed panel. */
|
|
937
|
+
expandPanel: (panelId: string) => void;
|
|
938
|
+
/** Move a panel to a new position in the active layout. */
|
|
939
|
+
movePanel: (panelId: string, target: PanelTarget) => void;
|
|
940
|
+
/** Remove a panel from all breakpoint layouts + panels map. */
|
|
941
|
+
removePanel: (panelId: string) => void;
|
|
942
|
+
/** Close a currently-open modal by id. */
|
|
943
|
+
closeModal: (modalId: string) => void;
|
|
944
|
+
/** Remove a floating panel by id. */
|
|
945
|
+
removeFloating: (floatingId: string) => void;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
type KnownTopics = '@history' | '@visibility' | '@message' | '@state-error' | '@layout-change' | '@layout-breakpoint';
|
|
774
949
|
type Events = {
|
|
775
950
|
/** Emitted when pages are updated */
|
|
776
951
|
'@history': (data: {
|
|
@@ -783,6 +958,11 @@ type Events = {
|
|
|
783
958
|
error: string;
|
|
784
959
|
key?: string;
|
|
785
960
|
}) => void;
|
|
961
|
+
'@layout-change': (snapshot: LayoutSnapshot) => void;
|
|
962
|
+
'@layout-breakpoint': (data: {
|
|
963
|
+
name: string;
|
|
964
|
+
width: number;
|
|
965
|
+
}) => void;
|
|
786
966
|
} & {
|
|
787
967
|
[K in string as K extends KnownTopics ? never : K]: (data: WsMessage) => void;
|
|
788
968
|
};
|
|
@@ -937,6 +1117,12 @@ interface ProxyApiInstance {
|
|
|
937
1117
|
* system route segments. Pure function — safe to call anywhere.
|
|
938
1118
|
*/
|
|
939
1119
|
classifyLink: (href: string | null | undefined) => LinkClassification;
|
|
1120
|
+
/**
|
|
1121
|
+
* Declarative multi-panel layout control (managed-layout entry point only).
|
|
1122
|
+
* Calls from child iframes not embedded inside a `managed-layout.html`
|
|
1123
|
+
* host will be dropped silently by the parent.
|
|
1124
|
+
*/
|
|
1125
|
+
layout: LayoutApi;
|
|
940
1126
|
logout: () => void;
|
|
941
1127
|
};
|
|
942
1128
|
api: AxiosInstance;
|
package/package.json
CHANGED