@disy/cadenza.js 2.9.0 → 2.10.1
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/CHANGELOG.md +12 -1
- package/apidoc/assets/navigation.js +1 -1
- package/apidoc/assets/search.js +1 -1
- package/apidoc/classes/AbortError.html +2 -2
- package/apidoc/classes/CadenzaClient.html +22 -19
- package/apidoc/classes/CadenzaError.html +3 -3
- package/apidoc/functions/cadenza.html +2 -2
- package/apidoc/interfaces/CadenzaClientOptions.html +5 -5
- package/apidoc/interfaces/CadenzaEvent.html +3 -3
- package/apidoc/interfaces/ExternalLinkKey.html +3 -3
- package/apidoc/interfaces/Geometry.html +2 -2
- package/apidoc/interfaces/PageSource.html +2 -2
- package/apidoc/modules.html +1 -0
- package/apidoc/types/CadenzaChangeSelectionEvent.html +1 -1
- package/apidoc/types/CadenzaDrillThroughEvent.html +1 -1
- package/apidoc/types/CadenzaEditGeometryCancelEvent.html +1 -1
- package/apidoc/types/CadenzaEditGeometryOkEvent.html +1 -1
- package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +1 -1
- package/apidoc/types/CadenzaErrorEvent.html +1 -1
- package/apidoc/types/CadenzaEventByType.html +1 -1
- package/apidoc/types/CadenzaEventType.html +2 -2
- package/apidoc/types/CadenzaObjectInfoEvent.html +1 -1
- package/apidoc/types/CadenzaReloadEvent.html +5 -0
- package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +1 -1
- package/apidoc/types/CadenzaSelectObjectsOkEvent.html +1 -1
- package/apidoc/types/DataType.html +1 -1
- package/apidoc/types/EmbeddingTargetId.html +1 -1
- package/apidoc/types/Extent.html +1 -1
- package/apidoc/types/FilterVariables.html +1 -1
- package/apidoc/types/GeometryType.html +1 -1
- package/apidoc/types/GlobalId.html +1 -1
- package/apidoc/types/OpaqueString.html +1 -1
- package/apidoc/types/OperationMode.html +1 -1
- package/apidoc/types/TablePart.html +1 -1
- package/apidoc/types/UiFeature.html +1 -1
- package/apidoc/types/WorkbookLayerPath.html +1 -1
- package/cadenza.d.ts +25 -2
- package/cadenza.js +26 -7
- package/package.json +1 -1
package/cadenza.js
CHANGED
|
@@ -190,12 +190,11 @@ export class CadenzaClient {
|
|
|
190
190
|
return this.#iframeElement;
|
|
191
191
|
}
|
|
192
192
|
get #targetWindow() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return /** @type {WindowProxy} */ targetWindow;
|
|
193
|
+
const targetWindow = this.#iframe
|
|
194
|
+
? this.iframe?.contentWindow
|
|
195
|
+
: // If a window does not have a parent, its parent property is a reference to itself.
|
|
196
|
+
window.opener ?? (window.parent !== window ? window.parent : null);
|
|
197
|
+
return /** @type {WindowProxy | null} */ targetWindow;
|
|
199
198
|
}
|
|
200
199
|
get #requiredIframe() {
|
|
201
200
|
const iframe = /** @type {HTMLIFrameElement} */ (this.iframe);
|
|
@@ -611,6 +610,15 @@ export class CadenzaClient {
|
|
|
611
610
|
}
|
|
612
611
|
});
|
|
613
612
|
};
|
|
613
|
+
/**
|
|
614
|
+
* Remove all subscriptions.
|
|
615
|
+
*
|
|
616
|
+
* @see {@link CadenzaClient#on}
|
|
617
|
+
*/
|
|
618
|
+
destroy() {
|
|
619
|
+
this.#subscriptions = [];
|
|
620
|
+
window.removeEventListener('message', this.#onMessage);
|
|
621
|
+
}
|
|
614
622
|
/**
|
|
615
623
|
* Posts an event to Cadenza and returns a `Promise` for the response.
|
|
616
624
|
*
|
|
@@ -646,7 +654,9 @@ export class CadenzaClient {
|
|
|
646
654
|
#postEvent(type, detail, transfer) {
|
|
647
655
|
const cadenzaEvent = { type, detail };
|
|
648
656
|
this.#log('postMessage', cadenzaEvent);
|
|
649
|
-
this.#targetWindow
|
|
657
|
+
const targetWindow = this.#targetWindow;
|
|
658
|
+
assert(targetWindow != null, 'Cannot find target window');
|
|
659
|
+
targetWindow.postMessage(cadenzaEvent, {
|
|
650
660
|
targetOrigin: this.#origin,
|
|
651
661
|
transfer,
|
|
652
662
|
});
|
|
@@ -926,6 +936,7 @@ function array(/** @type unknown */ value) {
|
|
|
926
936
|
* | 'objectInfo'
|
|
927
937
|
* | 'selectObjects:ok'
|
|
928
938
|
* | 'selectObjects:cancel'
|
|
939
|
+
* | 'reload'
|
|
929
940
|
* } CadenzaEventType - An event type to subscribe to using {@link CadenzaClient#on}
|
|
930
941
|
*/
|
|
931
942
|
/**
|
|
@@ -938,6 +949,7 @@ function array(/** @type unknown */ value) {
|
|
|
938
949
|
* : T extends 'objectInfo' ? CadenzaObjectInfoEvent
|
|
939
950
|
* : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent
|
|
940
951
|
* : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent
|
|
952
|
+
* : T extends 'reload' ? CadenzaReloadEvent
|
|
941
953
|
* : never
|
|
942
954
|
* } CadenzaEventByType
|
|
943
955
|
*/
|
|
@@ -978,6 +990,13 @@ function array(/** @type unknown */ value) {
|
|
|
978
990
|
* For a selection in a workbook map view with activated feature info, the values also include the simplified geometries of the selected objects.
|
|
979
991
|
*/
|
|
980
992
|
/** @typedef {CadenzaEvent<'selectObjects:cancel'>} CadenzaSelectObjectsCancelEvent - When the user cancelled the selection. */
|
|
993
|
+
/**
|
|
994
|
+
* @typedef {CadenzaEvent<'reload'>} CadenzaReloadEvent - When the user clicked on the 'reload' button in the embedding standby page
|
|
995
|
+
*
|
|
996
|
+
* If a user does not interact with the iframe displaying the Cadenza content for a while, a standby embed page is displayed
|
|
997
|
+
* and the user can click a reload button there. Then the application using Cadenza JS can re-trigger the loading of the iframe
|
|
998
|
+
* with the correct original URL and parameters and do what was originally done when displaying that iframe.
|
|
999
|
+
*/
|
|
981
1000
|
export class AbortError extends DOMException {
|
|
982
1001
|
constructor() {
|
|
983
1002
|
super('Aborted', 'AbortError');
|