@moser-inc/moser-labs-custom-elements 0.0.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.
@@ -0,0 +1,74 @@
1
+ import { type ComponentOptionsMixin, type ComponentOptionsWithArrayProps, type ComponentOptionsWithObjectProps, type ComponentOptionsWithoutProps, type ComponentPropsOptions, type ComponentPublicInstance, type ComputedOptions, type EmitsOptions, type MethodOptions, type RenderFunction, type SetupContext, type ComponentInternalInstance, type RootHydrateFunction, type ExtractPropTypes, type ConcreteComponent, type ComponentInjectOptions, type SlotsType } from 'vue';
2
+ export type VueElementConstructor<P = {}> = {
3
+ new (initialProps?: Record<string, any>): VueElement & P;
4
+ };
5
+ export interface DefineCustomElementConfig {
6
+ /**
7
+ * Render inside a shadow root DOM element
8
+ * @default true
9
+ */
10
+ shadowRoot?: boolean;
11
+ }
12
+ export declare function defineCustomElement<Props, RawBindings = object>(setup: (props: Readonly<Props>, ctx: SetupContext) => RawBindings | RenderFunction, config?: DefineCustomElementConfig): VueElementConstructor<Props>;
13
+ export declare function defineCustomElement<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = EmitsOptions, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
14
+ styles?: string[];
15
+ }, config?: DefineCustomElementConfig): VueElementConstructor<Props>;
16
+ export declare function defineCustomElement<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
17
+ styles?: string[];
18
+ }, config?: DefineCustomElementConfig): VueElementConstructor<{
19
+ [K in PropNames]: any;
20
+ }>;
21
+ export declare function defineCustomElement<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, I extends ComponentInjectOptions = {}, II extends string = string, S extends SlotsType = {}>(options: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, I, II, S> & {
22
+ styles?: string[];
23
+ }, config?: DefineCustomElementConfig): VueElementConstructor<ExtractPropTypes<PropsOptions>>;
24
+ export declare function defineCustomElement(options: {
25
+ new (...args: any[]): ComponentPublicInstance;
26
+ }, config?: DefineCustomElementConfig): VueElementConstructor;
27
+ /*! #__NO_SIDE_EFFECTS__ */
28
+ export declare const defineSSRCustomElement: typeof defineCustomElement;
29
+ declare const BaseClass: {
30
+ new (): HTMLElement;
31
+ prototype: HTMLElement;
32
+ };
33
+ type InnerComponentDef = ConcreteComponent & {
34
+ styles?: string[];
35
+ };
36
+ export declare class VueElement extends BaseClass {
37
+ private _def;
38
+ private _props;
39
+ private _config;
40
+ /**
41
+ * @internal
42
+ */
43
+ _instance: ComponentInternalInstance | null;
44
+ private _connected;
45
+ private _resolved;
46
+ private _numberProps;
47
+ private _styles?;
48
+ private _slots?;
49
+ private _ob?;
50
+ constructor(_def: InnerComponentDef, _props?: Record<string, any>, _config?: DefineCustomElementConfig, hydrate?: RootHydrateFunction);
51
+ get _root(): Element | ShadowRoot | null;
52
+ connectedCallback(): void;
53
+ parsedCallback(): void;
54
+ _connect(): void;
55
+ disconnectedCallback(): void;
56
+ /**
57
+ * resolve inner component definition (handle possible async component)
58
+ */
59
+ private _resolveDef;
60
+ private _resolveProps;
61
+ protected _setAttr(key: string): void;
62
+ /**
63
+ * @internal
64
+ */
65
+ protected _getProp(key: string): any;
66
+ /**
67
+ * @internal
68
+ */
69
+ protected _setProp(key: string, val: any, shouldReflect?: boolean, shouldUpdate?: boolean): void;
70
+ private _update;
71
+ private _createVNode;
72
+ private _applyStyles;
73
+ }
74
+ export {};
@@ -0,0 +1 @@
1
+ export * from './main'
package/dist/main.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import type Keycloak from 'keycloak-js';
2
+ declare const LabsAppSwitcher: import("./apiCustomElement").VueElementConstructor<{}>;
3
+ export { LabsAppSwitcher };
4
+ /**
5
+ * Call this function to register all provided custom elements at once.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { registerCustomElements } from '@moser-inc/moser-labs-custom-elements';
10
+ * registerCustomElements();
11
+ * ```
12
+ *
13
+ * Then use elements in your HTML or framework of choice.
14
+ *
15
+ * @example
16
+ * ```html
17
+ * <labs-app-switcher></labs-app-switcher>
18
+ * ```
19
+ */
20
+ export declare function registerCustomElements(): void;
21
+ /**
22
+ * Call this function to make sure custom elements have access to the Keycloak
23
+ * access token.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import Keycloak from 'keycloak-js';
28
+ * import { authenticateCustomElements, registerCustomElements } from '@moser-inc/moser-labs-custom-elements';
29
+ *
30
+ * const keycloak = new Keycloak('/keycloak.json');
31
+ *
32
+ * keycloak.init({ onLoad: 'login-required' }).then((isAuthenticated) => {
33
+ * if (!isAuthenticated) return;
34
+ *
35
+ * authenticateCustomElements(keycloak);
36
+ * registerCustomElements();
37
+ * });
38
+ * ```
39
+ */
40
+ export declare function authenticateCustomElements(keycloak: Keycloak): void;
41
+ declare global {
42
+ interface Window {
43
+ __CE_KEYCLOAK_TOKEN__?: string;
44
+ }
45
+ }