@open-pioneer/runtime 4.9.0-dev.20260930055642 → 4.9.0-dev.20261029090037

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/CustomElement.d.ts +5 -5
  3. package/CustomElement.js +1 -3
  4. package/CustomElement.js.map +1 -1
  5. package/README.md +14 -6
  6. package/Service.d.ts +2 -2
  7. package/Service.js.map +1 -1
  8. package/_virtual/source-info.js +7 -5
  9. package/_virtual/source-info.js.map +1 -1
  10. package/api.d.ts +7 -8
  11. package/app/AppInstance.js +10 -6
  12. package/app/AppInstance.js.map +1 -1
  13. package/app/gatherConfig.d.ts +13 -4
  14. package/app/gatherConfig.js +23 -12
  15. package/app/gatherConfig.js.map +1 -1
  16. package/app/logErrors.js +1 -1
  17. package/builtin-services/ApplicationContextImpl.js +7 -1
  18. package/builtin-services/ApplicationContextImpl.js.map +1 -1
  19. package/builtin-services/{ApplicationLifecycleEventService.d.ts → ApplicationLifecycleEventServiceImpl.d.ts} +1 -1
  20. package/builtin-services/{ApplicationLifecycleEventService.js → ApplicationLifecycleEventServiceImpl.js} +4 -4
  21. package/builtin-services/ApplicationLifecycleEventServiceImpl.js.map +1 -0
  22. package/builtin-services/NumberParserServiceImpl.d.ts +1 -1
  23. package/builtin-services/NumberParserServiceImpl.js +3 -3
  24. package/builtin-services/NumberParserServiceImpl.js.map +1 -1
  25. package/builtin-services/index.js +2 -2
  26. package/builtin-services/index.js.map +1 -1
  27. package/dom/index.d.ts +0 -1
  28. package/dom/index.js +1 -1
  29. package/dom/index.js.map +1 -1
  30. package/i18n/AppIntl.d.ts +1 -1
  31. package/i18n/AppIntl.js +5 -10
  32. package/i18n/AppIntl.js.map +1 -1
  33. package/i18n/PackageIntl.js +2 -5
  34. package/i18n/PackageIntl.js.map +1 -1
  35. package/metadata/ObservableBox.d.ts +1 -1
  36. package/metadata/ObservableBox.js.map +1 -1
  37. package/package.json +8 -8
  38. package/react-integration/PackageContext.d.ts +1 -1
  39. package/react-integration/PackageContext.js.map +1 -1
  40. package/react-integration/hooks.d.ts +4 -4
  41. package/react-integration/hooks.js +6 -7
  42. package/react-integration/hooks.js.map +1 -1
  43. package/service-layer/PackageRepr.d.ts +1 -1
  44. package/service-layer/PackageRepr.js +1 -1
  45. package/service-layer/PackageRepr.js.map +1 -1
  46. package/service-layer/ServiceLayer.d.ts +3 -2
  47. package/service-layer/ServiceLayer.js +4 -3
  48. package/service-layer/ServiceLayer.js.map +1 -1
  49. package/service-layer/ServiceLookup.d.ts +4 -3
  50. package/service-layer/ServiceLookup.js +3 -3
  51. package/service-layer/ServiceLookup.js.map +1 -1
  52. package/service-layer/ServiceRepr.d.ts +2 -2
  53. package/service-layer/ServiceRepr.js +7 -5
  54. package/service-layer/ServiceRepr.js.map +1 -1
  55. package/builtin-services/ApplicationLifecycleEventService.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,10 +1,21 @@
1
1
  # @open-pioneer/runtime
2
2
 
3
- ## 4.9.0-dev.20260930055642
3
+ ## 4.9.0-dev.20261029090037
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - 6145961: Update @formatjs/intl to version 6
7
+ - 6145961: Update `@formatjs/intl` to version 6.
8
+
9
+ ### Patch Changes
10
+
11
+ - 6b160f3: Fix a set of smaller issues:
12
+ - `element.when()` rejects with an abort error when the app failed to start, also when it is called after the failure. Previously such a call returned a promise that never settled.
13
+ - The deprecated `ApplicationContext.setLocale()` throws `runtime:unsupported-locale` again for a string that is not a valid BCP 47 tag, instead of silently switching to automatic locale selection.
14
+ - `useService()` no longer repeats the service lookup on every render when an options object is passed inline.
15
+ - The development-only intl watch of a service is released when the service constructor throws, and the `AppIntl` instance is released when the app is destroyed during startup.
16
+
17
+ - 42ca366: Update dependencies
18
+ - 7053566: An `undefined` value returned from `resolveConfig()` (for example `locale`) no longer overrides the default value of `config`.
8
19
 
9
20
  ## 4.8.0
10
21
 
@@ -44,7 +44,7 @@ export interface CustomElementOptions {
44
44
  resolveConfig?(ctx: ConfigContext): Promise<ApplicationConfig | undefined>;
45
45
  }
46
46
  /**
47
- * A context object that is passed to the `resolveProperties` function.
47
+ * A context object that is passed to the `resolveConfig` function.
48
48
  */
49
49
  export interface ConfigContext {
50
50
  /**
@@ -56,12 +56,12 @@ export interface ConfigContext {
56
56
  */
57
57
  overrides: ApplicationOverrides | undefined;
58
58
  /**
59
- * Returns an attribute from the application's root node.
59
+ * Returns an attribute of the application's host element.
60
60
  */
61
61
  getAttribute(name: string): string | undefined;
62
62
  }
63
63
  /**
64
- * Application overrides are defined when the is explicitly being restarted with new options.
64
+ * Application overrides are defined when the application is explicitly restarted with new options.
65
65
  *
66
66
  * Options set through overrides cannot be overwritten by the `resolveConfig` hook.
67
67
  */
@@ -196,11 +196,11 @@ export interface ApplicationElementConstructor {
196
196
  * Creates a new custom element class (web component) that can be registered within a DOM.
197
197
  *
198
198
  * @example
199
- * ```ts
199
+ * ```tsx
200
200
  * import * as appMetadata from "open-pioneer:app";
201
201
  *
202
202
  * const CustomElementClazz = createCustomElement({
203
- * component: <div>Hello World!</div>,
203
+ * component: () => <div>Hello World!</div>,
204
204
  * appMetadata
205
205
  * });
206
206
  * customElements.define("sample-element", CustomElementClazz);
package/CustomElement.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createLogger, Error } from '@open-pioneer/core';
2
- import { sourceId$7 as sourceId } from './_virtual/source-info.js';
2
+ import { sourceId$8 as sourceId } from './_virtual/source-info.js';
3
3
  import { AppInstance } from './app/AppInstance.js';
4
4
  import { ErrorId } from './errors.js';
5
5
 
@@ -8,9 +8,7 @@ function createCustomElement(options) {
8
8
  class PioneerApplication extends HTMLElement {
9
9
  #shadowRoot;
10
10
  #instance;
11
- // oxlint-disable-next-line @typescript-eslint/no-explicit-any
12
11
  #deferredRestart;
13
- // A Timer
14
12
  static get observedAttributes() {
15
13
  return [];
16
14
  }
@@ -1 +1 @@
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\n\nimport { SystemConfig as ChakraSystemConfig } from \"@chakra-ui/react\";\nimport { createLogger, Error } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ComponentType } from \"react\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type ApiMethods, type ColorModeValue, type ApiExtension } from \"./api\";\nimport { AppInstance } from \"./app\";\nimport { ErrorId } from \"./errors\";\nimport { ApplicationMetadata } from \"./metadata\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ServiceOptions } from \"./Service\";\n\nconst LOG = createLogger(sourceId);\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 * Chakra styled system object.\n *\n * Used to configure chakra's theme.\n */\n chakraSystemConfig?: ChakraSystemConfig;\n\n /**\n * Advanced configuration that alters the behavior of the custom element.\n */\n advanced?: AdvancedCustomElementOptions;\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/**\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 * Defined when the application forcefully restarts with new options.\n */\n overrides: ApplicationOverrides | undefined;\n\n /**\n * Returns an attribute from the application's root node.\n */\n getAttribute(name: string): string | undefined;\n}\n\n/**\n * Application overrides are defined when the is explicitly being restarted with new options.\n *\n * Options set through overrides cannot be overwritten by the `resolveConfig` hook.\n */\nexport interface ApplicationOverrides {\n /**\n * The new application locale.\n */\n locale?: string;\n\n /**\n * The new color mode.\n */\n colorMode?: ColorModeValue | \"system\";\n\n /**\n * The new used chakra system config.\n */\n chakraSystemConfig?: ChakraSystemConfig;\n}\n\n/**\n * Runtime application configuration.\n */\nexport interface ApplicationConfig {\n /**\n * Set this value to a locale (BCP-47 string, e.g. `\"en\"`) to set the default message locale of the application.\n *\n * The default behavior is to choose an appropriate locale for the current user based\n * on the browser's settings.\n *\n * This locale should match one of the supported message locales defined by the application's package.\n */\n locale?: string | undefined;\n\n /**\n * The list of locales supported by the application.\n *\n * This allows a further restriction of the locales supported by the application, compared to the ones defined by the application's package.\n * It is not possible to extend the supported locales defined by the package, only to restrict them.\n *\n * If this property is not set, then the application supports all locales defined by the application's package.\n * If the values are not a valid subset of the application package supported locales, then the application will throw an error at startup.\n *\n * An empty array will disable loading of any message bundle.\n */\n supportedLocales?: string[] | undefined;\n\n /**\n * Configures the application's initial color mode.\n *\n * Use `system` to use the user's preferred color mode, derived from the browser or operating system.\n *\n * Default: `light`.\n */\n colorMode?: ColorModeValue | \"system\";\n\n /**\n * Properties specified here will override default properties of the application's packages.\n */\n properties?: ApplicationProperties | undefined;\n\n /**\n * Chakra styled system object.\n *\n * Used to configure chakra's theme.\n *\n * NOTE: This setting has priority over {@link CustomElementOptions.chakraSystemConfig}.\n */\n chakraSystemConfig?: ChakraSystemConfig;\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 /**\n * Resolves to the element's API when the application has started.\n *\n * The API exposed by an application can be defined by implementing an {@link ApiExtension}.\n * For more details, open the documentation of the `@open-pioneer/integration` package.\n */\n when(): Promise<ApiMethods>;\n}\n\n/**\n * Advanced configuration that alters the behavior of the custom element.\n *\n * See {@link createCustomElement}.\n */\nexport interface AdvancedCustomElementOptions {\n /**\n * Enables or disables the [shadow root](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot) inside the application's web component.\n *\n * Default: `true`.\n *\n * By default, trails applications use a shadow root to avoid conflicts (e.g. styles) with other parts of the site where the application may be embedded.\n *\n * Applications that use the entire browser viewport may not need this feature, since there may be no \"other\" parts that may conflict with the app.\n * In this case, you can disable the shadow root by setting this property to `false`.\n * In general, UI components used by the app (e.g. from Chakra UI) should work just as well when disabling the shadow root.\n * If you notice any problems, please file an issue.\n *\n * If you are developing UI components that are meant to be used in other applications, you should always use a shadow root to\n * ensure that your components work in that setting.\n */\n enableShadowRoot?: boolean;\n\n /**\n * Opts into live locale changes within the running application, without performing a full application restart.\n *\n * Default: `false`.\n *\n * Live locale changes preserve the application's state when the user changes the language.\n * It requires that react components and services in the application handle intl changes correctly (see, for example, {@link ServiceOptions.currentIntl}).\n *\n * Note that this option will become the new default in the next major release,\n * at which point this option will be removed.\n */\n enableLiveLocaleChanges?: boolean;\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 | undefined;\n #instance: AppInstance | undefined;\n\n // oxlint-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 const enableShadowRoot = options.advanced?.enableShadowRoot ?? true;\n if (enableShadowRoot) {\n this.#shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n } else {\n LOG.debug(\"Creating component instance without shadow root\");\n }\n\n if (import.meta.env.DEV) {\n // oxlint-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 AppInstance({\n rootNode: this.#shadowRoot ?? document,\n hostElement: this,\n elementOptions: options,\n overrides: overrides,\n restart: this.#triggerReload.bind(this)\n });\n }\n }\n return PioneerApplication;\n}\n"],"names":[],"mappings":";;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cesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SystemConfig as ChakraSystemConfig } from \"@chakra-ui/react\";\nimport { createLogger, Error } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ComponentType } from \"react\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type ApiMethods, type ColorModeValue, type ApiExtension } from \"./api\";\nimport { AppInstance } from \"./app\";\nimport { ErrorId } from \"./errors\";\nimport { ApplicationMetadata } from \"./metadata\";\n// oxlint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { ServiceOptions } from \"./Service\";\n\nconst LOG = createLogger(sourceId);\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 * Chakra styled system object.\n *\n * Used to configure chakra's theme.\n */\n chakraSystemConfig?: ChakraSystemConfig;\n\n /**\n * Advanced configuration that alters the behavior of the custom element.\n */\n advanced?: AdvancedCustomElementOptions;\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/**\n * A context object that is passed to the `resolveConfig` function.\n */\nexport interface ConfigContext {\n /**\n * The application's host element.\n */\n hostElement: HTMLElement;\n\n /**\n * Defined when the application forcefully restarts with new options.\n */\n overrides: ApplicationOverrides | undefined;\n\n /**\n * Returns an attribute of the application's host element.\n */\n getAttribute(name: string): string | undefined;\n}\n\n/**\n * Application overrides are defined when the application is explicitly restarted with new options.\n *\n * Options set through overrides cannot be overwritten by the `resolveConfig` hook.\n */\nexport interface ApplicationOverrides {\n /**\n * The new application locale.\n */\n locale?: string;\n\n /**\n * The new color mode.\n */\n colorMode?: ColorModeValue | \"system\";\n\n /**\n * The new used chakra system config.\n */\n chakraSystemConfig?: ChakraSystemConfig;\n}\n\n/**\n * Runtime application configuration.\n */\nexport interface ApplicationConfig {\n /**\n * Set this value to a locale (BCP-47 string, e.g. `\"en\"`) to set the default message locale of the application.\n *\n * The default behavior is to choose an appropriate locale for the current user based\n * on the browser's settings.\n *\n * This locale should match one of the supported message locales defined by the application's package.\n */\n locale?: string | undefined;\n\n /**\n * The list of locales supported by the application.\n *\n * This allows a further restriction of the locales supported by the application, compared to the ones defined by the application's package.\n * It is not possible to extend the supported locales defined by the package, only to restrict them.\n *\n * If this property is not set, then the application supports all locales defined by the application's package.\n * If the values are not a valid subset of the application package supported locales, then the application will throw an error at startup.\n *\n * An empty array will disable loading of any message bundle.\n */\n supportedLocales?: string[] | undefined;\n\n /**\n * Configures the application's initial color mode.\n *\n * Use `system` to use the user's preferred color mode, derived from the browser or operating system.\n *\n * Default: `light`.\n */\n colorMode?: ColorModeValue | \"system\";\n\n /**\n * Properties specified here will override default properties of the application's packages.\n */\n properties?: ApplicationProperties | undefined;\n\n /**\n * Chakra styled system object.\n *\n * Used to configure chakra's theme.\n *\n * NOTE: This setting has priority over {@link CustomElementOptions.chakraSystemConfig}.\n */\n chakraSystemConfig?: ChakraSystemConfig;\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 /**\n * Resolves to the element's API when the application has started.\n *\n * The API exposed by an application can be defined by implementing an {@link ApiExtension}.\n * For more details, open the documentation of the `@open-pioneer/integration` package.\n */\n when(): Promise<ApiMethods>;\n}\n\n/**\n * Advanced configuration that alters the behavior of the custom element.\n *\n * See {@link createCustomElement}.\n */\nexport interface AdvancedCustomElementOptions {\n /**\n * Enables or disables the [shadow root](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot) inside the application's web component.\n *\n * Default: `true`.\n *\n * By default, trails applications use a shadow root to avoid conflicts (e.g. styles) with other parts of the site where the application may be embedded.\n *\n * Applications that use the entire browser viewport may not need this feature, since there may be no \"other\" parts that may conflict with the app.\n * In this case, you can disable the shadow root by setting this property to `false`.\n * In general, UI components used by the app (e.g. from Chakra UI) should work just as well when disabling the shadow root.\n * If you notice any problems, please file an issue.\n *\n * If you are developing UI components that are meant to be used in other applications, you should always use a shadow root to\n * ensure that your components work in that setting.\n */\n enableShadowRoot?: boolean;\n\n /**\n * Opts into live locale changes within the running application, without performing a full application restart.\n *\n * Default: `false`.\n *\n * Live locale changes preserve the application's state when the user changes the language.\n * It requires that react components and services in the application handle intl changes correctly (see, for example, {@link ServiceOptions.currentIntl}).\n *\n * Note that this option will become the new default in the next major release,\n * at which point this option will be removed.\n */\n enableLiveLocaleChanges?: boolean;\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 * ```tsx\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 | undefined;\n #instance: AppInstance | undefined;\n\n #deferredRestart: ReturnType<typeof setTimeout> | undefined;\n\n static get observedAttributes(): string[] {\n return [];\n }\n\n constructor() {\n super();\n\n const enableShadowRoot = options.advanced?.enableShadowRoot ?? true;\n if (enableShadowRoot) {\n this.#shadowRoot = this.attachShadow({\n mode: \"open\"\n });\n } else {\n LOG.debug(\"Creating component instance without shadow root\");\n }\n\n if (import.meta.env.DEV) {\n // oxlint-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 AppInstance({\n rootNode: this.#shadowRoot ?? document,\n hostElement: this,\n elementOptions: options,\n overrides: overrides,\n restart: this.#triggerReload.bind(this)\n });\n }\n }\n return PioneerApplication;\n}\n"],"names":[],"mappings":";;;;;AAeA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAoO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uBAAuB,CAAA;AAAA,IACrC;AAAA,IAEA,IAAA,GAAO;AACH,MAAA,IAAI,CAAC,KAAK,SAAA,EAAW;AACjB,QAAA,OAAO,OAAA,CAAQ,MAAA;AAAA,UACX,IAAI,KAAA;AAAA,YACA,OAAA,CAAQ,WAAA;AAAA,YACR;AAAA;AACJ,SACJ;AAAA,MACJ;AAEA,MAAA,OAAO,IAAA,CAAK,UAAU,OAAA,EAAQ;AAAA,IAClC;AAAA,IAEA,eAAe,SAAA,EAAkC;AAE7C,MAAA,IAAI,KAAK,gBAAA,EAAkB;AACvB,QAAA,YAAA,CAAa,KAAK,gBAAgB,CAAA;AAAA,MACtC;AACA,MAAA,IAAA,CAAK,gBAAA,GAAmB,WAAW,MAAM;AACrC,QAAA,IAAI,CAAC,KAAK,SAAA,EAAW;AAEjB,UAAA;AAAA,QACJ;AAEA,QAAA,GAAA,CAAI,KAAA,CAAM,2CAA2C,SAAS,CAAA;AAC9D,QAAA,IAAA,CAAK,UAAU,OAAA,EAAQ;AACvB,QAAA,IAAA,CAAK,SAAA,GAAY,IAAA,CAAK,0BAAA,CAA2B,SAAS,CAAA;AAC1D,QAAA,IAAA,CAAK,UAAU,KAAA,EAAM;AAAA,MACzB,GAAG,CAAC,CAAA;AAAA,IACR;AAAA,IAEA,2BAA2B,SAAA,EAAkC;AACzD,MAAA,OAAO,IAAI,WAAA,CAAY;AAAA,QACnB,QAAA,EAAU,KAAK,WAAA,IAAe,QAAA;AAAA,QAC9B,WAAA,EAAa,IAAA;AAAA,QACb,cAAA,EAAgB,OAAA;AAAA,QAChB,SAAA;AAAA,QACA,OAAA,EAAS,IAAA,CAAK,cAAA,CAAe,IAAA,CAAK,IAAI;AAAA,OACzC,CAAA;AAAA,IACL;AAAA;AAEJ,EAAA,OAAO,kBAAA;AACX;;"}
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # @open-pioneer/runtime
2
2
 
3
3
  Implements the runtime environment for Open Pioneer Trails apps.
4
- Additionally, the package provides some services that provide useful functionalities for app development.
4
+ The package also provides services for app development.
5
5
 
6
6
  ## Quick start
7
7
 
8
8
  Import the `createCustomElement` function from this package to create your application as a Web Component:
9
9
 
10
10
  ```js
11
- // my-app/app.js
11
+ // my-app/app.ts
12
12
  import { createCustomElement } from "@open-pioneer/runtime";
13
13
  import * as appMetadata from "open-pioneer:app";
14
14
  import { AppUI } from "./AppUI";
@@ -22,7 +22,7 @@ customElements.define("my-app", Element);
22
22
  ```
23
23
 
24
24
  In this example, `Element` is a custom web component class registered as `<my-app>`.
25
- The application renders the `AppUI` (a React component) and automatically contains services, styles etc. its package dependencies.
25
+ The application renders the `AppUI` (a React component) and automatically contains the services, styles etc. of its package dependencies.
26
26
  HTML sites or JavaScript code can now instantiate the application by creating a DOM-Element:
27
27
 
28
28
  ```html
@@ -41,9 +41,9 @@ HTML sites or JavaScript code can now instantiate the application by creating a
41
41
 
42
42
  If a hard error occurs on application start, the `AppUI` cannot be rendered but an error screen is shown instead.
43
43
  The error screen shows a message to the user that an error occurred on application start.
44
- The error screen is available in english (fallback) and german.
44
+ The error screen is available in English (fallback) and German.
45
45
 
46
- If the application was started in DEV-mode, the error screen shows additional information about the error and the stack trace.
46
+ If the application was started in development mode, the error screen shows additional information about the error and the stack trace.
47
47
 
48
48
  ## Provided services
49
49
 
@@ -52,7 +52,15 @@ For details, see the API description of the respective service.
52
52
 
53
53
  ### ApplicationContext
54
54
 
55
- The ApplicationContext provides access to global application values. E.g. the web component's host element and the current locale.
55
+ The ApplicationContext provides access to global application values, e.g. the web component's host element and the root node.
56
+
57
+ ### LocaleService
58
+
59
+ The LocaleService provides the current locale and the supported message locales, and switches the locale at runtime.
60
+
61
+ ### ThemeService
62
+
63
+ The ThemeService controls the color mode and the Chakra system config of the app.
56
64
 
57
65
  ### NumberParserService
58
66
 
package/Service.d.ts CHANGED
@@ -3,8 +3,8 @@ import { PackageIntl } from "./i18n";
3
3
  /** Lifecycle hooks supported by the service interface. */
4
4
  export interface ServiceLifecycleHooks {
5
5
  /**
6
- * Destroys the component.
7
- * Should clean up all resources used by the component.
6
+ * Destroys the service.
7
+ * Should clean up all resources used by the service.
8
8
  */
9
9
  destroy?(): void;
10
10
  toString(): string;
package/Service.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Service.js","sources":["Service.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { PackageIntl } from \"./i18n\";\n\n/** Lifecycle hooks supported by the service interface. */\nexport interface ServiceLifecycleHooks {\n /**\n * Destroys the component.\n * Should clean up all resources used by the component.\n */\n destroy?(): void;\n\n /*\n * Just used so that this interface is not empty.\n * TypeScript would otherwise throw an 'no common properties' error\n * if one tries to implement this interface without providing any\n * lifecycle hooks.\n */\n toString(): string;\n}\n\nexport type Service<Interface extends {} = {}> = ServiceLifecycleHooks & Interface;\n\n/**\n * Represents metadata for an injected reference.\n */\nexport interface ReferenceMeta {\n /**\n * The unique service id of the injected service.\n */\n serviceId: string;\n}\n\n/**\n * Contains metadata about injected references.\n * The key for the reference metadata is the reference's name.\n */\nexport type ReferencesMeta<References extends {}> = {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n [referenceName in keyof References]: References[referenceName] extends any[]\n ? ReferenceMeta[]\n : ReferenceMeta;\n};\n\n/**\n * Options passed to a service's constructor.\n */\nexport type ServiceOptions<References extends {} = {}> = {\n /**\n * References to other services.\n * These are injected by the runtime and match the declared references of the service.\n */\n references: References;\n\n /**\n * Metadata about the injected references.\n * The object contains one entry for every reference injected via `references` (under the same key).\n *\n * If a single service has been injected, `referencesMeta[key]` will be of type {@link ReferenceMeta}.\n * If multiple services have been injected, an array of {@link ReferenceMeta} will be provided instead,\n * where the indices match the order in the injected references array.\n */\n referencesMeta: ReferencesMeta<References>;\n\n /**\n * Configuration properties.\n *\n * Default values are taken from the package's configuration, but these can be overridden\n * by the application.\n */\n properties: Record<string, unknown>;\n\n /**\n * A constant reference to the shared i18n object of the current package.\n *\n * @deprecated use `currentIntl` instead, which is a signal that returns the current i18n object and updates when it changes at runtime. Be aware to implement a watch for yourself\n */\n intl: PackageIntl;\n\n /**\n * A signal that returns the current i18n object of the service's package.\n *\n * The i18n object may change at runtime (for example to implement hot reloading during development,\n * or to implement language changes while the application is running).\n */\n currentIntl: ReadonlyReactive<PackageIntl>;\n};\n\n/**\n * A service constructor returns a service instance when calling `new`.\n */\nexport type ServiceConstructor<References extends {} = {}, Interface extends {} = {}> = {\n new (options: ServiceOptions<References>): Service<Interface>;\n};\n\n/**\n * A service factory is an object that has a method to create a service instance.\n * The service factory itself can also implement lifecycle hooks, which will be called by the runtime\n * when the factory is destroyed.\n */\nexport type ServiceFactory<Interface extends {} = {}> = {\n /**\n * Method to create a service instance.\n * It is directly called by the runtime after constructing the factory.\n * NOTE: the service.destroy lifecycle hook is not called by the runtime.\n */\n createService(): Interface;\n /**\n * Optional method to destroy a service instance created by this factory.\n * If provided, this method will be called by the runtime when the service instance is destroyed.\n * A factory instance exists per service, this method invocation means that the factory is no longer used by the runtime.\n */\n destroyService?(service: Interface): void;\n};\n\n/**\n * A constructor type for a service factory.\n * The service factory is an object that has a method to create a service instance,\n * this allows for more flexibility in service construction.\n */\nexport type ServiceFactoryConstructor<References extends {} = {}, Interface extends {} = {}> = {\n new (options: ServiceOptions<References>): ServiceFactory<Interface>;\n};\n\n/**\n * Symbol used to detect if a constructor function is a service factory constructor.\n */\nconst IS_SERVICE_FACTORY = Symbol(\"runtime.IS_SERVICE_FACTORY\");\nexport { IS_SERVICE_FACTORY };\n\n/**\n * A service factory constructor must be marked\n * with the `IS_SERVICE_FACTORY` symbol to be recognized by the runtime as such.\n */\nexport type MarkedServiceFactoryConstructor<\n References extends {} = {},\n Interface extends {} = {}\n> = ServiceFactoryConstructor<References, Interface> & {\n [IS_SERVICE_FACTORY]: true;\n};\n\n/**\n * Utility function to mark a constructor as a service factory constructor.\n * @param ctr normal constructor function for a service factory.\n * @returns the same constructor function, but marked with the `IS_SERVICE_FACTORY` symbol so that the runtime recognizes it as a service factory constructor.\n */\nexport function defineServiceFactory(\n ctr: ServiceFactoryConstructor\n): MarkedServiceFactoryConstructor {\n const markedCtr = ctr as MarkedServiceFactoryConstructor;\n markedCtr[IS_SERVICE_FACTORY] = true;\n return markedCtr;\n}\n"],"names":[],"mappings":"AAiIA,MAAM,kBAAA,0BAA4B,4BAA4B;AAmBvD,SAAS,qBACZ,GAAA,EAC+B;AAC/B,EAAA,MAAM,SAAA,GAAY,GAAA;AAClB,EAAA,SAAA,CAAU,kBAAkB,CAAA,GAAI,IAAA;AAChC,EAAA,OAAO,SAAA;AACX;;"}
1
+ {"version":3,"file":"Service.js","sources":["Service.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { PackageIntl } from \"./i18n\";\n\n/** Lifecycle hooks supported by the service interface. */\nexport interface ServiceLifecycleHooks {\n /**\n * Destroys the service.\n * Should clean up all resources used by the service.\n */\n destroy?(): void;\n\n /*\n * Just used so that this interface is not empty.\n * TypeScript would otherwise throw an 'no common properties' error\n * if one tries to implement this interface without providing any\n * lifecycle hooks.\n */\n toString(): string;\n}\n\nexport type Service<Interface extends {} = {}> = ServiceLifecycleHooks & Interface;\n\n/**\n * Represents metadata for an injected reference.\n */\nexport interface ReferenceMeta {\n /**\n * The unique service id of the injected service.\n */\n serviceId: string;\n}\n\n/**\n * Contains metadata about injected references.\n * The key for the reference metadata is the reference's name.\n */\nexport type ReferencesMeta<References extends {}> = {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n [referenceName in keyof References]: References[referenceName] extends any[]\n ? ReferenceMeta[]\n : ReferenceMeta;\n};\n\n/**\n * Options passed to a service's constructor.\n */\nexport type ServiceOptions<References extends {} = {}> = {\n /**\n * References to other services.\n * These are injected by the runtime and match the declared references of the service.\n */\n references: References;\n\n /**\n * Metadata about the injected references.\n * The object contains one entry for every reference injected via `references` (under the same key).\n *\n * If a single service has been injected, `referencesMeta[key]` will be of type {@link ReferenceMeta}.\n * If multiple services have been injected, an array of {@link ReferenceMeta} will be provided instead,\n * where the indices match the order in the injected references array.\n */\n referencesMeta: ReferencesMeta<References>;\n\n /**\n * Configuration properties.\n *\n * Default values are taken from the package's configuration, but these can be overridden\n * by the application.\n */\n properties: Record<string, unknown>;\n\n /**\n * A constant reference to the shared i18n object of the current package.\n *\n * @deprecated use `currentIntl` instead, which is a signal that returns the current i18n object and updates when it changes at runtime. Be aware to implement a watch for yourself\n */\n intl: PackageIntl;\n\n /**\n * A signal that returns the current i18n object of the service's package.\n *\n * The i18n object may change at runtime (for example to implement hot reloading during development,\n * or to implement language changes while the application is running).\n */\n currentIntl: ReadonlyReactive<PackageIntl>;\n};\n\n/**\n * A service constructor returns a service instance when calling `new`.\n */\nexport type ServiceConstructor<References extends {} = {}, Interface extends {} = {}> = {\n new (options: ServiceOptions<References>): Service<Interface>;\n};\n\n/**\n * A service factory is an object that has a method to create a service instance.\n * The service factory itself can also implement lifecycle hooks, which will be called by the runtime\n * when the factory is destroyed.\n */\nexport type ServiceFactory<Interface extends {} = {}> = {\n /**\n * Method to create a service instance.\n * It is directly called by the runtime after constructing the factory.\n * NOTE: the service.destroy lifecycle hook is not called by the runtime.\n */\n createService(): Interface;\n /**\n * Optional method to destroy a service instance created by this factory.\n * If provided, this method will be called by the runtime when the service instance is destroyed.\n * A factory instance exists per service, this method invocation means that the factory is no longer used by the runtime.\n */\n destroyService?(service: Interface): void;\n};\n\n/**\n * A constructor type for a service factory.\n * The service factory is an object that has a method to create a service instance,\n * this allows for more flexibility in service construction.\n */\nexport type ServiceFactoryConstructor<References extends {} = {}, Interface extends {} = {}> = {\n new (options: ServiceOptions<References>): ServiceFactory<Interface>;\n};\n\n/**\n * Symbol used to detect if a constructor function is a service factory constructor.\n */\nconst IS_SERVICE_FACTORY = Symbol(\"runtime.IS_SERVICE_FACTORY\");\nexport { IS_SERVICE_FACTORY };\n\n/**\n * A service factory constructor must be marked\n * with the `IS_SERVICE_FACTORY` symbol to be recognized by the runtime as such.\n */\nexport type MarkedServiceFactoryConstructor<\n References extends {} = {},\n Interface extends {} = {}\n> = ServiceFactoryConstructor<References, Interface> & {\n [IS_SERVICE_FACTORY]: true;\n};\n\n/**\n * Utility function to mark a constructor as a service factory constructor.\n * @param ctr normal constructor function for a service factory.\n * @returns the same constructor function, but marked with the `IS_SERVICE_FACTORY` symbol so that the runtime recognizes it as a service factory constructor.\n */\nexport function defineServiceFactory(\n ctr: ServiceFactoryConstructor\n): MarkedServiceFactoryConstructor {\n const markedCtr = ctr as MarkedServiceFactoryConstructor;\n markedCtr[IS_SERVICE_FACTORY] = true;\n return markedCtr;\n}\n"],"names":[],"mappings":"AAiIA,MAAM,kBAAA,0BAA4B,4BAA4B;AAmBvD,SAAS,qBACZ,GAAA,EAC+B;AAC/B,EAAA,MAAM,SAAA,GAAY,GAAA;AAClB,EAAA,SAAA,CAAU,kBAAkB,CAAA,GAAI,IAAA;AAChC,EAAA,OAAO,SAAA;AACX;;"}
@@ -1,12 +1,14 @@
1
- const sourceId$7 = "@open-pioneer/runtime/CustomElement";
1
+ const sourceId$8 = "@open-pioneer/runtime/CustomElement";
2
2
 
3
- const sourceId$6 = "@open-pioneer/runtime/app/AppInstance";
3
+ const sourceId$7 = "@open-pioneer/runtime/app/AppInstance";
4
4
 
5
- const sourceId$5 = "@open-pioneer/runtime/i18n/AppIntl";
5
+ const sourceId$6 = "@open-pioneer/runtime/i18n/AppIntl";
6
+
7
+ const sourceId$5 = "@open-pioneer/runtime/service-layer/ServiceRepr";
6
8
 
7
9
  const sourceId$4 = "@open-pioneer/runtime/builtin-services/ApplicationContextImpl";
8
10
 
9
- const sourceId$3 = "@open-pioneer/runtime/builtin-services/ApplicationLifecycleEventService";
11
+ const sourceId$3 = "@open-pioneer/runtime/builtin-services/ApplicationLifecycleEventServiceImpl";
10
12
 
11
13
  const sourceId$2 = "@open-pioneer/runtime/builtin-services/NumberParserServiceImpl";
12
14
 
@@ -14,5 +16,5 @@ const sourceId$1 = "@open-pioneer/runtime/service-layer/ServiceLayer";
14
16
 
15
17
  const sourceId = "@open-pioneer/runtime/app/logErrors";
16
18
 
17
- export { sourceId$5 as sourceId, sourceId$4 as sourceId$1, sourceId$3 as sourceId$2, sourceId$2 as sourceId$3, sourceId$1 as sourceId$4, sourceId as sourceId$5, sourceId$6, sourceId$7 };
19
+ export { sourceId$6 as sourceId, sourceId$5 as sourceId$1, sourceId$4 as sourceId$2, sourceId$3, sourceId$2 as sourceId$4, sourceId$1 as sourceId$5, sourceId as sourceId$6, sourceId$7, sourceId$8 };
18
20
  //# sourceMappingURL=source-info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"source-info.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"source-info.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
package/api.d.ts CHANGED
@@ -34,7 +34,7 @@ export interface ApplicationContext extends DeclaredService<"runtime.Application
34
34
  */
35
35
  getHostElement(): HTMLElement;
36
36
  /**
37
- * A root node that resolves to the the shadow root or the site's document.
37
+ * A root node that resolves to the shadow root or the site's document.
38
38
  *
39
39
  * For example:
40
40
  *
@@ -50,7 +50,7 @@ export interface ApplicationContext extends DeclaredService<"runtime.Application
50
50
  *
51
51
  * NOTE: This method returns undefined if the application does not use a shadow root.
52
52
  *
53
- * See also {@link ApplicationConfig.disableShadowRoot} and {@link getRoot()}.
53
+ * See also {@link AdvancedCustomElementOptions.enableShadowRoot} and {@link getRoot}.
54
54
  */
55
55
  getShadowRoot(): ShadowRoot | undefined;
56
56
  /**
@@ -136,7 +136,9 @@ export interface LocaleService extends DeclaredService<"runtime.LocaleService">
136
136
  readonly supportsLiveChanges: boolean;
137
137
  /**
138
138
  * Switches to `locale`. Best-fit match against {@link supportedMessageLocales};
139
- * throws `UNSUPPORTED_LOCALE` on no match. `undefined` enables automatic picking.
139
+ * The promise rejects with the error id `runtime:unsupported-locale` on no match.
140
+ *
141
+ * Use `undefined` to pick the default locale.
140
142
  */
141
143
  changeLocale(locale: Intl.Locale | undefined): Promise<void>;
142
144
  /**
@@ -185,10 +187,7 @@ export type ColorModeValueSupplier = () => ColorModeValue;
185
187
  */
186
188
  export type ChakraSystemConfigSupplier = () => ChakraSystemConfig | undefined;
187
189
  /**
188
- * A Theme Service that provides methods to interact with the chakra theme.
189
- *
190
- * e.g. change the color mode of the application.
191
- * or update the system config of the application.
190
+ * A service that controls the color mode and the Chakra system config of the app.
192
191
  */
193
192
  export interface ThemeService extends DeclaredService<"runtime.ThemeService"> {
194
193
  /**
@@ -198,7 +197,7 @@ export interface ThemeService extends DeclaredService<"runtime.ThemeService"> {
198
197
  /**
199
198
  * The currently active color mode.
200
199
  * It is reactive.
201
- * Defaults to `"light".
200
+ * Defaults to `"light"`.
202
201
  */
203
202
  readonly colorMode: ColorModeValue;
204
203
  /**
@@ -1,6 +1,6 @@
1
1
  import { watchValue, computed, constant, reactive, effect } from '@conterra/reactivity-core';
2
2
  import { createLogger, Error, createAbortError, destroyResource, createManualPromise, throwAbortError } from '@open-pioneer/core';
3
- import { sourceId$6 as sourceId } from '../_virtual/source-info.js';
3
+ import { sourceId$7 as sourceId } from '../_virtual/source-info.js';
4
4
  import { createElement } from 'react';
5
5
  import { createBuiltinPackage, RUNTIME_THEME_SERVICE, RUNTIME_API_SERVICE, RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE, RUNTIME_LOCALE_SERVICE, RUNTIME_AUTO_START } from '../builtin-services/index.js';
6
6
  import { DEFAULT_INITIAL_COLOR_MODE } from '../builtin-services/ThemeServiceImpl.js';
@@ -70,10 +70,7 @@ class AppInstance {
70
70
  return;
71
71
  }
72
72
  if (this.#state === "started") {
73
- try {
74
- this.#triggerApplicationLifecycleEvent("before-stop");
75
- } catch (e) {
76
- }
73
+ this.#triggerApplicationLifecycleEvent("before-stop");
77
74
  }
78
75
  this.#state = "destroyed";
79
76
  this.#reset();
@@ -94,6 +91,9 @@ class AppInstance {
94
91
  if (this.#api) {
95
92
  return Promise.resolve(this.#api);
96
93
  }
94
+ if (this.#state === "destroyed" || this.#state === "error") {
95
+ return Promise.reject(createAbortError());
96
+ }
97
97
  const apiPromise = this.#apiPromise ??= createManualPromise();
98
98
  return apiPromise.promise;
99
99
  }
@@ -111,14 +111,18 @@ class AppInstance {
111
111
  const chakraSystemConfig = themeService2?.systemConfig;
112
112
  restart({ locale: locale?.baseName, colorMode, chakraSystemConfig });
113
113
  };
114
- const i18n = this.#i18n = await AppIntl.create({
114
+ const i18n = await AppIntl.create({
115
115
  appMetadata: elementOptions.appMetadata,
116
116
  forcedLocale: config.locale,
117
117
  restrictSupportedLocales: config.supportedLocales,
118
118
  supportsLiveChanges: enableLiveLocaleChanges,
119
119
  restartWithLocale
120
120
  });
121
+ if (this.#state === "destroyed") {
122
+ i18n.destroy();
123
+ }
121
124
  this.#checkAbort();
125
+ this.#i18n = i18n;
122
126
  const appRoot = this.#appRoot = createAppRoot();
123
127
  this.#localeWatch = watchValue(
124
128
  () => i18n.locale.baseName,
@@ -1 +1 @@
1
- {"version":3,"file":"AppInstance.js","sources":["AppInstance.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SystemConfig } from \"@chakra-ui/react\";\nimport {\n computed,\n constant,\n effect,\n reactive,\n ReadonlyReactive,\n watchValue\n} from \"@conterra/reactivity-core\";\nimport {\n createAbortError,\n createLogger,\n createManualPromise,\n destroyResource,\n Error,\n ManualPromise,\n Resource,\n throwAbortError\n} from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { createElement } from \"react\";\nimport { ApiMethods, ApiService, ColorModeValue, ThemeService } from \"../api\";\nimport {\n createBuiltinPackage,\n RUNTIME_API_SERVICE,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE,\n RUNTIME_AUTO_START,\n RUNTIME_LOCALE_SERVICE,\n RUNTIME_THEME_SERVICE\n} from \"../builtin-services\";\nimport { ApplicationLifecycleEventService } from \"../builtin-services/ApplicationLifecycleEventService\";\nimport { DEFAULT_INITIAL_COLOR_MODE } from \"../builtin-services/ThemeServiceImpl\";\nimport {\n ApplicationConfig,\n ApplicationOverrides,\n ApplicationProperties,\n CustomElementOptions\n} from \"../CustomElement\";\nimport { createAppRoot, isShadowRoot, RootNode } from \"../dom\";\nimport { ErrorId } from \"../errors\";\nimport { AppIntl, createPackageIntl, getBrowserLocales, LocalePicker, parseLocale } from \"../i18n\";\nimport { PackageMetadata } from \"../metadata\";\nimport { ErrorScreen, MESSAGES_BY_LOCALE } from \"../react-integration/ErrorScreen\";\nimport { EmptyComponent, ReactIntegration } from \"../react-integration/ReactIntegration\";\nimport { ReferenceSpec } from \"../service-layer/InterfaceSpec\";\nimport { createPackages, PackageRepr } from \"../service-layer/PackageRepr\";\nimport { ServiceLayer } from \"../service-layer/ServiceLayer\";\nimport { gatherConfig } from \"./gatherConfig\";\nimport { logError } from \"./logErrors\";\n\nconst LOG = createLogger(sourceId);\n\nexport interface AppOptions {\n /** The root node that contains the application. */\n rootNode: RootNode;\n\n /** The HTML element that embeds the application. */\n hostElement: HTMLElement;\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\nexport type AppState = \"not-started\" | \"starting\" | \"started\" | \"destroyed\" | \"error\";\n\nexport class AppInstance {\n #options: AppOptions;\n\n // Public API\n #apiPromise: ManualPromise<ApiMethods> | undefined; // Present when callers are waiting for the API\n #api: ApiMethods | undefined; // Present once started\n\n #state: AppState = \"not-started\";\n #rootNode: RootNode;\n #container: HTMLElement | ShadowRoot; // parent of .pioneer-root\n #i18n: AppIntl | undefined;\n\n // Unused on purpose for easier debugging.\n // oxlint-disable-next-line no-unused-private-class-members\n #appRoot: HTMLDivElement | undefined; // .pioneer-root\n\n // Unused on purpose for easier debugging.\n // oxlint-disable-next-line no-unused-private-class-members\n #config: ApplicationConfig | undefined;\n\n #serviceLayer: ServiceLayer | undefined;\n #lifecycleEvents: ApplicationLifecycleEventService | undefined;\n #themeService: ThemeService | undefined;\n #reactIntegration: ReactIntegration | undefined;\n\n #stylesWatch: Resource | undefined;\n #localeWatch: Resource | undefined;\n\n constructor(options: AppOptions) {\n this.#options = options;\n this.#container = isShadowRoot(options.rootNode) ? options.rootNode : options.hostElement;\n this.#rootNode = options.rootNode;\n }\n\n /** Current lifecycle state. Exposed (read-only) for tests/debugging via `$inspectElementState`. */\n get state(): AppState {\n return this.#state;\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 #reset() {\n this.#apiPromise?.reject(createAbortError());\n this.#reactIntegration = destroyResource(this.#reactIntegration);\n this.#container.replaceChildren();\n this.#appRoot = undefined;\n this.#lifecycleEvents = undefined;\n this.#themeService = undefined;\n this.#i18n = destroyResource(this.#i18n);\n this.#serviceLayer = destroyResource(this.#serviceLayer);\n this.#stylesWatch = destroyResource(this.#stylesWatch);\n this.#localeWatch = destroyResource(this.#localeWatch);\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 async #startImpl() {\n const { hostElement, elementOptions, overrides } = this.#options;\n const root = this.#rootNode;\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 // TODO (next major): always true (option can be removed).\n // Currently false by default (needs to be enabled) to preserve backwards compatibility.\n const enableLiveLocaleChanges = elementOptions.advanced?.enableLiveLocaleChanges ?? false;\n\n // TODO (next major): Remove restarting code!\n const restartWithLocale = (locale: Intl.Locale | undefined) => {\n // this code is triggered, when the app calls changeLocale while reactive switching is disabled.\n const restart = this.#options.restart;\n const themeService = this.#themeService;\n const colorMode = themeService?.colorMode;\n const chakraSystemConfig = themeService?.systemConfig;\n restart({ locale: locale?.baseName, colorMode, chakraSystemConfig });\n };\n\n // Decide on locale and load i18n messages (if any).\n const i18n = (this.#i18n = await AppIntl.create({\n appMetadata: elementOptions.appMetadata,\n forcedLocale: config.locale,\n restrictSupportedLocales: config.supportedLocales,\n supportsLiveChanges: enableLiveLocaleChanges,\n restartWithLocale\n }));\n this.#checkAbort();\n\n // Setup application root node in the shadow dom\n const appRoot = (this.#appRoot = createAppRoot());\n this.#localeWatch = watchValue(\n () => i18n.locale.baseName,\n (locale) => {\n appRoot.lang = locale;\n },\n {\n immediate: true\n }\n );\n this.#container.appendChild(appRoot);\n\n const styles = this.#initStylesSignal();\n\n // Launch the service layer\n const { serviceLayer, packages } = this.#initServiceLayer({\n container: appRoot,\n properties: config.properties,\n i18n,\n initialColorMode: config.colorMode,\n initialSystemConfig: config.chakraSystemConfig\n });\n this.#lifecycleEvents = getInternalService<ApplicationLifecycleEventService>(\n serviceLayer,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE\n );\n const themeService = (this.#themeService = getInternalService<ThemeService>(\n serviceLayer,\n RUNTIME_THEME_SERVICE\n ));\n\n // init api, but do not wait for it\n const apiPromise = this.#initAPI(serviceLayer);\n this.#checkAbort();\n\n // Launch react\n this.#reactIntegration = ReactIntegration.createForApp({\n rootNode: root,\n hostNode: hostElement,\n appRoot: appRoot,\n serviceLayer,\n packages,\n locale: computed(() => i18n.locale.baseName),\n config: computed(() => themeService.systemConfig),\n styles,\n colorMode: computed(() => themeService.colorMode)\n });\n const component = this.#options.elementOptions.component ?? EmptyComponent;\n this.#reactIntegration.render(createElement(component));\n\n // wait for api, to ensure that the \"started\" state is only reached after the API is available.\n // but do not block the react rendering, to allow for a fast Time to Interactive and to show potential errors in the UI even if the API fails.\n await apiPromise;\n this.#checkAbort();\n\n this.#state = \"started\";\n\n this.#triggerApplicationLifecycleEvent(\"after-start\");\n LOG.debug(\"Application started\");\n }\n\n /**\n * Returns a signal that contains the application's styles.\n * During development, the signal is updated when the user edits .css files.\n * In production, the signal is static.\n */\n #initStylesSignal(): ReadonlyReactive<string> {\n const stylesBox = this.#options.elementOptions.appMetadata?.styles;\n if (!stylesBox) {\n return constant(\"\");\n }\n\n const signal = reactive(stylesBox.value);\n if (import.meta.hot) {\n this.#stylesWatch = effect(\n () => {\n signal.value = stylesBox.value;\n LOG.debug(\"Application styles changed\");\n },\n { dispatch: \"sync\" }\n );\n }\n return signal;\n }\n\n #initServiceLayer(config: {\n container: HTMLDivElement;\n properties: ApplicationProperties;\n i18n: AppIntl;\n initialColorMode: ColorModeValue | \"system\" | undefined;\n initialSystemConfig: SystemConfig | undefined;\n }) {\n const { hostElement, rootNode: shadowRoot, elementOptions } = this.#options;\n const { container, properties, i18n, initialColorMode, initialSystemConfig } = config;\n\n const packageMetadata = elementOptions.appMetadata?.packages ?? {};\n const builtinPackage = createBuiltinPackage({\n host: hostElement,\n rootNode: shadowRoot,\n container: container,\n initialColorMode,\n initialSystemConfig,\n appIntl: i18n\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 async #initAPI(serviceLayer: ServiceLayer) {\n const apiService = getInternalService<ApiService>(serviceLayer, RUNTIME_API_SERVICE);\n try {\n const api = await apiService.getApi();\n this.#checkAbort();\n this.#api = api;\n LOG.debug(\"Application API initialized to\", api);\n this.#apiPromise?.resolve(api);\n } catch (e) {\n const ex = new Error(\n ErrorId.INTERNAL,\n \"Failed to gather the application's API methods.\",\n {\n cause: e\n }\n );\n if (!this.#apiPromise) {\n // no one is waiting yet.\n // keep the error for when they do\n this.#apiPromise = createManualPromise();\n // prevent unhandled rejection if no one is waiting for the API\n this.#apiPromise.promise.catch(() => {});\n }\n this.#apiPromise.reject(ex);\n throw ex;\n }\n }\n\n #triggerApplicationLifecycleEvent(event: \"after-start\" | \"before-stop\") {\n this.#lifecycleEvents?.emitLifecycleEvent(event);\n }\n\n #checkAbort() {\n if (this.#state === \"destroyed\") {\n throwAbortError();\n }\n }\n\n #showErrorScreen(error: globalThis.Error) {\n const userLocales = getBrowserLocales();\n const localePicker = new LocalePicker(\n Object.keys(MESSAGES_BY_LOCALE).map((tag) => parseLocale(tag))\n );\n const { locale, messageLocale } = localePicker.pickSupportedLocale(undefined, userLocales);\n const messages =\n MESSAGES_BY_LOCALE[messageLocale.baseName as keyof typeof MESSAGES_BY_LOCALE] ??\n MESSAGES_BY_LOCALE[\"en\"];\n const intl = createPackageIntl(locale.baseName, messages);\n\n const appRoot = (this.#appRoot = createAppRoot());\n appRoot.lang = locale.baseName;\n appRoot.classList.add(\"pioneer-root-error-screen\");\n this.#container.appendChild(appRoot);\n\n const styles = this.#initStylesSignal();\n\n this.#reactIntegration = ReactIntegration.createForErrorScreen({\n rootNode: this.#rootNode,\n hostNode: this.#options.hostElement,\n appRoot: appRoot,\n locale: constant(locale.baseName),\n config: constant(this.#options.elementOptions.chakraSystemConfig),\n styles,\n colorMode: constant(DEFAULT_INITIAL_COLOR_MODE)\n });\n this.#reactIntegration.render(createElement(ErrorScreen, { intl, error }));\n }\n}\n\nfunction createServiceLayer(config: {\n packageMetadata: Record<string, PackageMetadata> | undefined;\n properties: ApplicationProperties;\n builtinPackage: PackageRepr;\n i18n: AppIntl;\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_LOCALE_SERVICE\n },\n {\n interfaceName: RUNTIME_THEME_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"],"names":["themeService"],"mappings":";;;;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AAAA,EAChC;AAGA,EAAA,MAAM,gBAAA,GAAoC;AAAA,IACtC;AAAA,MACI,aAAA,EAAe;AAAA,KACnB;AAAA,IACA;AAAA,MACI,aAAA,EAAe;AAAA,KACnB;AAAA,IACA;AAAA,MACI,aAAA,EAAe;AAAA,KACnB;AAAA,IACA;AAAA,MACI,aAAA,EAAe;AAAA,KACnB;AAAA,IACA;AAAA,MACI,aAAA,EAAe,kBAAA;AAAA,MACf,GAAA,EAAK;AAAA;AACT,GACJ;AACA,EAAA,MAAM,YAAA,GAAe,IAAI,YAAA,CAAa,QAAA,EAAU,gBAAgB,CAAA;AAChE,EAAA,OAAO;AAAA,IACH,QAAA,EAAU,IAAI,GAAA,CAAI,QAAA,CAAS,GAAA,CAAI,CAAC,GAAA,KAAQ,CAAC,GAAA,CAAI,IAAA,EAAM,GAAG,CAAC,CAAC,CAAA;AAAA,IACxD;AAAA,GACJ;AACJ;AAEA,SAAS,kBAAA,CAAgC,cAA4B,aAAA,EAAuB;AACxF,EAAA,MAAM,SAAS,YAAA,CAAa,UAAA;AAAA,IACxB,uBAAA;AAAA,IACA;AAAA,MACI;AAAA,KACJ;AAAA,IACA,EAAE,wBAAwB,IAAA;AAAK,GACnC;AACA,EAAA,IAAI,MAAA,CAAO,SAAS,OAAA,EAAS;AACzB,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,OAAA,CAAQ,QAAA;AAAA,MACR,CAAA,4BAAA,EAA+B,aAAa,CAAA,gBAAA,EAAmB,MAAA,CAAO,IAAI,CAAA,gEAAA;AAAA,KAE9E;AAAA,EACJ;AAEA,EAAA,OAAO,MAAA,CAAO,MAAM,kBAAA,EAAmB;AAC3C;;"}
1
+ {"version":3,"file":"AppInstance.js","sources":["AppInstance.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { SystemConfig } from \"@chakra-ui/react\";\nimport {\n computed,\n constant,\n effect,\n reactive,\n ReadonlyReactive,\n watchValue\n} from \"@conterra/reactivity-core\";\nimport {\n createAbortError,\n createLogger,\n createManualPromise,\n destroyResource,\n Error,\n ManualPromise,\n Resource,\n throwAbortError\n} from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { createElement } from \"react\";\nimport { ApiMethods, ApiService, ColorModeValue, ThemeService } from \"../api\";\nimport {\n createBuiltinPackage,\n RUNTIME_API_SERVICE,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE,\n RUNTIME_AUTO_START,\n RUNTIME_LOCALE_SERVICE,\n RUNTIME_THEME_SERVICE\n} from \"../builtin-services\";\nimport { ApplicationLifecycleEventServiceImpl } from \"../builtin-services/ApplicationLifecycleEventServiceImpl\";\nimport { DEFAULT_INITIAL_COLOR_MODE } from \"../builtin-services/ThemeServiceImpl\";\nimport {\n ApplicationConfig,\n ApplicationOverrides,\n ApplicationProperties,\n CustomElementOptions\n} from \"../CustomElement\";\nimport { createAppRoot, isShadowRoot, RootNode } from \"../dom\";\nimport { ErrorId } from \"../errors\";\nimport { AppIntl, createPackageIntl, getBrowserLocales, LocalePicker, parseLocale } from \"../i18n\";\nimport { PackageMetadata } from \"../metadata\";\nimport { ErrorScreen, MESSAGES_BY_LOCALE } from \"../react-integration/ErrorScreen\";\nimport { EmptyComponent, ReactIntegration } from \"../react-integration/ReactIntegration\";\nimport { ReferenceSpec } from \"../service-layer/InterfaceSpec\";\nimport { createPackages, PackageRepr } from \"../service-layer/PackageRepr\";\nimport { ServiceLayer } from \"../service-layer/ServiceLayer\";\nimport { gatherConfig } from \"./gatherConfig\";\nimport { logError } from \"./logErrors\";\n\nconst LOG = createLogger(sourceId);\n\nexport interface AppOptions {\n /** The root node that contains the application. */\n rootNode: RootNode;\n\n /** The HTML element that embeds the application. */\n hostElement: HTMLElement;\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\nexport type AppState = \"not-started\" | \"starting\" | \"started\" | \"destroyed\" | \"error\";\n\nexport class AppInstance {\n #options: AppOptions;\n\n // Public API\n #apiPromise: ManualPromise<ApiMethods> | undefined; // Present when callers are waiting for the API\n #api: ApiMethods | undefined; // Present once started\n\n #state: AppState = \"not-started\";\n #rootNode: RootNode;\n #container: HTMLElement | ShadowRoot; // parent of .pioneer-root\n #i18n: AppIntl | undefined;\n\n // Unused on purpose for easier debugging.\n // oxlint-disable-next-line no-unused-private-class-members\n #appRoot: HTMLDivElement | undefined; // .pioneer-root\n\n // Unused on purpose for easier debugging.\n // oxlint-disable-next-line no-unused-private-class-members\n #config: ApplicationConfig | undefined;\n\n #serviceLayer: ServiceLayer | undefined;\n #lifecycleEvents: ApplicationLifecycleEventServiceImpl | undefined;\n #themeService: ThemeService | undefined;\n #reactIntegration: ReactIntegration | undefined;\n\n #stylesWatch: Resource | undefined;\n #localeWatch: Resource | undefined;\n\n constructor(options: AppOptions) {\n this.#options = options;\n this.#container = isShadowRoot(options.rootNode) ? options.rootNode : options.hostElement;\n this.#rootNode = options.rootNode;\n }\n\n /** Current lifecycle state. Exposed (read-only) for tests/debugging via `$inspectElementState`. */\n get state(): AppState {\n return this.#state;\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 this.#triggerApplicationLifecycleEvent(\"before-stop\");\n }\n this.#state = \"destroyed\";\n this.#reset();\n }\n\n #reset() {\n this.#apiPromise?.reject(createAbortError());\n this.#reactIntegration = destroyResource(this.#reactIntegration);\n this.#container.replaceChildren();\n this.#appRoot = undefined;\n this.#lifecycleEvents = undefined;\n this.#themeService = undefined;\n this.#i18n = destroyResource(this.#i18n);\n this.#serviceLayer = destroyResource(this.#serviceLayer);\n this.#stylesWatch = destroyResource(this.#stylesWatch);\n this.#localeWatch = destroyResource(this.#localeWatch);\n }\n\n whenAPI(): Promise<ApiMethods> {\n if (this.#api) {\n return Promise.resolve(this.#api);\n }\n if (this.#state === \"destroyed\" || this.#state === \"error\") {\n // The API will never become available. Callers that were already waiting\n // have been rejected with the same error in #reset().\n return Promise.reject(createAbortError());\n }\n\n const apiPromise = (this.#apiPromise ??= createManualPromise());\n return apiPromise.promise;\n }\n\n async #startImpl() {\n const { hostElement, elementOptions, overrides } = this.#options;\n const root = this.#rootNode;\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 // TODO (next major): always true (option can be removed).\n // Currently false by default (needs to be enabled) to preserve backwards compatibility.\n const enableLiveLocaleChanges = elementOptions.advanced?.enableLiveLocaleChanges ?? false;\n\n // TODO (next major): Remove restarting code!\n const restartWithLocale = (locale: Intl.Locale | undefined) => {\n // this code is triggered, when the app calls changeLocale while reactive switching is disabled.\n const restart = this.#options.restart;\n const themeService = this.#themeService;\n const colorMode = themeService?.colorMode;\n const chakraSystemConfig = themeService?.systemConfig;\n restart({ locale: locale?.baseName, colorMode, chakraSystemConfig });\n };\n\n // Decide on locale and load i18n messages (if any).\n const i18n = await AppIntl.create({\n appMetadata: elementOptions.appMetadata,\n forcedLocale: config.locale,\n restrictSupportedLocales: config.supportedLocales,\n supportsLiveChanges: enableLiveLocaleChanges,\n restartWithLocale\n });\n if (this.#state === \"destroyed\") {\n i18n.destroy();\n }\n this.#checkAbort();\n this.#i18n = i18n;\n\n // Setup application root node in the shadow dom\n const appRoot = (this.#appRoot = createAppRoot());\n this.#localeWatch = watchValue(\n () => i18n.locale.baseName,\n (locale) => {\n appRoot.lang = locale;\n },\n {\n immediate: true\n }\n );\n this.#container.appendChild(appRoot);\n\n const styles = this.#initStylesSignal();\n\n // Launch the service layer\n const { serviceLayer, packages } = this.#initServiceLayer({\n container: appRoot,\n properties: config.properties,\n i18n,\n initialColorMode: config.colorMode,\n initialSystemConfig: config.chakraSystemConfig\n });\n this.#lifecycleEvents = getInternalService<ApplicationLifecycleEventServiceImpl>(\n serviceLayer,\n RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE\n );\n const themeService = (this.#themeService = getInternalService<ThemeService>(\n serviceLayer,\n RUNTIME_THEME_SERVICE\n ));\n\n // init api, but do not wait for it\n const apiPromise = this.#initAPI(serviceLayer);\n this.#checkAbort();\n\n // Launch react\n this.#reactIntegration = ReactIntegration.createForApp({\n rootNode: root,\n hostNode: hostElement,\n appRoot: appRoot,\n serviceLayer,\n packages,\n locale: computed(() => i18n.locale.baseName),\n config: computed(() => themeService.systemConfig),\n styles,\n colorMode: computed(() => themeService.colorMode)\n });\n const component = this.#options.elementOptions.component ?? EmptyComponent;\n this.#reactIntegration.render(createElement(component));\n\n // wait for api, to ensure that the \"started\" state is only reached after the API is available.\n // but do not block the react rendering, to allow for a fast Time to Interactive and to show potential errors in the UI even if the API fails.\n await apiPromise;\n this.#checkAbort();\n\n this.#state = \"started\";\n\n this.#triggerApplicationLifecycleEvent(\"after-start\");\n LOG.debug(\"Application started\");\n }\n\n /**\n * Returns a signal that contains the application's styles.\n * During development, the signal is updated when the user edits .css files.\n * In production, the signal is static.\n */\n #initStylesSignal(): ReadonlyReactive<string> {\n const stylesBox = this.#options.elementOptions.appMetadata?.styles;\n if (!stylesBox) {\n return constant(\"\");\n }\n\n const signal = reactive(stylesBox.value);\n if (import.meta.hot) {\n this.#stylesWatch = effect(\n () => {\n signal.value = stylesBox.value;\n LOG.debug(\"Application styles changed\");\n },\n { dispatch: \"sync\" }\n );\n }\n return signal;\n }\n\n #initServiceLayer(config: {\n container: HTMLDivElement;\n properties: ApplicationProperties;\n i18n: AppIntl;\n initialColorMode: ColorModeValue | \"system\" | undefined;\n initialSystemConfig: SystemConfig | undefined;\n }) {\n const { hostElement, rootNode: shadowRoot, elementOptions } = this.#options;\n const { container, properties, i18n, initialColorMode, initialSystemConfig } = config;\n\n const packageMetadata = elementOptions.appMetadata?.packages ?? {};\n const builtinPackage = createBuiltinPackage({\n host: hostElement,\n rootNode: shadowRoot,\n container: container,\n initialColorMode,\n initialSystemConfig,\n appIntl: i18n\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 async #initAPI(serviceLayer: ServiceLayer) {\n const apiService = getInternalService<ApiService>(serviceLayer, RUNTIME_API_SERVICE);\n try {\n const api = await apiService.getApi();\n this.#checkAbort();\n this.#api = api;\n LOG.debug(\"Application API initialized to\", api);\n this.#apiPromise?.resolve(api);\n } catch (e) {\n const ex = new Error(\n ErrorId.INTERNAL,\n \"Failed to gather the application's API methods.\",\n {\n cause: e\n }\n );\n if (!this.#apiPromise) {\n // no one is waiting yet.\n // keep the error for when they do\n this.#apiPromise = createManualPromise();\n // prevent unhandled rejection if no one is waiting for the API\n this.#apiPromise.promise.catch(() => {});\n }\n this.#apiPromise.reject(ex);\n throw ex;\n }\n }\n\n #triggerApplicationLifecycleEvent(event: \"after-start\" | \"before-stop\") {\n this.#lifecycleEvents?.emitLifecycleEvent(event);\n }\n\n #checkAbort() {\n if (this.#state === \"destroyed\") {\n throwAbortError();\n }\n }\n\n #showErrorScreen(error: globalThis.Error) {\n const userLocales = getBrowserLocales();\n const localePicker = new LocalePicker(\n Object.keys(MESSAGES_BY_LOCALE).map((tag) => parseLocale(tag))\n );\n const { locale, messageLocale } = localePicker.pickSupportedLocale(undefined, userLocales);\n const messages =\n MESSAGES_BY_LOCALE[messageLocale.baseName as keyof typeof MESSAGES_BY_LOCALE] ??\n MESSAGES_BY_LOCALE[\"en\"];\n const intl = createPackageIntl(locale.baseName, messages);\n\n const appRoot = (this.#appRoot = createAppRoot());\n appRoot.lang = locale.baseName;\n appRoot.classList.add(\"pioneer-root-error-screen\");\n this.#container.appendChild(appRoot);\n\n const styles = this.#initStylesSignal();\n\n this.#reactIntegration = ReactIntegration.createForErrorScreen({\n rootNode: this.#rootNode,\n hostNode: this.#options.hostElement,\n appRoot: appRoot,\n locale: constant(locale.baseName),\n config: constant(this.#options.elementOptions.chakraSystemConfig),\n styles,\n colorMode: constant(DEFAULT_INITIAL_COLOR_MODE)\n });\n this.#reactIntegration.render(createElement(ErrorScreen, { intl, error }));\n }\n}\n\nfunction createServiceLayer(config: {\n packageMetadata: Record<string, PackageMetadata> | undefined;\n properties: ApplicationProperties;\n builtinPackage: PackageRepr;\n i18n: AppIntl;\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_LOCALE_SERVICE\n },\n {\n interfaceName: RUNTIME_THEME_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"],"names":["themeService"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAwB1B,MAAM,WAAA,CAAY;AAAA,EACrB,QAAA;AAAA;AAAA,EAGA,WAAA;AAAA;AAAA,EACA,IAAA;AAAA;AAAA,EAEA,MAAA,GAAmB,aAAA;AAAA,EACnB,SAAA;AAAA,EACA,UAAA;AAAA;AAAA,EACA,KAAA;AAAA;AAAA;AAAA,EAIA,QAAA;AAAA;AAAA;AAAA;AAAA,EAIA,OAAA;AAAA,EAEA,aAAA;AAAA,EACA,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EAEA,YAAA;AAAA,EACA,YAAA;AAAA,EAEA,YAAY,OAAA,EAAqB;AAC7B,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAChB,IAAA,IAAA,CAAK,aAAa,YAAA,CAAa,OAAA,CAAQ,QAAQ,CAAA,GAAI,OAAA,CAAQ,WAAW,OAAA,CAAQ,WAAA;AAC9E,IAAA,IAAA,CAAK,YAAY,OAAA,CAAQ,QAAA;AAAA,EAC7B;AAAA;AAAA,EAGA,IAAI,KAAA,GAAkB;AAClB,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EAChB;AAAA,EAEA,KAAA,GAAQ;AACJ,IAAA,IAAI,IAAA,CAAK,WAAW,aAAA,EAAe;AAC/B,MAAA,MAAM,IAAI,KAAA,CAAM,OAAA,CAAQ,UAAU,C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ACxB,uBAAA;AAAA,IACA;AAAA,MACI;AAAA,KACJ;AAAA,IACA,EAAE,wBAAwB,IAAA;AAAK,GACnC;AACA,EAAA,IAAI,MAAA,CAAO,SAAS,OAAA,EAAS;AACzB,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,OAAA,CAAQ,QAAA;AAAA,MACR,CAAA,4BAAA,EAA+B,aAAa,CAAA,gBAAA,EAAmB,MAAA,CAAO,IAAI,CAAA,gEAAA;AAAA,KAE9E;AAAA,EACJ;AAEA,EAAA,OAAO,MAAA,CAAO,MAAM,kBAAA,EAAmB;AAC3C;;"}
@@ -1,6 +1,15 @@
1
- import { ApplicationConfig, ApplicationOverrides, CustomElementOptions } from "../CustomElement";
1
+ import { ApplicationConfig, ApplicationOverrides, ApplicationProperties, CustomElementOptions } from "../CustomElement";
2
2
  /**
3
- * Gathers application properties by reading them from the options object
4
- * and by (optionally) invoking the `resolveProperties` hook.
3
+ * Gathers the application config by reading it from the options object
4
+ * and by (optionally) invoking the `resolveConfig` hook.
5
5
  */
6
- export declare function gatherConfig(hostElement: HTMLElement, options: CustomElementOptions, overrides?: ApplicationOverrides): Promise<Required<ApplicationConfig>>;
6
+ export declare function gatherConfig(hostElement: HTMLElement, options: CustomElementOptions, overrides?: ApplicationOverrides): Promise<ResolvedApplicationConfig>;
7
+ /**
8
+ * The application config after merging all sources.
9
+ * Every key is present, but values might be `undefined`.
10
+ */
11
+ export type ResolvedApplicationConfig = {
12
+ [K in keyof Required<ApplicationConfig>]: ApplicationConfig[K] | undefined;
13
+ } & {
14
+ properties: ApplicationProperties;
15
+ };
@@ -22,7 +22,7 @@ async function gatherConfig(hostElement, options, overrides) {
22
22
  } catch (e) {
23
23
  throw new Error(
24
24
  ErrorId.CONFIG_RESOLUTION_FAILED,
25
- "Failed to resolve application properties.",
25
+ "Failed to resolve the application config.",
26
26
  {
27
27
  cause: e
28
28
  }
@@ -43,17 +43,28 @@ async function gatherConfig(hostElement, options, overrides) {
43
43
  return merged;
44
44
  }
45
45
  function mergeConfigs(configs) {
46
- const mergedConfig = Object.assign(
47
- {
48
- locale: void 0,
49
- supportedLocales: void 0,
50
- chakraSystemConfig: void 0,
51
- colorMode: void 0,
52
- properties: {}
53
- },
54
- ...configs
55
- );
56
- const mergedProperties = mergedConfig.properties = {};
46
+ const mergedConfig = {
47
+ locale: void 0,
48
+ supportedLocales: void 0,
49
+ chakraSystemConfig: void 0,
50
+ colorMode: void 0,
51
+ properties: {}
52
+ };
53
+ for (const config of configs) {
54
+ if (config.locale !== void 0) {
55
+ mergedConfig.locale = config.locale;
56
+ }
57
+ if (config.supportedLocales !== void 0) {
58
+ mergedConfig.supportedLocales = config.supportedLocales;
59
+ }
60
+ if (config.chakraSystemConfig !== void 0) {
61
+ mergedConfig.chakraSystemConfig = config.chakraSystemConfig;
62
+ }
63
+ if (config.colorMode !== void 0) {
64
+ mergedConfig.colorMode = config.colorMode;
65
+ }
66
+ }
67
+ const mergedProperties = mergedConfig.properties;
57
68
  for (const config of configs) {
58
69
  for (const [packageName, packageProperties] of Object.entries(config.properties ?? {})) {
59
70
  const mergedPackageProps = mergedProperties[packageName] ??= {};
@@ -1 +1 @@
1
- {"version":3,"file":"gatherConfig.js","sources":["gatherConfig.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Error } from \"@open-pioneer/core\";\nimport {\n ApplicationConfig,\n ApplicationOverrides,\n ApplicationProperties,\n CustomElementOptions\n} from \"../CustomElement\";\nimport { ErrorId } from \"../errors\";\n\n/**\n * Gathers application properties by reading them from the options object\n * and by (optionally) invoking the `resolveProperties` hook.\n */\nexport async function gatherConfig(\n hostElement: HTMLElement,\n options: CustomElementOptions,\n overrides?: ApplicationOverrides\n): Promise<Required<ApplicationConfig>> {\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 overrides\n })) ?? {};\n\n configs = [\n {\n chakraSystemConfig: options.chakraSystemConfig\n },\n staticConfig,\n dynamicConfig\n ];\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) {\n if (overrides.locale) {\n merged.locale = overrides.locale;\n }\n if (overrides.colorMode) {\n merged.colorMode = overrides.colorMode;\n }\n if (overrides.chakraSystemConfig) {\n merged.chakraSystemConfig = overrides.chakraSystemConfig;\n }\n }\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 supportedLocales: undefined,\n chakraSystemConfig: undefined,\n colorMode: 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"],"names":[],"mappings":";;;AAgBA,eAAsB,YAAA,CAClB,WAAA,EACA,OAAA,EACA,SAAA,EACoC;AACpC,EAAA,IAAI,OAAA;AACJ,EAAA,IAAI;AACA,IAAA,MAAM,YAAA,GAAe,OAAA,CAAQ,MAAA,IAAU,EAAC;AACxC,IAAA,MAAM,aAAA,GACD,MAAM,OAAA,CAAQ,aAAA,GAAgB;AAAA,MAC3B,WAAA;AAAA,MACA,aAAa,IAAA,EAAM;AACf,QAAA,OAAO,WAAA,CAAY,YAAA,CAAa,IAAI,CAAA,IAAK,KAAA,CA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UAAA,IAAc,EAAE,CAAA,EAAG;AACpF,MAAA,MAAM,kBAAA,GAAsB,gBAAA,CAAiB,WAAW,CAAA,KAAM,EAAC;AAC/D,MAAA,MAAA,CAAO,MAAA,CAAO,oBAAoB,iBAAiB,CAAA;AAAA,IACvD;AAAA,EACJ;AAEA,EAAA,OAAO,YAAA;AACX;;"}
1
+ {"version":3,"file":"gatherConfig.js","sources":["gatherConfig.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Error } from \"@open-pioneer/core\";\nimport {\n ApplicationConfig,\n ApplicationOverrides,\n ApplicationProperties,\n CustomElementOptions\n} from \"../CustomElement\";\nimport { ErrorId } from \"../errors\";\n\n/**\n * Gathers the application config by reading it from the options object\n * and by (optionally) invoking the `resolveConfig` hook.\n */\nexport async function gatherConfig(\n hostElement: HTMLElement,\n options: CustomElementOptions,\n overrides?: ApplicationOverrides\n): Promise<ResolvedApplicationConfig> {\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 overrides\n })) ?? {};\n\n configs = [\n {\n chakraSystemConfig: options.chakraSystemConfig\n },\n staticConfig,\n dynamicConfig\n ];\n } catch (e) {\n throw new Error(\n ErrorId.CONFIG_RESOLUTION_FAILED,\n \"Failed to resolve the application config.\",\n {\n cause: e\n }\n );\n }\n\n const merged = mergeConfigs(configs);\n if (overrides) {\n if (overrides.locale) {\n merged.locale = overrides.locale;\n }\n if (overrides.colorMode) {\n merged.colorMode = overrides.colorMode;\n }\n if (overrides.chakraSystemConfig) {\n merged.chakraSystemConfig = overrides.chakraSystemConfig;\n }\n }\n\n return merged;\n}\n\n/**\n * The application config after merging all sources.\n * Every key is present, but values might be `undefined`.\n */\nexport type ResolvedApplicationConfig = {\n [K in keyof Required<ApplicationConfig>]: ApplicationConfig[K] | undefined;\n} & {\n properties: ApplicationProperties;\n};\n\n/**\n * Merges application configurations into a single object.\n *\n * Properties / config parameters at a later position overwrite properties from earlier ones. *\n * A key whose value is `undefined` does not override a previous value.\n */\nfunction mergeConfigs(configs: ApplicationConfig[]): ResolvedApplicationConfig {\n const mergedConfig: ResolvedApplicationConfig = {\n locale: undefined,\n supportedLocales: undefined,\n chakraSystemConfig: undefined,\n colorMode: undefined,\n properties: {}\n };\n for (const config of configs) {\n if (config.locale !== undefined) {\n mergedConfig.locale = config.locale;\n }\n if (config.supportedLocales !== undefined) {\n mergedConfig.supportedLocales = config.supportedLocales;\n }\n if (config.chakraSystemConfig !== undefined) {\n mergedConfig.chakraSystemConfig = config.chakraSystemConfig;\n }\n if (config.colorMode !== undefined) {\n mergedConfig.colorMode = config.colorMode;\n }\n }\n\n // Deep merge for application properties\n const mergedProperties = 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"],"names":[],"mappings":";;;AAgBA,eAAsB,YAAA,CAClB,WAAA,EACA,OAAA,EACA,SAAA,EACkC;AAClC,EAAA,IAAI,OAAA;AACJ,EAAA,IAAI;AACA,IAAA,MAAM,YAAA,GAAe,OAAA,CAAQ,MAAA,IAAU,EAAC;AACxC,IAAA,MAAM,aAAA,GACD,MAAM,OAAA,CAAQ,aAAA,GAAgB;AAAA,MAC3B,WAAA;AAAA,MACA,aAAa,IAAA,EAAM;AACf,QAAA,OAAO,WAAA,CAAY,YAAA,CAAa,IAAI,CAAA,IAAK,KAAA,CAAA;AAAA,MAC7C,CAAA;AAAA,MACA;AAAA,KACH,KAAM,EAAC;AAEZ,IAAA,OAAA,GAAU;AAAA,MACN;AAAA,QACI,oBAAoB,OAAA,CAAQ;AAAA,OAChC;AAAA,MACA,YAAA;AAAA,MACA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c,MAAA,EAAW;AAChC,MAAA,YAAA,CAAa,YAAY,MAAA,CAAO,SAAA;AAAA,IACpC;AAAA,EACJ;AAGA,EAAA,MAAM,mBAAmB,YAAA,CAAa,UAAA;AACtC,EAAA,KAAA,MAAW,UAAU,OAAA,EAAS;AAC1B,IAAA,KAAA,MAAW,CAAC,WAAA,EAAa,iBAAiB,CAAA,IAAK,MAAA,CAAO,QAAQ,MAAA,CAAO,UAAA,IAAc,EAAE,CAAA,EAAG;AACpF,MAAA,MAAM,kBAAA,GAAsB,gBAAA,CAAiB,WAAW,CAAA,KAAM,EAAC;AAC/D,MAAA,MAAA,CAAO,MAAA,CAAO,oBAAoB,iBAAiB,CAAA;AAAA,IACvD;AAAA,EACJ;AAEA,EAAA,OAAO,YAAA;AACX;;"}
package/app/logErrors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createLogger, getErrorChain } from '@open-pioneer/core';
2
- import { sourceId$5 as sourceId } from '../_virtual/source-info.js';
2
+ import { sourceId$6 as sourceId } from '../_virtual/source-info.js';
3
3
 
4
4
  const LOG = createLogger(sourceId);
5
5
  function logError(e) {