@markupai/sidebar-adapter 1.5.3 → 2.1.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/README.md +45 -21
- package/asyncapi.json +47 -152
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/pluginAdapter.d.ts +5 -10
- package/dist/adapters/pluginAdapter.d.ts.map +1 -1
- package/dist/adapters/sidebarAdapter.d.ts +10 -1
- package/dist/adapters/sidebarAdapter.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/ipc/call-signatures.d.ts +6 -11
- package/dist/ipc/call-signatures.d.ts.map +1 -1
- package/dist/ipc/index.d.ts +8 -8
- package/dist/ipc/ipc-core.d.ts +2 -2
- package/dist/ipc/plugin-ipc-adapter.d.ts +6 -11
- package/dist/ipc/plugin-ipc-adapter.d.ts.map +1 -1
- package/dist/ipc/sidebar-build-info.d.ts +22 -0
- package/dist/ipc/sidebar-build-info.d.ts.map +1 -0
- package/dist/ipc/sidebar-ipc-adapter.d.ts +10 -2
- package/dist/ipc/sidebar-ipc-adapter.d.ts.map +1 -1
- package/dist/load-overlay/sidebarLoadOverlay.d.ts +11 -0
- package/dist/load-overlay/sidebarLoadOverlay.d.ts.map +1 -1
- package/dist/main.js +257 -245
- package/dist/main.umd.cjs +6 -6
- package/dist/types/common.d.ts +27 -14
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/pluginInterface.d.ts +15 -26
- package/dist/types/pluginInterface.d.ts.map +1 -1
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SidebarBuildInfo } from "../types/common";
|
|
2
|
+
/** Longest string kept from a sidebar build report; longer values are truncated. */
|
|
3
|
+
export declare const SIDEBAR_BUILD_INFO_MAX_STRING_LENGTH = 64;
|
|
4
|
+
/**
|
|
5
|
+
* Validate the build report a sidebar sent with `getInitConfig`. It crosses a
|
|
6
|
+
* frame boundary, so it is treated as untrusted: only a plain object is
|
|
7
|
+
* accepted, fields of the wrong type are dropped, strings are truncated to
|
|
8
|
+
* {@link SIDEBAR_BUILD_INFO_MAX_STRING_LENGTH} characters, and unknown fields
|
|
9
|
+
* are discarded.
|
|
10
|
+
*
|
|
11
|
+
* @returns The sanitized report, or `null` when there is no report or it lacks
|
|
12
|
+
* a usable `version` or `commitHash`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizeSidebarBuildInfo(raw: unknown): SidebarBuildInfo | null;
|
|
15
|
+
/**
|
|
16
|
+
* The adapter's development/test log line for one `getInitConfig` request
|
|
17
|
+
* (stripped from the published build), e.g.
|
|
18
|
+
* `getInitConfig from sidebar v2.0.2 (abc1234, sw-controlled, auto update mode,
|
|
19
|
+
* sidebar adapter 2.1.0, host adapter 2.1.0)`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function describeSidebarBuildInfo(info: SidebarBuildInfo | null, hostAdapterVersion: string): string;
|
|
22
|
+
//# sourceMappingURL=sidebar-build-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-build-info.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-build-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,oFAAoF;AACpF,eAAO,MAAM,oCAAoC,KAAK,CAAC;AAUvD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAgB9E;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAC7B,kBAAkB,EAAE,MAAM,GACzB,MAAM,CAYR"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IPCConfig } from "
|
|
2
|
-
import type { PluginStatusType } from "../types/common";
|
|
1
|
+
import type { IPCConfig } from "./message-types";
|
|
2
|
+
import type { PluginStatusType, SidebarBuildInfo } from "../types/common";
|
|
3
3
|
import type { IntegrationSettingsPatch, IntegrationSettingsSnapshot } from "../types/integrationSettings";
|
|
4
4
|
import type { PluginInterface } from "../types/pluginInterface";
|
|
5
5
|
/**
|
|
@@ -12,6 +12,7 @@ export declare class SidebarIPCAdapter {
|
|
|
12
12
|
private readonly iframe;
|
|
13
13
|
private readonly window;
|
|
14
14
|
private readonly targetOrigin;
|
|
15
|
+
private latestSidebarBuildInfo;
|
|
15
16
|
constructor(plugin: PluginInterface, iframe: HTMLIFrameElement, win?: Window, config?: IPCConfig, targetOrigin?: string);
|
|
16
17
|
private readonly handleMessage;
|
|
17
18
|
private registerReceivers;
|
|
@@ -55,6 +56,13 @@ export declare class SidebarIPCAdapter {
|
|
|
55
56
|
* currently active. No-op if the sidebar has not registered a handler.
|
|
56
57
|
*/
|
|
57
58
|
notifyActiveDocumentChanged(documentReference: string | null): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* The sidebar build reported with the most recent `getInitConfig` request,
|
|
61
|
+
* sanitized. `null` before the sidebar's first request, and when the latest
|
|
62
|
+
* request carried no valid report (a sidebar that predates build
|
|
63
|
+
* reporting). Replaced on every request, so it tracks sidebar reloads.
|
|
64
|
+
*/
|
|
65
|
+
getSidebarBuildInfo(): SidebarBuildInfo | null;
|
|
58
66
|
/**
|
|
59
67
|
* Update IPC configuration
|
|
60
68
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS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vF;;OAEG;IACU,wBAAwB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrF;;OAEG;IACU,sBAAsB,IAAI,OAAO,CAAC,2BAA2B,CAAC;IAK3E;;;;OAIG;IACU,2BAA2B,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzF;;;;;OAKG;IACI,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IAIrD;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC;;OAEG;IACI,OAAO,IAAI,IAAI;CAKvB"}
|
|
@@ -10,5 +10,16 @@ export type SidebarLoadOverlayOptions = {
|
|
|
10
10
|
*/
|
|
11
11
|
messageListenWindow?: Window;
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Mounts the sidebar "failed to load / retry" overlay: shows it if no
|
|
15
|
+
* `message` arrives from the iframe within `timeoutMs`, auto-retries every
|
|
16
|
+
* `retryIntervalMs`, and exposes a manual retry button.
|
|
17
|
+
*
|
|
18
|
+
* The sidebar precaches its app shell in a service worker, so warm opens
|
|
19
|
+
* (any host that has loaded it once) rarely trip the timeout. Keep this wired
|
|
20
|
+
* up anyway — it is the recovery path for the first cold open in a host, a
|
|
21
|
+
* host where the service worker cannot register, and a real origin outage.
|
|
22
|
+
* See the adapter README, "SidebarLoadOverlay (Editor UI)".
|
|
23
|
+
*/
|
|
13
24
|
export declare const setupSidebarLoadOverlay: (container: HTMLElement, iframe: HTMLIFrameElement, options?: SidebarLoadOverlayOptions) => () => void;
|
|
14
25
|
//# sourceMappingURL=sidebarLoadOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarLoadOverlay.d.ts","sourceRoot":"","sources":["../../src/load-overlay/sidebarLoadOverlay.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAKF,eAAO,MAAM,uBAAuB,GAClC,WAAW,WAAW,EACtB,QAAQ,iBAAiB,EACzB,UAAS,yBAA8B,eAoHxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"sidebarLoadOverlay.d.ts","sourceRoot":"","sources":["../../src/load-overlay/sidebarLoadOverlay.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAKF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAW,WAAW,EACtB,QAAQ,iBAAiB,EACzB,UAAS,yBAA8B,eAoHxC,CAAC"}
|