@telia-ace/widget-runtime-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/component-platform-factory.d.ts +13 -0
- package/context/children.context.d.ts +4 -0
- package/context/component-node.context.d.ts +4 -0
- package/context/container.context.d.ts +4 -0
- package/context/context.context.d.ts +3 -0
- package/context/layout.context.d.ts +3 -0
- package/context/properties.context.d.ts +3 -0
- package/controllers/actions-controller.d.ts +14 -0
- package/core/create-lit-component.d.ts +11 -0
- package/core/get-render-state.d.ts +4 -0
- package/data-provider/data-provider.d.ts +24 -0
- package/data-provider/providers/guide-provider.plugin.d.ts +2 -0
- package/index-4be3f206.mjs +3409 -0
- package/index-5087564d.mjs +335 -0
- package/index-6dd00f59.js +1 -0
- package/index-e07bd0fb.js +206 -0
- package/{src/index.ts → index.d.ts} +1 -13
- package/index.js +1 -0
- package/index.mjs +17 -0
- package/mixins/widget-component.mixin.d.ts +24 -0
- package/package.json +1 -1
- package/render-049911af.mjs +458 -0
- package/render-f343a6c5.js +120 -0
- package/services.d.ts +5 -0
- package/ui/area.d.ts +9 -0
- package/ui/branding.d.ts +1 -0
- package/ui/get-css-props.d.ts +5 -0
- package/ui/get-layout-props.d.ts +9 -0
- package/ui/html-element-handlers.d.ts +14 -0
- package/ui/prepare-dom.d.ts +21 -0
- package/ui/render.d.ts +3 -0
- package/ui/trigger-component.d.ts +20 -0
- package/ui/view-outlet.d.ts +36 -0
- package/ui/wrapper.d.ts +21 -0
- package/widget.d.ts +54 -0
- package/.eslintrc.json +0 -30
- package/README.md +0 -11
- package/project.json +0 -48
- package/src/component-platform-factory.ts +0 -163
- package/src/context/children.context.ts +0 -4
- package/src/context/component-node.context.ts +0 -6
- package/src/context/container.context.ts +0 -6
- package/src/context/context.context.ts +0 -3
- package/src/context/layout.context.ts +0 -3
- package/src/context/properties.context.ts +0 -3
- package/src/controllers/actions-controller.ts +0 -55
- package/src/core/create-lit-component.ts +0 -31
- package/src/core/get-render-state.ts +0 -25
- package/src/data-provider/data-provider.ts +0 -87
- package/src/data-provider/providers/guide-provider.plugin.ts +0 -64
- package/src/declaration.d.ts +0 -2
- package/src/mixins/widget-component.mixin.ts +0 -231
- package/src/services.ts +0 -27
- package/src/ui/area.ts +0 -97
- package/src/ui/branding.ts +0 -25
- package/src/ui/get-css-props.ts +0 -23
- package/src/ui/get-layout-props.ts +0 -41
- package/src/ui/html-element-handlers.ts +0 -140
- package/src/ui/index.ts +0 -6
- package/src/ui/prepare-dom.ts +0 -164
- package/src/ui/render.ts +0 -19
- package/src/ui/trigger-component.ts +0 -200
- package/src/ui/view-outlet.ts +0 -172
- package/src/ui/wrapper.ts +0 -247
- package/src/vite.env.d.ts +0 -1
- package/src/widget.ts +0 -748
- package/tsconfig.json +0 -23
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -19
- package/vite.config.ts +0 -56
package/src/ui/wrapper.ts
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { ContextProvider } from '@lit-labs/context';
|
|
2
|
-
import { LitElement, css, html, nothing } from 'lit';
|
|
3
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
-
import { createRef, Ref, ref } from 'lit/directives/ref.js';
|
|
5
|
-
import {
|
|
6
|
-
Container,
|
|
7
|
-
EventSubscriptionCancellation,
|
|
8
|
-
} from '@webprovisions/platform';
|
|
9
|
-
import { ComponentPlatform, WidgetRenderState } from '@telia-ace/widget-core';
|
|
10
|
-
|
|
11
|
-
import { containerContext } from '../context/container.context';
|
|
12
|
-
import {
|
|
13
|
-
getRenderState,
|
|
14
|
-
subscribeToRenderState,
|
|
15
|
-
} from '../core/get-render-state';
|
|
16
|
-
import { getLayoutProps } from './get-layout-props';
|
|
17
|
-
|
|
18
|
-
@customElement('ace-widget-wrapper')
|
|
19
|
-
export class WrapperComponent extends LitElement {
|
|
20
|
-
static override styles = css`
|
|
21
|
-
:host {
|
|
22
|
-
--font-family: TeliaSans, Helvetica, Arial, Lucida Grande, sans-serif;
|
|
23
|
-
--spacing-xs: 0.2rem;
|
|
24
|
-
--spacing-sm: 0.5rem;
|
|
25
|
-
--spacing-md: 1rem;
|
|
26
|
-
--spacing-lg: 1.2rem;
|
|
27
|
-
--spacing-xl: 1.8rem;
|
|
28
|
-
|
|
29
|
-
--primary-color: #29003e;
|
|
30
|
-
--secondary-color: #00558f;
|
|
31
|
-
--text-color: #222222;
|
|
32
|
-
--link-color: #990ae3;
|
|
33
|
-
--gray-color: #f3f3f8;
|
|
34
|
-
--gray-dark-color: #a6a6a6;
|
|
35
|
-
|
|
36
|
-
--box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px;
|
|
37
|
-
--border-radius: 1rem;
|
|
38
|
-
--border-radius-sm: 0.3rem;
|
|
39
|
-
}
|
|
40
|
-
:host {
|
|
41
|
-
--voca-rem-multiplier: 0.625;
|
|
42
|
-
box-sizing: border-box;
|
|
43
|
-
display: block;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
:host(.floating) {
|
|
47
|
-
position: fixed;
|
|
48
|
-
z-index: 6;
|
|
49
|
-
inset: auto 20px 95px auto;
|
|
50
|
-
max-height: calc(100vh - 120px);
|
|
51
|
-
}
|
|
52
|
-
:host(.floating) .widget-container {
|
|
53
|
-
box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
|
|
54
|
-
border-radius: 0.7rem;
|
|
55
|
-
}
|
|
56
|
-
:host(.inline) {
|
|
57
|
-
height: 100%;
|
|
58
|
-
position: fixed;
|
|
59
|
-
inset: 0 0 0 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
* {
|
|
63
|
-
box-sizing: border-box;
|
|
64
|
-
}
|
|
65
|
-
.widget-container {
|
|
66
|
-
height: 100%;
|
|
67
|
-
background-color: var(--primary-color);
|
|
68
|
-
padding: 0 var(--spacing-sm);
|
|
69
|
-
}
|
|
70
|
-
.widget-container.expanded {
|
|
71
|
-
opacity: 1;
|
|
72
|
-
animation: slideUp 0.5s;
|
|
73
|
-
}
|
|
74
|
-
.widget-container.hidden {
|
|
75
|
-
opacity: 0;
|
|
76
|
-
animation: slideDown 0.5s;
|
|
77
|
-
}
|
|
78
|
-
@keyframes slideDown {
|
|
79
|
-
from {
|
|
80
|
-
transform: translateY(0);
|
|
81
|
-
opacity: 1;
|
|
82
|
-
}
|
|
83
|
-
to {
|
|
84
|
-
transform: translateY(100%);
|
|
85
|
-
opacity: 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
@keyframes slideUp {
|
|
89
|
-
from {
|
|
90
|
-
transform: translateY(100%);
|
|
91
|
-
opacity: 0;
|
|
92
|
-
}
|
|
93
|
-
to {
|
|
94
|
-
transform: translateY(0);
|
|
95
|
-
opacity: 1;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
// @provide({ context: containerContext })
|
|
100
|
-
// container = this.container;
|
|
101
|
-
private _provider = new ContextProvider(this, containerContext, undefined);
|
|
102
|
-
|
|
103
|
-
@property({ attribute: false })
|
|
104
|
-
container: Container | undefined;
|
|
105
|
-
|
|
106
|
-
wrapperRef: Ref<HTMLDivElement> = createRef();
|
|
107
|
-
|
|
108
|
-
private _unsubscribeRenderState?: EventSubscriptionCancellation;
|
|
109
|
-
private _unsubscribePropChange?: EventSubscriptionCancellation;
|
|
110
|
-
|
|
111
|
-
@state()
|
|
112
|
-
componentPlatform: ComponentPlatform | undefined;
|
|
113
|
-
|
|
114
|
-
@state()
|
|
115
|
-
renderState?: WidgetRenderState;
|
|
116
|
-
|
|
117
|
-
@state()
|
|
118
|
-
breakpoints: string[] = [];
|
|
119
|
-
|
|
120
|
-
@state()
|
|
121
|
-
breakpointsSet = false;
|
|
122
|
-
|
|
123
|
-
@state()
|
|
124
|
-
entry: string | undefined;
|
|
125
|
-
|
|
126
|
-
constructor() {
|
|
127
|
-
super();
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
override connectedCallback() {
|
|
131
|
-
super.connectedCallback();
|
|
132
|
-
this._provider.setValue(this.container);
|
|
133
|
-
|
|
134
|
-
if (this.container) {
|
|
135
|
-
getRenderState(this.container).then((state) => {
|
|
136
|
-
this.renderState = state;
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
subscribeToRenderState(this.container, (_origin, action) => {
|
|
140
|
-
switch (action) {
|
|
141
|
-
case 'close':
|
|
142
|
-
case 'open':
|
|
143
|
-
this.renderState =
|
|
144
|
-
action === 'open'
|
|
145
|
-
? WidgetRenderState.open
|
|
146
|
-
: WidgetRenderState.closed;
|
|
147
|
-
break;
|
|
148
|
-
case 'hide':
|
|
149
|
-
this.renderState = WidgetRenderState.hidden;
|
|
150
|
-
}
|
|
151
|
-
}).then((unsubscribe) => {
|
|
152
|
-
this._unsubscribeRenderState = unsubscribe;
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
ComponentPlatform.getInstance(this.container).then(
|
|
156
|
-
(componentPlatform) => {
|
|
157
|
-
this.componentPlatform = componentPlatform;
|
|
158
|
-
|
|
159
|
-
this.breakpoints = this.componentPlatform.breakpoints;
|
|
160
|
-
this.breakpointsSet = true;
|
|
161
|
-
|
|
162
|
-
this._unsubscribePropChange = this.componentPlatform.events.subscribe(
|
|
163
|
-
'components:properties-changed',
|
|
164
|
-
(_event, data) => {
|
|
165
|
-
if (data?.node?.type === 'root') {
|
|
166
|
-
this.breakpoints = this.componentPlatform?.breakpoints
|
|
167
|
-
? [...this.componentPlatform.breakpoints]
|
|
168
|
-
: [];
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
this.entry =
|
|
174
|
-
this.componentPlatform.nodes.root.children.default[0].id ||
|
|
175
|
-
undefined;
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
override disconnectedCallback(): void {
|
|
182
|
-
super.disconnectedCallback();
|
|
183
|
-
|
|
184
|
-
if (this._unsubscribeRenderState) {
|
|
185
|
-
this._unsubscribeRenderState();
|
|
186
|
-
}
|
|
187
|
-
if (this._unsubscribePropChange) {
|
|
188
|
-
this._unsubscribePropChange();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
override render() {
|
|
193
|
-
let layoutProps: ReturnType<typeof getLayoutProps> | undefined;
|
|
194
|
-
|
|
195
|
-
if (!this.entry || !this.breakpointsSet) {
|
|
196
|
-
return nothing;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (this.container && this.renderState) {
|
|
200
|
-
const [widgetDOMElement] = this.container.get('widgetDOMElements');
|
|
201
|
-
|
|
202
|
-
if (widgetDOMElement) {
|
|
203
|
-
widgetDOMElement.setAttribute('data-state', this.renderState);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (this.container) {
|
|
208
|
-
const settings = this.container.get('$settings');
|
|
209
|
-
|
|
210
|
-
if (settings?.layout) {
|
|
211
|
-
layoutProps = getLayoutProps(
|
|
212
|
-
settings.layout,
|
|
213
|
-
this.breakpoints,
|
|
214
|
-
!!settings.trigger
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
if (layoutProps.type === 'floating') {
|
|
218
|
-
(this.renderRoot as any).host.classList.add('floating');
|
|
219
|
-
(this.renderRoot as any).host.classList.remove('inline');
|
|
220
|
-
} else {
|
|
221
|
-
(this.renderRoot as any).host.classList.add('inline');
|
|
222
|
-
(this.renderRoot as any).host.classList.remove('floating');
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
Object.entries(layoutProps.styles).forEach(([key, value]) => {
|
|
226
|
-
(this.renderRoot as any).host.style.setProperty(key, value);
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (this.renderState) {
|
|
232
|
-
if (this.renderState === WidgetRenderState.hidden) {
|
|
233
|
-
this.wrapperRef.value?.classList.add('hidden');
|
|
234
|
-
this.wrapperRef.value?.classList.remove('expanded');
|
|
235
|
-
} else {
|
|
236
|
-
this.wrapperRef.value?.classList.remove('hidden');
|
|
237
|
-
this.wrapperRef.value?.classList.add('expanded');
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return html`
|
|
242
|
-
<div class="widget-container" ${ref(this.wrapperRef)}>
|
|
243
|
-
<ace-area entry=${this.entry}></ace-area>
|
|
244
|
-
</div>
|
|
245
|
-
`;
|
|
246
|
-
}
|
|
247
|
-
}
|
package/src/vite.env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|