forgeframe 0.0.5 → 0.0.9
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/README.md +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/core/component-instance-index.d.ts +43 -0
- package/dist/core/component.d.ts +14 -0
- package/dist/core/consumer/props-pipeline.d.ts +66 -0
- package/dist/core/consumer/renderer.d.ts +85 -0
- package/dist/core/consumer/transport.d.ts +107 -0
- package/dist/core/consumer/types.d.ts +24 -0
- package/dist/core/consumer.d.ts +55 -58
- package/dist/core/host.d.ts +44 -0
- package/dist/forgeframe.js +2650 -2097
- package/dist/forgeframe.umd.cjs +2 -2
- package/dist/render/iframe.d.ts +30 -0
- package/dist/types.d.ts +11 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -832,7 +832,7 @@ interface ComponentOptions<P> {
|
|
|
832
832
|
const instance = MyComponent(props);
|
|
833
833
|
|
|
834
834
|
await instance.render(container?, context?) // Render
|
|
835
|
-
await instance.renderTo(window, container?) //
|
|
835
|
+
await instance.renderTo(window, container?) // Supports only current window; throws for other windows
|
|
836
836
|
await instance.close() // Close and destroy
|
|
837
837
|
await instance.focus() // Focus
|
|
838
838
|
await instance.resize({ width, height }) // Resize
|
package/dist/constants.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export declare const PROP_SERIALIZATION: {
|
|
|
79
79
|
readonly JSON: "json";
|
|
80
80
|
/** Base64 encoding for binary or large data */
|
|
81
81
|
readonly BASE64: "base64";
|
|
82
|
-
/**
|
|
82
|
+
/** Explicit framed-path encoding for nested objects */
|
|
83
83
|
readonly DOTIFY: "dotify";
|
|
84
84
|
};
|
|
85
85
|
/**
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Internal active component instance index.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This module tracks active component instances by UID and tag so peer lookups
|
|
7
|
+
* can be performed without scanning the full component registry.
|
|
8
|
+
*/
|
|
9
|
+
import type { ForgeFrameComponentInstance } from '../types';
|
|
10
|
+
export type IndexedComponentInstance = ForgeFrameComponentInstance<Record<string, unknown>, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Adds an instance to the internal lookup index.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function indexComponentInstance<P extends Record<string, unknown>, X>(tag: string, instance: ForgeFrameComponentInstance<P, X>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Removes an instance from the internal lookup index.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function removeIndexedComponentInstance(uid: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Removes all indexed instances for a specific component tag.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare function clearIndexedInstancesByTag(tag: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Clears all active indexed instances.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare function clearIndexedInstances(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Returns active instances for a specific component tag.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export declare function getComponentInstancesByTag(tag: string): IndexedComponentInstance[];
|
|
36
|
+
/**
|
|
37
|
+
* Returns all active indexed instances across tags.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare function getIndexedComponentInstances(): Array<{
|
|
41
|
+
tag: string;
|
|
42
|
+
instance: IndexedComponentInstance;
|
|
43
|
+
}>;
|
package/dist/core/component.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* creation, validation, and lifecycle management.
|
|
9
9
|
*/
|
|
10
10
|
import type { ComponentOptions, ForgeFrameComponent, ForgeFrameComponentInstance } from '../types';
|
|
11
|
+
import { type IndexedComponentInstance } from './component-instance-index';
|
|
11
12
|
/**
|
|
12
13
|
* Creates a new ForgeFrame component definition.
|
|
13
14
|
*
|
|
@@ -68,6 +69,19 @@ export declare function getRegisteredComponents(): Array<[
|
|
|
68
69
|
string,
|
|
69
70
|
ForgeFrameComponent<Record<string, unknown>>
|
|
70
71
|
]>;
|
|
72
|
+
/**
|
|
73
|
+
* Returns active instances for a specific component tag using an internal index.
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export declare function getComponentInstancesByTag(tag: string): IndexedComponentInstance[];
|
|
77
|
+
/**
|
|
78
|
+
* Returns all active indexed instances across tags.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export declare function getIndexedComponentInstances(): Array<{
|
|
82
|
+
tag: string;
|
|
83
|
+
instance: IndexedComponentInstance;
|
|
84
|
+
}>;
|
|
71
85
|
/**
|
|
72
86
|
* Returns the internal options metadata for a component factory.
|
|
73
87
|
* @internal
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { PropContext } from '../../types';
|
|
2
|
+
import type { NormalizedOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Hooks used by the props pipeline to coordinate host synchronization behavior.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface ConsumerPropsUpdateHooks<P extends Record<string, unknown>> {
|
|
8
|
+
resolveUrl: (props: P) => string;
|
|
9
|
+
resolveUrlOrigin: (url: string) => string | null;
|
|
10
|
+
assertStableRenderedOrigin: (nextHostOrigin: string | null) => void;
|
|
11
|
+
isRendered: () => boolean;
|
|
12
|
+
syncTrustedDomainForUrl: (url: string) => void;
|
|
13
|
+
shouldSendPropsToHost: () => boolean;
|
|
14
|
+
sendPropsUpdateToHost: (nextProps: P) => Promise<void>;
|
|
15
|
+
emitPropsUpdated: (nextProps: P) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hooks required to queue a host sync for the current props snapshot.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export interface ConsumerPropsSyncHooks<P extends Record<string, unknown>> {
|
|
22
|
+
shouldSendPropsToHost: () => boolean;
|
|
23
|
+
sendPropsUpdateToHost: (nextProps: P) => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Owns consumer prop normalization, validation, and update queueing.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export declare class ConsumerPropsPipeline<P extends Record<string, unknown>> {
|
|
30
|
+
private options;
|
|
31
|
+
private createPropContext;
|
|
32
|
+
/** Current normalized prop snapshot. */
|
|
33
|
+
props: P;
|
|
34
|
+
/** Last input props snapshot prior to normalization. */
|
|
35
|
+
inputProps: Partial<P>;
|
|
36
|
+
/** Active in-flight update chain when host synchronization is occurring. */
|
|
37
|
+
pendingPropsUpdate: Promise<void> | null;
|
|
38
|
+
constructor(options: NormalizedOptions<P>, initialInputProps: Partial<P>, createPropContext: (props: P) => PropContext<P>);
|
|
39
|
+
/**
|
|
40
|
+
* Builds and validates the next props snapshot.
|
|
41
|
+
*/
|
|
42
|
+
buildNextProps(newProps: Partial<P>): {
|
|
43
|
+
nextInputProps: Partial<P>;
|
|
44
|
+
nextProps: P;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Applies a props update and synchronizes it to the host when connected.
|
|
48
|
+
*/
|
|
49
|
+
updateProps(newProps: Partial<P>, hooks: ConsumerPropsUpdateHooks<P>): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Queues a host synchronization for the current props snapshot.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* This shares the same serialization queue as updateProps so function bridge
|
|
55
|
+
* batches cannot overlap with user-initiated prop updates.
|
|
56
|
+
*/
|
|
57
|
+
syncCurrentPropsToHost(hooks: ConsumerPropsSyncHooks<P>): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Queues prop updates when a previous host sync is in flight.
|
|
60
|
+
*/
|
|
61
|
+
private queuePropsUpdate;
|
|
62
|
+
/**
|
|
63
|
+
* Tracks a promise as the active queued update and clears it when settled.
|
|
64
|
+
*/
|
|
65
|
+
private trackPendingUpdate;
|
|
66
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ContextType } from '../../constants';
|
|
2
|
+
import type { Dimensions } from '../../types';
|
|
3
|
+
import type { NormalizedOptions } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters required to open iframe/popup host content.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface ConsumerOpenParams {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
buildUrl: (baseUrl: string) => string;
|
|
11
|
+
buildBodyParams: () => URLSearchParams;
|
|
12
|
+
buildWindowName: () => string;
|
|
13
|
+
submitBodyForm: (target: string, actionUrl: string, params: URLSearchParams) => void;
|
|
14
|
+
onPopupClose: () => void;
|
|
15
|
+
registerCleanup: (cleanupFn: () => void) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Owns consumer rendering concerns (container resolution, prerender, iframe/popup lifecycle).
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare class ConsumerRenderer<P extends Record<string, unknown>> {
|
|
22
|
+
private options;
|
|
23
|
+
private uid;
|
|
24
|
+
private getProps;
|
|
25
|
+
private resolveDimensions;
|
|
26
|
+
private callbacks;
|
|
27
|
+
/** Active rendering context. */
|
|
28
|
+
context: ContextType;
|
|
29
|
+
/** Active iframe instance when rendering in iframe mode. */
|
|
30
|
+
iframe: HTMLIFrameElement | null;
|
|
31
|
+
/** Resolved container element. */
|
|
32
|
+
container: HTMLElement | null;
|
|
33
|
+
/** Prerender element currently displayed while host initializes. */
|
|
34
|
+
prerenderElement: HTMLElement | null;
|
|
35
|
+
/** Wrapper element created and owned by the renderer. */
|
|
36
|
+
private ownedContainer;
|
|
37
|
+
constructor(options: NormalizedOptions<P>, uid: string, getProps: () => P, resolveDimensions: () => Dimensions, callbacks: {
|
|
38
|
+
close: () => Promise<void>;
|
|
39
|
+
focus: () => Promise<void>;
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a container selector or element to an HTMLElement.
|
|
43
|
+
*/
|
|
44
|
+
resolveContainer(container?: string | HTMLElement): HTMLElement;
|
|
45
|
+
/**
|
|
46
|
+
* Creates and displays prerender/loading content.
|
|
47
|
+
*/
|
|
48
|
+
prerender(createIframeElement: (windowName: string) => HTMLIFrameElement, buildWindowName: () => string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Creates an iframe element without setting src (for prerender phase).
|
|
51
|
+
*/
|
|
52
|
+
createIframeElement(windowName: string): HTMLIFrameElement;
|
|
53
|
+
/**
|
|
54
|
+
* Opens host content in iframe or popup context.
|
|
55
|
+
*/
|
|
56
|
+
open(params: ConsumerOpenParams): Window | null;
|
|
57
|
+
/**
|
|
58
|
+
* Swaps prerender content with the live iframe after host initialization.
|
|
59
|
+
*/
|
|
60
|
+
swapPrerenderContentIfNeeded(): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Submits a hidden form to navigate a target window via POST.
|
|
63
|
+
*/
|
|
64
|
+
submitBodyForm(target: string, actionUrl: string, params: URLSearchParams): void;
|
|
65
|
+
/**
|
|
66
|
+
* Focuses iframe/popup context.
|
|
67
|
+
*/
|
|
68
|
+
focus(hostWindow: Window | null): void;
|
|
69
|
+
/**
|
|
70
|
+
* Resizes iframe/popup context.
|
|
71
|
+
*/
|
|
72
|
+
resize(dimensions: Dimensions, hostWindow: Window | null): void;
|
|
73
|
+
/**
|
|
74
|
+
* Shows iframe context.
|
|
75
|
+
*/
|
|
76
|
+
show(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Hides iframe context.
|
|
79
|
+
*/
|
|
80
|
+
hide(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Destroys rendered iframe/popup DOM artifacts.
|
|
83
|
+
*/
|
|
84
|
+
destroy(hostWindow: Window | null): void;
|
|
85
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { ConsumerExports, Dimensions, GetPeerInstancesOptions, HostComponentRef, PropsDefinition, SerializedProps, SiblingInfo } from '../../types';
|
|
2
|
+
import { Messenger } from '../../communication/messenger';
|
|
3
|
+
import { FunctionBridge } from '../../communication/bridge';
|
|
4
|
+
import { createDeferred } from '../../utils/promise';
|
|
5
|
+
import type { ContextType } from '../../constants';
|
|
6
|
+
import type { NormalizedOptions } from './types';
|
|
7
|
+
interface PeerRequest {
|
|
8
|
+
uid: string;
|
|
9
|
+
tag: string;
|
|
10
|
+
options?: GetPeerInstancesOptions;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Callbacks used by transport to map inbound host messages to component behavior.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export interface ConsumerTransportHandlers<X> {
|
|
17
|
+
onInit?: () => void | Promise<void>;
|
|
18
|
+
onClose: () => Promise<void>;
|
|
19
|
+
onResize: (dimensions: Dimensions) => Promise<void>;
|
|
20
|
+
onFocus: () => Promise<void>;
|
|
21
|
+
onShow: () => Promise<void>;
|
|
22
|
+
onHide: () => Promise<void>;
|
|
23
|
+
onError: (error: Error) => void;
|
|
24
|
+
onExport: (exports: X) => void;
|
|
25
|
+
onConsumerExport: (data: unknown) => void;
|
|
26
|
+
onGetSiblings: (request: PeerRequest) => SiblingInfo[] | Promise<SiblingInfo[]>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Owns consumer transport concerns (messenger, function bridge, trust management, handshake).
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare class ConsumerTransport<P extends Record<string, unknown>, X = unknown> {
|
|
33
|
+
private uid;
|
|
34
|
+
private options;
|
|
35
|
+
private resolveUrl;
|
|
36
|
+
private resolveUrlOrigin;
|
|
37
|
+
/** Messenger for host communication. */
|
|
38
|
+
messenger: Messenger;
|
|
39
|
+
/** Function bridge for serializing callable props across windows. */
|
|
40
|
+
bridge: FunctionBridge;
|
|
41
|
+
/** Connected host window reference. */
|
|
42
|
+
hostWindow: Window | null;
|
|
43
|
+
/** Origin of currently opened host content. */
|
|
44
|
+
openedHostDomain: string | null;
|
|
45
|
+
/** Dynamic origin currently trusted due to resolved URL. */
|
|
46
|
+
dynamicUrlTrustedOrigin: string | null;
|
|
47
|
+
/** Deferred host initialization handshake promise. */
|
|
48
|
+
initPromise: ReturnType<typeof createDeferred<void>> | null;
|
|
49
|
+
/** Whether host initialization handshake has completed. */
|
|
50
|
+
hostInitialized: boolean;
|
|
51
|
+
constructor(uid: string, options: NormalizedOptions<P>, resolveUrl: () => string, resolveUrlOrigin: (url: string) => string | null);
|
|
52
|
+
/**
|
|
53
|
+
* Builds trusted domains used to initialize messenger security checks.
|
|
54
|
+
*/
|
|
55
|
+
private buildTrustedDomains;
|
|
56
|
+
/**
|
|
57
|
+
* Returns true when the domain option explicitly includes this origin.
|
|
58
|
+
*/
|
|
59
|
+
isExplicitDomainTrust(origin: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Ensures the messenger trusts the origin for a resolved host URL.
|
|
62
|
+
*/
|
|
63
|
+
syncTrustedDomainForUrl(url: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the current host domain target used for messaging.
|
|
66
|
+
*/
|
|
67
|
+
getHostDomain(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Returns true when the host window is connected and not closed.
|
|
70
|
+
*/
|
|
71
|
+
isHostConnected(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Serializes host props while keeping function bridge references in sync.
|
|
74
|
+
*/
|
|
75
|
+
serializePropsForHost(propsForHost: Record<string, unknown>, propDefinitions: PropsDefinition<Record<string, unknown>>, options?: {
|
|
76
|
+
finishBatch?: boolean;
|
|
77
|
+
}): SerializedProps;
|
|
78
|
+
/**
|
|
79
|
+
* Sends the current props snapshot to the host window when available.
|
|
80
|
+
*/
|
|
81
|
+
sendPropsUpdateToHost(nextProps: P, propDefinitions: PropsDefinition<P>): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Builds the window.name payload for host initialization.
|
|
84
|
+
*/
|
|
85
|
+
buildWindowName(options: {
|
|
86
|
+
tag: string;
|
|
87
|
+
context: ContextType;
|
|
88
|
+
props: P;
|
|
89
|
+
propDefinitions: PropsDefinition<P>;
|
|
90
|
+
hostDomain?: string;
|
|
91
|
+
children?: Record<string, HostComponentRef>;
|
|
92
|
+
exports: ConsumerExports;
|
|
93
|
+
}): string;
|
|
94
|
+
/**
|
|
95
|
+
* Waits for the host to send the initialization handshake.
|
|
96
|
+
*/
|
|
97
|
+
waitForHost(timeout: number, tag: string, onError: (error: Error) => void): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Sets up host message handlers.
|
|
100
|
+
*/
|
|
101
|
+
setupMessageHandlers(handlers: ConsumerTransportHandlers<X>): void;
|
|
102
|
+
/**
|
|
103
|
+
* Destroys transport resources.
|
|
104
|
+
*/
|
|
105
|
+
destroy(): void;
|
|
106
|
+
}
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentOptions, Dimensions, PropsDefinition } from '../../types';
|
|
2
|
+
import type { ContextType } from '../../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Normalized and validated component options.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export interface NormalizedOptions<P extends Record<string, unknown>> {
|
|
8
|
+
tag: string;
|
|
9
|
+
url: string | ((props: P) => string);
|
|
10
|
+
props: PropsDefinition<P>;
|
|
11
|
+
defaultContext: ContextType;
|
|
12
|
+
dimensions: Dimensions | ((props: P) => Dimensions);
|
|
13
|
+
timeout: number;
|
|
14
|
+
domain?: ComponentOptions<P>['domain'];
|
|
15
|
+
allowedConsumerDomains?: ComponentOptions<P>['allowedConsumerDomains'];
|
|
16
|
+
containerTemplate?: ComponentOptions<P>['containerTemplate'];
|
|
17
|
+
prerenderTemplate?: ComponentOptions<P>['prerenderTemplate'];
|
|
18
|
+
eligible?: ComponentOptions<P>['eligible'];
|
|
19
|
+
validate?: ComponentOptions<P>['validate'];
|
|
20
|
+
attributes?: ComponentOptions<P>['attributes'];
|
|
21
|
+
style?: ComponentOptions<P>['style'];
|
|
22
|
+
autoResize?: ComponentOptions<P>['autoResize'];
|
|
23
|
+
children?: ComponentOptions<P>['children'];
|
|
24
|
+
}
|
package/dist/core/consumer.d.ts
CHANGED
|
@@ -14,9 +14,8 @@ import { EventEmitter } from '../events/emitter';
|
|
|
14
14
|
* Consumer-side component implementation.
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
|
-
* This class
|
|
18
|
-
*
|
|
19
|
-
* the host window via postMessage, and managing component state.
|
|
17
|
+
* This class coordinates focused subsystems for rendering, transport, and
|
|
18
|
+
* prop synchronization while preserving the existing public API.
|
|
20
19
|
*
|
|
21
20
|
* @typeParam P - The props type passed to the component
|
|
22
21
|
* @typeParam X - The exports type that the host can expose to the consumer
|
|
@@ -48,39 +47,67 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
48
47
|
/** @internal */
|
|
49
48
|
private options;
|
|
50
49
|
/** @internal */
|
|
51
|
-
private
|
|
50
|
+
private cleanup;
|
|
52
51
|
/** @internal */
|
|
53
|
-
private
|
|
52
|
+
private transport;
|
|
54
53
|
/** @internal */
|
|
55
|
-
private
|
|
54
|
+
private renderer;
|
|
56
55
|
/** @internal */
|
|
57
|
-
private
|
|
56
|
+
private propsPipeline;
|
|
58
57
|
/** @internal */
|
|
59
|
-
private
|
|
58
|
+
private rendered;
|
|
60
59
|
/** @internal */
|
|
61
|
-
private
|
|
60
|
+
private destroyed;
|
|
62
61
|
/** @internal */
|
|
63
|
-
private
|
|
62
|
+
private closing;
|
|
64
63
|
/** @internal */
|
|
65
|
-
private
|
|
64
|
+
private get props();
|
|
66
65
|
/** @internal */
|
|
67
|
-
private
|
|
66
|
+
private set props(value);
|
|
68
67
|
/** @internal */
|
|
69
|
-
private
|
|
68
|
+
private get inputProps();
|
|
70
69
|
/** @internal */
|
|
71
|
-
private
|
|
70
|
+
private set inputProps(value);
|
|
72
71
|
/** @internal */
|
|
73
|
-
private
|
|
72
|
+
private get pendingPropsUpdate();
|
|
74
73
|
/** @internal */
|
|
75
|
-
private
|
|
74
|
+
private set pendingPropsUpdate(value);
|
|
76
75
|
/** @internal */
|
|
77
|
-
private
|
|
76
|
+
private get context();
|
|
78
77
|
/** @internal */
|
|
79
|
-
private
|
|
78
|
+
private set context(value);
|
|
80
79
|
/** @internal */
|
|
81
|
-
private
|
|
80
|
+
private get hostWindow();
|
|
81
|
+
/** @internal */
|
|
82
|
+
private set hostWindow(value);
|
|
83
|
+
/** @internal */
|
|
84
|
+
private get openedHostDomain();
|
|
85
|
+
/** @internal */
|
|
86
|
+
private set openedHostDomain(value);
|
|
87
|
+
/** @internal */
|
|
88
|
+
private get dynamicUrlTrustedOrigin();
|
|
89
|
+
/** @internal */
|
|
90
|
+
private set dynamicUrlTrustedOrigin(value);
|
|
91
|
+
/** @internal */
|
|
92
|
+
private get iframe();
|
|
93
|
+
/** @internal */
|
|
94
|
+
private set iframe(value);
|
|
95
|
+
/** @internal */
|
|
96
|
+
private get container();
|
|
97
|
+
/** @internal */
|
|
98
|
+
private set container(value);
|
|
99
|
+
/** @internal */
|
|
100
|
+
private get initPromise();
|
|
101
|
+
/** @internal */
|
|
102
|
+
private set initPromise(value);
|
|
103
|
+
/** @internal */
|
|
104
|
+
private get hostInitialized();
|
|
105
|
+
/** @internal */
|
|
106
|
+
private set hostInitialized(value);
|
|
82
107
|
/** @internal */
|
|
83
|
-
private
|
|
108
|
+
private get messenger();
|
|
109
|
+
/** @internal */
|
|
110
|
+
private get bridge();
|
|
84
111
|
/**
|
|
85
112
|
* Creates a new ConsumerComponent instance.
|
|
86
113
|
*
|
|
@@ -88,11 +115,6 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
88
115
|
* @param props - Initial props to pass to the component
|
|
89
116
|
*/
|
|
90
117
|
constructor(options: ComponentOptions<P>, props?: Partial<P>);
|
|
91
|
-
/**
|
|
92
|
-
* Builds the list of trusted domains for messenger communication.
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
private buildTrustedDomains;
|
|
96
118
|
/**
|
|
97
119
|
* Renders the component into a DOM container.
|
|
98
120
|
*
|
|
@@ -116,14 +138,14 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
116
138
|
* Renders the component into a container in a different window.
|
|
117
139
|
*
|
|
118
140
|
* @remarks
|
|
119
|
-
*
|
|
120
|
-
*
|
|
141
|
+
* Only rendering into the current window is supported. Passing a
|
|
142
|
+
* different window throws explicitly to prevent silent misuse.
|
|
121
143
|
*
|
|
122
|
-
* @param
|
|
144
|
+
* @param win - Target window
|
|
123
145
|
* @param container - CSS selector or HTMLElement to render into
|
|
124
146
|
* @param context - Override the default rendering context
|
|
125
147
|
*/
|
|
126
|
-
renderTo(
|
|
148
|
+
renderTo(win: Window, container?: string | HTMLElement, context?: ContextType): Promise<void>;
|
|
127
149
|
/**
|
|
128
150
|
* Closes and destroys the component.
|
|
129
151
|
*
|
|
@@ -172,11 +194,6 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
172
194
|
* @internal
|
|
173
195
|
*/
|
|
174
196
|
private applyPropsUpdate;
|
|
175
|
-
/**
|
|
176
|
-
* Builds and validates the next props snapshot.
|
|
177
|
-
* @internal
|
|
178
|
-
*/
|
|
179
|
-
private buildNextProps;
|
|
180
197
|
/**
|
|
181
198
|
* Prevents origin changes after render for security and routing consistency.
|
|
182
199
|
* @internal
|
|
@@ -192,21 +209,6 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
192
209
|
* @internal
|
|
193
210
|
*/
|
|
194
211
|
private emitPropsUpdated;
|
|
195
|
-
/**
|
|
196
|
-
* Queues prop updates when a previous host sync is in flight.
|
|
197
|
-
* @internal
|
|
198
|
-
*/
|
|
199
|
-
private queuePropsUpdate;
|
|
200
|
-
/**
|
|
201
|
-
* Tracks pending updates only when host synchronization is active.
|
|
202
|
-
* @internal
|
|
203
|
-
*/
|
|
204
|
-
private trackPendingUpdateIfHostConnected;
|
|
205
|
-
/**
|
|
206
|
-
* Tracks a promise as the active queued update and clears it when settled.
|
|
207
|
-
* @internal
|
|
208
|
-
*/
|
|
209
|
-
private trackPendingUpdate;
|
|
210
212
|
/**
|
|
211
213
|
* Creates a clone of this instance with the same props.
|
|
212
214
|
*
|
|
@@ -300,11 +302,6 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
300
302
|
* @internal
|
|
301
303
|
*/
|
|
302
304
|
private buildWindowName;
|
|
303
|
-
/**
|
|
304
|
-
* Serializes host props while keeping function bridge references in sync.
|
|
305
|
-
* @internal
|
|
306
|
-
*/
|
|
307
|
-
private serializePropsForHost;
|
|
308
305
|
/**
|
|
309
306
|
* Builds component references for nested host components.
|
|
310
307
|
* @internal
|
|
@@ -331,15 +328,15 @@ export declare class ConsumerComponent<P extends Record<string, unknown>, X = un
|
|
|
331
328
|
*/
|
|
332
329
|
private setupMessageHandlers;
|
|
333
330
|
/**
|
|
334
|
-
*
|
|
331
|
+
* Synchronizes sameDomain props after the host proves its loaded origin via INIT.
|
|
335
332
|
* @internal
|
|
336
333
|
*/
|
|
337
|
-
private
|
|
334
|
+
private syncSameDomainPropsAfterInit;
|
|
338
335
|
/**
|
|
339
|
-
*
|
|
336
|
+
* Returns true when any prop definition is restricted to same-origin hosts.
|
|
340
337
|
* @internal
|
|
341
338
|
*/
|
|
342
|
-
private
|
|
339
|
+
private hasSameDomainPropDefinition;
|
|
343
340
|
/**
|
|
344
341
|
* Gets sibling component instances for a request.
|
|
345
342
|
* @internal
|
package/dist/core/host.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export declare class HostComponent<P extends Record<string, unknown>> {
|
|
|
47
47
|
/** @internal */
|
|
48
48
|
private consumerDomain;
|
|
49
49
|
/** @internal */
|
|
50
|
+
private consumerDomainVerified;
|
|
51
|
+
/** @internal */
|
|
50
52
|
private messenger;
|
|
51
53
|
/** @internal */
|
|
52
54
|
private bridge;
|
|
@@ -93,6 +95,42 @@ export declare class HostComponent<P extends Record<string, unknown>> {
|
|
|
93
95
|
* @internal
|
|
94
96
|
*/
|
|
95
97
|
private validateConsumerDomain;
|
|
98
|
+
/**
|
|
99
|
+
* Reads a browser-verifiable consumer origin when available.
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
private getVerifiedConsumerOrigin;
|
|
103
|
+
/**
|
|
104
|
+
* Updates the tracked consumer origin and keeps trusted messaging origins in sync.
|
|
105
|
+
* @internal
|
|
106
|
+
*/
|
|
107
|
+
private setConsumerDomain;
|
|
108
|
+
/**
|
|
109
|
+
* Applies host configuration that may arrive after deferred pre-initialization.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
applyHostConfiguration(propDefinitions?: PropsDefinition<P>, allowedConsumerDomains?: DomainMatcher): void;
|
|
113
|
+
/**
|
|
114
|
+
* Resolves the consumer origin from browser-provided context and falls back to the
|
|
115
|
+
* claimed bootstrap origin only when no explicit allowlist is configured.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
private resolveConsumerDomain;
|
|
119
|
+
/**
|
|
120
|
+
* Rechecks allowlist constraints against a browser-verified consumer origin.
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
assertAllowedConsumerDomain(allowedConsumerDomains: DomainMatcher): void;
|
|
124
|
+
/**
|
|
125
|
+
* Reads the consumer origin from the browser-provided referrer when available.
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
private getReferrerOrigin;
|
|
129
|
+
/**
|
|
130
|
+
* Reads the consumer origin directly when same-origin access is available.
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
private getAccessibleConsumerOrigin;
|
|
96
134
|
/**
|
|
97
135
|
* Returns the hostProps object.
|
|
98
136
|
*
|
|
@@ -109,6 +147,12 @@ export declare class HostComponent<P extends Record<string, unknown>> {
|
|
|
109
147
|
* @internal
|
|
110
148
|
*/
|
|
111
149
|
private buildHostProps;
|
|
150
|
+
/**
|
|
151
|
+
* Relaxes required sameDomain props during bootstrap for verified same-origin hosts.
|
|
152
|
+
* Those props are synchronized after INIT through the live messaging channel.
|
|
153
|
+
* @internal
|
|
154
|
+
*/
|
|
155
|
+
private getBootstrapValidationDefinitions;
|
|
112
156
|
/**
|
|
113
157
|
* Sends initialization message to the consumer.
|
|
114
158
|
* @internal
|