@moser-inc/moser-labs-custom-elements 2.1.0 → 2.2.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.
- package/README.md +13 -10
- package/dist/external/moser-labs-custom-elements.js +291 -282
- package/dist/moser-labs-custom-elements.js +1915 -1919
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,30 +10,33 @@ npm i @moser-inc/moser-labs-custom-elements
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
For these custom elements to function properly, you must first authenticate the user with Keycloak
|
|
13
|
+
For these custom elements to function properly, you must first authenticate the user with Keycloak before calling the provided `registerCustomElements` function, passing the Keycloak instance to it.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import Keycloak from 'keycloak-js';
|
|
17
|
-
import {
|
|
17
|
+
import { registerCustomElements } from '@moser-inc/moser-labs-custom-elements';
|
|
18
18
|
|
|
19
19
|
const keycloak = new Keycloak('/keycloak.json');
|
|
20
20
|
|
|
21
21
|
keycloak.init({ onLoad: 'login-required' }).then((isAuthenticated) => {
|
|
22
22
|
if (!isAuthenticated) return;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
registerCustomElements();
|
|
24
|
+
registerCustomElements({ keycloak });
|
|
26
25
|
});
|
|
27
26
|
```
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
## API
|
|
29
|
+
|
|
30
|
+
In order for the custom elements to use the correct instance for calling API endpoints and getting profile pictures, pass the `apiUri` option to `registerCustomElements`, using an environment variable for it to be dynamic between staging and production. It defaults to using `window.location.origin`.
|
|
30
31
|
|
|
31
32
|
```ts
|
|
32
|
-
|
|
33
|
+
registerCustomElements({ keycloak, apiUri: import.meta.env.VITE_API_URI });
|
|
34
|
+
```
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
registerCustomElements();
|
|
36
|
+
## External
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
When using a Vue + PrimeVue based application, a version of the package is provided that marks these dependencies as external to drastically reduce the bundle size.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { registerCustomElements } from '@moser-inc/moser-labs-custom-elements/external';
|
|
39
42
|
```
|