@wippy-fe/types-global-proxy 0.0.25 → 0.0.27
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 +122 -8
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { PanelTree, ModalSize, PanelTarget } from '@wippy-fe/layout';
|
|
1
|
+
import { PanelTree, ModalSize, SizeValue, PanelTarget } from '@wippy-fe/layout';
|
|
2
2
|
import { AxiosDefaults, AxiosInstance } from 'axios';
|
|
3
3
|
import { ConfirmationOptions } from 'primevue/confirmationoptions';
|
|
4
4
|
import { ToastMessageOptions } from 'primevue/toast';
|
|
5
5
|
import * as nanoevents from 'nanoevents';
|
|
6
|
+
import { GLOBAL_CONFIG_VAR, GLOBAL_API_PROVIDER, GLOBAL_PROXY_CONFIG_VAR, GLOBAL_WEB_COMPONENT_CACHE } from '@wippy-fe/shared';
|
|
6
7
|
import * as tailwindcss_types_config from 'tailwindcss/types/config';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -25,6 +26,14 @@ interface HostPanelBase {
|
|
|
25
26
|
title?: string;
|
|
26
27
|
icon?: string;
|
|
27
28
|
props?: Record<string, unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Drawer open state for panels whose active layout slot has
|
|
31
|
+
* `display: 'drawer-*'`. Surfaced in the snapshot wire so subscribed
|
|
32
|
+
* iframes can react to open/close. Mutated via
|
|
33
|
+
* `host.layout.openDrawer / closeDrawer / toggleDrawer` (or any
|
|
34
|
+
* `updatePanel` patch).
|
|
35
|
+
*/
|
|
36
|
+
drawerOpen?: boolean;
|
|
28
37
|
}
|
|
29
38
|
interface HostPagePanelDef extends HostPanelBase {
|
|
30
39
|
kind: 'page';
|
|
@@ -39,7 +48,13 @@ interface HostComponentPanelDef extends HostPanelBase {
|
|
|
39
48
|
kind: 'component';
|
|
40
49
|
tagName: string;
|
|
41
50
|
}
|
|
42
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Built-in panel ids shipped by gen-2-chat. The `@HOST/` prefix marks
|
|
53
|
+
* them as framework-owned so consumers can later plug in their own
|
|
54
|
+
* `kind: 'builtin'` ids without colliding (and so the declaration
|
|
55
|
+
* shows ownership at a glance).
|
|
56
|
+
*/
|
|
57
|
+
type HostBuiltinId = '@HOST/nav-sidebar' | '@HOST/chat-wrapper' | '@HOST/artifact-viewer' | '@HOST/session-selector';
|
|
43
58
|
interface HostBuiltinPanelDef extends HostPanelBase {
|
|
44
59
|
kind: 'builtin';
|
|
45
60
|
id: HostBuiltinId;
|
|
@@ -104,10 +119,26 @@ type HostFloatingDef = HostOverlayContent & HostOverlayBase & {
|
|
|
104
119
|
type HostModalDef = HostOverlayContent & HostOverlayBase & {
|
|
105
120
|
size?: ModalSize | Record<string, ModalSize>;
|
|
106
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* Coordinator def — headless coordinator app. Same content kinds as
|
|
124
|
+
* panels/floating/modals (page → iframe, artifact → iframe, component
|
|
125
|
+
* → web component, builtin → Vue), but mounted in a hidden host div
|
|
126
|
+
* with no slot / position / size. Use case: a custom app that wires
|
|
127
|
+
* cross-cutting glue — subscribes to WS topics, listens on the layout
|
|
128
|
+
* bus, dispatches `host.layout.updatePanel` / `expandPanel` /
|
|
129
|
+
* `navigate`. Display panels stay focused on rendering.
|
|
130
|
+
*/
|
|
131
|
+
type HostCoordinatorDef = HostOverlayContent & {
|
|
132
|
+
props?: Record<string, unknown>;
|
|
133
|
+
};
|
|
107
134
|
/**
|
|
108
135
|
* The root layout declaration stored in `AppConfig.hostConfig.layout`.
|
|
109
136
|
* Shape mirrors `@wippy-fe/layout`'s `LayoutDeclaration` but replaces
|
|
110
137
|
* `panels` with a tagged-union `HostPanelDef` map.
|
|
138
|
+
*
|
|
139
|
+
* **Status: Draft 1 (preview).** Shipped but not yet validated against
|
|
140
|
+
* a production consumer. Field names and validation rules may still
|
|
141
|
+
* change between minor releases. See `managed-layout.md`.
|
|
111
142
|
*/
|
|
112
143
|
interface HostLayoutDeclaration {
|
|
113
144
|
layouts: Record<string, PanelTree> & {
|
|
@@ -117,8 +148,27 @@ interface HostLayoutDeclaration {
|
|
|
117
148
|
panels: Record<string, HostPanelDef>;
|
|
118
149
|
floating?: Record<string, HostFloatingDef>;
|
|
119
150
|
modals?: Record<string, HostModalDef>;
|
|
151
|
+
/**
|
|
152
|
+
* Headless coordinator apps. Mounted in a hidden host div, get the
|
|
153
|
+
* full proxy API, never appear in any layout slot. Validated with the
|
|
154
|
+
* same kind/builtin-id checks as panels.
|
|
155
|
+
*/
|
|
156
|
+
coordinators?: Record<string, HostCoordinatorDef>;
|
|
120
157
|
dragEnabled?: boolean;
|
|
121
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* The envelope every subscriber receives. `sourcePanelId` is the
|
|
161
|
+
* publisher's panelId (null when published from outside any registered
|
|
162
|
+
* panel — e.g. a grand-child relay whose panel boundary fell off the
|
|
163
|
+
* map, or system events). `targetPanelId` is non-null only for
|
|
164
|
+
* `send(target, ...)` calls; `broadcast()` leaves it null.
|
|
165
|
+
*/
|
|
166
|
+
interface BroadcastEnvelope {
|
|
167
|
+
channel: string;
|
|
168
|
+
payload: unknown;
|
|
169
|
+
sourcePanelId: string | null;
|
|
170
|
+
targetPanelId: string | null;
|
|
171
|
+
}
|
|
122
172
|
|
|
123
173
|
declare namespace PageApi {
|
|
124
174
|
interface Page {
|
|
@@ -920,6 +970,15 @@ interface LayoutSnapshot {
|
|
|
920
970
|
activeBreakpoint?: string;
|
|
921
971
|
dragEnabled?: boolean;
|
|
922
972
|
}
|
|
973
|
+
/**
|
|
974
|
+
* Child-iframe handle on the host's managed-layout shell.
|
|
975
|
+
*
|
|
976
|
+
* **Status: Draft 1 (preview).** Shipped but not yet driven by a
|
|
977
|
+
* production consumer. Field names, defaults, and validation rules may
|
|
978
|
+
* still change between minor releases. Pin to an exact CDN version
|
|
979
|
+
* until this label is removed. See `managed-layout.md` for guidance,
|
|
980
|
+
* worked examples, and the three-tier "where state lives" rule.
|
|
981
|
+
*/
|
|
923
982
|
interface LayoutApi {
|
|
924
983
|
/**
|
|
925
984
|
* Current layout snapshot — sync property getter, never waits. Returns
|
|
@@ -929,20 +988,79 @@ interface LayoutApi {
|
|
|
929
988
|
* or subscribe reactively via `@wippy-fe/vue-host`'s `useWippyLayout`.
|
|
930
989
|
*/
|
|
931
990
|
readonly snapshot: LayoutSnapshot | null;
|
|
932
|
-
/**
|
|
933
|
-
|
|
991
|
+
/**
|
|
992
|
+
* Resize a panel in the active breakpoint layout. `size` follows the
|
|
993
|
+
* GoldenLayout-style grammar — `'auto' | 'Nfr' | 'Npx' | 'N%'`.
|
|
994
|
+
* Anything else is rejected at the host's `validateLayout` boundary
|
|
995
|
+
* (silent no-op for unknown panelId; `LayoutValidationError` for bad
|
|
996
|
+
* size).
|
|
997
|
+
*/
|
|
998
|
+
resizePanel: (panelId: string, size: SizeValue) => void;
|
|
934
999
|
/** Collapse a panel (no-op if not `collapsible`). */
|
|
935
1000
|
collapsePanel: (panelId: string) => void;
|
|
936
1001
|
/** Expand a collapsed panel. */
|
|
937
1002
|
expandPanel: (panelId: string) => void;
|
|
1003
|
+
/**
|
|
1004
|
+
* Open a panel's drawer overlay. Only meaningful when the panel's
|
|
1005
|
+
* active layout slot has `display: 'drawer-*'`. For inline slots,
|
|
1006
|
+
* this sets `panel.drawerOpen` but has no visible effect (the engine
|
|
1007
|
+
* ignores it on inline slots). The same panel can switch between
|
|
1008
|
+
* inline and drawer display across breakpoints — iframe state is
|
|
1009
|
+
* preserved across the transition.
|
|
1010
|
+
*/
|
|
1011
|
+
openDrawer: (panelId: string) => void;
|
|
1012
|
+
/** Close a panel's drawer overlay. */
|
|
1013
|
+
closeDrawer: (panelId: string) => void;
|
|
1014
|
+
/** Flip a panel's drawer open state. */
|
|
1015
|
+
toggleDrawer: (panelId: string) => void;
|
|
938
1016
|
/** Move a panel to a new position in the active layout. */
|
|
939
1017
|
movePanel: (panelId: string, target: PanelTarget) => void;
|
|
940
1018
|
/** Remove a panel from all breakpoint layouts + panels map. */
|
|
941
1019
|
removePanel: (panelId: string) => void;
|
|
1020
|
+
/**
|
|
1021
|
+
* Patch an existing panel's def at runtime — swap content kind / id /
|
|
1022
|
+
* tagName, replace `route` / `title` / `icon`, or shallow-merge `props`.
|
|
1023
|
+
* Unknown panelId is a silent no-op. Same merge semantics as the
|
|
1024
|
+
* host-side `updatePanelLiveState`: `props` shallow-merges, other
|
|
1025
|
+
* top-level fields replace wholesale.
|
|
1026
|
+
*/
|
|
1027
|
+
updatePanel: (panelId: string, def: Partial<HostPanelDef>) => void;
|
|
942
1028
|
/** Close a currently-open modal by id. */
|
|
943
1029
|
closeModal: (modalId: string) => void;
|
|
1030
|
+
/** Add a floating panel at runtime. Existing id is overwritten. */
|
|
1031
|
+
addFloating: (id: string, def: HostFloatingDef) => void;
|
|
944
1032
|
/** Remove a floating panel by id. */
|
|
945
1033
|
removeFloating: (floatingId: string) => void;
|
|
1034
|
+
/**
|
|
1035
|
+
* Publish on the in-tab layout bus to every OTHER subscribed iframe
|
|
1036
|
+
* panel and to host-mounted subscribers (components, services). The
|
|
1037
|
+
* sender's own window is excluded from the iframe fan-out (the host
|
|
1038
|
+
* receiver skips `w === source`); host-mounted handlers attached to
|
|
1039
|
+
* the same panel still fire via the in-process LocalBus mirror.
|
|
1040
|
+
* Subscribe via `host.layout.on(channel, handler)`.
|
|
1041
|
+
*/
|
|
1042
|
+
broadcast: (channel: string, payload: unknown) => void;
|
|
1043
|
+
/**
|
|
1044
|
+
* Send to a specific panel only (1:1). Unknown target panelIds are
|
|
1045
|
+
* silent no-ops on the iframe fan-out (matches `updatePanel`).
|
|
1046
|
+
* `target = self` IS delivered: the receiver routes by `panelId →
|
|
1047
|
+
* windows` without a source-equality check, so addressing your own
|
|
1048
|
+
* panel loops the message back through `host.layout.on(...)`. Use
|
|
1049
|
+
* this for the documented loop-through-coordinator pattern. Passing
|
|
1050
|
+
* a non-string `target` throws — use `broadcast()` for 1:N.
|
|
1051
|
+
*/
|
|
1052
|
+
send: (target: string, channel: string, payload: unknown) => void;
|
|
1053
|
+
/**
|
|
1054
|
+
* Subscribe to a layout-bus channel. Returns an `off()` function. The
|
|
1055
|
+
* handler receives the full envelope including `sourcePanelId` (who
|
|
1056
|
+
* published, `null` if from host system) and `targetPanelId` (who was
|
|
1057
|
+
* addressed, `null` for 1:N broadcasts).
|
|
1058
|
+
*
|
|
1059
|
+
* Layout-bus channels are deliberately separate from WS topics — they
|
|
1060
|
+
* never cross to other browser tabs and are scoped to the host page's
|
|
1061
|
+
* lifetime.
|
|
1062
|
+
*/
|
|
1063
|
+
on: (channel: string, handler: (env: BroadcastEnvelope) => void) => () => void;
|
|
946
1064
|
}
|
|
947
1065
|
|
|
948
1066
|
type KnownTopics = '@history' | '@visibility' | '@message' | '@state-error' | '@layout-change' | '@layout-breakpoint';
|
|
@@ -1148,10 +1266,6 @@ interface ProxyApiInstance {
|
|
|
1148
1266
|
loadWebComponent: (componentId: string, tagName?: string) => Promise<void>;
|
|
1149
1267
|
}
|
|
1150
1268
|
|
|
1151
|
-
declare const GLOBAL_CONFIG_VAR: "__WIPPY_APP_CONFIG__";
|
|
1152
|
-
declare const GLOBAL_PROXY_CONFIG_VAR: "__WIPPY_PROXY_CONFIG__";
|
|
1153
|
-
declare const GLOBAL_API_PROVIDER: "__WIPPY_APP_API__";
|
|
1154
|
-
declare const GLOBAL_WEB_COMPONENT_CACHE: "__WIPPY_WEB_COMPONENT_CACHE__";
|
|
1155
1269
|
declare global {
|
|
1156
1270
|
interface Window {
|
|
1157
1271
|
[GLOBAL_CONFIG_VAR]: AppConfig | ChildAppConfig;
|
package/package.json
CHANGED