@telia-ace/widget-core 1.0.14 → 1.0.16-next.0
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/LICENSE.txt +5 -5
- package/README.md +3 -3
- package/dist/action-resolver.d.ts +8 -8
- package/dist/component-platform/actions-controller.d.ts +40 -40
- package/dist/component-platform/changeset-provider.d.ts +8 -8
- package/dist/component-platform/component-configuration-api.d.ts +2 -2
- package/dist/component-platform/component-controller.d.ts +38 -38
- package/dist/component-platform/component-node-collection.d.ts +18 -18
- package/dist/component-platform/component-node.d.ts +63 -63
- package/dist/component-platform/component-platform.d.ts +54 -54
- package/dist/component-platform/component-query.d.ts +16 -16
- package/dist/component-platform/create-component-model.d.ts +36 -36
- package/dist/component-platform/custom-component-handler.d.ts +21 -21
- package/dist/component-platform/descriptor.d.ts +8 -8
- package/dist/component-platform/extend-component.d.ts +8 -8
- package/dist/component-platform/index.d.ts +18 -18
- package/dist/component-platform/queries.d.ts +6 -6
- package/dist/component-platform/state-processor.d.ts +12 -12
- package/dist/component-resolver.d.ts +14 -14
- package/dist/event-subscriber.d.ts +7 -7
- package/dist/index.d.ts +8 -8
- package/dist/index.js +303 -191
- package/dist/index.js.map +1 -1
- package/dist/types/configuration.d.ts +86 -86
- package/dist/types/index.d.ts +2 -2
- package/dist/types/ui.d.ts +53 -54
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var V = Object.defineProperty, _ = Object.defineProperties;
|
|
2
|
+
var z = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var S = Object.getOwnPropertySymbols;
|
|
4
|
+
var Q = Object.prototype.hasOwnProperty, q = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var w = (n, t, e) => t in n ? V(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, j = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
7
|
+
Q.call(t, e) && w(n, e, t[e]);
|
|
8
|
+
if (S)
|
|
9
|
+
for (var e of S(t))
|
|
10
|
+
q.call(t, e) && w(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
|
|
12
|
+
}, H = (n, t) => _(n, z(t));
|
|
13
|
+
var l = (n, t, e) => (w(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
14
|
+
import { createConfigurationApi as K } from "@webprovisions/platform";
|
|
15
|
+
import { uuid as N, Logger as k } from "@telia-ace/widget-utilities";
|
|
16
|
+
class ht {
|
|
16
17
|
constructor(t) {
|
|
18
|
+
l(this, "events");
|
|
17
19
|
const { events: e } = t.get("$widget");
|
|
18
20
|
this.events = e.createChild(this);
|
|
19
21
|
}
|
|
@@ -21,10 +23,13 @@ class ct {
|
|
|
21
23
|
this.events.dispatch("data:action", { action: e, value: s, target: t }, { bubbles: !0 });
|
|
22
24
|
}
|
|
23
25
|
subscribe(t, e) {
|
|
24
|
-
return this.events.subscribe(
|
|
26
|
+
return this.events.subscribe(
|
|
27
|
+
"data:action",
|
|
28
|
+
(s, { action: r, value: c, target: o }) => t === o && e(t, r, c)
|
|
29
|
+
);
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
|
-
const
|
|
32
|
+
const U = (n) => {
|
|
28
33
|
const t = [];
|
|
29
34
|
return [
|
|
30
35
|
(s, r) => {
|
|
@@ -37,7 +42,7 @@ const K = (n) => {
|
|
|
37
42
|
}
|
|
38
43
|
];
|
|
39
44
|
};
|
|
40
|
-
class
|
|
45
|
+
class P {
|
|
41
46
|
constructor(t, e = []) {
|
|
42
47
|
this.platform = t, this.rules = e;
|
|
43
48
|
}
|
|
@@ -51,13 +56,20 @@ class N {
|
|
|
51
56
|
return this.rules.push({ id: t }), this;
|
|
52
57
|
}
|
|
53
58
|
select() {
|
|
54
|
-
return new
|
|
59
|
+
return new Y(this.platform, this);
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
|
-
class
|
|
62
|
+
class B {
|
|
58
63
|
constructor(t, e, s) {
|
|
59
|
-
this
|
|
60
|
-
|
|
64
|
+
l(this, "actions");
|
|
65
|
+
l(this, "subscribe");
|
|
66
|
+
l(this, "unsubscribe");
|
|
67
|
+
this.platform = t, this.node = e, this.actions = new R(
|
|
68
|
+
t,
|
|
69
|
+
new P(t).withId(e.id),
|
|
70
|
+
s
|
|
71
|
+
);
|
|
72
|
+
const [r, c] = U(this.platform.events);
|
|
61
73
|
this.subscribe = r, this.unsubscribe = c;
|
|
62
74
|
}
|
|
63
75
|
properties(t) {
|
|
@@ -86,33 +98,41 @@ class $ {
|
|
|
86
98
|
this.unsubscribe(), this.actions.dispose();
|
|
87
99
|
}
|
|
88
100
|
}
|
|
89
|
-
class
|
|
101
|
+
class Y {
|
|
90
102
|
constructor(t, e, s = !0) {
|
|
91
|
-
this
|
|
103
|
+
l(this, "actions");
|
|
104
|
+
l(this, "removes", []);
|
|
105
|
+
this.platform = t, this.target = e, this.clearOnDispose = s, this.actions = new R(this.platform, this.target);
|
|
92
106
|
}
|
|
93
107
|
writeProperties(t, e) {
|
|
94
|
-
this.removes.push(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
this.removes.push(
|
|
109
|
+
this.platform.write({
|
|
110
|
+
options: e,
|
|
111
|
+
attributes: { properties: t },
|
|
112
|
+
target: this.target,
|
|
113
|
+
removable: this.clearOnDispose
|
|
114
|
+
})
|
|
115
|
+
);
|
|
100
116
|
}
|
|
101
117
|
writeContext(t, e) {
|
|
102
|
-
this.removes.push(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
118
|
+
this.removes.push(
|
|
119
|
+
this.platform.write({
|
|
120
|
+
options: e,
|
|
121
|
+
attributes: { context: t },
|
|
122
|
+
target: this.target,
|
|
123
|
+
removable: this.clearOnDispose
|
|
124
|
+
})
|
|
125
|
+
);
|
|
108
126
|
}
|
|
109
127
|
writeLayout(t, e) {
|
|
110
|
-
this.removes.push(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
this.removes.push(
|
|
129
|
+
this.platform.write({
|
|
130
|
+
options: e,
|
|
131
|
+
attributes: { layout: t },
|
|
132
|
+
target: this.target,
|
|
133
|
+
removable: this.clearOnDispose
|
|
134
|
+
})
|
|
135
|
+
);
|
|
116
136
|
}
|
|
117
137
|
dispose() {
|
|
118
138
|
this.removes.forEach((t) => {
|
|
@@ -120,12 +140,12 @@ class U {
|
|
|
120
140
|
}), this.actions.dispose();
|
|
121
141
|
}
|
|
122
142
|
}
|
|
123
|
-
const
|
|
143
|
+
const F = (n, t, e) => {
|
|
124
144
|
const s = n.concat(), r = (c, o, a) => {
|
|
125
145
|
let u = !0;
|
|
126
146
|
if (s.length) {
|
|
127
|
-
const h = s.shift(), i = (p,
|
|
128
|
-
return Promise.resolve(h(c, i, a)).then((p) => j(
|
|
147
|
+
const h = s.shift(), i = (p, d) => (u = !1, r(p, Object.assign({}, o, d), a));
|
|
148
|
+
return Promise.resolve(h(c, i, a)).then((p) => H(j({}, p), {
|
|
129
149
|
cancelled: u
|
|
130
150
|
}));
|
|
131
151
|
}
|
|
@@ -133,9 +153,10 @@ const Y = (n, t, e) => {
|
|
|
133
153
|
};
|
|
134
154
|
return r(t, {}, e);
|
|
135
155
|
};
|
|
136
|
-
class
|
|
156
|
+
class R {
|
|
137
157
|
constructor(t, e, s) {
|
|
138
|
-
this
|
|
158
|
+
l(this, "subscriptions", []);
|
|
159
|
+
this.platform = t, this.target = e, this.ns = s, this.create = this.create.bind(this);
|
|
139
160
|
}
|
|
140
161
|
create(t, e = () => {
|
|
141
162
|
}) {
|
|
@@ -153,19 +174,35 @@ class k {
|
|
|
153
174
|
return this.subscriptions.push(r), r;
|
|
154
175
|
}
|
|
155
176
|
dispatch(t, e) {
|
|
156
|
-
const s = this.platform.nodes.all.concat(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
const s = this.platform.nodes.all.concat(
|
|
178
|
+
this.platform.nodes.detached
|
|
179
|
+
), r = {}, c = this.platform.actionsState.handlers.filter(
|
|
180
|
+
(o) => o.key === t && (!o.ns || !this.ns || o.ns === this.ns)
|
|
181
|
+
);
|
|
182
|
+
return Promise.all(
|
|
183
|
+
c.map((o) => {
|
|
184
|
+
const a = s.filter(
|
|
185
|
+
(h) => o.target.match(h) && this.target.match(h)
|
|
186
|
+
), u = this.platform.actionsState.watchers.filter((h) => h.key === t && (!h.ns || !this.ns || h.ns === this.ns) && a.some((i) => h.target.match(i))).map((h) => h.fn);
|
|
187
|
+
return Promise.all(
|
|
188
|
+
a.map((h) => {
|
|
189
|
+
const i = new B(
|
|
190
|
+
this.platform,
|
|
191
|
+
h,
|
|
192
|
+
this.ns
|
|
193
|
+
);
|
|
194
|
+
return F(u, e, i).then((p) => {
|
|
195
|
+
const { data: d = {}, options: f, cancelled: g } = p;
|
|
196
|
+
return Promise.resolve(
|
|
197
|
+
g ? {} : o.fn(d, f, i)
|
|
198
|
+
).then((y) => {
|
|
199
|
+
r[h.id] = y;
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
})
|
|
203
|
+
);
|
|
204
|
+
})
|
|
205
|
+
).then(() => r);
|
|
169
206
|
}
|
|
170
207
|
watch(t, e) {
|
|
171
208
|
let s = t, r = this.ns;
|
|
@@ -188,7 +225,7 @@ class k {
|
|
|
188
225
|
this.subscriptions.forEach((t) => t());
|
|
189
226
|
}
|
|
190
227
|
}
|
|
191
|
-
const
|
|
228
|
+
const at = K((n) => {
|
|
192
229
|
n.createCommand("components", (t) => (e) => {
|
|
193
230
|
t.events.subscribeOnce("components:platform-created", (s, { platform: r }) => {
|
|
194
231
|
e.handlers && e.handlers.forEach(([c, o]) => {
|
|
@@ -197,9 +234,18 @@ const ht = q((n) => {
|
|
|
197
234
|
});
|
|
198
235
|
});
|
|
199
236
|
});
|
|
200
|
-
class
|
|
237
|
+
class $ {
|
|
201
238
|
constructor(t, e) {
|
|
202
|
-
this
|
|
239
|
+
l(this, "id");
|
|
240
|
+
l(this, "type");
|
|
241
|
+
l(this, "name");
|
|
242
|
+
l(this, "parent");
|
|
243
|
+
l(this, "tags", []);
|
|
244
|
+
l(this, "children", {});
|
|
245
|
+
l(this, "changesets", []);
|
|
246
|
+
l(this, "attributes");
|
|
247
|
+
l(this, "mountCount", 0);
|
|
248
|
+
this.events = t, this.id = N(), this.type = e, this.attributes = {
|
|
203
249
|
context: {},
|
|
204
250
|
properties: {},
|
|
205
251
|
layout: {},
|
|
@@ -208,7 +254,7 @@ class H {
|
|
|
208
254
|
}
|
|
209
255
|
mount(t, e) {
|
|
210
256
|
let s = t.get("mounted-nodes");
|
|
211
|
-
return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" &&
|
|
257
|
+
return s || (s = /* @__PURE__ */ new Map(), t.register("mounted-nodes", s)), s.has(this) ? (process.env.NODE_ENV !== "production" && k.error("Trying to mount an already mounted component node.", this), () => {
|
|
212
258
|
}) : (this.events.dispatch("components:node-mounted", { node: this }), this.mountCount === 0 && (this.mountCount = this.mountCount + 1, this.events.dispatch("components:node-enter", { node: this })), () => {
|
|
213
259
|
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 });
|
|
214
260
|
});
|
|
@@ -282,52 +328,55 @@ class H {
|
|
|
282
328
|
}), delete t.parent;
|
|
283
329
|
}
|
|
284
330
|
}
|
|
285
|
-
const
|
|
331
|
+
const M = (n, t, e) => {
|
|
286
332
|
for (let s = 0, r = n.length; s < r && e(n[s]) !== !0; s++) {
|
|
287
333
|
const c = t[n[s].id] || "default", o = n[s].getChildren(c);
|
|
288
|
-
|
|
334
|
+
M(o, t, e);
|
|
289
335
|
}
|
|
290
|
-
},
|
|
336
|
+
}, A = (n, t, e) => {
|
|
291
337
|
if (e(n) !== !0) {
|
|
292
338
|
const s = t[n.id] || "default", r = n.children[s];
|
|
293
|
-
|
|
339
|
+
M(r, t, e);
|
|
294
340
|
}
|
|
295
|
-
},
|
|
341
|
+
}, C = (n, t) => {
|
|
296
342
|
const e = [];
|
|
297
|
-
return
|
|
343
|
+
return A(n, t, (s) => {
|
|
298
344
|
e.push(s);
|
|
299
345
|
}), e;
|
|
300
|
-
},
|
|
346
|
+
}, G = (n, t, e) => {
|
|
301
347
|
let s;
|
|
302
|
-
return
|
|
348
|
+
return A(n, t, (r) => {
|
|
303
349
|
if (e(r))
|
|
304
350
|
return s = r, !0;
|
|
305
351
|
}), s;
|
|
306
352
|
};
|
|
307
|
-
class
|
|
353
|
+
class J {
|
|
308
354
|
constructor(t, e, s) {
|
|
309
|
-
this
|
|
310
|
-
|
|
355
|
+
l(this, "all", []);
|
|
356
|
+
l(this, "visible", []);
|
|
357
|
+
l(this, "detached", []);
|
|
358
|
+
this.root = t, this.switches = e, s.subscribe("components:node-appended", (r, c) => {
|
|
359
|
+
this.all.push(c.node), this.visible = C(t, e);
|
|
311
360
|
}), s.subscribe("components:node-removed", (r, c) => {
|
|
312
361
|
let o = this.all.indexOf(c.node);
|
|
313
|
-
o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(c.node), o > -1 && this.visible.splice(o, 1), this.visible =
|
|
362
|
+
o > -1 && this.all.splice(o, 1), o = this.visible.indexOf(c.node), o > -1 && this.visible.splice(o, 1), this.visible = C(t, e);
|
|
314
363
|
}), s.subscribe("components:node-switched", (r, c) => {
|
|
315
|
-
this.visible =
|
|
364
|
+
this.visible = C(t, e);
|
|
316
365
|
});
|
|
317
366
|
}
|
|
318
367
|
query(t = {}) {
|
|
319
368
|
const e = [];
|
|
320
|
-
return
|
|
369
|
+
return A(this.root, this.switches, (s) => {
|
|
321
370
|
Object.keys(t).every((c) => t[c] === s[c]) && e.push(s);
|
|
322
371
|
}), e;
|
|
323
372
|
}
|
|
324
373
|
get(t) {
|
|
325
|
-
return
|
|
374
|
+
return G(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
|
|
326
375
|
}
|
|
327
376
|
}
|
|
328
|
-
class
|
|
377
|
+
class X {
|
|
329
378
|
constructor() {
|
|
330
|
-
this
|
|
379
|
+
l(this, "handlers", /* @__PURE__ */ new Map());
|
|
331
380
|
}
|
|
332
381
|
add(t, e) {
|
|
333
382
|
this.handlers.set(t, e);
|
|
@@ -336,47 +385,49 @@ class J {
|
|
|
336
385
|
return this.handlers.get(t);
|
|
337
386
|
}
|
|
338
387
|
}
|
|
339
|
-
const
|
|
388
|
+
const Z = (n) => {
|
|
340
389
|
let t = n, e = 0;
|
|
341
390
|
for (; t.parent; )
|
|
342
391
|
e = e + 1, t = t.parent;
|
|
343
392
|
return e;
|
|
344
|
-
},
|
|
393
|
+
}, W = (n) => n.map(([e, s]) => [Z(e), e, s]).sort(([e], [s]) => e - s).map(([, e, s]) => [e, s]), E = (n) => n && typeof n == "object" && !Array.isArray(n), v = (n, ...t) => {
|
|
345
394
|
if (!t.length)
|
|
346
395
|
return n;
|
|
347
396
|
const e = t.shift();
|
|
348
|
-
if (
|
|
397
|
+
if (E(n) && E(e))
|
|
349
398
|
for (const s in e)
|
|
350
|
-
|
|
351
|
-
return
|
|
352
|
-
},
|
|
399
|
+
E(e[s]) ? (n[s] || Object.assign(n, { [s]: {} }), v(n[s], e[s])) : Object.assign(n, { [s]: e[s] });
|
|
400
|
+
return v(n, ...t);
|
|
401
|
+
}, tt = (n, t) => !n || n === "all" ? !0 : n.some((e) => t.indexOf(e) > -1), et = (n, t) => {
|
|
353
402
|
let e = [], s = [], r;
|
|
354
403
|
const c = () => {
|
|
355
404
|
process.env.NODE_ENV !== "production" && console.time("state-processor.flush");
|
|
356
|
-
const a = /* @__PURE__ */ new Map(), u =
|
|
357
|
-
var
|
|
358
|
-
const
|
|
405
|
+
const a = /* @__PURE__ */ new Map(), u = W(e.map((i, p) => [i, s[p]])), h = (i, p) => {
|
|
406
|
+
var L;
|
|
407
|
+
const d = a.get(i) || {}, f = p.context && !d.context, g = p.properties && !d.properties, y = p.layout && !d.layout;
|
|
359
408
|
a.set(i, {
|
|
360
|
-
context:
|
|
361
|
-
properties:
|
|
362
|
-
layout:
|
|
363
|
-
}),
|
|
364
|
-
const
|
|
365
|
-
if (i.changesets.forEach((
|
|
366
|
-
const [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}),
|
|
371
|
-
|
|
372
|
-
}),
|
|
373
|
-
|
|
374
|
-
}),
|
|
375
|
-
|
|
376
|
-
|
|
409
|
+
context: d.context || f,
|
|
410
|
+
properties: d.properties || g,
|
|
411
|
+
layout: d.layout || y
|
|
412
|
+
}), g && (i.attributes.properties = {}), y && (i.attributes.layout = {}), f && (i.attributes.context = v({}, (L = i.parent) == null ? void 0 : L.attributes.context));
|
|
413
|
+
const D = [], T = [], I = [];
|
|
414
|
+
if (i.changesets.forEach((b) => {
|
|
415
|
+
const [m, x] = b;
|
|
416
|
+
tt(x.breakpoints, n.breakpoints) && (g && (typeof m.properties == "function" ? D.push(
|
|
417
|
+
m.properties
|
|
418
|
+
) : v(i.attributes.properties, m.properties)), y && (typeof m.layout == "function" ? T.push(m.layout) : v(i.attributes.layout, m.layout)), f && (typeof m.context == "function" ? I.push(m.context) : v(i.attributes.context, m.context)));
|
|
419
|
+
}), D.forEach((b) => {
|
|
420
|
+
v(i.attributes.properties, b(i.attributes.properties));
|
|
421
|
+
}), T.forEach((b) => {
|
|
422
|
+
v(i.attributes.layout, b(i.attributes.layout));
|
|
423
|
+
}), I.forEach((b) => {
|
|
424
|
+
v(i.attributes.context, b(i.attributes.context));
|
|
425
|
+
}), f || p.recursive) {
|
|
426
|
+
const b = n.getBranch(i), m = p.recursive ? p : {
|
|
427
|
+
context: !!f
|
|
377
428
|
};
|
|
378
|
-
i.getChildren(
|
|
379
|
-
h(
|
|
429
|
+
i.getChildren(b).forEach((x) => {
|
|
430
|
+
h(x, m);
|
|
380
431
|
});
|
|
381
432
|
}
|
|
382
433
|
};
|
|
@@ -395,46 +446,93 @@ const X = (n) => {
|
|
|
395
446
|
return e.push(a), s.push(u), o();
|
|
396
447
|
};
|
|
397
448
|
};
|
|
398
|
-
class
|
|
449
|
+
class st {
|
|
399
450
|
constructor(t, e = {}) {
|
|
400
|
-
this
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
451
|
+
l(this, "events");
|
|
452
|
+
l(this, "breakpoints", []);
|
|
453
|
+
l(this, "nodes");
|
|
454
|
+
l(this, "actionsState", { handlers: [], watchers: [] });
|
|
455
|
+
l(this, "switches", {});
|
|
456
|
+
l(this, "changesets", []);
|
|
457
|
+
l(this, "subscriptions", []);
|
|
458
|
+
l(this, "processNode");
|
|
459
|
+
l(this, "customComponentHandler", new X());
|
|
460
|
+
this.providers = e, this.events = t.events.createChild(this);
|
|
461
|
+
const s = new $(this.events, "root");
|
|
462
|
+
s.name = `root-${t.name}`, this.nodes = new J(s, this.switches, this.events);
|
|
463
|
+
const r = this.processNode = et(this, (c) => {
|
|
404
464
|
const o = Array.from(c.keys());
|
|
405
465
|
process.env.NODE_ENV !== "production" && console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
|
|
406
|
-
${o.map(
|
|
407
|
-
|
|
466
|
+
${o.map(
|
|
467
|
+
(a) => `${a.name || "<no name>"} (${a.id})
|
|
468
|
+
`
|
|
469
|
+
)}`), o.forEach((a) => {
|
|
408
470
|
const u = c.get(a);
|
|
409
471
|
a.parent && a.parent.type === "root" && this.events.dispatch("components:root-children-changed", { node: a }), u != null && u.context && this.events.dispatch("components:context-changed", { node: a }), u != null && u.properties && this.events.dispatch("components:properties-changed", { node: a }), u != null && u.layout && this.events.dispatch("components:layout-changed", { node: a });
|
|
410
472
|
}), this.events.dispatch("components:component-model-initialized", {}, { bubbles: !0 });
|
|
411
473
|
});
|
|
412
|
-
Promise.all(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
474
|
+
Promise.all(
|
|
475
|
+
Object.keys(e).map((c) => e[c].load(this))
|
|
476
|
+
), this.subscriptions.push(
|
|
477
|
+
this.events.subscribe(
|
|
478
|
+
"components:node-appended",
|
|
479
|
+
(c, o) => {
|
|
480
|
+
const { node: a } = o;
|
|
481
|
+
this.changesets.forEach((u) => {
|
|
482
|
+
const { changeset: h, target: i, removes: p } = u, [d, f] = h;
|
|
483
|
+
i.match(o.node) && (d.properties && p.push(a.writeProperties(d.properties, f)), d.context && p.push(a.writeContext(d.context, f)), d.layout && p.push(a.writeLayout(d.layout, f)));
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
), this.subscriptions.push(
|
|
488
|
+
this.events.subscribe(
|
|
489
|
+
"components:node-appended",
|
|
490
|
+
(c, o) => {
|
|
491
|
+
r(o.node, { properties: !0, context: !0 });
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
), this.subscriptions.push(
|
|
495
|
+
this.events.subscribe(
|
|
496
|
+
"components:set-properties",
|
|
497
|
+
(c, o) => {
|
|
498
|
+
r(o.node, { properties: !0 });
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
), this.subscriptions.push(
|
|
502
|
+
this.events.subscribe(
|
|
503
|
+
"components:set-context",
|
|
504
|
+
(c, o) => {
|
|
505
|
+
r(o.node, { properties: !0, context: !0 });
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
), this.subscriptions.push(
|
|
509
|
+
this.events.subscribe(
|
|
510
|
+
"components:set-indent",
|
|
511
|
+
(c, o) => {
|
|
512
|
+
r(o.node, { layout: !0 });
|
|
513
|
+
}
|
|
514
|
+
)
|
|
515
|
+
), this.subscriptions.push(
|
|
516
|
+
this.events.subscribe(
|
|
517
|
+
"components:set-layout",
|
|
518
|
+
(c, o) => {
|
|
519
|
+
r(o.node, { layout: !0 });
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
), this.subscriptions.push(
|
|
523
|
+
this.events.subscribe("components:node-switched", (c, { node: o, branch: a }) => {
|
|
524
|
+
r(o, {
|
|
525
|
+
layout: !0,
|
|
526
|
+
recursive: !0,
|
|
527
|
+
properties: !0,
|
|
528
|
+
context: !0
|
|
529
|
+
});
|
|
530
|
+
})
|
|
531
|
+
), this.subscriptions.push(
|
|
532
|
+
this.events.subscribe("components:node-removed", (c, { parentNode: o }) => {
|
|
533
|
+
r(o, { properties: !0 });
|
|
534
|
+
})
|
|
535
|
+
), this.events.parent && this.events.parent.dispatch("components:platform-created", { platform: this });
|
|
438
536
|
}
|
|
439
537
|
static getInstance(t) {
|
|
440
538
|
return t.getAsync("components");
|
|
@@ -463,17 +561,17 @@ ${o.map((a) => `${a.name || "<no name>"} (${a.id})
|
|
|
463
561
|
return this.switches[t.id];
|
|
464
562
|
}
|
|
465
563
|
createNode(t, e = {}) {
|
|
466
|
-
const s = new
|
|
564
|
+
const s = new $(this.events, t);
|
|
467
565
|
return e.detached && this.nodes.detached.push(s), s;
|
|
468
566
|
}
|
|
469
567
|
components() {
|
|
470
|
-
return new
|
|
568
|
+
return new P(this);
|
|
471
569
|
}
|
|
472
570
|
actions(t, e) {
|
|
473
|
-
return new
|
|
571
|
+
return new R(this, t, e);
|
|
474
572
|
}
|
|
475
573
|
write(t) {
|
|
476
|
-
const { provider: e, target: s, attributes: r, options: c = {}, removable: o } = t, a = t.key ||
|
|
574
|
+
const { provider: e, target: s, attributes: r, options: c = {}, removable: o } = t, a = t.key || N(), h = { changeset: [r, c], target: s, removes: [] };
|
|
477
575
|
if (e) {
|
|
478
576
|
const i = this.providers[e];
|
|
479
577
|
i.write(a, s, r, c), h.removes.push(() => {
|
|
@@ -504,7 +602,7 @@ ${o.map((a) => `${a.name || "<no name>"} (${a.id})
|
|
|
504
602
|
this.subscriptions.forEach((t) => t());
|
|
505
603
|
}
|
|
506
604
|
}
|
|
507
|
-
const
|
|
605
|
+
const nt = (n) => {
|
|
508
606
|
if (Array.isArray(n)) {
|
|
509
607
|
const [t, ...e] = n;
|
|
510
608
|
return {
|
|
@@ -516,14 +614,14 @@ const st = (n) => {
|
|
|
516
614
|
definitionId: n,
|
|
517
615
|
overrides: []
|
|
518
616
|
};
|
|
519
|
-
},
|
|
617
|
+
}, O = (n, t, e, s, r, c) => {
|
|
520
618
|
e.forEach((o) => {
|
|
521
|
-
const a =
|
|
619
|
+
const a = nt(o), u = s[a.definitionId];
|
|
522
620
|
if (a.definitionId === "view") {
|
|
523
621
|
const h = n.createNode("view");
|
|
524
622
|
h.name = "view", Object.keys(r).forEach((i) => {
|
|
525
623
|
const p = r[i];
|
|
526
|
-
|
|
624
|
+
O(n, h, [p.entry], s, r, i);
|
|
527
625
|
}), t.appendChild(h), a.overrides.forEach((i) => {
|
|
528
626
|
i.properties && h.writeProperties(i.properties, {
|
|
529
627
|
breakpoints: i.breakpoints
|
|
@@ -542,17 +640,19 @@ const st = (n) => {
|
|
|
542
640
|
} else {
|
|
543
641
|
const h = s[a.definitionId];
|
|
544
642
|
if (process.env.NODE_ENV !== "production" && !h) {
|
|
545
|
-
|
|
643
|
+
k.error(
|
|
644
|
+
`No definition found for component type '${a.definitionId}'.`
|
|
645
|
+
);
|
|
546
646
|
return;
|
|
547
647
|
}
|
|
548
648
|
const i = n.createNode(h.type);
|
|
549
649
|
i.name = a.definitionId, i.tags = h.tags || [], h.properties && i.writeProperties(h.properties), h.context && i.writeContext(h.context), h.layout && i.writeLayout(h.layout), t.appendChild(i, c), a.overrides.forEach((p) => {
|
|
550
|
-
const
|
|
551
|
-
p.properties && i.writeProperties(p.properties,
|
|
552
|
-
}), h.children &&
|
|
650
|
+
const d = { breakpoints: p.breakpoints };
|
|
651
|
+
p.properties && i.writeProperties(p.properties, d), p.context && i.writeContext(p.context, d), p.layout && i.writeLayout(p.layout, d);
|
|
652
|
+
}), h.children && O(n, i, h.children, s, r);
|
|
553
653
|
}
|
|
554
654
|
});
|
|
555
|
-
},
|
|
655
|
+
}, pt = (n, t) => {
|
|
556
656
|
const { entry: e, components: s, breakpoints: r, views: c } = t, o = [];
|
|
557
657
|
return Object.keys(r).forEach((a) => {
|
|
558
658
|
const u = r[a], h = window.matchMedia(u);
|
|
@@ -561,48 +661,60 @@ const st = (n) => {
|
|
|
561
661
|
p.matches ? n.addBreakpoint(a) : n.removeBreakpoint(a);
|
|
562
662
|
};
|
|
563
663
|
h.addListener(i), o.push(() => h.removeListener(i));
|
|
564
|
-
}),
|
|
664
|
+
}), O(n, n.nodes.root, [e], s, c), () => o.forEach((a) => {
|
|
565
665
|
a();
|
|
566
666
|
});
|
|
567
|
-
},
|
|
667
|
+
}, ut = (n, t) => ({
|
|
568
668
|
id: n.id,
|
|
569
669
|
type: n.type,
|
|
570
670
|
name: n.name,
|
|
571
671
|
branch: t || "default"
|
|
572
|
-
}),
|
|
672
|
+
}), lt = (n, t, e, s = N(), r = {}) => n.getAsync("components").then((c) => {
|
|
573
673
|
let o;
|
|
574
674
|
if (typeof t == "string") {
|
|
575
|
-
const h = new
|
|
675
|
+
const h = new P(c);
|
|
576
676
|
h.ofType(t), o = h;
|
|
577
677
|
} else
|
|
578
678
|
o = t;
|
|
579
679
|
const a = {}, u = (h) => {
|
|
580
680
|
const i = a[h.id];
|
|
581
|
-
return i ? Promise.resolve(i.controller) :
|
|
681
|
+
return i ? Promise.resolve(i.controller) : st.getInstance(n).then((p) => new B(p, h, s));
|
|
582
682
|
};
|
|
583
|
-
c.events.subscribe(
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
683
|
+
c.events.subscribe(
|
|
684
|
+
"components:node-enter",
|
|
685
|
+
(h, { node: i }) => {
|
|
686
|
+
o.match(i) && u(i).then((p) => {
|
|
687
|
+
Promise.resolve(e(p)).then((d) => {
|
|
688
|
+
a[i.id] = {
|
|
689
|
+
dispose: d,
|
|
690
|
+
controller: p
|
|
691
|
+
};
|
|
692
|
+
});
|
|
590
693
|
});
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
694
|
+
}
|
|
695
|
+
), c.events.subscribe(
|
|
696
|
+
"components:node-exit",
|
|
697
|
+
(h, { node: i }) => {
|
|
698
|
+
const p = a[i.id];
|
|
699
|
+
p && (p.dispose && p.dispose(), r.reuseController || (p.controller.dispose(), delete a[i.id]));
|
|
700
|
+
}
|
|
701
|
+
);
|
|
596
702
|
});
|
|
597
|
-
class
|
|
703
|
+
class dt {
|
|
598
704
|
constructor(t) {
|
|
599
|
-
this
|
|
705
|
+
l(this, "aliases", /* @__PURE__ */ new Map());
|
|
706
|
+
l(this, "components", /* @__PURE__ */ new Map());
|
|
707
|
+
l(this, "events");
|
|
708
|
+
l(this, "logger", new k());
|
|
600
709
|
const { events: e } = t.get("$widget");
|
|
601
710
|
this.events = e;
|
|
602
711
|
}
|
|
603
712
|
getComponent(t) {
|
|
604
713
|
const e = this.aliases.get(t), s = this.components.get(e || t) || null;
|
|
605
|
-
return process.env.NODE_ENV !== "production" && (s || this.logger.warn(
|
|
714
|
+
return process.env.NODE_ENV !== "production" && (s || this.logger.warn(
|
|
715
|
+
e || t,
|
|
716
|
+
`Unable to resolve component: "${e || t}". You most likely forgot to register the required plugin for: ${e || t}.`
|
|
717
|
+
)), s;
|
|
606
718
|
}
|
|
607
719
|
registerComponent(t, e) {
|
|
608
720
|
return this.components.set(t, e), this.events.dispatch("component-resolver:resolve", t), () => {
|
|
@@ -623,24 +735,24 @@ class lt {
|
|
|
623
735
|
};
|
|
624
736
|
}
|
|
625
737
|
}
|
|
626
|
-
var
|
|
738
|
+
var it = /* @__PURE__ */ ((n) => (n.open = "open", n.closed = "closed", n.hidden = "hidden", n))(it || {});
|
|
627
739
|
export {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
740
|
+
ht as ActionResolver,
|
|
741
|
+
R as ActionsController,
|
|
742
|
+
$ as ComponentNode,
|
|
743
|
+
B as ComponentNodeController,
|
|
744
|
+
st as ComponentPlatform,
|
|
745
|
+
P as ComponentQuery,
|
|
746
|
+
dt as ComponentResolver,
|
|
747
|
+
it as WidgetRenderState,
|
|
748
|
+
ut as asDescriptor,
|
|
749
|
+
at as componentConfigurationApi,
|
|
750
|
+
O as createChildren,
|
|
751
|
+
pt as createComponentModel,
|
|
752
|
+
U as createEventSubscriber,
|
|
753
|
+
lt as extendComponent,
|
|
754
|
+
G as findComponent,
|
|
755
|
+
C as findVisibleComponents,
|
|
756
|
+
A as traverseComponents
|
|
645
757
|
};
|
|
646
758
|
//# sourceMappingURL=index.js.map
|