@markupai/sidebar-adapter 1.5.3 → 2.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.
- package/README.md +0 -19
- package/asyncapi.json +2 -147
- package/dist/adapters/pluginAdapter.d.ts +0 -8
- package/dist/adapters/pluginAdapter.d.ts.map +1 -1
- package/dist/ipc/call-signatures.d.ts +0 -8
- package/dist/ipc/call-signatures.d.ts.map +1 -1
- package/dist/ipc/plugin-ipc-adapter.d.ts +0 -8
- package/dist/ipc/plugin-ipc-adapter.d.ts.map +1 -1
- package/dist/ipc/sidebar-ipc-adapter.d.ts.map +1 -1
- package/dist/main.js +129 -149
- package/dist/main.umd.cjs +4 -4
- package/dist/types/common.d.ts +0 -14
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/pluginInterface.d.ts +0 -23
- package/dist/types/pluginInterface.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -138,9 +138,6 @@ await adapter.replaceMultipleContents([
|
|
|
138
138
|
{ suggestion: "bar", range: { start: 20, end: 23 } },
|
|
139
139
|
]);
|
|
140
140
|
|
|
141
|
-
// Show a dialog
|
|
142
|
-
adapter.showDialog("<div>Custom dialog content</div>", 400, 300, "My Dialog");
|
|
143
|
-
|
|
144
141
|
// Request initialization
|
|
145
142
|
adapter.requestInit();
|
|
146
143
|
|
|
@@ -195,7 +192,6 @@ const pluginInterface: PluginInterface = {
|
|
|
195
192
|
integrationName: "My Editor",
|
|
196
193
|
integrationVersion: "1.0.0",
|
|
197
194
|
integrationId: "my-editor",
|
|
198
|
-
useCheckPreviewDialog: true,
|
|
199
195
|
supportCheckSelection: true,
|
|
200
196
|
// Optional. Allow the sidebar to run several agents in one check, each
|
|
201
197
|
// cancellable on its own. Defaults to false (Style agent only). The
|
|
@@ -237,18 +233,6 @@ const pluginInterface: PluginInterface = {
|
|
|
237
233
|
console.log("Replace multiple contents:", replacements);
|
|
238
234
|
replaceMultipleContentsInEditor(replacements);
|
|
239
235
|
},
|
|
240
|
-
|
|
241
|
-
// Show a dialog (optional — omit on hosts without dialog support)
|
|
242
|
-
showDialog: async (dialogHtml: string, width?: number, height?: number, title?: string) => {
|
|
243
|
-
console.log("Show dialog:", title);
|
|
244
|
-
showDialogInEditor(dialogHtml, width, height, title);
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
// Close the dialog (optional — omit on hosts without dialog support)
|
|
248
|
-
closeDialog: async () => {
|
|
249
|
-
console.log("Close dialog");
|
|
250
|
-
closeDialogInEditor();
|
|
251
|
-
},
|
|
252
236
|
};
|
|
253
237
|
|
|
254
238
|
// Create the adapter with an iframe reference
|
|
@@ -506,8 +490,6 @@ Implement these **on the host** as async functions. The sidebar calls them over
|
|
|
506
490
|
- `selectContent(range: ContentRange, documentReference?: string | null): Promise<void>` — Focus/highlight the document span `[range.start, range.end)`. `documentReference` names the target document for multi-document hosts; omitted/`null` means "whichever document is currently active" (the single-document default — see [Multi-document hosts](#multi-document-hosts))
|
|
507
491
|
- `replaceContent(suggestion: string, range: ContentRange, documentReference?: string | null): Promise<void>` — Apply a single edit to `[range.start, range.end)`. Same `documentReference` rule as `selectContent`
|
|
508
492
|
- `replaceMultipleContents(replacements: ContentReplacement[]): Promise<void>` — Batch edits, always against the currently active document (no per-item `documentReference`)
|
|
509
|
-
- `showDialog?(dialogHtml: string, width?: number, height?: number, title?: string): Promise<void>` — Host-rendered dialog chrome around HTML from the sidebar. **Optional** — omit on hosts without dialog support (also leave `useCheckPreviewDialog: false`).
|
|
510
|
-
- `closeDialog?(): Promise<void>` — Dismiss that dialog. **Optional**, pairs with `showDialog`.
|
|
511
493
|
|
|
512
494
|
Optional (agentic / streaming flows):
|
|
513
495
|
|
|
@@ -822,7 +804,6 @@ const config: SidebarConfig = {
|
|
|
822
804
|
integrationName: "My Integration",
|
|
823
805
|
integrationVersion: "1.0.0",
|
|
824
806
|
integrationId: "my-integration",
|
|
825
|
-
useCheckPreviewDialog: false,
|
|
826
807
|
integrationSettings: {
|
|
827
808
|
title: "My integration",
|
|
828
809
|
fields: [
|
package/asyncapi.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"asyncapi": "3.0.0",
|
|
3
3
|
"info": {
|
|
4
4
|
"title": "Markup AI Sidebar IPC contract",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "2.0.0",
|
|
6
6
|
"description": "Bidirectional RPC-over-postMessage contract between the Markup AI sidebar and its host. Generated from the @markupai/sidebar-adapter TypeScript types — do not hand-edit."
|
|
7
7
|
},
|
|
8
8
|
"channels": {
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"replaceContent_response": { "$ref": "#/components/messages/replaceContent_response" },
|
|
23
23
|
"selectContent_call": { "$ref": "#/components/messages/selectContent_call" },
|
|
24
24
|
"selectContent_response": { "$ref": "#/components/messages/selectContent_response" },
|
|
25
|
-
"showDialog_call": { "$ref": "#/components/messages/showDialog_call" },
|
|
26
|
-
"showDialog_response": { "$ref": "#/components/messages/showDialog_response" },
|
|
27
|
-
"closeDialog_call": { "$ref": "#/components/messages/closeDialog_call" },
|
|
28
|
-
"closeDialog_response": { "$ref": "#/components/messages/closeDialog_response" },
|
|
29
25
|
"replaceMultipleContents_call": {
|
|
30
26
|
"$ref": "#/components/messages/replaceMultipleContents_call"
|
|
31
27
|
},
|
|
@@ -182,36 +178,6 @@
|
|
|
182
178
|
]
|
|
183
179
|
}
|
|
184
180
|
},
|
|
185
|
-
"showDialog": {
|
|
186
|
-
"action": "send",
|
|
187
|
-
"channel": { "$ref": "#/channels/sidebarToPlugin" },
|
|
188
|
-
"title": "showDialog",
|
|
189
|
-
"description": "Show a dialog in the editor.",
|
|
190
|
-
"x-optional": false,
|
|
191
|
-
"messages": [{ "$ref": "#/channels/sidebarToPlugin/messages/showDialog_call" }],
|
|
192
|
-
"reply": {
|
|
193
|
-
"channel": { "$ref": "#/channels/sidebarToPlugin" },
|
|
194
|
-
"messages": [
|
|
195
|
-
{ "$ref": "#/channels/sidebarToPlugin/messages/showDialog_response" },
|
|
196
|
-
{ "$ref": "#/channels/sidebarToPlugin/messages/ipc_error" }
|
|
197
|
-
]
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"closeDialog": {
|
|
201
|
-
"action": "send",
|
|
202
|
-
"channel": { "$ref": "#/channels/sidebarToPlugin" },
|
|
203
|
-
"title": "closeDialog",
|
|
204
|
-
"description": "Close the editor dialog.",
|
|
205
|
-
"x-optional": false,
|
|
206
|
-
"messages": [{ "$ref": "#/channels/sidebarToPlugin/messages/closeDialog_call" }],
|
|
207
|
-
"reply": {
|
|
208
|
-
"channel": { "$ref": "#/channels/sidebarToPlugin" },
|
|
209
|
-
"messages": [
|
|
210
|
-
{ "$ref": "#/channels/sidebarToPlugin/messages/closeDialog_response" },
|
|
211
|
-
{ "$ref": "#/channels/sidebarToPlugin/messages/ipc_error" }
|
|
212
|
-
]
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
181
|
"replaceMultipleContents": {
|
|
216
182
|
"action": "send",
|
|
217
183
|
"channel": { "$ref": "#/channels/sidebarToPlugin" },
|
|
@@ -652,87 +618,6 @@
|
|
|
652
618
|
}
|
|
653
619
|
}
|
|
654
620
|
},
|
|
655
|
-
"showDialog_call": {
|
|
656
|
-
"name": "showDialog_call",
|
|
657
|
-
"title": "call showDialog",
|
|
658
|
-
"payload": {
|
|
659
|
-
"title": "showDialog_call",
|
|
660
|
-
"type": "object",
|
|
661
|
-
"additionalProperties": false,
|
|
662
|
-
"required": ["type", "id", "name", "data"],
|
|
663
|
-
"properties": {
|
|
664
|
-
"type": { "const": "call" },
|
|
665
|
-
"id": { "type": "integer" },
|
|
666
|
-
"name": { "const": "showDialog" },
|
|
667
|
-
"data": {
|
|
668
|
-
"type": "array",
|
|
669
|
-
"prefixItems": [
|
|
670
|
-
{ "type": "string" },
|
|
671
|
-
{ "type": "number" },
|
|
672
|
-
{ "type": "number" },
|
|
673
|
-
{ "type": "string" }
|
|
674
|
-
],
|
|
675
|
-
"minItems": 1,
|
|
676
|
-
"maxItems": 4,
|
|
677
|
-
"items": false
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
},
|
|
682
|
-
"showDialog_response": {
|
|
683
|
-
"name": "showDialog_response",
|
|
684
|
-
"title": "response showDialog",
|
|
685
|
-
"payload": {
|
|
686
|
-
"title": "showDialog_response",
|
|
687
|
-
"type": "object",
|
|
688
|
-
"additionalProperties": false,
|
|
689
|
-
"required": ["type", "id", "name", "data"],
|
|
690
|
-
"properties": {
|
|
691
|
-
"type": { "const": "response" },
|
|
692
|
-
"id": { "type": "integer" },
|
|
693
|
-
"name": { "const": "showDialog" },
|
|
694
|
-
"data": { "type": "null" }
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
"closeDialog_call": {
|
|
699
|
-
"name": "closeDialog_call",
|
|
700
|
-
"title": "call closeDialog",
|
|
701
|
-
"payload": {
|
|
702
|
-
"title": "closeDialog_call",
|
|
703
|
-
"type": "object",
|
|
704
|
-
"additionalProperties": false,
|
|
705
|
-
"required": ["type", "id", "name", "data"],
|
|
706
|
-
"properties": {
|
|
707
|
-
"type": { "const": "call" },
|
|
708
|
-
"id": { "type": "integer" },
|
|
709
|
-
"name": { "const": "closeDialog" },
|
|
710
|
-
"data": {
|
|
711
|
-
"type": "array",
|
|
712
|
-
"prefixItems": [],
|
|
713
|
-
"minItems": 0,
|
|
714
|
-
"maxItems": 0,
|
|
715
|
-
"items": false
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
},
|
|
720
|
-
"closeDialog_response": {
|
|
721
|
-
"name": "closeDialog_response",
|
|
722
|
-
"title": "response closeDialog",
|
|
723
|
-
"payload": {
|
|
724
|
-
"title": "closeDialog_response",
|
|
725
|
-
"type": "object",
|
|
726
|
-
"additionalProperties": false,
|
|
727
|
-
"required": ["type", "id", "name", "data"],
|
|
728
|
-
"properties": {
|
|
729
|
-
"type": { "const": "response" },
|
|
730
|
-
"id": { "type": "integer" },
|
|
731
|
-
"name": { "const": "closeDialog" },
|
|
732
|
-
"data": { "type": "null" }
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
},
|
|
736
621
|
"replaceMultipleContents_call": {
|
|
737
622
|
"name": "replaceMultipleContents_call",
|
|
738
623
|
"title": "call replaceMultipleContents",
|
|
@@ -1505,18 +1390,10 @@
|
|
|
1505
1390
|
"type": "boolean",
|
|
1506
1391
|
"description": "Hide the promotional/upsell banner the sidebar shows by default. Set `true` for embedded hosts where the banner is inappropriate (e.g. Figma, Office task pane). Defaults to `false` when omitted."
|
|
1507
1392
|
},
|
|
1508
|
-
"dialogClosingScript": {
|
|
1509
|
-
"type": "string",
|
|
1510
|
-
"description": "JavaScript source the sidebar runs inside a host-rendered dialog to close it (see {@link PluginInterface.showDialog } /`closeDialog`). Lets hosts that render dialog chrome themselves supply the exact close call for their environment (e.g. `google.script.host.close();`). Omit when the host closes dialogs through the normal `closeDialog` IPC."
|
|
1511
|
-
},
|
|
1512
1393
|
"pluginOrigin": {
|
|
1513
1394
|
"type": "string",
|
|
1514
1395
|
"description": "Origin of the plugin/editor window where messages should be sent This is the origin where the plugin is listening for messages from the sidebar"
|
|
1515
1396
|
},
|
|
1516
|
-
"useCheckPreviewDialog": {
|
|
1517
|
-
"type": "boolean",
|
|
1518
|
-
"description": "Whether to use the check preview workflow dialog If true, the sidebar will show a check preview dialog where the user can apply issues to the content If false, the sidebar will not show a dialog, but there will be an issue tab on the sidebar from where the user can apply issues"
|
|
1519
|
-
},
|
|
1520
1397
|
"supportCheckSelection": {
|
|
1521
1398
|
"type": "boolean",
|
|
1522
1399
|
"description": "Whether to support selection-based check and rewrite functionality If true or undefined (default), the selection toggle UI will be shown and users can toggle between full content and selection modes If false, the selection toggle UI will be hidden and checkSelectionEnabled will be forced to false"
|
|
@@ -1542,7 +1419,7 @@
|
|
|
1542
1419
|
"description": "Optional declarative schema of host-supplied settings rendered in the sidebar's Settings surface. When omitted, no integration-settings section is rendered and no related IPC traffic is emitted.\n\nSee `@markupai/sidebar-adapter` README → \"Integration settings\" for the shape and lifecycle."
|
|
1543
1420
|
}
|
|
1544
1421
|
},
|
|
1545
|
-
"required": ["integrationName", "integrationVersion"
|
|
1422
|
+
"required": ["integrationName", "integrationVersion"],
|
|
1546
1423
|
"additionalProperties": false,
|
|
1547
1424
|
"description": "Configuration for the sidebar",
|
|
1548
1425
|
"title": "SidebarConfig"
|
|
@@ -1700,28 +1577,6 @@
|
|
|
1700
1577
|
},
|
|
1701
1578
|
"description": "Select or highlight content in the editor using document character offsets only."
|
|
1702
1579
|
},
|
|
1703
|
-
"showDialog": {
|
|
1704
|
-
"$comment": "(\n dialogHtml: string,\n width?: number,\n height?: number,\n title?: string) => Promise<void>",
|
|
1705
|
-
"type": "object",
|
|
1706
|
-
"properties": {
|
|
1707
|
-
"namedArgs": {
|
|
1708
|
-
"type": "object",
|
|
1709
|
-
"properties": {
|
|
1710
|
-
"dialogHtml": { "type": "string" },
|
|
1711
|
-
"width": { "type": "number" },
|
|
1712
|
-
"height": { "type": "number" },
|
|
1713
|
-
"title": { "type": "string" }
|
|
1714
|
-
},
|
|
1715
|
-
"required": ["dialogHtml"],
|
|
1716
|
-
"additionalProperties": false
|
|
1717
|
-
}
|
|
1718
|
-
},
|
|
1719
|
-
"description": "Show a dialog in the editor.\n\nOptional: not every host embedding the sidebar has dialog support. Hosts without a dialog surface should omit this method (and `closeDialog`). The sidebar gates dialog workflows behind `SidebarConfig.useCheckPreviewDialog`, so a host that omits these should also leave that flag `false`."
|
|
1720
|
-
},
|
|
1721
|
-
"closeDialog": {
|
|
1722
|
-
"$comment": "() => Promise<void>",
|
|
1723
|
-
"description": "Close the dialog in the editor.\n\nOptional: see `showDialog`. Omit on hosts without dialog support."
|
|
1724
|
-
},
|
|
1725
1580
|
"replaceMultipleContents": {
|
|
1726
1581
|
"$comment": "(replacements: ContentReplacement[]) => Promise<void>",
|
|
1727
1582
|
"type": "object",
|
|
@@ -37,14 +37,6 @@ export declare class PluginAdapter {
|
|
|
37
37
|
* Select content in the editor
|
|
38
38
|
*/
|
|
39
39
|
selectContent(range: ContentRange, documentReference?: string | null): 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
40
|
/**
|
|
49
41
|
* Replace multiple contents in the editor
|
|
50
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/pluginAdapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;gBAElC,OAAO,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,MAAM;IAKjF;;OAEG;IACI,OAAO,IAAI,IAAI;IAKtB;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAKpD;;;OAGG;IACU,UAAU,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAKpE;;;OAGG;IACU,kBAAkB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAK5E;;OAEG;IACU,cAAc,CACzB,UAAU,EAAE,MAAM,E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AAI,CAAC;IAKhB;;OAEG;IACU,uBAAuB,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvF;;OAEG;IACI,qBAAqB,CAC1B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAAE,EAC7B,iBAAiB,GAAE,MAAM,GAAG,IAAW,GACtC,OAAO,CAAC,IAAI,CAAC;IAIhB;;OAEG;IACI,uBAAuB,CAAC,iBAAiB,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAItF;;;;;OAKG;IACI,2BAA2B,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,EAC3C,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;;OAMG;IACI,sBAAsB,CAAC,iBAAiB,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrF;;;;OAIG;IACI,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C;;;;;OAKG;IACI,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;;;OAKG;IACI,2BAA2B,CAChC,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,IAAI,CAAC;IAIhB;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC;;OAEG;IACI,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAIlD;;OAEG;IACI,eAAe,IAAI,MAAM;CAGjC"}
|
|
@@ -29,14 +29,6 @@ export interface CallSignatures {
|
|
|
29
29
|
* @throws {TextLookupError} When the requested text cannot be found or located
|
|
30
30
|
*/
|
|
31
31
|
selectContent(range: ContentRange, documentReference?: string | null): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Show a dialog in the editor
|
|
34
|
-
*/
|
|
35
|
-
showDialog(dialogHtml: string, width?: number, height?: number, title?: string): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Close the dialog in the editor
|
|
38
|
-
*/
|
|
39
|
-
closeDialog(): Promise<void>;
|
|
40
32
|
/**
|
|
41
33
|
* Replace multiple contents in the editor
|
|
42
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-signatures.d.ts","sourceRoot":"","sources":["../../src/ipc/call-signatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAC7B,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAK7B;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAEnC;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,cAAc,CACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAChC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErF;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"call-signatures.d.ts","sourceRoot":"","sources":["../../src/ipc/call-signatures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,gB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 export declare class PluginIPCAdapter {
|
|
|
38
38
|
* Select content in the editor
|
|
39
39
|
*/
|
|
40
40
|
selectContent(range: ContentRange, documentReference?: string | null): Promise<void>;
|
|
41
|
-
/**
|
|
42
|
-
* Show a dialog in the editor
|
|
43
|
-
*/
|
|
44
|
-
showDialog(dialogHtml: string, width?: number, height?: number, title?: string): Promise<void>;
|
|
45
|
-
/**
|
|
46
|
-
* Close the dialog in the editor
|
|
47
|
-
*/
|
|
48
|
-
closeDialog(): Promise<void>;
|
|
49
41
|
/**
|
|
50
42
|
* Replace multiple contents in the editor
|
|
51
43
|
*/
|
|
@@ -1 +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,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAE9B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAU;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,YAAY,GAAE,MAAY;IAkBtF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAqB5B;IAEF,OAAO,CAAC,iBAAiB;IAgFzB;;OAEG;IACU,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAKpD;;;OAGG;IACU,UAAU,CAAC,OAAO,CAAC,E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yB,EACjC,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,IAAI,CAAC;IAIhB;;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"}
|
|
@@ -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;AACjE,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAGV,wBAAwB,EACxB,2BAA2B,EAC5B,MAAM,6BAA6B,CAAC;AACrC,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;
|
|
1
|
+
{"version":3,"file":"sidebar-ipc-adapter.d.ts","sourceRoot":"","sources":["../../src/ipc/sidebar-ipc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,KA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,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;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAIzC;;OAEG;IACI,OAAO,IAAI,IAAI;CAKvB"}
|
package/dist/main.js
CHANGED
|
@@ -10,18 +10,16 @@ var oe = /* @__PURE__ */ (function(e) {
|
|
|
10
10
|
integrationVersion: "unknown",
|
|
11
11
|
integrationId: "markupai-sidebar-app",
|
|
12
12
|
hideBanner: !1,
|
|
13
|
-
dialogClosingScript: void 0,
|
|
14
|
-
useCheckPreviewDialog: !1,
|
|
15
13
|
supportCheckSelection: !0,
|
|
16
14
|
multiAgent: !1,
|
|
17
15
|
multiDocument: !1
|
|
18
16
|
}, ce = (e) => typeof e != "object" || e === null ? !1 : Array.isArray(e.fields), de = (e) => {
|
|
19
17
|
if (typeof e != "object" || e === null) return !1;
|
|
20
18
|
const t = e;
|
|
21
|
-
return typeof t.id != "string" || t.id.length === 0 || typeof t.label != "string" ? !1 : t.type === "boolean" ? typeof t.default == "boolean" : t.type === "enum" ? typeof t.default != "string" || !Array.isArray(t.options) || t.options.length === 0 ? !1 : t.options.every((
|
|
22
|
-
if (typeof
|
|
23
|
-
const
|
|
24
|
-
return typeof
|
|
19
|
+
return typeof t.id != "string" || t.id.length === 0 || typeof t.label != "string" ? !1 : t.type === "boolean" ? typeof t.default == "boolean" : t.type === "enum" ? typeof t.default != "string" || !Array.isArray(t.options) || t.options.length === 0 ? !1 : t.options.every((n) => {
|
|
20
|
+
if (typeof n != "object" || n === null) return !1;
|
|
21
|
+
const r = n;
|
|
22
|
+
return typeof r.value == "string" && typeof r.label == "string";
|
|
25
23
|
}) : !1;
|
|
26
24
|
}, O = class T extends Error {
|
|
27
25
|
name = "TextLookupError";
|
|
@@ -34,20 +32,20 @@ function ge(e) {
|
|
|
34
32
|
}
|
|
35
33
|
var P = { TextLookupError: (e) => new O(e) };
|
|
36
34
|
function U(e) {
|
|
37
|
-
const t = e.message ?? "",
|
|
38
|
-
return
|
|
35
|
+
const t = e.message ?? "", n = e.name, r = typeof n == "string" && n in P ? P[n] : void 0;
|
|
36
|
+
return r ? r(t, e) : Object.assign(new Error(t), n ? { name: n } : {});
|
|
39
37
|
}
|
|
40
|
-
var
|
|
38
|
+
var x = ":", D = /^[a-z][a-z0-9-]*$/;
|
|
41
39
|
function pe(e) {
|
|
42
|
-
const t = e.indexOf(
|
|
43
|
-
return t <= 0 || t === e.length - 1 ? !1 :
|
|
40
|
+
const t = e.indexOf(x);
|
|
41
|
+
return t <= 0 || t === e.length - 1 ? !1 : D.test(e.slice(0, t));
|
|
44
42
|
}
|
|
45
43
|
function ue(e, t) {
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
return
|
|
44
|
+
const n = e.trim().toLowerCase(), r = t.trim();
|
|
45
|
+
if (!D.test(n)) throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);
|
|
46
|
+
if (r.length === 0) throw new Error("Invalid document reference: the document id is empty.");
|
|
47
|
+
const i = `${n}${x}`;
|
|
48
|
+
return r.startsWith(i) ? r : `${i}${r}`;
|
|
51
49
|
}
|
|
52
50
|
var H = class extends Promise {
|
|
53
51
|
static get [Symbol.species]() {
|
|
@@ -57,15 +55,15 @@ var H = class extends Promise {
|
|
|
57
55
|
reject;
|
|
58
56
|
constructor(e = () => {
|
|
59
57
|
}) {
|
|
60
|
-
let t,
|
|
61
|
-
super((
|
|
62
|
-
t =
|
|
63
|
-
}), this.resolve = t, this.reject =
|
|
58
|
+
let t, n;
|
|
59
|
+
super((r, i) => {
|
|
60
|
+
t = r, n = i, e(r, i);
|
|
61
|
+
}), this.resolve = t, this.reject = n;
|
|
64
62
|
}
|
|
65
63
|
}, $ = { timeout: 1e4 };
|
|
66
64
|
function j(e) {
|
|
67
|
-
const t = JSON.stringify(e, Object.getOwnPropertyNames(e)),
|
|
68
|
-
return
|
|
65
|
+
const t = JSON.stringify(e, Object.getOwnPropertyNames(e)), n = JSON.parse(t);
|
|
66
|
+
return n.message === void 0 || n.message === "" ? JSON.stringify({
|
|
69
67
|
message: e instanceof Error ? e.message : String(e),
|
|
70
68
|
name: e instanceof Error ? e.name : void 0
|
|
71
69
|
}) : t;
|
|
@@ -91,24 +89,24 @@ var L = class {
|
|
|
91
89
|
call(e, ...t) {
|
|
92
90
|
return this.callWithOptions(e, {}, ...t);
|
|
93
91
|
}
|
|
94
|
-
callWithOptions(e, t, ...
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
92
|
+
callWithOptions(e, t, ...n) {
|
|
93
|
+
const r = this.currentID++, i = new H(), a = t.timeout ?? this.config.timeout, o = setTimeout(() => {
|
|
94
|
+
if (r in this.promisesByID) {
|
|
97
95
|
const l = /* @__PURE__ */ new Error(`IPC call timeout: "${e}" did not respond within ${String(a)}ms`);
|
|
98
|
-
|
|
96
|
+
i.reject(l), Reflect.deleteProperty(this.promisesByID, r);
|
|
99
97
|
}
|
|
100
98
|
}, a);
|
|
101
|
-
this.promisesByID[
|
|
102
|
-
promise:
|
|
99
|
+
this.promisesByID[r] = {
|
|
100
|
+
promise: i,
|
|
103
101
|
timeoutId: o
|
|
104
102
|
};
|
|
105
103
|
const s = {
|
|
106
104
|
type: "call",
|
|
107
|
-
id:
|
|
105
|
+
id: r,
|
|
108
106
|
name: e,
|
|
109
|
-
data:
|
|
107
|
+
data: n
|
|
110
108
|
};
|
|
111
|
-
return this.postMessage(s),
|
|
109
|
+
return this.postMessage(s), i;
|
|
112
110
|
}
|
|
113
111
|
receive(e, t) {
|
|
114
112
|
this.receiversByName[e] = t;
|
|
@@ -131,27 +129,27 @@ var L = class {
|
|
|
131
129
|
}
|
|
132
130
|
}
|
|
133
131
|
async handleCall(e) {
|
|
134
|
-
const { id: t, name:
|
|
135
|
-
if (!(
|
|
136
|
-
const a = /* @__PURE__ */ new Error(`No receiver registered for: ${
|
|
132
|
+
const { id: t, name: n, data: r } = e;
|
|
133
|
+
if (!(n in this.receiversByName)) {
|
|
134
|
+
const a = /* @__PURE__ */ new Error(`No receiver registered for: ${n}`), o = JSON.stringify({
|
|
137
135
|
message: a.message,
|
|
138
136
|
name: a.name
|
|
139
137
|
});
|
|
140
138
|
this.postMessage({
|
|
141
139
|
type: "error",
|
|
142
140
|
id: t,
|
|
143
|
-
name:
|
|
141
|
+
name: n,
|
|
144
142
|
errorJSON: o
|
|
145
143
|
});
|
|
146
144
|
return;
|
|
147
145
|
}
|
|
148
|
-
const
|
|
146
|
+
const i = this.receiversByName[n];
|
|
149
147
|
try {
|
|
150
|
-
if (!Array.isArray(
|
|
151
|
-
const a = await
|
|
148
|
+
if (!Array.isArray(r)) throw new TypeError(`IPC: Expected array of arguments but got ${typeof r}`);
|
|
149
|
+
const a = await i(...r), o = {
|
|
152
150
|
type: "response",
|
|
153
151
|
id: t,
|
|
154
|
-
name:
|
|
152
|
+
name: n,
|
|
155
153
|
data: a
|
|
156
154
|
};
|
|
157
155
|
this.postMessage(o);
|
|
@@ -159,7 +157,7 @@ var L = class {
|
|
|
159
157
|
const o = {
|
|
160
158
|
type: "error",
|
|
161
159
|
id: t,
|
|
162
|
-
name:
|
|
160
|
+
name: n,
|
|
163
161
|
errorJSON: j(a)
|
|
164
162
|
};
|
|
165
163
|
this.postMessage(o);
|
|
@@ -168,20 +166,20 @@ var L = class {
|
|
|
168
166
|
handleResponse(e) {
|
|
169
167
|
const { id: t } = e;
|
|
170
168
|
if (t in this.promisesByID) {
|
|
171
|
-
const { promise:
|
|
172
|
-
clearTimeout(
|
|
169
|
+
const { promise: n, timeoutId: r } = this.promisesByID[t];
|
|
170
|
+
clearTimeout(r), n.resolve(e.data), Reflect.deleteProperty(this.promisesByID, t);
|
|
173
171
|
}
|
|
174
172
|
}
|
|
175
173
|
handleError(e) {
|
|
176
|
-
const { id: t, errorJSON:
|
|
174
|
+
const { id: t, errorJSON: n } = e;
|
|
177
175
|
if (t in this.promisesByID) {
|
|
178
|
-
const { promise:
|
|
179
|
-
clearTimeout(
|
|
176
|
+
const { promise: r, timeoutId: i } = this.promisesByID[t];
|
|
177
|
+
clearTimeout(i);
|
|
180
178
|
try {
|
|
181
|
-
const a =
|
|
182
|
-
|
|
179
|
+
const a = JSON.parse(n), o = U(a);
|
|
180
|
+
r.reject(o);
|
|
183
181
|
} catch {
|
|
184
|
-
|
|
182
|
+
r.reject(/* @__PURE__ */ new Error("Failed to parse error from IPC"));
|
|
185
183
|
}
|
|
186
184
|
Reflect.deleteProperty(this.promisesByID, t);
|
|
187
185
|
}
|
|
@@ -195,26 +193,26 @@ var L = class {
|
|
|
195
193
|
ipc;
|
|
196
194
|
sidebar;
|
|
197
195
|
targetOrigin;
|
|
198
|
-
constructor(e, t,
|
|
199
|
-
this.sidebar = e || {}, this.targetOrigin =
|
|
200
|
-
window.parent.postMessage(
|
|
196
|
+
constructor(e, t, n = "*") {
|
|
197
|
+
this.sidebar = e || {}, this.targetOrigin = n, this.ipc = new L((r) => {
|
|
198
|
+
window.parent.postMessage(r, this.targetOrigin);
|
|
201
199
|
}, t), window.addEventListener("message", this.handleMessage), this.registerReceivers();
|
|
202
200
|
}
|
|
203
201
|
handleMessage = (e) => {
|
|
204
|
-
const t = globalThis.window.location.origin,
|
|
205
|
-
e.origin !== t && (
|
|
202
|
+
const t = globalThis.window.location.origin, n = this.targetOrigin;
|
|
203
|
+
e.origin !== t && (n !== "*" && e.origin !== n || e.data && typeof e.data == "object" && this.ipc.handleMessage(e.data));
|
|
206
204
|
};
|
|
207
205
|
registerReceivers() {
|
|
208
206
|
if (this.sidebar.onPluginStatusChange) {
|
|
209
207
|
const e = this.sidebar.onPluginStatusChange;
|
|
210
|
-
this.ipc.receive("onPluginStatusChange", async (t,
|
|
211
|
-
await e(t,
|
|
208
|
+
this.ipc.receive("onPluginStatusChange", async (t, n) => {
|
|
209
|
+
await e(t, n);
|
|
212
210
|
});
|
|
213
211
|
}
|
|
214
212
|
if (this.sidebar.activateAgenticIssue) {
|
|
215
213
|
const e = this.sidebar.activateAgenticIssue;
|
|
216
|
-
this.ipc.receive("activateAgenticIssue", async (t,
|
|
217
|
-
await e(t, typeof
|
|
214
|
+
this.ipc.receive("activateAgenticIssue", async (t, n) => {
|
|
215
|
+
await e(t, typeof n == "string" ? n : null);
|
|
218
216
|
});
|
|
219
217
|
}
|
|
220
218
|
if (this.sidebar.invalidateAgenticIssue) {
|
|
@@ -261,29 +259,23 @@ var L = class {
|
|
|
261
259
|
async getSelectedContent(e) {
|
|
262
260
|
return this.ipc.callWithOptions("getSelectedContent", e ?? {});
|
|
263
261
|
}
|
|
264
|
-
async replaceContent(e, t,
|
|
265
|
-
await this.ipc.call("replaceContent", e, t,
|
|
262
|
+
async replaceContent(e, t, n = null) {
|
|
263
|
+
await this.ipc.call("replaceContent", e, t, n);
|
|
266
264
|
}
|
|
267
265
|
async selectContent(e, t = null) {
|
|
268
266
|
await this.ipc.call("selectContent", e, t);
|
|
269
267
|
}
|
|
270
|
-
async showDialog(e, t, i, n) {
|
|
271
|
-
await this.ipc.call("showDialog", e, t, i, n);
|
|
272
|
-
}
|
|
273
|
-
async closeDialog() {
|
|
274
|
-
await this.ipc.call("closeDialog");
|
|
275
|
-
}
|
|
276
268
|
async replaceMultipleContents(e) {
|
|
277
269
|
await this.ipc.call("replaceMultipleContents", e);
|
|
278
270
|
}
|
|
279
|
-
async onAgenticAgentResults(e, t,
|
|
280
|
-
await this.ipc.call("onAgenticAgentResults", e, t,
|
|
271
|
+
async onAgenticAgentResults(e, t, n = null) {
|
|
272
|
+
await this.ipc.call("onAgenticAgentResults", e, t, n);
|
|
281
273
|
}
|
|
282
274
|
async onAgenticStreamComplete(e = null) {
|
|
283
275
|
await this.ipc.call("onAgenticStreamComplete", e);
|
|
284
276
|
}
|
|
285
|
-
async onAgenticIssueStatusChanged(e, t,
|
|
286
|
-
await this.ipc.call("onAgenticIssueStatusChanged", e, t,
|
|
277
|
+
async onAgenticIssueStatusChanged(e, t, n) {
|
|
278
|
+
await this.ipc.call("onAgenticIssueStatusChanged", e, t, n);
|
|
287
279
|
}
|
|
288
280
|
async onAgenticIssuesCleared(e = null) {
|
|
289
281
|
await this.ipc.call("onAgenticIssuesCleared", e);
|
|
@@ -318,8 +310,8 @@ var L = class {
|
|
|
318
310
|
}
|
|
319
311
|
}, he = class {
|
|
320
312
|
ipcAdapter;
|
|
321
|
-
constructor(e, t,
|
|
322
|
-
this.ipcAdapter = new F(e, t,
|
|
313
|
+
constructor(e, t, n) {
|
|
314
|
+
this.ipcAdapter = new F(e, t, n);
|
|
323
315
|
}
|
|
324
316
|
destroy() {
|
|
325
317
|
this.ipcAdapter.destroy();
|
|
@@ -333,29 +325,23 @@ var L = class {
|
|
|
333
325
|
async getSelectedContent(e) {
|
|
334
326
|
return await this.ipcAdapter.getSelectedContent(e);
|
|
335
327
|
}
|
|
336
|
-
async replaceContent(e, t,
|
|
337
|
-
await this.ipcAdapter.replaceContent(e, t,
|
|
328
|
+
async replaceContent(e, t, n = null) {
|
|
329
|
+
await this.ipcAdapter.replaceContent(e, t, n);
|
|
338
330
|
}
|
|
339
331
|
async selectContent(e, t = null) {
|
|
340
332
|
await this.ipcAdapter.selectContent(e, t);
|
|
341
333
|
}
|
|
342
|
-
async showDialog(e, t, i, n) {
|
|
343
|
-
await this.ipcAdapter.showDialog(e, t, i, n);
|
|
344
|
-
}
|
|
345
|
-
async closeDialog() {
|
|
346
|
-
await this.ipcAdapter.closeDialog();
|
|
347
|
-
}
|
|
348
334
|
async replaceMultipleContents(e) {
|
|
349
335
|
await this.ipcAdapter.replaceMultipleContents(e);
|
|
350
336
|
}
|
|
351
|
-
onAgenticAgentResults(e, t,
|
|
352
|
-
return this.ipcAdapter.onAgenticAgentResults(e, t,
|
|
337
|
+
onAgenticAgentResults(e, t, n = null) {
|
|
338
|
+
return this.ipcAdapter.onAgenticAgentResults(e, t, n);
|
|
353
339
|
}
|
|
354
340
|
onAgenticStreamComplete(e = null) {
|
|
355
341
|
return this.ipcAdapter.onAgenticStreamComplete(e);
|
|
356
342
|
}
|
|
357
|
-
onAgenticIssueStatusChanged(e, t,
|
|
358
|
-
return this.ipcAdapter.onAgenticIssueStatusChanged(e, t,
|
|
343
|
+
onAgenticIssueStatusChanged(e, t, n) {
|
|
344
|
+
return this.ipcAdapter.onAgenticIssueStatusChanged(e, t, n);
|
|
359
345
|
}
|
|
360
346
|
onAgenticIssuesCleared(e = null) {
|
|
361
347
|
return this.ipcAdapter.onAgenticIssuesCleared(e);
|
|
@@ -384,41 +370,35 @@ var L = class {
|
|
|
384
370
|
iframe;
|
|
385
371
|
window;
|
|
386
372
|
targetOrigin;
|
|
387
|
-
constructor(e, t,
|
|
388
|
-
this.plugin = e, this.iframe = t, this.window =
|
|
373
|
+
constructor(e, t, n, r, i = "*") {
|
|
374
|
+
this.plugin = e, this.iframe = t, this.window = n ?? window, this.targetOrigin = i, this.ipc = new L((a) => {
|
|
389
375
|
this.iframe.contentWindow?.postMessage(a, this.targetOrigin);
|
|
390
|
-
},
|
|
376
|
+
}, r), this.window.addEventListener("message", this.handleMessage, !1), this.registerReceivers();
|
|
391
377
|
}
|
|
392
378
|
handleMessage = (e) => {
|
|
393
|
-
const t = this.window.location.origin,
|
|
394
|
-
e.origin !== t && (
|
|
379
|
+
const t = this.window.location.origin, n = this.targetOrigin;
|
|
380
|
+
e.origin !== t && (n !== "*" && e.origin !== n || e.data && typeof e.data == "object" && this.ipc.handleMessage(e.data));
|
|
395
381
|
};
|
|
396
382
|
registerReceivers() {
|
|
397
|
-
if (this.ipc.receive("getInitConfig", async () => await this.plugin.getInitConfig()), this.ipc.receive("getContent", async () => await this.plugin.getContent()), this.ipc.receive("getSelectedContent", async () => await this.plugin.getSelectedContent()), this.ipc.receive("replaceContent", async (e, t,
|
|
398
|
-
await this.plugin.replaceContent(e, t, typeof
|
|
383
|
+
if (this.ipc.receive("getInitConfig", async () => await this.plugin.getInitConfig()), this.ipc.receive("getContent", async () => await this.plugin.getContent()), this.ipc.receive("getSelectedContent", async () => await this.plugin.getSelectedContent()), this.ipc.receive("replaceContent", async (e, t, n) => {
|
|
384
|
+
await this.plugin.replaceContent(e, t, typeof n == "string" ? n : null);
|
|
399
385
|
}), this.ipc.receive("selectContent", async (e, t) => {
|
|
400
386
|
await this.plugin.selectContent(e, typeof t == "string" ? t : null);
|
|
401
|
-
}), this.ipc.receive("showDialog", async (e, t, i, n) => {
|
|
402
|
-
if (!this.plugin.showDialog) throw new Error("SidebarIPCAdapter: host does not implement showDialog");
|
|
403
|
-
await this.plugin.showDialog(e, t, i, n);
|
|
404
|
-
}), this.ipc.receive("closeDialog", async () => {
|
|
405
|
-
if (!this.plugin.closeDialog) throw new Error("SidebarIPCAdapter: host does not implement closeDialog");
|
|
406
|
-
await this.plugin.closeDialog();
|
|
407
387
|
}), this.ipc.receive("replaceMultipleContents", async (e) => {
|
|
408
388
|
await this.plugin.replaceMultipleContents(e);
|
|
409
|
-
}), this.ipc.receive("onAgenticAgentResults", async (e, t,
|
|
389
|
+
}), this.ipc.receive("onAgenticAgentResults", async (e, t, n) => {
|
|
410
390
|
if (!Array.isArray(t))
|
|
411
391
|
return;
|
|
412
|
-
const
|
|
413
|
-
|
|
392
|
+
const r = this.plugin.onAgenticAgentResults;
|
|
393
|
+
r && await r(e, t, typeof n == "string" ? n : null);
|
|
414
394
|
}), this.ipc.receive("onAgenticStreamComplete", async (e) => {
|
|
415
395
|
const t = this.plugin.onAgenticStreamComplete;
|
|
416
396
|
t && await t(typeof e == "string" ? e : null);
|
|
417
|
-
}), this.ipc.receive("onAgenticIssueStatusChanged", async (e, t,
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
397
|
+
}), this.ipc.receive("onAgenticIssueStatusChanged", async (e, t, n) => {
|
|
398
|
+
const r = this.plugin.onAgenticIssueStatusChanged;
|
|
399
|
+
if (r && !(t !== "active" && t !== "resolved" && t !== "dismissed" || n !== "user" && n !== "host"))
|
|
420
400
|
try {
|
|
421
|
-
await
|
|
401
|
+
await r(e, t, n);
|
|
422
402
|
} catch {
|
|
423
403
|
}
|
|
424
404
|
}), this.ipc.receive("onAgenticIssuesCleared", async (e) => {
|
|
@@ -442,8 +422,8 @@ var L = class {
|
|
|
442
422
|
}
|
|
443
423
|
if (this.plugin.onIntegrationSettingsChange) {
|
|
444
424
|
const e = this.plugin.onIntegrationSettingsChange;
|
|
445
|
-
this.ipc.receive("onIntegrationSettingsChange", async (t,
|
|
446
|
-
await e(t,
|
|
425
|
+
this.ipc.receive("onIntegrationSettingsChange", async (t, n) => {
|
|
426
|
+
await e(t, n);
|
|
447
427
|
});
|
|
448
428
|
}
|
|
449
429
|
}
|
|
@@ -479,8 +459,8 @@ var L = class {
|
|
|
479
459
|
}
|
|
480
460
|
}, W = class {
|
|
481
461
|
ipcAdapter;
|
|
482
|
-
constructor(e, t,
|
|
483
|
-
this.ipcAdapter = new z(e, t,
|
|
462
|
+
constructor(e, t, n) {
|
|
463
|
+
this.ipcAdapter = new z(e, t, n?.win, n?.config, n?.targetOrigin);
|
|
484
464
|
}
|
|
485
465
|
destroy() {
|
|
486
466
|
this.ipcAdapter.destroy();
|
|
@@ -637,12 +617,12 @@ var L = class {
|
|
|
637
617
|
`, V = (e) => {
|
|
638
618
|
const t = e ?? document;
|
|
639
619
|
if (t.getElementById(E)) return;
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
}, X = 8e3, K = 12e3, q = (e, t,
|
|
620
|
+
const n = t.createElement("style");
|
|
621
|
+
n.id = E, n.textContent = Y, t.head.appendChild(n);
|
|
622
|
+
}, X = 8e3, K = 12e3, q = (e, t, n = {}) => {
|
|
643
623
|
V(e.ownerDocument);
|
|
644
|
-
const { sidebarUrl:
|
|
645
|
-
if (
|
|
624
|
+
const { sidebarUrl: r, targetOrigin: i, timeoutMs: a = X, retryIntervalMs: o = K, messageListenWindow: s } = n, l = s ?? (typeof globalThis.window < "u" ? globalThis.window : globalThis), p = () => r ?? t.src, N = () => {
|
|
625
|
+
if (i) return i;
|
|
646
626
|
try {
|
|
647
627
|
return new URL(p()).origin;
|
|
648
628
|
} catch {
|
|
@@ -674,13 +654,13 @@ var L = class {
|
|
|
674
654
|
if (!t.contentWindow || c.source !== t.contentWindow) return;
|
|
675
655
|
const m = N();
|
|
676
656
|
m !== "*" && c.origin !== m || (u = !0, f(), C(), g(!1));
|
|
677
|
-
}, w = () => {
|
|
678
|
-
f(), g(!0);
|
|
679
657
|
}, S = () => {
|
|
658
|
+
f(), g(!0);
|
|
659
|
+
}, w = () => {
|
|
680
660
|
A();
|
|
681
661
|
};
|
|
682
|
-
return I.addEventListener("click",
|
|
683
|
-
f(), C(), t.removeEventListener("error",
|
|
662
|
+
return I.addEventListener("click", w), t.addEventListener("error", S), l.addEventListener("message", b), v(), B(), () => {
|
|
663
|
+
f(), C(), t.removeEventListener("error", S), l.removeEventListener("message", b), I.removeEventListener("click", w), y.remove();
|
|
684
664
|
};
|
|
685
665
|
}, Z = "Markup AI Sidebar", Q = "clipboard-read; clipboard-write", fe = "markupai.sidebarNextGen.overrideUrl", me = "https://sidebar.markup.ai/";
|
|
686
666
|
function ye(e) {
|
|
@@ -695,10 +675,10 @@ function Ie(e, t) {
|
|
|
695
675
|
if (!t) return e;
|
|
696
676
|
try {
|
|
697
677
|
if (!("localStorage" in globalThis)) return e;
|
|
698
|
-
const
|
|
699
|
-
if (!
|
|
700
|
-
const
|
|
701
|
-
return
|
|
678
|
+
const n = globalThis.localStorage.getItem(ee)?.trim();
|
|
679
|
+
if (!n) return e;
|
|
680
|
+
const r = JSON.parse(n);
|
|
681
|
+
return r !== null && typeof r == "object" && "type" in r && (r.type === "mediation" || r.type === "popup") ? r : e;
|
|
702
682
|
} catch {
|
|
703
683
|
return e;
|
|
704
684
|
}
|
|
@@ -706,23 +686,23 @@ function Ie(e, t) {
|
|
|
706
686
|
function ve(e, t) {
|
|
707
687
|
try {
|
|
708
688
|
return new URL(e).origin;
|
|
709
|
-
} catch (
|
|
710
|
-
return t?.onInvalidUrl?.(e,
|
|
689
|
+
} catch (n) {
|
|
690
|
+
return t?.onInvalidUrl?.(e, n), "*";
|
|
711
691
|
}
|
|
712
692
|
}
|
|
713
693
|
function Ae(e, t = "Expected SidebarAdapter from createSidebarHost") {
|
|
714
694
|
if (e.adapter === null) throw new Error(t);
|
|
715
695
|
}
|
|
716
696
|
function te(e) {
|
|
717
|
-
const { iframe: t, iframeMount:
|
|
718
|
-
if (t !== void 0 &&
|
|
697
|
+
const { iframe: t, iframeMount: n } = e;
|
|
698
|
+
if (t !== void 0 && n !== void 0) throw new Error("createSidebarHost: pass only one of `iframe` or `iframeMount`");
|
|
719
699
|
if (t !== void 0) return {
|
|
720
700
|
iframe: t,
|
|
721
701
|
removeMountedIframe: null
|
|
722
702
|
};
|
|
723
|
-
if (
|
|
724
|
-
const { container:
|
|
725
|
-
return o.title = Z, o.src =
|
|
703
|
+
if (n === void 0) throw new Error("createSidebarHost: pass either `iframe` or `iframeMount`");
|
|
704
|
+
const { container: r, src: i, allow: a = Q } = n, o = document.createElement("iframe");
|
|
705
|
+
return o.title = Z, o.src = i, a && o.setAttribute("allow", a), r.appendChild(o), {
|
|
726
706
|
iframe: o,
|
|
727
707
|
removeMountedIframe: () => {
|
|
728
708
|
o.remove();
|
|
@@ -730,9 +710,9 @@ function te(e) {
|
|
|
730
710
|
};
|
|
731
711
|
}
|
|
732
712
|
function Ce(e) {
|
|
733
|
-
const { plugin: t, loadOverlayContainer:
|
|
713
|
+
const { plugin: t, loadOverlayContainer: n, loadOverlayOptions: r, adapterOptions: i } = e, { iframe: a, removeMountedIframe: o } = te(e), s = n !== void 0 ? q(n, a, r ?? {}) : null;
|
|
734
714
|
if (t !== void 0) {
|
|
735
|
-
const l = new W(t, a,
|
|
715
|
+
const l = new W(t, a, i);
|
|
736
716
|
return {
|
|
737
717
|
iframe: a,
|
|
738
718
|
adapter: l,
|
|
@@ -782,33 +762,33 @@ body {
|
|
|
782
762
|
`.trim();
|
|
783
763
|
}
|
|
784
764
|
var be = k();
|
|
785
|
-
function
|
|
765
|
+
function ne(e) {
|
|
786
766
|
return e instanceof Document ? e : e.ownerDocument;
|
|
787
767
|
}
|
|
788
|
-
function
|
|
768
|
+
function re(e, t, n) {
|
|
789
769
|
if (!t || e.getElementById(R)) return;
|
|
790
|
-
const
|
|
791
|
-
|
|
770
|
+
const r = e.createElement("style");
|
|
771
|
+
r.id = R, r.textContent = k(n), e.head.appendChild(r);
|
|
792
772
|
}
|
|
793
|
-
function
|
|
794
|
-
const { root: t = typeof document < "u" ? document : void 0, containerId:
|
|
773
|
+
function Se(e) {
|
|
774
|
+
const { root: t = typeof document < "u" ? document : void 0, containerId: n = M, includeDefaultStyles: r = !0 } = e ?? {};
|
|
795
775
|
if (t === void 0) throw new Error("ensureSidebarHostShell: no document — pass `root` in non-browser environments");
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
const a = t instanceof Document ?
|
|
776
|
+
const i = ne(t);
|
|
777
|
+
re(i, r, n);
|
|
778
|
+
const a = t instanceof Document ? i.getElementById(n) : t.querySelector(`#${_(n)}`);
|
|
799
779
|
if (a instanceof HTMLElement && (t instanceof Document || t.contains(a))) return a;
|
|
800
780
|
if (!(t instanceof Document)) {
|
|
801
|
-
const s =
|
|
802
|
-
return s.id =
|
|
781
|
+
const s = i.createElement("div");
|
|
782
|
+
return s.id = n, t.appendChild(s), s;
|
|
803
783
|
}
|
|
804
|
-
const o =
|
|
805
|
-
return o.id =
|
|
784
|
+
const o = i.createElement("div");
|
|
785
|
+
return o.id = n, i.body.appendChild(o), o;
|
|
806
786
|
}
|
|
807
|
-
function
|
|
787
|
+
function ie() {
|
|
808
788
|
return ' <meta name="viewport" content="width=device-width, initial-scale=1.0" />';
|
|
809
789
|
}
|
|
810
|
-
function
|
|
811
|
-
const { title: t = "Markup AI Sidebar", headInnerHtml:
|
|
790
|
+
function we(e) {
|
|
791
|
+
const { title: t = "Markup AI Sidebar", headInnerHtml: n = "", includePluginHostHead: r = !1, bodyScriptsHtml: i, htmlLang: a = "en", htmlAttrs: o = `lang="${a}" style="height:100%"`, bodyAttrs: s = 'style="height:100%;margin:0"' } = e, l = [r ? ie() : "", n].filter((p) => p.trim().length > 0).join(`
|
|
812
792
|
`);
|
|
813
793
|
return `<!DOCTYPE html>
|
|
814
794
|
<html ${o}>
|
|
@@ -819,7 +799,7 @@ function Se(e) {
|
|
|
819
799
|
${l}` : ""}
|
|
820
800
|
</head>
|
|
821
801
|
<body ${s}>
|
|
822
|
-
${
|
|
802
|
+
${i}
|
|
823
803
|
</body>
|
|
824
804
|
</html>
|
|
825
805
|
`;
|
|
@@ -848,11 +828,11 @@ export {
|
|
|
848
828
|
O as TextLookupError,
|
|
849
829
|
Ae as assertSidebarHostAdapter,
|
|
850
830
|
ue as buildDocumentReference,
|
|
851
|
-
|
|
831
|
+
we as buildSidebarHostHtmlDocument,
|
|
852
832
|
k as buildSidebarHostShellCss,
|
|
853
|
-
|
|
833
|
+
ie as buildSidebarPluginHostHeadInnerHtml,
|
|
854
834
|
Ce as createSidebarHost,
|
|
855
|
-
|
|
835
|
+
Se as ensureSidebarHostShell,
|
|
856
836
|
Ie as getAuthConfigWithOverride,
|
|
857
837
|
ye as getSidebarBaseUrlWithOverride,
|
|
858
838
|
P as ipcErrorReconstructors,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(r,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(r=typeof globalThis<"u"?globalThis:r||self,g(r.main={}))})(this,function(r){Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});var g=(function(e){return e.TEXT_PLAIN="text/plain",e.TEXT_MARKDOWN="text/markdown",e.TEXT_HTML="text/html",e.APPLICATION_DITA_XML="application/dita+xml",e})({}),K=["text/plain","text/markdown","text/html","application/dita+xml"],X={integrationName:"unknown",integrationVersion:"unknown",integrationId:"markupai-sidebar-app",hideBanner:!1,dialogClosingScript:void 0,useCheckPreviewDialog:!1,supportCheckSelection:!0,multiAgent:!1,multiDocument:!1},q=e=>typeof e!="object"||e===null?!1:Array.isArray(e.fields),Z=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id!="string"||t.id.length===0||typeof t.label!="string"?!1:t.type==="boolean"?typeof t.default=="boolean":t.type==="enum"?typeof t.default!="string"||!Array.isArray(t.options)||t.options.length===0?!1:t.options.every(i=>{if(typeof i!="object"||i===null)return!1;const n=i;return typeof n.value=="string"&&typeof n.label=="string"}):!1},A=class V extends Error{name="TextLookupError";constructor(t){super(t),Object.setPrototypeOf(this,V.prototype)}};function Q(e){return e instanceof A}var v={TextLookupError:e=>new A(e)};function P(e){const t=e.message??"",i=e.name,n=typeof i=="string"&&i in v?v[i]:void 0;return n?n(t,e):Object.assign(new Error(t),i?{name:i}:{})}var E=":",R=/^[a-z][a-z0-9-]*$/;function ee(e){const t=e.indexOf(E);return t<=0||t===e.length-1?!1:R.test(e.slice(0,t))}function te(e,t){const i=e.trim().toLowerCase(),n=t.trim();if(!R.test(i))throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);if(n.length===0)throw new Error("Invalid document reference: the document id is empty.");const a=`${i}${E}`;return n.startsWith(a)?n:`${a}${n}`}var T=class extends Promise{static get[Symbol.species](){return Promise}resolve;reject;constructor(e=()=>{}){let t,i;super((n,a)=>{t=n,i=a,e(n,a)}),this.resolve=t,this.reject=i}},D={timeout:1e4};function ie(e){const t=JSON.stringify(e,Object.getOwnPropertyNames(e)),i=JSON.parse(t);return i.message===void 0||i.message===""?JSON.stringify({message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:void 0}):t}var C=class{promisesByID={};receiversByName={};currentID=0;config;postMessage;constructor(e,t){this.postMessage=e,this.config={...D,...t}}configure(e){this.config={...this.config,...e}}call(e,...t){return this.callWithOptions(e,{},...t)}callWithOptions(e,t,...i){const n=this.currentID++,a=new T,o=t.timeout??this.config.timeout,s=setTimeout(()=>{if(n in this.promisesByID){const c=new Error(`IPC call timeout: "${e}" did not respond within ${String(o)}ms`);a.reject(c),Reflect.deleteProperty(this.promisesByID,n)}},o);this.promisesByID[n]={promise:a,timeoutId:s};const l={type:"call",id:n,name:e,data:i};return this.postMessage(l),a}receive(e,t){this.receiversByName[e]=t}ignore(e){delete this.receiversByName[e]}async handleMessage(e){switch(e.type){case"call":await this.handleCall(e);break;case"response":this.handleResponse(e);break;case"error":this.handleError(e);break;default:}}async handleCall(e){const{id:t,name:i,data:n}=e;if(!(i in this.receiversByName)){const o=new Error(`No receiver registered for: ${i}`),s=JSON.stringify({message:o.message,name:o.name});this.postMessage({type:"error",id:t,name:i,errorJSON:s});return}const a=this.receiversByName[i];try{if(!Array.isArray(n))throw new TypeError(`IPC: Expected array of arguments but got ${typeof n}`);const o=await a(...n),s={type:"response",id:t,name:i,data:o};this.postMessage(s)}catch(o){const s={type:"error",id:t,name:i,errorJSON:ie(o)};this.postMessage(s)}}handleResponse(e){const{id:t}=e;if(t in this.promisesByID){const{promise:i,timeoutId:n}=this.promisesByID[t];clearTimeout(n),i.resolve(e.data),Reflect.deleteProperty(this.promisesByID,t)}}handleError(e){const{id:t,errorJSON:i}=e;if(t in this.promisesByID){const{promise:n,timeoutId:a}=this.promisesByID[t];clearTimeout(a);try{const o=P(JSON.parse(i));n.reject(o)}catch{n.reject(new Error("Failed to parse error from IPC"))}Reflect.deleteProperty(this.promisesByID,t)}}destroy(){for(const{promise:e,timeoutId:t}of Object.values(this.promisesByID))clearTimeout(t),e.reject(new Error("IPC destroyed"));this.promisesByID={},this.receiversByName={}}},O=class{ipc;sidebar;targetOrigin;constructor(e,t,i="*"){this.sidebar=e||{},this.targetOrigin=i,this.ipc=new C(n=>{window.parent.postMessage(n,this.targetOrigin)},t),window.addEventListener("message",this.handleMessage),this.registerReceivers()}handleMessage=e=>{const t=globalThis.window.location.origin,i=this.targetOrigin;e.origin!==t&&(i!=="*"&&e.origin!==i||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.sidebar.onPluginStatusChange){const e=this.sidebar.onPluginStatusChange;this.ipc.receive("onPluginStatusChange",async(t,i)=>{await e(t,i)})}if(this.sidebar.activateAgenticIssue){const e=this.sidebar.activateAgenticIssue;this.ipc.receive("activateAgenticIssue",async(t,i)=>{await e(t,typeof i=="string"?i:null)})}if(this.sidebar.invalidateAgenticIssue){const e=this.sidebar.invalidateAgenticIssue;this.ipc.receive("invalidateAgenticIssue",async t=>{await e(t)})}if(this.sidebar.markAgenticIssueResolved){const e=this.sidebar.markAgenticIssueResolved;this.ipc.receive("markAgenticIssueResolved",async t=>{await e(t)})}if(this.sidebar.restoreAgenticIssue){const e=this.sidebar.restoreAgenticIssue;this.ipc.receive("restoreAgenticIssue",async t=>{await e(t)})}if(this.sidebar.applyIntegrationSettings){const e=this.sidebar.applyIntegrationSettings;this.ipc.receive("applyIntegrationSettings",async t=>{await e(t)})}if(this.sidebar.getIntegrationSettings){const e=this.sidebar.getIntegrationSettings;this.ipc.receive("getIntegrationSettings",async()=>await e())}if(this.sidebar.onActiveDocumentChanged){const e=this.sidebar.onActiveDocumentChanged;this.ipc.receive("onActiveDocumentChanged",async t=>{await e(t)})}}async getInitConfig(){return await this.ipc.call("getInitConfig")}async getContent(e){return this.ipc.callWithOptions("getContent",e??{})}async getSelectedContent(e){return this.ipc.callWithOptions("getSelectedContent",e??{})}async replaceContent(e,t,i=null){await this.ipc.call("replaceContent",e,t,i)}async selectContent(e,t=null){await this.ipc.call("selectContent",e,t)}async showDialog(e,t,i,n){await this.ipc.call("showDialog",e,t,i,n)}async closeDialog(){await this.ipc.call("closeDialog")}async replaceMultipleContents(e){await this.ipc.call("replaceMultipleContents",e)}async onAgenticAgentResults(e,t,i=null){await this.ipc.call("onAgenticAgentResults",e,t,i)}async onAgenticStreamComplete(e=null){await this.ipc.call("onAgenticStreamComplete",e)}async onAgenticIssueStatusChanged(e,t,i){await this.ipc.call("onAgenticIssueStatusChanged",e,t,i)}async onAgenticIssuesCleared(e=null){await this.ipc.call("onAgenticIssuesCleared",e)}async openAuthUrl(e){await this.ipc.call("openAuthUrl",e)}async copyToClipboard(e){await this.ipc.call("copyToClipboard",e)}async onIntegrationSettingsChange(e,t){await this.ipc.call("onIntegrationSettingsChange",e,t)}configure(e){this.ipc.configure(e)}setTargetOrigin(e){if(!e||typeof e!="string")throw new Error("Invalid targetOrigin: must be a non-empty string");try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||!t.host)throw new Error("Invalid targetOrigin: protocol must be http or https and must have a host")}catch{throw new Error("Invalid targetOrigin: must be a valid origin (e.g., https://example.com)")}this.targetOrigin=e}getTargetOrigin(){return this.targetOrigin}destroy(){window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},ne=class{ipcAdapter;constructor(e,t,i){this.ipcAdapter=new O(e,t,i)}destroy(){this.ipcAdapter.destroy()}async getInitConfig(){return await this.ipcAdapter.getInitConfig()}async getContent(e){return await this.ipcAdapter.getContent(e)}async getSelectedContent(e){return await this.ipcAdapter.getSelectedContent(e)}async replaceContent(e,t,i=null){await this.ipcAdapter.replaceContent(e,t,i)}async selectContent(e,t=null){await this.ipcAdapter.selectContent(e,t)}async showDialog(e,t,i,n){await this.ipcAdapter.showDialog(e,t,i,n)}async closeDialog(){await this.ipcAdapter.closeDialog()}async replaceMultipleContents(e){await this.ipcAdapter.replaceMultipleContents(e)}onAgenticAgentResults(e,t,i=null){return this.ipcAdapter.onAgenticAgentResults(e,t,i)}onAgenticStreamComplete(e=null){return this.ipcAdapter.onAgenticStreamComplete(e)}onAgenticIssueStatusChanged(e,t,i){return this.ipcAdapter.onAgenticIssueStatusChanged(e,t,i)}onAgenticIssuesCleared(e=null){return this.ipcAdapter.onAgenticIssuesCleared(e)}openAuthUrl(e){return this.ipcAdapter.openAuthUrl(e)}copyToClipboard(e){return this.ipcAdapter.copyToClipboard(e)}onIntegrationSettingsChange(e,t){return this.ipcAdapter.onIntegrationSettingsChange(e,t)}configure(e){this.ipcAdapter.configure(e)}setTargetOrigin(e){this.ipcAdapter.setTargetOrigin(e)}getTargetOrigin(){return this.ipcAdapter.getTargetOrigin()}},_=class{ipc;plugin;iframe;window;targetOrigin;constructor(e,t,i,n,a="*"){this.plugin=e,this.iframe=t,this.window=i??window,this.targetOrigin=a,this.ipc=new C(o=>{this.iframe.contentWindow?.postMessage(o,this.targetOrigin)},n),this.window.addEventListener("message",this.handleMessage,!1),this.registerReceivers()}handleMessage=e=>{const t=this.window.location.origin,i=this.targetOrigin;e.origin!==t&&(i!=="*"&&e.origin!==i||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.ipc.receive("getInitConfig",async()=>await this.plugin.getInitConfig()),this.ipc.receive("getContent",async()=>await this.plugin.getContent()),this.ipc.receive("getSelectedContent",async()=>await this.plugin.getSelectedContent()),this.ipc.receive("replaceContent",async(e,t,i)=>{await this.plugin.replaceContent(e,t,typeof i=="string"?i:null)}),this.ipc.receive("selectContent",async(e,t)=>{await this.plugin.selectContent(e,typeof t=="string"?t:null)}),this.ipc.receive("showDialog",async(e,t,i,n)=>{if(!this.plugin.showDialog)throw new Error("SidebarIPCAdapter: host does not implement showDialog");await this.plugin.showDialog(e,t,i,n)}),this.ipc.receive("closeDialog",async()=>{if(!this.plugin.closeDialog)throw new Error("SidebarIPCAdapter: host does not implement closeDialog");await this.plugin.closeDialog()}),this.ipc.receive("replaceMultipleContents",async e=>{await this.plugin.replaceMultipleContents(e)}),this.ipc.receive("onAgenticAgentResults",async(e,t,i)=>{if(!Array.isArray(t))return;const n=this.plugin.onAgenticAgentResults;n&&await n(e,t,typeof i=="string"?i:null)}),this.ipc.receive("onAgenticStreamComplete",async e=>{const t=this.plugin.onAgenticStreamComplete;t&&await t(typeof e=="string"?e:null)}),this.ipc.receive("onAgenticIssueStatusChanged",async(e,t,i)=>{const n=this.plugin.onAgenticIssueStatusChanged;if(n&&!(t!=="active"&&t!=="resolved"&&t!=="dismissed"||i!=="user"&&i!=="host"))try{await n(e,t,i)}catch{}}),this.ipc.receive("onAgenticIssuesCleared",async e=>{const t=this.plugin.onAgenticIssuesCleared;if(t)try{await t(typeof e=="string"?e:null)}catch{}}),this.plugin.openAuthUrl){const e=this.plugin.openAuthUrl;this.ipc.receive("openAuthUrl",async t=>{await e(t)})}if(this.plugin.copyToClipboard){const e=this.plugin.copyToClipboard;this.ipc.receive("copyToClipboard",async t=>{await e(t)})}if(this.plugin.onIntegrationSettingsChange){const e=this.plugin.onIntegrationSettingsChange;this.ipc.receive("onIntegrationSettingsChange",async(t,i)=>{await e(t,i)})}}async activateAgenticIssue(e,t=null){await this.ipc.call("activateAgenticIssue",e,t)}async invalidateAgenticIssue(e){await this.ipc.call("invalidateAgenticIssue",e)}async markAgenticIssueResolved(e){await this.ipc.call("markAgenticIssueResolved",e)}async restoreAgenticIssue(e){await this.ipc.call("restoreAgenticIssue",e)}async notifyPluginStatus(e,t){await this.ipc.call("onPluginStatusChange",e,t)}async applyIntegrationSettings(e){await this.ipc.call("applyIntegrationSettings",e)}async getIntegrationSettings(){return await this.ipc.call("getIntegrationSettings")}async notifyActiveDocumentChanged(e){await this.ipc.call("onActiveDocumentChanged",e)}configure(e){this.ipc.configure(e)}destroy(){this.window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},L=class{ipcAdapter;constructor(e,t,i){this.ipcAdapter=new _(e,t,i?.win,i?.config,i?.targetOrigin)}destroy(){this.ipcAdapter.destroy()}async notifyPluginStatus(e,t){await this.ipcAdapter.notifyPluginStatus(e,t)}async activateAgenticIssue(e,t=null){await this.ipcAdapter.activateAgenticIssue(e,t)}async invalidateAgenticIssue(e){await this.ipcAdapter.invalidateAgenticIssue(e)}async markAgenticIssueResolved(e){await this.ipcAdapter.markAgenticIssueResolved(e)}async restoreAgenticIssue(e){await this.ipcAdapter.restoreAgenticIssue(e)}async applyIntegrationSettings(e){await this.ipcAdapter.applyIntegrationSettings(e)}async getIntegrationSettings(){return await this.ipcAdapter.getIntegrationSettings()}async notifyActiveDocumentChanged(e){await this.ipcAdapter.notifyActiveDocumentChanged(e)}configure(e){this.ipcAdapter.configure(e)}},re=`
|
|
1
|
+
(function(r,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(r=typeof globalThis<"u"?globalThis:r||self,g(r.main={}))})(this,function(r){Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});var g=(function(e){return e.TEXT_PLAIN="text/plain",e.TEXT_MARKDOWN="text/markdown",e.TEXT_HTML="text/html",e.APPLICATION_DITA_XML="application/dita+xml",e})({}),K=["text/plain","text/markdown","text/html","application/dita+xml"],X={integrationName:"unknown",integrationVersion:"unknown",integrationId:"markupai-sidebar-app",hideBanner:!1,supportCheckSelection:!0,multiAgent:!1,multiDocument:!1},q=e=>typeof e!="object"||e===null?!1:Array.isArray(e.fields),Z=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id!="string"||t.id.length===0||typeof t.label!="string"?!1:t.type==="boolean"?typeof t.default=="boolean":t.type==="enum"?typeof t.default!="string"||!Array.isArray(t.options)||t.options.length===0?!1:t.options.every(n=>{if(typeof n!="object"||n===null)return!1;const i=n;return typeof i.value=="string"&&typeof i.label=="string"}):!1},A=class V extends Error{name="TextLookupError";constructor(t){super(t),Object.setPrototypeOf(this,V.prototype)}};function Q(e){return e instanceof A}var v={TextLookupError:e=>new A(e)};function E(e){const t=e.message??"",n=e.name,i=typeof n=="string"&&n in v?v[n]:void 0;return i?i(t,e):Object.assign(new Error(t),n?{name:n}:{})}var P=":",R=/^[a-z][a-z0-9-]*$/;function ee(e){const t=e.indexOf(P);return t<=0||t===e.length-1?!1:R.test(e.slice(0,t))}function te(e,t){const n=e.trim().toLowerCase(),i=t.trim();if(!R.test(n))throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);if(i.length===0)throw new Error("Invalid document reference: the document id is empty.");const a=`${n}${P}`;return i.startsWith(a)?i:`${a}${i}`}var T=class extends Promise{static get[Symbol.species](){return Promise}resolve;reject;constructor(e=()=>{}){let t,n;super((i,a)=>{t=i,n=a,e(i,a)}),this.resolve=t,this.reject=n}},O={timeout:1e4};function ne(e){const t=JSON.stringify(e,Object.getOwnPropertyNames(e)),n=JSON.parse(t);return n.message===void 0||n.message===""?JSON.stringify({message:e instanceof Error?e.message:String(e),name:e instanceof Error?e.name:void 0}):t}var C=class{promisesByID={};receiversByName={};currentID=0;config;postMessage;constructor(e,t){this.postMessage=e,this.config={...O,...t}}configure(e){this.config={...this.config,...e}}call(e,...t){return this.callWithOptions(e,{},...t)}callWithOptions(e,t,...n){const i=this.currentID++,a=new T,o=t.timeout??this.config.timeout,s=setTimeout(()=>{if(i in this.promisesByID){const c=new Error(`IPC call timeout: "${e}" did not respond within ${String(o)}ms`);a.reject(c),Reflect.deleteProperty(this.promisesByID,i)}},o);this.promisesByID[i]={promise:a,timeoutId:s};const l={type:"call",id:i,name:e,data:n};return this.postMessage(l),a}receive(e,t){this.receiversByName[e]=t}ignore(e){delete this.receiversByName[e]}async handleMessage(e){switch(e.type){case"call":await this.handleCall(e);break;case"response":this.handleResponse(e);break;case"error":this.handleError(e);break;default:}}async handleCall(e){const{id:t,name:n,data:i}=e;if(!(n in this.receiversByName)){const o=new Error(`No receiver registered for: ${n}`),s=JSON.stringify({message:o.message,name:o.name});this.postMessage({type:"error",id:t,name:n,errorJSON:s});return}const a=this.receiversByName[n];try{if(!Array.isArray(i))throw new TypeError(`IPC: Expected array of arguments but got ${typeof i}`);const o=await a(...i),s={type:"response",id:t,name:n,data:o};this.postMessage(s)}catch(o){const s={type:"error",id:t,name:n,errorJSON:ne(o)};this.postMessage(s)}}handleResponse(e){const{id:t}=e;if(t in this.promisesByID){const{promise:n,timeoutId:i}=this.promisesByID[t];clearTimeout(i),n.resolve(e.data),Reflect.deleteProperty(this.promisesByID,t)}}handleError(e){const{id:t,errorJSON:n}=e;if(t in this.promisesByID){const{promise:i,timeoutId:a}=this.promisesByID[t];clearTimeout(a);try{const o=JSON.parse(n),s=E(o);i.reject(s)}catch{i.reject(new Error("Failed to parse error from IPC"))}Reflect.deleteProperty(this.promisesByID,t)}}destroy(){for(const{promise:e,timeoutId:t}of Object.values(this.promisesByID))clearTimeout(t),e.reject(new Error("IPC destroyed"));this.promisesByID={},this.receiversByName={}}},D=class{ipc;sidebar;targetOrigin;constructor(e,t,n="*"){this.sidebar=e||{},this.targetOrigin=n,this.ipc=new C(i=>{window.parent.postMessage(i,this.targetOrigin)},t),window.addEventListener("message",this.handleMessage),this.registerReceivers()}handleMessage=e=>{const t=globalThis.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.sidebar.onPluginStatusChange){const e=this.sidebar.onPluginStatusChange;this.ipc.receive("onPluginStatusChange",async(t,n)=>{await e(t,n)})}if(this.sidebar.activateAgenticIssue){const e=this.sidebar.activateAgenticIssue;this.ipc.receive("activateAgenticIssue",async(t,n)=>{await e(t,typeof n=="string"?n:null)})}if(this.sidebar.invalidateAgenticIssue){const e=this.sidebar.invalidateAgenticIssue;this.ipc.receive("invalidateAgenticIssue",async t=>{await e(t)})}if(this.sidebar.markAgenticIssueResolved){const e=this.sidebar.markAgenticIssueResolved;this.ipc.receive("markAgenticIssueResolved",async t=>{await e(t)})}if(this.sidebar.restoreAgenticIssue){const e=this.sidebar.restoreAgenticIssue;this.ipc.receive("restoreAgenticIssue",async t=>{await e(t)})}if(this.sidebar.applyIntegrationSettings){const e=this.sidebar.applyIntegrationSettings;this.ipc.receive("applyIntegrationSettings",async t=>{await e(t)})}if(this.sidebar.getIntegrationSettings){const e=this.sidebar.getIntegrationSettings;this.ipc.receive("getIntegrationSettings",async()=>await e())}if(this.sidebar.onActiveDocumentChanged){const e=this.sidebar.onActiveDocumentChanged;this.ipc.receive("onActiveDocumentChanged",async t=>{await e(t)})}}async getInitConfig(){return await this.ipc.call("getInitConfig")}async getContent(e){return this.ipc.callWithOptions("getContent",e??{})}async getSelectedContent(e){return this.ipc.callWithOptions("getSelectedContent",e??{})}async replaceContent(e,t,n=null){await this.ipc.call("replaceContent",e,t,n)}async selectContent(e,t=null){await this.ipc.call("selectContent",e,t)}async replaceMultipleContents(e){await this.ipc.call("replaceMultipleContents",e)}async onAgenticAgentResults(e,t,n=null){await this.ipc.call("onAgenticAgentResults",e,t,n)}async onAgenticStreamComplete(e=null){await this.ipc.call("onAgenticStreamComplete",e)}async onAgenticIssueStatusChanged(e,t,n){await this.ipc.call("onAgenticIssueStatusChanged",e,t,n)}async onAgenticIssuesCleared(e=null){await this.ipc.call("onAgenticIssuesCleared",e)}async openAuthUrl(e){await this.ipc.call("openAuthUrl",e)}async copyToClipboard(e){await this.ipc.call("copyToClipboard",e)}async onIntegrationSettingsChange(e,t){await this.ipc.call("onIntegrationSettingsChange",e,t)}configure(e){this.ipc.configure(e)}setTargetOrigin(e){if(!e||typeof e!="string")throw new Error("Invalid targetOrigin: must be a non-empty string");try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||!t.host)throw new Error("Invalid targetOrigin: protocol must be http or https and must have a host")}catch{throw new Error("Invalid targetOrigin: must be a valid origin (e.g., https://example.com)")}this.targetOrigin=e}getTargetOrigin(){return this.targetOrigin}destroy(){window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},ie=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new D(e,t,n)}destroy(){this.ipcAdapter.destroy()}async getInitConfig(){return await this.ipcAdapter.getInitConfig()}async getContent(e){return await this.ipcAdapter.getContent(e)}async getSelectedContent(e){return await this.ipcAdapter.getSelectedContent(e)}async replaceContent(e,t,n=null){await this.ipcAdapter.replaceContent(e,t,n)}async selectContent(e,t=null){await this.ipcAdapter.selectContent(e,t)}async replaceMultipleContents(e){await this.ipcAdapter.replaceMultipleContents(e)}onAgenticAgentResults(e,t,n=null){return this.ipcAdapter.onAgenticAgentResults(e,t,n)}onAgenticStreamComplete(e=null){return this.ipcAdapter.onAgenticStreamComplete(e)}onAgenticIssueStatusChanged(e,t,n){return this.ipcAdapter.onAgenticIssueStatusChanged(e,t,n)}onAgenticIssuesCleared(e=null){return this.ipcAdapter.onAgenticIssuesCleared(e)}openAuthUrl(e){return this.ipcAdapter.openAuthUrl(e)}copyToClipboard(e){return this.ipcAdapter.copyToClipboard(e)}onIntegrationSettingsChange(e,t){return this.ipcAdapter.onIntegrationSettingsChange(e,t)}configure(e){this.ipcAdapter.configure(e)}setTargetOrigin(e){this.ipcAdapter.setTargetOrigin(e)}getTargetOrigin(){return this.ipcAdapter.getTargetOrigin()}},_=class{ipc;plugin;iframe;window;targetOrigin;constructor(e,t,n,i,a="*"){this.plugin=e,this.iframe=t,this.window=n??window,this.targetOrigin=a,this.ipc=new C(o=>{this.iframe.contentWindow?.postMessage(o,this.targetOrigin)},i),this.window.addEventListener("message",this.handleMessage,!1),this.registerReceivers()}handleMessage=e=>{const t=this.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.ipc.receive("getInitConfig",async()=>await this.plugin.getInitConfig()),this.ipc.receive("getContent",async()=>await this.plugin.getContent()),this.ipc.receive("getSelectedContent",async()=>await this.plugin.getSelectedContent()),this.ipc.receive("replaceContent",async(e,t,n)=>{await this.plugin.replaceContent(e,t,typeof n=="string"?n:null)}),this.ipc.receive("selectContent",async(e,t)=>{await this.plugin.selectContent(e,typeof t=="string"?t:null)}),this.ipc.receive("replaceMultipleContents",async e=>{await this.plugin.replaceMultipleContents(e)}),this.ipc.receive("onAgenticAgentResults",async(e,t,n)=>{if(!Array.isArray(t))return;const i=this.plugin.onAgenticAgentResults;i&&await i(e,t,typeof n=="string"?n:null)}),this.ipc.receive("onAgenticStreamComplete",async e=>{const t=this.plugin.onAgenticStreamComplete;t&&await t(typeof e=="string"?e:null)}),this.ipc.receive("onAgenticIssueStatusChanged",async(e,t,n)=>{const i=this.plugin.onAgenticIssueStatusChanged;if(i&&!(t!=="active"&&t!=="resolved"&&t!=="dismissed"||n!=="user"&&n!=="host"))try{await i(e,t,n)}catch{}}),this.ipc.receive("onAgenticIssuesCleared",async e=>{const t=this.plugin.onAgenticIssuesCleared;if(t)try{await t(typeof e=="string"?e:null)}catch{}}),this.plugin.openAuthUrl){const e=this.plugin.openAuthUrl;this.ipc.receive("openAuthUrl",async t=>{await e(t)})}if(this.plugin.copyToClipboard){const e=this.plugin.copyToClipboard;this.ipc.receive("copyToClipboard",async t=>{await e(t)})}if(this.plugin.onIntegrationSettingsChange){const e=this.plugin.onIntegrationSettingsChange;this.ipc.receive("onIntegrationSettingsChange",async(t,n)=>{await e(t,n)})}}async activateAgenticIssue(e,t=null){await this.ipc.call("activateAgenticIssue",e,t)}async invalidateAgenticIssue(e){await this.ipc.call("invalidateAgenticIssue",e)}async markAgenticIssueResolved(e){await this.ipc.call("markAgenticIssueResolved",e)}async restoreAgenticIssue(e){await this.ipc.call("restoreAgenticIssue",e)}async notifyPluginStatus(e,t){await this.ipc.call("onPluginStatusChange",e,t)}async applyIntegrationSettings(e){await this.ipc.call("applyIntegrationSettings",e)}async getIntegrationSettings(){return await this.ipc.call("getIntegrationSettings")}async notifyActiveDocumentChanged(e){await this.ipc.call("onActiveDocumentChanged",e)}configure(e){this.ipc.configure(e)}destroy(){this.window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},L=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new _(e,t,n?.win,n?.config,n?.targetOrigin)}destroy(){this.ipcAdapter.destroy()}async notifyPluginStatus(e,t){await this.ipcAdapter.notifyPluginStatus(e,t)}async activateAgenticIssue(e,t=null){await this.ipcAdapter.activateAgenticIssue(e,t)}async invalidateAgenticIssue(e){await this.ipcAdapter.invalidateAgenticIssue(e)}async markAgenticIssueResolved(e){await this.ipcAdapter.markAgenticIssueResolved(e)}async restoreAgenticIssue(e){await this.ipcAdapter.restoreAgenticIssue(e)}async applyIntegrationSettings(e){await this.ipcAdapter.applyIntegrationSettings(e)}async getIntegrationSettings(){return await this.ipcAdapter.getIntegrationSettings()}async notifyActiveDocumentChanged(e){await this.ipcAdapter.notifyActiveDocumentChanged(e)}configure(e){this.ipcAdapter.configure(e)}},re=`
|
|
2
2
|
<div class="sidebar-load-overlay-card">
|
|
3
3
|
<div class="sidebar-load-overlay-title">Sidebar failed to load</div>
|
|
4
4
|
<div class="sidebar-load-overlay-description">Check your connection or try again.</div>
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
box-shadow: 0 0 0 2px
|
|
112
112
|
color-mix(in srgb, var(--accent, #ef4640) 60%, transparent);
|
|
113
113
|
}
|
|
114
|
-
`,se=e=>{const t=e??document;if(t.getElementById(M))return;const
|
|
114
|
+
`,se=e=>{const t=e??document;if(t.getElementById(M))return;const n=t.createElement("style");n.id=M,n.textContent=oe,t.head.appendChild(n)},le=8e3,ce=12e3,k=(e,t,n={})=>{se(e.ownerDocument);const{sidebarUrl:i,targetOrigin:a,timeoutMs:o=le,retryIntervalMs:s=ce,messageListenWindow:l}=n,c=l??(typeof globalThis.window<"u"?globalThis.window:globalThis),h=()=>i??t.src,we=()=>{if(a)return a;try{return new URL(h()).origin}catch{return"*"}},{overlay:w,button:j}=ae();e.appendChild(w);let f=!1,m,u;const p=d=>{w.style.display=d?"flex":"none"};p(!1);const I=()=>{m&&(globalThis.clearTimeout(m),m=void 0)},$=()=>{I(),m=globalThis.setTimeout(()=>{f||p(!0)},o)},W=d=>{const y=d?.preserveOverlay??!0;f=!1,y||p(!1),t.src=h(),$()},Ee=()=>{u||s<=0||(u=globalThis.setInterval(()=>{f||W({preserveOverlay:!0})},s))},G=()=>{u&&(globalThis.clearInterval(u),u=void 0)},z=d=>{if(!t.contentWindow||d.source!==t.contentWindow)return;const y=we();y!=="*"&&d.origin!==y||(f=!0,I(),G(),p(!1))},J=()=>{I(),p(!0)},Y=()=>{W()};return j.addEventListener("click",Y),t.addEventListener("error",J),c.addEventListener("message",z),$(),Ee(),()=>{I(),G(),t.removeEventListener("error",J),c.removeEventListener("message",z),j.removeEventListener("click",Y),w.remove()}},N="Markup AI Sidebar",U="clipboard-read; clipboard-write",de="markupai.sidebarNextGen.overrideUrl",ge="https://sidebar.markup.ai/";function ue(e){try{return"localStorage"in globalThis&&globalThis.localStorage.getItem("markupai.sidebarNextGen.overrideUrl")?.trim()||e}catch{return e}}var B="markupai.sidebarNextGen.authOverride";function pe(e,t){if(!t)return e;try{if(!("localStorage"in globalThis))return e;const n=globalThis.localStorage.getItem(B)?.trim();if(!n)return e;const i=JSON.parse(n);return i!==null&&typeof i=="object"&&"type"in i&&(i.type==="mediation"||i.type==="popup")?i:e}catch{return e}}function he(e,t){try{return new URL(e).origin}catch(n){return t?.onInvalidUrl?.(e,n),"*"}}function fe(e,t="Expected SidebarAdapter from createSidebarHost"){if(e.adapter===null)throw new Error(t)}function me(e){const{iframe:t,iframeMount:n}=e;if(t!==void 0&&n!==void 0)throw new Error("createSidebarHost: pass only one of `iframe` or `iframeMount`");if(t!==void 0)return{iframe:t,removeMountedIframe:null};if(n===void 0)throw new Error("createSidebarHost: pass either `iframe` or `iframeMount`");const{container:i,src:a,allow:o=U}=n,s=document.createElement("iframe");return s.title=N,s.src=a,o&&s.setAttribute("allow",o),i.appendChild(s),{iframe:s,removeMountedIframe:()=>{s.remove()}}}function Ie(e){const{plugin:t,loadOverlayContainer:n,loadOverlayOptions:i,adapterOptions:a}=e,{iframe:o,removeMountedIframe:s}=me(e),l=n!==void 0?k(n,o,i??{}):null;if(t!==void 0){const c=new L(t,o,a);return{iframe:o,adapter:c,destroy:()=>{l?.(),c.destroy(),s?.()}}}return{iframe:o,adapter:null,destroy:()=>{l?.(),s?.()}}}var b="sidebarContainer",H="markupai-sidebar-host-shell-styles";function x(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);if(!/^[a-zA-Z_][\w-]*$/.test(e))throw new Error(String.raw`sidebar host shell: containerId must match /^[a-zA-Z_][\w-]*$/ when CSS.escape is unavailable (got ${JSON.stringify(e)})`);return e}function S(e=b){const t=x(e);return`
|
|
115
115
|
html {
|
|
116
116
|
height: 100%;
|
|
117
117
|
}
|
|
@@ -133,7 +133,7 @@ body {
|
|
|
133
133
|
margin: 0;
|
|
134
134
|
display: block;
|
|
135
135
|
}
|
|
136
|
-
`.trim()}var ye=S();function Ae(e){return e instanceof Document?e:e.ownerDocument}function ve(e,t,
|
|
136
|
+
`.trim()}var ye=S();function Ae(e){return e instanceof Document?e:e.ownerDocument}function ve(e,t,n){if(!t||e.getElementById(H))return;const i=e.createElement("style");i.id=H,i.textContent=S(n),e.head.appendChild(i)}function Ce(e){const{root:t=typeof document<"u"?document:void 0,containerId:n=b,includeDefaultStyles:i=!0}=e??{};if(t===void 0)throw new Error("ensureSidebarHostShell: no document — pass `root` in non-browser environments");const a=Ae(t);ve(a,i,n);const o=t instanceof Document?a.getElementById(n):t.querySelector(`#${x(n)}`);if(o instanceof HTMLElement&&(t instanceof Document||t.contains(o)))return o;if(!(t instanceof Document)){const l=a.createElement("div");return l.id=n,t.appendChild(l),l}const s=a.createElement("div");return s.id=n,a.body.appendChild(s),s}function F(){return' <meta name="viewport" content="width=device-width, initial-scale=1.0" />'}function be(e){const{title:t="Markup AI Sidebar",headInnerHtml:n="",includePluginHostHead:i=!1,bodyScriptsHtml:a,htmlLang:o="en",htmlAttrs:s=`lang="${o}" style="height:100%"`,bodyAttrs:l='style="height:100%;margin:0"'}=e,c=[i?F():"",n].filter(h=>h.trim().length>0).join(`
|
|
137
137
|
`);return`<!DOCTYPE html>
|
|
138
138
|
<html ${s}>
|
|
139
139
|
<head>
|
|
@@ -146,4 +146,4 @@ ${c}`:""}
|
|
|
146
146
|
${a}
|
|
147
147
|
</body>
|
|
148
148
|
</html>
|
|
149
|
-
`}function Se(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}r.AUTH_CONFIG_OVERRIDE_STORAGE_KEY=
|
|
149
|
+
`}function Se(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}r.AUTH_CONFIG_OVERRIDE_STORAGE_KEY=B,r.DEFAULT_IPC_CONFIG=O,r.DEFAULT_SIDEBAR_CONFIG=X,r.DeferredPromise=T,r.IPCCore=C,r.MimeType=g,r.PluginAdapter=ie,r.PluginIPCAdapter=D,r.SIDEBAR_DEFAULT_PRODUCTION_BASE_URL=ge,r.SIDEBAR_HOST_CONTAINER_ID=b,r.SIDEBAR_HOST_SHELL_CSS=ye,r.SIDEBAR_IFRAME_DEFAULT_ALLOW=U,r.SIDEBAR_IFRAME_DEFAULT_TITLE=N,r.SIDEBAR_URL_OVERRIDE_STORAGE_KEY=de,r.SidebarAdapter=L,r.SidebarIPCAdapter=_,r.TEXT_MIME_TYPES=K,r.TextLookupError=A,r.assertSidebarHostAdapter=fe,r.buildDocumentReference=te,r.buildSidebarHostHtmlDocument=be,r.buildSidebarHostShellCss=S,r.buildSidebarPluginHostHeadInnerHtml=F,r.createSidebarHost=Ie,r.ensureSidebarHostShell=Ce,r.getAuthConfigWithOverride=pe,r.getSidebarBaseUrlWithOverride=ue,r.ipcErrorReconstructors=v,r.isDocumentReference=ee,r.isIntegrationSettingField=Z,r.isIntegrationSettingsSchema=q,r.isTextLookupError=Q,r.reconstructError=E,r.setupSidebarLoadOverlay=k,r.sidebarPostMessageTargetOrigin=he});
|
package/dist/types/common.d.ts
CHANGED
|
@@ -146,25 +146,11 @@ export interface SidebarConfig {
|
|
|
146
146
|
* pane). Defaults to `false` when omitted.
|
|
147
147
|
*/
|
|
148
148
|
hideBanner?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* JavaScript source the sidebar runs inside a host-rendered dialog to close it
|
|
151
|
-
* (see {@link PluginInterface.showDialog}/`closeDialog`). Lets hosts that render
|
|
152
|
-
* dialog chrome themselves supply the exact close call for their environment
|
|
153
|
-
* (e.g. `google.script.host.close();`). Omit when the host closes dialogs
|
|
154
|
-
* through the normal `closeDialog` IPC.
|
|
155
|
-
*/
|
|
156
|
-
dialogClosingScript?: string;
|
|
157
149
|
/**
|
|
158
150
|
* Origin of the plugin/editor window where messages should be sent
|
|
159
151
|
* This is the origin where the plugin is listening for messages from the sidebar
|
|
160
152
|
*/
|
|
161
153
|
pluginOrigin?: string;
|
|
162
|
-
/**
|
|
163
|
-
* Whether to use the check preview workflow dialog
|
|
164
|
-
* If true, the sidebar will show a check preview dialog where the user can apply issues to the content
|
|
165
|
-
* If false, the sidebar will not show a dialog, but there will be an issue tab on the sidebar from where the user can apply issues
|
|
166
|
-
*/
|
|
167
|
-
useCheckPreviewDialog: boolean;
|
|
168
154
|
/**
|
|
169
155
|
* Whether to support selection-based check and rewrite functionality
|
|
170
156
|
* If true or undefined (default), the selection toggle UI will be shown and users can toggle between full content and selection modes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;;GAIG;AACH,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,oBAAoB,yBAAyB;CAC9C;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,2GAKlB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;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E,OAAO,CAAC;IACrB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;;;;;;;OAgBG;IACH,8BAA8B,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,yBAAyB,CAAC;CACjD;AAED,eAAO,MAAM,sBAAsB,EAAE,aAQpC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -39,29 +39,6 @@ export interface PluginInterface {
|
|
|
39
39
|
* @throws {TextLookupError} When the requested text cannot be found or located (see SelectContentError)
|
|
40
40
|
*/
|
|
41
41
|
selectContent: (range: ContentRange, documentReference?: string | null) => Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Show a dialog in the editor.
|
|
44
|
-
*
|
|
45
|
-
* Optional: not every host embedding the sidebar has dialog support. Hosts
|
|
46
|
-
* without a dialog surface should omit this method (and `closeDialog`). The
|
|
47
|
-
* sidebar gates dialog workflows behind `SidebarConfig.useCheckPreviewDialog`,
|
|
48
|
-
* so a host that omits these should also leave that flag `false`.
|
|
49
|
-
*
|
|
50
|
-
* @param dialogHtml - The HTML content of the dialog
|
|
51
|
-
* @param width - Optional dialog width
|
|
52
|
-
* @param height - Optional dialog height
|
|
53
|
-
* @param title - Optional dialog title
|
|
54
|
-
* @returns Promise that resolves when dialog is shown
|
|
55
|
-
*/
|
|
56
|
-
showDialog?: (dialogHtml: string, width?: number, height?: number, title?: string) => Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Close the dialog in the editor.
|
|
59
|
-
*
|
|
60
|
-
* Optional: see `showDialog`. Omit on hosts without dialog support.
|
|
61
|
-
*
|
|
62
|
-
* @returns Promise that resolves when dialog is closed
|
|
63
|
-
*/
|
|
64
|
-
closeDialog?: () => Promise<void>;
|
|
65
42
|
/**
|
|
66
43
|
* Replace multiple contents in the editor
|
|
67
44
|
* @param replacements - Array of content replacements to apply
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pluginInterface.d.ts","sourceRoot":"","sources":["../../src/types/pluginInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/C;;;;;;;;OAQG;IACH,cAAc,EAAE,CACd,UAAU,EAAE,MAAM,EACl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ACtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAAE,EAC7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9E;;;;;;;;;;;OAWG;IACH,2BAA2B,CAAC,EAAE,CAC5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,EAC3C,MAAM,EAAE,MAAM,GAAG,MAAM,KACpB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,sBAAsB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7E;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;;;;;;;;;OAWG;IACH,2BAA2B,CAAC,EAAE,CAC5B,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE,6BAA6B,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markupai/sidebar-adapter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Adapter package for MarkupAI Sidebar integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markupai",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"type-check": "tsc --project tsconfig.json --noEmit"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@asyncapi/parser": "^3.6.
|
|
46
|
+
"@asyncapi/parser": "^3.6.3",
|
|
47
47
|
"ajv": "^8.20.0",
|
|
48
48
|
"ts-json-schema-generator": "^2.9.0",
|
|
49
|
-
"tsc-alias": "1.
|
|
49
|
+
"tsc-alias": "1.9.2"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|