@telia-ace/widget-core 1.0.26-next.4 → 1.0.26-next.6

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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/action-resolver.ts","../src/bootstrap.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/version.ts","../src/environment.ts","../src/implementation.ts","../src/plugin.ts","../src/types/configuration.ts","../src/widget-type.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 { bootstrapImplementation, BootstrappedImplementation } from '@webprovisions/bootstrapping';\nimport { ConfigureCallback, selectImplementations } from '@webprovisions/platform';\nimport Implementation from './implementation';\n\nexport type BootstrapOptions = {\n /**\n * Resolver function for the root element to base the bootstrapping on.\n */\n rootElementResolver?: () => HTMLElement;\n};\n\n/**\n * Bootstraps an `Implementation` by scanning trigger elements and attaches them to\n * their corresponding widgets.\n */\nexport default (\n implementation: Implementation,\n configure: ConfigureCallback,\n options: BootstrapOptions = {}\n): Promise<BootstrappedImplementation> => {\n return bootstrapImplementation(\n implementation as any,\n implementation.bindings,\n () => {\n const runtimeConfigurationHandlers = implementation.container\n .get('$runtimecfg')\n .map((cfgHandlerArgs: any) => {\n const fnOrSelector = cfgHandlerArgs[0];\n if (typeof fnOrSelector === 'function') {\n return fnOrSelector;\n }\n if (selectImplementations(fnOrSelector)(implementation)) {\n return cfgHandlerArgs[1];\n }\n })\n .filter((handler: any) => !!handler);\n return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);\n },\n options.rootElementResolver || (() => document.body)\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 if (item instanceof Date) {\n return false;\n }\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","export default '#____version____#';\n","import {\n BootstrappedImplementationConfiguration,\n ConfigurationApi as BootstrappingConfigurationApi,\n} from '@webprovisions/bootstrapping';\nimport {\n ConfigurationApiDefinition,\n Environment as EnvironmentBase,\n version as webprovisionsVersion,\n WidgetSelector,\n} from '@webprovisions/platform';\nimport Implementation from './implementation';\nimport version from './version';\n\nexport interface RuntimeConfiguration {\n /**\n * Extensions for the configuration API (optional).\n */\n configurationApiExtensions?: ConfigurationApiDefinition[];\n}\n\n/**\n * The widget runtime.\n */\nexport default class Environment extends EnvironmentBase {\n /**\n * Version of the widget runtime.\n */\n static version: string = `${version} (${webprovisionsVersion})`;\n\n constructor(name: string, configurationApiExtensions: ConfigurationApiDefinition[] = []) {\n super(name, configurationApiExtensions, {\n transformPluginSettings: (settings, name, container) => {\n const $settings = container.get('$settings');\n const configPluginSettings =\n $settings.plugins && name ? $settings.plugins[name] || {} : {};\n return {\n ...configPluginSettings,\n ...settings,\n };\n },\n });\n }\n\n createImplementation(configuration: BootstrappedImplementationConfiguration): Implementation {\n const implementation = <Implementation>super.createImplementation(configuration);\n implementation.bindings = configuration.bindings;\n return implementation;\n }\n\n /**\n * Performs navigation for widgets matching the specified selector by invoking a\n * 'navigate' command.\n * @param selector Widget selector matching the widget(s) to perform navigation on.\n * @param route Route name.\n * @param params Route params.\n */\n navigate(selector: WidgetSelector, route: string, params: { [key: string]: string }) {\n this.widgets\n .query(selector)\n .forEach((widget) => widget.invoke('navigate', { route, params }));\n }\n\n /**\n * Creates a runtime based on provided configuration.\n * @param configuration Runtime configuration.\n */\n static create(configuration: RuntimeConfiguration = {}): Environment {\n const configurationApiExtensions = [BootstrappingConfigurationApi].concat(\n (configuration.configurationApiExtensions as any) || []\n );\n return new Environment('humany', configurationApiExtensions as any);\n }\n\n /**\n * Creates a widget runtime based on provided configuration and retains configuration handlers\n * registered on global context. Use this factory to fully support the default embed script.\n * Will return any existing widget runtime if available.\n * @param configuration Runtime configuration.\n * @param global Object to read configuration handlers from (default: window).\n */\n static createFromGlobal(\n globalInstance: any,\n configuration: RuntimeConfiguration = {}\n ): Environment {\n if (this.isRuntime(globalInstance)) {\n (globalInstance as Environment).patch(configuration);\n return globalInstance;\n }\n\n const runtimeConfiguration: any[] = [];\n\n const tempRuntimeConfiguration = globalInstance && globalInstance._c;\n if (tempRuntimeConfiguration) {\n tempRuntimeConfiguration.forEach((args: any) => runtimeConfiguration.push(args));\n }\n\n const runtime = this.create(configuration);\n runtime.container.register('$runtimecfg', runtimeConfiguration);\n return runtime;\n }\n\n /**\n * Determines whether the specified object is a valid widget runtime.\n * @param obj Object to compare.\n */\n static isRuntime(obj: any): boolean {\n if (\n obj &&\n typeof obj === 'object' &&\n obj.container &&\n typeof obj.container.get === 'function' &&\n obj.container.get('$environment') === obj &&\n obj.container.owner === obj\n ) {\n return true;\n }\n return false;\n }\n}\n","import { Implementation as ImplementationBase } from '@webprovisions/platform';\n\n/**\n * Represents an implementation.\n */\nexport default class Implementation extends ImplementationBase {\n bindings: string[] = [];\n}\n","import { Container, Plugin as PluginBase } from '@webprovisions/platform';\n\n/**\n * Base class for a widget plugin.\n */\nexport default class Plugin extends PluginBase {\n constructor(container: Container, settings?: any) {\n super(container, settings);\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","import { Container, WidgetType as WidgetTypeBase } from '@webprovisions/platform';\n\n/**\n * Base class for a widget.\n */\nexport default class WidgetType extends WidgetTypeBase {\n constructor(container: Container) {\n super(container);\n }\n}\n"],"names":["ActionResolver","container","__publicField","events","target","action","value","origin","fn","e","bootstrap","implementation","configure","options","bootstrapImplementation","runtimeConfigurationHandlers","cfgHandlerArgs","fnOrSelector","selectImplementations","handler","createEventSubscriber","subs","type","listener","sub","ComponentQuery","platform","rules","node","rule","id","AbstractComponentController","ComponentNodeController","ns","ActionsController","subscribe","unsubscribe","updated","properties","event","context","layout","clearOnDispose","remove","executeActionListeners","listeners","data","controller","stack","dispatch","globalOptions","cancelled","next","result","__spreadProps","__spreadValues","key","subscription","index","instances","output","handlers","matchedInstances","instance","watchers","watcher","input","handlerResponse","parsedKey","parsedNs","sections","componentConfigurationApi","createConfigurationApi","builder","config","ComponentNode","uuid","viewOutletContainer","element","mountedNodes","Logger","branch","removable","changeset","indexToRemove","children","acc","i","traverseComponentsRecursive","nodes","switches","y","traverseComponents","root","findVisibleComponents","findComponent","matched","ComponentNodeCollection","query","member","CustomComponentHandler","name","calculateNodeIndex","currentNode","sortQueue","queue","a","b","isObject","item","mergeDeep","sources","source","matchesBreakpoint","b1","b2","createStateProcessor","callback","nodeQueue","optionsQueue","timeout","flush","processHistory","sortedQueue","processNode","history","processContext","processProperties","processLayout","_a","propertyResolvers","layoutResolvers","contextResolvers","change","resolver","childOptions","child","schedule","summary","ComponentPlatform","widget","providers","report","record","removes","parentNode","providerName","attributes","provider","definitionType","normalizeReference","reference","definitionId","overrides","createChildren","references","definitions","views","ref","childRef","childDef","viewNode","viewDef","override","handle","childNode","createComponentModel","settings","entry","components","breakpoints","subscriptions","list","asDescriptor","extendComponent","typeOrQuery","collection","managedInstances","getOrCreateController","existing","dispose","ComponentResolver","alias","component","version","_Environment","EnvironmentBase","configurationApiExtensions","$settings","configPluginSettings","configuration","selector","route","params","BootstrappingConfigurationApi","globalInstance","runtimeConfiguration","tempRuntimeConfiguration","args","runtime","obj","Environment","webprovisionsVersion","Implementation","ImplementationBase","Plugin","PluginBase","WidgetRenderState","WidgetType","WidgetTypeBase"],"mappings":";;;;;;;;;;;;;;;;AASA,MAAqBA,GAAe;AAAA,EAGhC,YAAYC,GAAsB;AAF1B,IAAAC,EAAA;AAGJ,UAAM,EAAE,QAAAC,EAAmB,IAAAF,EAAU,IAAI,SAAS;AAC7C,SAAA,SAASE,EAAO,YAAY,IAAI;AAAA,EACzC;AAAA,EAEA,OAAOC,GAAgBC,GAAgBC,GAAkB;AAChD,SAAA,OAAO,SAAS,eAAe,EAAE,QAAAD,GAAQ,OAAAC,GAAO,QAAAF,KAAU,EAAE,SAAS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YACfA,EAAI,aACJ,OAAOA,EAAI,UAAU,OAAQ,cAC7BA,EAAI,UAAU,IAAI,cAAc,MAAMA,KACtCA,EAAI,UAAU,UAAUA;AAAA,EAKhC;AACJ;AA/FA,IAAqBC,IAArBhB;AAIIvL,EAJiBuM,GAIV,WAAkB,GAAGjB,OAAYkB;ACtB5C,MAAqBC,WAAuBC,EAAmB;AAAA,EAA/D;AAAA;AACI,IAAA1M,EAAA,kBAAqB,CAAA;AAAA;AACzB;ACFA,MAAqB2M,WAAeC,GAAW;AAAA,EAC3C,YAAY7M,GAAsBsK,GAAgB;AAC9C,UAAMtK,GAAWsK,CAAQ;AAAA,EAC7B;AACJ;ACgEY,IAAAwC,uBAAAA,OACRA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,SAAS,UAHDA,IAAAA,MAAA,CAAA,CAAA;ACpEZ,MAAqBC,WAAmBC,GAAe;AAAA,EACnD,YAAYhN,GAAsB;AAC9B,UAAMA,CAAS;AAAA,EACnB;AACJ;"}
1
+ {"version":3,"file":"index.js","sources":["../src/action-resolver.ts","../src/bootstrap.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/version.ts","../src/environment.ts","../src/implementation.ts","../src/plugin.ts","../src/types/configuration.ts","../src/widget-type.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 { bootstrapImplementation, BootstrappedImplementation } from '@webprovisions/bootstrapping';\nimport { ConfigureCallback, selectImplementations } from '@webprovisions/platform';\nimport Implementation from './implementation';\n\nexport type BootstrapOptions = {\n /**\n * Resolver function for the root element to base the bootstrapping on.\n */\n rootElementResolver?: () => HTMLElement;\n};\n\n/**\n * Bootstraps an `Implementation` by scanning trigger elements and attaches them to\n * their corresponding widgets.\n */\nexport default (\n implementation: Implementation,\n configure: ConfigureCallback,\n options: BootstrapOptions = {}\n): Promise<BootstrappedImplementation> => {\n return bootstrapImplementation(\n implementation as any,\n implementation.bindings,\n () => {\n const runtimeConfigurationHandlers = implementation.container\n .get('$runtimecfg')\n .map((cfgHandlerArgs: any) => {\n const fnOrSelector = cfgHandlerArgs[0];\n if (typeof fnOrSelector === 'function') {\n return fnOrSelector;\n }\n if (selectImplementations(fnOrSelector)(implementation)) {\n return cfgHandlerArgs[1];\n }\n })\n .filter((handler: any) => !!handler);\n return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);\n },\n options.rootElementResolver || (() => document.body)\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 if (item instanceof Date) {\n return false;\n }\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","export default '#____version____#';\n","import {\n BootstrappedImplementationConfiguration,\n ConfigurationApi as BootstrappingConfigurationApi,\n} from '@webprovisions/bootstrapping';\nimport {\n ConfigurationApiDefinition,\n Environment as EnvironmentBase,\n version as webprovisionsVersion,\n WidgetSelector,\n} from '@webprovisions/platform';\nimport Implementation from './implementation';\nimport version from './version';\n\nexport interface RuntimeConfiguration {\n /**\n * Extensions for the configuration API (optional).\n */\n configurationApiExtensions?: ConfigurationApiDefinition[];\n}\n\n/**\n * The widget runtime.\n */\nexport default class Environment extends EnvironmentBase {\n /**\n * Version of the widget runtime.\n */\n static version: string = `${version} (${webprovisionsVersion})`;\n\n constructor(name: string, configurationApiExtensions: ConfigurationApiDefinition[] = []) {\n super(name, configurationApiExtensions, {\n transformPluginSettings: (settings, name, container) => {\n const $settings = container.get('$settings');\n const configPluginSettings =\n $settings.plugins && name ? $settings.plugins[name] || {} : {};\n return {\n ...configPluginSettings,\n ...settings,\n };\n },\n });\n }\n\n createImplementation(configuration: BootstrappedImplementationConfiguration): Implementation {\n const implementation = <Implementation>super.createImplementation(configuration);\n implementation.bindings = configuration.bindings;\n return implementation;\n }\n\n /**\n * Performs navigation for widgets matching the specified selector by invoking a\n * 'navigate' command.\n * @param selector Widget selector matching the widget(s) to perform navigation on.\n * @param route Route name.\n * @param params Route params.\n */\n navigate(selector: WidgetSelector, route: string, params: { [key: string]: string }) {\n this.widgets\n .query(selector)\n .forEach((widget) => widget.invoke('navigate', { route, params }));\n }\n\n /**\n * Creates a runtime based on provided configuration.\n * @param configuration Runtime configuration.\n */\n static create(configuration: RuntimeConfiguration = {}): Environment {\n const configurationApiExtensions = [BootstrappingConfigurationApi].concat(\n (configuration.configurationApiExtensions as any) || []\n );\n return new Environment('humany', configurationApiExtensions as any);\n }\n\n /**\n * Creates a widget runtime based on provided configuration and retains configuration handlers\n * registered on global context. Use this factory to fully support the default embed script.\n * Will return any existing widget runtime if available.\n * @param configuration Runtime configuration.\n * @param global Object to read configuration handlers from (default: window).\n */\n static createFromGlobal(\n globalInstance: any,\n configuration: RuntimeConfiguration = {}\n ): Environment {\n if (this.isRuntime(globalInstance)) {\n (globalInstance as Environment).patch(configuration);\n return globalInstance;\n }\n\n const runtimeConfiguration: any[] = [];\n\n const tempRuntimeConfiguration = globalInstance && globalInstance._c;\n if (tempRuntimeConfiguration) {\n tempRuntimeConfiguration.forEach((args: any) => runtimeConfiguration.push(args));\n }\n\n const runtime = this.create(configuration);\n runtime.container.register('$runtimecfg', runtimeConfiguration);\n return runtime;\n }\n\n /**\n * Determines whether the specified object is a valid widget runtime.\n * @param obj Object to compare.\n */\n static isRuntime(obj: any): boolean {\n if (\n obj &&\n typeof obj === 'object' &&\n obj.container &&\n typeof obj.container.get === 'function' &&\n obj.container.get('$environment') === obj &&\n obj.container.owner === obj\n ) {\n return true;\n }\n return false;\n }\n}\n","import { Implementation as ImplementationBase } from '@webprovisions/platform';\n\n/**\n * Represents an implementation.\n */\nexport default class Implementation extends ImplementationBase {\n bindings: string[] = [];\n}\n","import { Container, Plugin as PluginBase } from '@webprovisions/platform';\n\n/**\n * Base class for a widget plugin.\n */\nexport default class Plugin extends PluginBase {\n constructor(container: Container, settings?: any) {\n super(container, settings);\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","import { Container, WidgetType as WidgetTypeBase } from '@webprovisions/platform';\n\n/**\n * Base class for a widget.\n */\nexport default class WidgetType extends WidgetTypeBase {\n constructor(container: Container) {\n super(container);\n }\n}\n"],"names":["ActionResolver","container","events","target","action","value","origin","fn","e","bootstrap","implementation","configure","options","bootstrapImplementation","runtimeConfigurationHandlers","cfgHandlerArgs","fnOrSelector","selectImplementations","handler","createEventSubscriber","subs","type","listener","sub","ComponentQuery","platform","rules","node","rule","id","AbstractComponentController","ComponentNodeController","ns","ActionsController","subscribe","unsubscribe","updated","properties","event","context","layout","clearOnDispose","remove","executeActionListeners","listeners","data","controller","stack","dispatch","globalOptions","cancelled","next","result","__spreadProps","__spreadValues","key","subscription","index","instances","output","handlers","matchedInstances","instance","watchers","watcher","input","handlerResponse","parsedKey","parsedNs","sections","componentConfigurationApi","createConfigurationApi","builder","config","ComponentNode","uuid","viewOutletContainer","element","mountedNodes","Logger","branch","removable","changeset","indexToRemove","children","acc","i","traverseComponentsRecursive","nodes","switches","y","traverseComponents","root","findVisibleComponents","findComponent","matched","ComponentNodeCollection","query","member","CustomComponentHandler","name","calculateNodeIndex","currentNode","sortQueue","queue","a","b","isObject","item","mergeDeep","sources","source","matchesBreakpoint","b1","b2","createStateProcessor","callback","nodeQueue","optionsQueue","timeout","flush","processHistory","sortedQueue","processNode","history","processContext","processProperties","processLayout","_a","propertyResolvers","layoutResolvers","contextResolvers","change","resolver","childOptions","child","schedule","summary","ComponentPlatform","widget","providers","report","record","removes","parentNode","providerName","attributes","provider","definitionType","normalizeReference","reference","definitionId","overrides","createChildren","references","definitions","views","ref","childRef","childDef","viewNode","viewDef","override","handle","childNode","createComponentModel","settings","entry","components","breakpoints","subscriptions","list","asDescriptor","extendComponent","typeOrQuery","collection","managedInstances","getOrCreateController","existing","dispose","ComponentResolver","alias","component","version","_Environment","EnvironmentBase","configurationApiExtensions","$settings","configPluginSettings","configuration","selector","route","params","BootstrappingConfigurationApi","globalInstance","runtimeConfiguration","tempRuntimeConfiguration","args","runtime","obj","Environment","webprovisionsVersion","Implementation","ImplementationBase","Plugin","PluginBase","WidgetRenderState","WidgetType","WidgetTypeBase"],"mappings":";;;;;;;;;;;;;;;AASA,MAAqBA,GAAe;AAAA,EAGhC,YAAYC,GAAsB;AAC9B,UAAM,EAAE,QAAAC,EAAmB,IAAAD,EAAU,IAAI,SAAS;AAC7C,SAAA,SAASC,EAAO,YAAY,IAAI;AAAA,EACzC;AAAA,EAEA,OAAOC,GAAgBC,GAAgBC,GAAkB;AAChD,SAAA,OAAO,SAAS,eAAe,EAAE,QAAAD,GAAQ,OAAAC,GAAO,QAAAF,KAAU,EAAE,SAAS,GAAM,CAAA;AAAA,EACpF;AAAA,EAEA,UAAUG,GAAgBC,GAA2C;AACjE,WAAO,KAAK,OAAO;AAAA,MACf;AAAA,MACA,CAACC,GAAG,EAAE,QAAAJ,GAAQ,OAAAC,GAAO,QAAAF,EAAa,MAAAG,MAAWH,KAAUI,EAAGD,GAAQF,GAAQC,CAAK;AAAA,IAAA;AAAA,EAEvF;AACJ;ACZA,MAAeI,KAAA,CACXC,GACAC,GACAC,IAA4B,OAErBC;AAAA,EACHH;AAAA,EACAA,EAAe;AAAA,EACf,MAAM;AACI,UAAAI,IAA+BJ,EAAe,UAC/C,IAAI,aAAa,EACjB,IAAI,CAACK,MAAwB;AACpB,YAAAC,IAAeD,EAAe,CAAC;AACjC,UAAA,OAAOC,KAAiB;AACjB,eAAAA;AAEX,UAAIC,EAAsBD,CAAY,EAAEN,CAAc;AAClD,eAAOK,EAAe,CAAC;AAAA,IAE9B,CAAA,EACA,OAAO,CAACG,MAAiB,CAAC,CAACA,CAAO;AACvC,YAAQP,IAAY,CAACA,CAAS,IAAI,CAAA,GAAI,OAAOG,CAA4B;AAAA,EAC7E;AAAA,EACAF,EAAQ,wBAAwB,MAAM,SAAS;AAAA,GC1B1CO,KAAwB,CACjCjB,MACqD;AACrD,QAAMkB,I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5CK;AAGX,UAAMC,IAA8B,CAAA,GAE9BC,IAA2BF,KAAkBA,EAAe;AAClE,IAAIE,KACAA,EAAyB,QAAQ,CAACC,MAAcF,EAAqB,KAAKE,CAAI,CAAC;AAG7E,UAAAC,IAAU,KAAK,OAAOT,CAAa;AACjC,WAAAS,EAAA,UAAU,SAAS,eAAeH,CAAoB,GACvDG;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,UAAUC,GAAmB;AAE5B,WAAA,GAAAA,KACA,OAAOA,KAAQ,YACfA,EAAI,aACJ,OAAOA,EAAI,UAAU,OAAQ,cAC7BA,EAAI,UAAU,IAAI,cAAc,MAAMA,KACtCA,EAAI,UAAU,UAAUA;AAAA,EAKhC;AACJ;AA/FA,IAAqBC,KAArBhB;AAAqBgB,GAIV,UAAkB,GAAGjB,OAAYkB;ACtB5C,MAAqBC,WAAuBC,EAAmB;AAAA,EAA/D,cAAA;AAAA,UAAA,GAAA,SAAA,GACI,KAAA,WAAqB;EAAC;AAC1B;ACFA,MAAqBC,WAAeC,EAAW;AAAA,EAC3C,YAAY5M,GAAsBqK,GAAgB;AAC9C,UAAMrK,GAAWqK,CAAQ;AAAA,EAC7B;AACJ;ACgEY,IAAAwC,uBAAAA,OACRA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,SAAS,UAHDA,IAAAA,MAAA,CAAA,CAAA;ACpEZ,MAAqBC,WAAmBC,EAAe;AAAA,EACnD,YAAY/M,GAAsB;AAC9B,UAAMA,CAAS;AAAA,EACnB;AACJ;"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "d9f52ac";
1
+ declare const _default: "#____version____#";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/widget-core",
3
- "version": "1.0.26-next.4",
3
+ "version": "1.0.26-next.6",
4
4
  "description": "Core framework for ACE widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -21,15 +21,15 @@
21
21
  },
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@telia-ace/widget-utilities": "1.0.15-next.4",
25
- "@webprovisions/bootstrapping": "^1.0.12",
26
- "@webprovisions/platform": "^1.1.2"
24
+ "@telia-ace/widget-utilities": "1.0.15-next.6",
25
+ "@webprovisions/bootstrapping": "^1.0.13-rc.4",
26
+ "@webprovisions/platform": "^1.1.3-rc.3"
27
27
  },
28
28
  "devDependencies": {
29
- "@telia-ace/widget-developer-tools": "1.0.21-next.4"
29
+ "@telia-ace/widget-developer-tools": "1.0.21-next.6"
30
30
  },
31
31
  "scripts": {
32
32
  "clean": "rimraf ./dist",
33
- "build": "rimraf ./dist && tsc -emitDeclarationOnly && vite build && node scripts/print-version.js"
33
+ "build": "rimraf ./dist && tsc -emitDeclarationOnly && vite build"
34
34
  }
35
35
  }