@open-pioneer/runtime 4.7.0-dev.20260713101438 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +3 -2
  2. package/CustomElement.js +1 -1
  3. package/CustomElement.js.map +1 -1
  4. package/DeclaredService.d.ts +1 -1
  5. package/DeclaredService.js.map +1 -1
  6. package/Service.js.map +1 -1
  7. package/app/AppInstance.js +2 -2
  8. package/app/AppInstance.js.map +1 -1
  9. package/app/gatherConfig.js.map +1 -1
  10. package/app/logErrors.js.map +1 -1
  11. package/builtin-services/ApiServiceImpl.d.ts +1 -1
  12. package/builtin-services/ApiServiceImpl.js.map +1 -1
  13. package/builtin-services/ApplicationContextImpl.js.map +1 -1
  14. package/builtin-services/ApplicationLifecycleEventService.d.ts +1 -1
  15. package/builtin-services/ApplicationLifecycleEventService.js +1 -1
  16. package/builtin-services/ApplicationLifecycleEventService.js.map +1 -1
  17. package/builtin-services/LocaleServiceImpl.js.map +1 -1
  18. package/builtin-services/NumberParserServiceImpl.js.map +1 -1
  19. package/builtin-services/ThemeServiceImpl.js.map +1 -1
  20. package/builtin-services/index.js.map +1 -1
  21. package/errors.js.map +1 -1
  22. package/i18n/AppIntl.js.map +1 -1
  23. package/i18n/PackageIntl.js.map +1 -1
  24. package/i18n/pick.js.map +1 -1
  25. package/metadata/ObservableBox.js.map +1 -1
  26. package/package.json +9 -9
  27. package/react-integration/ChakraProvider.d.ts +1 -1
  28. package/react-integration/ChakraProvider.js.map +1 -1
  29. package/react-integration/ErrorScreen.js.map +1 -1
  30. package/react-integration/PackageContext.js.map +1 -1
  31. package/react-integration/ReactIntegration.d.ts +1 -1
  32. package/react-integration/ReactIntegration.js.map +1 -1
  33. package/react-integration/hooks.js +1 -1
  34. package/react-integration/hooks.js.map +1 -1
  35. package/service-layer/InterfaceSpec.js.map +1 -1
  36. package/service-layer/PackageRepr.js.map +1 -1
  37. package/service-layer/ServiceLayer.js.map +1 -1
  38. package/service-layer/ServiceLookup.js.map +1 -1
  39. package/service-layer/ServiceRepr.js.map +1 -1
  40. package/service-layer/verifyDependencies.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @open-pioneer/runtime
2
2
 
3
- ## 4.7.0-dev.20260713101438
3
+ ## 4.7.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - 278515d: Deprecate the following methods on the `ApplicationContext`: `getLocale`, `setLocale`, `getSupportedLocales()`.
8
8
  Use the alternatives provided by the new `LocaleService` instead.
9
- - e433296: Update Chakra UI to 3.36.0
9
+ - e433296: Update Chakra UI to 3.36.1
10
10
  - 278515d: Add `runtime.LocaleService` and opt-in reactive locale switching.
11
11
 
12
12
  You can opt-in by configuring the property `advanced.enableLiveLocaleChanges` when calling `createCustomElement`.
@@ -19,6 +19,7 @@
19
19
  ### Patch Changes
20
20
 
21
21
  - 8c277a2: Include service id in deprecation message of 'serviceOptions.intl'.
22
+ - 9d84f1e: Migrated from eslint to oxlint and from prettier to oxfmt.
22
23
  - 78aad9d: Refactor: use private javascript properties instead of typescript private keyword.
23
24
  - 7c7e6d1: Refactor equality comparisons using shallow equals from @open-pioneer/core.
24
25
  - 8b5c324: Fix 'useIntl' not transporting reactive changes of the intl object in production (e.g. when the locale changes).
package/CustomElement.js CHANGED
@@ -8,7 +8,7 @@ function createCustomElement(options) {
8
8
  class PioneerApplication extends HTMLElement {
9
9
  #shadowRoot;
10
10
  #instance;
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ // oxlint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  #deferredRestart;
13
13
  // A Timer
14
14
  static get observedAttributes() {
@@ -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\nimport { SystemConfig as ChakraSystemConfig } from \"@chakra-ui/react\";\nimport { createLogger, Error } from \"@open-pioneer/core\";\nimport type { ServiceOptions } from \"./Service\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ComponentType } from \"react\";\nimport { type ApiMethods, type ColorModeValue, type ApiExtension } from \"./api\";\nimport { AppInstance } from \"./app\";\nimport { ErrorId } from \"./errors\";\nimport { ApplicationMetadata } from \"./metadata\";\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 // 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 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 // 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 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":";;;;;AAYA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAoO1B,SAAS,oBAAoB,OAAA,EAA8D;AAAA,EAC9F,MAAM,2BAA2B,WAAA,CAA0C;AAAA,IACvE,WAAA;AAAA,IACA,SAAA;AAAA;AAAA,IAGA,gBAAA;AAAA;AAAA,IAEA,WAAW,kBAAA,GAA+B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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;;;;"}
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":";;;;;AAeA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAoO1B,SAAS,oBAAoB,OAAA,EAA8D;AAAA,EAC9F,MAAM,2BAA2B,WAAA,CAA0C;AAAA,IACvE,WAAA;AAAA,IACA,SAAA;AAAA;AAAA,IAGA,gBAAA;AAAA;AAAA,IAEA,WAAW,kBAAA,GAA+B;AACtC,MAAA,OAAO,EAAC;AAAA,I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R;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;;;;"}
@@ -63,7 +63,7 @@ export { DECLARE_SERVICE_INTERFACE };
63
63
  * this type will produce the interface name associated with the service type.
64
64
  */
65
65
  export type AssociatedInterfaceName<T> = T extends DeclaredService<infer InterfaceName> ? InterfaceName : T extends {
66
- [DECLARE_SERVICE_INTERFACE]: string & infer InterfaceName;
66
+ [DECLARE_SERVICE_INTERFACE]: string & (infer InterfaceName);
67
67
  } ? InterfaceName : never;
68
68
  /**
69
69
  * This helper type produces the expected `interfaceName` (a string parameter) for the given service type.
@@ -1 +1 @@
1
- {"version":3,"file":"DeclaredService.js","sources":["DeclaredService.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\ndeclare const INTERNAL_ASSOCIATED_SERVICE_METADATA: unique symbol;\ndeclare const ERROR: unique symbol;\n\n/**\n * Base interface for services that are associated with a well known interface name.\n *\n * By using this base interface, you can ensure that users of your interface use the correct interface name.\n *\n * Note that this interface is a type level marker only.\n * It has no real associated methods or properties and it is not necessary to implement anything\n * to use this interface in a class.\n *\n * @example\n * ```ts\n * // MyLogger should be referenced via \"my-package.Logger\"\n * export interface MyLogger extends DeclaredService<\"my-package.Logger\"> {\n * log(message: string): void;\n * }\n * ```\n *\n * > Note: TypeScript may list the `INTERNAL_ASSOCIATED_SERVICE_METADATA` property\n * > when generating the implementation for an interface extending this type.\n * > You can simply remove the offending line; it is not required (and not possible)\n * > to implement that attribute - it only exists for the compiler.\n */\nexport interface DeclaredService<InterfaceName extends string> {\n /**\n * Internal type-level service metadata.\n *\n * Note: there is no need to implement this symbol attribute.\n * It is optional and only exists for the compiler, never at runtime.\n *\n * @internal\n */\n [INTERNAL_ASSOCIATED_SERVICE_METADATA]?: ServiceMetadata<InterfaceName>;\n}\n\n/**\n * Helper symbol to declare a service's interface name when not using a separate interface.\n *\n * > NOTE: This symbol does not exist at runtime. Declaring a service interface is compile time only!\n * > It should therefore be imported via `import type` (see example below).\n *\n * @example\n *\n * ```ts\n * import { type DECLARE_SERVICE_INTERFACE} from \"@open-pioneer/runtime\";\n *\n * class MyServiceImpl {\n * // Add this line to your class.\n * // It declares (at compile time) that the service class must be used via the given interface name.\n * // Note that the property is not really present at runtime.\n * declare [DECLARE_SERVICE_INTERFACE]: \"my-package.MyInterface\";\n *\n * method(): void {\n * throw new Error(\"Method not implemented.\");\n * }\n * }\n * ```\n */\nconst DECLARE_SERVICE_INTERFACE = Symbol(\"runtime.DECLARE_SERVICE_INTERFACE\");\nexport { DECLARE_SERVICE_INTERFACE };\n\n/**\n * Given a type implementing {@link DeclaredService} or using {@link DECLARE_SERVICE_INTERFACE},\n * this type will produce the interface name associated with the service type.\n */\nexport type AssociatedInterfaceName<T> =\n T extends DeclaredService<infer InterfaceName>\n ? InterfaceName\n : T extends { [DECLARE_SERVICE_INTERFACE]: string & infer InterfaceName }\n ? InterfaceName\n : never;\n\n/**\n * This helper type produces the expected `interfaceName` (a string parameter) for the given service type.\n *\n * 1. If `ServiceType` is `unknown`, it will produce `string` to allow arbitrary parameters.\n * 2. If `ServiceType` implements {@link DeclaredService}, it will enforce the associated interface name.\n * 3. Otherwise, a compile time error is generated.\n */\nexport type InterfaceNameForServiceType<ServiceType> =\n IsUnknown<ServiceType> extends true\n ? string\n : AssociatedInterfaceName<ServiceType> extends never\n ? {\n [ERROR]: \"TypeScript integration was not set up properly for this service. Make sure the service's TypeScript interface extends 'DeclaredService'.\";\n }\n : AssociatedInterfaceName<ServiceType>;\n\n/**\n * @internal\n */\ninterface ServiceMetadata<InterfaceName> {\n interfaceName: InterfaceName;\n}\n\ntype IsUnknown<T> = unknown extends T ? ([T] extends [null] ? false : true) : false;\n"],"names":[],"mappings":"AA8DA,MAAM,yBAAA,0BAAmC,mCAAmC;;;;"}
1
+ {"version":3,"file":"DeclaredService.js","sources":["DeclaredService.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\ndeclare const INTERNAL_ASSOCIATED_SERVICE_METADATA: unique symbol;\ndeclare const ERROR: unique symbol;\n\n/**\n * Base interface for services that are associated with a well known interface name.\n *\n * By using this base interface, you can ensure that users of your interface use the correct interface name.\n *\n * Note that this interface is a type level marker only.\n * It has no real associated methods or properties and it is not necessary to implement anything\n * to use this interface in a class.\n *\n * @example\n * ```ts\n * // MyLogger should be referenced via \"my-package.Logger\"\n * export interface MyLogger extends DeclaredService<\"my-package.Logger\"> {\n * log(message: string): void;\n * }\n * ```\n *\n * > Note: TypeScript may list the `INTERNAL_ASSOCIATED_SERVICE_METADATA` property\n * > when generating the implementation for an interface extending this type.\n * > You can simply remove the offending line; it is not required (and not possible)\n * > to implement that attribute - it only exists for the compiler.\n */\nexport interface DeclaredService<InterfaceName extends string> {\n /**\n * Internal type-level service metadata.\n *\n * Note: there is no need to implement this symbol attribute.\n * It is optional and only exists for the compiler, never at runtime.\n *\n * @internal\n */\n [INTERNAL_ASSOCIATED_SERVICE_METADATA]?: ServiceMetadata<InterfaceName>;\n}\n\n/**\n * Helper symbol to declare a service's interface name when not using a separate interface.\n *\n * > NOTE: This symbol does not exist at runtime. Declaring a service interface is compile time only!\n * > It should therefore be imported via `import type` (see example below).\n *\n * @example\n *\n * ```ts\n * import { type DECLARE_SERVICE_INTERFACE} from \"@open-pioneer/runtime\";\n *\n * class MyServiceImpl {\n * // Add this line to your class.\n * // It declares (at compile time) that the service class must be used via the given interface name.\n * // Note that the property is not really present at runtime.\n * declare [DECLARE_SERVICE_INTERFACE]: \"my-package.MyInterface\";\n *\n * method(): void {\n * throw new Error(\"Method not implemented.\");\n * }\n * }\n * ```\n */\nconst DECLARE_SERVICE_INTERFACE = Symbol(\"runtime.DECLARE_SERVICE_INTERFACE\");\nexport { DECLARE_SERVICE_INTERFACE };\n\n/**\n * Given a type implementing {@link DeclaredService} or using {@link DECLARE_SERVICE_INTERFACE},\n * this type will produce the interface name associated with the service type.\n */\nexport type AssociatedInterfaceName<T> =\n T extends DeclaredService<infer InterfaceName>\n ? InterfaceName\n : T extends { [DECLARE_SERVICE_INTERFACE]: string & (infer InterfaceName) }\n ? InterfaceName\n : never;\n\n/**\n * This helper type produces the expected `interfaceName` (a string parameter) for the given service type.\n *\n * 1. If `ServiceType` is `unknown`, it will produce `string` to allow arbitrary parameters.\n * 2. If `ServiceType` implements {@link DeclaredService}, it will enforce the associated interface name.\n * 3. Otherwise, a compile time error is generated.\n */\nexport type InterfaceNameForServiceType<ServiceType> =\n IsUnknown<ServiceType> extends true\n ? string\n : AssociatedInterfaceName<ServiceType> extends never\n ? {\n [ERROR]: \"TypeScript integration was not set up properly for this service. Make sure the service's TypeScript interface extends 'DeclaredService'.\";\n }\n : AssociatedInterfaceName<ServiceType>;\n\n/**\n * @internal\n */\ninterface ServiceMetadata<InterfaceName> {\n interfaceName: InterfaceName;\n}\n\ntype IsUnknown<T> = unknown extends T ? ([T] extends [null] ? false : true) : false;\n"],"names":[],"mappings":"AA+DA,MAAM,yBAAA,0BAAmC,mCAAmC;;;;"}
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\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 // eslint-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":"AAgIA,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 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;;;;"}
@@ -31,11 +31,11 @@ class AppInstance {
31
31
  // parent of .pioneer-root
32
32
  #i18n;
33
33
  // Unused on purpose for easier debugging.
34
- // eslint-disable-next-line no-unused-private-class-members
34
+ // oxlint-disable-next-line no-unused-private-class-members
35
35
  #appRoot;
36
36
  // .pioneer-root
37
37
  // Unused on purpose for easier debugging.
38
- // eslint-disable-next-line no-unused-private-class-members
38
+ // oxlint-disable-next-line no-unused-private-class-members
39
39
  #config;
40
40
  #serviceLayer;
41
41
  #lifecycleEvents;
@@ -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\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\";\n\nimport { SystemConfig } from \"@chakra-ui/react\";\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 // eslint-disable-next-line no-unused-private-class-members\n #appRoot: HTMLDivElement | undefined; // .pioneer-root\n\n // Unused on purpose for easier debugging.\n // eslint-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":";;;;;;;;;;;;;;;;;;;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,MA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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 { 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":";;;;;;;;;;;;;;;;;;;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,C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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 +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\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":";;;AAeA,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,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;AAAA,KACJ;AAAA,EACJ,SAAS,CAAA,EA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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 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,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;AAAA,KACJ;AAAA,EACJ,SAAS,CAAA,EAAG;AACR,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,OAAA,CAAQ,wBAAA;AAAA,MACR,2CAAA;AAAA,MACA;AAAA,QACI,KAAA,EAAO;AAAA;AACX,KACJ;AAAA,EACJ;AAEA,EAAA,MAAM,MAAA,GAAS,aAAa,OAAO,CAAA;AACnC,EAAA,IAAI,SAAA,EAAW;AACX,IAAA,IAAI,UAAU,MAAA,EAAQ;AAClB,MAAA,MAAA,CAAO,SAAS,SAAA,CAAU,MAAA;AAAA,IAC9B;AACA,IAAA,IAAI,UAAU,SAAA,EAAW;AACrB,MAAA,MAAA,CAAO,YAAY,SAAA,CAAU,SAAA;AAAA,IACjC;AACA,IAAA,IAAI,UAAU,kBAAA,EAAoB;AAC9B,MAAA,MAAA,CAAO,qBAAqB,SAAA,CAAU,kBAAA;AAAA,IAC1C;AAAA,EACJ;AAEA,EAAA,OAAO,MAAA;AACX;AAMA,SAAS,aAAa,OAAA,EAA2D;AAE7E,EAAA,MAAM,eAA4C,MAAA,CAAO,MAAA;AAAA,IACrD;AAAA,MACI,MAAA,EAAQ,MAAA;AAAA,MACR,gBAAA,EAAkB,MAAA;AAAA,MAClB,kBAAA,EAAoB,MAAA;AAAA,MACpB,SAAA,EAAW,MAAA;AAAA,MACX,YAAY;AAAC,KACjB;AAAA,IACA,GAAG;AAAA,GACP;AAGA,EAAA,MAAM,gBAAA,GAA2C,YAAA,CAAa,UAAA,GAAa,EAAC;AAC5E,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;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"logErrors.js","sources":["logErrors.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { getErrorChain } from \"@open-pioneer/core\";\n\nexport function 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"],"names":[],"mappings":";;AAIO,SAAS,SAAS,CAAA,EAAY;AACjC,EAAA,IAAI,aAAa,KAAA,EAAO;AACpB,IAAA,MAAM,KAAA,GAAQ,aAAA,CAAc,CAAC,CAAA,CAAE,OAAA,EAAQ;AACvC,IAAA,IAAI,KAAA,CAAM,WAAW,CAAA,EAAG;AACpB,MAAA,OAAA,CAAQ,MAAM,CAAC,CAAA;AACf,MAAA;AAAA,IACJ;AAEA,IAAA,IAAI,CAAA,GAAI,CAAA;AACR,IAAA,KAAA,MAAW,SAAS,KAAA,EAAO;AACvB,MAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,EAAI,KAAK,CAAA;AAC5B,MAAA,EAAE,CAAA;AAAA,IACN;AAAA,EACJ,CAAA,MAAO;AACH,IAAA,OAAA,CAAQ,KAAA,CAAM,oBAAoB,CAAC,CAAA;AAAA,EACvC;AACJ;;;;"}
1
+ {"version":3,"file":"logErrors.js","sources":["logErrors.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getErrorChain } from \"@open-pioneer/core\";\n\nexport function 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"],"names":[],"mappings":";;AAKO,SAAS,SAAS,CAAA,EAAY;AACjC,EAAA,IAAI,aAAa,KAAA,EAAO;AACpB,IAAA,MAAM,KAAA,GAAQ,aAAA,CAAc,CAAC,CAAA,CAAE,OAAA,EAAQ;AACvC,IAAA,IAAI,KAAA,CAAM,WAAW,CAAA,EAAG;AACpB,MAAA,OAAA,CAAQ,MAAM,CAAC,CAAA;AACf,MAAA;AAAA,IACJ;AAEA,IAAA,IAAI,CAAA,GAAI,CAAA;AACR,IAAA,KAAA,MAAW,SAAS,KAAA,EAAO;AACvB,MAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,EAAI,KAAK,CAAA;AAC5B,MAAA,EAAE,CAAA;AAAA,IACN;AAAA,EACJ,CAAA,MAAO;AACH,IAAA,OAAA,CAAQ,KAAA,CAAM,oBAAoB,CAAC,CAAA;AAAA,EACvC;AACJ;;;;"}
@@ -1,5 +1,5 @@
1
- import { ServiceOptions } from "../Service";
2
1
  import { ApiExtension, ApiMethod, ApiService } from "../api";
2
+ import { ServiceOptions } from "../Service";
3
3
  interface References {
4
4
  providers: ApiExtension[];
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ApiServiceImpl.js","sources":["ApiServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ServiceOptions } from \"../Service\";\nimport { ApiExtension, ApiMethod, ApiMethods, ApiService } from \"../api\";\nimport { Error } from \"@open-pioneer/core\";\nimport { ErrorId } from \"../errors\";\n\ninterface References {\n providers: ApiExtension[];\n}\n\nexport class ApiServiceImpl implements ApiService {\n readonly #providers: [serviceId: string, provider: ApiExtension][];\n\n constructor(options: ServiceOptions<References>) {\n const providers = options.references.providers;\n const meta = options.referencesMeta.providers;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.#providers = providers.map((provider, index) => [meta[index]!.serviceId, provider]);\n }\n\n async getApi() {\n interface ProviderResult {\n serviceId: string;\n methods: ApiMethods;\n }\n\n const promises = this.#providers.map(async ([serviceId, provider]) => {\n const methods = await provider.getApiMethods();\n const result: ProviderResult = {\n serviceId,\n methods\n };\n return result;\n });\n const providerMethods = await Promise.all(promises);\n\n interface MethodEntry {\n method: ApiMethod;\n serviceId: string;\n }\n\n const methodEntries = new Map<string, MethodEntry>();\n for (const { serviceId, methods } of providerMethods) {\n for (const [methodName, method] of Object.entries(methods)) {\n const existingEntry = methodEntries.get(methodName);\n if (existingEntry) {\n throw new Error(\n ErrorId.DUPLICATE_API_METHODS,\n `Cannot define API method '${methodName}' from '${serviceId}' (method is also defined by '${existingEntry.serviceId}').`\n );\n }\n\n methodEntries.set(methodName, {\n serviceId,\n method\n });\n }\n }\n\n const api: Record<string, ApiMethod> = {};\n for (const [methodName, entry] of methodEntries.entries()) {\n api[methodName] = entry.method;\n }\n return api;\n }\n}\n"],"names":[],"mappings":";;;AAWO,MAAM,cAAA,CAAqC;AAAA,EACrC,UAAA;AAAA,EAET,YAAY,OAAA,EAAqC;AAC7C,IAAA,MAAM,SAAA,GAAY,QAAQ,UAAA,CAAW,SAAA;AACrC,IAAA,MAAM,IAAA,GAAO,QAAQ,cAAA,CAAe,SAAA;AAEpC,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA,CAAU,GAAA,CAAI,CAAC,QAAA,EAAU,KAAA,KAAU,CAAC,IAAA,CAAK,KAAK,CAAA,CAAG,SAAA,EAAW,QAAQ,CAAC,CAAA;AAAA,EAC3F;AAAA,EAEA,MAAM,MAAA,GAAS;AAMX,IAAA,MAAM,QAAA,GAAW,KAAK,UAAA,CAAW,GAAA,CAAI,OAAO,CAAC,SAAA,EAAW,QAAQ,CAAA,KAAM;AAClE,MAAA,MAAM,OAAA,GAAU,MAAM,QAAA,CAAS,aAAA,EAAc;AAC7C,MAAA,MAAM,MAAA,GAAyB;AAAA,QAC3B,SAAA;AAAA,QACA;AAAA,OACJ;AACA,MAAA,OAAO,MAAA;AAAA,IACX,CAAC,CAAA;AACD,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAA,CAAQ,GAAA,CAAI,QAAQ,CAAA;AAOlD,IAAA,MAAM,aAAA,uBAAoB,GAAA,EAAyB;AACnD,IAAA,KAAA,MAAW,EAAE,SAAA,EAAW,OAAA,EAAQ,IAAK,eAAA,EAAiB;AAClD,MAAA,KAAA,MAAW,CAAC,UAAA,EAAY,MAAM,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAA,EAAG;AACxD,QAAA,MAAM,aAAA,GAAgB,aAAA,CAAc,GAAA,CAAI,UAAU,CAAA;AAClD,QAAA,IAAI,aAAA,EAAe;AACf,UAAA,MAAM,IAAI,KAAA;AAAA,YACN,OAAA,CAAQ,qBAAA;AAAA,YACR,6BAA6B,UAAU,CAAA,QAAA,EAAW,SAAS,CAAA,8BAAA,EAAiC,cAAc,SAAS,CAAA,GAAA;AAAA,WACvH;AAAA,QACJ;AAEA,QAAA,aAAA,CAAc,IAAI,UAAA,EAAY;AAAA,UAC1B,SAAA;AAAA,UACA;AAAA,SACH,CAAA;AAAA,MACL;AAAA,IACJ;AAEA,IAAA,MAAM,MAAiC,EAAC;AACxC,IAAA,KAAA,MAAW,CAAC,UAAA,EAAY,KAAK,CAAA,IAAK,aAAA,CAAc,SAAQ,EAAG;AACvD,MAAA,GAAA,CAAI,UAAU,IAAI,KAAA,CAAM,MAAA;AAAA,IAC5B;AACA,IAAA,OAAO,GAAA;AAAA,EACX;AACJ;;;;"}
1
+ {"version":3,"file":"ApiServiceImpl.js","sources":["ApiServiceImpl.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 { ApiExtension, ApiMethod, ApiMethods, ApiService } from \"../api\";\nimport { ErrorId } from \"../errors\";\nimport { ServiceOptions } from \"../Service\";\n\ninterface References {\n providers: ApiExtension[];\n}\n\nexport class ApiServiceImpl implements ApiService {\n readonly #providers: [serviceId: string, provider: ApiExtension][];\n\n constructor(options: ServiceOptions<References>) {\n const providers = options.references.providers;\n const meta = options.referencesMeta.providers;\n // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.#providers = providers.map((provider, index) => [meta[index]!.serviceId, provider]);\n }\n\n async getApi() {\n interface ProviderResult {\n serviceId: string;\n methods: ApiMethods;\n }\n\n const promises = this.#providers.map(async ([serviceId, provider]) => {\n const methods = await provider.getApiMethods();\n const result: ProviderResult = {\n serviceId,\n methods\n };\n return result;\n });\n const providerMethods = await Promise.all(promises);\n\n interface MethodEntry {\n method: ApiMethod;\n serviceId: string;\n }\n\n const methodEntries = new Map<string, MethodEntry>();\n for (const { serviceId, methods } of providerMethods) {\n for (const [methodName, method] of Object.entries(methods)) {\n const existingEntry = methodEntries.get(methodName);\n if (existingEntry) {\n throw new Error(\n ErrorId.DUPLICATE_API_METHODS,\n `Cannot define API method '${methodName}' from '${serviceId}' (method is also defined by '${existingEntry.serviceId}').`\n );\n }\n\n methodEntries.set(methodName, {\n serviceId,\n method\n });\n }\n }\n\n const api: Record<string, ApiMethod> = {};\n for (const [methodName, entry] of methodEntries.entries()) {\n api[methodName] = entry.method;\n }\n return api;\n }\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,cAAA,CAAqC;AAAA,EACrC,UAAA;AAAA,EAET,YAAY,OAAA,EAAqC;AAC7C,IAAA,MAAM,SAAA,GAAY,QAAQ,UAAA,CAAW,SAAA;AACrC,IAAA,MAAM,IAAA,GAAO,QAAQ,cAAA,CAAe,SAAA;AAEpC,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA,CAAU,GAAA,CAAI,CAAC,QAAA,EAAU,KAAA,KAAU,CAAC,IAAA,CAAK,KAAK,CAAA,CAAG,SAAA,EAAW,QAAQ,CAAC,CAAA;AAAA,EAC3F;AAAA,EAEA,MAAM,MAAA,GAAS;AAMX,IAAA,MAAM,QAAA,GAAW,KAAK,UAAA,CAAW,GAAA,CAAI,OAAO,CAAC,SAAA,EAAW,QAAQ,CAAA,KAAM;AAClE,MAAA,MAAM,OAAA,GAAU,MAAM,QAAA,CAAS,aAAA,EAAc;AAC7C,MAAA,MAAM,MAAA,GAAyB;AAAA,QAC3B,SAAA;AAAA,QACA;AAAA,OACJ;AACA,MAAA,OAAO,MAAA;AAAA,IACX,CAAC,CAAA;AACD,IAAA,MAAM,eAAA,GAAkB,MAAM,OAAA,CAAQ,GAAA,CAAI,QAAQ,CAAA;AAOlD,IAAA,MAAM,aAAA,uBAAoB,GAAA,EAAyB;AACnD,IAAA,KAAA,MAAW,EAAE,SAAA,EAAW,OAAA,EAAQ,IAAK,eAAA,EAAiB;AAClD,MAAA,KAAA,MAAW,CAAC,UAAA,EAAY,MAAM,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAA,EAAG;AACxD,QAAA,MAAM,aAAA,GAAgB,aAAA,CAAc,GAAA,CAAI,UAAU,CAAA;AAClD,QAAA,IAAI,aAAA,EAAe;AACf,UAAA,MAAM,IAAI,KAAA;AAAA,YACN,OAAA,CAAQ,qBAAA;AAAA,YACR,6BAA6B,UAAU,CAAA,QAAA,EAAW,SAAS,CAAA,8BAAA,EAAiC,cAAc,SAAS,CAAA,GAAA;AAAA,WACvH;AAAA,QACJ;AAEA,QAAA,aAAA,CAAc,IAAI,UAAA,EAAY;AAAA,UAC1B,SAAA;AAAA,UACA;AAAA,SACH,CAAA;AAAA,MACL;AAAA,IACJ;AAEA,IAAA,MAAM,MAAiC,EAAC;AACxC,IAAA,KAAA,MAAW,CAAC,UAAA,EAAY,KAAK,CAAA,IAAK,aAAA,CAAc,SAAQ,EAAG;AACvD,MAAA,GAAA,CAAI,UAAU,IAAI,KAAA,CAAM,MAAA;AAAA,IAC5B;AACA,IAAA,OAAO,GAAA;AAAA,EACX;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationContextImpl.js","sources":["ApplicationContextImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger, Error, deprecated, isAbortError } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ApplicationContext, LocaleService } from \"../api\";\nimport { isShadowRoot, RootNode } from \"../dom\";\nimport { ErrorId } from \"../errors\";\nimport { tryParseLocale } from \"../i18n\";\nimport { ServiceOptions } from \"../Service\";\n\nconst LOG = createLogger(sourceId);\n\nexport interface ApplicationContextProperties {\n host: HTMLElement;\n rootNode: RootNode;\n container: HTMLElement;\n}\n\ninterface ServiceReferences {\n localeService: LocaleService;\n}\n\nexport type ApplicationContextServiceOptions = ServiceOptions<ServiceReferences>;\n\nconst setLocaleDeprecationMessage = deprecated({\n name: \"ApplicationContext.setLocale\",\n packageName: \"@open-pioneer/runtime\",\n since: \"v4.7.0\",\n alternative: \"Use `runtime.LocaleService.changeLocale` instead.\"\n});\nconst getLocaleDeprecationMessage = deprecated({\n name: \"ApplicationContext.getLocale\",\n packageName: \"@open-pioneer/runtime\",\n since: \"v4.7.0\",\n alternative: \"Use `runtime.LocaleService.locale` instead.\"\n});\nconst getSupportedLocalesDeprecationMessage = deprecated({\n name: \"ApplicationContext.getSupportedLocales\",\n packageName: \"@open-pioneer/runtime\",\n since: \"v4.7.0\",\n alternative: \"Use `runtime.LocaleService.supportedMessageLocales` instead.\"\n});\n\nexport class ApplicationContextImpl implements ApplicationContext {\n #host: HTMLElement;\n #rootNode: RootNode;\n #container: HTMLElement;\n #localeService: LocaleService;\n\n constructor(\n options: ApplicationContextServiceOptions,\n properties: ApplicationContextProperties\n ) {\n this.#host = properties.host;\n this.#rootNode = properties.rootNode;\n this.#container = properties.container;\n this.#localeService = options.references.localeService;\n }\n\n getHostElement(): HTMLElement {\n return this.#host;\n }\n\n getRoot(): RootNode {\n return this.#rootNode;\n }\n\n getShadowRoot(): ShadowRoot | undefined {\n return isShadowRoot(this.#rootNode) ? this.#rootNode : undefined;\n }\n\n getApplicationContainer(): HTMLElement {\n return this.#container;\n }\n\n /** @deprecated Use `runtime.LocaleService` instead. */\n getLocale(): string {\n getLocaleDeprecationMessage();\n return this.#localeService.locale.baseName;\n }\n\n /** @deprecated Use `runtime.LocaleService` instead. */\n setLocale(locale: string | undefined): void {\n setLocaleDeprecationMessage();\n const targetLocale = tryParseLocale(locale);\n // to be backwards compatible, we check here synchronously\n // same check is done in AppIntl.changeLocale\n if (targetLocale && !this.#localeService.supportsLocale(targetLocale)) {\n const localesList = this.#localeService.supportedMessageLocales\n .map((l) => l.baseName)\n .join(\", \");\n throw new Error(\n ErrorId.UNSUPPORTED_LOCALE,\n `Unsupported locale '${targetLocale.baseName}' (supported locales: ${localesList}).`\n );\n }\n this.#localeService.changeLocale(targetLocale).catch((e) => {\n if (!isAbortError(e)) {\n LOG.error(`Failed to switch locale to '${targetLocale?.baseName}'.`, e);\n }\n });\n }\n\n /** @deprecated Use `runtime.LocaleService` instead. */\n getSupportedLocales(): readonly string[] {\n getSupportedLocalesDeprecationMessage();\n return this.#localeService.supportedMessageLocales.map((l) => l.baseName);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAcjC,MAAM,8BAA8B,UAAA,CAAW;AAAA,EAC3C,IAAA,EAAM,8BAAA;AAAA,EACN,WAAA,EAAa,uBAAA;AAAA,EACb,KAAA,EAAO,QAAA;AAAA,EACP,WAAA,EAAa;AACjB,CAAC,CAAA;AACD,MAAM,8BAA8B,UAAA,CAAW;AAAA,EAC3C,IAAA,EAAM,8BAAA;AAAA,EACN,WAAA,EAAa,uBAAA;AAAA,EACb,KAAA,EAAO,QAAA;AAAA,EACP,WAAA,EAAa;AACjB,CAAC,CAAA;AACD,MAAM,wCAAwC,UAAA,CAAW;AAAA,EACrD,IAAA,EAAM,wCAAA;AAAA,EACN,WAAA,EAAa,uBAAA;AAAA,EACb,KAAA,EAAO,QAAA;AAAA,EACP,WAAA,EAAa;AACjB,CAAC,CAAA;AAEM,MAAM,sBAAA,CAAqD;AAAA,EAC9D,KAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EAEA,WAAA,CACI,SACA,UAAA,EACF;AACE,IAAA,IAAA,CAAK,QAAQ,UAAA,CAAW,IAAA;AACxB,IAAA,IAAA,CAAK,YAAY,UAAA,CAAW,QAAA;AAC5B,IAAA,IAAA,CAAK,aAAa,UAAA,CAAW,SAAA;AAC7B,IAAA,IAAA,CAAK,cAAA,GAAiB,QAAQ,UAAA,CAAW,aAAA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AAM,CAAC,CAAA;AAAA,MAC1E;AAAA,IACJ,CAAC,CAAA;AAAA,EACL;AAAA;AAAA,EAGA,mBAAA,GAAyC;AACrC,IAAA,qCAAA,EAAsC;AACtC,IAAA,OAAO,KAAK,cAAA,CAAe,uBAAA,CAAwB,IAAI,CAAC,CAAA,KAAM,EAAE,QAAQ,CAAA;AAAA,EAC5E;AACJ;;;;"}
1
+ {"version":3,"file":"ApplicationContextImpl.js","sources":["ApplicationContextImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createLogger, Error, deprecated, isAbortError } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ApplicationContext, LocaleService } from \"../api\";\nimport { isShadowRoot, RootNode } from \"../dom\";\nimport { ErrorId } from \"../errors\";\nimport { tryParseLocale } from \"../i18n\";\nimport { ServiceOptions } from \"../Service\";\n\nconst LOG = createLogger(sourceId);\n\nexport interface ApplicationContextProperties {\n host: HTMLElement;\n rootNode: RootNode;\n container: HTMLElement;\n}\n\ninterface ServiceReferences {\n localeService: LocaleService;\n}\n\nexport type ApplicationContextServiceOptions = ServiceOptions<ServiceReferences>;\n\nconst setLocaleDeprecationMessage = deprecated({\n name: \"ApplicationContext.setLocale\",\n packageName: \"@open-pioneer/runtime\",\n since: \"v4.7.0\",\n alternative: \"Use `runtime.LocaleService.changeLocale` instead.\"\n});\nconst getLocaleDeprecationMessage = deprecated({\n name: \"ApplicationContext.getLocale\",\n packageName: \"@open-pioneer/runtime\",\n since: \"v4.7.0\",\n alternative: \"Use `runtime.LocaleService.locale` instead.\"\n});\nconst getSupportedLocalesDeprecationMessage = deprecated({\n name: \"ApplicationContext.getSupportedLocales\",\n packageName: \"@open-pioneer/runtime\",\n since: \"v4.7.0\",\n alternative: \"Use `runtime.LocaleService.supportedMessageLocales` instead.\"\n});\n\nexport class ApplicationContextImpl implements ApplicationContext {\n #host: HTMLElement;\n #rootNode: RootNode;\n #container: HTMLElement;\n #localeService: LocaleService;\n\n constructor(\n options: ApplicationContextServiceOptions,\n properties: ApplicationContextProperties\n ) {\n this.#host = properties.host;\n this.#rootNode = properties.rootNode;\n this.#container = properties.container;\n this.#localeService = options.references.localeService;\n }\n\n getHostElement(): HTMLElement {\n return this.#host;\n }\n\n getRoot(): RootNode {\n return this.#rootNode;\n }\n\n getShadowRoot(): ShadowRoot | undefined {\n return isShadowRoot(this.#rootNode) ? this.#rootNode : undefined;\n }\n\n getApplicationContainer(): HTMLElement {\n return this.#container;\n }\n\n /** @deprecated Use `runtime.LocaleService` instead. */\n getLocale(): string {\n getLocaleDeprecationMessage();\n return this.#localeService.locale.baseName;\n }\n\n /** @deprecated Use `runtime.LocaleService` instead. */\n setLocale(locale: string | undefined): void {\n setLocaleDeprecationMessage();\n const targetLocale = tryParseLocale(locale);\n // to be backwards compatible, we check here synchronously\n // same check is done in AppIntl.changeLocale\n if (targetLocale && !this.#localeService.supportsLocale(targetLocale)) {\n const localesList = this.#localeService.supportedMessageLocales\n .map((l) => l.baseName)\n .join(\", \");\n throw new Error(\n ErrorId.UNSUPPORTED_LOCALE,\n `Unsupported locale '${targetLocale.baseName}' (supported locales: ${localesList}).`\n );\n }\n this.#localeService.changeLocale(targetLocale).catch((e) => {\n if (!isAbortError(e)) {\n LOG.error(`Failed to switch locale to '${targetLocale?.baseName}'.`, e);\n }\n });\n }\n\n /** @deprecated Use `runtime.LocaleService` instead. */\n getSupportedLocales(): readonly string[] {\n getSupportedLocalesDeprecationMessage();\n return this.#localeService.supportedMessageLocales.map((l) => l.baseName);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAWA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAcjC,MAAM,8BAA8B,UAAA,CAAW;AAAA,EAC3C,IAAA,EAAM,8BAAA;AAAA,EACN,WAAA,EAAa,uBAAA;AAAA,EACb,KAAA,EAAO,QAAA;AAAA,EACP,W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2BAAA,EAA4B;AAC5B,IAAA,MAAM,YAAA,GAAe,eAAe,MAAM,CAAA;AAG1C,IAAA,IAAI,gBAAgB,CAAC,IAAA,CAAK,cAAA,CAAe,cAAA,CAAe,YAAY,CAAA,EAAG;AACnE,MAAA,MAAM,WAAA,GAAc,IAAA,CAAK,cAAA,CAAe,uBAAA,CACnC,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,QAAQ,CAAA,CACrB,IAAA,CAAK,IAAI,CAAA;AACd,MAAA,MAAM,IAAI,KAAA;AAAA,QACN,OAAA,CAAQ,kBAAA;AAAA,QACR,CAAA,oBAAA,EAAuB,YAAA,CAAa,QAAQ,CAAA,sBAAA,EAAyB,WAAW,CAAA,EAAA;AAAA,OACpF;AAAA,IACJ;AACA,IAAA,IAAA,CAAK,eAAe,YAAA,CAAa,YAAY,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,KAAM;AACxD,MAAA,IAAI,CAAC,YAAA,CAAa,CAAC,CAAA,EAAG;AAClB,QAAA,GAAA,CAAI,KAAA,CAAM,CAAA,4BAAA,EAA+B,YAAA,EAAc,QAAQ,MAAM,CAAC,CAAA;AAAA,MAC1E;AAAA,IACJ,CAAC,CAAA;AAAA,EACL;AAAA;AAAA,EAGA,mBAAA,GAAyC;AACrC,IAAA,qCAAA,EAAsC;AACtC,IAAA,OAAO,KAAK,cAAA,CAAe,uBAAA,CAAwB,IAAI,CAAC,CAAA,KAAM,EAAE,QAAQ,CAAA;AAAA,EAC5E;AACJ;;;;"}
@@ -1,5 +1,5 @@
1
- import { ServiceOptions } from "../Service";
2
1
  import { ApplicationLifecycleListener } from "../api";
2
+ import { ServiceOptions } from "../Service";
3
3
  interface References {
4
4
  listeners: ApplicationLifecycleListener[];
5
5
  }
@@ -9,7 +9,7 @@ class ApplicationLifecycleEventService {
9
9
  const listeners = options.references.listeners;
10
10
  const listenersMeta = options.referencesMeta.listeners;
11
11
  this.#listeners = listeners.map((listener, index) => [
12
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
12
+ // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion
13
13
  listenersMeta[index].serviceId,
14
14
  listener
15
15
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationLifecycleEventService.js","sources":["ApplicationLifecycleEventService.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger, Error } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ServiceOptions } from \"../Service\";\nimport { ApplicationLifecycleListener } from \"../api\";\nimport { ErrorId } from \"../errors\";\n\nconst LOG = createLogger(sourceId);\n\ninterface References {\n listeners: ApplicationLifecycleListener[];\n}\n\nexport class ApplicationLifecycleEventService {\n #listeners: [serviceId: string, listener: ApplicationLifecycleListener][];\n\n constructor(options: ServiceOptions<References>) {\n const listeners = options.references.listeners;\n const listenersMeta = options.referencesMeta.listeners;\n this.#listeners = listeners.map((listener, index) => [\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n listenersMeta[index]!.serviceId,\n listener\n ]);\n }\n\n /** @internal */\n emitLifecycleEvent(event: \"after-start\" | \"before-stop\"): void {\n const methodName = (() => {\n switch (event) {\n case \"after-start\":\n return \"afterApplicationStart\";\n case \"before-stop\":\n return \"beforeApplicationStop\";\n default:\n throw new Error(ErrorId.INTERNAL, `Invalid event '${event}'`);\n }\n })();\n for (const [serviceId, listener] of this.#listeners) {\n try {\n listener[methodName]?.();\n } catch (e) {\n LOG.error(`Unexpected error from application lifecycle listener ${serviceId}`, e);\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;AAQA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAM1B,MAAM,gCAAA,CAAiC;AAAA,EAC1C,UAAA;AAAA,EAEA,YAAY,OAAA,EAAqC;AAC7C,IAAA,MAAM,SAAA,GAAY,QAAQ,UAAA,CAAW,SAAA;AACrC,IAAA,MAAM,aAAA,GAAgB,QAAQ,cAAA,CAAe,SAAA;AAC7C,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA,CAAU,GAAA,CAAI,CAAC,UAAU,KAAA,KAAU;AAAA;AAAA,MAEjD,aAAA,CAAc,KAAK,CAAA,CAAG,SAAA;AAAA,MACtB;AAAA,KACH,CAAA;AAAA,EACL;AAAA;AAAA,EAGA,mBAAmB,KAAA,EAA4C;AAC3D,IAAA,MAAM,cAAc,MAAM;AACtB,MAAA,QAAQ,KAAA;AAAO,QACX,KAAK,aAAA;AACD,UAAA,OAAO,uBAAA;AAAA,QACX,KAAK,aAAA;AACD,UAAA,OAAO,uBAAA;AAAA,QACX;AACI,UAAA,MAAM,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,EAAU,CAAA,eAAA,EAAkB,KAAK,CAAA,CAAA,CAAG,CAAA;AAAA;AACpE,IACJ,CAAA,GAAG;AACH,IAAA,KAAA,MAAW,CAAC,SAAA,EAAW,QAAQ,CAAA,IAAK,KAAK,UAAA,EAAY;AACjD,MAAA,IAAI;AACA,QAAA,QAAA,CAAS,UAAU,CAAA,IAAI;AAAA,MAC3B,SAAS,CAAA,EAAG;AACR,QAAA,GAAA,CAAI,KAAA,CAAM,CAAA,qDAAA,EAAwD,SAAS,CAAA,CAAA,EAAI,CAAC,CAAA;AAAA,MACpF;AAAA,IACJ;AAAA,EACJ;AACJ;;;;"}
1
+ {"version":3,"file":"ApplicationLifecycleEventService.js","sources":["ApplicationLifecycleEventService.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createLogger, Error } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { ApplicationLifecycleListener } from \"../api\";\nimport { ErrorId } from \"../errors\";\nimport { ServiceOptions } from \"../Service\";\n\nconst LOG = createLogger(sourceId);\n\ninterface References {\n listeners: ApplicationLifecycleListener[];\n}\n\nexport class ApplicationLifecycleEventService {\n #listeners: [serviceId: string, listener: ApplicationLifecycleListener][];\n\n constructor(options: ServiceOptions<References>) {\n const listeners = options.references.listeners;\n const listenersMeta = options.referencesMeta.listeners;\n this.#listeners = listeners.map((listener, index) => [\n // oxlint-disable-next-line @typescript-eslint/no-non-null-assertion\n listenersMeta[index]!.serviceId,\n listener\n ]);\n }\n\n /** @internal */\n emitLifecycleEvent(event: \"after-start\" | \"before-stop\"): void {\n const methodName = (() => {\n switch (event) {\n case \"after-start\":\n return \"afterApplicationStart\";\n case \"before-stop\":\n return \"beforeApplicationStop\";\n default:\n throw new Error(ErrorId.INTERNAL, `Invalid event '${event}'`);\n }\n })();\n for (const [serviceId, listener] of this.#listeners) {\n try {\n listener[methodName]?.();\n } catch (e) {\n LOG.error(`Unexpected error from application lifecycle listener ${serviceId}`, e);\n }\n }\n }\n}\n"],"names":[],"mappings":";;;;AASA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAM1B,MAAM,gCAAA,CAAiC;AAAA,EAC1C,UAAA;AAAA,EAEA,YAAY,OAAA,EAAqC;AAC7C,IAAA,MAAM,SAAA,GAAY,QAAQ,UAAA,CAAW,SAAA;AACrC,IAAA,MAAM,aAAA,GAAgB,QAAQ,cAAA,CAAe,SAAA;AAC7C,IAAA,IAAA,CAAK,UAAA,GAAa,SAAA,CAAU,GAAA,CAAI,CAAC,UAAU,KAAA,KAAU;AAAA;AAAA,MAEjD,aAAA,CAAc,KAAK,CAAA,CAAG,SAAA;AAAA,MACtB;AAAA,KACH,CAAA;AAAA,EACL;AAAA;AAAA,EAGA,mBAAmB,KAAA,EAA4C;AAC3D,IAAA,MAAM,cAAc,MAAM;AACtB,MAAA,QAAQ,KAAA;AAAO,QACX,KAAK,aAAA;AACD,UAAA,OAAO,uBAAA;AAAA,QACX,KAAK,aAAA;AACD,UAAA,OAAO,uBAAA;AAAA,QACX;AACI,UAAA,MAAM,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,EAAU,CAAA,eAAA,EAAkB,KAAK,CAAA,CAAA,CAAG,CAAA;AAAA;AACpE,IACJ,CAAA,GAAG;AACH,IAAA,KAAA,MAAW,CAAC,SAAA,EAAW,QAAQ,CAAA,IAAK,KAAK,UAAA,EAAY;AACjD,MAAA,IAAI;AACA,QAAA,QAAA,CAAS,UAAU,CAAA,IAAI;AAAA,MAC3B,SAAS,CAAA,EAAG;AACR,QAAA,GAAA,CAAI,KAAA,CAAM,CAAA,qDAAA,EAAwD,SAAS,CAAA,CAAA,EAAI,CAAC,CAAA;AAAA,MACpF;AAAA,IACJ;AAAA,EACJ;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LocaleServiceImpl.js","sources":["LocaleServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { type LocaleService } from \"../api\";\nimport { AppIntl } from \"../i18n\";\n\nexport interface LocaleServiceProperties {\n appIntl: AppIntl;\n}\n\n/**\n * Implementation of the `runtime.LocaleService` builtin service.\n */\nexport class LocaleServiceImpl implements LocaleService {\n // this is the source of truth.\n // Carries the real reactive state.\n #appIntl: AppIntl;\n\n constructor(properties: LocaleServiceProperties) {\n this.#appIntl = properties.appIntl;\n }\n\n get locale(): Intl.Locale {\n return this.#appIntl.locale;\n }\n\n get messageLocale(): Intl.Locale {\n return this.#appIntl.messageLocale;\n }\n\n get supportedMessageLocales(): readonly Intl.Locale[] {\n return this.#appIntl.supportedMessageLocales;\n }\n\n get supportsLiveChanges(): boolean {\n return this.#appIntl.supportsLiveChanges;\n }\n\n changeLocale(targetLocale: Intl.Locale | undefined): Promise<void> {\n return this.#appIntl.changeLocale(targetLocale);\n }\n\n supportsLocale(locale: Intl.Locale): boolean {\n return this.#appIntl.supportsLocale(locale);\n }\n}\n"],"names":[],"mappings":"AAYO,MAAM,iBAAA,CAA2C;AAAA;AAAA;AAAA,EAGpD,QAAA;AAAA,EAEA,YAAY,UAAA,EAAqC;AAC7C,IAAA,IAAA,CAAK,WAAW,UAAA,CAAW,OAAA;AAAA,EAC/B;AAAA,EAEA,IAAI,MAAA,GAAsB;AACtB,IAAA,OAAO,KAAK,QAAA,CAAS,MAAA;AAAA,EACzB;AAAA,EAEA,IAAI,aAAA,GAA6B;AAC7B,IAAA,OAAO,KAAK,QAAA,CAAS,aAAA;AAAA,EACzB;AAAA,EAEA,IAAI,uBAAA,GAAkD;AAClD,IAAA,OAAO,KAAK,QAAA,CAAS,uBAAA;AAAA,EACzB;AAAA,EAEA,IAAI,mBAAA,GAA+B;AAC/B,IAAA,OAAO,KAAK,QAAA,CAAS,mBAAA;AAAA,EACzB;AAAA,EAEA,aAAa,YAAA,EAAsD;AAC/D,IAAA,OAAO,IAAA,CAAK,QAAA,CAAS,YAAA,CAAa,YAAY,CAAA;AAAA,EAClD;AAAA,EAEA,eAAe,MAAA,EAA8B;AACzC,IAAA,OAAO,IAAA,CAAK,QAAA,CAAS,cAAA,CAAe,MAAM,CAAA;AAAA,EAC9C;AACJ;;;;"}
1
+ {"version":3,"file":"LocaleServiceImpl.js","sources":["LocaleServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { type LocaleService } from \"../api\";\nimport { AppIntl } from \"../i18n\";\n\nexport interface LocaleServiceProperties {\n appIntl: AppIntl;\n}\n\n/**\n * Implementation of the `runtime.LocaleService` builtin service.\n */\nexport class LocaleServiceImpl implements LocaleService {\n // this is the source of truth.\n // Carries the real reactive state.\n #appIntl: AppIntl;\n\n constructor(properties: LocaleServiceProperties) {\n this.#appIntl = properties.appIntl;\n }\n\n get locale(): Intl.Locale {\n return this.#appIntl.locale;\n }\n\n get messageLocale(): Intl.Locale {\n return this.#appIntl.messageLocale;\n }\n\n get supportedMessageLocales(): readonly Intl.Locale[] {\n return this.#appIntl.supportedMessageLocales;\n }\n\n get supportsLiveChanges(): boolean {\n return this.#appIntl.supportsLiveChanges;\n }\n\n changeLocale(targetLocale: Intl.Locale | undefined): Promise<void> {\n return this.#appIntl.changeLocale(targetLocale);\n }\n\n supportsLocale(locale: Intl.Locale): boolean {\n return this.#appIntl.supportsLocale(locale);\n }\n}\n"],"names":[],"mappings":"AAaO,MAAM,iBAAA,CAA2C;AAAA;AAAA;AAAA,EAGpD,QAAA;AAAA,EAEA,YAAY,UAAA,EAAqC;AAC7C,IAAA,IAAA,CAAK,WAAW,UAAA,CAAW,OAAA;AAAA,EAC/B;AAAA,EAEA,IAAI,MAAA,GAAsB;AACtB,IAAA,OAAO,KAAK,QAAA,CAAS,MAAA;AAAA,EACzB;AAAA,EAEA,IAAI,aAAA,GAA6B;AAC7B,IAAA,OAAO,KAAK,QAAA,CAAS,aAAA;AAAA,EACzB;AAAA,EAEA,IAAI,uBAAA,GAAkD;AAClD,IAAA,OAAO,KAAK,QAAA,CAAS,uBAAA;AAAA,EACzB;AAAA,EAEA,IAAI,mBAAA,GAA+B;AAC/B,IAAA,OAAO,KAAK,QAAA,CAAS,mBAAA;AAAA,EACzB;AAAA,EAEA,aAAa,YAAA,EAAsD;AAC/D,IAAA,OAAO,IAAA,CAAK,QAAA,CAAS,YAAA,CAAa,YAAY,CAAA;AAAA,EAClD;AAAA,EAEA,eAAe,MAAA,EAA8B;AACzC,IAAA,OAAO,IAAA,CAAK,QAAA,CAAS,cAAA,CAAe,MAAM,CAAA;AAAA,EAC9C;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NumberParserServiceImpl.js","sources":["NumberParserServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { createLogger, NumberParser } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { LocaleService, NumberParserService } from \"../api\";\nimport { ServiceOptions } from \"../Service\";\n\nconst LOG = createLogger(sourceId);\n\ninterface ServiceReferences {\n localeService: Pick<LocaleService, \"locale\">;\n}\n\nexport type NumberParserServiceOptions = ServiceOptions<ServiceReferences>;\n\nexport class NumberParserServiceImpl implements NumberParserService {\n #numberParser: ReadonlyReactive<NumberParser>;\n\n constructor(_serviceOptions: NumberParserServiceOptions) {\n const localeService = _serviceOptions.references.localeService;\n this.#numberParser = computed(() => {\n // reactive\n const tag = localeService.locale.baseName;\n try {\n return new NumberParser(tag);\n } catch (e) {\n LOG.warn(\n `Failed to create NumberParser with locale '${tag}'. Falling back to 'en-US'.`,\n e\n );\n return new NumberParser(\"en-US\");\n }\n });\n }\n\n parseNumber(numberString: string): number {\n return this.#numberParser.value.parse(numberString);\n }\n}\n"],"names":[],"mappings":";;;;AAQA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAQ1B,MAAM,uBAAA,CAAuD;AAAA,EAChE,aAAA;AAAA,EAEA,YAAY,eAAA,EAA6C;AACrD,IAAA,MAAM,aAAA,GAAgB,gBAAgB,UAAA,CAAW,aAAA;AACjD,IAAA,IAAA,CAAK,aAAA,GAAgB,SAAS,MAAM;AAEhC,MAAA,MAAM,GAAA,GAAM,cAAc,MAAA,CAAO,QAAA;AACjC,MAAA,IAAI;AACA,QAAA,OAAO,IAAI,aAAa,GAAG,CAAA;AAAA,MAC/B,SAAS,CAAA,EAAG;AACR,QAAA,GAAA,CAAI,IAAA;AAAA,UACA,8CAA8C,GAAG,CAAA,2BAAA,CAAA;AAAA,UACjD;AAAA,SACJ;AACA,QAAA,OAAO,IAAI,aAAa,OAAO,CAAA;AAAA,MACnC;AAAA,IACJ,CAAC,CAAA;AAAA,EACL;AAAA,EAEA,YAAY,YAAA,EAA8B;AACtC,IAAA,OAAO,IAAA,CAAK,aAAA,CAAc,KAAA,CAAM,KAAA,CAAM,YAAY,CAAA;AAAA,EACtD;AACJ;;;;"}
1
+ {"version":3,"file":"NumberParserServiceImpl.js","sources":["NumberParserServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { computed, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { createLogger, NumberParser } from \"@open-pioneer/core\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { LocaleService, NumberParserService } from \"../api\";\nimport { ServiceOptions } from \"../Service\";\n\nconst LOG = createLogger(sourceId);\n\ninterface ServiceReferences {\n localeService: Pick<LocaleService, \"locale\">;\n}\n\nexport type NumberParserServiceOptions = ServiceOptions<ServiceReferences>;\n\nexport class NumberParserServiceImpl implements NumberParserService {\n #numberParser: ReadonlyReactive<NumberParser>;\n\n constructor(_serviceOptions: NumberParserServiceOptions) {\n const localeService = _serviceOptions.references.localeService;\n this.#numberParser = computed(() => {\n // reactive\n const tag = localeService.locale.baseName;\n try {\n return new NumberParser(tag);\n } catch (e) {\n LOG.warn(\n `Failed to create NumberParser with locale '${tag}'. Falling back to 'en-US'.`,\n e\n );\n return new NumberParser(\"en-US\");\n }\n });\n }\n\n parseNumber(numberString: string): number {\n return this.#numberParser.value.parse(numberString);\n }\n}\n"],"names":[],"mappings":";;;;AASA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAQ1B,MAAM,uBAAA,CAAuD;AAAA,EAChE,aAAA;AAAA,EAEA,YAAY,eAAA,EAA6C;AACrD,IAAA,MAAM,aAAA,GAAgB,gBAAgB,UAAA,CAAW,aAAA;AACjD,IAAA,IAAA,CAAK,aAAA,GAAgB,SAAS,MAAM;AAEhC,MAAA,MAAM,GAAA,GAAM,cAAc,MAAA,CAAO,QAAA;AACjC,MAAA,IAAI;AACA,QAAA,OAAO,IAAI,aAAa,GAAG,CAAA;AAAA,MAC/B,SAAS,CAAA,EAAG;AACR,QAAA,GAAA,CAAI,IAAA;AAAA,UACA,8CAA8C,GAAG,CAAA,2BAAA,CAAA;AAAA,UACjD;AAAA,SACJ;AACA,QAAA,OAAO,IAAI,aAAa,OAAO,CAAA;AAAA,MACnC;AAAA,IACJ,CAAC,CAAA;AAAA,EACL;AAAA,EAEA,YAAY,YAAA,EAA8B;AACtC,IAAA,OAAO,IAAA,CAAK,aAAA,CAAc,KAAA,CAAM,KAAA,CAAM,YAAY,CAAA;AAAA,EACtD;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeServiceImpl.js","sources":["ThemeServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { type SystemConfig as ChakraSystemConfig } from \"@chakra-ui/react\";\nimport { computed, reactive, ReadonlyReactive, synchronized } from \"@conterra/reactivity-core\";\nimport {\n type ChakraSystemConfigSupplier,\n type ColorModeValue,\n type ColorModeValueSupplier,\n type ThemeService\n} from \"../api\";\n\nexport const DEFAULT_INITIAL_COLOR_MODE: ColorModeValue = \"light\";\n\nexport interface ThemeServiceProperties {\n initialColorMode?: ColorModeValue | \"system\";\n initialSystemConfig?: ChakraSystemConfig;\n}\n\nexport class ThemeServiceImpl implements ThemeService {\n #systemColorMode = reactiveSystemColorMode();\n\n #colorModeSource = reactive<ColorModeValueSupplier>(() => DEFAULT_INITIAL_COLOR_MODE);\n #colorMode = computed<ColorModeValue>(\n () => this.#colorModeSource.value() ?? DEFAULT_INITIAL_COLOR_MODE\n );\n\n #systemConfigSource = reactive<ChakraSystemConfigSupplier>(() => undefined);\n #systemConfig = computed<ChakraSystemConfig | undefined>(\n () => this.#systemConfigSource.value() ?? undefined\n );\n\n constructor({ initialSystemConfig, initialColorMode }: ThemeServiceProperties) {\n this.setColorMode(initialColorMode ?? DEFAULT_INITIAL_COLOR_MODE);\n if (initialSystemConfig) {\n this.setSystemConfig(initialSystemConfig);\n }\n }\n\n get systemColorMode(): ColorModeValue {\n return this.#systemColorMode.value;\n }\n\n get colorMode(): ColorModeValue {\n return this.#colorMode.value;\n }\n\n setColorMode(value: ColorModeValue | \"system\" | ColorModeValueSupplier): void {\n if (typeof value === \"function\") {\n this.#colorModeSource.value = value;\n } else if (value === \"system\") {\n this.#colorModeSource.value = () => this.#systemColorMode.value;\n } else {\n this.#colorModeSource.value = () => value;\n }\n }\n\n get systemConfig(): ChakraSystemConfig | undefined {\n return this.#systemConfig.value;\n }\n\n setSystemConfig(value: ChakraSystemConfig | ChakraSystemConfigSupplier | undefined): void {\n if (typeof value === \"function\") {\n this.#systemConfigSource.value = value;\n } else {\n this.#systemConfigSource.value = () => value;\n }\n }\n}\n\nfunction reactiveSystemColorMode(): ReadonlyReactive<ColorModeValue> {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return reactive(\"light\");\n }\n\n const query = window.matchMedia(\"(prefers-color-scheme: dark)\");\n return synchronized(\n () => (query.matches ? \"dark\" : \"light\"),\n (onChange) => {\n const listener = () => onChange();\n query.addEventListener(\"change\", listener);\n return () => query.removeEventListener(\"change\", listener);\n }\n );\n}\n"],"names":[],"mappings":";;AAWO,MAAM,0BAAA,GAA6C;AAOnD,MAAM,gBAAA,CAAyC;AAAA,EAClD,mBAAmB,uBAAA,EAAwB;AAAA,EAE3C,gBAAA,GAAmB,QAAA,CAAiC,MAAM,0BAA0B,CAAA;AAAA,EACpF,UAAA,GAAa,QAAA;AAAA,IACT,MAAM,IAAA,CAAK,gBAAA,CAAiB,KAAA,EAAM,IAAK;AAAA,GAC3C;AAAA,EAEA,mBAAA,GAAsB,QAAA,CAAqC,MAAM,MAAS,CAAA;AAAA,EAC1E,aAAA,GAAgB,QAAA;AAAA,IACZ,MAAM,IAAA,CAAK,mBAAA,CAAoB,KAAA,EAAM,IAAK;AAAA,GAC9C;AAAA,EAEA,WAAA,CAAY,EAAE,mBAAA,EAAqB,gBAAA,EAAiB,EAA2B;AAC3E,IAAA,IAAA,CAAK,YAAA,CAAa,oBAAoB,0BAA0B,CAAA;AAChE,IAAA,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IACH,MAAO,KAAA,CAAM,OAAA,GAAU,MAAA,GAAS,OAAA;AAAA,IAChC,CAAC,QAAA,KAAa;AACV,MAAA,MAAM,QAAA,GAAW,MAAM,QAAA,EAAS;AAChC,MAAA,KAAA,CAAM,gBAAA,CAAiB,UAAU,QAAQ,CAAA;AACzC,MAAA,OAAO,MAAM,KAAA,CAAM,mBAAA,CAAoB,QAAA,EAAU,QAAQ,CAAA;AAAA,IAC7D;AAAA,GACJ;AACJ;;;;"}
1
+ {"version":3,"file":"ThemeServiceImpl.js","sources":["ThemeServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { type SystemConfig as ChakraSystemConfig } from \"@chakra-ui/react\";\nimport { computed, reactive, ReadonlyReactive, synchronized } from \"@conterra/reactivity-core\";\nimport {\n type ChakraSystemConfigSupplier,\n type ColorModeValue,\n type ColorModeValueSupplier,\n type ThemeService\n} from \"../api\";\n\nexport const DEFAULT_INITIAL_COLOR_MODE: ColorModeValue = \"light\";\n\nexport interface ThemeServiceProperties {\n initialColorMode?: ColorModeValue | \"system\";\n initialSystemConfig?: ChakraSystemConfig;\n}\n\nexport class ThemeServiceImpl implements ThemeService {\n #systemColorMode = reactiveSystemColorMode();\n\n #colorModeSource = reactive<ColorModeValueSupplier>(() => DEFAULT_INITIAL_COLOR_MODE);\n #colorMode = computed<ColorModeValue>(\n () => this.#colorModeSource.value() ?? DEFAULT_INITIAL_COLOR_MODE\n );\n\n #systemConfigSource = reactive<ChakraSystemConfigSupplier>(() => undefined);\n #systemConfig = computed<ChakraSystemConfig | undefined>(\n () => this.#systemConfigSource.value() ?? undefined\n );\n\n constructor({ initialSystemConfig, initialColorMode }: ThemeServiceProperties) {\n this.setColorMode(initialColorMode ?? DEFAULT_INITIAL_COLOR_MODE);\n if (initialSystemConfig) {\n this.setSystemConfig(initialSystemConfig);\n }\n }\n\n get systemColorMode(): ColorModeValue {\n return this.#systemColorMode.value;\n }\n\n get colorMode(): ColorModeValue {\n return this.#colorMode.value;\n }\n\n setColorMode(value: ColorModeValue | \"system\" | ColorModeValueSupplier): void {\n if (typeof value === \"function\") {\n this.#colorModeSource.value = value;\n } else if (value === \"system\") {\n this.#colorModeSource.value = () => this.#systemColorMode.value;\n } else {\n this.#colorModeSource.value = () => value;\n }\n }\n\n get systemConfig(): ChakraSystemConfig | undefined {\n return this.#systemConfig.value;\n }\n\n setSystemConfig(value: ChakraSystemConfig | ChakraSystemConfigSupplier | undefined): void {\n if (typeof value === \"function\") {\n this.#systemConfigSource.value = value;\n } else {\n this.#systemConfigSource.value = () => value;\n }\n }\n}\n\nfunction reactiveSystemColorMode(): ReadonlyReactive<ColorModeValue> {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return reactive(\"light\");\n }\n\n const query = window.matchMedia(\"(prefers-color-scheme: dark)\");\n return synchronized(\n () => (query.matches ? \"dark\" : \"light\"),\n (onChange) => {\n const listener = () => onChange();\n query.addEventListener(\"change\", listener);\n return () => query.removeEventListener(\"change\", listener);\n }\n );\n}\n"],"names":[],"mappings":";;AAYO,MAAM,0BAAA,GAA6C;AAOnD,MAAM,gBAAA,CAAyC;AAAA,EAClD,mBAAmB,uBAAA,EAAwB;AAAA,EAE3C,gBAAA,GAAmB,QAAA,CAAiC,MAAM,0BAA0B,CAAA;AAAA,EACpF,UAAA,GAAa,QAAA;AAAA,IACT,MAAM,IAAA,CAAK,gBAAA,CAAiB,KAAA,EAAM,IAAK;AAAA,GAC3C;AAAA,EAEA,mBAAA,GAAsB,QAAA,CAAqC,MAAM,MAAS,CAAA;AAAA,EAC1E,aAAA,GAAgB,QAAA;AAAA,IACZ,MAAM,IAAA,CAAK,mBAAA,CAAoB,KAAA,EAAM,IAAK;AAAA,GAC9C;AAAA,EAEA,WAAA,CAAY,EAAE,mBAAA,EAAqB,gBAAA,EAAiB,EAA2B;AAC3E,IAAA,IAAA,CAAK,YAA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AA8B,CAAA;AAC9D,EAAA,OAAO,YAAA;AAAA,IACH,MAAO,KAAA,CAAM,OAAA,GAAU,MAAA,GAAS,OAAA;AAAA,IAChC,CAAC,QAAA,KAAa;AACV,MAAA,MAAM,QAAA,GAAW,MAAM,QAAA,EAAS;AAChC,MAAA,KAAA,CAAM,gBAAA,CAAiB,UAAU,QAAQ,CAAA;AACzC,MAAA,OAAO,MAAM,KAAA,CAAM,mBAAA,CAAoB,QAAA,EAAU,QAAQ,CAAA;AAAA,IAC7D;AAAA,GACJ;AACJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { constant } from \"@conterra/reactivity-core\";\nimport { createEmptyPackageIntl } from \"../i18n\";\nimport { PackageRepr } from \"../service-layer/PackageRepr\";\nimport {\n createConstructorFactory,\n createFunctionFactory,\n ServiceRepr\n} from \"../service-layer/ServiceRepr\";\nimport { ApiServiceImpl } from \"./ApiServiceImpl\";\nimport {\n ApplicationContextImpl,\n ApplicationContextProperties,\n ApplicationContextServiceOptions\n} from \"./ApplicationContextImpl\";\nimport { ApplicationLifecycleEventService } from \"./ApplicationLifecycleEventService\";\nimport { LocaleServiceImpl, LocaleServiceProperties } from \"./LocaleServiceImpl\";\nimport { NumberParserServiceImpl, NumberParserServiceOptions } from \"./NumberParserServiceImpl\";\nimport { ThemeServiceImpl, ThemeServiceProperties } from \"./ThemeServiceImpl\";\n\nexport const RUNTIME_PACKAGE_NAME = \"@open-pioneer/runtime\";\nexport const RUNTIME_API_EXTENSION = \"integration.ApiExtension\";\nexport const RUNTIME_API_SERVICE = \"runtime.ApiService\";\nexport const RUNTIME_APPLICATION_CONTEXT = \"runtime.ApplicationContext\";\nexport const RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE =\n \"runtime.ApplicationLifecycleEventService\";\nexport const RUNTIME_NUMBER_PARSER_SERVICE = \"runtime.NumberParserService\";\nexport const RUNTIME_AUTO_START = \"runtime.AutoStart\";\nexport const RUNTIME_THEME_SERVICE = \"runtime.ThemeService\";\nexport const RUNTIME_LOCALE_SERVICE = \"runtime.LocaleService\";\n\nexport type BuiltinPackageProperties = ApplicationContextProperties &\n ThemeServiceProperties &\n LocaleServiceProperties;\n\n/**\n * Creates the builtin package containing the builtin services.\n *\n * The runtime package should not use services in the `build.config.mjs`\n * for a clean bootstrapping procedure (it will be instantiated without\n * generated application metadata in tests).\n *\n * This function is called as part of the service layer startup.\n * The package produced here is always part of the application.\n */\nexport function createBuiltinPackage(properties: BuiltinPackageProperties): PackageRepr {\n const intl = createEmptyPackageIntl();\n\n const localeService = new ServiceRepr({\n name: \"LocaleServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(() => new LocaleServiceImpl(properties)),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_LOCALE_SERVICE,\n qualifier: \"builtin\"\n }\n ]\n });\n const apiService = new ServiceRepr({\n name: \"ApiServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createConstructorFactory(ApiServiceImpl),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_API_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"providers\",\n interfaceName: RUNTIME_API_EXTENSION,\n all: true\n }\n ]\n });\n const appContext = new ServiceRepr({\n name: \"ApplicationContextImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(\n (options) =>\n new ApplicationContextImpl(options as ApplicationContextServiceOptions, properties)\n ),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_APPLICATION_CONTEXT,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"localeService\",\n interfaceName: RUNTIME_LOCALE_SERVICE,\n qualifier: \"builtin\"\n }\n ]\n });\n const lifecycleEventService = new ServiceRepr({\n name: \"ApplicationLifecycleEventServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createConstructorFactory(ApplicationLifecycleEventService),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"listeners\",\n interfaceName: \"runtime.ApplicationLifecycleListener\",\n all: true\n }\n ]\n });\n const numberParserService = new ServiceRepr({\n name: \"NumberParserServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(\n (options) => new NumberParserServiceImpl(options as NumberParserServiceOptions)\n ),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_NUMBER_PARSER_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"localeService\",\n interfaceName: RUNTIME_LOCALE_SERVICE,\n qualifier: \"builtin\"\n }\n ]\n });\n\n const themeService = new ServiceRepr({\n name: \"ThemeServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(() => new ThemeServiceImpl(properties)),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_THEME_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"applicationContext\",\n interfaceName: RUNTIME_APPLICATION_CONTEXT,\n qualifier: \"builtin\"\n }\n ]\n });\n\n return new PackageRepr({\n name: RUNTIME_PACKAGE_NAME,\n services: [\n apiService,\n appContext,\n lifecycleEventService,\n localeService,\n numberParserService,\n themeService\n ],\n intl: constant(intl)\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAqBO,MAAM,oBAAA,GAAuB;AAC7B,MAAM,qBAAA,GAAwB,0BAAA;AAC9B,MAAM,mBAAA,GAAsB;AAC5B,MAAM,2BAAA,GAA8B,4BAAA;AACpC,MAAM,2CAAA,GACT;AACG,MAAM,6BAAA,GAAgC,6BAAA;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kBAAA;AAAA,IACN,WAAA,EAAa,oBAAA;AAAA,IACb,SAAS,qBAAA,CAAsB,MAAM,IAAI,gBAAA,CAAiB,UAAU,CAAC,CAAA;AAAA,IACrE,IAAA,EAAM,SAAS,IAAI,CAAA;AAAA,IACnB,UAAA,EAAY;AAAA,MACR;AAAA,QACI,aAAA,EAAe,qBAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf,KACJ;AAAA,IACA,YAAA,EAAc;AAAA,MACV;AAAA,QACI,aAAA,EAAe,oBAAA;AAAA,QACf,aAAA,EAAe,2BAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf;AACJ,GACH,CAAA;AAED,EAAA,OAAO,IAAI,WAAA,CAAY;AAAA,IACnB,IAAA,EAAM,oBAAA;AAAA,IACN,QAAA,EAAU;AAAA,MACN,UAAA;AAAA,MACA,UAAA;AAAA,MACA,qBAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KACJ;AAAA,IACA,IAAA,EAAM,SAAS,IAAI;AAAA,GACtB,CAAA;AACL;;;;"}
1
+ {"version":3,"file":"index.js","sources":["index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { constant } from \"@conterra/reactivity-core\";\nimport { createEmptyPackageIntl } from \"../i18n\";\nimport { PackageRepr } from \"../service-layer/PackageRepr\";\nimport {\n createConstructorFactory,\n createFunctionFactory,\n ServiceRepr\n} from \"../service-layer/ServiceRepr\";\nimport { ApiServiceImpl } from \"./ApiServiceImpl\";\nimport {\n ApplicationContextImpl,\n ApplicationContextProperties,\n ApplicationContextServiceOptions\n} from \"./ApplicationContextImpl\";\nimport { ApplicationLifecycleEventService } from \"./ApplicationLifecycleEventService\";\nimport { LocaleServiceImpl, LocaleServiceProperties } from \"./LocaleServiceImpl\";\nimport { NumberParserServiceImpl, NumberParserServiceOptions } from \"./NumberParserServiceImpl\";\nimport { ThemeServiceImpl, ThemeServiceProperties } from \"./ThemeServiceImpl\";\n\nexport const RUNTIME_PACKAGE_NAME = \"@open-pioneer/runtime\";\nexport const RUNTIME_API_EXTENSION = \"integration.ApiExtension\";\nexport const RUNTIME_API_SERVICE = \"runtime.ApiService\";\nexport const RUNTIME_APPLICATION_CONTEXT = \"runtime.ApplicationContext\";\nexport const RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE =\n \"runtime.ApplicationLifecycleEventService\";\nexport const RUNTIME_NUMBER_PARSER_SERVICE = \"runtime.NumberParserService\";\nexport const RUNTIME_AUTO_START = \"runtime.AutoStart\";\nexport const RUNTIME_THEME_SERVICE = \"runtime.ThemeService\";\nexport const RUNTIME_LOCALE_SERVICE = \"runtime.LocaleService\";\n\nexport type BuiltinPackageProperties = ApplicationContextProperties &\n ThemeServiceProperties &\n LocaleServiceProperties;\n\n/**\n * Creates the builtin package containing the builtin services.\n *\n * The runtime package should not use services in the `build.config.mjs`\n * for a clean bootstrapping procedure (it will be instantiated without\n * generated application metadata in tests).\n *\n * This function is called as part of the service layer startup.\n * The package produced here is always part of the application.\n */\nexport function createBuiltinPackage(properties: BuiltinPackageProperties): PackageRepr {\n const intl = createEmptyPackageIntl();\n\n const localeService = new ServiceRepr({\n name: \"LocaleServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(() => new LocaleServiceImpl(properties)),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_LOCALE_SERVICE,\n qualifier: \"builtin\"\n }\n ]\n });\n const apiService = new ServiceRepr({\n name: \"ApiServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createConstructorFactory(ApiServiceImpl),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_API_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"providers\",\n interfaceName: RUNTIME_API_EXTENSION,\n all: true\n }\n ]\n });\n const appContext = new ServiceRepr({\n name: \"ApplicationContextImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(\n (options) =>\n new ApplicationContextImpl(options as ApplicationContextServiceOptions, properties)\n ),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_APPLICATION_CONTEXT,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"localeService\",\n interfaceName: RUNTIME_LOCALE_SERVICE,\n qualifier: \"builtin\"\n }\n ]\n });\n const lifecycleEventService = new ServiceRepr({\n name: \"ApplicationLifecycleEventServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createConstructorFactory(ApplicationLifecycleEventService),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_APPLICATION_LIFECYCLE_EVENT_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"listeners\",\n interfaceName: \"runtime.ApplicationLifecycleListener\",\n all: true\n }\n ]\n });\n const numberParserService = new ServiceRepr({\n name: \"NumberParserServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(\n (options) => new NumberParserServiceImpl(options as NumberParserServiceOptions)\n ),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_NUMBER_PARSER_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"localeService\",\n interfaceName: RUNTIME_LOCALE_SERVICE,\n qualifier: \"builtin\"\n }\n ]\n });\n\n const themeService = new ServiceRepr({\n name: \"ThemeServiceImpl\",\n packageName: RUNTIME_PACKAGE_NAME,\n factory: createFunctionFactory(() => new ThemeServiceImpl(properties)),\n intl: constant(intl),\n interfaces: [\n {\n interfaceName: RUNTIME_THEME_SERVICE,\n qualifier: \"builtin\"\n }\n ],\n dependencies: [\n {\n referenceName: \"applicationContext\",\n interfaceName: RUNTIME_APPLICATION_CONTEXT,\n qualifier: \"builtin\"\n }\n ]\n });\n\n return new PackageRepr({\n name: RUNTIME_PACKAGE_NAME,\n services: [\n apiService,\n appContext,\n lifecycleEventService,\n localeService,\n numberParserService,\n themeService\n ],\n intl: constant(intl)\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsBO,MAAM,oBAAA,GAAuB;AAC7B,MAAM,qBAAA,GAAwB,0BAAA;AAC9B,MAAM,mBAAA,GAAsB;AAC5B,MAAM,2BAAA,GAA8B,4BAAA;AACpC,MAAM,2CAAA,GACT;AACG,MAAM,6BAAA,GAAgC,6BAAA;AACtC,MAAM,kBAAA,GAAqB;AAC3B,MAAM,qBAAA,GAAwB;AAC9B,MAAM,sBAAA,GAAyB;AAgB/B,SAAS,qBAAqB,UAAA,EAAmD;AACpF,EAAA,MAAM,OAAO,sBAAA,EAAuB;AAEpC,EAAA,MAAM,aAAA,GAAgB,IAAI,WAAA,CAAY;AAAA,IAClC,IAAA,EAAM,mBAAA;AAAA,IACN,WAAA,EAAa,oBAAA;AAAA,IACb,SAAS,qBAAA,CAAsB,MAAM,IAAI,iBAAA,CAAkB,UAAU,CAAC,CAAA;AAAA,IACtE,IAAA,EAAM,SAAS,IAAI,CAAA;AAAA,IACnB,UAAA,EAAY;AAAA,MACR;AAAA,QACI,aAAA,EAAe,sBAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf;AACJ,GACH,CAAA;AACD,EAAA,MAAM,UAAA,GAAa,IAAI,WAAA,CAAY;AAAA,IAC/B,IAAA,EAAM,gBAAA;AAAA,IACN,WAAA,EAAa,oBAAA;AAAA,IACb,OAAA,EAAS,yBAAyB,cAAc,CAAA;AAAA,IAChD,IAAA,EAAM,SAAS,IAAI,CAAA;AAAA,IACnB,UAAA,EAAY;AAAA,MACR;AAAA,QACI,aAAA,EAAe,mBAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf,KACJ;AAAA,IACA,YAAA,EAAc;AAAA,MACV;AAAA,QACI,aAAA,EAAe,WAAA;AAAA,QACf,aAAA,EAAe,qBAAA;AAAA,QACf,GAAA,EAAK;AAA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ACnB,UAAA,EAAY;AAAA,MACR;AAAA,QACI,aAAA,EAAe,6BAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf,KACJ;AAAA,IACA,YAAA,EAAc;AAAA,MACV;AAAA,QACI,aAAA,EAAe,eAAA;AAAA,QACf,aAAA,EAAe,sBAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf;AACJ,GACH,CAAA;AAED,EAAA,MAAM,YAAA,GAAe,IAAI,WAAA,CAAY;AAAA,IACjC,IAAA,EAAM,kBAAA;AAAA,IACN,WAAA,EAAa,oBAAA;AAAA,IACb,SAAS,qBAAA,CAAsB,MAAM,IAAI,gBAAA,CAAiB,UAAU,CAAC,CAAA;AAAA,IACrE,IAAA,EAAM,SAAS,IAAI,CAAA;AAAA,IACnB,UAAA,EAAY;AAAA,MACR;AAAA,QACI,aAAA,EAAe,qBAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf,KACJ;AAAA,IACA,YAAA,EAAc;AAAA,MACV;AAAA,QACI,aAAA,EAAe,oBAAA;AAAA,QACf,aAAA,EAAe,2BAAA;AAAA,QACf,SAAA,EAAW;AAAA;AACf;AACJ,GACH,CAAA;AAED,EAAA,OAAO,IAAI,WAAA,CAAY;AAAA,IACnB,IAAA,EAAM,oBAAA;AAAA,IACN,QAAA,EAAU;AAAA,MACN,UAAA;AAAA,MACA,UAAA;AAAA,MACA,qBAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KACJ;AAAA,IACA,IAAA,EAAM,SAAS,IAAI;AAAA,GACtB,CAAA;AACL;;;;"}
package/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sources":["errors.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nexport enum ErrorId {\n // Problems with application metadata\n INVALID_METADATA = \"runtime:invalid-metadata\",\n INVALID_PROPERTY_NAME = \"runtime:invalid-property-name\",\n REQUIRED_PROPERTY = \"runtime:required-property\",\n\n // Application lifecycle\n NOT_MOUNTED = \"runtime:element-not-mounted\",\n UNSUPPORTED_LOCALE = \"runtime:unsupported-locale\",\n CONFIG_RESOLUTION_FAILED = \"runtime:config-resolution-failed\",\n INVALID_STATE = \"runtime:invalid-state\",\n\n // Service layer\n INTERFACE_NOT_FOUND = \"runtime:interface-not-found\",\n AMBIGUOUS_DEPENDENCY = \"runtime:ambiguous-dependency\",\n UNDECLARED_DEPENDENCY = \"runtime:undeclared-dependency\",\n MISSING_PACKAGE = \"runtime:missing-package\",\n SERVICE_CONSTRUCTION_FAILED = \"runtime:service-construction-failed\",\n SERVICE_DESTRUCTION_FAILED = \"runtime:service-destruction-failed\",\n DUPLICATE_INTERFACE = \"runtime:duplicate-interface\",\n DEPENDENCY_CYCLE = \"runtime:dependency-cycle\",\n\n // Web component API\n DUPLICATE_API_METHODS = \"runtime:duplicate-api-methods\",\n\n // Internal\n INTERNAL = \"runtime:internal-error\"\n}\n"],"names":["ErrorId"],"mappings":"AAEO,IAAK,OAAA,qBAAAA,QAAAA,KAAL;AAEH,EAAAA,SAAA,kBAAA,CAAA,GAAmB,0BAAA;AACnB,EAAAA,SAAA,uBAAA,CAAA,GAAwB,+BAAA;AACxB,EAAAA,SAAA,mBAAA,CAAA,GAAoB,2BAAA;AAGpB,EAAAA,SAAA,aAAA,CAAA,GAAc,6BAAA;AACd,EAAAA,SAAA,oBAAA,CAAA,GAAqB,4BAAA;AACrB,EAAAA,SAAA,0BAAA,CAAA,GAA2B,kCAAA;AAC3B,EAAAA,SAAA,eAAA,CAAA,GAAgB,uBAAA;AAGhB,EAAAA,SAAA,qBAAA,CAAA,GAAsB,6BAAA;AACtB,EAAAA,SAAA,sBAAA,CAAA,GAAuB,8BAAA;AACvB,EAAAA,SAAA,uBAAA,CAAA,GAAwB,+BAAA;AACxB,EAAAA,SAAA,iBAAA,CAAA,GAAkB,yBAAA;AAClB,EAAAA,SAAA,6BAAA,CAAA,GAA8B,qCAAA;AAC9B,EAAAA,SAAA,4BAAA,CAAA,GAA6B,oCAAA;AAC7B,EAAAA,SAAA,qBAAA,CAAA,GAAsB,6BAAA;AACtB,EAAAA,SAAA,kBAAA,CAAA,GAAmB,0BAAA;AAGnB,EAAAA,SAAA,uBAAA,CAAA,GAAwB,+BAAA;AAGxB,EAAAA,SAAA,UAAA,CAAA,GAAW,wBAAA;AA1BH,EAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;;"}
1
+ {"version":3,"file":"errors.js","sources":["errors.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nexport enum ErrorId {\n // Problems with application metadata\n INVALID_METADATA = \"runtime:invalid-metadata\",\n INVALID_PROPERTY_NAME = \"runtime:invalid-property-name\",\n REQUIRED_PROPERTY = \"runtime:required-property\",\n\n // Application lifecycle\n NOT_MOUNTED = \"runtime:element-not-mounted\",\n UNSUPPORTED_LOCALE = \"runtime:unsupported-locale\",\n CONFIG_RESOLUTION_FAILED = \"runtime:config-resolution-failed\",\n INVALID_STATE = \"runtime:invalid-state\",\n\n // Service layer\n INTERFACE_NOT_FOUND = \"runtime:interface-not-found\",\n AMBIGUOUS_DEPENDENCY = \"runtime:ambiguous-dependency\",\n UNDECLARED_DEPENDENCY = \"runtime:undeclared-dependency\",\n MISSING_PACKAGE = \"runtime:missing-package\",\n SERVICE_CONSTRUCTION_FAILED = \"runtime:service-construction-failed\",\n SERVICE_DESTRUCTION_FAILED = \"runtime:service-destruction-failed\",\n DUPLICATE_INTERFACE = \"runtime:duplicate-interface\",\n DEPENDENCY_CYCLE = \"runtime:dependency-cycle\",\n\n // Web component API\n DUPLICATE_API_METHODS = \"runtime:duplicate-api-methods\",\n\n // Internal\n INTERNAL = \"runtime:internal-error\"\n}\n"],"names":["ErrorId"],"mappings":"AAGO,IAAK,OAAA,qBAAAA,QAAAA,KAAL;AAEH,EAAAA,SAAA,kBAAA,CAAA,GAAmB,0BAAA;AACnB,EAAAA,SAAA,uBAAA,CAAA,GAAwB,+BAAA;AACxB,EAAAA,SAAA,mBAAA,CAAA,GAAoB,2BAAA;AAGpB,EAAAA,SAAA,aAAA,CAAA,GAAc,6BAAA;AACd,EAAAA,SAAA,oBAAA,CAAA,GAAqB,4BAAA;AACrB,EAAAA,SAAA,0BAAA,CAAA,GAA2B,kCAAA;AAC3B,EAAAA,SAAA,eAAA,CAAA,GAAgB,uBAAA;AAGhB,EAAAA,SAAA,qBAAA,CAAA,GAAsB,6BAAA;AACtB,EAAAA,SAAA,sBAAA,CAAA,GAAuB,8BAAA;AACvB,EAAAA,SAAA,uBAAA,CAAA,GAAwB,+BAAA;AACxB,EAAAA,SAAA,iBAAA,CAAA,GAAkB,yBAAA;AAClB,EAAAA,SAAA,6BAAA,CAAA,GAA8B,qCAAA;AAC9B,EAAAA,SAAA,4BAAA,CAAA,GAA6B,oCAAA;AAC7B,EAAAA,SAAA,qBAAA,CAAA,GAAsB,6BAAA;AACtB,EAAAA,SAAA,kBAAA,CAAA,GAAmB,0BAAA;AAGnB,EAAAA,SAAA,uBAAA,CAAA,GAAwB,+BAAA;AAGxB,EAAAA,SAAA,UAAA,CAAA,GAAW,wBAAA;AA1BH,EAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;;"}