@disy/cadenza.js 0.0.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.
@@ -0,0 +1,60 @@
1
+ <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>WorksheetSource | Cadenza JS</title><meta name="description" content="Documentation for Cadenza JS"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
2
+ <div class="tsd-toolbar-contents container">
3
+ <div class="table-cell" id="tsd-search" data-base="..">
4
+ <div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
5
+ <div class="field">
6
+ <div id="tsd-toolbar-links"></div></div>
7
+ <ul class="results">
8
+ <li class="state loading">Preparing search index...</li>
9
+ <li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">Cadenza JS</a></div>
10
+ <div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
11
+ <div class="container container-main">
12
+ <div class="col-content">
13
+ <div class="tsd-page-title">
14
+ <ul class="tsd-breadcrumb">
15
+ <li><a href="../modules.html">Cadenza JS</a></li>
16
+ <li><a href="WorksheetSource.html">WorksheetSource</a></li></ul>
17
+ <h1>Type alias WorksheetSource</h1></div>
18
+ <div class="tsd-signature"><span class="tsd-kind-type-alias">Worksheet<wbr/>Source</span><span class="tsd-signature-symbol">:</span> <a href="EmbeddingTargetId.html" class="tsd-signature-type tsd-kind-type-alias">EmbeddingTargetId</a><span class="tsd-signature-symbol"> | </span><a href="../interfaces/WorksheetKey.html" class="tsd-signature-type tsd-kind-interface">WorksheetKey</a></div>
19
+ <div class="tsd-comment tsd-typography"><p>A worksheet source</p>
20
+ </div>
21
+ <div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
22
+ <ul>
23
+ <li>Defined in <a href="https://github.com/DisyInformationssysteme/cadenza.js/blob/68d655f/src/cadenza.js#L48">src/cadenza.js:48</a></li></ul></aside></div>
24
+ <div class="col-sidebar">
25
+ <div class="page-menu">
26
+ <div class="tsd-navigation settings">
27
+ <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
28
+ <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)" id="icon-chevronDown"></path></svg>Settings</h3></summary>
29
+ <div class="tsd-accordion-details">
30
+ <div class="tsd-filter-visibility">
31
+ <h4 class="uppercase">Member Visibility</h4><form>
32
+ <ul id="tsd-filter-options">
33
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
34
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li>
35
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
36
+ <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div>
37
+ <div class="tsd-theme-toggle">
38
+ <h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div>
39
+ <div class="site-menu">
40
+ <nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g></svg><span>Cadenza JS</span></a>
41
+ <ul class="tsd-small-nested-navigation">
42
+ <li><a href="../classes/AbortError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g></svg><span>Abort<wbr/>Error</span></a></li>
43
+ <li><a href="../classes/CadenzaClient.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Cadenza<wbr/>Client</span></a></li>
44
+ <li><a href="../classes/CadenzaError.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Cadenza<wbr/>Error</span></a></li>
45
+ <li><a href="../interfaces/CadenzaEvent.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g></svg><span>Cadenza<wbr/>Event</span></a></li>
46
+ <li><a href="../interfaces/Geometry.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Geometry</span></a></li>
47
+ <li><a href="../interfaces/WorkbookKey.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Workbook<wbr/>Key</span></a></li>
48
+ <li><a href="../interfaces/WorkbookViewKey.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Workbook<wbr/>View<wbr/>Key</span></a></li>
49
+ <li><a href="../interfaces/WorksheetKey.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Worksheet<wbr/>Key</span></a></li>
50
+ <li><a href="CadenzaErrorEvent.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-4194304"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g></svg><span>Cadenza<wbr/>Error<wbr/>Event</span></a></li>
51
+ <li><a href="EmbeddingTargetId.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Embedding<wbr/>Target<wbr/>Id</span></a></li>
52
+ <li><a href="Extent.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Extent</span></a></li>
53
+ <li><a href="GeometryType.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Geometry<wbr/>Type</span></a></li>
54
+ <li><a href="WorkbookSource.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Workbook<wbr/>Source</span></a></li>
55
+ <li><a href="WorkbookViewSource.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Workbook<wbr/>View<wbr/>Source</span></a></li>
56
+ <li><a href="WorksheetSource.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4194304"></use></svg><span>Worksheet<wbr/>Source</span></a></li>
57
+ <li><a href="../functions/cadenza.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g></svg><span>cadenza</span></a></li></ul></nav></div></div></div>
58
+ <div class="tsd-generator">
59
+ <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
60
+ <div class="overlay"></div></body></html>
package/cadenza.d.ts ADDED
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Creates a new Cadenza instance of the Cadenza JS client.
3
+ *
4
+ * @param {string} baseUrl - The base URL of the Cadenza server
5
+ * @param {object} [options] - Options
6
+ * @param {HTMLIFrameElement | string} [options.iframe] - An iframe for embedding Cadenza or the iframe's ID
7
+ * @param {boolean} [options.debug] - Whether to enable debug logging
8
+ * @throws For invalid base URL
9
+ */
10
+ export function cadenza(baseUrl: string, options?: {
11
+ iframe?: string | HTMLIFrameElement | undefined;
12
+ debug?: boolean | undefined;
13
+ } | undefined): CadenzaClient;
14
+ /** @typedef {string} EmbeddingTargetId - The ID of an embedding target */
15
+ /**
16
+ * @typedef WorkbookKey - A tuple qualifying a workbook
17
+ * @property {string} repositoryName - The name of the workbook's repository
18
+ * @property {string} workbookId - The ID of the workbook
19
+ */
20
+ /**
21
+ * @typedef WorksheetKey - A tuple qualifying a worksheet
22
+ * @property {string} repositoryName - The name of the workbook's repository
23
+ * @property {string} workbookId - The ID of the workbook
24
+ * @property {string} worksheetId - The ID of the worksheet
25
+ */
26
+ /**
27
+ * @typedef WorkbookViewKey - A tuple qualifying a workbook view
28
+ * @property {string} repositoryName - The name of the workbook's repository
29
+ * @property {string} workbookId - The ID of the workbook
30
+ * @property {string} viewId - The ID of the view
31
+ */
32
+ /** @typedef {EmbeddingTargetId | WorkbookKey} WorkbookSource - A workbook source */
33
+ /** @typedef {EmbeddingTargetId | WorksheetKey} WorksheetSource - A worksheet source */
34
+ /** @typedef {EmbeddingTargetId | WorkbookViewKey} WorkbookViewSource - A workbook view source */
35
+ /**
36
+ * @typedef Geometry - A [GeoJSON](https://geojson.org/) geometry object
37
+ * @property {GeometryType} type - The type of the geometry
38
+ */
39
+ /**
40
+ * @typedef {'Point'|'MultiPoint'|'LineString'|'MultiLineString'|'Polygon'|'MultiPolygon'} GeometryType - A GeoJSON geometry type
41
+ *
42
+ * _Note:_ The GeoJSON geometry type "GeometryCollection" is currently not supported.
43
+ */
44
+ /** @typedef {[number,number,number,number]} Extent - An array of numbers representing an extent: [minx, miny, maxx, maxy] */
45
+ /**
46
+ * _Notes:_
47
+ * * Most public methods can be aborted using an [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal).
48
+ * When aborted, the result Promise is rejected with an {@link AbortError}.
49
+ * * If there's another error, the result Promise is rejected with a {@link CadenzaError}.
50
+ * * For methods that support the `hideMainHeaderAndFooter` and `hideWorkbookToolBar` parameters - the parameters cannot override the configuration of an embedding target.
51
+ * * For methods that support the `locationFinder` and `mapExtent` parameters - when both are given, the `mapExtent` takes precedence.
52
+ */
53
+ export class CadenzaClient {
54
+ /**
55
+ * @hidden
56
+ * @param {string} baseUrl
57
+ * @param {object} [options]
58
+ * @param {HTMLIFrameElement | string} [options.iframe]
59
+ * @param {boolean} [options.debug]
60
+ */
61
+ constructor(baseUrl: string, { debug, iframe }?: {
62
+ iframe?: string | HTMLIFrameElement | undefined;
63
+ debug?: boolean | undefined;
64
+ } | undefined);
65
+ /** The base URL of the Cadenza server this client is requesting */
66
+ get baseUrl(): string;
67
+ /** The iframe this client is using for embedding Cadenza. */
68
+ get iframe(): HTMLIFrameElement | undefined;
69
+ /**
70
+ * Show a workbook, worksheet or workbook view in an iframe.
71
+ *
72
+ * @param {WorkbookSource | WorksheetSource | WorkbookViewSource} source - The source to show
73
+ * @param {object} [options]
74
+ * @param {boolean} [options.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer.
75
+ * @param {boolean} [options.hideWorkbookToolBar] - Whether to hide the workbook toolbar.
76
+ * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
77
+ * @return {Promise<void>} A Promise for when the iframe is loaded
78
+ * @throws For an invalid source
79
+ */
80
+ show(source: WorkbookSource | WorksheetSource | WorkbookViewSource, { hideMainHeaderAndFooter, hideWorkbookToolBar, signal }?: {
81
+ hideMainHeaderAndFooter?: boolean | undefined;
82
+ hideWorkbookToolBar?: boolean | undefined;
83
+ signal?: AbortSignal | undefined;
84
+ } | undefined): Promise<void>;
85
+ /**
86
+ * Show a workbook map view in an iframe.
87
+ *
88
+ * @param {WorkbookViewSource} mapView - The workbook map view to show
89
+ * @param {object} [options] - Options
90
+ * @param {Geometry} [options.geometry] - A geometry to show on the map
91
+ * @param {boolean} [options.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer.
92
+ * @param {boolean} [options.hideWorkbookToolBar] - Whether to hide the workbook toolbar.
93
+ * @param {string} [options.locationFinder] - A search query for the location finder
94
+ * @param {Extent} [options.mapExtent] - A map extent to set
95
+ * @param {boolean} [options.useMapSrs] - Whether the geometry and the extent are in the map's SRS (otherwise EPSG:4326 is assumed)
96
+ * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
97
+ * @return {Promise<void>} A Promise for when the iframe is loaded
98
+ * @throws For an invalid workbook view source or geometry type
99
+ */
100
+ showMap(mapView: WorkbookViewSource, { geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, locationFinder, mapExtent, useMapSrs, signal, }?: {
101
+ geometry?: Geometry | undefined;
102
+ hideMainHeaderAndFooter?: boolean | undefined;
103
+ hideWorkbookToolBar?: boolean | undefined;
104
+ locationFinder?: string | undefined;
105
+ mapExtent?: Extent | undefined;
106
+ useMapSrs?: boolean | undefined;
107
+ signal?: AbortSignal | undefined;
108
+ } | undefined): Promise<void>;
109
+ /**
110
+ * Create a geometry.
111
+ *
112
+ * _Note:_ Under the hood, creating a geometry is similar to editing a geometry.
113
+ * That's why the events use the `editGeometry` prefix.
114
+ *
115
+ * @param {WorkbookViewSource} backgroundMapView - The workbook map view in the background
116
+ * @param {GeometryType} geometryType - The geometry type
117
+ * @param {object} [options] - Options
118
+ * @param {Extent} [options.mapExtent] - A map extent to set
119
+ * @param {string} [options.locationFinder] - A search query for the location finder
120
+ * @param {boolean} [options.useMapSrs] - Whether the created geometry should use the map's SRS (otherwise EPSG:4326 will be used)
121
+ * @param {number} [options.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
122
+ * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
123
+ * @return {Promise<void>} A Promise for when the iframe is loaded
124
+ * @throws For an invalid workbook view source or geometry type
125
+ * @fires `editGeometry:update` - When the user changed the geometry. The event includes the edited geometry.
126
+ * @fires `editGeometry:ok` - When the user completed the geometry editing. The event includes the edited geometry.
127
+ * @fires `editGeometry:cancel` - When the user cancelled the geometry editing in Cadenza.
128
+ */
129
+ createGeometry(backgroundMapView: WorkbookViewSource, geometryType: GeometryType, { mapExtent, locationFinder, useMapSrs, minScale, signal }?: {
130
+ mapExtent?: Extent | undefined;
131
+ locationFinder?: string | undefined;
132
+ useMapSrs?: boolean | undefined;
133
+ minScale?: number | undefined;
134
+ signal?: AbortSignal | undefined;
135
+ } | undefined): Promise<void>;
136
+ /**
137
+ * Edit a geometry.
138
+ *
139
+ * @param {WorkbookViewSource} backgroundMapView - The workbook map view in the background
140
+ * @param {Geometry} geometry - The geometry
141
+ * @param {object} [options] - Options
142
+ * @param {string} [options.locationFinder] - A search query for the location finder
143
+ * @param {Extent} [options.mapExtent] - A map extent to set
144
+ * @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
145
+ * @param {number} [options.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
146
+ * @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
147
+ * @return {Promise<void>} A Promise for when the iframe is loaded
148
+ * @throws For an invalid workbook view source
149
+ * @fires `editGeometry:update` - When the user changed the geometry. The event includes the edited geometry.
150
+ * @fires `editGeometry:ok` - When the user completed the geometry editing. The event includes the edited geometry.
151
+ * @fires `editGeometry:cancel` - When the user cancelled the geometry editing in Cadenza.
152
+ */
153
+ editGeometry(backgroundMapView: WorkbookViewSource, geometry: Geometry, { mapExtent, locationFinder, useMapSrs, minScale, signal }?: {
154
+ locationFinder?: string | undefined;
155
+ mapExtent?: Extent | undefined;
156
+ useMapSrs?: boolean | undefined;
157
+ minScale?: number | undefined;
158
+ signal?: AbortSignal | undefined;
159
+ } | undefined): Promise<void>;
160
+ /**
161
+ * Subscribe to a `postMessage()` event.
162
+ *
163
+ * @template [T=unknown]
164
+ * @param {string} type - The event type
165
+ * @param {(event: CadenzaEvent<T>) => void} subscriber - The subscriber function
166
+ * @return {() => void} An unsubscribe function
167
+ */
168
+ on<T = unknown>(type: string, subscriber: (event: CadenzaEvent<T>) => void): () => void;
169
+ #private;
170
+ }
171
+ /**
172
+ * @template [T=unknown]
173
+ * @typedef CadenzaEvent - A Cadenza `postMessage()` event
174
+ * @property {string} type - The event type
175
+ * @property {T} detail - Optional event details (depending on the event type)
176
+ */
177
+ /** @typedef {CadenzaEvent<{type: string, message?: string}>} CadenzaErrorEvent - An error event that is mapped to a {@link CadenzaError} */
178
+ export class AbortError extends DOMException {
179
+ constructor();
180
+ }
181
+ /**
182
+ * An `Error` implementation for errors in the communication with Cadenza.
183
+ *
184
+ * _Note:_ For invalid parameters, the Cadenza client will throw "normal" `Error`s.
185
+ */
186
+ export class CadenzaError extends Error {
187
+ /**
188
+ * @param {string} type - The technical identifier of the error
189
+ * @param {string} message - A description of the error
190
+ */
191
+ constructor(type: string, message: string);
192
+ get type(): string;
193
+ #private;
194
+ }
195
+ /**
196
+ * - The ID of an embedding target
197
+ */
198
+ export type EmbeddingTargetId = string;
199
+ /**
200
+ * - A tuple qualifying a workbook
201
+ */
202
+ export type WorkbookKey = {
203
+ /**
204
+ * - The name of the workbook's repository
205
+ */
206
+ repositoryName: string;
207
+ /**
208
+ * - The ID of the workbook
209
+ */
210
+ workbookId: string;
211
+ };
212
+ /**
213
+ * - A tuple qualifying a worksheet
214
+ */
215
+ export type WorksheetKey = {
216
+ /**
217
+ * - The name of the workbook's repository
218
+ */
219
+ repositoryName: string;
220
+ /**
221
+ * - The ID of the workbook
222
+ */
223
+ workbookId: string;
224
+ /**
225
+ * - The ID of the worksheet
226
+ */
227
+ worksheetId: string;
228
+ };
229
+ /**
230
+ * - A tuple qualifying a workbook view
231
+ */
232
+ export type WorkbookViewKey = {
233
+ /**
234
+ * - The name of the workbook's repository
235
+ */
236
+ repositoryName: string;
237
+ /**
238
+ * - The ID of the workbook
239
+ */
240
+ workbookId: string;
241
+ /**
242
+ * - The ID of the view
243
+ */
244
+ viewId: string;
245
+ };
246
+ /**
247
+ * - A workbook source
248
+ */
249
+ export type WorkbookSource = EmbeddingTargetId | WorkbookKey;
250
+ /**
251
+ * - A worksheet source
252
+ */
253
+ export type WorksheetSource = EmbeddingTargetId | WorksheetKey;
254
+ /**
255
+ * - A workbook view source
256
+ */
257
+ export type WorkbookViewSource = EmbeddingTargetId | WorkbookViewKey;
258
+ /**
259
+ * - A [GeoJSON](https://geojson.org/) geometry object
260
+ */
261
+ export type Geometry = {
262
+ /**
263
+ * - The type of the geometry
264
+ */
265
+ type: GeometryType;
266
+ };
267
+ /**
268
+ * - A GeoJSON geometry type
269
+ *
270
+ * _Note:_ The GeoJSON geometry type "GeometryCollection" is currently not supported.
271
+ */
272
+ export type GeometryType = 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon';
273
+ /**
274
+ * - An array of numbers representing an extent: [minx, miny, maxx, maxy]
275
+ */
276
+ export type Extent = [number, number, number, number];
277
+ /**
278
+ * - A Cadenza `postMessage()` event
279
+ */
280
+ export type CadenzaEvent<T = unknown> = {
281
+ /**
282
+ * - The event type
283
+ */
284
+ type: string;
285
+ /**
286
+ * - Optional event details (depending on the event type)
287
+ */
288
+ detail: T;
289
+ };
290
+ /**
291
+ * - An error event that is mapped to a {@link CadenzaError }
292
+ */
293
+ export type CadenzaErrorEvent = CadenzaEvent<{
294
+ type: string;
295
+ message?: string;
296
+ }>;