@telia-ace/widget-components-widget-header-flamingo 1.1.2 → 1.1.3
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/ai-robot-0e89be0b.js +1 -0
- package/ai-robot-dbe1c82f.mjs +4 -0
- package/index-0bcf9ac3.mjs +2572 -0
- package/index-76cdc3ae.js +148 -0
- package/index-d18b6f25.mjs +336 -0
- package/index-df07fc07.js +1 -0
- package/{src/index.ts → index.d.ts} +0 -3
- package/index.js +1 -0
- package/index.mjs +4 -0
- package/package.json +2 -2
- package/widget-header-component.d.ts +3 -0
- package/widget-header-d4b70c0d.js +74 -0
- package/widget-header-e556e370.mjs +353 -0
- package/widget-header.d.ts +7 -0
- package/.eslintrc.json +0 -30
- package/README.md +0 -11
- package/project.json +0 -48
- package/src/widget-header-component.ts +0 -15
- package/src/widget-header.ts +0 -51
- package/tsconfig.json +0 -23
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -19
- package/vite.config.ts +0 -57
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./index-76cdc3ae.js");module.exports=e.WidgetHeaderComponent;
|
package/index.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/widget-components-widget-header-flamingo",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@telia-ace/widget-runtime-flamingo": "1.1.
|
|
5
|
+
"@telia-ace/widget-runtime-flamingo": "1.1.3",
|
|
6
6
|
"@webprovisions/platform": "^1.1.3",
|
|
7
7
|
"lit": "^2.8.0",
|
|
8
8
|
"@teliads/icons": "^8.4.0"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-76cdc3ae.js"),y=require("./ai-robot-0e89be0b.js");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const g=o=>t=>typeof t=="function"?((i,e)=>(customElements.define(i,e),e))(o,t):((i,e)=>{const{kind:s,elements:n}=e;return{kind:s,elements:n,finisher(r){customElements.define(i,r)}}})(o,t);/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const _=({finisher:o,descriptor:t})=>(i,e)=>{var s;if(e===void 0){const n=(s=i.originalKey)!==null&&s!==void 0?s:i.key,r=t!=null?{kind:"method",placement:"prototype",key:n,descriptor:t(i.key)}:{...i,key:n};return o!=null&&(r.finisher=function(h){o(h,n)}),r}{const n=i.constructor;t!==void 0&&Object.defineProperty(i,e,t(e)),o==null||o(n,e)}};/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2021 Google LLC
|
|
12
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
+
*/let v=class extends Event{constructor(t,i,e){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=i,this.subscribe=e!=null&&e}};/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2021 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*//**
|
|
18
|
+
* @license
|
|
19
|
+
* Copyright 2021 Google LLC
|
|
20
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
+
*/let m=class{constructor(t,i,e,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(r,h)=>{this.unsubscribe&&(this.unsubscribe!==h&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=r,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(r,h)),this.unsubscribe=h},this.host=t,i.context!==void 0){const r=i;this.context=r.context,this.callback=r.callback,this.subscribe=(n=r.subscribe)!==null&&n!==void 0&&n}else this.context=i,this.callback=e,this.subscribe=s!=null&&s;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new v(this.context,this.t,this.subscribe))}};/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2021 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/class C{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)}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()}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()}}/**
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright 2021 Google LLC
|
|
28
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
29
|
+
*/class P extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}}class l 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 r=new Set;for(const[h,{consumerHost:u}]of this.subscriptions)r.has(h)||(r.add(h),u.dispatchEvent(new v(this.context,h,!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 P(this.context))}}/**
|
|
30
|
+
* @license
|
|
31
|
+
* Copyright 2022 Google LLC
|
|
32
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
33
|
+
*/function w({context:o,subscribe:t}){return _({finisher:(i,e)=>{i.addInitializer(s=>{new m(s,{context:o,callback:n=>{s[e]=n},subscribe:t})})}})}const L="children",O="descriptor",E="container",k="context",R="layout",q="properties";class ${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 c.pt.getInstance(this._container),s=new c.P(e).withId(this._descriptor.id);await e.actions(s,this._descriptor.type||c.ht()).dispatch(t,i)}}const D=o=>{const t={};return Object.keys(o).forEach(i=>{i.indexOf("css-")>-1&&(t[i]=o[i])}),t},W=(o,t)=>{const i=D(t);Object.entries(i).forEach(([e,s])=>{o.style.setProperty(e.replace("css-",""),s)})};var j=Object.defineProperty,H=Object.getOwnPropertyDescriptor,d=(o,t,i,e)=>{for(var s=e>1?void 0:e?H(t,i):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(s=(e?r(t,i,s):r(s))||s);return e&&s&&j(t,i,s),s};const V=o=>{class t extends o{constructor(){super(...arguments),this.entry="",this._descriptorProvider=new l(this,O,void 0),this._childrenProvider=new l(this,L,[]),this._propertiesProvider=new l(this,q,{}),this._contextProvider=new l(this,k,{}),this._layoutProvider=new l(this,R,{}),this.actions=new $(this),this.context={},this.layout={},this.properties={}}connectedCallback(){super.connectedCallback(),this.container&&(this.actions.setContainer(this.container),c.pt.getInstance(this.container).then(async e=>{var n,r;const s=e.nodes.get(this.entry);if(s){this._propertyChangeListener=e.events.subscribe("components:properties-changed",(p,a)=>{s.id===a.node.id&&this._setProperties(a.node.attributes.properties)}),this._contextChangeListener=e.events.subscribe("components:context-changed",(p,a)=>{s.id===a.node.id&&this._setContext(a.node.attributes.context)}),this._layoutChangeListener=e.events.subscribe("components:layout-changed",(p,a)=>{s.id===a.node.id&&this._setLayout(a.node.attributes.layout)});const h="default";this._unmountNode=s.mount(this.container),this._setDescriptor(c.Et(s,h)),this._setProperties(s.attributes.properties),this._setContext(s.attributes.context),this._setLayout(this.layout);const u=s.getChildren(h).map(p=>c.Et(p));this._childrenProvider.setValue(u);const f=await this.container.getAsync("componentResolver");if(((n=this.descriptor)==null?void 0:n.type)==="area")return;const b=f.getComponent(((r=this.descriptor)==null?void 0:r.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),c.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))`),W(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??[],c.i`
|
|
34
|
+
:host {
|
|
35
|
+
font-family: var(--font-family);
|
|
36
|
+
grid-column: span var(--width);
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
display: block;
|
|
41
|
+
}
|
|
42
|
+
* {
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
}
|
|
45
|
+
`],d([w({context:E}),c.n({attribute:!1})],t.prototype,"container",2),d([c.n()],t.prototype,"entry",2),d([c.t()],t.prototype,"descriptor",2),d([c.t()],t.prototype,"component",2),d([c.t()],t.prototype,"context",2),d([c.t()],t.prototype,"layout",2),d([c.t()],t.prototype,"properties",2),t};var z=Object.defineProperty,I=Object.getOwnPropertyDescriptor,N=(o,t,i,e)=>{for(var s=e>1?void 0:e?I(t,i):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(s=(e?r(t,i,s):r(s))||s);return e&&s&&z(t,i,s),s};const x=V(c.s);exports.WidgetHeaderComponent=class extends x{render(){return c.x` <div class="widget-header">
|
|
46
|
+
<telia-icon svg=${y.aiRobot.svg} size="lg"></telia-icon>
|
|
47
|
+
<div>
|
|
48
|
+
<h1>${this.properties.header}</h1>
|
|
49
|
+
|
|
50
|
+
${this.properties.tagline?c.x`<p>${this.properties.tagline}</p>`:c.A}
|
|
51
|
+
</div>
|
|
52
|
+
</div>`}};exports.WidgetHeaderComponent.styles=[x.styles||[],c.i`
|
|
53
|
+
.widget-header {
|
|
54
|
+
background-color: transparent;
|
|
55
|
+
color: #fff;
|
|
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=N([g("ace-widget-header")],exports.WidgetHeaderComponent);const S=exports.WidgetHeaderComponent;exports.default=S;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { p as _, P as w, h as L, i as g, n as x, t as p, E as f, m as $, x as y, A as O, s as E } from "./index-0bcf9ac3.mjs";
|
|
2
|
+
import { a as k } from "./ai-robot-dbe1c82f.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2017 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
const R = (n) => (t) => typeof t == "function" ? ((i, e) => (customElements.define(i, e), e))(n, t) : ((i, e) => {
|
|
9
|
+
const { kind: s, elements: o } = e;
|
|
10
|
+
return { kind: s, elements: o, finisher(r) {
|
|
11
|
+
customElements.define(i, r);
|
|
12
|
+
} };
|
|
13
|
+
})(n, t);
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright 2017 Google LLC
|
|
17
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
+
*/
|
|
19
|
+
const q = ({ finisher: n, descriptor: t }) => (i, e) => {
|
|
20
|
+
var s;
|
|
21
|
+
if (e === void 0) {
|
|
22
|
+
const o = (s = i.originalKey) !== null && s !== void 0 ? s : i.key, r = t != null ? { kind: "method", placement: "prototype", key: o, descriptor: t(i.key) } : { ...i, key: o };
|
|
23
|
+
return n != null && (r.finisher = function(c) {
|
|
24
|
+
n(c, o);
|
|
25
|
+
}), r;
|
|
26
|
+
}
|
|
27
|
+
{
|
|
28
|
+
const o = i.constructor;
|
|
29
|
+
t !== void 0 && Object.defineProperty(i, e, t(e)), n == null || n(o, e);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2021 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
36
|
+
*/
|
|
37
|
+
let m = class extends Event {
|
|
38
|
+
constructor(t, i, e) {
|
|
39
|
+
super("context-request", { bubbles: !0, composed: !0 }), this.context = t, this.callback = i, this.subscribe = e != null && e;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* @license
|
|
44
|
+
* Copyright 2021 Google LLC
|
|
45
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* @license
|
|
49
|
+
* Copyright 2021 Google LLC
|
|
50
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
|
+
*/
|
|
52
|
+
let D = class {
|
|
53
|
+
constructor(t, i, e, s) {
|
|
54
|
+
var o;
|
|
55
|
+
if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (r, c) => {
|
|
56
|
+
this.unsubscribe && (this.unsubscribe !== c && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = r, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(r, c)), this.unsubscribe = c;
|
|
57
|
+
}, this.host = t, i.context !== void 0) {
|
|
58
|
+
const r = i;
|
|
59
|
+
this.context = r.context, this.callback = r.callback, this.subscribe = (o = r.subscribe) !== null && o !== void 0 && o;
|
|
60
|
+
} else
|
|
61
|
+
this.context = i, this.callback = e, this.subscribe = s != null && s;
|
|
62
|
+
this.host.addController(this);
|
|
63
|
+
}
|
|
64
|
+
hostConnected() {
|
|
65
|
+
this.dispatchRequest();
|
|
66
|
+
}
|
|
67
|
+
hostDisconnected() {
|
|
68
|
+
this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0);
|
|
69
|
+
}
|
|
70
|
+
dispatchRequest() {
|
|
71
|
+
this.host.dispatchEvent(new m(this.context, this.t, this.subscribe));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* @license
|
|
76
|
+
* Copyright 2021 Google LLC
|
|
77
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
78
|
+
*/
|
|
79
|
+
class j {
|
|
80
|
+
constructor(t) {
|
|
81
|
+
this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
|
|
82
|
+
for (const [i, { disposer: e }] of this.subscriptions)
|
|
83
|
+
i(this.o, e);
|
|
84
|
+
}, t !== void 0 && (this.value = t);
|
|
85
|
+
}
|
|
86
|
+
get value() {
|
|
87
|
+
return this.o;
|
|
88
|
+
}
|
|
89
|
+
set value(t) {
|
|
90
|
+
this.setValue(t);
|
|
91
|
+
}
|
|
92
|
+
setValue(t, i = !1) {
|
|
93
|
+
const e = i || !Object.is(t, this.o);
|
|
94
|
+
this.o = t, e && this.updateObservers();
|
|
95
|
+
}
|
|
96
|
+
addCallback(t, i, e) {
|
|
97
|
+
if (!e)
|
|
98
|
+
return void t(this.value);
|
|
99
|
+
this.subscriptions.has(t) || this.subscriptions.set(t, { disposer: () => {
|
|
100
|
+
this.subscriptions.delete(t);
|
|
101
|
+
}, consumerHost: i });
|
|
102
|
+
const { disposer: s } = this.subscriptions.get(t);
|
|
103
|
+
t(this.value, s);
|
|
104
|
+
}
|
|
105
|
+
clearCallbacks() {
|
|
106
|
+
this.subscriptions.clear();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @license
|
|
111
|
+
* Copyright 2021 Google LLC
|
|
112
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
113
|
+
*/
|
|
114
|
+
class V extends Event {
|
|
115
|
+
constructor(t) {
|
|
116
|
+
super("context-provider", { bubbles: !0, composed: !0 }), this.context = t;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
class l extends j {
|
|
120
|
+
constructor(t, i, e) {
|
|
121
|
+
super(i.context !== void 0 ? i.initialValue : e), this.onContextRequest = (s) => {
|
|
122
|
+
const o = s.composedPath()[0];
|
|
123
|
+
s.context === this.context && o !== this.host && (s.stopPropagation(), this.addCallback(s.callback, o, s.subscribe));
|
|
124
|
+
}, this.onProviderRequest = (s) => {
|
|
125
|
+
const o = s.composedPath()[0];
|
|
126
|
+
if (s.context !== this.context || o === this.host)
|
|
127
|
+
return;
|
|
128
|
+
const r = /* @__PURE__ */ new Set();
|
|
129
|
+
for (const [c, { consumerHost: b }] of this.subscriptions)
|
|
130
|
+
r.has(c) || (r.add(c), b.dispatchEvent(new m(this.context, c, !0)));
|
|
131
|
+
s.stopPropagation();
|
|
132
|
+
}, this.host = t, i.context !== void 0 ? this.context = i.context : this.context = i, this.attachListeners(), this.host.addController(this);
|
|
133
|
+
}
|
|
134
|
+
attachListeners() {
|
|
135
|
+
this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
|
|
136
|
+
}
|
|
137
|
+
hostConnected() {
|
|
138
|
+
this.host.dispatchEvent(new V(this.context));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @license
|
|
143
|
+
* Copyright 2022 Google LLC
|
|
144
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
145
|
+
*/
|
|
146
|
+
function z({ context: n, subscribe: t }) {
|
|
147
|
+
return q({ finisher: (i, e) => {
|
|
148
|
+
i.addInitializer((s) => {
|
|
149
|
+
new D(s, { context: n, callback: (o) => {
|
|
150
|
+
s[e] = o;
|
|
151
|
+
}, subscribe: t });
|
|
152
|
+
});
|
|
153
|
+
} });
|
|
154
|
+
}
|
|
155
|
+
const W = "children", H = "descriptor", I = "container", N = "context", A = "layout", S = "properties";
|
|
156
|
+
class B {
|
|
157
|
+
constructor(t) {
|
|
158
|
+
(this.host = t).addController(this);
|
|
159
|
+
}
|
|
160
|
+
hostConnected() {
|
|
161
|
+
}
|
|
162
|
+
hostDisconnected() {
|
|
163
|
+
}
|
|
164
|
+
setDescriptor(t) {
|
|
165
|
+
this._descriptor = t;
|
|
166
|
+
}
|
|
167
|
+
setContainer(t) {
|
|
168
|
+
this._container = t;
|
|
169
|
+
}
|
|
170
|
+
async dispatch(t, i) {
|
|
171
|
+
if (!this._container || !this._descriptor)
|
|
172
|
+
return;
|
|
173
|
+
const e = await _.getInstance(
|
|
174
|
+
this._container
|
|
175
|
+
), s = new w(e).withId(
|
|
176
|
+
this._descriptor.id
|
|
177
|
+
);
|
|
178
|
+
await e.actions(
|
|
179
|
+
s,
|
|
180
|
+
this._descriptor.type || L()
|
|
181
|
+
).dispatch(t, i);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const F = (n) => {
|
|
185
|
+
const t = {};
|
|
186
|
+
return Object.keys(n).forEach((i) => {
|
|
187
|
+
i.indexOf("css-") > -1 && (t[i] = n[i]);
|
|
188
|
+
}), t;
|
|
189
|
+
}, K = (n, t) => {
|
|
190
|
+
const i = F(t);
|
|
191
|
+
Object.entries(i).forEach(([e, s]) => {
|
|
192
|
+
n.style.setProperty(e.replace("css-", ""), s);
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
var M = Object.defineProperty, U = Object.getOwnPropertyDescriptor, a = (n, t, i, e) => {
|
|
196
|
+
for (var s = e > 1 ? void 0 : e ? U(t, i) : t, o = n.length - 1, r; o >= 0; o--)
|
|
197
|
+
(r = n[o]) && (s = (e ? r(t, i, s) : r(s)) || s);
|
|
198
|
+
return e && s && M(t, i, s), s;
|
|
199
|
+
};
|
|
200
|
+
const G = (n) => {
|
|
201
|
+
class t extends n {
|
|
202
|
+
constructor() {
|
|
203
|
+
super(...arguments), this.entry = "", this._descriptorProvider = new l(
|
|
204
|
+
this,
|
|
205
|
+
H,
|
|
206
|
+
void 0
|
|
207
|
+
), this._childrenProvider = new l(this, W, []), this._propertiesProvider = new l(this, S, {}), this._contextProvider = new l(this, N, {}), this._layoutProvider = new l(this, A, {}), this.actions = new B(this), this.context = {}, this.layout = {}, this.properties = {};
|
|
208
|
+
}
|
|
209
|
+
connectedCallback() {
|
|
210
|
+
super.connectedCallback(), this.container && (this.actions.setContainer(this.container), _.getInstance(this.container).then(
|
|
211
|
+
async (e) => {
|
|
212
|
+
var o, r;
|
|
213
|
+
const s = e.nodes.get(this.entry);
|
|
214
|
+
if (s) {
|
|
215
|
+
this._propertyChangeListener = e.events.subscribe(
|
|
216
|
+
"components:properties-changed",
|
|
217
|
+
(d, h) => {
|
|
218
|
+
s.id === h.node.id && this._setProperties(h.node.attributes.properties);
|
|
219
|
+
}
|
|
220
|
+
), this._contextChangeListener = e.events.subscribe(
|
|
221
|
+
"components:context-changed",
|
|
222
|
+
(d, h) => {
|
|
223
|
+
s.id === h.node.id && this._setContext(h.node.attributes.context);
|
|
224
|
+
}
|
|
225
|
+
), this._layoutChangeListener = e.events.subscribe(
|
|
226
|
+
"components:layout-changed",
|
|
227
|
+
(d, h) => {
|
|
228
|
+
s.id === h.node.id && this._setLayout(h.node.attributes.layout);
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
const c = "default";
|
|
232
|
+
this._unmountNode = s.mount(this.container), this._setDescriptor(f(s, c)), this._setProperties(s.attributes.properties), this._setContext(s.attributes.context), this._setLayout(this.layout);
|
|
233
|
+
const b = s.getChildren(c).map((d) => f(d));
|
|
234
|
+
this._childrenProvider.setValue(b);
|
|
235
|
+
const P = await this.container.getAsync("componentResolver");
|
|
236
|
+
if (((o = this.descriptor) == null ? void 0 : o.type) === "area")
|
|
237
|
+
return;
|
|
238
|
+
const v = P.getComponent(
|
|
239
|
+
((r = this.descriptor) == null ? void 0 : r.type) || ""
|
|
240
|
+
);
|
|
241
|
+
v.then && v.then((d) => {
|
|
242
|
+
this.component = d.default;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
));
|
|
247
|
+
}
|
|
248
|
+
disconnectedCallback() {
|
|
249
|
+
super.disconnectedCallback(), this._propertyChangeListener && this._propertyChangeListener(), this._contextChangeListener && this._contextChangeListener(), this._layoutChangeListener && this._layoutChangeListener(), this._unmountNode && this._unmountNode();
|
|
250
|
+
}
|
|
251
|
+
updated() {
|
|
252
|
+
this.container && this.actions.setContainer(this.container), $(this.context, this.renderRoot.host), this.renderRoot.host.style.setProperty(
|
|
253
|
+
"--width",
|
|
254
|
+
this.layout.size === "full" ? "var(--columns, 1)" : `min(${this.layout.size || "var(--columns)"}, var(--columns))`
|
|
255
|
+
), K(this.renderRoot.host, this.properties);
|
|
256
|
+
}
|
|
257
|
+
_setProperties(e) {
|
|
258
|
+
this._propertiesProvider.setValue(e), this.properties = e;
|
|
259
|
+
}
|
|
260
|
+
_setContext(e) {
|
|
261
|
+
this._contextProvider.setValue(e), this.context = e;
|
|
262
|
+
}
|
|
263
|
+
_setLayout(e) {
|
|
264
|
+
this._layoutProvider.setValue(e), this.layout = e;
|
|
265
|
+
}
|
|
266
|
+
_setDescriptor(e) {
|
|
267
|
+
this.descriptor = e, this._descriptorProvider.setValue(e), this.actions.setDescriptor(e);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return t.styles = [
|
|
271
|
+
n.styles ?? [],
|
|
272
|
+
g`
|
|
273
|
+
:host {
|
|
274
|
+
font-family: var(--font-family);
|
|
275
|
+
grid-column: span var(--width);
|
|
276
|
+
max-width: 100%;
|
|
277
|
+
overflow: hidden;
|
|
278
|
+
box-sizing: border-box;
|
|
279
|
+
display: block;
|
|
280
|
+
}
|
|
281
|
+
* {
|
|
282
|
+
box-sizing: border-box;
|
|
283
|
+
}
|
|
284
|
+
`
|
|
285
|
+
], a([
|
|
286
|
+
z({ context: I }),
|
|
287
|
+
x({ attribute: !1 })
|
|
288
|
+
], t.prototype, "container", 2), a([
|
|
289
|
+
x()
|
|
290
|
+
], t.prototype, "entry", 2), a([
|
|
291
|
+
p()
|
|
292
|
+
], t.prototype, "descriptor", 2), a([
|
|
293
|
+
p()
|
|
294
|
+
], t.prototype, "component", 2), a([
|
|
295
|
+
p()
|
|
296
|
+
], t.prototype, "context", 2), a([
|
|
297
|
+
p()
|
|
298
|
+
], t.prototype, "layout", 2), a([
|
|
299
|
+
p()
|
|
300
|
+
], t.prototype, "properties", 2), t;
|
|
301
|
+
};
|
|
302
|
+
var J = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, T = (n, t, i, e) => {
|
|
303
|
+
for (var s = e > 1 ? void 0 : e ? Q(t, i) : t, o = n.length - 1, r; o >= 0; o--)
|
|
304
|
+
(r = n[o]) && (s = (e ? r(t, i, s) : r(s)) || s);
|
|
305
|
+
return e && s && J(t, i, s), s;
|
|
306
|
+
};
|
|
307
|
+
const C = G(E);
|
|
308
|
+
let u = class extends C {
|
|
309
|
+
render() {
|
|
310
|
+
return y` <div class="widget-header">
|
|
311
|
+
<telia-icon svg=${k.svg} size="lg"></telia-icon>
|
|
312
|
+
<div>
|
|
313
|
+
<h1>${this.properties.header}</h1>
|
|
314
|
+
|
|
315
|
+
${this.properties.tagline ? y`<p>${this.properties.tagline}</p>` : O}
|
|
316
|
+
</div>
|
|
317
|
+
</div>`;
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
u.styles = [
|
|
321
|
+
C.styles || [],
|
|
322
|
+
g`
|
|
323
|
+
.widget-header {
|
|
324
|
+
background-color: transparent;
|
|
325
|
+
color: #fff;
|
|
326
|
+
height: 85px;
|
|
327
|
+
display: flex;
|
|
328
|
+
gap: var(--spacing-md);
|
|
329
|
+
flex-direction: row;
|
|
330
|
+
align-items: center;
|
|
331
|
+
border-radius: var(--spacing-sm) var(--spacing-sm) 0px 0px;
|
|
332
|
+
padding: 0 var(--spacing-md);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
h1 {
|
|
336
|
+
font-size: 1.2rem;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
h1,
|
|
340
|
+
p {
|
|
341
|
+
margin: 0;
|
|
342
|
+
padding: 0;
|
|
343
|
+
}
|
|
344
|
+
`
|
|
345
|
+
];
|
|
346
|
+
u = T([
|
|
347
|
+
R("ace-widget-header")
|
|
348
|
+
], u);
|
|
349
|
+
const et = u;
|
|
350
|
+
export {
|
|
351
|
+
u as WidgetHeaderComponent,
|
|
352
|
+
et as default
|
|
353
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
declare const WidgetElement: (new (...args: any[]) => import("libs/runtime/src/mixins/widget-component.mixin").WidgetComponentInterface) & typeof LitElement;
|
|
3
|
+
export declare class WidgetHeaderComponent extends WidgetElement {
|
|
4
|
+
static styles: import("lit").CSSResultGroup[];
|
|
5
|
+
render(): import("lit").TemplateResult<1>;
|
|
6
|
+
}
|
|
7
|
+
export default WidgetHeaderComponent;
|
package/.eslintrc.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
-
"rules": {}
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.js", "*.jsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"files": ["*.json"],
|
|
19
|
-
"parser": "jsonc-eslint-parser",
|
|
20
|
-
"rules": {
|
|
21
|
-
"@nx/dependency-checks": [
|
|
22
|
-
"error",
|
|
23
|
-
{
|
|
24
|
-
"ignoredFiles": ["{projectRoot}/vite.config.{js,ts,mjs,mts}"]
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
package/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# widget-components-widget-header-flamingo
|
|
2
|
-
|
|
3
|
-
This library was generated with [Nx](https://nx.dev).
|
|
4
|
-
|
|
5
|
-
## Building
|
|
6
|
-
|
|
7
|
-
Run `nx build widget-components-widget-header-flamingo` to build the library.
|
|
8
|
-
|
|
9
|
-
## Running unit tests
|
|
10
|
-
|
|
11
|
-
Run `nx test widget-components-widget-header-flamingo` to execute the unit tests via [Jest](https://jestjs.io).
|
package/project.json
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "components-widget-header",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/components-widget-header/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"executor": "@nx/vite:build",
|
|
9
|
-
"outputs": ["{options.outputPath}"],
|
|
10
|
-
"options": {
|
|
11
|
-
"outputPath": "dist/libs/components-widget-header"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"publish": {
|
|
15
|
-
"executor": "nx:run-commands",
|
|
16
|
-
"options": {
|
|
17
|
-
"command": "npm publish",
|
|
18
|
-
"cwd": "dist/libs/components-widget-header"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"prerelease": {
|
|
22
|
-
"executor": "nx:run-commands",
|
|
23
|
-
"options": {
|
|
24
|
-
"command": "npm publish --tag=rc",
|
|
25
|
-
"cwd": "dist/libs/components-widget-header"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"test": {
|
|
29
|
-
"executor": "@nx/vite:test",
|
|
30
|
-
"outputs": ["{options.reportsDirectory}"],
|
|
31
|
-
"options": {
|
|
32
|
-
"passWithNoTests": true,
|
|
33
|
-
"reportsDirectory": "../../coverage/libs/components-widget-header"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"lint": {
|
|
37
|
-
"executor": "@nx/eslint:lint",
|
|
38
|
-
"outputs": ["{options.outputFile}"],
|
|
39
|
-
"options": {
|
|
40
|
-
"lintFilePatterns": [
|
|
41
|
-
"libs/components-widget-header/**/*.ts",
|
|
42
|
-
"libs/components-widget-header/package.json"
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"tags": []
|
|
48
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createWebComponent } from '@telia-ace/widget-runtime-flamingo';
|
|
2
|
-
import { Container } from '@webprovisions/platform';
|
|
3
|
-
|
|
4
|
-
export const WidgetHeaderComponent = (container: Container) => {
|
|
5
|
-
return createWebComponent(
|
|
6
|
-
container,
|
|
7
|
-
'widget-header',
|
|
8
|
-
import('./widget-header'),
|
|
9
|
-
(_component) => {
|
|
10
|
-
//
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default WidgetHeaderComponent;
|
package/src/widget-header.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { LitElement, css, html, nothing } from 'lit';
|
|
2
|
-
import { customElement } from 'lit/decorators.js';
|
|
3
|
-
import { WidgetComponent } from '@telia-ace/widget-runtime-flamingo';
|
|
4
|
-
import { aiRobot } from '@teliads/icons';
|
|
5
|
-
|
|
6
|
-
const WidgetElement = WidgetComponent(LitElement);
|
|
7
|
-
|
|
8
|
-
@customElement('ace-widget-header')
|
|
9
|
-
export class WidgetHeaderComponent extends WidgetElement {
|
|
10
|
-
static override styles = [
|
|
11
|
-
WidgetElement.styles || [],
|
|
12
|
-
css`
|
|
13
|
-
.widget-header {
|
|
14
|
-
background-color: transparent;
|
|
15
|
-
color: #fff;
|
|
16
|
-
height: 85px;
|
|
17
|
-
display: flex;
|
|
18
|
-
gap: var(--spacing-md);
|
|
19
|
-
flex-direction: row;
|
|
20
|
-
align-items: center;
|
|
21
|
-
border-radius: var(--spacing-sm) var(--spacing-sm) 0px 0px;
|
|
22
|
-
padding: 0 var(--spacing-md);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
h1 {
|
|
26
|
-
font-size: 1.2rem;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
h1,
|
|
30
|
-
p {
|
|
31
|
-
margin: 0;
|
|
32
|
-
padding: 0;
|
|
33
|
-
}
|
|
34
|
-
`,
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
override render() {
|
|
38
|
-
return html` <div class="widget-header">
|
|
39
|
-
<telia-icon svg=${aiRobot.svg} size="lg"></telia-icon>
|
|
40
|
-
<div>
|
|
41
|
-
<h1>${this.properties.header}</h1>
|
|
42
|
-
|
|
43
|
-
${this.properties.tagline
|
|
44
|
-
? html`<p>${this.properties.tagline}</p>`
|
|
45
|
-
: nothing}
|
|
46
|
-
</div>
|
|
47
|
-
</div>`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default WidgetHeaderComponent;
|
package/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"forceConsistentCasingInFileNames": true,
|
|
6
|
-
"strict": true,
|
|
7
|
-
"noImplicitOverride": true,
|
|
8
|
-
"noPropertyAccessFromIndexSignature": false,
|
|
9
|
-
"noImplicitReturns": false,
|
|
10
|
-
"noFallthroughCasesInSwitch": true,
|
|
11
|
-
"types": ["vitest"]
|
|
12
|
-
},
|
|
13
|
-
"files": [],
|
|
14
|
-
"include": [],
|
|
15
|
-
"references": [
|
|
16
|
-
{
|
|
17
|
-
"path": "./tsconfig.lib.json"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "./tsconfig.spec.json"
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
package/tsconfig.lib.json
DELETED