@telia-ace/widget-core 1.0.7 → 1.0.10
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/LICENSE.txt +5 -5
- package/README.md +3 -3
- package/dist/action-resolver.d.ts +8 -8
- package/dist/component-platform/actions-controller.d.ts +40 -40
- package/dist/component-platform/changeset-provider.d.ts +8 -8
- package/dist/component-platform/component-configuration-api.d.ts +2 -2
- package/dist/component-platform/component-controller.d.ts +38 -38
- package/dist/component-platform/component-node-collection.d.ts +18 -18
- package/dist/component-platform/component-node.d.ts +63 -63
- package/dist/component-platform/component-platform.d.ts +54 -54
- package/dist/component-platform/component-query.d.ts +16 -16
- package/dist/component-platform/create-component-model.d.ts +36 -36
- package/dist/component-platform/custom-component-handler.d.ts +21 -21
- package/dist/component-platform/descriptor.d.ts +8 -8
- package/dist/component-platform/extend-component.d.ts +8 -8
- package/dist/component-platform/index.d.ts +18 -18
- package/dist/component-platform/queries.d.ts +6 -6
- package/dist/component-platform/state-processor.d.ts +12 -12
- package/dist/component-resolver.d.ts +14 -14
- package/dist/event-subscriber.d.ts +7 -7
- package/dist/index.d.ts +8 -8
- package/dist/index.js.map +1 -1
- package/dist/types/configuration.d.ts +86 -86
- package/dist/types/index.d.ts +2 -2
- package/dist/types/ui.d.ts +54 -54
- package/package.json +3 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentNode } from './component-node';
|
|
2
|
-
export declare type ComponentDescriptor = {
|
|
3
|
-
id: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
branch: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const asDescriptor: (node: ComponentNode, branch?: string | undefined) => ComponentDescriptor;
|
|
1
|
+
import { ComponentNode } from './component-node';
|
|
2
|
+
export declare type ComponentDescriptor = {
|
|
3
|
+
id: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
branch: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const asDescriptor: (node: ComponentNode, branch?: string | undefined) => ComponentDescriptor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Container } from '@webprovisions/platform';
|
|
2
|
-
import { ComponentNodeController } from './component-controller';
|
|
3
|
-
import { ComponentQuery } from './component-query';
|
|
4
|
-
export declare type ExtendComponentHandler = (controller: ComponentNodeController) => any;
|
|
5
|
-
export declare type ExtendComponentOptions = {
|
|
6
|
-
reuseController?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const extendComponent: (container: Container, typeOrQuery: string | ComponentQuery, handler: ExtendComponentHandler, ns?: string, options?: ExtendComponentOptions) => Promise<void>;
|
|
1
|
+
import { Container } from '@webprovisions/platform';
|
|
2
|
+
import { ComponentNodeController } from './component-controller';
|
|
3
|
+
import { ComponentQuery } from './component-query';
|
|
4
|
+
export declare type ExtendComponentHandler = (controller: ComponentNodeController) => any;
|
|
5
|
+
export declare type ExtendComponentOptions = {
|
|
6
|
+
reuseController?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const extendComponent: (container: Container, typeOrQuery: string | ComponentQuery, handler: ExtendComponentHandler, ns?: string, options?: ExtendComponentOptions) => Promise<void>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { ActionsController } from './actions-controller';
|
|
2
|
-
export type { WatchActionDelegate } from './actions-controller';
|
|
3
|
-
export type { ChangesetProvider } from './changeset-provider';
|
|
4
|
-
export { default as componentConfigurationApi } from './component-configuration-api';
|
|
5
|
-
export { AbstractComponentController, ComponentNodeController } from './component-controller';
|
|
6
|
-
export { ComponentNode } from './component-node';
|
|
7
|
-
export type { ChangesetOptions, ComponentNodeAttributes, ComponentNodeContext, ComponentNodeLayout, ComponentNodeProperties, ComponentNodeSettings, Size, } from './component-node';
|
|
8
|
-
export { ComponentPlatform } from './component-platform';
|
|
9
|
-
export type { SwitchMap } from './component-platform';
|
|
10
|
-
export { ComponentQuery } from './component-query';
|
|
11
|
-
export type { ComponentQueryRule } from './component-query';
|
|
12
|
-
export { createChildren, createComponentModel } from './create-component-model';
|
|
13
|
-
export type { ComponentHandlerOptions, NormalizedComponentReference, } from './create-component-model';
|
|
14
|
-
export { asDescriptor } from './descriptor';
|
|
15
|
-
export type { ComponentDescriptor } from './descriptor';
|
|
16
|
-
export { extendComponent } from './extend-component';
|
|
17
|
-
export type { ExtendComponentHandler, ExtendComponentOptions } from './extend-component';
|
|
18
|
-
export { findComponent, findVisibleComponents, traverseComponents } from './queries';
|
|
1
|
+
export { ActionsController } from './actions-controller';
|
|
2
|
+
export type { WatchActionDelegate } from './actions-controller';
|
|
3
|
+
export type { ChangesetProvider } from './changeset-provider';
|
|
4
|
+
export { default as componentConfigurationApi } from './component-configuration-api';
|
|
5
|
+
export { AbstractComponentController, ComponentNodeController } from './component-controller';
|
|
6
|
+
export { ComponentNode } from './component-node';
|
|
7
|
+
export type { ChangesetOptions, ComponentNodeAttributes, ComponentNodeContext, ComponentNodeLayout, ComponentNodeProperties, ComponentNodeSettings, Size, } from './component-node';
|
|
8
|
+
export { ComponentPlatform } from './component-platform';
|
|
9
|
+
export type { SwitchMap } from './component-platform';
|
|
10
|
+
export { ComponentQuery } from './component-query';
|
|
11
|
+
export type { ComponentQueryRule } from './component-query';
|
|
12
|
+
export { createChildren, createComponentModel } from './create-component-model';
|
|
13
|
+
export type { ComponentHandlerOptions, NormalizedComponentReference, } from './create-component-model';
|
|
14
|
+
export { asDescriptor } from './descriptor';
|
|
15
|
+
export type { ComponentDescriptor } from './descriptor';
|
|
16
|
+
export { extendComponent } from './extend-component';
|
|
17
|
+
export type { ExtendComponentHandler, ExtendComponentOptions } from './extend-component';
|
|
18
|
+
export { findComponent, findVisibleComponents, traverseComponents } from './queries';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ComponentNode } from './component-node';
|
|
2
|
-
import { SwitchMap } from './component-platform';
|
|
3
|
-
export declare const traverseComponents: (root: ComponentNode, switches: SwitchMap, fn: (node: ComponentNode) => boolean | void) => void;
|
|
4
|
-
export declare const findVisibleComponents: (root: ComponentNode, switches: SwitchMap) => ComponentNode[];
|
|
5
|
-
export declare const findComponent: (root: ComponentNode, switches: SwitchMap, fn: (node: ComponentNode) => boolean) => ComponentNode | undefined;
|
|
6
|
-
export declare const getAncestors: (node: ComponentNode) => ComponentNode[];
|
|
1
|
+
import { ComponentNode } from './component-node';
|
|
2
|
+
import { SwitchMap } from './component-platform';
|
|
3
|
+
export declare const traverseComponents: (root: ComponentNode, switches: SwitchMap, fn: (node: ComponentNode) => boolean | void) => void;
|
|
4
|
+
export declare const findVisibleComponents: (root: ComponentNode, switches: SwitchMap) => ComponentNode[];
|
|
5
|
+
export declare const findComponent: (root: ComponentNode, switches: SwitchMap, fn: (node: ComponentNode) => boolean) => ComponentNode | undefined;
|
|
6
|
+
export declare const getAncestors: (node: ComponentNode) => ComponentNode[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ComponentPlatform } from '.';
|
|
2
|
-
import { ComponentNode } from './component-node';
|
|
3
|
-
export declare type ProcessOptions = {
|
|
4
|
-
context?: boolean;
|
|
5
|
-
properties?: boolean;
|
|
6
|
-
layout?: boolean;
|
|
7
|
-
recursive?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare type StateProcessor = (node: ComponentNode, options: ProcessOptions) => void;
|
|
10
|
-
export declare type ProcessResult = Map<ComponentNode, ProcessOptions>;
|
|
11
|
-
export declare type ProcessReportCallback = (report: ProcessResult) => void;
|
|
12
|
-
export declare const createStateProcessor: (platform: ComponentPlatform, callback: ProcessReportCallback) => StateProcessor;
|
|
1
|
+
import { ComponentPlatform } from '.';
|
|
2
|
+
import { ComponentNode } from './component-node';
|
|
3
|
+
export declare type ProcessOptions = {
|
|
4
|
+
context?: boolean;
|
|
5
|
+
properties?: boolean;
|
|
6
|
+
layout?: boolean;
|
|
7
|
+
recursive?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare type StateProcessor = (node: ComponentNode, options: ProcessOptions) => void;
|
|
10
|
+
export declare type ProcessResult = Map<ComponentNode, ProcessOptions>;
|
|
11
|
+
export declare type ProcessReportCallback = (report: ProcessResult) => void;
|
|
12
|
+
export declare const createStateProcessor: (platform: ComponentPlatform, callback: ProcessReportCallback) => StateProcessor;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Logger } from '@telia-ace/widget-utilities';
|
|
2
|
-
import { Container, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';
|
|
3
|
-
export declare type ReactComponent = any | null;
|
|
4
|
-
export default class ComponentResolver {
|
|
5
|
-
aliases: Map<string, string>;
|
|
6
|
-
components: Map<string, any>;
|
|
7
|
-
events: EventManager;
|
|
8
|
-
logger: Logger;
|
|
9
|
-
constructor(container: Container);
|
|
10
|
-
getComponent(key: string): ReactComponent;
|
|
11
|
-
registerComponent(key: string, component: ReactComponent): EventSubscriptionCancellation;
|
|
12
|
-
registerResolver(key: string, fn: (component: ReactComponent) => void): EventSubscriptionCancellation;
|
|
13
|
-
registerAlias(alias: string, key: string): EventSubscriptionCancellation;
|
|
14
|
-
}
|
|
1
|
+
import { Logger } from '@telia-ace/widget-utilities';
|
|
2
|
+
import { Container, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';
|
|
3
|
+
export declare type ReactComponent = any | null;
|
|
4
|
+
export default class ComponentResolver {
|
|
5
|
+
aliases: Map<string, string>;
|
|
6
|
+
components: Map<string, any>;
|
|
7
|
+
events: EventManager;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
constructor(container: Container);
|
|
10
|
+
getComponent(key: string): ReactComponent;
|
|
11
|
+
registerComponent(key: string, component: ReactComponent): EventSubscriptionCancellation;
|
|
12
|
+
registerResolver(key: string, fn: (component: ReactComponent) => void): EventSubscriptionCancellation;
|
|
13
|
+
registerAlias(alias: string, key: string): EventSubscriptionCancellation;
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventListener, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';
|
|
2
|
-
export declare type SubscribeDelegate = (type: string, listener: EventListener) => void;
|
|
3
|
-
/**
|
|
4
|
-
* Creates s subscriber for the specified `EventManager` and provides a single cancellation
|
|
5
|
-
* function for all registered subscriptions.
|
|
6
|
-
*/
|
|
7
|
-
export declare const createEventSubscriber: (events: EventManager) => [SubscribeDelegate, EventSubscriptionCancellation];
|
|
1
|
+
import { EventListener, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';
|
|
2
|
+
export declare type SubscribeDelegate = (type: string, listener: EventListener) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Creates s subscriber for the specified `EventManager` and provides a single cancellation
|
|
5
|
+
* function for all registered subscriptions.
|
|
6
|
+
*/
|
|
7
|
+
export declare const createEventSubscriber: (events: EventManager) => [SubscribeDelegate, EventSubscriptionCancellation];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as ActionResolver } from './action-resolver';
|
|
2
|
-
export { ActionsController, asDescriptor, componentConfigurationApi, ComponentNode, ComponentNodeController, ComponentPlatform, ComponentQuery, createChildren, createComponentModel, extendComponent, findComponent, findVisibleComponents, traverseComponents, } from './component-platform';
|
|
3
|
-
export type { ChangesetOptions, ChangesetProvider, ComponentDescriptor, ComponentHandlerOptions, ComponentNodeAttributes, ComponentNodeContext, ComponentNodeLayout, ComponentNodeProperties, ComponentNodeSettings, ComponentQueryRule, ExtendComponentHandler, ExtendComponentOptions, NormalizedComponentReference, Size, SwitchMap, WatchActionDelegate, } from './component-platform';
|
|
4
|
-
export { default as ComponentResolver } from './component-resolver';
|
|
5
|
-
export type { ReactComponent } from './component-resolver';
|
|
6
|
-
export { createEventSubscriber } from './event-subscriber';
|
|
7
|
-
export type { SubscribeDelegate } from './event-subscriber';
|
|
8
|
-
export * from './types';
|
|
1
|
+
export { default as ActionResolver } from './action-resolver';
|
|
2
|
+
export { ActionsController, asDescriptor, componentConfigurationApi, ComponentNode, ComponentNodeController, ComponentPlatform, ComponentQuery, createChildren, createComponentModel, extendComponent, findComponent, findVisibleComponents, traverseComponents, } from './component-platform';
|
|
3
|
+
export type { ChangesetOptions, ChangesetProvider, ComponentDescriptor, ComponentHandlerOptions, ComponentNodeAttributes, ComponentNodeContext, ComponentNodeLayout, ComponentNodeProperties, ComponentNodeSettings, ComponentQueryRule, ExtendComponentHandler, ExtendComponentOptions, NormalizedComponentReference, Size, SwitchMap, WatchActionDelegate, } from './component-platform';
|
|
4
|
+
export { default as ComponentResolver } from './component-resolver';
|
|
5
|
+
export type { ReactComponent } from './component-resolver';
|
|
6
|
+
export { createEventSubscriber } from './event-subscriber';
|
|
7
|
+
export type { SubscribeDelegate } from './event-subscriber';
|
|
8
|
+
export * from './types';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/action-resolver.ts","../src/event-subscriber.ts","../src/component-platform/component-query.ts","../src/component-platform/component-controller.ts","../src/component-platform/actions-controller.ts","../src/component-platform/component-configuration-api.ts","../src/component-platform/component-node.ts","../src/component-platform/queries.ts","../src/component-platform/component-node-collection.ts","../src/component-platform/custom-component-handler.ts","../src/component-platform/state-processor.ts","../src/component-platform/component-platform.ts","../src/component-platform/create-component-model.ts","../src/component-platform/descriptor.ts","../src/component-platform/extend-component.ts","../src/component-resolver.ts","../src/types/configuration.ts"],"sourcesContent":["import {\n Container,\n EventManager,\n EventSubscriptionCancellation,\n Widget,\n} from '@webprovisions/platform';\n\nexport type Action = (origin: string, action: string, value?: any) => void;\n\nexport default class ActionResolver {\n private events: EventManager;\n\n constructor(container: Container) {\n const { events }: Widget = container.get('$widget');\n this.events = events.createChild(this);\n }\n\n action(target: string, action: string, value: any): void {\n this.events.dispatch('data:action', { action, value, target }, { bubbles: true });\n }\n\n subscribe(origin: string, fn: Action): EventSubscriptionCancellation {\n return this.events.subscribe(\n 'data:action',\n (e, { action, value, target }) => origin === target && fn(origin, action, value)\n );\n }\n}\n","import {\n EventListener,\n EventManager,\n EventSubscriptionCancellation,\n} from '@webprovisions/platform';\n\nexport type SubscribeDelegate = (type: string, listener: EventListener) => void;\n\n/**\n * Creates s subscriber for the specified `EventManager` and provides a single cancellation\n * function for all registered subscriptions.\n */\nexport const createEventSubscriber = (\n events: EventManager\n): [SubscribeDelegate, EventSubscriptionCancellation] => {\n const subs: EventSubscriptionCancellation[] = [];\n\n const subscribe = (type: string, listener: EventListener) => {\n subs.push(events.subscribe(type, listener));\n };\n\n return [\n subscribe,\n () => {\n subs.forEach((sub) => {\n sub();\n });\n },\n ];\n};\n","import { AbstractComponentController } from './component-controller';\nimport { ComponentNode } from './component-node';\nimport { ComponentPlatform } from './component-platform';\n\nexport type ComponentQueryRule = {\n id?: string;\n type?: string;\n};\n\nexport class ComponentQuery {\n constructor(private platform: ComponentPlatform, public rules: ComponentQueryRule[] = []) {}\n\n match(node: ComponentNode) {\n return this.rules.every((rule) => {\n if (rule.id && rule.id !== node.id) {\n return false;\n }\n if (rule.type && rule.type !== node.type) {\n return false;\n }\n return true;\n });\n }\n\n ofType(type: string): ComponentQuery {\n this.rules.push({ type });\n return this;\n }\n\n withId(id: string): ComponentQuery {\n this.rules.push({ id });\n return this;\n }\n\n select(): AbstractComponentController {\n return new AbstractComponentController(this.platform, this);\n }\n}\n","import { EventSubscriptionCancellation } from '@webprovisions/platform';\nimport { createEventSubscriber, SubscribeDelegate } from '../event-subscriber';\nimport { ActionsController } from './actions-controller';\nimport {\n ChangesetOptions,\n ComponentNode,\n ComponentNodeContext,\n ComponentNodeLayout,\n ComponentNodeProperties,\n RemoveChangeset,\n} from './component-node';\nimport { ComponentPlatform } from './component-platform';\nimport { ComponentQuery } from './component-query';\n\nexport interface ComponentController {\n actions: ActionsController;\n\n writeProperties(properties: Partial<ComponentNodeProperties>, options: ChangesetOptions): void;\n\n writeContext(context: Partial<ComponentNodeContext>, options: ChangesetOptions): void;\n\n writeLayout(context: Partial<ComponentNodeLayout>, options: ChangesetOptions): void;\n\n dispose(): void;\n}\n\nexport class ComponentNodeController implements ComponentController {\n actions: ActionsController;\n\n private subscribe: SubscribeDelegate;\n private unsubscribe: EventSubscriptionCancellation;\n\n constructor(private platform: ComponentPlatform, public node: ComponentNode, ns?: string) {\n this.actions = new ActionsController(\n platform,\n new ComponentQuery(platform).withId(node.id),\n ns\n );\n const [subscribe, unsubscribe] = createEventSubscriber(this.platform.events);\n this.subscribe = subscribe;\n this.unsubscribe = unsubscribe;\n }\n\n properties<T extends ComponentNodeProperties>(\n updated?: (properties: T) => void | Partial<ComponentNodeProperties>\n ): T {\n if (updated) {\n this.node.touchProperties((properties) => updated(<T>properties));\n }\n return <T>this.node.attributes.properties;\n }\n\n context(updated?: (context: ComponentNodeContext) => void): ComponentNodeContext {\n if (updated) {\n this.subscribe('components:context-changed', (event, { node }) => {\n if (node === this.node) {\n updated(this.node.attributes.context);\n }\n });\n }\n return this.node.attributes.context;\n }\n\n layout(updated?: (layout: ComponentNodeLayout) => void): ComponentNodeLayout {\n if (updated) {\n this.subscribe('components:layout-changed', (event, { node }) => {\n if (node === this.node) {\n updated(this.node.attributes.layout);\n }\n });\n }\n return this.node.attributes.layout;\n }\n\n writeProperties(\n properties:\n | Partial<ComponentNodeProperties>\n | ((properties: ComponentNodeProperties) => Partial<ComponentNodeProperties>),\n options?: ChangesetOptions\n ): void {\n this.node.writeProperties(properties, options);\n }\n\n writeContext(context: Partial<ComponentNodeContext>, options?: ChangesetOptions): void {\n this.node.writeProperties(context, options);\n }\n\n writeLayout(layout: Partial<ComponentNodeLayout>, options?: ChangesetOptions): void {\n this.node.writeLayout(layout, options);\n }\n\n dispose() {\n this.unsubscribe();\n this.actions.dispose();\n }\n}\n\nexport class AbstractComponentController implements ComponentController {\n actions: ActionsController;\n private removes: RemoveChangeset[] = [];\n\n constructor(\n private platform: ComponentPlatform,\n private target: ComponentQuery,\n private clearOnDispose = true\n ) {\n this.actions = new ActionsController(this.platform, this.target);\n }\n\n writeProperties(\n properties: Partial<ComponentNodeProperties>,\n options?: ChangesetOptions\n ): void {\n this.removes.push(\n this.platform.write({\n options,\n attributes: { properties },\n target: this.target,\n removable: this.clearOnDispose,\n })\n );\n }\n\n writeContext(context: Partial<ComponentNodeContext>, options?: ChangesetOptions): void {\n this.removes.push(\n this.platform.write({\n options,\n attributes: { context },\n target: this.target,\n removable: this.clearOnDispose,\n })\n );\n }\n\n writeLayout(layout: Partial<ComponentNodeLayout>, options?: ChangesetOptions): void {\n this.removes.push(\n this.platform.write({\n options,\n attributes: { layout },\n target: this.target,\n removable: this.clearOnDispose,\n })\n );\n }\n\n dispose() {\n this.removes.forEach((remove) => {\n remove();\n });\n this.actions.dispose();\n }\n}\n","import { EventSubscriptionCancellation } from '@webprovisions/platform';\nimport { ComponentNodeController } from './component-controller';\nimport { ComponentNode } from './component-node';\nimport { ComponentPlatform } from './component-platform';\nimport { ComponentQuery } from './component-query';\n\nexport type ActionData = any;\n\nexport type ActionHandler = (data: any, options: any, instance: ComponentNodeController) => any;\nexport type NextActionDelegate = (data: any, options?: any) => Promise<any>;\nexport type WatchActionDelegate = (\n input: ActionData,\n next: NextActionDelegate,\n instance: ComponentNodeController\n) => Promise<any> | any;\nexport type ActionWatcherContext = {\n source: ComponentNode;\n action: string;\n};\n\nexport type ActionsState = {\n handlers: {\n fn: ActionHandler;\n key: string;\n target: ComponentQuery;\n ns?: string;\n }[];\n\n watchers: {\n target: ComponentQuery;\n fn: WatchActionDelegate;\n key: string;\n ns?: string;\n }[];\n};\n\ntype ActionWatcherExecutionResult = {\n data: any;\n options: any;\n cancelled: boolean;\n};\n\nconst executeActionListeners = (\n listeners: WatchActionDelegate[],\n data: any,\n controller: ComponentNodeController\n): Promise<ActionWatcherExecutionResult> => {\n const stack = listeners.concat();\n const dispatch = (\n data: any,\n globalOptions: any,\n controller: ComponentNodeController\n ): Promise<ActionWatcherExecutionResult> => {\n let cancelled = true;\n if (stack.length) {\n const handler = stack.shift() as WatchActionDelegate;\n\n const next = (data: any, options: any) => {\n cancelled = false;\n return dispatch(data, Object.assign({}, globalOptions, options), controller);\n };\n\n return Promise.resolve(handler(data, next, controller)).then((result) => ({\n ...result,\n cancelled,\n }));\n }\n\n return Promise.resolve({ data, cancelled: false, options: globalOptions });\n };\n return dispatch(data, {}, controller);\n};\n\nexport class ActionsController {\n private subscriptions: (() => void)[] = [];\n constructor(\n private platform: ComponentPlatform,\n private target: ComponentQuery,\n private ns?: string\n ) {\n this.create = this.create.bind(this);\n }\n\n create(key: string, fn: ActionHandler = () => {}): EventSubscriptionCancellation {\n const handler = {\n key,\n fn,\n target: this.target,\n ns: this.ns,\n };\n this.platform.actionsState.handlers.push(handler);\n const subscription = () => {\n const index = this.platform.actionsState.handlers.indexOf(handler);\n if (index > -1) {\n this.platform.actionsState.handlers.splice(index, 1);\n }\n };\n this.subscriptions.push(subscription);\n return subscription;\n }\n\n dispatch(key: string, data: any): Promise<{ [instanceId: string]: any }> {\n const instances: ComponentNode[] = this.platform.nodes.all.concat(\n this.platform.nodes.detached\n );\n\n const output: { [instanceId: string]: any } = {};\n\n // handlers matching the specified pattern.\n const handlers = this.platform.actionsState.handlers.filter(\n (handler) => handler.key === key && (!handler.ns || !this.ns || handler.ns === this.ns)\n );\n\n return Promise.all(\n handlers.map((handler) => {\n // select all matching instances for this particular\n // handler (a handler can be mapped to many instances)\n const matchedInstances = instances.filter(\n (instance) => handler.target.match(instance) && this.target.match(instance)\n );\n\n // execute watchers for each matched instance\n const watchers = this.platform.actionsState.watchers\n .filter((watcher) => {\n return (\n watcher.key === key &&\n (!watcher.ns || !this.ns || watcher.ns === this.ns) &&\n matchedInstances.some((instance) => watcher.target.match(instance))\n );\n })\n .map((watcher) => watcher.fn);\n\n // execute watchers and handler for each instance\n return Promise.all(\n matchedInstances.map((node) => {\n const controller = new ComponentNodeController(\n this.platform,\n node,\n this.ns\n );\n return executeActionListeners(watchers, data, controller).then((input) => {\n const { data = {}, options, cancelled } = input;\n return Promise.resolve(\n cancelled ? {} : handler.fn(data, options, controller)\n ).then((handlerResponse) => {\n output[node.id] = handlerResponse;\n });\n });\n })\n );\n })\n ).then(() => output);\n }\n\n watch(key: string, fn: WatchActionDelegate): EventSubscriptionCancellation {\n let parsedKey = key;\n let parsedNs = this.ns;\n const sections = key.split('.');\n\n if (sections.length > 1) {\n parsedNs = sections[0];\n parsedKey = sections.splice(1).join('.');\n }\n const watcher = {\n fn,\n target: this.target,\n key: parsedKey,\n ns: parsedNs,\n };\n this.platform.actionsState.watchers.push(watcher);\n const subscription = () => {\n const index = this.platform.actionsState.watchers.indexOf(watcher);\n if (index > -1) {\n this.platform.actionsState.watchers.splice(index, 1);\n }\n };\n this.subscriptions.push(subscription);\n return subscription;\n }\n\n dispose() {\n this.subscriptions.forEach((unsubscribe) => unsubscribe());\n }\n}\n","import { createConfigurationApi } from '@webprovisions/platform';\nimport { CustomHandlerCallback } from './custom-component-handler';\n\ntype Options = {\n handlers?: [string, CustomHandlerCallback][];\n};\n\nexport default createConfigurationApi((builder) => {\n builder.createCommand('components', (context) => (config: Options) => {\n context.events.subscribeOnce('components:platform-created', (event, { platform }) => {\n if (config.handlers) {\n config.handlers.forEach(([key, handler]) => {\n platform.addComponentHandler(key, handler);\n });\n }\n });\n });\n});\n","import { Logger, uuid } from '@telia-ace/widget-utilities';\nimport { Container, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';\nimport { Breakpoints } from '../types';\n\nexport type ComponentNodeEventData = { node: ComponentNode };\n\nexport type RemoveChangeset = () => void;\n\nexport type ComponentNodeAttributes = {\n tags: string[];\n properties: ComponentNodeProperties;\n context: ComponentNodeContext;\n layout: ComponentNodeLayout;\n};\n\nexport type ResolveComponentNodeProperties = (\n properties: ComponentNodeProperties\n) => Partial<ComponentNodeProperties> | void;\n\nexport type ResolveComponentNodeContext = (\n context: ComponentNodeContext\n) => Partial<ComponentNodeContext>;\n\nexport type ResolveComponentNodeLayout = (\n layout: ComponentNodeLayout\n) => Partial<ComponentNodeLayout>;\n\nexport type ComponentNodeSettings = {\n tags?: string[];\n properties?: ComponentNodeProperties | ResolveComponentNodeProperties;\n context?: ComponentNodeContext | ResolveComponentNodeContext;\n layout?: ComponentNodeLayout | ResolveComponentNodeLayout;\n};\n\nexport type ComponentNodeProperties = { [key: string]: any };\n\nexport type ComponentNodeContext = { [key: string]: any };\n\nexport type ComponentNodeLayout = {\n size?: Size;\n indent?: number;\n order?: number;\n};\n\nexport type Size = number | 'full' | 'none';\n\nexport type UnmountComponentNode = () => void;\n\nexport type ChangesetOptions = {\n breakpoints?: Breakpoints;\n};\n\nexport type Changeset = [Partial<ComponentNodeSettings>, ChangesetOptions];\n\nexport class ComponentNode {\n id: string;\n type: string;\n name?: string;\n parent?: ComponentNode;\n tags: string[] = [];\n children: { [key: string]: ComponentNode[] } = {};\n changesets: Changeset[] = [];\n attributes: ComponentNodeAttributes;\n\n private mountCount = 0;\n\n constructor(private events: EventManager, type: string) {\n this.id = uuid();\n this.type = type;\n this.attributes = {\n context: {},\n properties: {},\n layout: {},\n tags: [],\n };\n // write default attributes\n this.writeLayout({ size: 'full', indent: 0 });\n }\n\n mount(viewOutletContainer: Container, element?: HTMLElement): UnmountComponentNode {\n let mountedNodes: Map<ComponentNode, EventSubscriptionCancellation> =\n viewOutletContainer.get('mounted-nodes');\n\n if (!mountedNodes) {\n mountedNodes = new Map<ComponentNode, EventSubscriptionCancellation>();\n viewOutletContainer.register('mounted-nodes', mountedNodes);\n }\n\n if (mountedNodes.has(this)) {\n if (process.env.NODE_ENV !== 'production') {\n Logger.error('Trying to mount an already mounted component node.', this);\n }\n return () => {};\n }\n\n /**\n * Dispatched when a node is mounted in a component.\n * This happens once for every `ViewOutlet`.\n */\n this.events.dispatch('components:node-mounted', { node: this });\n\n if (this.mountCount === 0) {\n this.mountCount = this.mountCount + 1;\n /**\n * Dispatched when a node is mounted in a component the first time.\n */\n this.events.dispatch('components:node-enter', { node: this });\n }\n\n return () => {\n mountedNodes.delete(this);\n this.events.dispatch('components:node-unmounted', { node: this });\n\n this.mountCount = this.mountCount - 1;\n if (this.mountCount === 0) {\n this.events.dispatch('components:node-exit', { node: this });\n }\n };\n }\n\n appendChild(node: ComponentNode, branch: string = 'default') {\n if (node.parent) {\n if (node.parent === this) {\n return;\n }\n node.parent.removeChild(node);\n }\n node.parent = this;\n\n if (!this.children[branch]) {\n this.children[branch] = [];\n }\n this.children[branch].push(node);\n\n this.events.dispatch('components:node-appended', { node });\n }\n\n prependChild(node: ComponentNode, branch: string = 'default') {\n if (node.parent) {\n if (node.parent === this) {\n return;\n }\n node.parent.removeChild(node);\n }\n node.parent = this;\n\n if (!this.children[branch]) {\n this.children[branch] = [];\n }\n this.children[branch].unshift(node);\n\n this.events.dispatch('components:node-appended', { node });\n }\n\n touchProperties(\n properties: ResolveComponentNodeProperties,\n options: ChangesetOptions = {},\n removable?: boolean\n ): RemoveChangeset {\n const attributes: Partial<ComponentNodeSettings> = { properties };\n const changeset: Changeset = [attributes, options];\n this.changesets.push(changeset);\n this.events.dispatch('components:set-properties', { node: this });\n return () => {\n if (removable) {\n const indexToRemove = this.changesets.indexOf(changeset);\n if (indexToRemove > -1) {\n this.changesets.splice(indexToRemove, 1);\n this.events.dispatch('components:set-properties', { node: this });\n }\n }\n };\n }\n\n writeProperties(\n properties: Partial<ComponentNodeProperties> | ResolveComponentNodeProperties,\n options: ChangesetOptions = {},\n removable?: boolean\n ): RemoveChangeset {\n const attributes: Partial<ComponentNodeSettings> = { properties };\n const changeset: Changeset = [attributes, options];\n this.changesets.push(changeset);\n this.events.dispatch('components:set-properties', { node: this });\n return () => {\n if (removable) {\n const indexToRemove = this.changesets.indexOf(changeset);\n if (indexToRemove > -1) {\n this.changesets.splice(indexToRemove, 1);\n this.events.dispatch('components:set-properties', { node: this });\n }\n }\n };\n }\n\n writeLayout(\n layout: Partial<ComponentNodeLayout> | ResolveComponentNodeLayout,\n options: ChangesetOptions = {},\n removable?: boolean\n ): RemoveChangeset {\n const attributes: Partial<ComponentNodeSettings> = { layout };\n const changeset: Changeset = [attributes, options];\n this.changesets.push(changeset);\n this.events.dispatch('components:set-layout', { node: this });\n return () => {\n if (!removable) {\n return;\n }\n const indexToRemove = this.changesets.indexOf(changeset);\n if (indexToRemove > -1) {\n this.changesets.splice(indexToRemove, 1);\n this.events.dispatch('components:set-layout', { node: this });\n }\n };\n }\n\n writeContext(\n context: Partial<ComponentNodeContext> | ResolveComponentNodeContext,\n options: ChangesetOptions = {},\n removable?: boolean\n ): RemoveChangeset {\n const attributes: Partial<ComponentNodeSettings> = { context };\n const changeset: Changeset = [attributes, options];\n this.changesets.push(changeset);\n this.events.dispatch('components:set-context', { node: this });\n return () => {\n if (!removable) {\n return;\n }\n const indexToRemove = this.changesets.indexOf(changeset);\n if (indexToRemove > -1) {\n this.changesets.splice(indexToRemove, 1);\n this.events.dispatch('components:set-context', { node: this });\n }\n };\n }\n\n getChildren(branch: string = 'default'): ComponentNode[] {\n const children = this.children[branch] || [];\n return children.reduce((acc, node, i) => {\n const { order: index = i } = node.attributes.layout;\n if (!acc[index]) {\n acc[index] = node;\n } else {\n acc.splice(index, 0, node);\n }\n return acc;\n }, Array(children.length));\n }\n\n remove() {\n if (this.parent) {\n this.parent.removeChild(this);\n }\n }\n\n removeChild(node: ComponentNode) {\n Object.keys(this.children).forEach((branch) => {\n const children = this.children[branch];\n const indexToRemove = children.indexOf(node);\n if (indexToRemove > -1) {\n children.splice(indexToRemove, 1);\n this.events.dispatch('components:node-removed', { node, parentNode: this });\n }\n });\n delete node.parent;\n }\n}\n","import { ComponentNode } from './component-node';\nimport { SwitchMap } from './component-platform';\n\nconst traverseComponentsRecursive = (\n nodes: ComponentNode[],\n switches: SwitchMap,\n fn: (node: ComponentNode) => boolean | void\n) => {\n for (let i = 0, y = nodes.length; i < y; i++) {\n if (fn(nodes[i]) === true) {\n break;\n }\n const branch = switches[nodes[i].id] || 'default';\n const children = nodes[i].getChildren(branch);\n traverseComponentsRecursive(children, switches, fn);\n }\n};\n\nexport const traverseComponents = (\n root: ComponentNode,\n switches: SwitchMap,\n fn: (node: ComponentNode) => boolean | void\n) => {\n if (fn(root) !== true) {\n const branch = switches[root.id] || 'default';\n const children = root.children[branch];\n traverseComponentsRecursive(children, switches, fn);\n }\n};\n\nexport const findVisibleComponents = (\n root: ComponentNode,\n switches: SwitchMap\n): ComponentNode[] => {\n const nodes: ComponentNode[] = [];\n traverseComponents(root, switches, (node) => {\n nodes.push(node);\n });\n return nodes;\n};\n\nexport const findComponent = (\n root: ComponentNode,\n switches: SwitchMap,\n fn: (node: ComponentNode) => boolean\n) => {\n let matched: ComponentNode | undefined;\n traverseComponents(root, switches, (node) => {\n if (fn(node)) {\n matched = node;\n return true;\n }\n });\n return matched;\n};\n\nexport const getAncestors = (node: ComponentNode) => {\n if (!node.parent) {\n return [];\n }\n const tree: ComponentNode[] = [];\n let currentNode: ComponentNode | undefined = node.parent;\n while (currentNode) {\n tree.unshift(currentNode);\n currentNode = currentNode.parent;\n }\n return tree;\n};\n","import { EventManager } from '@webprovisions/platform';\nimport { ComponentNode, ComponentNodeEventData } from './component-node';\nimport { SwitchMap } from './component-platform';\nimport { findComponent, findVisibleComponents, traverseComponents } from './queries';\n\nexport type QueryDescriptor = {\n id?: string;\n type?: string;\n name?: string;\n};\n\nexport class ComponentNodeCollection {\n all: ComponentNode[] = [];\n visible: ComponentNode[] = [];\n detached: ComponentNode[] = [];\n\n constructor(public root: ComponentNode, private switches: SwitchMap, events: EventManager) {\n events.subscribe('components:node-appended', (event, data: ComponentNodeEventData) => {\n this.all.push(data.node);\n this.visible = findVisibleComponents(root, switches);\n });\n events.subscribe('components:node-removed', (event, data: ComponentNodeEventData) => {\n let indexToRemove = this.all.indexOf(data.node);\n if (indexToRemove > -1) {\n this.all.splice(indexToRemove, 1);\n }\n indexToRemove = this.visible.indexOf(data.node);\n if (indexToRemove > -1) {\n this.visible.splice(indexToRemove, 1);\n }\n this.visible = findVisibleComponents(root, switches);\n });\n events.subscribe('components:node-switched', (event, data: ComponentNodeEventData) => {\n this.visible = findVisibleComponents(root, switches);\n });\n }\n\n query(query: QueryDescriptor = {}): ComponentNode[] {\n const nodes: ComponentNode[] = [];\n traverseComponents(this.root, this.switches, (node) => {\n const match = Object.keys(query).every((member) => {\n return (<any>query)[member] === (<any>node)[member];\n });\n if (match) {\n nodes.push(node);\n }\n });\n return nodes;\n }\n\n get(id: string) {\n return (\n findComponent(this.root, this.switches, (node) => node.id === id) ||\n this.detached.find((node) => node.id === id)\n );\n }\n}\n","import { ComponentReference, ComponentSettings, ViewDefinition } from '../types';\nimport { ComponentNode } from './component-node';\nimport { ComponentPlatform } from './component-platform';\nimport { NormalizedComponentReference } from './create-component-model';\n\nexport type CustomHandlerCallback = (\n ref: NormalizedComponentReference,\n options: {\n platform: ComponentPlatform;\n node: ComponentNode;\n references: ComponentReference[];\n definitions: { [name: string]: ComponentSettings };\n views: { [key: string]: ViewDefinition };\n branch?: string;\n }\n) => void;\n\nexport class CustomComponentHandler {\n private handlers = new Map<string, CustomHandlerCallback>();\n\n add(name: string, fn: CustomHandlerCallback) {\n this.handlers.set(name, fn);\n }\n\n get(name: string) {\n return this.handlers.get(name);\n }\n}\n","import { ComponentPlatform } from '.';\nimport { Breakpoints } from '../types';\nimport {\n ComponentNode,\n ResolveComponentNodeContext,\n ResolveComponentNodeLayout,\n ResolveComponentNodeProperties,\n} from './component-node';\n\nexport type ProcessOptions = {\n context?: boolean;\n properties?: boolean;\n layout?: boolean;\n recursive?: boolean;\n};\n\nexport type StateProcessor = (node: ComponentNode, options: ProcessOptions) => void;\n\nconst calculateNodeIndex = (node: ComponentNode): number => {\n let currentNode = node;\n let index = 0;\n\n while (currentNode.parent) {\n index = index + 1;\n currentNode = currentNode.parent;\n }\n\n return index;\n};\n\nconst sortQueue = (queue: [ComponentNode, ProcessOptions][]): [ComponentNode, ProcessOptions][] => {\n const mapped: [number, ComponentNode, ProcessOptions][] = queue.map(([node, options]) => {\n return [calculateNodeIndex(node), node, options];\n });\n return mapped\n .sort(([a], [b]) => a - b)\n .map(([, node, options]) => {\n return [node, options];\n });\n};\n\nconst isObject = (item: any) => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\nconst mergeDeep = (target: any, ...sources: any[]): any => {\n if (!sources.length) return target;\n const source = sources.shift();\n\n if (isObject(target) && isObject(source)) {\n for (const key in source) {\n if (isObject(source[key])) {\n if (!target[key]) Object.assign(target, { [key]: {} });\n mergeDeep(target[key], source[key]);\n } else {\n Object.assign(target, { [key]: source[key] });\n }\n }\n }\n return mergeDeep(target, ...sources);\n};\n\nconst matchesBreakpoint = (b1: Breakpoints | undefined, b2: string[]) => {\n if (!b1 || b1 === 'all') {\n return true;\n }\n return b1.some((b1) => b2.indexOf(b1) > -1);\n};\n\nexport type ProcessResult = Map<ComponentNode, ProcessOptions>;\n\nexport type ProcessReportCallback = (report: ProcessResult) => void;\n\nexport const createStateProcessor = (\n platform: ComponentPlatform,\n callback: ProcessReportCallback\n): StateProcessor => {\n let nodeQueue: ComponentNode[] = [];\n let optionsQueue: ProcessOptions[] = [];\n\n let timeout: NodeJS.Timeout;\n\n const flush = () => {\n if (process.env.NODE_ENV !== 'production') {\n console.time('state-processor.flush');\n }\n const processHistory: Map<ComponentNode, ProcessOptions> = new Map();\n const sortedQueue = sortQueue(nodeQueue.map((node, i) => [node, optionsQueue[i]]));\n\n const processNode = (node: ComponentNode, options: ProcessOptions) => {\n const history = processHistory.get(node) || {};\n\n // todo: this doesnt take overrides into account\n const processContext = options.context && !history.context;\n const processProperties = options.properties && !history.properties;\n const processLayout = options.layout && !history.layout;\n\n processHistory.set(node, {\n context: history.context || processContext,\n properties: history.properties || processProperties,\n layout: history.layout || processLayout,\n });\n\n if (processProperties) {\n node.attributes.properties = {};\n }\n if (processLayout) {\n node.attributes.layout = {};\n }\n\n if (processContext) {\n node.attributes.context = mergeDeep({}, node.parent?.attributes.context);\n }\n\n const propertyResolvers: ResolveComponentNodeProperties[] = [];\n const layoutResolvers: ResolveComponentNodeLayout[] = [];\n const contextResolvers: ResolveComponentNodeContext[] = [];\n\n node.changesets.forEach((changeset) => {\n const [change, options] = changeset;\n if (matchesBreakpoint(options.breakpoints, platform.breakpoints)) {\n if (processProperties) {\n if (typeof change.properties === 'function') {\n propertyResolvers.push(\n <ResolveComponentNodeProperties>change.properties\n );\n } else {\n mergeDeep(node.attributes.properties, change.properties);\n }\n }\n\n if (processLayout) {\n if (typeof change.layout === 'function') {\n layoutResolvers.push(<ResolveComponentNodeLayout>change.layout);\n } else {\n mergeDeep(node.attributes.layout, change.layout);\n }\n }\n\n if (processContext) {\n if (typeof change.context === 'function') {\n contextResolvers.push(<ResolveComponentNodeContext>change.context);\n } else {\n mergeDeep(node.attributes.context, change.context);\n }\n }\n }\n });\n\n propertyResolvers.forEach((resolver) => {\n mergeDeep(node.attributes.properties, resolver(node.attributes.properties));\n });\n\n layoutResolvers.forEach((resolver) => {\n mergeDeep(node.attributes.layout, resolver(node.attributes.layout));\n });\n\n contextResolvers.forEach((resolver) => {\n mergeDeep(node.attributes.context, resolver(node.attributes.context));\n });\n\n if (processContext || options.recursive) {\n const branch = platform.getBranch(node);\n const childOptions: ProcessOptions = options.recursive\n ? options\n : {\n context: !!processContext,\n };\n node.getChildren(branch).forEach((child) => {\n processNode(child, childOptions);\n });\n }\n };\n\n if (process.env.NODE_ENV !== 'production') {\n console.timeEnd('state-processor.flush');\n }\n\n sortedQueue.forEach(([node, options]) => {\n processNode(node, options);\n });\n\n nodeQueue = [];\n optionsQueue = [];\n\n callback(processHistory);\n };\n\n const schedule = () => {\n clearTimeout(timeout);\n timeout = setTimeout(flush, 0);\n };\n\n return (node, options) => {\n const index = nodeQueue.indexOf(node);\n\n if (index > -1) {\n // if node already exist in queue, update its options\n const summary = optionsQueue[index];\n if (options.context) {\n summary.context = true;\n }\n if (options.properties) {\n summary.properties = true;\n }\n if (options.layout) {\n summary.layout = true;\n }\n if (options.recursive) {\n summary.recursive = true;\n }\n return schedule();\n }\n\n nodeQueue.push(node);\n optionsQueue.push(options);\n\n return schedule();\n };\n};\n","import { uuid } from '@telia-ace/widget-utilities';\nimport {\n Container,\n EventManager,\n EventSubscriptionCancellation,\n Widget,\n} from '@webprovisions/platform';\nimport { ActionsController, ActionsState } from './actions-controller';\nimport { ChangesetProvider } from './changeset-provider';\nimport {\n Changeset,\n ChangesetOptions,\n ComponentNode,\n ComponentNodeEventData,\n ComponentNodeSettings,\n RemoveChangeset,\n} from './component-node';\nimport { ComponentNodeCollection } from './component-node-collection';\nimport { ComponentQuery } from './component-query';\nimport { CustomComponentHandler, CustomHandlerCallback } from './custom-component-handler';\nimport { createStateProcessor, StateProcessor } from './state-processor';\n\nexport type MergeOptions = { breakpoints?: string[] };\n\ntype AbstractChangesetRecord = {\n changeset: Changeset;\n target: ComponentQuery;\n removes: RemoveChangeset[];\n};\n\nexport type SwitchMap = { [id: string]: string };\n\nexport type ChangesetData = {\n key?: string;\n target: ComponentQuery;\n attributes: Partial<ComponentNodeSettings>;\n options?: ChangesetOptions;\n removable?: boolean;\n provider?: string;\n};\n\nexport class ComponentPlatform {\n events: EventManager;\n breakpoints: string[] = [];\n nodes: ComponentNodeCollection;\n // internal\n actionsState: ActionsState = { handlers: [], watchers: [] };\n\n private switches: SwitchMap = {};\n private changesets: AbstractChangesetRecord[] = [];\n private subscriptions: EventSubscriptionCancellation[] = [];\n private processNode: StateProcessor;\n private customComponentHandler = new CustomComponentHandler();\n\n constructor(widget: Widget, private providers: { [key: string]: ChangesetProvider } = {}) {\n this.events = widget.events.createChild(this);\n const root = new ComponentNode(this.events, 'root');\n root.name = `root-${widget.name}`;\n this.nodes = new ComponentNodeCollection(root, this.switches, this.events);\n\n const processNode = (this.processNode = createStateProcessor(this, (report) => {\n const nodes = Array.from(report.keys());\n if (process.env.NODE_ENV !== 'production') {\n console.info(`STATE PROCESSOR: ${nodes.length} node(s) processed:\n${nodes.map(\n (node) => `${node.name || '<no name>'} (${node.id})\n`\n)}`);\n }\n nodes.forEach((node) => {\n const options = report.get(node);\n if (node.parent && node.parent.type === 'root') {\n this.events.dispatch('components:root-children-changed', { node });\n }\n if (options?.context) {\n this.events.dispatch('components:context-changed', { node });\n }\n if (options?.properties) {\n this.events.dispatch('components:properties-changed', { node });\n }\n if (options?.layout) {\n this.events.dispatch('components:layout-changed', { node });\n }\n });\n this.events.dispatch('components:component-model-initialized', {}, { bubbles: true });\n }));\n\n Promise.all(\n Object.keys(providers).map((key) => {\n const provider = providers[key];\n return provider.load(this);\n })\n );\n\n this.subscriptions.push(\n this.events.subscribe(\n 'components:node-appended',\n (event, data: ComponentNodeEventData) => {\n const { node } = data;\n this.changesets.forEach((record) => {\n const { changeset, target, removes } = record;\n const [change, options] = changeset;\n if (target.match(data.node)) {\n if (change.properties) {\n removes.push(node.writeProperties(change.properties, options));\n }\n if (change.context) {\n removes.push(node.writeContext(change.context, options));\n }\n if (change.layout) {\n removes.push(node.writeLayout(change.layout, options));\n }\n }\n });\n }\n )\n );\n this.subscriptions.push(\n this.events.subscribe(\n 'components:node-appended',\n (event, data: ComponentNodeEventData) => {\n processNode(data.node, { properties: true, context: true });\n }\n )\n );\n this.subscriptions.push(\n this.events.subscribe(\n 'components:set-properties',\n (event, data: ComponentNodeEventData) => {\n processNode(data.node, { properties: true });\n }\n )\n );\n this.subscriptions.push(\n this.events.subscribe(\n 'components:set-context',\n (event, data: ComponentNodeEventData) => {\n processNode(data.node, { properties: true, context: true });\n }\n )\n );\n this.subscriptions.push(\n this.events.subscribe(\n 'components:set-indent',\n (event, data: ComponentNodeEventData) => {\n processNode(data.node, { layout: true });\n }\n )\n );\n this.subscriptions.push(\n this.events.subscribe(\n 'components:set-layout',\n (event, data: ComponentNodeEventData) => {\n processNode(data.node, { layout: true });\n }\n )\n );\n this.subscriptions.push(\n this.events.subscribe('components:node-switched', (event, { node, branch }) => {\n processNode(node, {\n layout: true,\n recursive: true,\n properties: true,\n context: true,\n });\n })\n );\n this.subscriptions.push(\n this.events.subscribe('components:node-removed', (event, { parentNode }) => {\n processNode(parentNode, { properties: true });\n })\n );\n\n if (this.events.parent) {\n this.events.parent.dispatch('components:platform-created', { platform: this });\n }\n }\n\n static getInstance(container: Container): Promise<ComponentPlatform> {\n return container.getAsync('components');\n }\n\n addBreakpoint(name: string) {\n if (this.breakpoints.indexOf(name) === -1) {\n this.breakpoints.push(name);\n this.processNode(this.nodes.root, {\n context: true,\n properties: true,\n layout: true,\n recursive: true,\n });\n }\n }\n\n removeBreakpoint(name: string) {\n const indexToRemove = this.breakpoints.indexOf(name);\n if (indexToRemove > -1) {\n this.breakpoints.splice(indexToRemove, 1);\n this.processNode(this.nodes.root, {\n context: true,\n properties: true,\n layout: true,\n recursive: true,\n });\n }\n }\n\n setSwitch(node: ComponentNode, branch: string) {\n this.switches[node.id] = branch;\n this.events.dispatch('components:node-switched', { node, branch });\n }\n\n getBranch(node: ComponentNode): string | undefined {\n return this.switches[node.id];\n }\n\n /**\n * Creates a `ComponentNode` of the specified type.\n * @param type Type of node.\n */\n createNode(type: string, options: { detached?: boolean } = {}): ComponentNode {\n const node = new ComponentNode(this.events, type);\n if (options.detached) {\n this.nodes.detached.push(node);\n }\n return node;\n }\n\n components(): ComponentQuery {\n return new ComponentQuery(this);\n }\n\n actions(target: ComponentQuery, ns: string): ActionsController {\n return new ActionsController(this, <any>target, ns);\n }\n\n write(data: ChangesetData): RemoveChangeset {\n const { provider: providerName, target, attributes, options = {}, removable } = data;\n const key = data.key || uuid();\n const changeset: Changeset = [attributes, options];\n const record: AbstractChangesetRecord = { changeset, target, removes: [] };\n if (providerName) {\n const provider = this.providers[providerName];\n provider.write(key, target, attributes, options);\n record.removes.push(() => {\n provider.remove(key);\n });\n }\n\n this.changesets.push(record);\n this.nodes.all.forEach((node) => {\n if (target.match(node)) {\n let remove: RemoveChangeset = () => {};\n if (attributes.properties) {\n remove = node.writeProperties(attributes.properties, options, removable);\n }\n if (attributes.context) {\n remove = node.writeContext(attributes.context, options, removable);\n }\n if (attributes.layout) {\n remove = node.writeContext(attributes.layout, options, removable);\n }\n record.removes.push(remove);\n }\n });\n return () => {\n if (removable) {\n record.removes.forEach((remove) => remove());\n const indexToRemove = this.changesets.indexOf(record);\n if (indexToRemove > -1) {\n this.changesets.splice(indexToRemove, 1);\n }\n }\n };\n }\n\n addComponentHandler(definitionType: string, fn: CustomHandlerCallback) {\n this.customComponentHandler.add(definitionType, fn);\n }\n\n getComponentHandler(definitionType: string) {\n return this.customComponentHandler.get(definitionType);\n }\n\n dispose() {\n this.subscriptions.forEach((sub) => sub());\n }\n}\n","import { Logger } from '@telia-ace/widget-utilities';\nimport { EventSubscriptionCancellation } from '@webprovisions/platform';\nimport { Breakpoints, ComponentSettings, ViewDefinition, WidgetSettings } from '../types';\nimport {\n ComponentNode,\n ComponentNodeContext,\n ComponentNodeLayout,\n ComponentNodeProperties,\n} from './component-node';\nimport { ComponentPlatform } from './component-platform';\n\ntype ComponentReference = string | [string, ...ComponentReferenceOverride[]];\n\ntype ComponentReferenceOverride = {\n breakpoints?: Breakpoints;\n tags?: string[];\n context?: ComponentNodeContext;\n properties?: ComponentNodeProperties;\n layout?: ComponentNodeLayout;\n};\n\nexport type NormalizedComponentReference = {\n definitionId: string;\n overrides: ComponentReferenceOverride[];\n};\n\nexport const normalizeReference = (reference: ComponentReference): NormalizedComponentReference => {\n if (Array.isArray(reference)) {\n const [definitionId, ...overrides] = reference;\n return {\n definitionId,\n overrides,\n };\n }\n return {\n definitionId: reference,\n overrides: [],\n };\n};\n\nexport type ComponentHandlerOptions = {\n platform: ComponentPlatform;\n node: ComponentNode;\n references: ComponentReference[];\n definitions: { [name: string]: ComponentSettings };\n views: { [key: string]: ViewDefinition };\n branch?: string;\n};\n\nexport const createChildren = (\n platform: ComponentPlatform,\n node: ComponentNode,\n references: ComponentReference[],\n definitions: { [name: string]: ComponentSettings },\n views: { [key: string]: ViewDefinition },\n branch?: string\n) => {\n references.forEach((ref) => {\n const childRef = normalizeReference(ref);\n const childDef = definitions[childRef.definitionId];\n if (childRef.definitionId === 'view') {\n const viewNode = platform.createNode('view');\n viewNode.name = 'view';\n Object.keys(views).forEach((key) => {\n const viewDef = views[key];\n createChildren(platform, viewNode, [viewDef.entry], definitions, views, key);\n });\n node.appendChild(viewNode);\n\n childRef.overrides.forEach((override) => {\n if (override.properties) {\n viewNode.writeProperties(override.properties, {\n breakpoints: override.breakpoints,\n });\n }\n if (override.context) {\n viewNode.writeContext(override.context, { breakpoints: override.breakpoints });\n }\n if (override.layout) {\n viewNode.writeLayout(override.layout, { breakpoints: override.breakpoints });\n }\n });\n } else if (platform.getComponentHandler(childDef.type)) {\n const handle = platform.getComponentHandler(childDef.type);\n if (handle) {\n handle(childRef, {\n platform,\n node,\n references,\n definitions,\n views,\n branch,\n });\n }\n } else {\n const childDef = definitions[childRef.definitionId];\n if (process.env.NODE_ENV !== 'production') {\n if (!childDef) {\n Logger.error(\n `No definition found for component type '${childRef.definitionId}'.`\n );\n return;\n }\n }\n const childNode = platform.createNode(childDef.type);\n childNode.name = childRef.definitionId;\n childNode.tags = childDef.tags || [];\n if (childDef.properties) {\n childNode.writeProperties(childDef.properties);\n }\n if (childDef.context) {\n childNode.writeContext(childDef.context);\n }\n if (childDef.layout) {\n childNode.writeLayout(childDef.layout);\n }\n node.appendChild(childNode, branch);\n\n childRef.overrides.forEach((override) => {\n const options = { breakpoints: override.breakpoints };\n if (override.properties) {\n childNode.writeProperties(override.properties, options);\n }\n if (override.context) {\n childNode.writeContext(override.context, options);\n }\n if (override.layout) {\n childNode.writeLayout(override.layout, options);\n }\n });\n\n if (childDef.children) {\n createChildren(platform, childNode, childDef.children, definitions, views);\n }\n }\n });\n};\n\nexport const createComponentModel = (\n platform: ComponentPlatform,\n settings: WidgetSettings\n): EventSubscriptionCancellation => {\n const { entry, components, breakpoints, views } = settings;\n const subscriptions: EventSubscriptionCancellation[] = [];\n\n Object.keys(breakpoints).forEach((name) => {\n const query = breakpoints[name];\n const list = window.matchMedia(query);\n if (list.matches) {\n platform.breakpoints.push(name);\n }\n const listener = (event: MediaQueryListEvent) => {\n if (event.matches) {\n platform.addBreakpoint(name);\n } else {\n platform.removeBreakpoint(name);\n }\n };\n list.addListener(listener);\n subscriptions.push(() => list.removeListener(listener));\n });\n\n createChildren(platform, platform.nodes.root, [entry], components, views);\n\n return () =>\n subscriptions.forEach((sub) => {\n sub();\n });\n};\n","import { ComponentNode } from './component-node';\n\nexport type ComponentDescriptor = {\n id: string;\n type?: string;\n name?: string;\n branch: string;\n};\n\nexport const asDescriptor = (node: ComponentNode, branch?: string): ComponentDescriptor => {\n return {\n id: node.id,\n type: node.type,\n name: node.name,\n branch: branch || 'default',\n };\n};\n","import { uuid } from '@telia-ace/widget-utilities';\nimport { Container, EventSubscriptionCancellation } from '@webprovisions/platform';\nimport { ComponentNodeController } from './component-controller';\nimport { ComponentNode } from './component-node';\nimport { ComponentPlatform } from './component-platform';\nimport { ComponentQuery } from './component-query';\n\nexport type ExtendComponentHandler = (controller: ComponentNodeController) => any;\n\nexport type ExtendComponentOptions = {\n reuseController?: boolean;\n};\n\nexport const extendComponent = (\n container: Container,\n typeOrQuery: string | ComponentQuery,\n handler: ExtendComponentHandler,\n ns: string = uuid(),\n options: ExtendComponentOptions = {}\n): Promise<void> => {\n return container.getAsync('components').then((components: ComponentPlatform) => {\n let target: ComponentQuery;\n if (typeof typeOrQuery === 'string') {\n const collection = new ComponentQuery(components);\n collection.ofType(typeOrQuery);\n target = collection;\n } else {\n target = typeOrQuery;\n }\n\n const managedInstances: {\n [instanceId: string]: {\n dispose: EventSubscriptionCancellation;\n controller: ComponentNodeController;\n };\n } = {};\n\n const getOrCreateController = (node: ComponentNode): Promise<ComponentNodeController> => {\n const existing = managedInstances[node.id];\n if (existing) {\n return Promise.resolve(existing.controller);\n }\n return ComponentPlatform.getInstance(container).then((platform) => {\n return new ComponentNodeController(platform, node, ns);\n });\n };\n\n components.events.subscribe(\n 'components:node-enter',\n (event, { node }: { node: ComponentNode }) => {\n if (target.match(node)) {\n getOrCreateController(node).then((controller) => {\n Promise.resolve(handler(controller)).then((dispose) => {\n managedInstances[node.id] = {\n dispose,\n controller,\n };\n });\n });\n }\n }\n );\n components.events.subscribe(\n 'components:node-exit',\n (event, { node }: { node: ComponentNode }) => {\n const instance = managedInstances[node.id];\n if (instance) {\n instance.dispose && instance.dispose();\n if (!options.reuseController) {\n instance.controller.dispose();\n delete managedInstances[node.id];\n }\n }\n }\n );\n });\n};\n","import { Logger } from '@telia-ace/widget-utilities';\nimport {\n Container,\n EventManager,\n EventSubscriptionCancellation,\n WidgetType,\n} from '@webprovisions/platform';\n\nexport type ReactComponent = any | null;\n\nexport default class ComponentResolver {\n aliases: Map<string, string> = new Map();\n components: Map<string, any> = new Map();\n events: EventManager;\n logger = new Logger();\n\n constructor(container: Container) {\n const { events }: WidgetType = container.get('$widget');\n this.events = events;\n }\n\n getComponent(key: string): ReactComponent {\n const alias = this.aliases.get(key);\n const component = this.components.get(alias || key) || null;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!component) {\n this.logger.warn(\n alias || key,\n `Unable to resolve component: \"${\n alias || key\n }\". You most likely forgot to register the required plugin for: ${\n alias || key\n }.`\n );\n }\n }\n\n return component;\n }\n\n registerComponent(key: string, component: ReactComponent): EventSubscriptionCancellation {\n this.components.set(key, component);\n\n this.events.dispatch('component-resolver:resolve', key);\n\n return () => {\n this.components.delete(key);\n };\n }\n\n registerResolver(\n key: string,\n fn: (component: ReactComponent) => void\n ): EventSubscriptionCancellation {\n return this.events.subscribe('component-resolver:resolve', (e, data: string) => {\n if (data === key) {\n const component = this.getComponent(key);\n fn(component);\n }\n });\n }\n\n registerAlias(alias: string, key: string): EventSubscriptionCancellation {\n this.aliases.set(alias, key);\n\n this.events.dispatch('component-resolver:resolve', alias);\n\n return () => {\n this.aliases.delete(alias);\n };\n }\n}\n","import { ComponentNodeLayout } from '../component-platform';\n\nexport type ComponentSettings = {\n type: string;\n context?: Context;\n properties?: Properties;\n layout?: ComponentNodeLayout;\n tags?: string[];\n children?: ComponentReference[];\n};\n\nenum HistoryMode {\n scopedHash = 'scopedHash',\n hash = 'hash',\n browser = 'browser',\n memory = 'memory',\n}\n\nexport type RoutingSettings = {\n initialPath: string;\n mode: HistoryMode;\n basePath?: string;\n};\n\nexport type ComponentReference = string | [string, ...ComponentReferenceOverride[]];\n\nexport type Properties = { [key: string]: any };\n\nexport type Context = { [key: string]: any };\n\nexport type ViewDefinition = {\n path: string | string[];\n entry: ComponentReference;\n};\n\nexport type Breakpoints = 'all' | string[];\n\nexport type ComponentReferenceOverride = {\n breakpoints?: Breakpoints;\n size?: number | 'full' | 'none';\n indent?: number;\n tags?: string[];\n context?: Context;\n properties?: Properties;\n};\n\nexport type ComponentDefinitionMap = {\n [name: string]: ComponentSettings;\n};\n\nexport type WidgetSettings = {\n data: { projection: string; site?: 'current' | 'referrer'; forceHttps?: boolean };\n components: ComponentDefinitionMap;\n entry: ComponentReference;\n breakpoints: { [name: string]: string };\n routing: RoutingSettings;\n views: { [name: string]: ViewDefinition };\n integrationResources: { path: string; mediaQueriesSupported: boolean }[];\n trigger?: { symbol?: Symbol; label?: string; action?: string };\n activate?: boolean | null;\n plugins?: { [key: string]: any };\n};\n\nexport type MinMax = {\n min: string;\n max: string;\n};\n\ntype Symbol = {\n type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;\n content: string;\n};\n\nexport enum WidgetRenderState {\n open = 'open',\n closed = 'closed',\n hidden = 'hidden',\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,MAAqB,eAAe;AAAA,EAGhC,YAAY,WAAsB;AAC9B,UAAM,EAAE,WAAmB,UAAU,IAAI,SAAS;AAC7C,SAAA,SAAS,OAAO,YAAY,IAAI;AAAA,EACzC;AAAA,EAEA,OAAO,QAAgB,QAAgB,OAAkB;AAChD,SAAA,OAAO,SAAS,eAAe,EAAE,QAAQ,OAAO,UAAU,EAAE,SAAS,KAAM,CAAA;AAAA,EACpF;AAAA,EAEA,UAAU,QAAgB,IAA2C;AACjE,WAAO,KAAK,OAAO,UACf,eACA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,OAAO,SAAS,8BAA8B,GAAG;AAEtD,WAAO,MAAM;AACJ,WAAA,WAAW,OAAO,GAAG;AAAA,IAAA;AAAA,EAElC;AAAA,EAEA,iBACI,KACA,IAC6B;AAC7B,WAAO,KAAK,OAAO,UAAU,8BAA8B,CAAC,GAAG,SAAiB;AAC5E,UAAI,SAAS,KAAK;AACR,cAAA,YAAY,KAAK,aAAa,GAAG;AACvC,WAAG,SAAS;AAAA,MAChB;AAAA,IAAA,CACH;AAAA,EACL;AAAA,EAEA,cAAc,OAAe,KAA4C;AAChE,SAAA,QAAQ,IAAI,OAAO,GAAG;AAEtB,SAAA,OAAO,SAAS,8BAA8B,KAAK;AAExD,WAAO,MAAM;AACJ,WAAA,QAAQ,OAAO,KAAK;AAAA,IAAA;AAAA,EAEjC;AACJ;ACCY,IAAA,sCAAA,uBAAL;AACI,qBAAA,UAAA;AACE,qBAAA,YAAA;AACA,qBAAA,YAAA;AAHD,SAAA;AAAA,GAAA,qBAAA,CAAA,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/action-resolver.ts","../src/event-subscriber.ts","../src/component-platform/component-query.ts","../src/component-platform/component-controller.ts","../src/component-platform/actions-controller.ts","../src/component-platform/component-configuration-api.ts","../src/component-platform/component-node.ts","../src/component-platform/queries.ts","../src/component-platform/component-node-collection.ts","../src/component-platform/custom-component-handler.ts","../src/component-platform/state-processor.ts","../src/component-platform/component-platform.ts","../src/component-platform/create-component-model.ts","../src/component-platform/descriptor.ts","../src/component-platform/extend-component.ts","../src/component-resolver.ts","../src/types/configuration.ts"],"sourcesContent":["import {\r\n Container,\r\n EventManager,\r\n EventSubscriptionCancellation,\r\n Widget,\r\n} from '@webprovisions/platform';\r\n\r\nexport type Action = (origin: string, action: string, value?: any) => void;\r\n\r\nexport default class ActionResolver {\r\n private events: EventManager;\r\n\r\n constructor(container: Container) {\r\n const { events }: Widget = container.get('$widget');\r\n this.events = events.createChild(this);\r\n }\r\n\r\n action(target: string, action: string, value: any): void {\r\n this.events.dispatch('data:action', { action, value, target }, { bubbles: true });\r\n }\r\n\r\n subscribe(origin: string, fn: Action): EventSubscriptionCancellation {\r\n return this.events.subscribe(\r\n 'data:action',\r\n (e, { action, value, target }) => origin === target && fn(origin, action, value)\r\n );\r\n }\r\n}\r\n","import {\r\n EventListener,\r\n EventManager,\r\n EventSubscriptionCancellation,\r\n} from '@webprovisions/platform';\r\n\r\nexport type SubscribeDelegate = (type: string, listener: EventListener) => void;\r\n\r\n/**\r\n * Creates s subscriber for the specified `EventManager` and provides a single cancellation\r\n * function for all registered subscriptions.\r\n */\r\nexport const createEventSubscriber = (\r\n events: EventManager\r\n): [SubscribeDelegate, EventSubscriptionCancellation] => {\r\n const subs: EventSubscriptionCancellation[] = [];\r\n\r\n const subscribe = (type: string, listener: EventListener) => {\r\n subs.push(events.subscribe(type, listener));\r\n };\r\n\r\n return [\r\n subscribe,\r\n () => {\r\n subs.forEach((sub) => {\r\n sub();\r\n });\r\n },\r\n ];\r\n};\r\n","import { AbstractComponentController } from './component-controller';\r\nimport { ComponentNode } from './component-node';\r\nimport { ComponentPlatform } from './component-platform';\r\n\r\nexport type ComponentQueryRule = {\r\n id?: string;\r\n type?: string;\r\n};\r\n\r\nexport class ComponentQuery {\r\n constructor(private platform: ComponentPlatform, public rules: ComponentQueryRule[] = []) {}\r\n\r\n match(node: ComponentNode) {\r\n return this.rules.every((rule) => {\r\n if (rule.id && rule.id !== node.id) {\r\n return false;\r\n }\r\n if (rule.type && rule.type !== node.type) {\r\n return false;\r\n }\r\n return true;\r\n });\r\n }\r\n\r\n ofType(type: string): ComponentQuery {\r\n this.rules.push({ type });\r\n return this;\r\n }\r\n\r\n withId(id: string): ComponentQuery {\r\n this.rules.push({ id });\r\n return this;\r\n }\r\n\r\n select(): AbstractComponentController {\r\n return new AbstractComponentController(this.platform, this);\r\n }\r\n}\r\n","import { EventSubscriptionCancellation } from '@webprovisions/platform';\r\nimport { createEventSubscriber, SubscribeDelegate } from '../event-subscriber';\r\nimport { ActionsController } from './actions-controller';\r\nimport {\r\n ChangesetOptions,\r\n ComponentNode,\r\n ComponentNodeContext,\r\n ComponentNodeLayout,\r\n ComponentNodeProperties,\r\n RemoveChangeset,\r\n} from './component-node';\r\nimport { ComponentPlatform } from './component-platform';\r\nimport { ComponentQuery } from './component-query';\r\n\r\nexport interface ComponentController {\r\n actions: ActionsController;\r\n\r\n writeProperties(properties: Partial<ComponentNodeProperties>, options: ChangesetOptions): void;\r\n\r\n writeContext(context: Partial<ComponentNodeContext>, options: ChangesetOptions): void;\r\n\r\n writeLayout(context: Partial<ComponentNodeLayout>, options: ChangesetOptions): void;\r\n\r\n dispose(): void;\r\n}\r\n\r\nexport class ComponentNodeController implements ComponentController {\r\n actions: ActionsController;\r\n\r\n private subscribe: SubscribeDelegate;\r\n private unsubscribe: EventSubscriptionCancellation;\r\n\r\n constructor(private platform: ComponentPlatform, public node: ComponentNode, ns?: string) {\r\n this.actions = new ActionsController(\r\n platform,\r\n new ComponentQuery(platform).withId(node.id),\r\n ns\r\n );\r\n const [subscribe, unsubscribe] = createEventSubscriber(this.platform.events);\r\n this.subscribe = subscribe;\r\n this.unsubscribe = unsubscribe;\r\n }\r\n\r\n properties<T extends ComponentNodeProperties>(\r\n updated?: (properties: T) => void | Partial<ComponentNodeProperties>\r\n ): T {\r\n if (updated) {\r\n this.node.touchProperties((properties) => updated(<T>properties));\r\n }\r\n return <T>this.node.attributes.properties;\r\n }\r\n\r\n context(updated?: (context: ComponentNodeContext) => void): ComponentNodeContext {\r\n if (updated) {\r\n this.subscribe('components:context-changed', (event, { node }) => {\r\n if (node === this.node) {\r\n updated(this.node.attributes.context);\r\n }\r\n });\r\n }\r\n return this.node.attributes.context;\r\n }\r\n\r\n layout(updated?: (layout: ComponentNodeLayout) => void): ComponentNodeLayout {\r\n if (updated) {\r\n this.subscribe('components:layout-changed', (event, { node }) => {\r\n if (node === this.node) {\r\n updated(this.node.attributes.layout);\r\n }\r\n });\r\n }\r\n return this.node.attributes.layout;\r\n }\r\n\r\n writeProperties(\r\n properties:\r\n | Partial<ComponentNodeProperties>\r\n | ((properties: ComponentNodeProperties) => Partial<ComponentNodeProperties>),\r\n options?: ChangesetOptions\r\n ): void {\r\n this.node.writeProperties(properties, options);\r\n }\r\n\r\n writeContext(context: Partial<ComponentNodeContext>, options?: ChangesetOptions): void {\r\n this.node.writeProperties(context, options);\r\n }\r\n\r\n writeLayout(layout: Partial<ComponentNodeLayout>, options?: ChangesetOptions): void {\r\n this.node.writeLayout(layout, options);\r\n }\r\n\r\n dispose() {\r\n this.unsubscribe();\r\n this.actions.dispose();\r\n }\r\n}\r\n\r\nexport class AbstractComponentController implements ComponentController {\r\n actions: ActionsController;\r\n private removes: RemoveChangeset[] = [];\r\n\r\n constructor(\r\n private platform: ComponentPlatform,\r\n private target: ComponentQuery,\r\n private clearOnDispose = true\r\n ) {\r\n this.actions = new ActionsController(this.platform, this.target);\r\n }\r\n\r\n writeProperties(\r\n properties: Partial<ComponentNodeProperties>,\r\n options?: ChangesetOptions\r\n ): void {\r\n this.removes.push(\r\n this.platform.write({\r\n options,\r\n attributes: { properties },\r\n target: this.target,\r\n removable: this.clearOnDispose,\r\n })\r\n );\r\n }\r\n\r\n writeContext(context: Partial<ComponentNodeContext>, options?: ChangesetOptions): void {\r\n this.removes.push(\r\n this.platform.write({\r\n options,\r\n attributes: { context },\r\n target: this.target,\r\n removable: this.clearOnDispose,\r\n })\r\n );\r\n }\r\n\r\n writeLayout(layout: Partial<ComponentNodeLayout>, options?: ChangesetOptions): void {\r\n this.removes.push(\r\n this.platform.write({\r\n options,\r\n attributes: { layout },\r\n target: this.target,\r\n removable: this.clearOnDispose,\r\n })\r\n );\r\n }\r\n\r\n dispose() {\r\n this.removes.forEach((remove) => {\r\n remove();\r\n });\r\n this.actions.dispose();\r\n }\r\n}\r\n","import { EventSubscriptionCancellation } from '@webprovisions/platform';\r\nimport { ComponentNodeController } from './component-controller';\r\nimport { ComponentNode } from './component-node';\r\nimport { ComponentPlatform } from './component-platform';\r\nimport { ComponentQuery } from './component-query';\r\n\r\nexport type ActionData = any;\r\n\r\nexport type ActionHandler = (data: any, options: any, instance: ComponentNodeController) => any;\r\nexport type NextActionDelegate = (data: any, options?: any) => Promise<any>;\r\nexport type WatchActionDelegate = (\r\n input: ActionData,\r\n next: NextActionDelegate,\r\n instance: ComponentNodeController\r\n) => Promise<any> | any;\r\nexport type ActionWatcherContext = {\r\n source: ComponentNode;\r\n action: string;\r\n};\r\n\r\nexport type ActionsState = {\r\n handlers: {\r\n fn: ActionHandler;\r\n key: string;\r\n target: ComponentQuery;\r\n ns?: string;\r\n }[];\r\n\r\n watchers: {\r\n target: ComponentQuery;\r\n fn: WatchActionDelegate;\r\n key: string;\r\n ns?: string;\r\n }[];\r\n};\r\n\r\ntype ActionWatcherExecutionResult = {\r\n data: any;\r\n options: any;\r\n cancelled: boolean;\r\n};\r\n\r\nconst executeActionListeners = (\r\n listeners: WatchActionDelegate[],\r\n data: any,\r\n controller: ComponentNodeController\r\n): Promise<ActionWatcherExecutionResult> => {\r\n const stack = listeners.concat();\r\n const dispatch = (\r\n data: any,\r\n globalOptions: any,\r\n controller: ComponentNodeController\r\n ): Promise<ActionWatcherExecutionResult> => {\r\n let cancelled = true;\r\n if (stack.length) {\r\n const handler = stack.shift() as WatchActionDelegate;\r\n\r\n const next = (data: any, options: any) => {\r\n cancelled = false;\r\n return dispatch(data, Object.assign({}, globalOptions, options), controller);\r\n };\r\n\r\n return Promise.resolve(handler(data, next, controller)).then((result) => ({\r\n ...result,\r\n cancelled,\r\n }));\r\n }\r\n\r\n return Promise.resolve({ data, cancelled: false, options: globalOptions });\r\n };\r\n return dispatch(data, {}, controller);\r\n};\r\n\r\nexport class ActionsController {\r\n private subscriptions: (() => void)[] = [];\r\n constructor(\r\n private platform: ComponentPlatform,\r\n private target: ComponentQuery,\r\n private ns?: string\r\n ) {\r\n this.create = this.create.bind(this);\r\n }\r\n\r\n create(key: string, fn: ActionHandler = () => {}): EventSubscriptionCancellation {\r\n const handler = {\r\n key,\r\n fn,\r\n target: this.target,\r\n ns: this.ns,\r\n };\r\n this.platform.actionsState.handlers.push(handler);\r\n const subscription = () => {\r\n const index = this.platform.actionsState.handlers.indexOf(handler);\r\n if (index > -1) {\r\n this.platform.actionsState.handlers.splice(index, 1);\r\n }\r\n };\r\n this.subscriptions.push(subscription);\r\n return subscription;\r\n }\r\n\r\n dispatch(key: string, data: any): Promise<{ [instanceId: string]: any }> {\r\n const instances: ComponentNode[] = this.platform.nodes.all.concat(\r\n this.platform.nodes.detached\r\n );\r\n\r\n const output: { [instanceId: string]: any } = {};\r\n\r\n // handlers matching the specified pattern.\r\n const handlers = this.platform.actionsState.handlers.filter(\r\n (handler) => handler.key === key && (!handler.ns || !this.ns || handler.ns === this.ns)\r\n );\r\n\r\n return Promise.all(\r\n handlers.map((handler) => {\r\n // select all matching instances for this particular\r\n // handler (a handler can be mapped to many instances)\r\n const matchedInstances = instances.filter(\r\n (instance) => handler.target.match(instance) && this.target.match(instance)\r\n );\r\n\r\n // execute watchers for each matched instance\r\n const watchers = this.platform.actionsState.watchers\r\n .filter((watcher) => {\r\n return (\r\n watcher.key === key &&\r\n (!watcher.ns || !this.ns || watcher.ns === this.ns) &&\r\n matchedInstances.some((instance) => watcher.target.match(instance))\r\n );\r\n })\r\n .map((watcher) => watcher.fn);\r\n\r\n // execute watchers and handler for each instance\r\n return Promise.all(\r\n matchedInstances.map((node) => {\r\n const controller = new ComponentNodeController(\r\n this.platform,\r\n node,\r\n this.ns\r\n );\r\n return executeActionListeners(watchers, data, controller).then((input) => {\r\n const { data = {}, options, cancelled } = input;\r\n return Promise.resolve(\r\n cancelled ? {} : handler.fn(data, options, controller)\r\n ).then((handlerResponse) => {\r\n output[node.id] = handlerResponse;\r\n });\r\n });\r\n })\r\n );\r\n })\r\n ).then(() => output);\r\n }\r\n\r\n watch(key: string, fn: WatchActionDelegate): EventSubscriptionCancellation {\r\n let parsedKey = key;\r\n let parsedNs = this.ns;\r\n const sections = key.split('.');\r\n\r\n if (sections.length > 1) {\r\n parsedNs = sections[0];\r\n parsedKey = sections.splice(1).join('.');\r\n }\r\n const watcher = {\r\n fn,\r\n target: this.target,\r\n key: parsedKey,\r\n ns: parsedNs,\r\n };\r\n this.platform.actionsState.watchers.push(watcher);\r\n const subscription = () => {\r\n const index = this.platform.actionsState.watchers.indexOf(watcher);\r\n if (index > -1) {\r\n this.platform.actionsState.watchers.splice(index, 1);\r\n }\r\n };\r\n this.subscriptions.push(subscription);\r\n return subscription;\r\n }\r\n\r\n dispose() {\r\n this.subscriptions.forEach((unsubscribe) => unsubscribe());\r\n }\r\n}\r\n","import { createConfigurationApi } from '@webprovisions/platform';\r\nimport { CustomHandlerCallback } from './custom-component-handler';\r\n\r\ntype Options = {\r\n handlers?: [string, CustomHandlerCallback][];\r\n};\r\n\r\nexport default createConfigurationApi((builder) => {\r\n builder.createCommand('components', (context) => (config: Options) => {\r\n context.events.subscribeOnce('components:platform-created', (event, { platform }) => {\r\n if (config.handlers) {\r\n config.handlers.forEach(([key, handler]) => {\r\n platform.addComponentHandler(key, handler);\r\n });\r\n }\r\n });\r\n });\r\n});\r\n","import { Logger, uuid } from '@telia-ace/widget-utilities';\r\nimport { Container, EventManager, EventSubscriptionCancellation } from '@webprovisions/platform';\r\nimport { Breakpoints } from '../types';\r\n\r\nexport type ComponentNodeEventData = { node: ComponentNode };\r\n\r\nexport type RemoveChangeset = () => void;\r\n\r\nexport type ComponentNodeAttributes = {\r\n tags: string[];\r\n properties: ComponentNodeProperties;\r\n context: ComponentNodeContext;\r\n layout: ComponentNodeLayout;\r\n};\r\n\r\nexport type ResolveComponentNodeProperties = (\r\n properties: ComponentNodeProperties\r\n) => Partial<ComponentNodeProperties> | void;\r\n\r\nexport type ResolveComponentNodeContext = (\r\n context: ComponentNodeContext\r\n) => Partial<ComponentNodeContext>;\r\n\r\nexport type ResolveComponentNodeLayout = (\r\n layout: ComponentNodeLayout\r\n) => Partial<ComponentNodeLayout>;\r\n\r\nexport type ComponentNodeSettings = {\r\n tags?: string[];\r\n properties?: ComponentNodeProperties | ResolveComponentNodeProperties;\r\n context?: ComponentNodeContext | ResolveComponentNodeContext;\r\n layout?: ComponentNodeLayout | ResolveComponentNodeLayout;\r\n};\r\n\r\nexport type ComponentNodeProperties = { [key: string]: any };\r\n\r\nexport type ComponentNodeContext = { [key: string]: any };\r\n\r\nexport type ComponentNodeLayout = {\r\n size?: Size;\r\n indent?: number;\r\n order?: number;\r\n};\r\n\r\nexport type Size = number | 'full' | 'none';\r\n\r\nexport type UnmountComponentNode = () => void;\r\n\r\nexport type ChangesetOptions = {\r\n breakpoints?: Breakpoints;\r\n};\r\n\r\nexport type Changeset = [Partial<ComponentNodeSettings>, ChangesetOptions];\r\n\r\nexport class ComponentNode {\r\n id: string;\r\n type: string;\r\n name?: string;\r\n parent?: ComponentNode;\r\n tags: string[] = [];\r\n children: { [key: string]: ComponentNode[] } = {};\r\n changesets: Changeset[] = [];\r\n attributes: ComponentNodeAttributes;\r\n\r\n private mountCount = 0;\r\n\r\n constructor(private events: EventManager, type: string) {\r\n this.id = uuid();\r\n this.type = type;\r\n this.attributes = {\r\n context: {},\r\n properties: {},\r\n layout: {},\r\n tags: [],\r\n };\r\n // write default attributes\r\n this.writeLayout({ size: 'full', indent: 0 });\r\n }\r\n\r\n mount(viewOutletContainer: Container, element?: HTMLElement): UnmountComponentNode {\r\n let mountedNodes: Map<ComponentNode, EventSubscriptionCancellation> =\r\n viewOutletContainer.get('mounted-nodes');\r\n\r\n if (!mountedNodes) {\r\n mountedNodes = new Map<ComponentNode, EventSubscriptionCancellation>();\r\n viewOutletContainer.register('mounted-nodes', mountedNodes);\r\n }\r\n\r\n if (mountedNodes.has(this)) {\r\n if (process.env.NODE_ENV !== 'production') {\r\n Logger.error('Trying to mount an already mounted component node.', this);\r\n }\r\n return () => {};\r\n }\r\n\r\n /**\r\n * Dispatched when a node is mounted in a component.\r\n * This happens once for every `ViewOutlet`.\r\n */\r\n this.events.dispatch('components:node-mounted', { node: this });\r\n\r\n if (this.mountCount === 0) {\r\n this.mountCount = this.mountCount + 1;\r\n /**\r\n * Dispatched when a node is mounted in a component the first time.\r\n */\r\n this.events.dispatch('components:node-enter', { node: this });\r\n }\r\n\r\n return () => {\r\n mountedNodes.delete(this);\r\n this.events.dispatch('components:node-unmounted', { node: this });\r\n\r\n this.mountCount = this.mountCount - 1;\r\n if (this.mountCount === 0) {\r\n this.events.dispatch('components:node-exit', { node: this });\r\n }\r\n };\r\n }\r\n\r\n appendChild(node: ComponentNode, branch: string = 'default') {\r\n if (node.parent) {\r\n if (node.parent === this) {\r\n return;\r\n }\r\n node.parent.removeChild(node);\r\n }\r\n node.parent = this;\r\n\r\n if (!this.children[branch]) {\r\n this.children[branch] = [];\r\n }\r\n this.children[branch].push(node);\r\n\r\n this.events.dispatch('components:node-appended', { node });\r\n }\r\n\r\n prependChild(node: ComponentNode, branch: string = 'default') {\r\n if (node.parent) {\r\n if (node.parent === this) {\r\n return;\r\n }\r\n node.parent.removeChild(node);\r\n }\r\n node.parent = this;\r\n\r\n if (!this.children[branch]) {\r\n this.children[branch] = [];\r\n }\r\n this.children[branch].unshift(node);\r\n\r\n this.events.dispatch('components:node-appended', { node });\r\n }\r\n\r\n touchProperties(\r\n properties: ResolveComponentNodeProperties,\r\n options: ChangesetOptions = {},\r\n removable?: boolean\r\n ): RemoveChangeset {\r\n const attributes: Partial<ComponentNodeSettings> = { properties };\r\n const changeset: Changeset = [attributes, options];\r\n this.changesets.push(changeset);\r\n this.events.dispatch('components:set-properties', { node: this });\r\n return () => {\r\n if (removable) {\r\n const indexToRemove = this.changesets.indexOf(changeset);\r\n if (indexToRemove > -1) {\r\n this.changesets.splice(indexToRemove, 1);\r\n this.events.dispatch('components:set-properties', { node: this });\r\n }\r\n }\r\n };\r\n }\r\n\r\n writeProperties(\r\n properties: Partial<ComponentNodeProperties> | ResolveComponentNodeProperties,\r\n options: ChangesetOptions = {},\r\n removable?: boolean\r\n ): RemoveChangeset {\r\n const attributes: Partial<ComponentNodeSettings> = { properties };\r\n const changeset: Changeset = [attributes, options];\r\n this.changesets.push(changeset);\r\n this.events.dispatch('components:set-properties', { node: this });\r\n return () => {\r\n if (removable) {\r\n const indexToRemove = this.changesets.indexOf(changeset);\r\n if (indexToRemove > -1) {\r\n this.changesets.splice(indexToRemove, 1);\r\n this.events.dispatch('components:set-properties', { node: this });\r\n }\r\n }\r\n };\r\n }\r\n\r\n writeLayout(\r\n layout: Partial<ComponentNodeLayout> | ResolveComponentNodeLayout,\r\n options: ChangesetOptions = {},\r\n removable?: boolean\r\n ): RemoveChangeset {\r\n const attributes: Partial<ComponentNodeSettings> = { layout };\r\n const changeset: Changeset = [attributes, options];\r\n this.changesets.push(changeset);\r\n this.events.dispatch('components:set-layout', { node: this });\r\n return () => {\r\n if (!removable) {\r\n return;\r\n }\r\n const indexToRemove = this.changesets.indexOf(changeset);\r\n if (indexToRemove > -1) {\r\n this.changesets.splice(indexToRemove, 1);\r\n this.events.dispatch('components:set-layout', { node: this });\r\n }\r\n };\r\n }\r\n\r\n writeContext(\r\n context: Partial<ComponentNodeContext> | ResolveComponentNodeContext,\r\n options: ChangesetOptions = {},\r\n removable?: boolean\r\n ): RemoveChangeset {\r\n const attributes: Partial<ComponentNodeSettings> = { context };\r\n const changeset: Changeset = [attributes, options];\r\n this.changesets.push(changeset);\r\n this.events.dispatch('components:set-context', { node: this });\r\n return () => {\r\n if (!removable) {\r\n return;\r\n }\r\n const indexToRemove = this.changesets.indexOf(changeset);\r\n if (indexToRemove > -1) {\r\n this.changesets.splice(indexToRemove, 1);\r\n this.events.dispatch('components:set-context', { node: this });\r\n }\r\n };\r\n }\r\n\r\n getChildren(branch: string = 'default'): ComponentNode[] {\r\n const children = this.children[branch] || [];\r\n return children.reduce((acc, node, i) => {\r\n const { order: index = i } = node.attributes.layout;\r\n if (!acc[index]) {\r\n acc[index] = node;\r\n } else {\r\n acc.splice(index, 0, node);\r\n }\r\n return acc;\r\n }, Array(children.length));\r\n }\r\n\r\n remove() {\r\n if (this.parent) {\r\n this.parent.removeChild(this);\r\n }\r\n }\r\n\r\n removeChild(node: ComponentNode) {\r\n Object.keys(this.children).forEach((branch) => {\r\n const children = this.children[branch];\r\n const indexToRemove = children.indexOf(node);\r\n if (indexToRemove > -1) {\r\n children.splice(indexToRemove, 1);\r\n this.events.dispatch('components:node-removed', { node, parentNode: this });\r\n }\r\n });\r\n delete node.parent;\r\n }\r\n}\r\n","import { ComponentNode } from './component-node';\r\nimport { SwitchMap } from './component-platform';\r\n\r\nconst traverseComponentsRecursive = (\r\n nodes: ComponentNode[],\r\n switches: SwitchMap,\r\n fn: (node: ComponentNode) => boolean | void\r\n) => {\r\n for (let i = 0, y = nodes.length; i < y; i++) {\r\n if (fn(nodes[i]) === true) {\r\n break;\r\n }\r\n const branch = switches[nodes[i].id] || 'default';\r\n const children = nodes[i].getChildren(branch);\r\n traverseComponentsRecursive(children, switches, fn);\r\n }\r\n};\r\n\r\nexport const traverseComponents = (\r\n root: ComponentNode,\r\n switches: SwitchMap,\r\n fn: (node: ComponentNode) => boolean | void\r\n) => {\r\n if (fn(root) !== true) {\r\n const branch = switches[root.id] || 'default';\r\n const children = root.children[branch];\r\n traverseComponentsRecursive(children, switches, fn);\r\n }\r\n};\r\n\r\nexport const findVisibleComponents = (\r\n root: ComponentNode,\r\n switches: SwitchMap\r\n): ComponentNode[] => {\r\n const nodes: ComponentNode[] = [];\r\n traverseComponents(root, switches, (node) => {\r\n nodes.push(node);\r\n });\r\n return nodes;\r\n};\r\n\r\nexport const findComponent = (\r\n root: ComponentNode,\r\n switches: SwitchMap,\r\n fn: (node: ComponentNode) => boolean\r\n) => {\r\n let matched: ComponentNode | undefined;\r\n traverseComponents(root, switches, (node) => {\r\n if (fn(node)) {\r\n matched = node;\r\n return true;\r\n }\r\n });\r\n return matched;\r\n};\r\n\r\nexport const getAncestors = (node: ComponentNode) => {\r\n if (!node.parent) {\r\n return [];\r\n }\r\n const tree: ComponentNode[] = [];\r\n let currentNode: ComponentNode | undefined = node.parent;\r\n while (currentNode) {\r\n tree.unshift(currentNode);\r\n currentNode = currentNode.parent;\r\n }\r\n return tree;\r\n};\r\n","import { EventManager } from '@webprovisions/platform';\r\nimport { ComponentNode, ComponentNodeEventData } from './component-node';\r\nimport { SwitchMap } from './component-platform';\r\nimport { findComponent, findVisibleComponents, traverseComponents } from './queries';\r\n\r\nexport type QueryDescriptor = {\r\n id?: string;\r\n type?: string;\r\n name?: string;\r\n};\r\n\r\nexport class ComponentNodeCollection {\r\n all: ComponentNode[] = [];\r\n visible: ComponentNode[] = [];\r\n detached: ComponentNode[] = [];\r\n\r\n constructor(public root: ComponentNode, private switches: SwitchMap, events: EventManager) {\r\n events.subscribe('components:node-appended', (event, data: ComponentNodeEventData) => {\r\n this.all.push(data.node);\r\n this.visible = findVisibleComponents(root, switches);\r\n });\r\n events.subscribe('components:node-removed', (event, data: ComponentNodeEventData) => {\r\n let indexToRemove = this.all.indexOf(data.node);\r\n if (indexToRemove > -1) {\r\n this.all.splice(indexToRemove, 1);\r\n }\r\n indexToRemove = this.visible.indexOf(data.node);\r\n if (indexToRemove > -1) {\r\n this.visible.splice(indexToRemove, 1);\r\n }\r\n this.visible = findVisibleComponents(root, switches);\r\n });\r\n events.subscribe('components:node-switched', (event, data: ComponentNodeEventData) => {\r\n this.visible = findVisibleComponents(root, switches);\r\n });\r\n }\r\n\r\n query(query: QueryDescriptor = {}): ComponentNode[] {\r\n const nodes: ComponentNode[] = [];\r\n traverseComponents(this.root, this.switches, (node) => {\r\n const match = Object.keys(query).every((member) => {\r\n return (<any>query)[member] === (<any>node)[member];\r\n });\r\n if (match) {\r\n nodes.push(node);\r\n }\r\n });\r\n return nodes;\r\n }\r\n\r\n get(id: string) {\r\n return (\r\n findComponent(this.root, this.switches, (node) => node.id === id) ||\r\n this.detached.find((node) => node.id === id)\r\n );\r\n }\r\n}\r\n","import { ComponentReference, ComponentSettings, ViewDefinition } from '../types';\r\nimport { ComponentNode } from './component-node';\r\nimport { ComponentPlatform } from './component-platform';\r\nimport { NormalizedComponentReference } from './create-component-model';\r\n\r\nexport type CustomHandlerCallback = (\r\n ref: NormalizedComponentReference,\r\n options: {\r\n platform: ComponentPlatform;\r\n node: ComponentNode;\r\n references: ComponentReference[];\r\n definitions: { [name: string]: ComponentSettings };\r\n views: { [key: string]: ViewDefinition };\r\n branch?: string;\r\n }\r\n) => void;\r\n\r\nexport class CustomComponentHandler {\r\n private handlers = new Map<string, CustomHandlerCallback>();\r\n\r\n add(name: string, fn: CustomHandlerCallback) {\r\n this.handlers.set(name, fn);\r\n }\r\n\r\n get(name: string) {\r\n return this.handlers.get(name);\r\n }\r\n}\r\n","import { ComponentPlatform } from '.';\r\nimport { Breakpoints } from '../types';\r\nimport {\r\n ComponentNode,\r\n ResolveComponentNodeContext,\r\n ResolveComponentNodeLayout,\r\n ResolveComponentNodeProperties,\r\n} from './component-node';\r\n\r\nexport type ProcessOptions = {\r\n context?: boolean;\r\n properties?: boolean;\r\n layout?: boolean;\r\n recursive?: boolean;\r\n};\r\n\r\nexport type StateProcessor = (node: ComponentNode, options: ProcessOptions) => void;\r\n\r\nconst calculateNodeIndex = (node: ComponentNode): number => {\r\n let currentNode = node;\r\n let index = 0;\r\n\r\n while (currentNode.parent) {\r\n index = index + 1;\r\n currentNode = currentNode.parent;\r\n }\r\n\r\n return index;\r\n};\r\n\r\nconst sortQueue = (queue: [ComponentNode, ProcessOptions][]): [ComponentNode, ProcessOptions][] => {\r\n const mapped: [number, ComponentNode, ProcessOptions][] = queue.map(([node, options]) => {\r\n return [calculateNodeIndex(node), node, options];\r\n });\r\n return mapped\r\n .sort(([a], [b]) => a - b)\r\n .map(([, node, options]) => {\r\n return [node, options];\r\n });\r\n};\r\n\r\nconst isObject = (item: any) => {\r\n return item && typeof item === 'object' && !Array.isArray(item);\r\n};\r\n\r\nconst mergeDeep = (target: any, ...sources: any[]): any => {\r\n if (!sources.length) return target;\r\n const source = sources.shift();\r\n\r\n if (isObject(target) && isObject(source)) {\r\n for (const key in source) {\r\n if (isObject(source[key])) {\r\n if (!target[key]) Object.assign(target, { [key]: {} });\r\n mergeDeep(target[key], source[key]);\r\n } else {\r\n Object.assign(target, { [key]: source[key] });\r\n }\r\n }\r\n }\r\n return mergeDeep(target, ...sources);\r\n};\r\n\r\nconst matchesBreakpoint = (b1: Breakpoints | undefined, b2: string[]) => {\r\n if (!b1 || b1 === 'all') {\r\n return true;\r\n }\r\n return b1.some((b1) => b2.indexOf(b1) > -1);\r\n};\r\n\r\nexport type ProcessResult = Map<ComponentNode, ProcessOptions>;\r\n\r\nexport type ProcessReportCallback = (report: ProcessResult) => void;\r\n\r\nexport const createStateProcessor = (\r\n platform: ComponentPlatform,\r\n callback: ProcessReportCallback\r\n): StateProcessor => {\r\n let nodeQueue: ComponentNode[] = [];\r\n let optionsQueue: ProcessOptions[] = [];\r\n\r\n let timeout: NodeJS.Timeout;\r\n\r\n const flush = () => {\r\n if (process.env.NODE_ENV !== 'production') {\r\n console.time('state-processor.flush');\r\n }\r\n const processHistory: Map<ComponentNode, ProcessOptions> = new Map();\r\n const sortedQueue = sortQueue(nodeQueue.map((node, i) => [node, optionsQueue[i]]));\r\n\r\n const processNode = (node: ComponentNode, options: ProcessOptions) => {\r\n const history = processHistory.get(node) || {};\r\n\r\n // todo: this doesnt take overrides into account\r\n const processContext = options.context && !history.context;\r\n const processProperties = options.properties && !history.properties;\r\n const processLayout = options.layout && !history.layout;\r\n\r\n processHistory.set(node, {\r\n context: history.context || processContext,\r\n properties: history.properties || processProperties,\r\n layout: history.layout || processLayout,\r\n });\r\n\r\n if (processProperties) {\r\n node.attributes.properties = {};\r\n }\r\n if (processLayout) {\r\n node.attributes.layout = {};\r\n }\r\n\r\n if (processContext) {\r\n node.attributes.context = mergeDeep({}, node.parent?.attributes.context);\r\n }\r\n\r\n const propertyResolvers: ResolveComponentNodeProperties[] = [];\r\n const layoutResolvers: ResolveComponentNodeLayout[] = [];\r\n const contextResolvers: ResolveComponentNodeContext[] = [];\r\n\r\n node.changesets.forEach((changeset) => {\r\n const [change, options] = changeset;\r\n if (matchesBreakpoint(options.breakpoints, platform.breakpoints)) {\r\n if (processProperties) {\r\n if (typeof change.properties === 'function') {\r\n propertyResolvers.push(\r\n <ResolveComponentNodeProperties>change.properties\r\n );\r\n } else {\r\n mergeDeep(node.attributes.properties, change.properties);\r\n }\r\n }\r\n\r\n if (processLayout) {\r\n if (typeof change.layout === 'function') {\r\n layoutResolvers.push(<ResolveComponentNodeLayout>change.layout);\r\n } else {\r\n mergeDeep(node.attributes.layout, change.layout);\r\n }\r\n }\r\n\r\n if (processContext) {\r\n if (typeof change.context === 'function') {\r\n contextResolvers.push(<ResolveComponentNodeContext>change.context);\r\n } else {\r\n mergeDeep(node.attributes.context, change.context);\r\n }\r\n }\r\n }\r\n });\r\n\r\n propertyResolvers.forEach((resolver) => {\r\n mergeDeep(node.attributes.properties, resolver(node.attributes.properties));\r\n });\r\n\r\n layoutResolvers.forEach((resolver) => {\r\n mergeDeep(node.attributes.layout, resolver(node.attributes.layout));\r\n });\r\n\r\n contextResolvers.forEach((resolver) => {\r\n mergeDeep(node.attributes.context, resolver(node.attributes.context));\r\n });\r\n\r\n if (processContext || options.recursive) {\r\n const branch = platform.getBranch(node);\r\n const childOptions: ProcessOptions = options.recursive\r\n ? options\r\n : {\r\n context: !!processContext,\r\n };\r\n node.getChildren(branch).forEach((child) => {\r\n processNode(child, childOptions);\r\n });\r\n }\r\n };\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n console.timeEnd('state-processor.flush');\r\n }\r\n\r\n sortedQueue.forEach(([node, options]) => {\r\n processNode(node, options);\r\n });\r\n\r\n nodeQueue = [];\r\n optionsQueue = [];\r\n\r\n callback(processHistory);\r\n };\r\n\r\n const schedule = () => {\r\n clearTimeout(timeout);\r\n timeout = setTimeout(flush, 0);\r\n };\r\n\r\n return (node, options) => {\r\n const index = nodeQueue.indexOf(node);\r\n\r\n if (index > -1) {\r\n // if node already exist in queue, update its options\r\n const summary = optionsQueue[index];\r\n if (options.context) {\r\n summary.context = true;\r\n }\r\n if (options.properties) {\r\n summary.properties = true;\r\n }\r\n if (options.layout) {\r\n summary.layout = true;\r\n }\r\n if (options.recursive) {\r\n summary.recursive = true;\r\n }\r\n return schedule();\r\n }\r\n\r\n nodeQueue.push(node);\r\n optionsQueue.push(options);\r\n\r\n return schedule();\r\n };\r\n};\r\n","import { uuid } from '@telia-ace/widget-utilities';\r\nimport {\r\n Container,\r\n EventManager,\r\n EventSubscriptionCancellation,\r\n Widget,\r\n} from '@webprovisions/platform';\r\nimport { ActionsController, ActionsState } from './actions-controller';\r\nimport { ChangesetProvider } from './changeset-provider';\r\nimport {\r\n Changeset,\r\n ChangesetOptions,\r\n ComponentNode,\r\n ComponentNodeEventData,\r\n ComponentNodeSettings,\r\n RemoveChangeset,\r\n} from './component-node';\r\nimport { ComponentNodeCollection } from './component-node-collection';\r\nimport { ComponentQuery } from './component-query';\r\nimport { CustomComponentHandler, CustomHandlerCallback } from './custom-component-handler';\r\nimport { createStateProcessor, StateProcessor } from './state-processor';\r\n\r\nexport type MergeOptions = { breakpoints?: string[] };\r\n\r\ntype AbstractChangesetRecord = {\r\n changeset: Changeset;\r\n target: ComponentQuery;\r\n removes: RemoveChangeset[];\r\n};\r\n\r\nexport type SwitchMap = { [id: string]: string };\r\n\r\nexport type ChangesetData = {\r\n key?: string;\r\n target: ComponentQuery;\r\n attributes: Partial<ComponentNodeSettings>;\r\n options?: ChangesetOptions;\r\n removable?: boolean;\r\n provider?: string;\r\n};\r\n\r\nexport class ComponentPlatform {\r\n events: EventManager;\r\n breakpoints: string[] = [];\r\n nodes: ComponentNodeCollection;\r\n // internal\r\n actionsState: ActionsState = { handlers: [], watchers: [] };\r\n\r\n private switches: SwitchMap = {};\r\n private changesets: AbstractChangesetRecord[] = [];\r\n private subscriptions: EventSubscriptionCancellation[] = [];\r\n private processNode: StateProcessor;\r\n private customComponentHandler = new CustomComponentHandler();\r\n\r\n constructor(widget: Widget, private providers: { [key: string]: ChangesetProvider } = {}) {\r\n this.events = widget.events.createChild(this);\r\n const root = new ComponentNode(this.events, 'root');\r\n root.name = `root-${widget.name}`;\r\n this.nodes = new ComponentNodeCollection(root, this.switches, this.events);\r\n\r\n const processNode = (this.processNode = createStateProcessor(this, (report) => {\r\n const nodes = Array.from(report.keys());\r\n if (process.env.NODE_ENV !== 'production') {\r\n console.info(`STATE PROCESSOR: ${nodes.length} node(s) processed:\r\n${nodes.map(\r\n (node) => `${node.name || '<no name>'} (${node.id})\r\n`\r\n)}`);\r\n }\r\n nodes.forEach((node) => {\r\n const options = report.get(node);\r\n if (node.parent && node.parent.type === 'root') {\r\n this.events.dispatch('components:root-children-changed', { node });\r\n }\r\n if (options?.context) {\r\n this.events.dispatch('components:context-changed', { node });\r\n }\r\n if (options?.properties) {\r\n this.events.dispatch('components:properties-changed', { node });\r\n }\r\n if (options?.layout) {\r\n this.events.dispatch('components:layout-changed', { node });\r\n }\r\n });\r\n this.events.dispatch('components:component-model-initialized', {}, { bubbles: true });\r\n }));\r\n\r\n Promise.all(\r\n Object.keys(providers).map((key) => {\r\n const provider = providers[key];\r\n return provider.load(this);\r\n })\r\n );\r\n\r\n this.subscriptions.push(\r\n this.events.subscribe(\r\n 'components:node-appended',\r\n (event, data: ComponentNodeEventData) => {\r\n const { node } = data;\r\n this.changesets.forEach((record) => {\r\n const { changeset, target, removes } = record;\r\n const [change, options] = changeset;\r\n if (target.match(data.node)) {\r\n if (change.properties) {\r\n removes.push(node.writeProperties(change.properties, options));\r\n }\r\n if (change.context) {\r\n removes.push(node.writeContext(change.context, options));\r\n }\r\n if (change.layout) {\r\n removes.push(node.writeLayout(change.layout, options));\r\n }\r\n }\r\n });\r\n }\r\n )\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe(\r\n 'components:node-appended',\r\n (event, data: ComponentNodeEventData) => {\r\n processNode(data.node, { properties: true, context: true });\r\n }\r\n )\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe(\r\n 'components:set-properties',\r\n (event, data: ComponentNodeEventData) => {\r\n processNode(data.node, { properties: true });\r\n }\r\n )\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe(\r\n 'components:set-context',\r\n (event, data: ComponentNodeEventData) => {\r\n processNode(data.node, { properties: true, context: true });\r\n }\r\n )\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe(\r\n 'components:set-indent',\r\n (event, data: ComponentNodeEventData) => {\r\n processNode(data.node, { layout: true });\r\n }\r\n )\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe(\r\n 'components:set-layout',\r\n (event, data: ComponentNodeEventData) => {\r\n processNode(data.node, { layout: true });\r\n }\r\n )\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe('components:node-switched', (event, { node, branch }) => {\r\n processNode(node, {\r\n layout: true,\r\n recursive: true,\r\n properties: true,\r\n context: true,\r\n });\r\n })\r\n );\r\n this.subscriptions.push(\r\n this.events.subscribe('components:node-removed', (event, { parentNode }) => {\r\n processNode(parentNode, { properties: true });\r\n })\r\n );\r\n\r\n if (this.events.parent) {\r\n this.events.parent.dispatch('components:platform-created', { platform: this });\r\n }\r\n }\r\n\r\n static getInstance(container: Container): Promise<ComponentPlatform> {\r\n return container.getAsync('components');\r\n }\r\n\r\n addBreakpoint(name: string) {\r\n if (this.breakpoints.indexOf(name) === -1) {\r\n this.breakpoints.push(name);\r\n this.processNode(this.nodes.root, {\r\n context: true,\r\n properties: true,\r\n layout: true,\r\n recursive: true,\r\n });\r\n }\r\n }\r\n\r\n removeBreakpoint(name: string) {\r\n const indexToRemove = this.breakpoints.indexOf(name);\r\n if (indexToRemove > -1) {\r\n this.breakpoints.splice(indexToRemove, 1);\r\n this.processNode(this.nodes.root, {\r\n context: true,\r\n properties: true,\r\n layout: true,\r\n recursive: true,\r\n });\r\n }\r\n }\r\n\r\n setSwitch(node: ComponentNode, branch: string) {\r\n this.switches[node.id] = branch;\r\n this.events.dispatch('components:node-switched', { node, branch });\r\n }\r\n\r\n getBranch(node: ComponentNode): string | undefined {\r\n return this.switches[node.id];\r\n }\r\n\r\n /**\r\n * Creates a `ComponentNode` of the specified type.\r\n * @param type Type of node.\r\n */\r\n createNode(type: string, options: { detached?: boolean } = {}): ComponentNode {\r\n const node = new ComponentNode(this.events, type);\r\n if (options.detached) {\r\n this.nodes.detached.push(node);\r\n }\r\n return node;\r\n }\r\n\r\n components(): ComponentQuery {\r\n return new ComponentQuery(this);\r\n }\r\n\r\n actions(target: ComponentQuery, ns: string): ActionsController {\r\n return new ActionsController(this, <any>target, ns);\r\n }\r\n\r\n write(data: ChangesetData): RemoveChangeset {\r\n const { provider: providerName, target, attributes, options = {}, removable } = data;\r\n const key = data.key || uuid();\r\n const changeset: Changeset = [attributes, options];\r\n const record: AbstractChangesetRecord = { changeset, target, removes: [] };\r\n if (providerName) {\r\n const provider = this.providers[providerName];\r\n provider.write(key, target, attributes, options);\r\n record.removes.push(() => {\r\n provider.remove(key);\r\n });\r\n }\r\n\r\n this.changesets.push(record);\r\n this.nodes.all.forEach((node) => {\r\n if (target.match(node)) {\r\n let remove: RemoveChangeset = () => {};\r\n if (attributes.properties) {\r\n remove = node.writeProperties(attributes.properties, options, removable);\r\n }\r\n if (attributes.context) {\r\n remove = node.writeContext(attributes.context, options, removable);\r\n }\r\n if (attributes.layout) {\r\n remove = node.writeContext(attributes.layout, options, removable);\r\n }\r\n record.removes.push(remove);\r\n }\r\n });\r\n return () => {\r\n if (removable) {\r\n record.removes.forEach((remove) => remove());\r\n const indexToRemove = this.changesets.indexOf(record);\r\n if (indexToRemove > -1) {\r\n this.changesets.splice(indexToRemove, 1);\r\n }\r\n }\r\n };\r\n }\r\n\r\n addComponentHandler(definitionType: string, fn: CustomHandlerCallback) {\r\n this.customComponentHandler.add(definitionType, fn);\r\n }\r\n\r\n getComponentHandler(definitionType: string) {\r\n return this.customComponentHandler.get(definitionType);\r\n }\r\n\r\n dispose() {\r\n this.subscriptions.forEach((sub) => sub());\r\n }\r\n}\r\n","import { Logger } from '@telia-ace/widget-utilities';\r\nimport { EventSubscriptionCancellation } from '@webprovisions/platform';\r\nimport { Breakpoints, ComponentSettings, ViewDefinition, WidgetSettings } from '../types';\r\nimport {\r\n ComponentNode,\r\n ComponentNodeContext,\r\n ComponentNodeLayout,\r\n ComponentNodeProperties,\r\n} from './component-node';\r\nimport { ComponentPlatform } from './component-platform';\r\n\r\ntype ComponentReference = string | [string, ...ComponentReferenceOverride[]];\r\n\r\ntype ComponentReferenceOverride = {\r\n breakpoints?: Breakpoints;\r\n tags?: string[];\r\n context?: ComponentNodeContext;\r\n properties?: ComponentNodeProperties;\r\n layout?: ComponentNodeLayout;\r\n};\r\n\r\nexport type NormalizedComponentReference = {\r\n definitionId: string;\r\n overrides: ComponentReferenceOverride[];\r\n};\r\n\r\nexport const normalizeReference = (reference: ComponentReference): NormalizedComponentReference => {\r\n if (Array.isArray(reference)) {\r\n const [definitionId, ...overrides] = reference;\r\n return {\r\n definitionId,\r\n overrides,\r\n };\r\n }\r\n return {\r\n definitionId: reference,\r\n overrides: [],\r\n };\r\n};\r\n\r\nexport type ComponentHandlerOptions = {\r\n platform: ComponentPlatform;\r\n node: ComponentNode;\r\n references: ComponentReference[];\r\n definitions: { [name: string]: ComponentSettings };\r\n views: { [key: string]: ViewDefinition };\r\n branch?: string;\r\n};\r\n\r\nexport const createChildren = (\r\n platform: ComponentPlatform,\r\n node: ComponentNode,\r\n references: ComponentReference[],\r\n definitions: { [name: string]: ComponentSettings },\r\n views: { [key: string]: ViewDefinition },\r\n branch?: string\r\n) => {\r\n references.forEach((ref) => {\r\n const childRef = normalizeReference(ref);\r\n const childDef = definitions[childRef.definitionId];\r\n if (childRef.definitionId === 'view') {\r\n const viewNode = platform.createNode('view');\r\n viewNode.name = 'view';\r\n Object.keys(views).forEach((key) => {\r\n const viewDef = views[key];\r\n createChildren(platform, viewNode, [viewDef.entry], definitions, views, key);\r\n });\r\n node.appendChild(viewNode);\r\n\r\n childRef.overrides.forEach((override) => {\r\n if (override.properties) {\r\n viewNode.writeProperties(override.properties, {\r\n breakpoints: override.breakpoints,\r\n });\r\n }\r\n if (override.context) {\r\n viewNode.writeContext(override.context, { breakpoints: override.breakpoints });\r\n }\r\n if (override.layout) {\r\n viewNode.writeLayout(override.layout, { breakpoints: override.breakpoints });\r\n }\r\n });\r\n } else if (platform.getComponentHandler(childDef.type)) {\r\n const handle = platform.getComponentHandler(childDef.type);\r\n if (handle) {\r\n handle(childRef, {\r\n platform,\r\n node,\r\n references,\r\n definitions,\r\n views,\r\n branch,\r\n });\r\n }\r\n } else {\r\n const childDef = definitions[childRef.definitionId];\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (!childDef) {\r\n Logger.error(\r\n `No definition found for component type '${childRef.definitionId}'.`\r\n );\r\n return;\r\n }\r\n }\r\n const childNode = platform.createNode(childDef.type);\r\n childNode.name = childRef.definitionId;\r\n childNode.tags = childDef.tags || [];\r\n if (childDef.properties) {\r\n childNode.writeProperties(childDef.properties);\r\n }\r\n if (childDef.context) {\r\n childNode.writeContext(childDef.context);\r\n }\r\n if (childDef.layout) {\r\n childNode.writeLayout(childDef.layout);\r\n }\r\n node.appendChild(childNode, branch);\r\n\r\n childRef.overrides.forEach((override) => {\r\n const options = { breakpoints: override.breakpoints };\r\n if (override.properties) {\r\n childNode.writeProperties(override.properties, options);\r\n }\r\n if (override.context) {\r\n childNode.writeContext(override.context, options);\r\n }\r\n if (override.layout) {\r\n childNode.writeLayout(override.layout, options);\r\n }\r\n });\r\n\r\n if (childDef.children) {\r\n createChildren(platform, childNode, childDef.children, definitions, views);\r\n }\r\n }\r\n });\r\n};\r\n\r\nexport const createComponentModel = (\r\n platform: ComponentPlatform,\r\n settings: WidgetSettings\r\n): EventSubscriptionCancellation => {\r\n const { entry, components, breakpoints, views } = settings;\r\n const subscriptions: EventSubscriptionCancellation[] = [];\r\n\r\n Object.keys(breakpoints).forEach((name) => {\r\n const query = breakpoints[name];\r\n const list = window.matchMedia(query);\r\n if (list.matches) {\r\n platform.breakpoints.push(name);\r\n }\r\n const listener = (event: MediaQueryListEvent) => {\r\n if (event.matches) {\r\n platform.addBreakpoint(name);\r\n } else {\r\n platform.removeBreakpoint(name);\r\n }\r\n };\r\n list.addListener(listener);\r\n subscriptions.push(() => list.removeListener(listener));\r\n });\r\n\r\n createChildren(platform, platform.nodes.root, [entry], components, views);\r\n\r\n return () =>\r\n subscriptions.forEach((sub) => {\r\n sub();\r\n });\r\n};\r\n","import { ComponentNode } from './component-node';\r\n\r\nexport type ComponentDescriptor = {\r\n id: string;\r\n type?: string;\r\n name?: string;\r\n branch: string;\r\n};\r\n\r\nexport const asDescriptor = (node: ComponentNode, branch?: string): ComponentDescriptor => {\r\n return {\r\n id: node.id,\r\n type: node.type,\r\n name: node.name,\r\n branch: branch || 'default',\r\n };\r\n};\r\n","import { uuid } from '@telia-ace/widget-utilities';\r\nimport { Container, EventSubscriptionCancellation } from '@webprovisions/platform';\r\nimport { ComponentNodeController } from './component-controller';\r\nimport { ComponentNode } from './component-node';\r\nimport { ComponentPlatform } from './component-platform';\r\nimport { ComponentQuery } from './component-query';\r\n\r\nexport type ExtendComponentHandler = (controller: ComponentNodeController) => any;\r\n\r\nexport type ExtendComponentOptions = {\r\n reuseController?: boolean;\r\n};\r\n\r\nexport const extendComponent = (\r\n container: Container,\r\n typeOrQuery: string | ComponentQuery,\r\n handler: ExtendComponentHandler,\r\n ns: string = uuid(),\r\n options: ExtendComponentOptions = {}\r\n): Promise<void> => {\r\n return container.getAsync('components').then((components: ComponentPlatform) => {\r\n let target: ComponentQuery;\r\n if (typeof typeOrQuery === 'string') {\r\n const collection = new ComponentQuery(components);\r\n collection.ofType(typeOrQuery);\r\n target = collection;\r\n } else {\r\n target = typeOrQuery;\r\n }\r\n\r\n const managedInstances: {\r\n [instanceId: string]: {\r\n dispose: EventSubscriptionCancellation;\r\n controller: ComponentNodeController;\r\n };\r\n } = {};\r\n\r\n const getOrCreateController = (node: ComponentNode): Promise<ComponentNodeController> => {\r\n const existing = managedInstances[node.id];\r\n if (existing) {\r\n return Promise.resolve(existing.controller);\r\n }\r\n return ComponentPlatform.getInstance(container).then((platform) => {\r\n return new ComponentNodeController(platform, node, ns);\r\n });\r\n };\r\n\r\n components.events.subscribe(\r\n 'components:node-enter',\r\n (event, { node }: { node: ComponentNode }) => {\r\n if (target.match(node)) {\r\n getOrCreateController(node).then((controller) => {\r\n Promise.resolve(handler(controller)).then((dispose) => {\r\n managedInstances[node.id] = {\r\n dispose,\r\n controller,\r\n };\r\n });\r\n });\r\n }\r\n }\r\n );\r\n components.events.subscribe(\r\n 'components:node-exit',\r\n (event, { node }: { node: ComponentNode }) => {\r\n const instance = managedInstances[node.id];\r\n if (instance) {\r\n instance.dispose && instance.dispose();\r\n if (!options.reuseController) {\r\n instance.controller.dispose();\r\n delete managedInstances[node.id];\r\n }\r\n }\r\n }\r\n );\r\n });\r\n};\r\n","import { Logger } from '@telia-ace/widget-utilities';\r\nimport {\r\n Container,\r\n EventManager,\r\n EventSubscriptionCancellation,\r\n WidgetType,\r\n} from '@webprovisions/platform';\r\n\r\nexport type ReactComponent = any | null;\r\n\r\nexport default class ComponentResolver {\r\n aliases: Map<string, string> = new Map();\r\n components: Map<string, any> = new Map();\r\n events: EventManager;\r\n logger = new Logger();\r\n\r\n constructor(container: Container) {\r\n const { events }: WidgetType = container.get('$widget');\r\n this.events = events;\r\n }\r\n\r\n getComponent(key: string): ReactComponent {\r\n const alias = this.aliases.get(key);\r\n const component = this.components.get(alias || key) || null;\r\n\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (!component) {\r\n this.logger.warn(\r\n alias || key,\r\n `Unable to resolve component: \"${\r\n alias || key\r\n }\". You most likely forgot to register the required plugin for: ${\r\n alias || key\r\n }.`\r\n );\r\n }\r\n }\r\n\r\n return component;\r\n }\r\n\r\n registerComponent(key: string, component: ReactComponent): EventSubscriptionCancellation {\r\n this.components.set(key, component);\r\n\r\n this.events.dispatch('component-resolver:resolve', key);\r\n\r\n return () => {\r\n this.components.delete(key);\r\n };\r\n }\r\n\r\n registerResolver(\r\n key: string,\r\n fn: (component: ReactComponent) => void\r\n ): EventSubscriptionCancellation {\r\n return this.events.subscribe('component-resolver:resolve', (e, data: string) => {\r\n if (data === key) {\r\n const component = this.getComponent(key);\r\n fn(component);\r\n }\r\n });\r\n }\r\n\r\n registerAlias(alias: string, key: string): EventSubscriptionCancellation {\r\n this.aliases.set(alias, key);\r\n\r\n this.events.dispatch('component-resolver:resolve', alias);\r\n\r\n return () => {\r\n this.aliases.delete(alias);\r\n };\r\n }\r\n}\r\n","import { ComponentNodeLayout } from '../component-platform';\r\n\r\nexport type ComponentSettings = {\r\n type: string;\r\n context?: Context;\r\n properties?: Properties;\r\n layout?: ComponentNodeLayout;\r\n tags?: string[];\r\n children?: ComponentReference[];\r\n};\r\n\r\nenum HistoryMode {\r\n scopedHash = 'scopedHash',\r\n hash = 'hash',\r\n browser = 'browser',\r\n memory = 'memory',\r\n}\r\n\r\nexport type RoutingSettings = {\r\n initialPath: string;\r\n mode: HistoryMode;\r\n basePath?: string;\r\n};\r\n\r\nexport type ComponentReference = string | [string, ...ComponentReferenceOverride[]];\r\n\r\nexport type Properties = { [key: string]: any };\r\n\r\nexport type Context = { [key: string]: any };\r\n\r\nexport type ViewDefinition = {\r\n path: string | string[];\r\n entry: ComponentReference;\r\n};\r\n\r\nexport type Breakpoints = 'all' | string[];\r\n\r\nexport type ComponentReferenceOverride = {\r\n breakpoints?: Breakpoints;\r\n size?: number | 'full' | 'none';\r\n indent?: number;\r\n tags?: string[];\r\n context?: Context;\r\n properties?: Properties;\r\n};\r\n\r\nexport type ComponentDefinitionMap = {\r\n [name: string]: ComponentSettings;\r\n};\r\n\r\nexport type WidgetSettings = {\r\n data: { projection: string; site?: 'current' | 'referrer'; forceHttps?: boolean };\r\n components: ComponentDefinitionMap;\r\n entry: ComponentReference;\r\n breakpoints: { [name: string]: string };\r\n routing: RoutingSettings;\r\n views: { [name: string]: ViewDefinition };\r\n integrationResources: { path: string; mediaQueriesSupported: boolean }[];\r\n trigger?: { symbol?: Symbol; label?: string; action?: string };\r\n activate?: boolean | null;\r\n plugins?: { [key: string]: any };\r\n};\r\n\r\nexport type MinMax = {\r\n min: string;\r\n max: string;\r\n};\r\n\r\ntype Symbol = {\r\n type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;\r\n content: string;\r\n};\r\n\r\nexport enum WidgetRenderState {\r\n open = 'open',\r\n closed = 'closed',\r\n hidden = 'hidden',\r\n}\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,MAAqB,eAAe;AAAA,EAGhC,YAAY,WAAsB;AAC9B,UAAM,EAAE,WAAmB,UAAU,IAAI,SAAS;AAC7C,SAAA,SAAS,OAAO,YAAY,IAAI;AAAA,EACzC;AAAA,EAEA,OAAO,QAAgB,QAAgB,OAAkB;AAChD,SAAA,OAAO,SAAS,eAAe,EAAE,QAAQ,OAAO,UAAU,EAAE,SAAS,KAAM,CAAA;AAAA,EACpF;AAAA,EAEA,UAAU,QAAgB,IAA2C;AACjE,WAAO,KAAK,OAAO,UACf,eACA,CAAC,GAAG,EAAE,QAAQ,OAAO,aAAa,WAAW,UAAU,GAAG,QAAQ,QAAQ,KAAK,CACnF;AAAA,EACJ;AACJ;ACfa,MAAA,wBAAwB,CACjC,WACqD;AACrD,QAAM,OAAwC,CAAA;AAExC,QAAA,YAAY,CAAC,MAAc,aAA4B;AACzD,SAAK,KAAK,OAAO,UAAU,MAAM,QAAQ,CAAC;AAAA,EAAA;AAGvC,SAAA;AAAA,IACH;AAAA,IACA,MAAM;AACG,WAAA,QAAQ,CAAC,QAAQ;AACd;MAAA,CACP;AAAA,IACL;AAAA,EAAA;AAER;ACpBO,MAAM,eAAe;AAAA,EACxB,YAAoB,UAAoC,QAA8B,IAAI;AAAtE,SAAA,WAAA;AAAoC,SAAA,QAAA;AAAA,EAAmC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