@open-pioneer/integration 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @open-pioneer/integration
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a40f12d: Update build-package tool. TypeScript declaration files should now be available.
8
+
9
+ ## 0.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - e1c7295: Compiled with build-package 0.5.2
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
@@ -0,0 +1,12 @@
1
+ import { ApplicationContext, Service, ServiceOptions } from "@open-pioneer/runtime";
2
+ import { ExternalEventService } from "./api";
3
+ interface References {
4
+ ctx: ApplicationContext;
5
+ }
6
+ export declare class ExternalEventServiceImpl implements Service<ExternalEventService> {
7
+ #private;
8
+ constructor({ references }: ServiceOptions<References>);
9
+ emitEvent(name: string, detail?: unknown): void;
10
+ emitEvent(event: Event): void;
11
+ }
12
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalEventServiceImpl.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/integration/ExternalEventServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { ApplicationContext, Service, ServiceOptions } from \"@open-pioneer/runtime\";\nimport { ExternalEventService } from \"./api\";\n\ninterface References {\n ctx: ApplicationContext;\n}\n\nexport class ExternalEventServiceImpl implements Service<ExternalEventService> {\n #ctx: ApplicationContext;\n\n constructor({ references }: ServiceOptions<References>) {\n this.#ctx = references.ctx;\n }\n\n emitEvent(name: string, detail?: unknown): void;\n emitEvent(event: Event): void;\n emitEvent(nameOrEvent: string | Event, detail: unknown = null) {\n if (nameOrEvent == null) {\n return;\n }\n\n if (nameOrEvent instanceof Event) {\n this.#dispatch(nameOrEvent);\n return;\n }\n\n const event = new CustomEvent(nameOrEvent, {\n bubbles: false,\n cancelable: false,\n detail\n });\n this.#dispatch(event);\n }\n\n #dispatch(event: Event) {\n this.#ctx.getHostElement().dispatchEvent(event);\n }\n}\n"],"names":[],"mappings":"AASO,MAAM,wBAAkE,CAAA;AAAA,EAC3E,IAAA,CAAA;AAAA,EAEA,WAAA,CAAY,EAAE,UAAA,EAA0C,EAAA;AACpD,IAAA,IAAA,CAAK,OAAO,UAAW,CAAA,GAAA,CAAA;AAAA,GAC3B;AAAA,EAIA,SAAA,CAAU,WAA6B,EAAA,MAAA,GAAkB,IAAM,EAAA;AAC3D,IAAA,IAAI,eAAe,IAAM,EAAA;AACrB,MAAA,OAAA;AAAA,KACJ;AAEA,IAAA,IAAI,uBAAuB,KAAO,EAAA;AAC9B,MAAA,IAAA,CAAK,UAAU,WAAW,CAAA,CAAA;AAC1B,MAAA,OAAA;AAAA,KACJ;AAEA,IAAM,MAAA,KAAA,GAAQ,IAAI,WAAA,CAAY,WAAa,EAAA;AAAA,MACvC,OAAS,EAAA,KAAA;AAAA,MACT,UAAY,EAAA,KAAA;AAAA,MACZ,MAAA;AAAA,KACH,CAAA,CAAA;AACD,IAAA,IAAA,CAAK,UAAU,KAAK,CAAA,CAAA;AAAA,GACxB;AAAA,EAEA,UAAU,KAAc,EAAA;AACpB,IAAA,IAAA,CAAK,IAAK,CAAA,cAAA,EAAiB,CAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,GAClD;AACJ;;;;"}
1
+ {"version":3,"file":"ExternalEventServiceImpl.js","sources":["ExternalEventServiceImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { ApplicationContext, Service, ServiceOptions } from \"@open-pioneer/runtime\";\nimport { ExternalEventService } from \"./api\";\n\ninterface References {\n ctx: ApplicationContext;\n}\n\nexport class ExternalEventServiceImpl implements Service<ExternalEventService> {\n #ctx: ApplicationContext;\n\n constructor({ references }: ServiceOptions<References>) {\n this.#ctx = references.ctx;\n }\n\n emitEvent(name: string, detail?: unknown): void;\n emitEvent(event: Event): void;\n emitEvent(nameOrEvent: string | Event, detail: unknown = null) {\n if (nameOrEvent == null) {\n return;\n }\n\n if (nameOrEvent instanceof Event) {\n this.#dispatch(nameOrEvent);\n return;\n }\n\n const event = new CustomEvent(nameOrEvent, {\n bubbles: false,\n cancelable: false,\n detail\n });\n this.#dispatch(event);\n }\n\n #dispatch(event: Event) {\n this.#ctx.getHostElement().dispatchEvent(event);\n }\n}\n"],"names":[],"mappings":"AASO,MAAM,wBAAkE,CAAA;AAAA,EAC3E,IAAA,CAAA;AAAA,EAEA,WAAA,CAAY,EAAE,UAAA,EAA0C,EAAA;AACpD,IAAA,IAAA,CAAK,OAAO,UAAW,CAAA,GAAA,CAAA;AAAA,GAC3B;AAAA,EAIA,SAAA,CAAU,WAA6B,EAAA,MAAA,GAAkB,IAAM,EAAA;AAC3D,IAAA,IAAI,eAAe,IAAM,EAAA;AACrB,MAAA,OAAA;AAAA,KACJ;AAEA,IAAA,IAAI,uBAAuB,KAAO,EAAA;AAC9B,MAAA,IAAA,CAAK,UAAU,WAAW,CAAA,CAAA;AAC1B,MAAA,OAAA;AAAA,KACJ;AAEA,IAAM,MAAA,KAAA,GAAQ,IAAI,WAAA,CAAY,WAAa,EAAA;AAAA,MACvC,OAAS,EAAA,KAAA;AAAA,MACT,UAAY,EAAA,KAAA;AAAA,MACZ,MAAA;AAAA,KACH,CAAA,CAAA;AACD,IAAA,IAAA,CAAK,UAAU,KAAK,CAAA,CAAA;AAAA,GACxB;AAAA,EAEA,UAAU,KAAc,EAAA;AACpB,IAAA,IAAA,CAAK,IAAK,CAAA,cAAA,EAAiB,CAAA,aAAA,CAAc,KAAK,CAAA,CAAA;AAAA,GAClD;AACJ;;;;"}
package/api.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ import { type ApiExtension, type ApiMethods, type ApiMethod } from "@open-pioneer/runtime";
2
+ /**
3
+ * Emits events to users of the current web component.
4
+ *
5
+ * Use the interface `"integration.ExternalEventService"` to obtain an instance of this service.
6
+ */
7
+ export interface ExternalEventService {
8
+ /**
9
+ * Emits an event to the host site as a [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent).
10
+ *
11
+ * The `detail` value (if any) will be used as the custom event's `detail`.
12
+ *
13
+ * @example
14
+ *
15
+ * ```js
16
+ * // In the application, e.g. in a service
17
+ * eventService.emitEvent("my-event", { message: "Hello World" });
18
+ *
19
+ * // In the host site (node is the application's web component node)
20
+ * node.addEventLister("my-event", (event) => {
21
+ * console.log(event.detail);
22
+ * })
23
+ * ```
24
+ */
25
+ emitEvent(name: string, detail?: unknown): void;
26
+ /**
27
+ * Emits a prepared [DOM event](https://developer.mozilla.org/en-US/docs/Web/API/Event) to the host site.
28
+ *
29
+ * The event will be dispatched on the web component's dom node without being altered by this service.
30
+ *
31
+ * You must take care to set the appropriate event options for your use case if you're using this overload (e.g. `bubbles`).
32
+ *
33
+ * @example
34
+ *
35
+ * ```js
36
+ * // You can use the CustomEvent class or your own subclass of Event
37
+ * eventService.emitEvent(new CustomEvent("my-event", {
38
+ * detail: "detail-value"
39
+ * }));
40
+ * ```
41
+ */
42
+ emitEvent(event: Event): void;
43
+ }
44
+ export { ApiExtension, ApiMethod, ApiMethods };
45
+ declare module "@open-pioneer/runtime" {
46
+ interface ServiceRegistry {
47
+ "integration.ApiExtension": ApiExtension;
48
+ "integration.ExternalEventService": ExternalEventService;
49
+ }
50
+ }
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export default undefined;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["open-pioneer://external-pioneer-packages/@open-pioneer/integration/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport * from \"./api\";\n\n// Get rid of empty chunk warning\nexport default undefined;\n"],"names":[],"mappings":"AAKA,YAAe,KAAA,CAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport * from \"./api\";\n\n// Get rid of empty chunk warning\nexport default undefined;\n"],"names":[],"mappings":"AAKA,YAAe,KAAA,CAAA;;;;"}
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/integration",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "license": "Apache-2.0",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
8
8
  ".": {
9
- "import": "./index.js"
9
+ "import": "./index.js",
10
+ "types": "./index.d.ts"
10
11
  },
11
12
  "./services": {
12
- "import": "./services.js"
13
+ "import": "./services.js",
14
+ "types": "./services.d.ts"
13
15
  }
14
16
  },
15
17
  "openPioneerFramework": {
package/services.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { ExternalEventServiceImpl } from "./ExternalEventServiceImpl";