@markupai/sidebar-adapter 0.0.23 → 1.0.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 (51) hide show
  1. package/README.md +38 -21
  2. package/dist/adapters/index.d.ts +3 -0
  3. package/dist/adapters/index.d.ts.map +1 -0
  4. package/dist/adapters/pluginAdapter.d.ts +73 -0
  5. package/dist/adapters/pluginAdapter.d.ts.map +1 -0
  6. package/dist/adapters/sidebarAdapter.d.ts +43 -0
  7. package/dist/adapters/sidebarAdapter.d.ts.map +1 -0
  8. package/dist/errors.d.ts +48 -0
  9. package/dist/errors.d.ts.map +1 -0
  10. package/dist/index.d.ts +7 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/ipc/call-signatures.d.ts +64 -0
  13. package/dist/ipc/call-signatures.d.ts.map +1 -0
  14. package/dist/ipc/deferred-promise.d.ts +49 -0
  15. package/dist/ipc/deferred-promise.d.ts.map +1 -0
  16. package/dist/ipc/index.d.ts +9 -0
  17. package/dist/ipc/index.d.ts.map +1 -0
  18. package/dist/ipc/ipc-core.d.ts +72 -0
  19. package/dist/ipc/ipc-core.d.ts.map +1 -0
  20. package/dist/ipc/message-types.d.ts +57 -0
  21. package/dist/ipc/message-types.d.ts.map +1 -0
  22. package/dist/ipc/plugin-ipc-adapter.d.ts +77 -0
  23. package/dist/ipc/plugin-ipc-adapter.d.ts.map +1 -0
  24. package/dist/ipc/sidebar-ipc-adapter.d.ts +38 -0
  25. package/dist/ipc/sidebar-ipc-adapter.d.ts.map +1 -0
  26. package/dist/load-overlay/index.d.ts +2 -0
  27. package/dist/load-overlay/index.d.ts.map +1 -0
  28. package/dist/load-overlay/loadOverlayDom.d.ts +5 -0
  29. package/dist/load-overlay/loadOverlayDom.d.ts.map +1 -0
  30. package/dist/load-overlay/loadOverlayStyles.d.ts +3 -0
  31. package/dist/load-overlay/loadOverlayStyles.d.ts.map +1 -0
  32. package/dist/load-overlay/sidebarLoadOverlay.d.ts +14 -0
  33. package/dist/load-overlay/sidebarLoadOverlay.d.ts.map +1 -0
  34. package/dist/main.js +289 -517
  35. package/dist/main.umd.cjs +12 -12
  36. package/dist/sidebar-host/createSidebarHost.d.ts +84 -0
  37. package/dist/sidebar-host/createSidebarHost.d.ts.map +1 -0
  38. package/dist/sidebar-host/index.d.ts +3 -0
  39. package/dist/sidebar-host/index.d.ts.map +1 -0
  40. package/dist/sidebar-host/sidebarHostShell.d.ts +56 -0
  41. package/dist/sidebar-host/sidebarHostShell.d.ts.map +1 -0
  42. package/dist/types/common.d.ts +95 -0
  43. package/dist/types/common.d.ts.map +1 -0
  44. package/dist/types/index.d.ts +4 -0
  45. package/dist/types/index.d.ts.map +1 -0
  46. package/dist/types/pluginInterface.d.ts +70 -0
  47. package/dist/types/pluginInterface.d.ts.map +1 -0
  48. package/dist/types/sidebarInterface.d.ts +41 -0
  49. package/dist/types/sidebarInterface.d.ts.map +1 -0
  50. package/package.json +5 -5
  51. package/dist/main.d.ts +0 -888
@@ -0,0 +1,77 @@
1
+ import type { CallOptions, IPCConfig } from "../ipc/message-types";
2
+ import type { ContentRange, ContentReplacement, ContentInfo, SidebarConfig, AgenticIssuePayload } from "../types/common";
3
+ import type { SidebarInterface } from "../types/sidebarInterface";
4
+ /**
5
+ * PluginIPCAdapter - Used in the Sidebar to communicate with the Plugin in the editor
6
+ * Provides async methods to call plugin functions
7
+ *
8
+ * Primarily uses PULL pattern where Sidebar initiates calls.
9
+ * Optional SidebarInterface parameter allows Plugin → Sidebar callbacks if needed.
10
+ */
11
+ export declare class PluginIPCAdapter {
12
+ private readonly ipc;
13
+ private readonly sidebar;
14
+ private targetOrigin;
15
+ constructor(sidebar?: SidebarInterface, config?: IPCConfig, targetOrigin?: string);
16
+ private readonly handleMessage;
17
+ private registerReceivers;
18
+ /**
19
+ * Request initialization configuration from the editor
20
+ */
21
+ getInitConfig(): Promise<SidebarConfig>;
22
+ /**
23
+ * Request content from the editor in whatever format the integration supports
24
+ * @param options - Optional per-call overrides (e.g. timeout in ms; overrides default IPC timeout)
25
+ */
26
+ getContent(options?: CallOptions): Promise<ContentInfo>;
27
+ /**
28
+ * Request selected content from the editor in whatever format the integration supports
29
+ * @param options - Optional per-call overrides (e.g. timeout in ms; overrides default IPC timeout)
30
+ */
31
+ getSelectedContent(options?: CallOptions): Promise<ContentInfo>;
32
+ /**
33
+ * Replace content in the editor
34
+ */
35
+ replaceContent(suggestion: string, range: ContentRange): Promise<void>;
36
+ /**
37
+ * Select content in the editor
38
+ */
39
+ selectContent(range: ContentRange): Promise<void>;
40
+ /**
41
+ * Show a dialog in the editor
42
+ */
43
+ showDialog(dialogHtml: string, width?: number, height?: number, title?: string): Promise<void>;
44
+ /**
45
+ * Close the dialog in the editor
46
+ */
47
+ closeDialog(): Promise<void>;
48
+ /**
49
+ * Replace multiple contents in the editor
50
+ */
51
+ replaceMultipleContents(replacements: ContentReplacement[]): Promise<void>;
52
+ /**
53
+ * Notify plugin that one agent's results are available (streaming).
54
+ */
55
+ onAgenticAgentResults(agentName: string, issues: AgenticIssuePayload[]): Promise<void>;
56
+ /**
57
+ * Notify plugin that the agentic stream has finished.
58
+ */
59
+ onAgenticStreamComplete(): Promise<void>;
60
+ /**
61
+ * Update IPC configuration
62
+ */
63
+ configure(config: IPCConfig): void;
64
+ /**
65
+ * Set or update the target origin for postMessage communication
66
+ */
67
+ setTargetOrigin(targetOrigin: string): void;
68
+ /**
69
+ * Get the current target origin
70
+ */
71
+ getTargetOrigin(): string;
72
+ /**
73
+ * Cleanup and destroy the adapter
74
+ */
75
+ destroy(): void;
76
+ }
77
+ //# sourceMappingURL=plugin-ipc-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/plugin-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAc,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,E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AAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAAE,GAC5B,OAAO,CAAC,IAAI,CAAC;IAIhB;;OAEG;IACU,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrD;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC;;OAEG;IACI,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAkBlD;;OAEG;IACI,eAAe,IAAI,MAAM;IAIhC;;OAEG;IACI,OAAO,IAAI,IAAI;CAKvB"}
@@ -0,0 +1,38 @@
1
+ import type { IPCConfig } from "../ipc/message-types";
2
+ import type { PluginInterface } from "../types/pluginInterface";
3
+ /**
4
+ * SidebarIPCAdapter - Used in the Plugin to communicate with the Sidebar in the iframe
5
+ * Provides async methods to call sidebar functions and registers receivers for plugin functions
6
+ */
7
+ export declare class SidebarIPCAdapter {
8
+ private readonly ipc;
9
+ private readonly plugin;
10
+ private readonly iframe;
11
+ private readonly window;
12
+ private readonly targetOrigin;
13
+ constructor(plugin: PluginInterface, iframe: HTMLIFrameElement, win?: Window, config?: IPCConfig, targetOrigin?: string);
14
+ private readonly handleMessage;
15
+ private registerReceivers;
16
+ /**
17
+ * Request sidebar to activate (expand and scroll to) the card for the given issue.
18
+ */
19
+ activateAgenticIssue(issueId: string): Promise<void>;
20
+ /**
21
+ * Request sidebar to invalidate (dismiss) the card for the given issue.
22
+ */
23
+ invalidateAgenticIssue(issueId: string): Promise<void>;
24
+ /**
25
+ * Notify sidebar of plugin status changes
26
+ * Example method demonstrating Plugin → Sidebar communication
27
+ */
28
+ notifyPluginStatus(status: string): Promise<void>;
29
+ /**
30
+ * Update IPC configuration
31
+ */
32
+ configure(config: IPCConfig): void;
33
+ /**
34
+ * Cleanup and destroy the adapter
35
+ */
36
+ destroy(): void;
37
+ }
38
+ //# sourceMappingURL=sidebar-ipc-adapter.d.ts.map
@@ -0,0 +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;AAEjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAGpC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,iBAAiB,EACzB,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,SAAS,EAClB,YAAY,GAAE,MAAY;IAqB5B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAqB5B;IAEF,OAAO,CAAC,iBAAiB;IAqEzB;;OAEG;IACU,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjE;;OAEG;IACU,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE;;;OAGG;IACU,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9D;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC;;OAEG;IACI,OAAO,IAAI,IAAI;CAKvB"}
@@ -0,0 +1,2 @@
1
+ export { setupSidebarLoadOverlay, type SidebarLoadOverlayOptions } from "./sidebarLoadOverlay";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/load-overlay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const buildLoadOverlay: () => {
2
+ overlay: HTMLDivElement;
3
+ button: HTMLButtonElement;
4
+ };
5
+ //# sourceMappingURL=loadOverlayDom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadOverlayDom.d.ts","sourceRoot":"","sources":["../../src/load-overlay/loadOverlayDom.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,gBAAgB;;;CAY5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** When omitted, styles are injected into the global `document` (original behavior). */
2
+ export declare const injectSidebarLoadOverlayStyles: (targetDocument?: Document) => void;
3
+ //# sourceMappingURL=loadOverlayStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadOverlayStyles.d.ts","sourceRoot":"","sources":["../../src/load-overlay/loadOverlayStyles.ts"],"names":[],"mappings":"AAgGA,wFAAwF;AACxF,eAAO,MAAM,8BAA8B,GAAI,iBAAiB,QAAQ,SAOvE,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type SidebarLoadOverlayOptions = {
2
+ sidebarUrl?: string;
3
+ targetOrigin?: string;
4
+ timeoutMs?: number;
5
+ retryIntervalMs?: number;
6
+ /**
7
+ * Window that receives `message` events from the sidebar iframe (typically `iframe.contentWindow`'s parent).
8
+ * Use the iframe's parent `Window` when the iframe is not a direct child of the host page (e.g. undocked popup).
9
+ * Defaults to the global `window` (the page that called `setupSidebarLoadOverlay`).
10
+ */
11
+ messageListenWindow?: Window;
12
+ };
13
+ export declare const setupSidebarLoadOverlay: (container: HTMLElement, iframe: HTMLIFrameElement, options?: SidebarLoadOverlayOptions) => () => void;
14
+ //# sourceMappingURL=sidebarLoadOverlay.d.ts.map
@@ -0,0 +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"}