@telia-ace/widget-components-widget-header-flamingo 1.1.12 → 1.1.13

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.
@@ -1,74 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-6c3c27db.js"),y=require("./ai-robot-0e89be0b.js");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const f=o=>(t,i)=>{i!==void 0?i.addInitializer(()=>{customElements.define(o,t)}):customElements.define(o,t)};/**
6
- * @license
7
- * Copyright 2021 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */let x=class extends Event{constructor(t,i,e){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=i,this.subscribe=e??!1}};/**
10
- * @license
11
- * Copyright 2021 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- *//**
14
- * @license
15
- * Copyright 2021 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */let v=class{constructor(t,i,e,s){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,c)=>{this.unsubscribe&&(this.unsubscribe!==c&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,c)),this.unsubscribe=c},this.host=t,i.context!==void 0){const n=i;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=i,this.callback=e,this.subscribe=s??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new x(this.context,this.t,this.subscribe))}};/**
18
- * @license
19
- * Copyright 2021 Google LLC
20
- * SPDX-License-Identifier: BSD-3-Clause
21
- */class C{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,i=!1){const e=i||!Object.is(t,this.o);this.o=t,e&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[i,{disposer:e}]of this.subscriptions)i(this.o,e)},t!==void 0&&(this.value=t)}addCallback(t,i,e){if(!e)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:i});const{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}}/**
22
- * @license
23
- * Copyright 2021 Google LLC
24
- * SPDX-License-Identifier: BSD-3-Clause
25
- */class m extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}}class u extends C{constructor(t,i,e){super(i.context!==void 0?i.initialValue:e),this.onContextRequest=s=>{const n=s.composedPath()[0];s.context===this.context&&n!==this.host&&(s.stopPropagation(),this.addCallback(s.callback,n,s.subscribe))},this.onProviderRequest=s=>{const n=s.composedPath()[0];if(s.context!==this.context||n===this.host)return;const c=new Set;for(const[d,{consumerHost:l}]of this.subscriptions)c.has(d)||(c.add(d),l.dispatchEvent(new x(this.context,d,!0)));s.stopPropagation()},this.host=t,i.context!==void 0?this.context=i.context:this.context=i,this.attachListeners(),this.host.addController(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new m(this.context))}}/**
26
- * @license
27
- * Copyright 2022 Google LLC
28
- * SPDX-License-Identifier: BSD-3-Clause
29
- */function P({context:o,subscribe:t}){return(i,e)=>{typeof e=="object"?e.addInitializer(function(){new v(this,{context:o,callback:s=>{this[e.name]=s},subscribe:t})}):i.constructor.addInitializer(s=>{new v(s,{context:o,callback:n=>{s[e]=n},subscribe:t})})}}const w="children",L="descriptor",O="container",E="context",q="layout",R="properties";class D{constructor(t){(this.host=t).addController(this)}hostConnected(){}hostDisconnected(){}setDescriptor(t){this._descriptor=t}setContainer(t){this._container=t}async dispatch(t,i){if(!this._container||!this._descriptor)return;const e=await r.pt.getInstance(this._container),s=new r.P(e).withId(this._descriptor.id);await e.actions(s,this._descriptor.type||r.ht()).dispatch(t,i)}}const W=o=>{const t={};return Object.keys(o).forEach(i=>{i.indexOf("css-")>-1&&(t[i]=o[i])}),t},$=(o,t)=>{const i=W(t);Object.entries(i).forEach(([e,s])=>{o.style.setProperty(e.replace("css-",""),s)})};var j=Object.defineProperty,z=Object.getOwnPropertyDescriptor,a=(o,t,i,e)=>{for(var s=e>1?void 0:e?z(t,i):t,n=o.length-1,c;n>=0;n--)(c=o[n])&&(s=(e?c(t,i,s):c(s))||s);return e&&s&&j(t,i,s),s};const H=o=>{class t extends o{constructor(){super(...arguments),this.entry="",this._descriptorProvider=new u(this,L,void 0),this._childrenProvider=new u(this,w,[]),this._propertiesProvider=new u(this,R,{}),this._contextProvider=new u(this,E,{}),this._layoutProvider=new u(this,q,{}),this.actions=new D(this),this.context={},this.layout={},this.properties={}}connectedCallback(){super.connectedCallback(),this.container&&(this.actions.setContainer(this.container),r.pt.getInstance(this.container).then(async e=>{var n,c;const s=e.nodes.get(this.entry);if(s){this._propertyChangeListener=e.events.subscribe("components:properties-changed",(p,h)=>{s.id===h.node.id&&this._setProperties(h.node.attributes.properties)}),this._contextChangeListener=e.events.subscribe("components:context-changed",(p,h)=>{s.id===h.node.id&&this._setContext(h.node.attributes.context)}),this._layoutChangeListener=e.events.subscribe("components:layout-changed",(p,h)=>{s.id===h.node.id&&this._setLayout(h.node.attributes.layout)});const d="default";this._unmountNode=s.mount(this.container),this._setDescriptor(r.Et(s,d)),this._setProperties(s.attributes.properties),this._setContext(s.attributes.context),this._setLayout(this.layout);const l=s.getChildren(d).map(p=>r.Et(p));this._childrenProvider.setValue(l);const _=await this.container.getAsync("componentResolver");if(((n=this.descriptor)==null?void 0:n.type)==="area")return;const b=_.getComponent(((c=this.descriptor)==null?void 0:c.type)||"");b.then&&b.then(p=>{this.component=p.default})}}))}disconnectedCallback(){super.disconnectedCallback(),this._propertyChangeListener&&this._propertyChangeListener(),this._contextChangeListener&&this._contextChangeListener(),this._layoutChangeListener&&this._layoutChangeListener(),this._unmountNode&&this._unmountNode()}updated(){this.container&&this.actions.setContainer(this.container),this.renderRoot.host.style.setProperty("--width",this.layout.size==="full"?"var(--columns, 1)":`min(${this.layout.size||"var(--columns)"}, var(--columns))`),$(this.renderRoot.host,this.properties)}_setProperties(e){this._propertiesProvider.setValue(e),this.properties=e}_setContext(e){this._contextProvider.setValue(e),this.context=e}_setLayout(e){this._layoutProvider.setValue(e),this.layout=e}_setDescriptor(e){this.descriptor=e,this._descriptorProvider.setValue(e),this.actions.setDescriptor(e)}}return t.styles=[o.styles??[],r.i`
30
- :host {
31
- font-family: var(--font-family);
32
- grid-column: span var(--width);
33
- max-width: 100%;
34
- overflow: hidden;
35
- box-sizing: border-box;
36
- display: block;
37
- }
38
- * {
39
- box-sizing: border-box;
40
- }
41
- `],a([P({context:O}),r.n({attribute:!1})],t.prototype,"container",2),a([r.n()],t.prototype,"entry",2),a([r.r()],t.prototype,"descriptor",2),a([r.r()],t.prototype,"component",2),a([r.r()],t.prototype,"context",2),a([r.r()],t.prototype,"layout",2),a([r.r()],t.prototype,"properties",2),t};var k=Object.defineProperty,V=Object.getOwnPropertyDescriptor,I=(o,t,i,e)=>{for(var s=e>1?void 0:e?V(t,i):t,n=o.length-1,c;n>=0;n--)(c=o[n])&&(s=(e?c(t,i,s):c(s))||s);return e&&s&&k(t,i,s),s};const g=H(r.s);exports.WidgetHeaderComponent=class extends g{render(){return r.x` <div class="widget-header">
42
- <!-- <telia-icon svg=${y.aiRobot.svg} size="lg"></telia-icon> -->
43
- <div>
44
- <h1>${this.properties.header}</h1>
45
-
46
- ${this.properties.tagline?r.x`<p>${this.properties.tagline}</p>`:r.T}
47
- </div>
48
- </div>`}};exports.WidgetHeaderComponent.styles=[g.styles||[],r.i`
49
- :host {
50
- --header-text-color: var(--text-on-primary-background);
51
- }
52
-
53
- .widget-header {
54
- background-color: transparent;
55
- color: var(--header-text-color);
56
- height: 85px;
57
- display: flex;
58
- gap: var(--spacing-md);
59
- flex-direction: row;
60
- align-items: center;
61
- border-radius: var(--spacing-sm) var(--spacing-sm) 0px 0px;
62
- padding: 0 var(--spacing-md);
63
- }
64
-
65
- h1 {
66
- font-size: 1.2rem;
67
- }
68
-
69
- h1,
70
- p {
71
- margin: 0;
72
- padding: 0;
73
- }
74
- `];exports.WidgetHeaderComponent=I([f("ace-widget-header")],exports.WidgetHeaderComponent);const N=exports.WidgetHeaderComponent;exports.default=N;
@@ -1,341 +0,0 @@
1
- import { p as g, P as L, h as E, i as m, n as x, r as p, E as _, x as f, T as O, s as $ } from "./index-425a19a3.mjs";
2
- import { a as R } from "./ai-robot-dbe1c82f.mjs";
3
- /**
4
- * @license
5
- * Copyright 2017 Google LLC
6
- * SPDX-License-Identifier: BSD-3-Clause
7
- */
8
- const q = (o) => (t, i) => {
9
- i !== void 0 ? i.addInitializer(() => {
10
- customElements.define(o, t);
11
- }) : customElements.define(o, t);
12
- };
13
- /**
14
- * @license
15
- * Copyright 2021 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */
18
- let C = class extends Event {
19
- constructor(t, i, e) {
20
- super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.callback = i, this.subscribe = e ?? !1;
21
- }
22
- };
23
- /**
24
- * @license
25
- * Copyright 2021 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */
28
- /**
29
- * @license
30
- * Copyright 2021 Google LLC
31
- * SPDX-License-Identifier: BSD-3-Clause
32
- */
33
- let y = class {
34
- constructor(t, i, e, s) {
35
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (n, r) => {
36
- this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = n, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(n, r)), this.unsubscribe = r;
37
- }, this.host = t, i.context !== void 0) {
38
- const n = i;
39
- this.context = n.context, this.callback = n.callback, this.subscribe = n.subscribe ?? !1;
40
- } else
41
- this.context = i, this.callback = e, this.subscribe = s ?? !1;
42
- this.host.addController(this);
43
- }
44
- hostConnected() {
45
- this.dispatchRequest();
46
- }
47
- hostDisconnected() {
48
- this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
49
- }
50
- dispatchRequest() {
51
- this.host.dispatchEvent(new C(this.context, this.t, this.subscribe));
52
- }
53
- };
54
- /**
55
- * @license
56
- * Copyright 2021 Google LLC
57
- * SPDX-License-Identifier: BSD-3-Clause
58
- */
59
- class D {
60
- get value() {
61
- return this.o;
62
- }
63
- set value(t) {
64
- this.setValue(t);
65
- }
66
- setValue(t, i = !1) {
67
- const e = i || !Object.is(t, this.o);
68
- this.o = t, e && this.updateObservers();
69
- }
70
- constructor(t) {
71
- this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
72
- for (const [i, { disposer: e }] of this.subscriptions)
73
- i(this.o, e);
74
- }, t !== void 0 && (this.value = t);
75
- }
76
- addCallback(t, i, e) {
77
- if (!e)
78
- return void t(this.value);
79
- this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
80
- this.subscriptions.delete(t);
81
- }, consumerHost: i });
82
- const { disposer: s } = this.subscriptions.get(t);
83
- t(this.value, s);
84
- }
85
- clearCallbacks() {
86
- this.subscriptions.clear();
87
- }
88
- }
89
- /**
90
- * @license
91
- * Copyright 2021 Google LLC
92
- * SPDX-License-Identifier: BSD-3-Clause
93
- */
94
- class z extends Event {
95
- constructor(t) {
96
- super("context-provider", { bubbles: !0, composed: !0 }), this.context = t;
97
- }
98
- }
99
- class u extends D {
100
- constructor(t, i, e) {
101
- super(i.context !== void 0 ? i.initialValue : e), this.onContextRequest = (s) => {
102
- const n = s.composedPath()[0];
103
- s.context === this.context && n !== this.host && (s.stopPropagation(), this.addCallback(s.callback, n, s.subscribe));
104
- }, this.onProviderRequest = (s) => {
105
- const n = s.composedPath()[0];
106
- if (s.context !== this.context || n === this.host)
107
- return;
108
- const r = /* @__PURE__ */ new Set();
109
- for (const [a, { consumerHost: b }] of this.subscriptions)
110
- r.has(a) || (r.add(a), b.dispatchEvent(new C(this.context, a, !0)));
111
- s.stopPropagation();
112
- }, this.host = t, i.context !== void 0 ? this.context = i.context : this.context = i, this.attachListeners(), this.host.addController(this);
113
- }
114
- attachListeners() {
115
- this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
116
- }
117
- hostConnected() {
118
- this.host.dispatchEvent(new z(this.context));
119
- }
120
- }
121
- /**
122
- * @license
123
- * Copyright 2022 Google LLC
124
- * SPDX-License-Identifier: BSD-3-Clause
125
- */
126
- function j({ context: o, subscribe: t }) {
127
- return (i, e) => {
128
- typeof e == "object" ? e.addInitializer(function() {
129
- new y(this, { context: o, callback: (s) => {
130
- this[e.name] = s;
131
- }, subscribe: t });
132
- }) : i.constructor.addInitializer((s) => {
133
- new y(s, { context: o, callback: (n) => {
134
- s[e] = n;
135
- }, subscribe: t });
136
- });
137
- };
138
- }
139
- const k = "children", V = "descriptor", I = "container", W = "context", H = "layout", N = "properties";
140
- class A {
141
- constructor(t) {
142
- (this.host = t).addController(this);
143
- }
144
- hostConnected() {
145
- }
146
- hostDisconnected() {
147
- }
148
- setDescriptor(t) {
149
- this._descriptor = t;
150
- }
151
- setContainer(t) {
152
- this._container = t;
153
- }
154
- async dispatch(t, i) {
155
- if (!this._container || !this._descriptor)
156
- return;
157
- const e = await g.getInstance(
158
- this._container
159
- ), s = new L(e).withId(
160
- this._descriptor.id
161
- );
162
- await e.actions(
163
- s,
164
- this._descriptor.type || E()
165
- ).dispatch(t, i);
166
- }
167
- }
168
- const S = (o) => {
169
- const t = {};
170
- return Object.keys(o).forEach((i) => {
171
- i.indexOf("css-") > -1 && (t[i] = o[i]);
172
- }), t;
173
- }, F = (o, t) => {
174
- const i = S(t);
175
- Object.entries(i).forEach(([e, s]) => {
176
- o.style.setProperty(e.replace("css-", ""), s);
177
- });
178
- };
179
- var M = Object.defineProperty, T = Object.getOwnPropertyDescriptor, h = (o, t, i, e) => {
180
- for (var s = e > 1 ? void 0 : e ? T(t, i) : t, n = o.length - 1, r; n >= 0; n--)
181
- (r = o[n]) && (s = (e ? r(t, i, s) : r(s)) || s);
182
- return e && s && M(t, i, s), s;
183
- };
184
- const U = (o) => {
185
- class t extends o {
186
- constructor() {
187
- super(...arguments), this.entry = "", this._descriptorProvider = new u(
188
- this,
189
- V,
190
- void 0
191
- ), this._childrenProvider = new u(this, k, []), this._propertiesProvider = new u(this, N, {}), this._contextProvider = new u(this, W, {}), this._layoutProvider = new u(this, H, {}), this.actions = new A(this), this.context = {}, this.layout = {}, this.properties = {};
192
- }
193
- connectedCallback() {
194
- super.connectedCallback(), this.container && (this.actions.setContainer(this.container), g.getInstance(this.container).then(
195
- async (e) => {
196
- var n, r;
197
- const s = e.nodes.get(this.entry);
198
- if (s) {
199
- this._propertyChangeListener = e.events.subscribe(
200
- "components:properties-changed",
201
- (d, c) => {
202
- s.id === c.node.id && this._setProperties(c.node.attributes.properties);
203
- }
204
- ), this._contextChangeListener = e.events.subscribe(
205
- "components:context-changed",
206
- (d, c) => {
207
- s.id === c.node.id && this._setContext(c.node.attributes.context);
208
- }
209
- ), this._layoutChangeListener = e.events.subscribe(
210
- "components:layout-changed",
211
- (d, c) => {
212
- s.id === c.node.id && this._setLayout(c.node.attributes.layout);
213
- }
214
- );
215
- const a = "default";
216
- this._unmountNode = s.mount(this.container), this._setDescriptor(_(s, a)), this._setProperties(s.attributes.properties), this._setContext(s.attributes.context), this._setLayout(this.layout);
217
- const b = s.getChildren(a).map((d) => _(d));
218
- this._childrenProvider.setValue(b);
219
- const w = await this.container.getAsync("componentResolver");
220
- if (((n = this.descriptor) == null ? void 0 : n.type) === "area")
221
- return;
222
- const v = w.getComponent(
223
- ((r = this.descriptor) == null ? void 0 : r.type) || ""
224
- );
225
- v.then && v.then((d) => {
226
- this.component = d.default;
227
- });
228
- }
229
- }
230
- ));
231
- }
232
- disconnectedCallback() {
233
- super.disconnectedCallback(), this._propertyChangeListener && this._propertyChangeListener(), this._contextChangeListener && this._contextChangeListener(), this._layoutChangeListener && this._layoutChangeListener(), this._unmountNode && this._unmountNode();
234
- }
235
- updated() {
236
- this.container && this.actions.setContainer(this.container), this.renderRoot.host.style.setProperty(
237
- "--width",
238
- this.layout.size === "full" ? "var(--columns, 1)" : `min(${this.layout.size || "var(--columns)"}, var(--columns))`
239
- ), F(this.renderRoot.host, this.properties);
240
- }
241
- _setProperties(e) {
242
- this._propertiesProvider.setValue(e), this.properties = e;
243
- }
244
- _setContext(e) {
245
- this._contextProvider.setValue(e), this.context = e;
246
- }
247
- _setLayout(e) {
248
- this._layoutProvider.setValue(e), this.layout = e;
249
- }
250
- _setDescriptor(e) {
251
- this.descriptor = e, this._descriptorProvider.setValue(e), this.actions.setDescriptor(e);
252
- }
253
- }
254
- return t.styles = [
255
- o.styles ?? [],
256
- m`
257
- :host {
258
- font-family: var(--font-family);
259
- grid-column: span var(--width);
260
- max-width: 100%;
261
- overflow: hidden;
262
- box-sizing: border-box;
263
- display: block;
264
- }
265
- * {
266
- box-sizing: border-box;
267
- }
268
- `
269
- ], h([
270
- j({ context: I }),
271
- x({ attribute: !1 })
272
- ], t.prototype, "container", 2), h([
273
- x()
274
- ], t.prototype, "entry", 2), h([
275
- p()
276
- ], t.prototype, "descriptor", 2), h([
277
- p()
278
- ], t.prototype, "component", 2), h([
279
- p()
280
- ], t.prototype, "context", 2), h([
281
- p()
282
- ], t.prototype, "layout", 2), h([
283
- p()
284
- ], t.prototype, "properties", 2), t;
285
- };
286
- var B = Object.defineProperty, G = Object.getOwnPropertyDescriptor, J = (o, t, i, e) => {
287
- for (var s = e > 1 ? void 0 : e ? G(t, i) : t, n = o.length - 1, r; n >= 0; n--)
288
- (r = o[n]) && (s = (e ? r(t, i, s) : r(s)) || s);
289
- return e && s && B(t, i, s), s;
290
- };
291
- const P = U($);
292
- let l = class extends P {
293
- render() {
294
- return f` <div class="widget-header">
295
- <!-- <telia-icon svg=${R.svg} size="lg"></telia-icon> -->
296
- <div>
297
- <h1>${this.properties.header}</h1>
298
-
299
- ${this.properties.tagline ? f`<p>${this.properties.tagline}</p>` : O}
300
- </div>
301
- </div>`;
302
- }
303
- };
304
- l.styles = [
305
- P.styles || [],
306
- m`
307
- :host {
308
- --header-text-color: var(--text-on-primary-background);
309
- }
310
-
311
- .widget-header {
312
- background-color: transparent;
313
- color: var(--header-text-color);
314
- height: 85px;
315
- display: flex;
316
- gap: var(--spacing-md);
317
- flex-direction: row;
318
- align-items: center;
319
- border-radius: var(--spacing-sm) var(--spacing-sm) 0px 0px;
320
- padding: 0 var(--spacing-md);
321
- }
322
-
323
- h1 {
324
- font-size: 1.2rem;
325
- }
326
-
327
- h1,
328
- p {
329
- margin: 0;
330
- padding: 0;
331
- }
332
- `
333
- ];
334
- l = J([
335
- q("ace-widget-header")
336
- ], l);
337
- const Z = l;
338
- export {
339
- l as WidgetHeaderComponent,
340
- Z as default
341
- };