@telia-ace/widget-runtime-flamingo 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export { default as GridWidget, default as Widget } from './widget';
2
+ export { childrenContext } from './context/children.context';
3
+ export { descriptorContext } from './context/component-node.context';
4
+ export { containerContext } from './context/container.context';
5
+ export { contextCtx } from './context/context.context';
6
+ export { layoutCtx } from './context/layout.context';
7
+ export { propertiesCtx } from './context/properties.context';
8
+ export { ActionsController } from './controllers/actions-controller';
9
+ export { DataProvider, createDataProvider, } from './data-provider/data-provider';
10
+ export { GuideProviderPlugin } from './data-provider/providers/guide-provider.plugin';
11
+ export { default as createWebComponent } from './core/create-lit-component';
12
+ export { WidgetComponent } from './mixins/widget-component.mixin';
package/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-df31095a.js");exports.ActionsController=t.ActionsController;exports.DataProvider=t.DataProvider;exports.GridWidget=t.Widget;exports.GuideProviderPlugin=t.GuideProviderPlugin;exports.Widget=t.Widget;exports.WidgetComponent=t.WidgetComponent;exports.childrenContext=t.childrenContext;exports.containerContext=t.containerContext;exports.contextCtx=t.contextCtx;exports.createDataProvider=t.createDataProvider;exports.createWebComponent=t.createLitComponent;exports.descriptorContext=t.descriptorContext;exports.layoutCtx=t.layoutCtx;exports.propertiesCtx=t.propertiesCtx;
package/index.mjs ADDED
@@ -0,0 +1,17 @@
1
+ import { r as a, D as o, h as r, G as s, h as i, W as n, j as d, c as C, l as c, u as x, v as l, k as p, o as W, q as g } from "./index-e7cd706f.mjs";
2
+ export {
3
+ a as ActionsController,
4
+ o as DataProvider,
5
+ r as GridWidget,
6
+ s as GuideProviderPlugin,
7
+ i as Widget,
8
+ n as WidgetComponent,
9
+ d as childrenContext,
10
+ C as containerContext,
11
+ c as contextCtx,
12
+ x as createDataProvider,
13
+ l as createWebComponent,
14
+ p as descriptorContext,
15
+ W as layoutCtx,
16
+ g as propertiesCtx
17
+ };
@@ -0,0 +1,24 @@
1
+ import { LitElement } from 'lit';
2
+ import { childrenContext } from '../context/children.context';
3
+ import { propertiesCtx } from '../context/properties.context';
4
+ import { contextCtx } from '../context/context.context';
5
+ import { ContextProvider } from '@lit-labs/context';
6
+ import { Container } from '@webprovisions/platform';
7
+ import { ComponentDescriptor } from '@telia-ace/widget-core';
8
+ import { ActionsController } from '../controllers/actions-controller';
9
+ type Constructor<T = {}> = new (...args: any[]) => T;
10
+ export declare class WidgetComponentInterface {
11
+ entry: string;
12
+ descriptor?: ComponentDescriptor;
13
+ component?: any;
14
+ layout: Record<string, any>;
15
+ context: Record<string, any>;
16
+ properties: Record<string, any>;
17
+ container?: Container;
18
+ actions: ActionsController;
19
+ _contextProvider: ContextProvider<typeof contextCtx>;
20
+ _propertiesProvider: ContextProvider<typeof propertiesCtx>;
21
+ _childrenProvider: ContextProvider<typeof childrenContext>;
22
+ }
23
+ export declare const WidgetComponent: <T extends Constructor<LitElement>>(superClass: T) => Constructor<WidgetComponentInterface> & T;
24
+ export {};
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@telia-ace/widget-runtime-flamingo",
3
+ "version": "0.0.1",
4
+ "scripts": {
5
+ "release": "release-it"
6
+ },
7
+ "release-it": {
8
+ "git": false
9
+ },
10
+ "dependencies": {},
11
+ "main": "./index.js",
12
+ "module": "./index.mjs",
13
+ "typings": "./index.d.ts"
14
+ }
@@ -0,0 +1,457 @@
1
+ import { i as L, t as D, e as A, A as y, s as P, a as Y, c as M, p as T, m as f, x as v, b as R, n as j, d as u, T as w, W as z, f as E, g as N } from "./index-e7cd706f.mjs";
2
+ /**
3
+ * @license
4
+ * Copyright 2017 Google LLC
5
+ * SPDX-License-Identifier: BSD-3-Clause
6
+ */
7
+ const S = (s) => (t) => typeof t == "function" ? ((e, i) => (customElements.define(e, i), i))(s, t) : ((e, i) => {
8
+ const { kind: n, elements: r } = i;
9
+ return { kind: n, elements: r, finisher(o) {
10
+ customElements.define(e, o);
11
+ } };
12
+ })(s, t);
13
+ /**
14
+ * @license
15
+ * Copyright 2020 Google LLC
16
+ * SPDX-License-Identifier: BSD-3-Clause
17
+ */
18
+ const W = (s) => s === null || typeof s != "object" && typeof s != "function", q = (s) => s.strings === void 0;
19
+ /**
20
+ * @license
21
+ * Copyright 2017 Google LLC
22
+ * SPDX-License-Identifier: BSD-3-Clause
23
+ */
24
+ const p = (s, t) => {
25
+ var e, i;
26
+ const n = s._$AN;
27
+ if (n === void 0)
28
+ return !1;
29
+ for (const r of n)
30
+ (i = (e = r)._$AO) === null || i === void 0 || i.call(e, t, !1), p(r, t);
31
+ return !0;
32
+ }, m = (s) => {
33
+ let t, e;
34
+ do {
35
+ if ((t = s._$AM) === void 0)
36
+ break;
37
+ e = t._$AN, e.delete(s), s = t;
38
+ } while ((e == null ? void 0 : e.size) === 0);
39
+ }, k = (s) => {
40
+ for (let t; t = s._$AM; s = t) {
41
+ let e = t._$AN;
42
+ if (e === void 0)
43
+ t._$AN = e = /* @__PURE__ */ new Set();
44
+ else if (e.has(s))
45
+ break;
46
+ e.add(s), K(t);
47
+ }
48
+ };
49
+ function H(s) {
50
+ this._$AN !== void 0 ? (m(this), this._$AM = s, k(this)) : this._$AM = s;
51
+ }
52
+ function I(s, t = !1, e = 0) {
53
+ const i = this._$AH, n = this._$AN;
54
+ if (n !== void 0 && n.size !== 0)
55
+ if (t)
56
+ if (Array.isArray(i))
57
+ for (let r = e; r < i.length; r++)
58
+ p(i[r], !1), m(i[r]);
59
+ else
60
+ i != null && (p(i, !1), m(i));
61
+ else
62
+ p(this, s);
63
+ }
64
+ const K = (s) => {
65
+ var t, e, i, n;
66
+ s.type == D.CHILD && ((t = (i = s)._$AP) !== null && t !== void 0 || (i._$AP = I), (e = (n = s)._$AQ) !== null && e !== void 0 || (n._$AQ = H));
67
+ };
68
+ let G = class extends L {
69
+ constructor() {
70
+ super(...arguments), this._$AN = void 0;
71
+ }
72
+ _$AT(t, e, i) {
73
+ super._$AT(t, e, i), k(this), this.isConnected = t._$AU;
74
+ }
75
+ _$AO(t, e = !0) {
76
+ var i, n;
77
+ t !== this.isConnected && (this.isConnected = t, t ? (i = this.reconnected) === null || i === void 0 || i.call(this) : (n = this.disconnected) === null || n === void 0 || n.call(this)), e && (p(this, t), m(this));
78
+ }
79
+ setValue(t) {
80
+ if (q(this._$Ct))
81
+ this._$Ct._$AI(t, this);
82
+ else {
83
+ const e = [...this._$Ct._$AH];
84
+ e[this._$Ci] = t, this._$Ct._$AI(e, this, 0);
85
+ }
86
+ }
87
+ disconnected() {
88
+ }
89
+ reconnected() {
90
+ }
91
+ };
92
+ /**
93
+ * @license
94
+ * Copyright 2020 Google LLC
95
+ * SPDX-License-Identifier: BSD-3-Clause
96
+ */
97
+ const Z = () => new U();
98
+ class U {
99
+ }
100
+ const $ = /* @__PURE__ */ new WeakMap(), V = A(class extends G {
101
+ render(s) {
102
+ return y;
103
+ }
104
+ update(s, [t]) {
105
+ var e;
106
+ const i = t !== this.G;
107
+ return i && this.G !== void 0 && this.ot(void 0), (i || this.rt !== this.lt) && (this.G = t, this.dt = (e = s.options) === null || e === void 0 ? void 0 : e.host, this.ot(this.lt = s.element)), y;
108
+ }
109
+ ot(s) {
110
+ var t;
111
+ if (typeof this.G == "function") {
112
+ const e = (t = this.dt) !== null && t !== void 0 ? t : globalThis;
113
+ let i = $.get(e);
114
+ i === void 0 && (i = /* @__PURE__ */ new WeakMap(), $.set(e, i)), i.get(this.G) !== void 0 && this.G.call(this.dt, void 0), i.set(this.G, s), s !== void 0 && this.G.call(this.dt, s);
115
+ } else
116
+ this.G.value = s;
117
+ }
118
+ get rt() {
119
+ var s, t, e;
120
+ return typeof this.G == "function" ? (t = $.get((s = this.dt) !== null && s !== void 0 ? s : globalThis)) === null || t === void 0 ? void 0 : t.get(this.G) : (e = this.G) === null || e === void 0 ? void 0 : e.value;
121
+ }
122
+ disconnected() {
123
+ this.rt === this.lt && this.ot(void 0);
124
+ }
125
+ reconnected() {
126
+ this.ot(this.lt);
127
+ }
128
+ }), Q = async (s) => await s.get("$widget").invoke("renderState"), B = async (s, t) => {
129
+ const e = s.get("$widget");
130
+ return (await s.getAsync(
131
+ "actionResolver"
132
+ )).subscribe(e.name, t);
133
+ }, F = (s, t, e = !1) => {
134
+ const i = s.reduce(
135
+ (o, { breakpoints: a = [], values: l }) => a.length ? t.some((g) => a.includes(g)) ? { ...o, ...l } : o : { ...o, ...l },
136
+ {}
137
+ ), n = {};
138
+ let r = i.type;
139
+ return n.height = i.height || "", n.width = i.width || "", i.type === "floating" || i.type === "inline" && e && (n.height = "calc(100vh - 120px)"), { type: r, styles: n };
140
+ };
141
+ var J = Object.defineProperty, X = Object.getOwnPropertyDescriptor, h = (s, t, e, i) => {
142
+ for (var n = i > 1 ? void 0 : i ? X(t, e) : t, r = s.length - 1, o; r >= 0; r--)
143
+ (o = s[r]) && (n = (i ? o(t, e, n) : o(n)) || n);
144
+ return i && n && J(t, e, n), n;
145
+ };
146
+ let c = class extends P {
147
+ constructor() {
148
+ super(), this._provider = new Y(this, M, void 0), this.wrapperRef = Z(), this.breakpoints = [], this.breakpointsSet = !1;
149
+ }
150
+ connectedCallback() {
151
+ super.connectedCallback(), this._provider.setValue(this.container), this.container && (Q(this.container).then((s) => {
152
+ this.renderState = s;
153
+ }), B(this.container, (s, t) => {
154
+ switch (t) {
155
+ case "close":
156
+ case "open":
157
+ this.renderState = t === "open" ? f.open : f.closed;
158
+ break;
159
+ case "hide":
160
+ this.renderState = f.hidden;
161
+ }
162
+ }).then((s) => {
163
+ this._unsubscribeRenderState = s;
164
+ }), T.getInstance(this.container).then(
165
+ (s) => {
166
+ this.componentPlatform = s, this.breakpoints = this.componentPlatform.breakpoints, this.breakpointsSet = !0, this._unsubscribePropChange = this.componentPlatform.events.subscribe(
167
+ "components:properties-changed",
168
+ (t, e) => {
169
+ var i, n;
170
+ ((i = e == null ? void 0 : e.node) == null ? void 0 : i.type) === "root" && (this.breakpoints = (n = this.componentPlatform) != null && n.breakpoints ? [...this.componentPlatform.breakpoints] : []);
171
+ }
172
+ ), this.entry = this.componentPlatform.nodes.root.children.default[0].id || void 0;
173
+ }
174
+ ));
175
+ }
176
+ disconnectedCallback() {
177
+ super.disconnectedCallback(), this._unsubscribeRenderState && this._unsubscribeRenderState(), this._unsubscribePropChange && this._unsubscribePropChange();
178
+ }
179
+ render() {
180
+ var t, e, i, n;
181
+ let s;
182
+ if (!this.entry || !this.breakpointsSet)
183
+ return y;
184
+ if (this.container && this.renderState) {
185
+ const [r] = this.container.get("widgetDOMElements");
186
+ r && r.setAttribute("data-state", this.renderState);
187
+ }
188
+ if (this.container) {
189
+ const r = this.container.get("$settings");
190
+ r != null && r.layout && (s = F(
191
+ r.layout,
192
+ this.breakpoints,
193
+ !!r.trigger
194
+ ), s.type === "floating" ? (this.renderRoot.host.classList.add("floating"), this.renderRoot.host.classList.remove("inline")) : (this.renderRoot.host.classList.add("inline"), this.renderRoot.host.classList.remove("floating")), Object.entries(s.styles).forEach(([o, a]) => {
195
+ this.renderRoot.host.style.setProperty(o, a);
196
+ }));
197
+ }
198
+ return this.renderState && (this.renderState === f.hidden ? ((t = this.wrapperRef.value) == null || t.classList.add("hidden"), (e = this.wrapperRef.value) == null || e.classList.remove("expanded")) : ((i = this.wrapperRef.value) == null || i.classList.remove("hidden"), (n = this.wrapperRef.value) == null || n.classList.add("expanded"))), v`
199
+ <div class="widget-container" ${V(this.wrapperRef)}>
200
+ <ace-area entry=${this.entry}></ace-area>
201
+ </div>
202
+ `;
203
+ }
204
+ };
205
+ c.styles = R`
206
+ :host {
207
+ --font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
208
+ --spacing-xs: 0.2rem;
209
+ --spacing-sm: 0.5rem;
210
+ --spacing-md: 1rem;
211
+ --spacing-lg: 1.2rem;
212
+ --spacing-xl: 1.8rem;
213
+
214
+ --primary-color: #29003e;
215
+ --secondary-color: #00558f;
216
+ --text-color: #222222;
217
+ --link-color: #990ae3;
218
+ --gray-color: #efefef;
219
+ --gray-dark-color: #a6a6a6;
220
+
221
+ --box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
222
+ --border-radius: 1rem;
223
+ --border-radius-sm: 0.3rem;
224
+ }
225
+ :host {
226
+ --voca-rem-multiplier: 0.625;
227
+ box-sizing: border-box;
228
+ display: block;
229
+ }
230
+
231
+ :host(.floating) {
232
+ position: fixed;
233
+ z-index: 6;
234
+ inset: auto 20px 95px auto;
235
+ max-height: calc(100vh - 120px);
236
+ }
237
+ :host(.floating) .widget-container {
238
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
239
+ border-radius: 0.7rem;
240
+ }
241
+ :host(.inline) {
242
+ height: 100%;
243
+ position: fixed;
244
+ inset: 0 0 0 0;
245
+ }
246
+
247
+ * {
248
+ box-sizing: border-box;
249
+ }
250
+ .widget-container {
251
+ height: 100%;
252
+ }
253
+ .widget-container.expanded {
254
+ opacity: 1;
255
+ animation: slideUp 0.5s;
256
+ }
257
+ .widget-container.hidden {
258
+ opacity: 0;
259
+ animation: slideDown 0.5s;
260
+ }
261
+ @keyframes slideDown {
262
+ from {
263
+ transform: translateY(0);
264
+ opacity: 1;
265
+ }
266
+ to {
267
+ transform: translateY(100%);
268
+ opacity: 0;
269
+ }
270
+ }
271
+ @keyframes slideUp {
272
+ from {
273
+ transform: translateY(100%);
274
+ opacity: 0;
275
+ }
276
+ to {
277
+ transform: translateY(0);
278
+ opacity: 1;
279
+ }
280
+ }
281
+ `;
282
+ h([
283
+ j({ attribute: !1 })
284
+ ], c.prototype, "container", 2);
285
+ h([
286
+ u()
287
+ ], c.prototype, "componentPlatform", 2);
288
+ h([
289
+ u()
290
+ ], c.prototype, "renderState", 2);
291
+ h([
292
+ u()
293
+ ], c.prototype, "breakpoints", 2);
294
+ h([
295
+ u()
296
+ ], c.prototype, "breakpointsSet", 2);
297
+ h([
298
+ u()
299
+ ], c.prototype, "entry", 2);
300
+ c = h([
301
+ S("ace-widget-wrapper")
302
+ ], c);
303
+ /**
304
+ * @license
305
+ * Copyright 2021 Google LLC
306
+ * SPDX-License-Identifier: BSD-3-Clause
307
+ */
308
+ class tt {
309
+ constructor(t) {
310
+ this.G = t;
311
+ }
312
+ disconnect() {
313
+ this.G = void 0;
314
+ }
315
+ reconnect(t) {
316
+ this.G = t;
317
+ }
318
+ deref() {
319
+ return this.G;
320
+ }
321
+ }
322
+ class et {
323
+ constructor() {
324
+ this.Y = void 0, this.Z = void 0;
325
+ }
326
+ get() {
327
+ return this.Y;
328
+ }
329
+ pause() {
330
+ var t;
331
+ (t = this.Y) !== null && t !== void 0 || (this.Y = new Promise((e) => this.Z = e));
332
+ }
333
+ resume() {
334
+ var t;
335
+ (t = this.Z) === null || t === void 0 || t.call(this), this.Y = this.Z = void 0;
336
+ }
337
+ }
338
+ /**
339
+ * @license
340
+ * Copyright 2017 Google LLC
341
+ * SPDX-License-Identifier: BSD-3-Clause
342
+ */
343
+ const C = (s) => !W(s) && typeof s.then == "function", x = 1073741823;
344
+ class st extends G {
345
+ constructor() {
346
+ super(...arguments), this._$C_t = x, this._$Cwt = [], this._$Cq = new tt(this), this._$CK = new et();
347
+ }
348
+ render(...t) {
349
+ var e;
350
+ return (e = t.find((i) => !C(i))) !== null && e !== void 0 ? e : w;
351
+ }
352
+ update(t, e) {
353
+ const i = this._$Cwt;
354
+ let n = i.length;
355
+ this._$Cwt = e;
356
+ const r = this._$Cq, o = this._$CK;
357
+ this.isConnected || this.disconnected();
358
+ for (let a = 0; a < e.length && !(a > this._$C_t); a++) {
359
+ const l = e[a];
360
+ if (!C(l))
361
+ return this._$C_t = a, l;
362
+ a < n && l === i[a] || (this._$C_t = x, n = 0, Promise.resolve(l).then(async (g) => {
363
+ for (; o.get(); )
364
+ await o.get();
365
+ const d = r.deref();
366
+ if (d !== void 0) {
367
+ const _ = d._$Cwt.indexOf(l);
368
+ _ > -1 && _ < d._$C_t && (d._$C_t = _, d.setValue(g));
369
+ }
370
+ }));
371
+ }
372
+ return w;
373
+ }
374
+ disconnected() {
375
+ this._$Cq.disconnect(), this._$CK.pause();
376
+ }
377
+ reconnected() {
378
+ this._$Cq.reconnect(this), this._$CK.resume();
379
+ }
380
+ }
381
+ const it = A(st);
382
+ var nt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, ot = (s, t, e, i) => {
383
+ for (var n = i > 1 ? void 0 : i ? rt(t, e) : t, r = s.length - 1, o; r >= 0; r--)
384
+ (o = s[r]) && (n = (i ? o(t, e, n) : o(n)) || n);
385
+ return i && n && nt(t, e, n), n;
386
+ };
387
+ const O = z(P);
388
+ let b = class extends O {
389
+ constructor() {
390
+ super(...arguments), this._resolveChildComponent = async (s) => {
391
+ const e = (await this.container.getAsync(
392
+ "componentResolver"
393
+ )).getComponent(s);
394
+ if (e.then)
395
+ return e.then((i) => i.default);
396
+ }, this._resolveAllChildren = async (s) => Promise.all(
397
+ s.map(async (t) => {
398
+ let e = customElements.get(`ace-${t.type}`);
399
+ return e || (e = await this._resolveChildComponent(t.type || "")), {
400
+ ...t,
401
+ component: e
402
+ };
403
+ })
404
+ );
405
+ }
406
+ render() {
407
+ var s;
408
+ return E(this.context, this.renderRoot.host), this.renderRoot.host.style.setProperty(
409
+ "--width",
410
+ this.layout.size === "full" ? "var(--columns, 1)" : `min(${this.layout.size || "var(--columns)"}, var(--columns))`
411
+ ), this.renderRoot.host.style.setProperty(
412
+ "--columns",
413
+ ((s = this._propertiesProvider.value.columns) == null ? void 0 : s.toString()) || "1"
414
+ ), N(
415
+ this.renderRoot.host,
416
+ this._propertiesProvider.value
417
+ ), v`
418
+ ${it(
419
+ this._resolveAllChildren(this._childrenProvider.value).then(
420
+ (t) => v`
421
+ ${t.map((e) => {
422
+ if (e.type === "area")
423
+ return v`<ace-area entry=${e.id}></ace-area>`;
424
+ const i = new e.component();
425
+ return i.entry = e.id, i;
426
+ })}
427
+ `
428
+ )
429
+ )}
430
+ `;
431
+ }
432
+ };
433
+ b.styles = [
434
+ O.styles || [],
435
+ R`
436
+ :host {
437
+ height: 100%;
438
+ display: grid;
439
+ justify-content: center;
440
+ grid-auto-rows: max-content;
441
+ grid-template-rows: auto;
442
+ grid-template-columns: repeat(var(--columns), 1fr);
443
+ }
444
+ `
445
+ ];
446
+ b = ot([
447
+ S("ace-area")
448
+ ], b);
449
+ const lt = (s, t) => {
450
+ setTimeout(() => {
451
+ const e = new c();
452
+ e.container = s.parent, t.appendChild(e);
453
+ }, 0);
454
+ };
455
+ export {
456
+ lt as default
457
+ };
@@ -0,0 +1,118 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-df31095a.js");/**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const b=s=>t=>typeof t=="function"?((e,i)=>(customElements.define(e,i),i))(s,t):((e,i)=>{const{kind:n,elements:o}=i;return{kind:n,elements:o,finisher(a){customElements.define(e,a)}}})(s,t);/**
6
+ * @license
7
+ * Copyright 2020 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */const A=s=>s===null||typeof s!="object"&&typeof s!="function",P=s=>s.strings===void 0;/**
10
+ * @license
11
+ * Copyright 2017 Google LLC
12
+ * SPDX-License-Identifier: BSD-3-Clause
13
+ */const u=(s,t)=>{var e,i;const n=s._$AN;if(n===void 0)return!1;for(const o of n)(i=(e=o)._$AO)===null||i===void 0||i.call(e,t,!1),u(o,t);return!0},f=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while((e==null?void 0:e.size)===0)},w=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),k(t)}};function S(s){this._$AN!==void 0?(f(this),this._$AM=s,w(this)):this._$AM=s}function R(s,t=!1,e=0){const i=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(i))for(let o=e;o<i.length;o++)u(i[o],!1),f(i[o]);else i!=null&&(u(i,!1),f(i));else u(this,s)}const k=s=>{var t,e,i,n;s.type==r.t.CHILD&&((t=(i=s)._$AP)!==null&&t!==void 0||(i._$AP=R),(e=(n=s)._$AQ)!==null&&e!==void 0||(n._$AQ=S))};let C=class extends r.i{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),w(this),this.isConnected=t._$AU}_$AO(t,e=!0){var i,n;t!==this.isConnected&&(this.isConnected=t,t?(i=this.reconnected)===null||i===void 0||i.call(this):(n=this.disconnected)===null||n===void 0||n.call(this)),e&&(u(this,t),f(this))}setValue(t){if(P(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};/**
14
+ * @license
15
+ * Copyright 2020 Google LLC
16
+ * SPDX-License-Identifier: BSD-3-Clause
17
+ */const G=()=>new O;class O{}const g=new WeakMap,L=r.e(class extends C{render(s){return r.A}update(s,[t]){var e;const i=t!==this.G;return i&&this.G!==void 0&&this.ot(void 0),(i||this.rt!==this.lt)&&(this.G=t,this.dt=(e=s.options)===null||e===void 0?void 0:e.host,this.ot(this.lt=s.element)),r.A}ot(s){var t;if(typeof this.G=="function"){const e=(t=this.dt)!==null&&t!==void 0?t:globalThis;let i=g.get(e);i===void 0&&(i=new WeakMap,g.set(e,i)),i.get(this.G)!==void 0&&this.G.call(this.dt,void 0),i.set(this.G,s),s!==void 0&&this.G.call(this.dt,s)}else this.G.value=s}get rt(){var s,t,e;return typeof this.G=="function"?(t=g.get((s=this.dt)!==null&&s!==void 0?s:globalThis))===null||t===void 0?void 0:t.get(this.G):(e=this.G)===null||e===void 0?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}}),T=async s=>await s.get("$widget").invoke("renderState"),D=async(s,t)=>{const e=s.get("$widget");return(await s.getAsync("actionResolver")).subscribe(e.name,t)},M=(s,t,e=!1)=>{const i=s.reduce((a,{breakpoints:c=[],values:h})=>c.length?t.some(v=>c.includes(v))?{...a,...h}:a:{...a,...h},{}),n={};let o=i.type;return n.height=i.height||"",n.width=i.width||"",i.type==="floating"||i.type==="inline"&&e&&(n.height="calc(100vh - 120px)"),{type:o,styles:n}};var Y=Object.defineProperty,j=Object.getOwnPropertyDescriptor,d=(s,t,e,i)=>{for(var n=i>1?void 0:i?j(t,e):t,o=s.length-1,a;o>=0;o--)(a=s[o])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&Y(t,e,n),n};let l=class extends r.s{constructor(){super(),this._provider=new r.i$1(this,r.containerContext,void 0),this.wrapperRef=G(),this.breakpoints=[],this.breakpointsSet=!1}connectedCallback(){super.connectedCallback(),this._provider.setValue(this.container),this.container&&(T(this.container).then(s=>{this.renderState=s}),D(this.container,(s,t)=>{switch(t){case"close":case"open":this.renderState=t==="open"?r.mt.open:r.mt.closed;break;case"hide":this.renderState=r.mt.hidden}}).then(s=>{this._unsubscribeRenderState=s}),r.pt.getInstance(this.container).then(s=>{this.componentPlatform=s,this.breakpoints=this.componentPlatform.breakpoints,this.breakpointsSet=!0,this._unsubscribePropChange=this.componentPlatform.events.subscribe("components:properties-changed",(t,e)=>{var i,n;((i=e==null?void 0:e.node)==null?void 0:i.type)==="root"&&(this.breakpoints=(n=this.componentPlatform)!=null&&n.breakpoints?[...this.componentPlatform.breakpoints]:[])}),this.entry=this.componentPlatform.nodes.root.children.default[0].id||void 0}))}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeRenderState&&this._unsubscribeRenderState(),this._unsubscribePropChange&&this._unsubscribePropChange()}render(){var t,e,i,n;let s;if(!this.entry||!this.breakpointsSet)return r.A;if(this.container&&this.renderState){const[o]=this.container.get("widgetDOMElements");o&&o.setAttribute("data-state",this.renderState)}if(this.container){const o=this.container.get("$settings");o!=null&&o.layout&&(s=M(o.layout,this.breakpoints,!!o.trigger),s.type==="floating"?(this.renderRoot.host.classList.add("floating"),this.renderRoot.host.classList.remove("inline")):(this.renderRoot.host.classList.add("inline"),this.renderRoot.host.classList.remove("floating")),Object.entries(s.styles).forEach(([a,c])=>{this.renderRoot.host.style.setProperty(a,c)}))}return this.renderState&&(this.renderState===r.mt.hidden?((t=this.wrapperRef.value)==null||t.classList.add("hidden"),(e=this.wrapperRef.value)==null||e.classList.remove("expanded")):((i=this.wrapperRef.value)==null||i.classList.remove("hidden"),(n=this.wrapperRef.value)==null||n.classList.add("expanded"))),r.x`
18
+ <div class="widget-container" ${L(this.wrapperRef)}>
19
+ <ace-area entry=${this.entry}></ace-area>
20
+ </div>
21
+ `}};l.styles=r.i$2`
22
+ :host {
23
+ --font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
24
+ --spacing-xs: 0.2rem;
25
+ --spacing-sm: 0.5rem;
26
+ --spacing-md: 1rem;
27
+ --spacing-lg: 1.2rem;
28
+ --spacing-xl: 1.8rem;
29
+
30
+ --primary-color: #29003e;
31
+ --secondary-color: #00558f;
32
+ --text-color: #222222;
33
+ --link-color: #990ae3;
34
+ --gray-color: #efefef;
35
+ --gray-dark-color: #a6a6a6;
36
+
37
+ --box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
38
+ --border-radius: 1rem;
39
+ --border-radius-sm: 0.3rem;
40
+ }
41
+ :host {
42
+ --voca-rem-multiplier: 0.625;
43
+ box-sizing: border-box;
44
+ display: block;
45
+ }
46
+
47
+ :host(.floating) {
48
+ position: fixed;
49
+ z-index: 6;
50
+ inset: auto 20px 95px auto;
51
+ max-height: calc(100vh - 120px);
52
+ }
53
+ :host(.floating) .widget-container {
54
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
55
+ border-radius: 0.7rem;
56
+ }
57
+ :host(.inline) {
58
+ height: 100%;
59
+ position: fixed;
60
+ inset: 0 0 0 0;
61
+ }
62
+
63
+ * {
64
+ box-sizing: border-box;
65
+ }
66
+ .widget-container {
67
+ height: 100%;
68
+ }
69
+ .widget-container.expanded {
70
+ opacity: 1;
71
+ animation: slideUp 0.5s;
72
+ }
73
+ .widget-container.hidden {
74
+ opacity: 0;
75
+ animation: slideDown 0.5s;
76
+ }
77
+ @keyframes slideDown {
78
+ from {
79
+ transform: translateY(0);
80
+ opacity: 1;
81
+ }
82
+ to {
83
+ transform: translateY(100%);
84
+ opacity: 0;
85
+ }
86
+ }
87
+ @keyframes slideUp {
88
+ from {
89
+ transform: translateY(100%);
90
+ opacity: 0;
91
+ }
92
+ to {
93
+ transform: translateY(0);
94
+ opacity: 1;
95
+ }
96
+ }
97
+ `;d([r.n({attribute:!1})],l.prototype,"container",2);d([r.t$1()],l.prototype,"componentPlatform",2);d([r.t$1()],l.prototype,"renderState",2);d([r.t$1()],l.prototype,"breakpoints",2);d([r.t$1()],l.prototype,"breakpointsSet",2);d([r.t$1()],l.prototype,"entry",2);l=d([b("ace-widget-wrapper")],l);/**
98
+ * @license
99
+ * Copyright 2021 Google LLC
100
+ * SPDX-License-Identifier: BSD-3-Clause
101
+ */class z{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}}class E{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){var t;(t=this.Y)!==null&&t!==void 0||(this.Y=new Promise(e=>this.Z=e))}resume(){var t;(t=this.Z)===null||t===void 0||t.call(this),this.Y=this.Z=void 0}}/**
102
+ * @license
103
+ * Copyright 2017 Google LLC
104
+ * SPDX-License-Identifier: BSD-3-Clause
105
+ */const $=s=>!A(s)&&typeof s.then=="function",y=1073741823;class N extends C{constructor(){super(...arguments),this._$C_t=y,this._$Cwt=[],this._$Cq=new z(this),this._$CK=new E}render(...t){var e;return(e=t.find(i=>!$(i)))!==null&&e!==void 0?e:r.T}update(t,e){const i=this._$Cwt;let n=i.length;this._$Cwt=e;const o=this._$Cq,a=this._$CK;this.isConnected||this.disconnected();for(let c=0;c<e.length&&!(c>this._$C_t);c++){const h=e[c];if(!$(h))return this._$C_t=c,h;c<n&&h===i[c]||(this._$C_t=y,n=0,Promise.resolve(h).then(async v=>{for(;a.get();)await a.get();const p=o.deref();if(p!==void 0){const m=p._$Cwt.indexOf(h);m>-1&&m<p._$C_t&&(p._$C_t=m,p.setValue(v))}}))}return r.T}disconnected(){this._$Cq.disconnect(),this._$CK.pause()}reconnected(){this._$Cq.reconnect(this),this._$CK.resume()}}const q=r.e(N);var W=Object.defineProperty,H=Object.getOwnPropertyDescriptor,I=(s,t,e,i)=>{for(var n=i>1?void 0:i?H(t,e):t,o=s.length-1,a;o>=0;o--)(a=s[o])&&(n=(i?a(t,e,n):a(n))||n);return i&&n&&W(t,e,n),n};const x=r.WidgetComponent(r.s);let _=class extends x{constructor(){super(...arguments),this._resolveChildComponent=async s=>{const e=(await this.container.getAsync("componentResolver")).getComponent(s);if(e.then)return e.then(i=>i.default)},this._resolveAllChildren=async s=>Promise.all(s.map(async t=>{let e=customElements.get(`ace-${t.type}`);return e||(e=await this._resolveChildComponent(t.type||"")),{...t,component:e}}))}render(){var s;return r.mapBranding(this.context,this.renderRoot.host),this.renderRoot.host.style.setProperty("--width",this.layout.size==="full"?"var(--columns, 1)":`min(${this.layout.size||"var(--columns)"}, var(--columns))`),this.renderRoot.host.style.setProperty("--columns",((s=this._propertiesProvider.value.columns)==null?void 0:s.toString())||"1"),r.appendStyleFromProperties(this.renderRoot.host,this._propertiesProvider.value),r.x`
106
+ ${q(this._resolveAllChildren(this._childrenProvider.value).then(t=>r.x`
107
+ ${t.map(e=>{if(e.type==="area")return r.x`<ace-area entry=${e.id}></ace-area>`;const i=new e.component;return i.entry=e.id,i})}
108
+ `))}
109
+ `}};_.styles=[x.styles||[],r.i$2`
110
+ :host {
111
+ height: 100%;
112
+ display: grid;
113
+ justify-content: center;
114
+ grid-auto-rows: max-content;
115
+ grid-template-rows: auto;
116
+ grid-template-columns: repeat(var(--columns), 1fr);
117
+ }
118
+ `];_=I([b("ace-area")],_);const K=(s,t)=>{setTimeout(()=>{const e=new l;e.container=s.parent,t.appendChild(e)},0)};exports.default=K;
package/services.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Container } from '@webprovisions/platform';
2
+ export declare const createStorageService: (_container: Container) => Promise<import("@telia-ace/widget-services").StorageProvider>;
3
+ export declare const createActionResolver: (container: Container) => Promise<import("@telia-ace/widget-core").ActionResolver>;
4
+ export declare const createComponentResolver: (container: Container) => Promise<import("@telia-ace/widget-core").ComponentResolver>;
5
+ export declare const createComponentPlatform: (container: Container) => Promise<import("@telia-ace/widget-core").ComponentPlatform>;
package/ui/area.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { LitElement } from 'lit';
2
+ declare const WidgetElement: (new (...args: any[]) => import("../mixins/widget-component.mixin").WidgetComponentInterface) & typeof LitElement;
3
+ export declare class AreaComponent extends WidgetElement {
4
+ static styles: import("lit").CSSResultGroup[];
5
+ private _resolveChildComponent;
6
+ private _resolveAllChildren;
7
+ render(): import("lit").TemplateResult<1>;
8
+ }
9
+ export {};
@@ -0,0 +1 @@
1
+ export declare const mapBranding: (context: Record<string, any>, el: HTMLElement) => void;
@@ -0,0 +1,5 @@
1
+ declare const filterCssProps: (props: Record<string, any>) => {
2
+ [key: string]: any;
3
+ };
4
+ export declare const appendStyleFromProperties: (elem: HTMLElement, p: Record<string, any>) => void;
5
+ export default filterCssProps;