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