@open-pioneer/runtime 2.4.0-dev.20241120092632 → 3.0.0-dev.20250221111321

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 CHANGED
@@ -1,80 +1,102 @@
1
1
  # @open-pioneer/runtime
2
2
 
3
- ## 2.4.0-dev.20241120092632
3
+ ## 3.0.0-dev.20250221111321
4
+
5
+ ### Major Changes
6
+
7
+ - 9477e54: Update dependencies
8
+
9
+ - React 19
10
+ - Vite 6
11
+ - FormatJS 3
12
+ - Open Pioneer Build Tools
13
+ - ...
14
+
15
+ For more details, see https://github.com/open-pioneer/trails-core-packages/pull/81
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [9477e54]
20
+ - @open-pioneer/base-theme@3.0.0-dev.20250221111321
21
+ - @open-pioneer/chakra-integration@3.0.0-dev.20250221111321
22
+ - @open-pioneer/core@3.0.0-dev.20250221111321
23
+ - @open-pioneer/runtime-react-support@3.0.0-dev.20250221111321
24
+
25
+ ## 2.4.0
4
26
 
5
27
  ### Minor Changes
6
28
 
7
- - e3802fb: Introduce `NumberParserService` for parsing strings to numbers in the application's current locale.
8
- - ac39468: Introducing an error screen that is shown in case of hard errors on app start.
29
+ - e3802fb: Introduce `NumberParserService` for parsing strings to numbers in the application's current locale.
30
+ - ac39468: Introducing an error screen that is shown in case of hard errors on app start.
9
31
 
10
32
  ### Patch Changes
11
33
 
12
- - 1b63ebe: Update dependencies
13
- - Updated dependencies [1b63ebe]
14
- - Updated dependencies [e3802fb]
15
- - @open-pioneer/chakra-integration@2.4.0-dev.20241120092632
16
- - @open-pioneer/base-theme@2.4.0-dev.20241120092632
17
- - @open-pioneer/core@2.4.0-dev.20241120092632
18
- - @open-pioneer/runtime-react-support@2.4.0-dev.20241120092632
34
+ - 1b63ebe: Update dependencies
35
+ - Updated dependencies [1b63ebe]
36
+ - Updated dependencies [e3802fb]
37
+ - @open-pioneer/chakra-integration@2.4.0
38
+ - @open-pioneer/base-theme@2.4.0
39
+ - @open-pioneer/core@2.4.0
40
+ - @open-pioneer/runtime-react-support@2.4.0
19
41
 
20
42
  ## 2.3.0
21
43
 
22
44
  ### Minor Changes
23
45
 
24
- - 2fbaaa0: Use normal `dependencies` instead of `peerDependencies`. Peer dependencies have some usability issues (and bugs) when used at scale.
46
+ - 2fbaaa0: Use normal `dependencies` instead of `peerDependencies`. Peer dependencies have some usability issues (and bugs) when used at scale.
25
47
 
26
48
  ### Patch Changes
27
49
 
28
- - Updated dependencies [2fbaaa0]
29
- - @open-pioneer/runtime-react-support@2.3.0
30
- - @open-pioneer/chakra-integration@2.3.0
31
- - @open-pioneer/base-theme@2.3.0
32
- - @open-pioneer/core@2.3.0
50
+ - Updated dependencies [2fbaaa0]
51
+ - @open-pioneer/runtime-react-support@2.3.0
52
+ - @open-pioneer/chakra-integration@2.3.0
53
+ - @open-pioneer/base-theme@2.3.0
54
+ - @open-pioneer/core@2.3.0
33
55
 
34
56
  ## 2.2.0
35
57
 
36
58
  ### Patch Changes
37
59
 
38
- - 39dad46: Switch to a new versioning strategy.
39
- From now on, packages released by this repository share a common version number.
40
- - Updated dependencies [39dad46]
41
- - @open-pioneer/base-theme@2.2.0
42
- - @open-pioneer/chakra-integration@2.2.0
43
- - @open-pioneer/core@2.2.0
44
- - @open-pioneer/runtime-react-support@2.2.0
60
+ - 39dad46: Switch to a new versioning strategy.
61
+ From now on, packages released by this repository share a common version number.
62
+ - Updated dependencies [39dad46]
63
+ - @open-pioneer/base-theme@2.2.0
64
+ - @open-pioneer/chakra-integration@2.2.0
65
+ - @open-pioneer/core@2.2.0
66
+ - @open-pioneer/runtime-react-support@2.2.0
45
67
 
46
68
  ## 2.1.7
47
69
 
48
70
  ### Patch Changes
49
71
 
50
- - 58ce24f: Export `DECLARE_SERVICE_INTERFACE` as a value instead of a type only.
51
- It was previously necessary to import this symbol via `import type` to avoid errors during development.
52
- The `type` keyword can now be omitted.
53
- - e0b2fae: Update dependencies
54
- - 6cc7fcd: Allow synchronous `getApiMethods()` when implementing an `ApiExtension`.
55
- - Updated dependencies [5c62522]
56
- - Updated dependencies [50550d3]
57
- - Updated dependencies [e0b2fae]
58
- - @open-pioneer/chakra-integration@1.1.4
59
- - @open-pioneer/core@1.3.0
60
- - @open-pioneer/base-theme@0.3.3
61
- - @open-pioneer/runtime-react-support@1.0.2
72
+ - 58ce24f: Export `DECLARE_SERVICE_INTERFACE` as a value instead of a type only.
73
+ It was previously necessary to import this symbol via `import type` to avoid errors during development.
74
+ The `type` keyword can now be omitted.
75
+ - e0b2fae: Update dependencies
76
+ - 6cc7fcd: Allow synchronous `getApiMethods()` when implementing an `ApiExtension`.
77
+ - Updated dependencies [5c62522]
78
+ - Updated dependencies [50550d3]
79
+ - Updated dependencies [e0b2fae]
80
+ - @open-pioneer/chakra-integration@1.1.4
81
+ - @open-pioneer/core@1.3.0
82
+ - @open-pioneer/base-theme@0.3.3
83
+ - @open-pioneer/runtime-react-support@1.0.2
62
84
 
63
85
  ## 2.1.6
64
86
 
65
87
  ### Patch Changes
66
88
 
67
- - e945264: Improve error message when metadata is missing (#55)
68
- - @open-pioneer/runtime-react-support@1.0.2
89
+ - e945264: Improve error message when metadata is missing (#55)
90
+ - @open-pioneer/runtime-react-support@1.0.2
69
91
 
70
92
  ## 2.1.5
71
93
 
72
94
  ### Patch Changes
73
95
 
74
- - 90d0cce: The `resolveConfig` callback of an app's configuration can now inspect the application's `hostElement`.
75
- - 90d0cce: Add a builtin method on the `ApplicationContext` to change the application's locale.
76
- Note that with the current implementation, the application will simply restart with the new locale.
77
- The application's state will be lost.
96
+ - 90d0cce: The `resolveConfig` callback of an app's configuration can now inspect the application's `hostElement`.
97
+ - 90d0cce: Add a builtin method on the `ApplicationContext` to change the application's locale.
98
+ Note that with the current implementation, the application will simply restart with the new locale.
99
+ The application's state will be lost.
78
100
 
79
101
  Example:
80
102
 
@@ -85,55 +107,55 @@
85
107
  appCtx.setLocale("en-US");
86
108
  ```
87
109
 
88
- - @open-pioneer/runtime-react-support@1.0.2
110
+ - @open-pioneer/runtime-react-support@1.0.2
89
111
 
90
112
  ## 2.1.4
91
113
 
92
114
  ### Patch Changes
93
115
 
94
- - 64645aa: Update to react 18.3
95
- - b3c60f2: Harmonize naming of Open Pioneer Trails in READMEs and package.json files.
96
- - Updated dependencies [5d3aafd]
97
- - Updated dependencies [64645aa]
98
- - Updated dependencies [64645aa]
99
- - Updated dependencies [b3c60f2]
100
- - @open-pioneer/core@1.2.3
101
- - @open-pioneer/runtime-react-support@1.0.2
102
- - @open-pioneer/chakra-integration@1.1.3
103
- - @open-pioneer/base-theme@0.3.2
116
+ - 64645aa: Update to react 18.3
117
+ - b3c60f2: Harmonize naming of Open Pioneer Trails in READMEs and package.json files.
118
+ - Updated dependencies [5d3aafd]
119
+ - Updated dependencies [64645aa]
120
+ - Updated dependencies [64645aa]
121
+ - Updated dependencies [b3c60f2]
122
+ - @open-pioneer/core@1.2.3
123
+ - @open-pioneer/runtime-react-support@1.0.2
124
+ - @open-pioneer/chakra-integration@1.1.3
125
+ - @open-pioneer/base-theme@0.3.2
104
126
 
105
127
  ## 2.1.3
106
128
 
107
129
  ### Patch Changes
108
130
 
109
- - 5ff8f30: Update package.json metadata.
110
- - Updated dependencies [be236af]
111
- - Updated dependencies [5ff8f30]
112
- - @open-pioneer/base-theme@0.3.1
113
- - @open-pioneer/runtime-react-support@1.0.1
114
- - @open-pioneer/chakra-integration@1.1.2
115
- - @open-pioneer/core@1.2.2
131
+ - 5ff8f30: Update package.json metadata.
132
+ - Updated dependencies [be236af]
133
+ - Updated dependencies [5ff8f30]
134
+ - @open-pioneer/base-theme@0.3.1
135
+ - @open-pioneer/runtime-react-support@1.0.1
136
+ - @open-pioneer/chakra-integration@1.1.2
137
+ - @open-pioneer/core@1.2.2
116
138
 
117
139
  ## 2.1.2
118
140
 
119
141
  ### Patch Changes
120
142
 
121
- - Updated dependencies [6380aa4]
122
- - @open-pioneer/base-theme@0.3.0
123
- - @open-pioneer/runtime-react-support@1.0.0
143
+ - Updated dependencies [6380aa4]
144
+ - @open-pioneer/base-theme@0.3.0
145
+ - @open-pioneer/runtime-react-support@1.0.0
124
146
 
125
147
  ## 2.1.1
126
148
 
127
149
  ### Patch Changes
128
150
 
129
- - f749d96: Add a hint that `DECLARE_SERVICE_INTERFACE` should be imported via `import type`.
130
- - @open-pioneer/runtime-react-support@1.0.0
151
+ - f749d96: Add a hint that `DECLARE_SERVICE_INTERFACE` should be imported via `import type`.
152
+ - @open-pioneer/runtime-react-support@1.0.0
131
153
 
132
154
  ## 2.1.0
133
155
 
134
156
  ### Minor Changes
135
157
 
136
- - 80cd62d: Improve TypeScript integration for service classes.
158
+ - 80cd62d: Improve TypeScript integration for service classes.
137
159
 
138
160
  Add a way for a service class to specify its interface name directly.
139
161
  Usually services used across package boundaries split their public interface and their implementation such as this:
@@ -178,37 +200,37 @@
178
200
 
179
201
  ### Patch Changes
180
202
 
181
- - @open-pioneer/runtime-react-support@1.0.0
203
+ - @open-pioneer/runtime-react-support@1.0.0
182
204
 
183
205
  ## 2.0.2
184
206
 
185
207
  ### Patch Changes
186
208
 
187
- - Updated dependencies [11b1428]
188
- - @open-pioneer/core@1.2.1
189
- - @open-pioneer/runtime-react-support@1.0.0
209
+ - Updated dependencies [11b1428]
210
+ - @open-pioneer/core@1.2.1
211
+ - @open-pioneer/runtime-react-support@1.0.0
190
212
 
191
213
  ## 2.0.1
192
214
 
193
215
  ### Patch Changes
194
216
 
195
- - Updated dependencies [a18d227]
196
- - @open-pioneer/core@1.2.0
197
- - @open-pioneer/runtime-react-support@1.0.0
217
+ - Updated dependencies [a18d227]
218
+ - @open-pioneer/core@1.2.0
219
+ - @open-pioneer/runtime-react-support@1.0.0
198
220
 
199
221
  ## 2.0.0
200
222
 
201
223
  ### Major Changes
202
224
 
203
- - ce9e060: Remove support for closed shadow roots.
204
- Shadow roots used by Open Pioneer Trails applications are now always `"open"`.
205
- See #19.
206
- - 6f954e3: **Breaking Change**: change how services integrate into TypeScript (fixes #22).
207
- The old TypeScript integration had unexpected edge cases, see the linked issue.
225
+ - ce9e060: Remove support for closed shadow roots.
226
+ Shadow roots used by Open Pioneer Trails applications are now always `"open"`.
227
+ See #19.
228
+ - 6f954e3: **Breaking Change**: change how services integrate into TypeScript (fixes #22).
229
+ The old TypeScript integration had unexpected edge cases, see the linked issue.
208
230
 
209
231
  NOTE: The changes below have no impact on runtime behavior, but they may trigger TypeScript errors in your code.
210
232
 
211
- - To register a service's type with TypeScript, one previously used a block such as this:
233
+ - To register a service's type with TypeScript, one previously used a block such as this:
212
234
 
213
235
  ```ts
214
236
  // OLD! Can be removed
@@ -237,7 +259,7 @@
237
259
  - }
238
260
  ```
239
261
 
240
- - To use a service from React code (i.e. `useService` and `useServices`), you must now use the explicit service type in the hook's generic parameter list. Otherwise the hook will simply return `unknown`:
262
+ - To use a service from React code (i.e. `useService` and `useServices`), you must now use the explicit service type in the hook's generic parameter list. Otherwise the hook will simply return `unknown`:
241
263
 
242
264
  ```diff
243
265
  + import { HttpService } from "@open-pioneer/http";
@@ -249,118 +271,118 @@
249
271
 
250
272
  The system will still check that the provided string matches the string constant used in the service's declaration (`DeclaredService<...>`), so type safety is preserved.
251
273
 
252
- - The types `InterfaceName` and `ServiceType<I>` have been removed. Use explicit service interfaces instead.
253
- - The interfaces `ServiceRegistry` and `PropertiesRegistry` have been removed as global registration is no longer possible.
254
- - The type `RawApplicationProperties` has been removed. Use `ApplicationProperties` instead.
274
+ - The types `InterfaceName` and `ServiceType<I>` have been removed. Use explicit service interfaces instead.
275
+ - The interfaces `ServiceRegistry` and `PropertiesRegistry` have been removed as global registration is no longer possible.
276
+ - The type `RawApplicationProperties` has been removed. Use `ApplicationProperties` instead.
255
277
 
256
278
  ### Patch Changes
257
279
 
258
- - f5c0e31: Bump @formatjs/intl version
259
- - Updated dependencies [f5c0e31]
260
- - Updated dependencies [6f954e3]
261
- - @open-pioneer/chakra-integration@1.1.1
262
- - @open-pioneer/base-theme@0.2.0
263
- - @open-pioneer/runtime-react-support@1.0.0
280
+ - f5c0e31: Bump @formatjs/intl version
281
+ - Updated dependencies [f5c0e31]
282
+ - Updated dependencies [6f954e3]
283
+ - @open-pioneer/chakra-integration@1.1.1
284
+ - @open-pioneer/base-theme@0.2.0
285
+ - @open-pioneer/runtime-react-support@1.0.0
264
286
 
265
287
  ## 1.1.0
266
288
 
267
289
  ### Minor Changes
268
290
 
269
- - 6632892: Implement support for custom chakra themes via the `theme` parameter in `createCustomElement()`.
270
- `theme` from `@open-pioneer/base-theme` is used as default when no other theme is configured.
291
+ - 6632892: Implement support for custom chakra themes via the `theme` parameter in `createCustomElement()`.
292
+ `theme` from `@open-pioneer/base-theme` is used as default when no other theme is configured.
271
293
 
272
294
  ### Patch Changes
273
295
 
274
- - Updated dependencies [6632892]
275
- - Updated dependencies [6632892]
276
- - @open-pioneer/base-theme@0.1.0
277
- - @open-pioneer/chakra-integration@1.1.0
278
- - @open-pioneer/runtime-react-support@1.0.0
296
+ - Updated dependencies [6632892]
297
+ - Updated dependencies [6632892]
298
+ - @open-pioneer/base-theme@0.1.0
299
+ - @open-pioneer/chakra-integration@1.1.0
300
+ - @open-pioneer/runtime-react-support@1.0.0
279
301
 
280
302
  ## 1.0.2
281
303
 
282
304
  ### Patch Changes
283
305
 
284
- - Updated dependencies [69c0fcd]
285
- - @open-pioneer/core@1.1.0
286
- - @open-pioneer/runtime-react-support@1.0.0
306
+ - Updated dependencies [69c0fcd]
307
+ - @open-pioneer/core@1.1.0
308
+ - @open-pioneer/runtime-react-support@1.0.0
287
309
 
288
310
  ## 1.0.1
289
311
 
290
312
  ### Patch Changes
291
313
 
292
- - Updated dependencies [88fd710]
293
- - @open-pioneer/core@1.0.1
294
- - @open-pioneer/runtime-react-support@1.0.0
314
+ - Updated dependencies [88fd710]
315
+ - @open-pioneer/core@1.0.1
316
+ - @open-pioneer/runtime-react-support@1.0.0
295
317
 
296
318
  ## 1.0.0
297
319
 
298
320
  ### Major Changes
299
321
 
300
- - 22ff68a: Initial release
322
+ - 22ff68a: Initial release
301
323
 
302
324
  ### Patch Changes
303
325
 
304
- - Updated dependencies [22ff68a]
305
- - @open-pioneer/chakra-integration@1.0.0
306
- - @open-pioneer/core@1.0.0
307
- - @open-pioneer/runtime-react-support@1.0.0
326
+ - Updated dependencies [22ff68a]
327
+ - @open-pioneer/chakra-integration@1.0.0
328
+ - @open-pioneer/core@1.0.0
329
+ - @open-pioneer/runtime-react-support@1.0.0
308
330
 
309
331
  ## 0.1.5
310
332
 
311
333
  ### Patch Changes
312
334
 
313
- - 9eac5c9: Use peer dependencies for (most) dependencies
314
- - Updated dependencies [9eac5c9]
315
- - @open-pioneer/runtime-react-support@0.1.2
316
- - @open-pioneer/chakra-integration@0.1.4
317
- - @open-pioneer/core@0.1.4
335
+ - 9eac5c9: Use peer dependencies for (most) dependencies
336
+ - Updated dependencies [9eac5c9]
337
+ - @open-pioneer/runtime-react-support@0.1.2
338
+ - @open-pioneer/chakra-integration@0.1.4
339
+ - @open-pioneer/core@0.1.4
318
340
 
319
341
  ## 0.1.4
320
342
 
321
343
  ### Patch Changes
322
344
 
323
- - 234b3be: Fix registrations in ServiceRegistry
324
- - 49ba4e1: Use build-package CLI to build.
325
- - Updated dependencies [49ba4e1]
326
- - @open-pioneer/chakra-integration@0.1.3
327
- - @open-pioneer/core@0.1.3
328
- - @open-pioneer/runtime-react-support@0.1.1
345
+ - 234b3be: Fix registrations in ServiceRegistry
346
+ - 49ba4e1: Use build-package CLI to build.
347
+ - Updated dependencies [49ba4e1]
348
+ - @open-pioneer/chakra-integration@0.1.3
349
+ - @open-pioneer/core@0.1.3
350
+ - @open-pioneer/runtime-react-support@0.1.1
329
351
 
330
352
  ## 0.1.3
331
353
 
332
354
  ### Patch Changes
333
355
 
334
- - e752d49: Use new runtime-react-support package
335
- - Updated dependencies [e752d49]
336
- - @open-pioneer/runtime-react-support@0.1.0
356
+ - e752d49: Use new runtime-react-support package
357
+ - Updated dependencies [e752d49]
358
+ - @open-pioneer/runtime-react-support@0.1.0
337
359
 
338
360
  ## 0.1.2
339
361
 
340
362
  ### Patch Changes
341
363
 
342
- - a40f12d: Update build-package tool. TypeScript declaration files should now be available.
343
- - Updated dependencies [a40f12d]
344
- - @open-pioneer/chakra-integration@0.1.2
345
- - @open-pioneer/core@0.1.2
364
+ - a40f12d: Update build-package tool. TypeScript declaration files should now be available.
365
+ - Updated dependencies [a40f12d]
366
+ - @open-pioneer/chakra-integration@0.1.2
367
+ - @open-pioneer/core@0.1.2
346
368
 
347
369
  ## 0.1.1
348
370
 
349
371
  ### Patch Changes
350
372
 
351
- - e1c7295: Compiled with build-package 0.5.2
352
- - Updated dependencies [e1c7295]
353
- - @open-pioneer/chakra-integration@0.1.1
354
- - @open-pioneer/core@0.1.1
373
+ - e1c7295: Compiled with build-package 0.5.2
374
+ - Updated dependencies [e1c7295]
375
+ - @open-pioneer/chakra-integration@0.1.1
376
+ - @open-pioneer/core@0.1.1
355
377
 
356
378
  ## 0.1.0
357
379
 
358
380
  ### Minor Changes
359
381
 
360
- - 77f7d5c: Initial test release
382
+ - 77f7d5c: Initial test release
361
383
 
362
384
  ### Patch Changes
363
385
 
364
- - Updated dependencies [77f7d5c]
365
- - @open-pioneer/chakra-integration@0.1.0
366
- - @open-pioneer/core@0.1.0
386
+ - Updated dependencies [77f7d5c]
387
+ - @open-pioneer/chakra-integration@0.1.0
388
+ - @open-pioneer/core@0.1.0
package/CustomElement.js CHANGED
@@ -4,8 +4,8 @@ import { ErrorId } from './errors.js';
4
4
  import { createPackages } from './service-layer/PackageRepr.js';
5
5
  import { ServiceLayer } from './service-layer/ServiceLayer.js';
6
6
  import { ReactIntegration } from './react-integration/ReactIntegration.js';
7
- import { createBuiltinPackage, RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE, RUNTIME_API_SERVICE, RUNTIME_AUTO_START } from './builtin-services/index.js';
8
- import { initI18n, getBrowserLocales, createPackageIntl, I18nConfig } from './i18n.js';
7
+ import { createBuiltinPackage, RUNTIME_API_SERVICE, RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE, RUNTIME_AUTO_START } from './builtin-services/index.js';
8
+ import { initI18n, getBrowserLocales, I18nConfig, createPackageIntl } from './i18n.js';
9
9
  import { ErrorScreen, MESSAGES_BY_LOCALE } from './ErrorScreen.js';
10
10
 
11
11
  const LOG = createLogger("runtime:CustomElement");
@@ -1 +1 @@
1
- {"version":3,"file":"CustomElement.js","sources":["CustomElement.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ComponentType, createElement } from \"react\";\nimport {\n createAbortError,\n createLogger,\n createManualPromise,\n destroyResource,\n Error,\n ManualPromise,\n Resource,\n throwAbortError\n} from \"@open-pioneer/core\";\nimport { ErrorId } from \"./errors\";\nimport { ApplicationMetadata, PackageMetadata } from \"./metadata\";\nimport { PackageRepr, createPackages } from \"./service-layer/PackageRepr\";\nimport { ServiceLayer } from \"./service-layer/ServiceLayer\";\nimport { getErrorChain } from \"@open-pioneer/core\";\nimport { ReactIntegration } from \"./react-integration/ReactIntegration\";\nimport { ApiMethods, ApiService } from \"./api\";\nimport {\n createBuiltinPackage,\n RUNTIME_API_SERVICE,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE,\n RUNTIME_AUTO_START\n} from \"./builtin-services\";\nimport { ReferenceSpec } from \"./service-layer/InterfaceSpec\";\nimport { AppI18n, createPackageIntl, getBrowserLocales, I18nConfig, initI18n } from \"./i18n\";\nimport { ApplicationLifecycleEventService } from \"./builtin-services/ApplicationLifecycleEventService\";\nimport { ErrorScreen, MESSAGES_BY_LOCALE } from \"./ErrorScreen\";\nconst LOG = createLogger(\"runtime:CustomElement\");\n\n/**\n * Options for the {@link createCustomElement} function.\n */\nexport interface CustomElementOptions {\n /**\n * Rendered UI component.\n */\n component?: ComponentType<Record<string, string>>;\n\n /**\n * Application metadata (packages, services etc.).\n * This is usually autogenerated by importing the virtual `\"open-pioneer:app\"` module.\n */\n appMetadata?: ApplicationMetadata;\n\n /**\n * Application defined configuration.\n *\n * This option can be used to override default properties of the application's packages.\n *\n * All instances of the web component will share this static configuration.\n */\n config?: ApplicationConfig;\n\n /**\n * Function to provide additional application defined configuration parameters.\n *\n * Compared to {@link config}, this function receives a context object\n * that allows the developer to provide dynamic properties on a per-application instance basis.\n *\n * Parameters returned by this function take precedence over the ones defined by {@link config}.\n */\n resolveConfig?(ctx: ConfigContext): Promise<ApplicationConfig | undefined>;\n\n /**\n * Chakra theming object.\n */\n theme?: Record<string, unknown>;\n}\n\n/**\n * A context object that is passed to the `resolveProperties` function.\n */\nexport interface ConfigContext {\n /**\n * The application's host element.\n */\n hostElement: HTMLElement;\n\n /**\n * Returns an attribute from the application's root node.\n */\n getAttribute(name: string): string | undefined;\n}\n\n/**\n * Runtime application configuration.\n */\nexport interface ApplicationConfig {\n /**\n * Set this value to a locale string (e.g. \"en\") to for the application's locale.\n * The default behavior is to choose an appropriate locale for the current user based\n * on the browser's settings.\n *\n * The locale must be supported by the application.\n */\n locale?: string | undefined;\n\n /**\n * Properties specified here will override default properties of the application's packages.\n */\n properties?: ApplicationProperties | undefined;\n}\n\n/**\n * Allows the application to override default properties in all packages.\n *\n * Properties are typed when the package contains type definitions for them.\n */\nexport interface ApplicationProperties {\n /**\n * Key: the name of the package.\n * Value: A record of configuration properties (key/value pairs).\n *\n * Properties will override default property values in the package.\n */\n [packageName: string]: Record<string, unknown>;\n}\n\n/**\n * The interface implemented by web components produced via {@link createCustomElement}.\n */\nexport interface ApplicationElement extends HTMLElement {\n /** Resolves to the element's API when the application has started. */\n when(): Promise<ApiMethods>;\n}\n\n/**\n * The class returned by a call to {@link createCustomElement}.\n */\nexport interface ApplicationElementConstructor {\n new (): ApplicationElement;\n}\n\n/**\n * Creates a new custom element class (web component) that can be registered within a DOM.\n *\n * @example\n * ```ts\n * import * as appMetadata from \"open-pioneer:app\";\n *\n * const CustomElementClazz = createCustomElement({\n * component: <div>Hello World!</div>,\n * appMetadata\n * });\n * customElements.define(\"sample-element\", CustomElementClazz);\n * ```\n */\nexport function createCustomElement(options: CustomElementOptions): ApplicationElementConstructor {\n class PioneerApplication extends HTMLElement implements ApplicationElement {\n #shadowRoot: ShadowRoot;\n #instance: ApplicationInstance | undefined;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n #deferredRestart: any; // A Timer\n\n static get observedAttributes(): string[] {\n return [];\n }\n\n constructor() {\n super();\n\n this.#shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n\n if (import.meta.env.DEV) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).$inspectElementState = () => this.#instance;\n }\n }\n\n connectedCallback() {\n LOG.debug(\"Launching application\");\n\n if (this.#instance) {\n this.#instance.destroy();\n }\n\n this.#instance = this.#createApplicationInstance();\n this.#instance.start();\n }\n\n disconnectedCallback() {\n LOG.debug(\"Shutting down application\");\n\n if (this.#deferredRestart) {\n clearTimeout(this.#deferredRestart);\n }\n this.#instance?.destroy();\n this.#instance = undefined;\n\n LOG.debug(\"Application destroyed\");\n }\n\n when() {\n if (!this.#instance) {\n return Promise.reject(\n new Error(\n ErrorId.NOT_MOUNTED,\n \"Cannot use the application's API because the HTML element has not yet been mounted into the DOM.\"\n )\n );\n }\n\n return this.#instance.whenAPI();\n }\n\n #triggerReload(overrides?: ApplicationOverrides) {\n // Defer the restart operation a tiny bit so calling code does not get surprised by the application's destruction.\n if (this.#deferredRestart) {\n clearTimeout(this.#deferredRestart);\n }\n this.#deferredRestart = setTimeout(() => {\n if (!this.#instance) {\n // disconnectedCallback was called in the meantime\n return;\n }\n\n LOG.debug(\"Restarting application with new options\", overrides);\n this.#instance.destroy();\n this.#instance = this.#createApplicationInstance(overrides);\n this.#instance.start();\n }, 1);\n }\n\n #createApplicationInstance(overrides?: ApplicationOverrides) {\n return new ApplicationInstance({\n hostElement: this,\n shadowRoot: this.#shadowRoot,\n elementOptions: options,\n overrides: overrides,\n restart: this.#triggerReload.bind(this)\n });\n }\n }\n return PioneerApplication;\n}\n\ninterface InstanceOptions {\n /** The HTML element that embeds the application. */\n hostElement: HTMLElement;\n\n /** The shadow root inside the host element that contains the rest of the application. */\n shadowRoot: ShadowRoot;\n\n /** Trails options for the application. */\n elementOptions: CustomElementOptions;\n\n /** These have higher priority than the options in `elementOptions`. */\n overrides: ApplicationOverrides | undefined;\n\n /**\n * A callback to restart the application with new options.\n * Currently only used for reloading with a certain locale.\n */\n restart: (overrides?: ApplicationOverrides) => void;\n}\n\ninterface ApplicationOverrides {\n locale?: string;\n}\n\ntype ApplicationState = \"not-started\" | \"starting\" | \"started\" | \"destroyed\" | \"error\";\n\nclass ApplicationInstance {\n private options: InstanceOptions;\n\n // Public API\n private apiPromise: ManualPromise<ApiMethods> | undefined; // Present when callers are waiting for the API\n private api: ApiMethods | undefined; // Present once started\n\n private state: ApplicationState = \"not-started\";\n private container: HTMLDivElement | undefined;\n private config: ApplicationConfig | undefined;\n private serviceLayer: ServiceLayer | undefined;\n private lifecycleEvents: ApplicationLifecycleEventService | undefined;\n private reactIntegration: ReactIntegration | undefined;\n private stylesWatch: Resource | undefined;\n\n constructor(options: InstanceOptions) {\n this.options = options;\n }\n\n start() {\n if (this.state !== \"not-started\") {\n throw new Error(ErrorId.INTERNAL, `Cannot start element in state '${this.state}'`);\n }\n\n this.state = \"starting\";\n this.startImpl().catch((e) => {\n if (this.state === \"destroyed\") return;\n\n logError(e);\n this.reset();\n this.state = \"error\";\n this.showErrorScreen(e);\n });\n }\n\n destroy() {\n if (this.state === \"destroyed\") {\n return;\n }\n\n // Only call event listener when 'started' was also signalled.\n if (this.state === \"started\") {\n try {\n this.triggerApplicationLifecycleEvent(\"before-stop\");\n } catch (e) {\n void e; // Ignored\n }\n }\n this.state = \"destroyed\";\n this.reset();\n }\n\n private reset() {\n this.apiPromise?.reject(createAbortError());\n this.reactIntegration = destroyResource(this.reactIntegration);\n this.options.shadowRoot.replaceChildren();\n this.container = undefined;\n this.lifecycleEvents = undefined;\n this.serviceLayer = destroyResource(this.serviceLayer);\n this.stylesWatch = destroyResource(this.stylesWatch);\n }\n\n whenAPI(): Promise<ApiMethods> {\n if (this.api) {\n return Promise.resolve(this.api);\n }\n\n const apiPromise = (this.apiPromise ??= createManualPromise());\n return apiPromise.promise;\n }\n\n private async startImpl() {\n const { shadowRoot, hostElement, elementOptions, overrides } = this.options;\n\n // Resolve custom application config\n const config = (this.config = await gatherConfig(hostElement, elementOptions, overrides));\n this.checkAbort();\n LOG.debug(\"Application config is\", config);\n\n // Decide on locale and load i18n messages (if any).\n const i18n = await initI18n(elementOptions.appMetadata, config.locale);\n this.checkAbort();\n\n // Setup application root node in the shadow dom\n const container = (this.container = createContainer(i18n.locale));\n const styles = this.initStyles();\n shadowRoot.replaceChildren(container, ...styles);\n\n // Launch the service layer\n const { serviceLayer, packages } = this.initServiceLayer({\n container,\n properties: config.properties,\n i18n\n });\n this.lifecycleEvents = getInternalService<ApplicationLifecycleEventService>(\n serviceLayer,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE\n );\n\n await this.initAPI(serviceLayer);\n this.checkAbort();\n\n // Launch react\n this.reactIntegration = ReactIntegration.createForApp({\n rootNode: container,\n container: shadowRoot,\n theme: elementOptions.theme,\n serviceLayer,\n packages\n });\n const component = this.options.elementOptions.component ?? emptyComponent;\n this.reactIntegration.render(createElement(component));\n this.state = \"started\";\n\n this.triggerApplicationLifecycleEvent(\"after-start\");\n LOG.debug(\"Application started\");\n }\n\n private initStyles() {\n // Prevent inheritance of certain css values and normalize to display: block by default.\n // See https://open-wc.org/guides/knowledge/styling/styles-piercing-shadow-dom/\n const builtinStyles = \":host { all: initial; display: block; }\";\n const builtinStylesNode = document.createElement(\"style\");\n applyStyles(builtinStylesNode, { value: builtinStyles });\n\n const appStyles = this.options.elementOptions.appMetadata?.styles;\n const appStylesNode = document.createElement(\"style\");\n applyStyles(appStylesNode, appStyles);\n if (import.meta.hot) {\n this.stylesWatch = appStyles?.on?.(\"changed\", () => {\n LOG.debug(\"Application styles changed\");\n applyStyles(appStylesNode, appStyles);\n });\n }\n return [builtinStylesNode, appStylesNode];\n }\n\n private initServiceLayer(config: {\n container: HTMLDivElement;\n properties: ApplicationProperties;\n i18n: AppI18n;\n }) {\n const { hostElement, shadowRoot, elementOptions, restart } = this.options;\n const { container, properties, i18n } = config;\n const packageMetadata = elementOptions.appMetadata?.packages ?? {};\n const builtinPackage = createBuiltinPackage({\n host: hostElement,\n shadowRoot: shadowRoot,\n container: container,\n locale: i18n.locale,\n supportedLocales: i18n.supportedMessageLocales,\n changeLocale(locale) {\n const supported = i18n.supportedMessageLocales;\n if (locale != null && !i18n.supportsLocale(locale)) {\n throw new Error(\n ErrorId.UNSUPPORTED_LOCALE,\n `Unsupported locale '${locale}' (supported locales: ${supported.join(\n \", \"\n )}).`\n );\n }\n restart({ locale });\n }\n });\n const { serviceLayer, packages } = createServiceLayer({\n packageMetadata,\n builtinPackage,\n properties,\n i18n\n });\n this.serviceLayer = serviceLayer;\n\n if (LOG.isDebug()) {\n LOG.debug(\"Launching service layer with packages\", Object.fromEntries(packages));\n }\n serviceLayer.start();\n return { serviceLayer, packages };\n }\n\n private async initAPI(serviceLayer: ServiceLayer) {\n const apiService = getInternalService<ApiService>(serviceLayer, RUNTIME_API_SERVICE);\n try {\n const api = (this.api = await apiService.getApi());\n LOG.debug(\"Application API initialized to\", api);\n this.apiPromise?.resolve(api);\n } catch (e) {\n throw new Error(ErrorId.INTERNAL, \"Failed to gather the application's API methods.\", {\n cause: e\n });\n }\n }\n\n private triggerApplicationLifecycleEvent(event: \"after-start\" | \"before-stop\") {\n this.lifecycleEvents?.emitLifecycleEvent(event);\n }\n\n private checkAbort() {\n if (this.state === \"destroyed\") {\n throwAbortError();\n }\n }\n\n private showErrorScreen(error: globalThis.Error) {\n const { shadowRoot, elementOptions } = this.options;\n\n const userLocales = getBrowserLocales();\n const i18nConfig = new I18nConfig(Object.keys(MESSAGES_BY_LOCALE));\n const { locale, messageLocale } = i18nConfig.pickSupportedLocale(undefined, userLocales);\n\n const container = (this.container = createContainer(locale));\n container.classList.add(\"pioneer-root-error-screen\");\n\n const messages =\n MESSAGES_BY_LOCALE[messageLocale as keyof typeof MESSAGES_BY_LOCALE] ??\n MESSAGES_BY_LOCALE[\"en\"];\n const intl = createPackageIntl(locale, messages);\n this.reactIntegration = ReactIntegration.createForErrorScreen({\n rootNode: container,\n container: shadowRoot,\n theme: elementOptions.theme\n });\n this.reactIntegration.render(createElement(ErrorScreen, { intl, error }));\n\n shadowRoot.replaceChildren(container);\n }\n}\n\nfunction createContainer(locale: string) {\n // Setup application root node in the shadow dom\n const container = document.createElement(\"div\");\n container.classList.add(\"pioneer-root\");\n container.style.minHeight = \"100%\";\n container.style.height = \"100%\";\n if (locale) {\n container.lang = locale;\n }\n return container;\n}\n\nfunction createServiceLayer(config: {\n packageMetadata: Record<string, PackageMetadata> | undefined;\n properties: ApplicationProperties;\n builtinPackage: PackageRepr;\n i18n: AppI18n;\n}) {\n const { packageMetadata, properties, builtinPackage, i18n } = config;\n\n let packages: PackageRepr[];\n try {\n packages = createPackages(packageMetadata ?? {}, i18n, properties);\n } catch (e) {\n throw new Error(ErrorId.INVALID_METADATA, \"Failed to parse package metadata.\", {\n cause: e\n });\n }\n\n // Add builtin services defined within this package.\n {\n const index = packages.findIndex((pkg) => pkg.name === builtinPackage.name);\n if (index >= 0) {\n packages.splice(index, 1);\n }\n packages.push(builtinPackage);\n }\n\n // Automatically required references (-> forces services to start)\n const forcedReferences: ReferenceSpec[] = [\n {\n interfaceName: RUNTIME_API_SERVICE\n },\n {\n interfaceName: RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE\n },\n {\n interfaceName: RUNTIME_AUTO_START,\n all: true\n }\n ];\n const serviceLayer = new ServiceLayer(packages, forcedReferences);\n return {\n packages: new Map(packages.map((pkg) => [pkg.name, pkg])),\n serviceLayer: serviceLayer\n };\n}\n\nfunction getInternalService<T = unknown>(serviceLayer: ServiceLayer, interfaceName: string) {\n const result = serviceLayer.getService(\n \"@open-pioneer/runtime\",\n {\n interfaceName\n },\n { ignoreDeclarationCheck: true }\n );\n if (result.type !== \"found\") {\n throw new Error(\n ErrorId.INTERNAL,\n `Failed to find instance of '${interfaceName}' (result type '${result.type}').` +\n ` This is a builtin service that must be present exactly once.`\n );\n }\n\n return result.value.getInstanceOrThrow() as T;\n}\n\n/**\n * Gathers application properties by reading them from the options object\n * and by (optionally) invoking the `resolveProperties` hook.\n */\nasync function gatherConfig(\n hostElement: HTMLElement,\n options: CustomElementOptions,\n overrides?: ApplicationOverrides\n) {\n let configs: ApplicationConfig[];\n try {\n const staticConfig = options.config ?? {};\n const dynamicConfig =\n (await options.resolveConfig?.({\n hostElement,\n getAttribute(name) {\n return hostElement.getAttribute(name) ?? undefined;\n }\n })) ?? {};\n\n configs = [staticConfig, dynamicConfig];\n } catch (e) {\n throw new Error(\n ErrorId.CONFIG_RESOLUTION_FAILED,\n \"Failed to resolve application properties.\",\n {\n cause: e\n }\n );\n }\n\n const merged = mergeConfigs(configs);\n if (overrides?.locale) {\n merged.locale = overrides.locale;\n }\n return merged;\n}\n\n/**\n * Merges application configurations into a single object.\n * Properties / config parameters at a later position overwrite properties from earlier ones.\n */\nfunction mergeConfigs(configs: ApplicationConfig[]): Required<ApplicationConfig> {\n // Merge simple values by assigning them in order\n const mergedConfig: Required<ApplicationConfig> = Object.assign(\n {\n locale: undefined,\n properties: {}\n } satisfies ApplicationConfig,\n ...configs\n );\n\n // Deep merge for application properties\n const mergedProperties: ApplicationProperties = (mergedConfig.properties = {});\n for (const config of configs) {\n for (const [packageName, packageProperties] of Object.entries(config.properties ?? {})) {\n const mergedPackageProps = (mergedProperties[packageName] ??= {});\n Object.assign(mergedPackageProps, packageProperties);\n }\n }\n\n return mergedConfig;\n}\n\n// Applies application styles to the given style node.\n// Can be called multiple times in development mode to implement hot reloading.\nfunction applyStyles(styleNode: HTMLStyleElement, styles: { value: string } | undefined) {\n let cssValue = styles?.value ?? \"\";\n // Remove sourcemaps from inline css.\n // This currently does not work because a) the 'importer' (the index.html file) does not\n // match the actual path the source map would exist and b) vite refuses to generate it anyway, probably\n // because of our virtual modules.\n // TODO: both should be fixed once we can refer to actual `.css` files\n // and don't have to embed inline css anymore.\n cssValue = cssValue.replace(/\\/\\*# sourceMappingURL=.*$/, \"\");\n const cssNode = document.createTextNode(cssValue);\n styleNode.replaceChildren(cssNode);\n}\n\nfunction logError(e: unknown) {\n if (e instanceof Error) {\n const chain = getErrorChain(e).reverse();\n if (chain.length === 1) {\n console.error(e);\n return;\n }\n\n let n = 1;\n for (const error of chain) {\n console.error(`#${n}`, error);\n ++n;\n }\n } else {\n console.error(\"Unexpected error\", e);\n }\n}\n\nfunction emptyComponent() {\n return null;\n}\n"],"names":[],"mappings":";;;;;;;;;;AA8BA,MAAM,GAAA,GAAM,aAAa,uBAAuB,CAAA,CAAA;AAwHzC,SAAS,oBAAoB,OAA8D,EAAA;AAAA,EAC9F,MAAM,2BAA2B,WAA0C,CAAA;AAAA,IACvE,WAAA,CAAA;AAAA,IACA,SAAA,CAAA;AAAA;AAAA,IAGA,gBAAA,CAAA;AAAA;AAAA,IAEA,WAAW,kBAA+B,GAAA;AACtC,MAAA,OAAO,EAAC,CAAA;AAAA,KACZ;AAAA,IAEA,WAAc,GAAA;AACV,MAAM,KAAA,EAAA,CAAA;AAEN,MAAK,IAAA,CAAA,WAAA,GAAc,KAAK,YAAa,CAAA;AAAA,QACjC,IAAM,EAAA,MAAA;AAAA,OACT,CAAA,CAAA;AAED,MAAI,IAAA,MAAA,CAAA,IAAA,CAAY,IAAI,GAAK,EAAA;AAErB,QAAC,IAAA,CAAa,oBAAuB,GAAA,MAAM,IAAK,CAAA,SAAA,CAAA;AAAA,OACpD;AAAA,KACJ;AAAA,IAEA,iBAAoB,GAAA;AAChB,MAAA,GAAA,CAAI,MAAM,uBAAuB,CAAA,CAAA;AAEjC,MA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C,IAAI,IAAA,KAAA,CAAM,WAAW,CAAG,EAAA;AACpB,MAAA,OAAA,CAAQ,MAAM,CAAC,CAAA,CAAA;AACf,MAAA,OAAA;AAAA,KACJ;AAEA,IAAA,IAAI,CAAI,GAAA,CAAA,CAAA;AACR,IAAA,KAAA,MAAW,SAAS,KAAO,EAAA;AACvB,MAAA,OAAA,CAAQ,KAAM,CAAA,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA;AAC5B,MAAE,EAAA,CAAA,CAAA;AAAA,KACN;AAAA,GACG,MAAA;AACH,IAAQ,OAAA,CAAA,KAAA,CAAM,oBAAoB,CAAC,CAAA,CAAA;AAAA,GACvC;AACJ,CAAA;AAEA,SAAS,cAAiB,GAAA;AACtB,EAAO,OAAA,IAAA,CAAA;AACX;;;;"}
1
+ {"version":3,"file":"CustomElement.js","sources":["CustomElement.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ComponentType, createElement } from \"react\";\nimport {\n createAbortError,\n createLogger,\n createManualPromise,\n destroyResource,\n Error,\n ManualPromise,\n Resource,\n throwAbortError\n} from \"@open-pioneer/core\";\nimport { ErrorId } from \"./errors\";\nimport { ApplicationMetadata, PackageMetadata } from \"./metadata\";\nimport { PackageRepr, createPackages } from \"./service-layer/PackageRepr\";\nimport { ServiceLayer } from \"./service-layer/ServiceLayer\";\nimport { getErrorChain } from \"@open-pioneer/core\";\nimport { ReactIntegration } from \"./react-integration/ReactIntegration\";\nimport { ApiMethods, ApiService } from \"./api\";\nimport {\n createBuiltinPackage,\n RUNTIME_API_SERVICE,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE,\n RUNTIME_AUTO_START\n} from \"./builtin-services\";\nimport { ReferenceSpec } from \"./service-layer/InterfaceSpec\";\nimport { AppI18n, createPackageIntl, getBrowserLocales, I18nConfig, initI18n } from \"./i18n\";\nimport { ApplicationLifecycleEventService } from \"./builtin-services/ApplicationLifecycleEventService\";\nimport { ErrorScreen, MESSAGES_BY_LOCALE } from \"./ErrorScreen\";\nconst LOG = createLogger(\"runtime:CustomElement\");\n\n/**\n * Options for the {@link createCustomElement} function.\n */\nexport interface CustomElementOptions {\n /**\n * Rendered UI component.\n */\n component?: ComponentType<Record<string, string>>;\n\n /**\n * Application metadata (packages, services etc.).\n * This is usually autogenerated by importing the virtual `\"open-pioneer:app\"` module.\n */\n appMetadata?: ApplicationMetadata;\n\n /**\n * Application defined configuration.\n *\n * This option can be used to override default properties of the application's packages.\n *\n * All instances of the web component will share this static configuration.\n */\n config?: ApplicationConfig;\n\n /**\n * Function to provide additional application defined configuration parameters.\n *\n * Compared to {@link config}, this function receives a context object\n * that allows the developer to provide dynamic properties on a per-application instance basis.\n *\n * Parameters returned by this function take precedence over the ones defined by {@link config}.\n */\n resolveConfig?(ctx: ConfigContext): Promise<ApplicationConfig | undefined>;\n\n /**\n * Chakra theming object.\n */\n theme?: Record<string, unknown>;\n}\n\n/**\n * A context object that is passed to the `resolveProperties` function.\n */\nexport interface ConfigContext {\n /**\n * The application's host element.\n */\n hostElement: HTMLElement;\n\n /**\n * Returns an attribute from the application's root node.\n */\n getAttribute(name: string): string | undefined;\n}\n\n/**\n * Runtime application configuration.\n */\nexport interface ApplicationConfig {\n /**\n * Set this value to a locale string (e.g. \"en\") to for the application's locale.\n * The default behavior is to choose an appropriate locale for the current user based\n * on the browser's settings.\n *\n * The locale must be supported by the application.\n */\n locale?: string | undefined;\n\n /**\n * Properties specified here will override default properties of the application's packages.\n */\n properties?: ApplicationProperties | undefined;\n}\n\n/**\n * Allows the application to override default properties in all packages.\n *\n * Properties are typed when the package contains type definitions for them.\n */\nexport interface ApplicationProperties {\n /**\n * Key: the name of the package.\n * Value: A record of configuration properties (key/value pairs).\n *\n * Properties will override default property values in the package.\n */\n [packageName: string]: Record<string, unknown>;\n}\n\n/**\n * The interface implemented by web components produced via {@link createCustomElement}.\n */\nexport interface ApplicationElement extends HTMLElement {\n /** Resolves to the element's API when the application has started. */\n when(): Promise<ApiMethods>;\n}\n\n/**\n * The class returned by a call to {@link createCustomElement}.\n */\nexport interface ApplicationElementConstructor {\n new (): ApplicationElement;\n}\n\n/**\n * Creates a new custom element class (web component) that can be registered within a DOM.\n *\n * @example\n * ```ts\n * import * as appMetadata from \"open-pioneer:app\";\n *\n * const CustomElementClazz = createCustomElement({\n * component: <div>Hello World!</div>,\n * appMetadata\n * });\n * customElements.define(\"sample-element\", CustomElementClazz);\n * ```\n */\nexport function createCustomElement(options: CustomElementOptions): ApplicationElementConstructor {\n class PioneerApplication extends HTMLElement implements ApplicationElement {\n #shadowRoot: ShadowRoot;\n #instance: ApplicationInstance | undefined;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n #deferredRestart: any; // A Timer\n\n static get observedAttributes(): string[] {\n return [];\n }\n\n constructor() {\n super();\n\n this.#shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n\n if (import.meta.env.DEV) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this as any).$inspectElementState = () => this.#instance;\n }\n }\n\n connectedCallback() {\n LOG.debug(\"Launching application\");\n\n if (this.#instance) {\n this.#instance.destroy();\n }\n\n this.#instance = this.#createApplicationInstance();\n this.#instance.start();\n }\n\n disconnectedCallback() {\n LOG.debug(\"Shutting down application\");\n\n if (this.#deferredRestart) {\n clearTimeout(this.#deferredRestart);\n }\n this.#instance?.destroy();\n this.#instance = undefined;\n\n LOG.debug(\"Application destroyed\");\n }\n\n when() {\n if (!this.#instance) {\n return Promise.reject(\n new Error(\n ErrorId.NOT_MOUNTED,\n \"Cannot use the application's API because the HTML element has not yet been mounted into the DOM.\"\n )\n );\n }\n\n return this.#instance.whenAPI();\n }\n\n #triggerReload(overrides?: ApplicationOverrides) {\n // Defer the restart operation a tiny bit so calling code does not get surprised by the application's destruction.\n if (this.#deferredRestart) {\n clearTimeout(this.#deferredRestart);\n }\n this.#deferredRestart = setTimeout(() => {\n if (!this.#instance) {\n // disconnectedCallback was called in the meantime\n return;\n }\n\n LOG.debug(\"Restarting application with new options\", overrides);\n this.#instance.destroy();\n this.#instance = this.#createApplicationInstance(overrides);\n this.#instance.start();\n }, 1);\n }\n\n #createApplicationInstance(overrides?: ApplicationOverrides) {\n return new ApplicationInstance({\n hostElement: this,\n shadowRoot: this.#shadowRoot,\n elementOptions: options,\n overrides: overrides,\n restart: this.#triggerReload.bind(this)\n });\n }\n }\n return PioneerApplication;\n}\n\ninterface InstanceOptions {\n /** The HTML element that embeds the application. */\n hostElement: HTMLElement;\n\n /** The shadow root inside the host element that contains the rest of the application. */\n shadowRoot: ShadowRoot;\n\n /** Trails options for the application. */\n elementOptions: CustomElementOptions;\n\n /** These have higher priority than the options in `elementOptions`. */\n overrides: ApplicationOverrides | undefined;\n\n /**\n * A callback to restart the application with new options.\n * Currently only used for reloading with a certain locale.\n */\n restart: (overrides?: ApplicationOverrides) => void;\n}\n\ninterface ApplicationOverrides {\n locale?: string;\n}\n\ntype ApplicationState = \"not-started\" | \"starting\" | \"started\" | \"destroyed\" | \"error\";\n\nclass ApplicationInstance {\n private options: InstanceOptions;\n\n // Public API\n private apiPromise: ManualPromise<ApiMethods> | undefined; // Present when callers are waiting for the API\n private api: ApiMethods | undefined; // Present once started\n\n private state: ApplicationState = \"not-started\";\n private container: HTMLDivElement | undefined;\n private config: ApplicationConfig | undefined;\n private serviceLayer: ServiceLayer | undefined;\n private lifecycleEvents: ApplicationLifecycleEventService | undefined;\n private reactIntegration: ReactIntegration | undefined;\n private stylesWatch: Resource | undefined;\n\n constructor(options: InstanceOptions) {\n this.options = options;\n }\n\n start() {\n if (this.state !== \"not-started\") {\n throw new Error(ErrorId.INTERNAL, `Cannot start element in state '${this.state}'`);\n }\n\n this.state = \"starting\";\n this.startImpl().catch((e) => {\n if (this.state === \"destroyed\") return;\n\n logError(e);\n this.reset();\n this.state = \"error\";\n this.showErrorScreen(e);\n });\n }\n\n destroy() {\n if (this.state === \"destroyed\") {\n return;\n }\n\n // Only call event listener when 'started' was also signalled.\n if (this.state === \"started\") {\n try {\n this.triggerApplicationLifecycleEvent(\"before-stop\");\n } catch (e) {\n void e; // Ignored\n }\n }\n this.state = \"destroyed\";\n this.reset();\n }\n\n private reset() {\n this.apiPromise?.reject(createAbortError());\n this.reactIntegration = destroyResource(this.reactIntegration);\n this.options.shadowRoot.replaceChildren();\n this.container = undefined;\n this.lifecycleEvents = undefined;\n this.serviceLayer = destroyResource(this.serviceLayer);\n this.stylesWatch = destroyResource(this.stylesWatch);\n }\n\n whenAPI(): Promise<ApiMethods> {\n if (this.api) {\n return Promise.resolve(this.api);\n }\n\n const apiPromise = (this.apiPromise ??= createManualPromise());\n return apiPromise.promise;\n }\n\n private async startImpl() {\n const { shadowRoot, hostElement, elementOptions, overrides } = this.options;\n\n // Resolve custom application config\n const config = (this.config = await gatherConfig(hostElement, elementOptions, overrides));\n this.checkAbort();\n LOG.debug(\"Application config is\", config);\n\n // Decide on locale and load i18n messages (if any).\n const i18n = await initI18n(elementOptions.appMetadata, config.locale);\n this.checkAbort();\n\n // Setup application root node in the shadow dom\n const container = (this.container = createContainer(i18n.locale));\n const styles = this.initStyles();\n shadowRoot.replaceChildren(container, ...styles);\n\n // Launch the service layer\n const { serviceLayer, packages } = this.initServiceLayer({\n container,\n properties: config.properties,\n i18n\n });\n this.lifecycleEvents = getInternalService<ApplicationLifecycleEventService>(\n serviceLayer,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE\n );\n\n await this.initAPI(serviceLayer);\n this.checkAbort();\n\n // Launch react\n this.reactIntegration = ReactIntegration.createForApp({\n rootNode: container,\n container: shadowRoot,\n theme: elementOptions.theme,\n serviceLayer,\n packages\n });\n const component = this.options.elementOptions.component ?? emptyComponent;\n this.reactIntegration.render(createElement(component));\n this.state = \"started\";\n\n this.triggerApplicationLifecycleEvent(\"after-start\");\n LOG.debug(\"Application started\");\n }\n\n private initStyles() {\n // Prevent inheritance of certain css values and normalize to display: block by default.\n // See https://open-wc.org/guides/knowledge/styling/styles-piercing-shadow-dom/\n const builtinStyles = \":host { all: initial; display: block; }\";\n const builtinStylesNode = document.createElement(\"style\");\n applyStyles(builtinStylesNode, { value: builtinStyles });\n\n const appStyles = this.options.elementOptions.appMetadata?.styles;\n const appStylesNode = document.createElement(\"style\");\n applyStyles(appStylesNode, appStyles);\n if (import.meta.hot) {\n this.stylesWatch = appStyles?.on?.(\"changed\", () => {\n LOG.debug(\"Application styles changed\");\n applyStyles(appStylesNode, appStyles);\n });\n }\n return [builtinStylesNode, appStylesNode];\n }\n\n private initServiceLayer(config: {\n container: HTMLDivElement;\n properties: ApplicationProperties;\n i18n: AppI18n;\n }) {\n const { hostElement, shadowRoot, elementOptions, restart } = this.options;\n const { container, properties, i18n } = config;\n const packageMetadata = elementOptions.appMetadata?.packages ?? {};\n const builtinPackage = createBuiltinPackage({\n host: hostElement,\n shadowRoot: shadowRoot,\n container: container,\n locale: i18n.locale,\n supportedLocales: i18n.supportedMessageLocales,\n changeLocale(locale) {\n const supported = i18n.supportedMessageLocales;\n if (locale != null && !i18n.supportsLocale(locale)) {\n throw new Error(\n ErrorId.UNSUPPORTED_LOCALE,\n `Unsupported locale '${locale}' (supported locales: ${supported.join(\n \", \"\n )}).`\n );\n }\n restart({ locale });\n }\n });\n const { serviceLayer, packages } = createServiceLayer({\n packageMetadata,\n builtinPackage,\n properties,\n i18n\n });\n this.serviceLayer = serviceLayer;\n\n if (LOG.isDebug()) {\n LOG.debug(\"Launching service layer with packages\", Object.fromEntries(packages));\n }\n serviceLayer.start();\n return { serviceLayer, packages };\n }\n\n private async initAPI(serviceLayer: ServiceLayer) {\n const apiService = getInternalService<ApiService>(serviceLayer, RUNTIME_API_SERVICE);\n try {\n const api = (this.api = await apiService.getApi());\n LOG.debug(\"Application API initialized to\", api);\n this.apiPromise?.resolve(api);\n } catch (e) {\n throw new Error(ErrorId.INTERNAL, \"Failed to gather the application's API methods.\", {\n cause: e\n });\n }\n }\n\n private triggerApplicationLifecycleEvent(event: \"after-start\" | \"before-stop\") {\n this.lifecycleEvents?.emitLifecycleEvent(event);\n }\n\n private checkAbort() {\n if (this.state === \"destroyed\") {\n throwAbortError();\n }\n }\n\n private showErrorScreen(error: globalThis.Error) {\n const { shadowRoot, elementOptions } = this.options;\n\n const userLocales = getBrowserLocales();\n const i18nConfig = new I18nConfig(Object.keys(MESSAGES_BY_LOCALE));\n const { locale, messageLocale } = i18nConfig.pickSupportedLocale(undefined, userLocales);\n\n const container = (this.container = createContainer(locale));\n container.classList.add(\"pioneer-root-error-screen\");\n\n const messages =\n MESSAGES_BY_LOCALE[messageLocale as keyof typeof MESSAGES_BY_LOCALE] ??\n MESSAGES_BY_LOCALE[\"en\"];\n const intl = createPackageIntl(locale, messages);\n this.reactIntegration = ReactIntegration.createForErrorScreen({\n rootNode: container,\n container: shadowRoot,\n theme: elementOptions.theme\n });\n this.reactIntegration.render(createElement(ErrorScreen, { intl, error }));\n\n shadowRoot.replaceChildren(container);\n }\n}\n\nfunction createContainer(locale: string) {\n // Setup application root node in the shadow dom\n const container = document.createElement(\"div\");\n container.classList.add(\"pioneer-root\");\n container.style.minHeight = \"100%\";\n container.style.height = \"100%\";\n if (locale) {\n container.lang = locale;\n }\n return container;\n}\n\nfunction createServiceLayer(config: {\n packageMetadata: Record<string, PackageMetadata> | undefined;\n properties: ApplicationProperties;\n builtinPackage: PackageRepr;\n i18n: AppI18n;\n}) {\n const { packageMetadata, properties, builtinPackage, i18n } = config;\n\n let packages: PackageRepr[];\n try {\n packages = createPackages(packageMetadata ?? {}, i18n, properties);\n } catch (e) {\n throw new Error(ErrorId.INVALID_METADATA, \"Failed to parse package metadata.\", {\n cause: e\n });\n }\n\n // Add builtin services defined within this package.\n {\n const index = packages.findIndex((pkg) => pkg.name === builtinPackage.name);\n if (index >= 0) {\n packages.splice(index, 1);\n }\n packages.push(builtinPackage);\n }\n\n // Automatically required references (-> forces services to start)\n const forcedReferences: ReferenceSpec[] = [\n {\n interfaceName: RUNTIME_API_SERVICE\n },\n {\n interfaceName: RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE\n },\n {\n interfaceName: RUNTIME_AUTO_START,\n all: true\n }\n ];\n const serviceLayer = new ServiceLayer(packages, forcedReferences);\n return {\n packages: new Map(packages.map((pkg) => [pkg.name, pkg])),\n serviceLayer: serviceLayer\n };\n}\n\nfunction getInternalService<T = unknown>(serviceLayer: ServiceLayer, interfaceName: string) {\n const result = serviceLayer.getService(\n \"@open-pioneer/runtime\",\n {\n interfaceName\n },\n { ignoreDeclarationCheck: true }\n );\n if (result.type !== \"found\") {\n throw new Error(\n ErrorId.INTERNAL,\n `Failed to find instance of '${interfaceName}' (result type '${result.type}').` +\n ` This is a builtin service that must be present exactly once.`\n );\n }\n\n return result.value.getInstanceOrThrow() as T;\n}\n\n/**\n * Gathers application properties by reading them from the options object\n * and by (optionally) invoking the `resolveProperties` hook.\n */\nasync function gatherConfig(\n hostElement: HTMLElement,\n options: CustomElementOptions,\n overrides?: ApplicationOverrides\n) {\n let configs: ApplicationConfig[];\n try {\n const staticConfig = options.config ?? {};\n const dynamicConfig =\n (await options.resolveConfig?.({\n hostElement,\n getAttribute(name) {\n return hostElement.getAttribute(name) ?? undefined;\n }\n })) ?? {};\n\n configs = [staticConfig, dynamicConfig];\n } catch (e) {\n throw new Error(\n ErrorId.CONFIG_RESOLUTION_FAILED,\n \"Failed to resolve application properties.\",\n {\n cause: e\n }\n );\n }\n\n const merged = mergeConfigs(configs);\n if (overrides?.locale) {\n merged.locale = overrides.locale;\n }\n return merged;\n}\n\n/**\n * Merges application configurations into a single object.\n * Properties / config parameters at a later position overwrite properties from earlier ones.\n */\nfunction mergeConfigs(configs: ApplicationConfig[]): Required<ApplicationConfig> {\n // Merge simple values by assigning them in order\n const mergedConfig: Required<ApplicationConfig> = Object.assign(\n {\n locale: undefined,\n properties: {}\n } satisfies ApplicationConfig,\n ...configs\n );\n\n // Deep merge for application properties\n const mergedProperties: ApplicationProperties = (mergedConfig.properties = {});\n for (const config of configs) {\n for (const [packageName, packageProperties] of Object.entries(config.properties ?? {})) {\n const mergedPackageProps = (mergedProperties[packageName] ??= {});\n Object.assign(mergedPackageProps, packageProperties);\n }\n }\n\n return mergedConfig;\n}\n\n// Applies application styles to the given style node.\n// Can be called multiple times in development mode to implement hot reloading.\nfunction applyStyles(styleNode: HTMLStyleElement, styles: { value: string } | undefined) {\n let cssValue = styles?.value ?? \"\";\n // Remove sourcemaps from inline css.\n // This currently does not work because a) the 'importer' (the index.html file) does not\n // match the actual path the source map would exist and b) vite refuses to generate it anyway, probably\n // because of our virtual modules.\n // TODO: both should be fixed once we can refer to actual `.css` files\n // and don't have to embed inline css anymore.\n cssValue = cssValue.replace(/\\/\\*# sourceMappingURL=.*$/, \"\");\n const cssNode = document.createTextNode(cssValue);\n styleNode.replaceChildren(cssNode);\n}\n\nfunction logError(e: unknown) {\n if (e instanceof Error) {\n const chain = getErrorChain(e).reverse();\n if (chain.length === 1) {\n console.error(e);\n return;\n }\n\n let n = 1;\n for (const error of chain) {\n console.error(`#${n}`, error);\n ++n;\n }\n } else {\n console.error(\"Unexpected error\", e);\n }\n}\n\nfunction emptyComponent() {\n return null;\n}\n"],"names":[],"mappings":";;;;;;;;;;AA8BA,MAAM,GAAA,GAAM,aAAa,uBAAuB,CAAA;AAwHzC,SAAS,oBAAoB,OAA8D,EAAA;AAAA,EAC9F,MAAM,2BAA2B,WAA0C,CAAA;AAAA,IACvE,WAAA;AAAA,IACA,SAAA;AAAA;AAAA,IAGA,gBAAA;AAAA;AAAA,IAEA,WAAW,kBAA+B,GAAA;AACtC,MAAA,OAAO,EAAC;AAAA;AACZ,IAEA,WAAc,GAAA;AACV,MAAM,KAAA,EAAA;AAEN,MAAK,IAAA,CAAA,WAAA,GAAc,KAAK,YAAa,CAAA;AAAA,QACjC,IAAM,EAAA;AAAA,OACT,CAAA;AAED,MAAI,IAAA,MAAA,CAAA,IAAA,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