@openmrs/esm-globals 3.4.1-pre.96 → 4.0.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- @openmrs/esm-globals:build: cache hit, replaying output 0ffc3e6000e5a944
2
- @openmrs/esm-globals:build: $ webpack --mode=production
3
- @openmrs/esm-globals:build: asset openmrs-esm-globals.js 3.52 KiB [emitted] [minimized] (name: main) 1 related asset
4
- @openmrs/esm-globals:build: runtime modules 1.76 KiB 6 modules
5
- @openmrs/esm-globals:build: orphan modules 2.91 KiB [orphan] 3 modules
6
- @openmrs/esm-globals:build: cacheable modules 6.25 KiB
7
- @openmrs/esm-globals:build:  modules by path ../../../node_modules/systemjs-webpack-interop/auto-public-path/*.js 935 bytes
8
- @openmrs/esm-globals:build:  ../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js 89 bytes [built] [code generated]
9
- @openmrs/esm-globals:build:  ../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js 846 bytes [built] [code generated]
10
- @openmrs/esm-globals:build:  ./src/index.ts + 2 modules 2.97 KiB [built] [code generated]
11
- @openmrs/esm-globals:build:  ../../../node_modules/systemjs-webpack-interop/public-path.js 2.36 KiB [built] [code generated]
12
- @openmrs/esm-globals:build: webpack 5.70.0 compiled successfully in 17216 ms
1
+ @openmrs/esm-globals:build: cache hit, replaying output cfa64264ff6d658c
2
+ @openmrs/esm-globals:build: $ webpack --mode=production
3
+ @openmrs/esm-globals:build: asset openmrs-esm-globals.js 3.52 KiB [emitted] [minimized] (name: main) 1 related asset
4
+ @openmrs/esm-globals:build: runtime modules 1.76 KiB 6 modules
5
+ @openmrs/esm-globals:build: orphan modules 2.91 KiB [orphan] 3 modules
6
+ @openmrs/esm-globals:build: cacheable modules 6.25 KiB
7
+ @openmrs/esm-globals:build:  modules by path ../../../node_modules/systemjs-webpack-interop/auto-public-path/*.js 935 bytes
8
+ @openmrs/esm-globals:build:  ../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js 89 bytes [built] [code generated]
9
+ @openmrs/esm-globals:build:  ../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js 846 bytes [built] [code generated]
10
+ @openmrs/esm-globals:build:  ./src/index.ts + 2 modules 2.97 KiB [built] [code generated]
11
+ @openmrs/esm-globals:build:  ../../../node_modules/systemjs-webpack-interop/public-path.js 2.36 KiB [built] [code generated]
12
+ @openmrs/esm-globals:build: webpack 5.70.0 compiled successfully in 21988 ms
@@ -0,0 +1,2 @@
1
+ @openmrs/esm-globals:lint: cache hit, replaying output 99dc52c66e4f35f0
2
+ @openmrs/esm-globals:lint: $ eslint src --ext ts,tsx
@@ -0,0 +1,2 @@
1
+ @openmrs/esm-globals:typescript: cache hit, replaying output 0a8841f46a788712
2
+ @openmrs/esm-globals:typescript: $ tsc
@@ -0,0 +1,33 @@
1
+ export interface ConnectivityChangedEvent {
2
+ online: boolean;
3
+ }
4
+ export declare function dispatchConnectivityChanged(online: boolean): void;
5
+ /** @category Offline */
6
+ export declare function subscribeConnectivityChanged(cb: (ev: ConnectivityChangedEvent) => void): () => void;
7
+ /** @category Offline */
8
+ export declare function subscribeConnectivity(cb: (ev: ConnectivityChangedEvent) => void): () => void;
9
+ export interface PrecacheStaticDependenciesEvent {
10
+ }
11
+ export declare function dispatchPrecacheStaticDependencies(data?: PrecacheStaticDependenciesEvent): void;
12
+ /** @category Offline */
13
+ export declare function subscribePrecacheStaticDependencies(cb: (data: PrecacheStaticDependenciesEvent) => void): () => void;
14
+ /** @category UI */
15
+ export interface ShowNotificationEvent {
16
+ description: any;
17
+ kind?: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt";
18
+ title?: string;
19
+ action?: any;
20
+ millis?: number;
21
+ }
22
+ /** @category UI */
23
+ export interface ShowToastEvent {
24
+ description: any;
25
+ kind?: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt";
26
+ title?: string;
27
+ millis?: number;
28
+ }
29
+ export declare function dispatchNotificationShown(data: ShowNotificationEvent): void;
30
+ /** @category UI */
31
+ export declare function subscribeNotificationShown(cb: (data: ShowNotificationEvent) => void): () => void;
32
+ /** @category UI */
33
+ export declare function subscribeToastShown(cb: (data: ShowToastEvent) => void): () => void;
@@ -0,0 +1,3 @@
1
+ import { SpaConfig } from "./types";
2
+ export declare function setupPaths(config: SpaConfig): void;
3
+ export declare function setupUtils(): void;
@@ -0,0 +1,3 @@
1
+ export * from "./events";
2
+ export * from "./globals";
3
+ export * from "./types";
@@ -0,0 +1,2 @@
1
+ export { ConnectivityChangedEvent, subscribeConnectivity, subscribeConnectivityChanged, subscribePrecacheStaticDependencies, PrecacheStaticDependenciesEvent, subscribeNotificationShown, subscribeToastShown, ShowNotificationEvent, ShowToastEvent, } from "./events";
2
+ export * from "./types";
@@ -0,0 +1,137 @@
1
+ import { LifeCycleFn } from "single-spa";
2
+ declare global {
3
+ interface Window {
4
+ /**
5
+ * Easily copies a text from an element.
6
+ * @param source The source element carrying the text.
7
+ */
8
+ copyText(source: HTMLElement): void;
9
+ /**
10
+ * Gets the OpenMRS SPA base path with a trailing slash.
11
+ */
12
+ getOpenmrsSpaBase(): string;
13
+ /**
14
+ * Starts the OpenMRS SPA application.
15
+ * @param config The configuration to use for running.
16
+ */
17
+ initializeSpa(config: SpaConfig): void;
18
+ /**
19
+ * Gets the API base path.
20
+ */
21
+ openmrsBase: string;
22
+ /**
23
+ * Gets the SPA base path.
24
+ */
25
+ spaBase: string;
26
+ /**
27
+ * Gets the determined SPA environment.
28
+ */
29
+ spaEnv: SpaEnvironment;
30
+ /**
31
+ * Gets the published SPA version.
32
+ */
33
+ spaVersion?: string;
34
+ /**
35
+ * Gets a set of options from the import-map-overrides package.
36
+ */
37
+ importMapOverrides: {
38
+ getCurrentPageMap: () => Promise<ImportMap>;
39
+ addOverride(moduleName: string, url: string): void;
40
+ };
41
+ /**
42
+ * Gets the installed modules, which are tuples consisting of the module's name and exports.
43
+ */
44
+ installedModules: Array<[string, any]>;
45
+ /**
46
+ * The remotes from Webpack Module Federation.
47
+ */
48
+ __remotes__: Record<string, string>;
49
+ }
50
+ }
51
+ export declare type SpaEnvironment = "production" | "development" | "test";
52
+ export interface ImportMap {
53
+ imports: Record<string, string>;
54
+ }
55
+ export interface Lifecycle {
56
+ bootstrap: LifeCycleFn<any>;
57
+ mount: LifeCycleFn<any>;
58
+ unmount: LifeCycleFn<any>;
59
+ update?: LifeCycleFn<any>;
60
+ }
61
+ export interface SpaConfig {
62
+ /**
63
+ * The base path or URL for the OpenMRS API / endpoints.
64
+ */
65
+ apiUrl: string;
66
+ /**
67
+ * The base path for the SPA root path.
68
+ */
69
+ spaPath: string;
70
+ /**
71
+ * The environment to use.
72
+ * @default production
73
+ */
74
+ env?: SpaEnvironment;
75
+ /**
76
+ * URLs of configurations to load in the system.
77
+ */
78
+ configUrls?: Array<string>;
79
+ /**
80
+ * Defines if offline should be supported by installing a service worker.
81
+ * @default true
82
+ */
83
+ offline?: boolean;
84
+ }
85
+ export interface ResourceLoader<T = any> {
86
+ (): Promise<T>;
87
+ }
88
+ export interface ComponentDefinition {
89
+ /**
90
+ * The module/app that defines the component
91
+ */
92
+ appName: string;
93
+ /**
94
+ * Defines a function to use for actually loading the component's lifecycle.
95
+ */
96
+ load(): Promise<any>;
97
+ /**
98
+ * Defines the online support / properties of the component.
99
+ */
100
+ online?: boolean | object;
101
+ /**
102
+ * Defines the offline support / properties of the component.
103
+ */
104
+ offline?: boolean | object;
105
+ /**
106
+ * Defines the access privilege required for this component, if any.
107
+ */
108
+ privilege?: string;
109
+ /**
110
+ * Defines resources that are loaded when the component should mount.
111
+ */
112
+ resources?: Record<string, ResourceLoader>;
113
+ }
114
+ export interface ExtensionDefinition extends ComponentDefinition {
115
+ /** The name of the extension being registered */
116
+ name: string;
117
+ /** A slot to attach to */
118
+ slot?: string;
119
+ /** Slots to attach to */
120
+ slots?: Array<string>;
121
+ /** The meta data used for reflection by other components */
122
+ meta?: Record<string, any>;
123
+ /** Specifies the relative order in which the extension renders in a slot */
124
+ order?: number;
125
+ /** @deprecated A confusing way to specify the name of the extension */
126
+ id?: string;
127
+ }
128
+ export interface PageDefinition extends ComponentDefinition {
129
+ /**
130
+ * The route of the page.
131
+ */
132
+ route: string;
133
+ /**
134
+ * The order in which to load the page. This determines DOM order.
135
+ */
136
+ order: number;
137
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-globals",
3
- "version": "3.4.1-pre.96",
3
+ "version": "4.0.0-pre.1",
4
4
  "license": "MPL-2.0",
5
5
  "browser": "dist/openmrs-esm-globals.js",
6
6
  "main": "src/index.ts",
@@ -38,5 +38,5 @@
38
38
  "devDependencies": {
39
39
  "single-spa": "^5.9.3"
40
40
  },
41
- "gitHead": "593214cd88408e07e9c18eab4c204be4a3722c73"
41
+ "gitHead": "9f58b801f07526083a9edc1cc5a1e58660d71eb0"
42
42
  }