@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/index.js CHANGED
@@ -1,21 +1,22 @@
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) => {
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
- 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]);
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
- }, H = (n, t) => _(n, z(t));
13
- var l = (n, t, e) => (w(n, typeof t != "symbol" ? t + "" : t, e), e);
14
- import { uuid as N, Logger as k } from "@telia-ace/widget-utilities";
15
- import { createConfigurationApi as K } from "@webprovisions/platform";
16
- class ht {
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
- l(this, "events");
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: r, value: c, target: o }) => t === o && e(t, r, c)
29
+ (s, { action: i, value: c, target: o }) => t === o && e(t, i, c)
29
30
  );
30
31
  }
31
32
  }
32
- const U = (n) => {
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, r) => {
36
- t.push(n.subscribe(s, r));
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 P {
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 Y(this.platform, this);
74
+ return new nt(this.platform, this);
60
75
  }
61
76
  }
62
- class B {
77
+ class V {
63
78
  constructor(t, e, s) {
64
- l(this, "actions");
65
- l(this, "subscribe");
66
- l(this, "unsubscribe");
67
- this.platform = t, this.node = e, this.actions = new R(
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 P(t).withId(e.id),
84
+ new R(t).withId(e.id),
70
85
  s
71
86
  );
72
- const [r, c] = U(this.platform.events);
73
- this.subscribe = r, this.unsubscribe = c;
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 Y {
116
+ class nt {
102
117
  constructor(t, e, s = !0) {
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);
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 F = (n, t, e) => {
144
- const s = n.concat(), r = (c, o, a) => {
145
- let u = !0;
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 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), {
149
- cancelled: u
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 r(t, {}, e);
169
+ return i(t, {}, e);
155
170
  };
156
- class R {
171
+ class A {
157
172
  constructor(t, e, s) {
158
- l(this, "subscriptions", []);
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 r = () => {
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(r), r;
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
- ), r = {}, c = this.platform.actionsState.handlers.filter(
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 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);
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
- a.map((h) => {
189
- const i = new B(
203
+ h.map((a) => {
204
+ const r = new V(
190
205
  this.platform,
191
- h,
206
+ a,
192
207
  this.ns
193
208
  );
194
- return F(u, e, i).then((p) => {
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, i)
212
+ g ? {} : o.fn(d, f, r)
198
213
  ).then((y) => {
199
- r[h.id] = y;
214
+ i[a.id] = y;
200
215
  });
201
216
  });
202
217
  })
203
218
  );
204
219
  })
205
- ).then(() => r);
220
+ ).then(() => i);
206
221
  }
207
222
  watch(t, e) {
208
- let s = t, r = this.ns;
223
+ let s = t, i = this.ns;
209
224
  const c = t.split(".");
210
- c.length > 1 && (r = c[0], s = c.splice(1).join("."));
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: r
230
+ ns: i
216
231
  };
217
232
  this.platform.actionsState.watchers.push(o);
218
- const a = () => {
219
- const u = this.platform.actionsState.watchers.indexOf(o);
220
- u > -1 && this.platform.actionsState.watchers.splice(u, 1);
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(a), a;
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 at = K((n) => {
243
+ const Ct = Y((n) => {
229
244
  n.createCommand("components", (t) => (e) => {
230
- t.events.subscribeOnce("components:platform-created", (s, { platform: r }) => {
245
+ t.events.subscribeOnce("components:platform-created", (s, { platform: i }) => {
231
246
  e.handlers && e.handlers.forEach(([c, o]) => {
232
- r.addComponentHandler(c, o);
247
+ i.addComponentHandler(c, o);
233
248
  });
234
249
  });
235
250
  });
236
251
  });
237
- class $ {
252
+ class M {
238
253
  constructor(t, e) {
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 = {
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" && k.error("Trying to mount an already mounted component node.", this), () => {
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, r, c) => {
317
- const { order: o = c } = r.attributes.layout;
318
- return s[o] ? s.splice(o, 0, r) : s[o] = r, s;
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], r = s.indexOf(t);
327
- r > -1 && (s.splice(r, 1), this.events.dispatch("components:node-removed", { node: t, parentNode: this }));
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 M = (n, t, e) => {
332
- for (let s = 0, r = n.length; s < r && e(n[s]) !== !0; s++) {
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
- M(o, t, e);
349
+ j(o, t, e);
335
350
  }
336
- }, A = (n, t, e) => {
351
+ }, T = (n, t, e) => {
337
352
  if (e(n) !== !0) {
338
- const s = t[n.id] || "default", r = n.children[s];
339
- M(r, t, e);
353
+ const s = t[n.id] || "default", i = n.children[s];
354
+ j(i, t, e);
340
355
  }
341
- }, C = (n, t) => {
356
+ }, E = (n, t) => {
342
357
  const e = [];
343
- return A(n, t, (s) => {
358
+ return T(n, t, (s) => {
344
359
  e.push(s);
345
360
  }), e;
346
- }, G = (n, t, e) => {
361
+ }, ot = (n, t, e) => {
347
362
  let s;
348
- return A(n, t, (r) => {
349
- if (e(r))
350
- return s = r, !0;
363
+ return T(n, t, (i) => {
364
+ if (e(i))
365
+ return s = i, !0;
351
366
  }), s;
352
367
  };
353
- class J {
368
+ class rt {
354
369
  constructor(t, e, s) {
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);
360
- }), s.subscribe("components:node-removed", (r, c) => {
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 = C(t, e);
363
- }), s.subscribe("components:node-switched", (r, c) => {
364
- this.visible = C(t, e);
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 A(this.root, this.switches, (s) => {
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 G(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
389
+ return ot(this.root, this.switches, (e) => e.id === t) || this.detached.find((e) => e.id === t);
375
390
  }
376
391
  }
377
- class X {
392
+ class ct {
378
393
  constructor() {
379
- l(this, "handlers", /* @__PURE__ */ new Map());
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 Z = (n) => {
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
- }, 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) => {
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 (E(n) && E(e))
412
+ if (O(n) && O(e))
398
413
  for (const s in e)
399
- E(e[s]) ? (n[s] || Object.assign(n, { [s]: {} }), v(n[s], e[s])) : Object.assign(n, { [s]: e[s] });
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
- }, tt = (n, t) => !n || n === "all" ? !0 : n.some((e) => t.indexOf(e) > -1), et = (n, t) => {
402
- let e = [], s = [], r;
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 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;
408
- a.set(i, {
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 && (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(
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(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)));
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(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));
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(i), m = p.recursive ? p : {
441
+ const b = n.getBranch(r), m = p.recursive ? p : {
427
442
  context: !!f
428
443
  };
429
- i.getChildren(b).forEach((x) => {
430
- h(x, m);
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"), u.forEach(([i, p]) => {
435
- h(i, p);
436
- }), e = [], s = [], t(a);
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(r), r = setTimeout(c, 0);
453
+ clearTimeout(i), i = setTimeout(c, 0);
439
454
  };
440
- return (a, u) => {
441
- const h = e.indexOf(a);
442
- if (h > -1) {
443
- const i = s[h];
444
- return u.context && (i.context = !0), u.properties && (i.properties = !0), u.layout && (i.layout = !0), u.recursive && (i.recursive = !0), o();
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(a), s.push(u), o();
461
+ return e.push(h), s.push(l), o();
447
462
  };
448
463
  };
449
- class st {
464
+ class lt {
450
465
  constructor(t, e = {}) {
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());
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 $(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) => {
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
- (a) => `${a.name || "<no name>"} (${a.id})
482
+ (h) => `${h.name || "<no name>"} (${h.id})
468
483
  `
469
- )}`), o.forEach((a) => {
470
- const u = c.get(a);
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 });
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: 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)));
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
- r(o.node, { properties: !0, context: !0 });
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
- r(o.node, { properties: !0 });
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
- r(o.node, { properties: !0, context: !0 });
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
- r(o.node, { layout: !0 });
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
- r(o.node, { layout: !0 });
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: a }) => {
524
- r(o, {
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
- r(o, { properties: !0 });
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 $(this.events, t);
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 P(this);
583
+ return new R(this);
569
584
  }
570
585
  actions(t, e) {
571
- return new R(this, t, e);
586
+ return new A(this, t, e);
572
587
  }
573
588
  write(t) {
574
- const { provider: e, target: s, attributes: r, options: c = {}, removable: o } = t, a = t.key || N(), h = { changeset: [r, c], target: s, removes: [] };
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 i = this.providers[e];
577
- i.write(a, s, r, c), h.removes.push(() => {
578
- i.remove(a);
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(h), this.nodes.all.forEach((i) => {
582
- if (s.match(i)) {
596
+ return this.changesets.push(a), this.nodes.all.forEach((r) => {
597
+ if (s.match(r)) {
583
598
  let p = () => {
584
599
  };
585
- r.properties && (p = i.writeProperties(r.properties, c, o)), r.context && (p = i.writeContext(r.context, c, o)), r.layout && (p = i.writeContext(r.layout, c, o)), h.removes.push(p);
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
- h.removes.forEach((p) => p());
590
- const i = this.changesets.indexOf(h);
591
- i > -1 && this.changesets.splice(i, 1);
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 nt = (n) => {
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
- }, O = (n, t, e, s, r, c) => {
632
+ }, P = (n, t, e, s, i, c) => {
618
633
  e.forEach((o) => {
619
- const a = nt(o), u = s[a.definitionId];
620
- if (a.definitionId === "view") {
621
- const h = n.createNode("view");
622
- h.name = "view", Object.keys(r).forEach((i) => {
623
- const p = r[i];
624
- O(n, h, [p.entry], s, r, i);
625
- }), t.appendChild(h), a.overrides.forEach((i) => {
626
- i.properties && h.writeProperties(i.properties, {
627
- breakpoints: i.breakpoints
628
- }), i.context && h.writeContext(i.context, { breakpoints: i.breakpoints }), i.layout && h.writeLayout(i.layout, { breakpoints: i.breakpoints });
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(u.type)) {
631
- const h = n.getComponentHandler(u.type);
632
- h && h(a, {
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: r,
652
+ views: i,
638
653
  branch: c
639
654
  });
640
655
  } else {
641
- const h = s[a.definitionId];
642
- if (process.env.NODE_ENV !== "production" && !h) {
643
- k.error(
644
- `No definition found for component type '${a.definitionId}'.`
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 i = n.createNode(h.type);
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) => {
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 && 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);
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
- }, pt = (n, t) => {
656
- const { entry: e, components: s, breakpoints: r, views: c } = t, o = [];
657
- return Object.keys(r).forEach((a) => {
658
- const u = r[a], h = window.matchMedia(u);
659
- h.matches && n.breakpoints.push(a);
660
- const i = (p) => {
661
- p.matches ? n.addBreakpoint(a) : n.removeBreakpoint(a);
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
- h.addListener(i), o.push(() => h.removeListener(i));
664
- }), O(n, n.nodes.root, [e], s, c), () => o.forEach((a) => {
665
- a();
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
- }, ut = (n, t) => ({
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
- }), lt = (n, t, e, s = N(), r = {}) => n.getAsync("components").then((c) => {
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 h = new P(c);
676
- h.ofType(t), o = h;
690
+ const a = new R(c);
691
+ a.ofType(t), o = a;
677
692
  } else
678
693
  o = t;
679
- const a = {}, u = (h) => {
680
- const i = a[h.id];
681
- return i ? Promise.resolve(i.controller) : st.getInstance(n).then((p) => new B(p, h, s));
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
- (h, { node: i }) => {
686
- o.match(i) && u(i).then((p) => {
700
+ (a, { node: r }) => {
701
+ o.match(r) && l(r).then((p) => {
687
702
  Promise.resolve(e(p)).then((d) => {
688
- a[i.id] = {
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
- (h, { node: i }) => {
698
- const p = a[i.id];
699
- p && (p.dispose && p.dispose(), r.reuseController || (p.controller.dispose(), delete a[i.id]));
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 dt {
718
+ class Pt {
704
719
  constructor(t) {
705
- l(this, "aliases", /* @__PURE__ */ new Map());
706
- l(this, "components", /* @__PURE__ */ new Map());
707
- l(this, "events");
708
- l(this, "logger", new k());
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, r) => {
726
- if (r === t) {
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
- var it = /* @__PURE__ */ ((n) => (n.open = "open", n.closed = "closed", n.hidden = "hidden", n))(it || {});
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
- 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
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