@telia-ace/widget-core 1.0.17 → 1.0.18-next.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/dist/bootstrap.d.ts +15 -0
- package/dist/environment.d.ts +48 -0
- package/dist/implementation.d.ts +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +329 -256
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/version.d.ts +2 -0
- package/dist/widget-type.d.ts +7 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var q = Object.defineProperty, z = Object.defineProperties;
|
|
2
|
+
var Q = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var H = Object.getOwnPropertySymbols;
|
|
4
|
+
var F = Object.prototype.hasOwnProperty, G = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var C = (n, t, e) => t in n ? q(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, x = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
7
|
+
F.call(t, e) && C(n, e, t[e]);
|
|
8
|
+
if (H)
|
|
9
|
+
for (var e of H(t))
|
|
10
|
+
G.call(t, e) && C(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
import {
|
|
15
|
-
import { createConfigurationApi as
|
|
16
|
-
|
|
12
|
+
}, B = (n, t) => z(n, Q(t));
|
|
13
|
+
var u = (n, t, e) => (C(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
14
|
+
import { bootstrapImplementation as K, ConfigurationApi as U } from "@webprovisions/bootstrapping";
|
|
15
|
+
import { selectImplementations as W, createConfigurationApi as Y, Environment as J, version as X, Implementation as Z, Plugin as tt, WidgetType as et } from "@webprovisions/platform";
|
|
16
|
+
import { uuid as k, Logger as $ } from "@telia-ace/widget-utilities";
|
|
17
|
+
class xt {
|
|
17
18
|
constructor(t) {
|
|
18
|
-
|
|
19
|
+
u(this, "events");
|
|
19
20
|
const { events: e } = t.get("$widget");
|
|
20
21
|
this.events = e.createChild(this);
|
|
21
22
|
}
|
|
@@ -25,15 +26,29 @@ class ht {
|
|
|
25
26
|
subscribe(t, e) {
|
|
26
27
|
return this.events.subscribe(
|
|
27
28
|
"data:action",
|
|
28
|
-
(s, { action:
|
|
29
|
+
(s, { action: i, value: c, target: o }) => t === o && e(t, i, c)
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
const
|
|
33
|
+
const wt = (n, t, e = {}) => K(
|
|
34
|
+
n,
|
|
35
|
+
n.bindings,
|
|
36
|
+
() => {
|
|
37
|
+
const s = n.container.get("$runtimecfg").map((i) => {
|
|
38
|
+
const c = i[0];
|
|
39
|
+
if (typeof c == "function")
|
|
40
|
+
return c;
|
|
41
|
+
if (W(c)(n))
|
|
42
|
+
return i[1];
|
|
43
|
+
}).filter((i) => !!i);
|
|
44
|
+
return (t ? [t] : []).concat(s);
|
|
45
|
+
},
|
|
46
|
+
e.rootElementResolver || (() => document.body)
|
|
47
|
+
), st = (n) => {
|
|
33
48
|
const t = [];
|
|
34
49
|
return [
|
|
35
|
-
(s,
|
|
36
|
-
t.push(n.subscribe(s,
|
|
50
|
+
(s, i) => {
|
|
51
|
+
t.push(n.subscribe(s, i));
|
|
37
52
|
},
|
|
38
53
|
() => {
|
|
39
54
|
t.forEach((s) => {
|
|
@@ -42,7 +57,7 @@ const U = (n) => {
|
|
|
42
57
|
}
|
|
43
58
|
];
|
|
44
59
|
};
|
|
45
|
-
class
|
|
60
|
+
class R {
|
|
46
61
|
constructor(t, e = []) {
|
|
47
62
|
this.platform = t, this.rules = e;
|
|
48
63
|
}
|
|
@@ -56,21 +71,21 @@ class P {
|
|
|
56
71
|
return this.rules.push({ id: t }), this;
|
|
57
72
|
}
|
|
58
73
|
select() {
|
|
59
|
-
return new
|
|
74
|
+
return new nt(this.platform, this);
|
|
60
75
|
}
|
|
61
76
|
}
|
|
62
|
-
class
|
|
77
|
+
class V {
|
|
63
78
|
constructor(t, e, s) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.platform = t, this.node = e, this.actions = new
|
|
79
|
+
u(this, "actions");
|
|
80
|
+
u(this, "subscribe");
|
|
81
|
+
u(this, "unsubscribe");
|
|
82
|
+
this.platform = t, this.node = e, this.actions = new A(
|
|
68
83
|
t,
|
|
69
|
-
new
|
|
84
|
+
new R(t).withId(e.id),
|
|
70
85
|
s
|
|
71
86
|
);
|
|
72
|
-
const [
|
|
73
|
-
this.subscribe =
|
|
87
|
+
const [i, c] = st(this.platform.events);
|
|
88
|
+
this.subscribe = i, this.unsubscribe = c;
|
|
74
89
|
}
|
|
75
90
|
properties(t) {
|
|
76
91
|
return t && this.node.touchProperties((e) => t(e)), this.node.attributes.properties;
|
|
@@ -98,11 +113,11 @@ class B {
|
|
|
98
113
|
this.unsubscribe(), this.actions.dispose();
|
|
99
114
|
}
|
|
100
115
|
}
|
|
101
|
-
class
|
|
116
|
+
class nt {
|
|
102
117
|
constructor(t, e, s = !0) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.platform = t, this.target = e, this.clearOnDispose = s, this.actions = new
|
|
118
|
+
u(this, "actions");
|
|
119
|
+
u(this, "removes", []);
|
|
120
|
+
this.platform = t, this.target = e, this.clearOnDispose = s, this.actions = new A(this.platform, this.target);
|
|
106
121
|
}
|
|
107
122
|
writeProperties(t, e) {
|
|
108
123
|
this.removes.push(
|
|
@@ -140,22 +155,22 @@ class Y {
|
|
|
140
155
|
}), this.actions.dispose();
|
|
141
156
|
}
|
|
142
157
|
}
|
|
143
|
-
const
|
|
144
|
-
const s = n.concat(),
|
|
145
|
-
let
|
|
158
|
+
const it = (n, t, e) => {
|
|
159
|
+
const s = n.concat(), i = (c, o, h) => {
|
|
160
|
+
let l = !0;
|
|
146
161
|
if (s.length) {
|
|
147
|
-
const
|
|
148
|
-
return Promise.resolve(
|
|
149
|
-
cancelled:
|
|
162
|
+
const a = s.shift(), r = (p, d) => (l = !1, i(p, Object.assign({}, o, d), h));
|
|
163
|
+
return Promise.resolve(a(c, r, h)).then((p) => B(x({}, p), {
|
|
164
|
+
cancelled: l
|
|
150
165
|
}));
|
|
151
166
|
}
|
|
152
167
|
return Promise.resolve({ data: c, cancelled: !1, options: o });
|
|
153
168
|
};
|
|
154
|
-
return
|
|
169
|
+
return i(t, {}, e);
|
|
155
170
|
};
|
|
156
|
-
class
|
|
171
|
+
class A {
|
|
157
172
|
constructor(t, e, s) {
|
|
158
|
-
|
|
173
|
+
u(this, "subscriptions", []);
|
|
159
174
|
this.platform = t, this.target = e, this.ns = s, this.create = this.create.bind(this);
|
|
160
175
|
}
|
|
161
176
|
create(t, e = () => {
|
|
@@ -167,85 +182,85 @@ class R {
|
|
|
167
182
|
ns: this.ns
|
|
168
183
|
};
|
|
169
184
|
this.platform.actionsState.handlers.push(s);
|
|
170
|
-
const
|
|
185
|
+
const i = () => {
|
|
171
186
|
const c = this.platform.actionsState.handlers.indexOf(s);
|
|
172
187
|
c > -1 && this.platform.actionsState.handlers.splice(c, 1);
|
|
173
188
|
};
|
|
174
|
-
return this.subscriptions.push(
|
|
189
|
+
return this.subscriptions.push(i), i;
|
|
175
190
|
}
|
|
176
191
|
dispatch(t, e) {
|
|
177
192
|
const s = this.platform.nodes.all.concat(
|
|
178
193
|
this.platform.nodes.detached
|
|
179
|
-
),
|
|
194
|
+
), i = {}, c = this.platform.actionsState.handlers.filter(
|
|
180
195
|
(o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)
|
|
181
196
|
);
|
|
182
197
|
return Promise.all(
|
|
183
198
|
c.map((o) => {
|
|
184
|
-
const
|
|
185
|
-
(
|
|
186
|
-
),
|
|
199
|
+
const h = s.filter(
|
|
200
|
+
(a) => o.target.match(a) && this.target.match(a)
|
|
201
|
+
), l = this.platform.actionsState.watchers.filter((a) => a.key === t && (!a.ns || !this.ns || a.ns === this.ns) && h.some((r) => a.target.match(r))).map((a) => a.fn);
|
|
187
202
|
return Promise.all(
|
|
188
|
-
|
|
189
|
-
const
|
|
203
|
+
h.map((a) => {
|
|
204
|
+
const r = new V(
|
|
190
205
|
this.platform,
|
|
191
|
-
|
|
206
|
+
a,
|
|
192
207
|
this.ns
|
|
193
208
|
);
|
|
194
|
-
return
|
|
209
|
+
return it(l, e, r).then((p) => {
|
|
195
210
|
const { data: d = {}, options: f, cancelled: g } = p;
|
|
196
211
|
return Promise.resolve(
|
|
197
|
-
g ? {} : o.fn(d, f,
|
|
212
|
+
g ? {} : o.fn(d, f, r)
|
|
198
213
|
).then((y) => {
|
|
199
|
-
|
|
214
|
+
i[a.id] = y;
|
|
200
215
|
});
|
|
201
216
|
});
|
|
202
217
|
})
|
|
203
218
|
);
|
|
204
219
|
})
|
|
205
|
-
).then(() =>
|
|
220
|
+
).then(() => i);
|
|
206
221
|
}
|
|
207
222
|
watch(t, e) {
|
|
208
|
-
let s = t,
|
|
223
|
+
let s = t, i = this.ns;
|
|
209
224
|
const c = t.split(".");
|
|
210
|
-
c.length > 1 && (
|
|
225
|
+
c.length > 1 && (i = c[0], s = c.splice(1).join("."));
|
|
211
226
|
const o = {
|
|
212
227
|
fn: e,
|
|
213
228
|
target: this.target,
|
|
214
229
|
key: s,
|
|
215
|
-
ns:
|
|
230
|
+
ns: i
|
|
216
231
|
};
|
|
217
232
|
this.platform.actionsState.watchers.push(o);
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
|
|
233
|
+
const h = () => {
|
|
234
|
+
const l = this.platform.actionsState.watchers.indexOf(o);
|
|
235
|
+
l > -1 && this.platform.actionsState.watchers.splice(l, 1);
|
|
221
236
|
};
|
|
222
|
-
return this.subscriptions.push(
|
|
237
|
+
return this.subscriptions.push(h), h;
|
|
223
238
|
}
|
|
224
239
|
dispose() {
|
|
225
240
|
this.subscriptions.forEach((t) => t());
|
|
226
241
|
}
|
|
227
242
|
}
|
|
228
|
-
const
|
|
243
|
+
const Ct = Y((n) => {
|
|
229
244
|
n.createCommand("components", (t) => (e) => {
|
|
230
|
-
t.events.subscribeOnce("components:platform-created", (s, { platform:
|
|
245
|
+
t.events.subscribeOnce("components:platform-created", (s, { platform: i }) => {
|
|
231
246
|
e.handlers && e.handlers.forEach(([c, o]) => {
|
|
232
|
-
|
|
247
|
+
i.addComponentHandler(c, o);
|
|
233
248
|
});
|
|
234
249
|
});
|
|
235
250
|
});
|
|
236
251
|
});
|
|
237
|
-
class
|
|
252
|
+
class M {
|
|
238
253
|
constructor(t, e) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
this.events = t, this.id =
|
|
254
|
+
u(this, "id");
|
|
255
|
+
u(this, "type");
|
|
256
|
+
u(this, "name");
|
|
257
|
+
u(this, "parent");
|
|
258
|
+
u(this, "tags", []);
|
|
259
|
+
u(this, "children", {});
|
|
260
|
+
u(this, "changesets", []);
|
|
261
|
+
u(this, "attributes");
|
|
262
|
+
u(this, "mountCount", 0);
|
|
263
|
+
this.events = t, this.id = k(), this.type = e, this.attributes = {
|
|
249
264
|
context: {},
|
|
250
265
|
properties: {},
|
|
251
266
|
layout: {},
|
|
@@ -254,7 +269,7 @@ class $ {
|
|
|
254
269
|
}
|
|
255
270
|
mount(t, e) {
|
|
256
271
|
let s = t.get("mounted-nodes");
|
|
257
|
-
return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" &&
|
|
272
|
+
return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" && $.error("Trying to mount an already mounted component node.", this), () => {
|
|
258
273
|
}) : (this.events.dispatch("components:node-mounted", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch("components:node-enter", { node: this })), () => {
|
|
259
274
|
s.delete(this), this.events.dispatch("components:node-unmounted", { node: this }), this.mountCount = this.mountCount - 1, this.mountCount === 0 && this.events.dispatch("components:node-exit", { node: this });
|
|
260
275
|
});
|
|
@@ -313,9 +328,9 @@ class $ {
|
|
|
313
328
|
}
|
|
314
329
|
getChildren(t = "default") {
|
|
315
330
|
const e = this.children[t] || [];
|
|
316
|
-
return e.reduce((s,
|
|
317
|
-
const { order: o = c } =
|
|
318
|
-
return s[o] ? s.splice(o, 0,
|
|
331
|
+
return e.reduce((s, i, c) => {
|
|
332
|
+
const { order: o = c } = i.attributes.layout;
|
|
333
|
+
return s[o] ? s.splice(o, 0, i) : s[o] = i, s;
|
|
319
334
|
}, Array(e.length));
|
|
320
335
|
}
|
|
321
336
|
remove() {
|
|
@@ -323,60 +338,60 @@ class $ {
|
|
|
323
338
|
}
|
|
324
339
|
removeChild(t) {
|
|
325
340
|
Object.keys(this.children).forEach((e) => {
|
|
326
|
-
const s = this.children[e],
|
|
327
|
-
|
|
341
|
+
const s = this.children[e], i = s.indexOf(t);
|
|
342
|
+
i > -1 && (s.splice(i, 1), this.events.dispatch("components:node-removed", { node: t, parentNode: this }));
|
|
328
343
|
}), delete t.parent;
|
|
329
344
|
}
|
|
330
345
|
}
|
|
331
|
-
const
|
|
332
|
-
for (let s = 0,
|
|
346
|
+
const j = (n, t, e) => {
|
|
347
|
+
for (let s = 0, i = n.length; s < i && e(n[s]) !== !0; s++) {
|
|
333
348
|
const c = t[n[s].id] || "default", o = n[s].getChildren(c);
|
|
334
|
-
|
|
349
|
+
j(o, t, e);
|
|
335
350
|
}
|
|
336
|
-
},
|
|
351
|
+
}, T = (n, t, e) => {
|
|
337
352
|
if (e(n) !== !0) {
|
|
338
|
-
const s = t[n.id] || "default",
|
|
339
|
-
|
|
353
|
+
const s = t[n.id] || "default", i = n.children[s];
|
|
354
|
+
j(i, t, e);
|
|
340
355
|
}
|
|
341
|
-
},
|
|
356
|
+
}, E = (n, t) => {
|
|
342
357
|
const e = [];
|
|
343
|
-
return
|
|
358
|
+
return T(n, t, (s) => {
|
|
344
359
|
e.push(s);
|
|
345
360
|
}), e;
|
|
346
|
-
},
|
|
361
|
+
}, ot = (n, t, e) => {
|
|
347
362
|
let s;
|
|
348
|
-
return
|
|
349
|
-
if (e(
|
|
350
|
-
return s =
|
|
363
|
+
return T(n, t, (i) => {
|
|
364
|
+
if (e(i))
|
|
365
|
+
return s = i, !0;
|
|
351
366
|
}), s;
|
|
352
367
|
};
|
|
353
|
-
class
|
|
368
|
+
class rt {
|
|
354
369
|
constructor(t, e, s) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
this.root = t, this.switches = e, s.subscribe("components:node-appended", (
|
|
359
|
-
this.all.push(c.node), this.visible =
|
|
360
|
-
}), s.subscribe("components:node-removed", (
|
|
370
|
+
u(this, "all", []);
|
|
371
|
+
u(this, "visible", []);
|
|
372
|
+
u(this, "detached", []);
|
|
373
|
+
this.root = t, this.switches = e, s.subscribe("components:node-appended", (i, c) => {
|
|
374
|
+
this.all.push(c.node), this.visible = E(t, e);
|
|
375
|
+
}), s.subscribe("components:node-removed", (i, c) => {
|
|
361
376
|
let o = this.all.indexOf(c.node);
|
|
362
|
-
o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(c.node), o > -1 && this.visible.splice(o, 1), this.visible =
|
|
363
|
-
}), s.subscribe("components:node-switched", (
|
|
364
|
-
this.visible =
|
|
377
|
+
o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(c.node), o > -1 && this.visible.splice(o, 1), this.visible = E(t, e);
|
|
378
|
+
}), s.subscribe("components:node-switched", (i, c) => {
|
|
379
|
+
this.visible = E(t, e);
|
|
365
380
|
});
|
|
366
381
|
}
|
|
367
382
|
query(t = {}) {
|
|
368
383
|
const e = [];
|
|
369
|
-
return
|
|
384
|
+
return T(this.root, this.switches, (s) => {
|
|
370
385
|
Object.keys(t).every((c) => t[c] === s[c]) && e.push(s);
|
|
371
386
|
}), e;
|
|
372
387
|
}
|
|
373
388
|
get(t) {
|
|
374
|
-
return
|
|
389
|
+
return ot(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
|
|
375
390
|
}
|
|
376
391
|
}
|
|
377
|
-
class
|
|
392
|
+
class ct {
|
|
378
393
|
constructor() {
|
|
379
|
-
|
|
394
|
+
u(this, "handlers", /* @__PURE__ */ new Map());
|
|
380
395
|
}
|
|
381
396
|
add(t, e) {
|
|
382
397
|
this.handlers.set(t, e);
|
|
@@ -385,90 +400,90 @@ class X {
|
|
|
385
400
|
return this.handlers.get(t);
|
|
386
401
|
}
|
|
387
402
|
}
|
|
388
|
-
const
|
|
403
|
+
const at = (n) => {
|
|
389
404
|
let t = n, e = 0;
|
|
390
405
|
for (; t.parent; )
|
|
391
406
|
e = e + 1, t = t.parent;
|
|
392
407
|
return e;
|
|
393
|
-
},
|
|
408
|
+
}, ht = (n) => n.map(([e, s]) => [at(e), e, s]).sort(([e], [s]) => e - s).map(([, e, s]) => [e, s]), O = (n) => n && typeof n == "object" && !Array.isArray(n), v = (n, ...t) => {
|
|
394
409
|
if (!t.length)
|
|
395
410
|
return n;
|
|
396
411
|
const e = t.shift();
|
|
397
|
-
if (
|
|
412
|
+
if (O(n) && O(e))
|
|
398
413
|
for (const s in e)
|
|
399
|
-
|
|
414
|
+
O(e[s]) ? (n[s] || Object.assign(n, { [s]: {} }), v(n[s], e[s])) : Object.assign(n, { [s]: e[s] });
|
|
400
415
|
return v(n, ...t);
|
|
401
|
-
},
|
|
402
|
-
let e = [], s = [],
|
|
416
|
+
}, pt = (n, t) => !n || n === "all" ? !0 : n.some((e) => t.indexOf(e) > -1), ut = (n, t) => {
|
|
417
|
+
let e = [], s = [], i;
|
|
403
418
|
const c = () => {
|
|
404
419
|
process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
|
|
405
|
-
const
|
|
406
|
-
var
|
|
407
|
-
const d =
|
|
408
|
-
|
|
420
|
+
const h = /* @__PURE__ */ new Map(), l = ht(e.map((r, p) => [r, s[p]])), a = (r, p) => {
|
|
421
|
+
var _;
|
|
422
|
+
const d = h.get(r) || {}, f = p.context && !d.context, g = p.properties && !d.properties, y = p.layout && !d.layout;
|
|
423
|
+
h.set(r, {
|
|
409
424
|
context: d.context || f,
|
|
410
425
|
properties: d.properties || g,
|
|
411
426
|
layout: d.layout || y
|
|
412
|
-
}), g && (
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
const [m,
|
|
416
|
-
|
|
427
|
+
}), g && (r.attributes.properties = {}), y && (r.attributes.layout = {}), f && (r.attributes.context = v({}, (_ = r.parent) == null ? void 0 : _.attributes.context));
|
|
428
|
+
const S = [], D = [], L = [];
|
|
429
|
+
if (r.changesets.forEach((b) => {
|
|
430
|
+
const [m, w] = b;
|
|
431
|
+
pt(w.breakpoints, n.breakpoints) && (g && (typeof m.properties == "function" ? S.push(
|
|
417
432
|
m.properties
|
|
418
|
-
) : v(
|
|
433
|
+
) : v(r.attributes.properties, m.properties)), y && (typeof m.layout == "function" ? D.push(m.layout) : v(r.attributes.layout, m.layout)), f && (typeof m.context == "function" ? L.push(m.context) : v(r.attributes.context, m.context)));
|
|
434
|
+
}), S.forEach((b) => {
|
|
435
|
+
v(r.attributes.properties, b(r.attributes.properties));
|
|
419
436
|
}), D.forEach((b) => {
|
|
420
|
-
v(
|
|
421
|
-
}),
|
|
422
|
-
v(
|
|
423
|
-
}), I.forEach((b) => {
|
|
424
|
-
v(i.attributes.context, b(i.attributes.context));
|
|
437
|
+
v(r.attributes.layout, b(r.attributes.layout));
|
|
438
|
+
}), L.forEach((b) => {
|
|
439
|
+
v(r.attributes.context, b(r.attributes.context));
|
|
425
440
|
}), f || p.recursive) {
|
|
426
|
-
const b = n.getBranch(
|
|
441
|
+
const b = n.getBranch(r), m = p.recursive ? p : {
|
|
427
442
|
context: !!f
|
|
428
443
|
};
|
|
429
|
-
|
|
430
|
-
|
|
444
|
+
r.getChildren(b).forEach((w) => {
|
|
445
|
+
a(w, m);
|
|
431
446
|
});
|
|
432
447
|
}
|
|
433
448
|
};
|
|
434
|
-
process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"),
|
|
435
|
-
|
|
436
|
-
}), e = [], s = [], t(
|
|
449
|
+
process.env.NODE_ENV !== "production" && console.timeEnd("state-processor.flush"), l.forEach(([r, p]) => {
|
|
450
|
+
a(r, p);
|
|
451
|
+
}), e = [], s = [], t(h);
|
|
437
452
|
}, o = () => {
|
|
438
|
-
clearTimeout(
|
|
453
|
+
clearTimeout(i), i = setTimeout(c, 0);
|
|
439
454
|
};
|
|
440
|
-
return (
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
const
|
|
444
|
-
return
|
|
455
|
+
return (h, l) => {
|
|
456
|
+
const a = e.indexOf(h);
|
|
457
|
+
if (a > -1) {
|
|
458
|
+
const r = s[a];
|
|
459
|
+
return l.context && (r.context = !0), l.properties && (r.properties = !0), l.layout && (r.layout = !0), l.recursive && (r.recursive = !0), o();
|
|
445
460
|
}
|
|
446
|
-
return e.push(
|
|
461
|
+
return e.push(h), s.push(l), o();
|
|
447
462
|
};
|
|
448
463
|
};
|
|
449
|
-
class
|
|
464
|
+
class lt {
|
|
450
465
|
constructor(t, e = {}) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
466
|
+
u(this, "events");
|
|
467
|
+
u(this, "breakpoints", []);
|
|
468
|
+
u(this, "nodes");
|
|
469
|
+
u(this, "actionsState", { handlers: [], watchers: [] });
|
|
470
|
+
u(this, "switches", {});
|
|
471
|
+
u(this, "changesets", []);
|
|
472
|
+
u(this, "subscriptions", []);
|
|
473
|
+
u(this, "processNode");
|
|
474
|
+
u(this, "customComponentHandler", new ct());
|
|
460
475
|
this.providers = e, this.events = t.events.createChild(this);
|
|
461
|
-
const s = new
|
|
462
|
-
s.name = `root-${t.name}`, this.nodes = new
|
|
463
|
-
const
|
|
476
|
+
const s = new M(this.events, "root");
|
|
477
|
+
s.name = `root-${t.name}`, this.nodes = new rt(s, this.switches, this.events);
|
|
478
|
+
const i = this.processNode = ut(this, (c) => {
|
|
464
479
|
const o = Array.from(c.keys());
|
|
465
480
|
process.env.NODE_ENV !== "production" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
|
|
466
481
|
${o.map(
|
|
467
|
-
(
|
|
482
|
+
(h) => `${h.name || "<no name>"} (${h.id})
|
|
468
483
|
`
|
|
469
|
-
)}`), o.forEach((
|
|
470
|
-
const
|
|
471
|
-
|
|
484
|
+
)}`), o.forEach((h) => {
|
|
485
|
+
const l = c.get(h);
|
|
486
|
+
h.parent && h.parent.type === "root" && this.events.dispatch("components:root-children-changed", { node: h }), l != null && l.context && this.events.dispatch("components:context-changed", { node: h }), l != null && l.properties && this.events.dispatch("components:properties-changed", { node: h }), l != null && l.layout && this.events.dispatch("components:layout-changed", { node: h });
|
|
472
487
|
}), this.events.dispatch("components:component-model-initialized", {}, { bubbles: !0 });
|
|
473
488
|
});
|
|
474
489
|
Promise.all(
|
|
@@ -477,10 +492,10 @@ ${o.map(
|
|
|
477
492
|
this.events.subscribe(
|
|
478
493
|
"components:node-appended",
|
|
479
494
|
(c, o) => {
|
|
480
|
-
const { node:
|
|
481
|
-
this.changesets.forEach((
|
|
482
|
-
const { changeset:
|
|
483
|
-
|
|
495
|
+
const { node: h } = o;
|
|
496
|
+
this.changesets.forEach((l) => {
|
|
497
|
+
const { changeset: a, target: r, removes: p } = l, [d, f] = a;
|
|
498
|
+
r.match(o.node) && (d.properties && p.push(h.writeProperties(d.properties, f)), d.context && p.push(h.writeContext(d.context, f)), d.layout && p.push(h.writeLayout(d.layout, f)));
|
|
484
499
|
});
|
|
485
500
|
}
|
|
486
501
|
)
|
|
@@ -488,40 +503,40 @@ ${o.map(
|
|
|
488
503
|
this.events.subscribe(
|
|
489
504
|
"components:node-appended",
|
|
490
505
|
(c, o) => {
|
|
491
|
-
|
|
506
|
+
i(o.node, { properties: !0, context: !0 });
|
|
492
507
|
}
|
|
493
508
|
)
|
|
494
509
|
), this.subscriptions.push(
|
|
495
510
|
this.events.subscribe(
|
|
496
511
|
"components:set-properties",
|
|
497
512
|
(c, o) => {
|
|
498
|
-
|
|
513
|
+
i(o.node, { properties: !0 });
|
|
499
514
|
}
|
|
500
515
|
)
|
|
501
516
|
), this.subscriptions.push(
|
|
502
517
|
this.events.subscribe(
|
|
503
518
|
"components:set-context",
|
|
504
519
|
(c, o) => {
|
|
505
|
-
|
|
520
|
+
i(o.node, { properties: !0, context: !0 });
|
|
506
521
|
}
|
|
507
522
|
)
|
|
508
523
|
), this.subscriptions.push(
|
|
509
524
|
this.events.subscribe(
|
|
510
525
|
"components:set-indent",
|
|
511
526
|
(c, o) => {
|
|
512
|
-
|
|
527
|
+
i(o.node, { layout: !0 });
|
|
513
528
|
}
|
|
514
529
|
)
|
|
515
530
|
), this.subscriptions.push(
|
|
516
531
|
this.events.subscribe(
|
|
517
532
|
"components:set-layout",
|
|
518
533
|
(c, o) => {
|
|
519
|
-
|
|
534
|
+
i(o.node, { layout: !0 });
|
|
520
535
|
}
|
|
521
536
|
)
|
|
522
537
|
), this.subscriptions.push(
|
|
523
|
-
this.events.subscribe("components:node-switched", (c, { node: o, branch:
|
|
524
|
-
|
|
538
|
+
this.events.subscribe("components:node-switched", (c, { node: o, branch: h }) => {
|
|
539
|
+
i(o, {
|
|
525
540
|
layout: !0,
|
|
526
541
|
recursive: !0,
|
|
527
542
|
properties: !0,
|
|
@@ -530,7 +545,7 @@ ${o.map(
|
|
|
530
545
|
})
|
|
531
546
|
), this.subscriptions.push(
|
|
532
547
|
this.events.subscribe("components:node-removed", (c, { parentNode: o }) => {
|
|
533
|
-
|
|
548
|
+
i(o, { properties: !0 });
|
|
534
549
|
})
|
|
535
550
|
), this.events.parent && this.events.parent.dispatch("components:platform-created", { platform: this });
|
|
536
551
|
}
|
|
@@ -561,34 +576,34 @@ ${o.map(
|
|
|
561
576
|
return this.switches[t.id];
|
|
562
577
|
}
|
|
563
578
|
createNode(t, e = {}) {
|
|
564
|
-
const s = new
|
|
579
|
+
const s = new M(this.events, t);
|
|
565
580
|
return e.detached && this.nodes.detached.push(s), s;
|
|
566
581
|
}
|
|
567
582
|
components() {
|
|
568
|
-
return new
|
|
583
|
+
return new R(this);
|
|
569
584
|
}
|
|
570
585
|
actions(t, e) {
|
|
571
|
-
return new
|
|
586
|
+
return new A(this, t, e);
|
|
572
587
|
}
|
|
573
588
|
write(t) {
|
|
574
|
-
const { provider: e, target: s, attributes:
|
|
589
|
+
const { provider: e, target: s, attributes: i, options: c = {}, removable: o } = t, h = t.key || k(), a = { changeset: [i, c], target: s, removes: [] };
|
|
575
590
|
if (e) {
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
591
|
+
const r = this.providers[e];
|
|
592
|
+
r.write(h, s, i, c), a.removes.push(() => {
|
|
593
|
+
r.remove(h);
|
|
579
594
|
});
|
|
580
595
|
}
|
|
581
|
-
return this.changesets.push(
|
|
582
|
-
if (s.match(
|
|
596
|
+
return this.changesets.push(a), this.nodes.all.forEach((r) => {
|
|
597
|
+
if (s.match(r)) {
|
|
583
598
|
let p = () => {
|
|
584
599
|
};
|
|
585
|
-
|
|
600
|
+
i.properties && (p = r.writeProperties(i.properties, c, o)), i.context && (p = r.writeContext(i.context, c, o)), i.layout && (p = r.writeContext(i.layout, c, o)), a.removes.push(p);
|
|
586
601
|
}
|
|
587
602
|
}), () => {
|
|
588
603
|
if (o) {
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
|
|
604
|
+
a.removes.forEach((p) => p());
|
|
605
|
+
const r = this.changesets.indexOf(a);
|
|
606
|
+
r > -1 && this.changesets.splice(r, 1);
|
|
592
607
|
}
|
|
593
608
|
};
|
|
594
609
|
}
|
|
@@ -602,7 +617,7 @@ ${o.map(
|
|
|
602
617
|
this.subscriptions.forEach((t) => t());
|
|
603
618
|
}
|
|
604
619
|
}
|
|
605
|
-
const
|
|
620
|
+
const dt = (n) => {
|
|
606
621
|
if (Array.isArray(n)) {
|
|
607
622
|
const [t, ...e] = n;
|
|
608
623
|
return {
|
|
@@ -614,78 +629,78 @@ const nt = (n) => {
|
|
|
614
629
|
definitionId: n,
|
|
615
630
|
overrides: []
|
|
616
631
|
};
|
|
617
|
-
},
|
|
632
|
+
}, P = (n, t, e, s, i, c) => {
|
|
618
633
|
e.forEach((o) => {
|
|
619
|
-
const
|
|
620
|
-
if (
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
const p = r
|
|
624
|
-
|
|
625
|
-
}), t.appendChild(
|
|
626
|
-
|
|
627
|
-
breakpoints:
|
|
628
|
-
}),
|
|
634
|
+
const h = dt(o), l = s[h.definitionId];
|
|
635
|
+
if (h.definitionId === "view") {
|
|
636
|
+
const a = n.createNode("view");
|
|
637
|
+
a.name = "view", Object.keys(i).forEach((r) => {
|
|
638
|
+
const p = i[r];
|
|
639
|
+
P(n, a, [p.entry], s, i, r);
|
|
640
|
+
}), t.appendChild(a), h.overrides.forEach((r) => {
|
|
641
|
+
r.properties && a.writeProperties(r.properties, {
|
|
642
|
+
breakpoints: r.breakpoints
|
|
643
|
+
}), r.context && a.writeContext(r.context, { breakpoints: r.breakpoints }), r.layout && a.writeLayout(r.layout, { breakpoints: r.breakpoints });
|
|
629
644
|
});
|
|
630
|
-
} else if (n.getComponentHandler(
|
|
631
|
-
const
|
|
632
|
-
|
|
645
|
+
} else if (n.getComponentHandler(l.type)) {
|
|
646
|
+
const a = n.getComponentHandler(l.type);
|
|
647
|
+
a && a(h, {
|
|
633
648
|
platform: n,
|
|
634
649
|
node: t,
|
|
635
650
|
references: e,
|
|
636
651
|
definitions: s,
|
|
637
|
-
views:
|
|
652
|
+
views: i,
|
|
638
653
|
branch: c
|
|
639
654
|
});
|
|
640
655
|
} else {
|
|
641
|
-
const
|
|
642
|
-
if (process.env.NODE_ENV !== "production" && !
|
|
643
|
-
|
|
644
|
-
`No definition found for component type '${
|
|
656
|
+
const a = s[h.definitionId];
|
|
657
|
+
if (process.env.NODE_ENV !== "production" && !a) {
|
|
658
|
+
$.error(
|
|
659
|
+
`No definition found for component type '${h.definitionId}'.`
|
|
645
660
|
);
|
|
646
661
|
return;
|
|
647
662
|
}
|
|
648
|
-
const
|
|
649
|
-
|
|
663
|
+
const r = n.createNode(a.type);
|
|
664
|
+
r.name = h.definitionId, r.tags = a.tags || [], a.properties && r.writeProperties(a.properties), a.context && r.writeContext(a.context), a.layout && r.writeLayout(a.layout), t.appendChild(r, c), h.overrides.forEach((p) => {
|
|
650
665
|
const d = { breakpoints: p.breakpoints };
|
|
651
|
-
p.properties &&
|
|
652
|
-
}),
|
|
666
|
+
p.properties && r.writeProperties(p.properties, d), p.context && r.writeContext(p.context, d), p.layout && r.writeLayout(p.layout, d);
|
|
667
|
+
}), a.children && P(n, r, a.children, s, i);
|
|
653
668
|
}
|
|
654
669
|
});
|
|
655
|
-
},
|
|
656
|
-
const { entry: e, components: s, breakpoints:
|
|
657
|
-
return Object.keys(
|
|
658
|
-
const
|
|
659
|
-
|
|
660
|
-
const
|
|
661
|
-
p.matches ? n.addBreakpoint(
|
|
670
|
+
}, Et = (n, t) => {
|
|
671
|
+
const { entry: e, components: s, breakpoints: i, views: c } = t, o = [];
|
|
672
|
+
return Object.keys(i).forEach((h) => {
|
|
673
|
+
const l = i[h], a = window.matchMedia(l);
|
|
674
|
+
a.matches && n.breakpoints.push(h);
|
|
675
|
+
const r = (p) => {
|
|
676
|
+
p.matches ? n.addBreakpoint(h) : n.removeBreakpoint(h);
|
|
662
677
|
};
|
|
663
|
-
|
|
664
|
-
}),
|
|
665
|
-
|
|
678
|
+
a.addListener(r), o.push(() => a.removeListener(r));
|
|
679
|
+
}), P(n, n.nodes.root, [e], s, c), () => o.forEach((h) => {
|
|
680
|
+
h();
|
|
666
681
|
});
|
|
667
|
-
},
|
|
682
|
+
}, Ot = (n, t) => ({
|
|
668
683
|
id: n.id,
|
|
669
684
|
type: n.type,
|
|
670
685
|
name: n.name,
|
|
671
686
|
branch: t || "default"
|
|
672
|
-
}),
|
|
687
|
+
}), Nt = (n, t, e, s = k(), i = {}) => n.getAsync("components").then((c) => {
|
|
673
688
|
let o;
|
|
674
689
|
if (typeof t == "string") {
|
|
675
|
-
const
|
|
676
|
-
|
|
690
|
+
const a = new R(c);
|
|
691
|
+
a.ofType(t), o = a;
|
|
677
692
|
} else
|
|
678
693
|
o = t;
|
|
679
|
-
const
|
|
680
|
-
const
|
|
681
|
-
return
|
|
694
|
+
const h = {}, l = (a) => {
|
|
695
|
+
const r = h[a.id];
|
|
696
|
+
return r ? Promise.resolve(r.controller) : lt.getInstance(n).then((p) => new V(p, a, s));
|
|
682
697
|
};
|
|
683
698
|
c.events.subscribe(
|
|
684
699
|
"components:node-enter",
|
|
685
|
-
(
|
|
686
|
-
o.match(
|
|
700
|
+
(a, { node: r }) => {
|
|
701
|
+
o.match(r) && l(r).then((p) => {
|
|
687
702
|
Promise.resolve(e(p)).then((d) => {
|
|
688
|
-
|
|
703
|
+
h[r.id] = {
|
|
689
704
|
dispose: d,
|
|
690
705
|
controller: p
|
|
691
706
|
};
|
|
@@ -694,18 +709,18 @@ const nt = (n) => {
|
|
|
694
709
|
}
|
|
695
710
|
), c.events.subscribe(
|
|
696
711
|
"components:node-exit",
|
|
697
|
-
(
|
|
698
|
-
const p =
|
|
699
|
-
p && (p.dispose && p.dispose(),
|
|
712
|
+
(a, { node: r }) => {
|
|
713
|
+
const p = h[r.id];
|
|
714
|
+
p && (p.dispose && p.dispose(), i.reuseController || (p.controller.dispose(), delete h[r.id]));
|
|
700
715
|
}
|
|
701
716
|
);
|
|
702
717
|
});
|
|
703
|
-
class
|
|
718
|
+
class Pt {
|
|
704
719
|
constructor(t) {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
720
|
+
u(this, "aliases", /* @__PURE__ */ new Map());
|
|
721
|
+
u(this, "components", /* @__PURE__ */ new Map());
|
|
722
|
+
u(this, "events");
|
|
723
|
+
u(this, "logger", new $());
|
|
709
724
|
const { events: e } = t.get("$widget");
|
|
710
725
|
this.events = e;
|
|
711
726
|
}
|
|
@@ -722,8 +737,8 @@ class dt {
|
|
|
722
737
|
};
|
|
723
738
|
}
|
|
724
739
|
registerResolver(t, e) {
|
|
725
|
-
return this.events.subscribe("component-resolver:resolve", (s,
|
|
726
|
-
if (
|
|
740
|
+
return this.events.subscribe("component-resolver:resolve", (s, i) => {
|
|
741
|
+
if (i === t) {
|
|
727
742
|
const c = this.getComponent(t);
|
|
728
743
|
e(c);
|
|
729
744
|
}
|
|
@@ -735,24 +750,82 @@ class dt {
|
|
|
735
750
|
};
|
|
736
751
|
}
|
|
737
752
|
}
|
|
738
|
-
|
|
753
|
+
const ft = "771ae5e", I = class extends J {
|
|
754
|
+
constructor(t, e = []) {
|
|
755
|
+
super(t, e, {
|
|
756
|
+
transformPluginSettings: (s, i, c) => {
|
|
757
|
+
const o = c.get("$settings"), h = o.plugins && i ? o.plugins[i] || {} : {};
|
|
758
|
+
return x(x({}, h), s);
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
createImplementation(t) {
|
|
763
|
+
const e = super.createImplementation(t);
|
|
764
|
+
return e.bindings = t.bindings, e;
|
|
765
|
+
}
|
|
766
|
+
navigate(t, e, s) {
|
|
767
|
+
this.widgets.query(t).forEach((i) => i.invoke("navigate", { route: e, params: s }));
|
|
768
|
+
}
|
|
769
|
+
static create(t = {}) {
|
|
770
|
+
const e = [U].concat(
|
|
771
|
+
t.configurationApiExtensions || []
|
|
772
|
+
);
|
|
773
|
+
return new I("widgets", e);
|
|
774
|
+
}
|
|
775
|
+
static createFromGlobal(t, e = {}) {
|
|
776
|
+
if (this.isRuntime(t))
|
|
777
|
+
return t.patch(e), t;
|
|
778
|
+
const s = [], i = t && t._c;
|
|
779
|
+
i && i.forEach((o) => s.push(o));
|
|
780
|
+
const c = this.create(e);
|
|
781
|
+
return c.container.register("$runtimecfg", s), c;
|
|
782
|
+
}
|
|
783
|
+
static isRuntime(t) {
|
|
784
|
+
return !!(t && typeof t == "object" && t.container && typeof t.container.get == "function" && t.container.get("$environment") === t && t.container.owner === t);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
let N = I;
|
|
788
|
+
u(N, "version", `${ft} (${X})`);
|
|
789
|
+
class kt extends Z {
|
|
790
|
+
constructor() {
|
|
791
|
+
super(...arguments);
|
|
792
|
+
u(this, "bindings", []);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
class $t extends tt {
|
|
796
|
+
constructor(t, e) {
|
|
797
|
+
super(t, e);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
var mt = /* @__PURE__ */ ((n) => (n.open = "open", n.closed = "closed", n.hidden = "hidden", n))(mt || {});
|
|
801
|
+
class Rt extends et {
|
|
802
|
+
constructor(t) {
|
|
803
|
+
super(t);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
739
806
|
export {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
807
|
+
xt as ActionResolver,
|
|
808
|
+
A as ActionsController,
|
|
809
|
+
M as ComponentNode,
|
|
810
|
+
V as ComponentNodeController,
|
|
811
|
+
lt as ComponentPlatform,
|
|
812
|
+
R as ComponentQuery,
|
|
813
|
+
Pt as ComponentResolver,
|
|
814
|
+
N as Environment,
|
|
815
|
+
kt as Implementation,
|
|
816
|
+
$t as Plugin,
|
|
817
|
+
mt as WidgetRenderState,
|
|
818
|
+
Rt as WidgetType,
|
|
819
|
+
Ot as asDescriptor,
|
|
820
|
+
wt as bootstrap,
|
|
821
|
+
Ct as componentConfigurationApi,
|
|
822
|
+
P as createChildren,
|
|
823
|
+
Et as createComponentModel,
|
|
824
|
+
st as createEventSubscriber,
|
|
825
|
+
Nt as extendComponent,
|
|
826
|
+
ot as findComponent,
|
|
827
|
+
E as findVisibleComponents,
|
|
828
|
+
T as traverseComponents,
|
|
829
|
+
ft as version
|
|
757
830
|
};
|
|
758
831
|
//# sourceMappingURL=index.js.map
|