@mintplayer/web-components 3.5.0 → 3.6.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.
@@ -128,7 +128,8 @@ var C = class extends s {
128
128
  maxHeight: this.maxHeight,
129
129
  label: this.label,
130
130
  active: this.active
131
- })
131
+ }),
132
+ hostScope: "dropdown"
132
133
  });
133
134
  constructor() {
134
135
  super(), this.maxHeight = null, this.label = null, this.active = !1;
package/machine/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { noChange as e, nothing as t, render as n } from "lit";
2
2
  import { createBodyHost as r, removeBodyHost as i } from "@mintplayer/ui-core/overlay";
3
3
  import { Directive as a, PartType as o, directive as s } from "lit/directive.js";
4
- import { coreRuntime as c, directiveInputs as l, elementCore as u, sameContent as d } from "@mintplayer/ui-core/component";
5
- import { AsyncDirective as f, PartType as p, directive as m } from "lit/async-directive.js";
4
+ import { coreRuntime as c, directiveInputs as l, elementCore as u, sameContent as d, scopedHost as f } from "@mintplayer/ui-core/component";
5
+ import { AsyncDirective as p, PartType as m, directive as h } from "lit/async-directive.js";
6
6
  //#region libs/mintplayer-web-components/machine/src/machine-controller.ts
7
- var h = class {
7
+ var g = class {
8
8
  #e = null;
9
9
  constructor(e, t, n = !0) {
10
10
  this.host = e, this.machine = t, this.ownsMachine = n, e.addController(this);
@@ -21,7 +21,7 @@ var h = class {
21
21
  dispose() {
22
22
  this.hostDisconnected(), this.ownsMachine && this.machine.destroy();
23
23
  }
24
- }, g = /* @__PURE__ */ new Set([
24
+ }, _ = /* @__PURE__ */ new Set([
25
25
  "href",
26
26
  "src",
27
27
  "srcdoc",
@@ -30,7 +30,7 @@ var h = class {
30
30
  "action",
31
31
  "formaction",
32
32
  "data"
33
- ]), _ = s(class extends a {
33
+ ]), v = s(class extends a {
34
34
  #e = {};
35
35
  constructor(e) {
36
36
  if (super(e), e.type !== o.ELEMENT) throw Error("props() must be used in element position");
@@ -41,29 +41,29 @@ var h = class {
41
41
  update(t, [n]) {
42
42
  let r = t.element, i = (e) => e == null || e === !1;
43
43
  return Object.keys(this.#e).filter((e) => !(e in n) || i(n[e])).forEach((e) => r.removeAttribute(e)), Object.entries(n).filter(([, e]) => !i(e)).filter(([e]) => {
44
- if (g.has(e) || e.startsWith("on")) throw Error(`props() refuses to set "${e}"`);
44
+ if (_.has(e) || e.startsWith("on")) throw Error(`props() refuses to set "${e}"`);
45
45
  return !0;
46
46
  }).filter(([e, t]) => !Object.is(this.#e[e], t)).forEach(([e, t]) => r.setAttribute(e, t === !0 ? "" : String(t))), this.#e = { ...n }, e;
47
47
  }
48
- }), v = {
48
+ }), y = {
49
49
  attrs: {},
50
50
  classes: []
51
- }, y = (e) => e == null || e === !1;
52
- function b(e, t, n) {
51
+ }, b = (e) => e == null || e === !1;
52
+ function x(e, t, n) {
53
53
  let { class: r, ...i } = n, a = typeof r == "string" ? r.split(/\s+/).filter(Boolean) : [];
54
- return e.classList.remove(...t.classes.filter((e) => !a.includes(e))), a.length && e.classList.add(...a), Object.keys(t.attrs).filter((e) => y(i[e])).forEach((t) => e.removeAttribute(t)), Object.entries(i).filter(([, e]) => !y(e)).filter(([e, n]) => !Object.is(t.attrs[e], n)).forEach(([t, n]) => e.setAttribute(t, n === !0 ? "" : String(n))), {
54
+ return e.classList.remove(...t.classes.filter((e) => !a.includes(e))), a.length && e.classList.add(...a), Object.keys(t.attrs).filter((e) => b(i[e])).forEach((t) => e.removeAttribute(t)), Object.entries(i).filter(([, e]) => !b(e)).filter(([e, n]) => !Object.is(t.attrs[e], n)).forEach(([t, n]) => e.setAttribute(t, n === !0 ? "" : String(n))), {
55
55
  attrs: i,
56
56
  classes: a
57
57
  };
58
58
  }
59
- function x(e) {
59
+ function S(e) {
60
60
  let t = Object.fromEntries(Array.from(e.attributes).filter(({ name: e }) => e.startsWith("aria-") || e === "id" || e === "tabindex").map(({ name: e, value: t }) => [e, t]));
61
61
  return ["id", "tabindex"].filter((e) => e in t).forEach((t) => e.removeAttribute(t)), {
62
62
  host: e,
63
63
  attrs: t
64
64
  };
65
65
  }
66
- function S(e, t) {
66
+ function C(e, t) {
67
67
  let n = e ?? {};
68
68
  if (!t) return n;
69
69
  let { id: r, ...i } = t.attrs, a = n.id !== null && n.id !== void 0;
@@ -73,7 +73,7 @@ function S(e, t) {
73
73
  ...r && !a ? { id: r } : {}
74
74
  };
75
75
  }
76
- var C = (e) => e.nodeType === Node.COMMENT_NODE || e.nodeType === Node.TEXT_NODE && !e.textContent?.trim() || e instanceof Element && (e.hasAttribute("data-mp-owned") || e.hasAttribute("data-mps") && !e.localName.includes("-")), w = class {
76
+ var w = (e) => e.nodeType === Node.COMMENT_NODE || e.nodeType === Node.TEXT_NODE && !e.textContent?.trim() || e instanceof Element && (e.hasAttribute("data-mp-owned") || e.hasAttribute("data-mps") && !e.localName.includes("-")), T = class {
77
77
  #e = null;
78
78
  #t = null;
79
79
  constructor(e) {
@@ -83,7 +83,7 @@ var C = (e) => e.nodeType === Node.COMMENT_NODE || e.nodeType === Node.TEXT_NODE
83
83
  return this.#e ?? {};
84
84
  }
85
85
  capture() {
86
- this.#e ??= T(this.host);
86
+ this.#e ??= E(this.host);
87
87
  }
88
88
  hostConnected() {
89
89
  this.#t = new MutationObserver((e) => this.#n(e, !0)), this.#t.observe(this.host, { childList: !0 });
@@ -99,11 +99,11 @@ var C = (e) => e.nodeType === Node.COMMENT_NODE || e.nodeType === Node.TEXT_NODE
99
99
  }
100
100
  #n(e, t) {
101
101
  if (!this.#e) return;
102
- let n = new Set(e.flatMap((e) => [...e.addedNodes])), r = new Set(Object.values(this.#e).flat()), i = T(this.host, (e) => !n.has(e) || r.has(e) || C(e));
102
+ let n = new Set(e.flatMap((e) => [...e.addedNodes])), r = new Set(Object.values(this.#e).flat()), i = E(this.host, (e) => !n.has(e) || r.has(e) || w(e));
103
103
  Object.keys(i).length !== 0 && (Object.entries(i).forEach(([e, t]) => this.#e[e] = [...this.#e[e] ?? [], ...t]), t && this.host.requestUpdate());
104
104
  }
105
105
  };
106
- function T(e, t = () => !1) {
106
+ function E(e, t = () => !1) {
107
107
  let n = {};
108
108
  return [...e.childNodes].filter((e) => !t(e)).forEach((e) => {
109
109
  if (e.parentNode?.removeChild(e), e.nodeType === Node.COMMENT_NODE || e.nodeType === Node.TEXT_NODE && !e.textContent?.trim()) return;
@@ -111,36 +111,36 @@ function T(e, t = () => !1) {
111
111
  (n[t ?? "default"] ??= []).push(e);
112
112
  }), n;
113
113
  }
114
- var E = (e) => ({
114
+ var D = (e) => ({
115
115
  fromAttribute: (t) => t === null ? e : t !== "false",
116
116
  toAttribute: (e) => e ? "" : null
117
- }), D = (e, t) => ({
117
+ }), O = (e, t) => ({
118
118
  fromAttribute: (n) => n === null || t && !t.includes(n) ? e : n,
119
119
  toAttribute: (e) => e == null ? null : String(e)
120
- }), O = (e) => ({
120
+ }), k = (e) => ({
121
121
  fromAttribute: (t) => {
122
122
  let n = t === null || t.trim() === "" ? NaN : Number(t);
123
123
  return Number.isFinite(n) ? n : e;
124
124
  },
125
125
  toAttribute: (e) => e == null ? null : String(e)
126
- }), k = /* @__PURE__ */ new WeakMap();
127
- function A(e) {
128
- let t = k.get(e);
129
- return t || (t = Symbol(e.name), k.set(e, t)), t;
126
+ }), A = /* @__PURE__ */ new WeakMap();
127
+ function j(e) {
128
+ let t = A.get(e);
129
+ return t || (t = Symbol(e.name), A.set(e, t)), t;
130
130
  }
131
- var j = /* @__PURE__ */ new WeakMap();
132
- function M(e, t) {
133
- let n = A(t);
131
+ var M = /* @__PURE__ */ new WeakMap();
132
+ function N(e, t) {
133
+ let n = j(t);
134
134
  for (let t = e.parentNode; t; t = t instanceof ShadowRoot ? t.host : t.parentNode) {
135
135
  let r = t[n];
136
136
  if (r) {
137
- let n = j.get(t) ?? /* @__PURE__ */ new Set();
138
- return j.set(t, n.add(e)), r();
137
+ let n = M.get(t) ?? /* @__PURE__ */ new Set();
138
+ return M.set(t, n.add(e)), r();
139
139
  }
140
140
  }
141
141
  return t.defaultValue;
142
142
  }
143
- var N = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "object" && Object.keys(e).length === Object.keys(t).length && Object.entries(e).every(([e, n]) => t[e] === n), P = 0, F = class {
143
+ var P = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "object" && Object.keys(e).length === Object.keys(t).length && Object.entries(e).every(([e, n]) => t[e] === n), F = 0, I = class {
144
144
  #e;
145
145
  #t;
146
146
  #n;
@@ -149,11 +149,11 @@ var N = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "
149
149
  #a;
150
150
  #o;
151
151
  #s = !1;
152
- #c = v;
152
+ #c = y;
153
153
  #l;
154
154
  #u;
155
155
  constructor(e, t, n) {
156
- this.#e = e, this.#t = t, this.#n = n, this.#r = `${n.idPrefix}-${++P}`, this.#i = c(t, {
156
+ this.#e = e, this.#t = t, this.#n = n, this.#r = `${n.idPrefix}-${++F}`, this.#i = c(t, {
157
157
  inputs: n.inputs,
158
158
  state: () => this.#d,
159
159
  setState: (t) => {
@@ -175,7 +175,7 @@ var N = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "
175
175
  bubbles: !0,
176
176
  composed: !0
177
177
  }))
178
- }), e.addController(this), t.provides && (e[A(t.provides)] = () => t.provide?.(this.#f()));
178
+ }), e.addController(this), t.provides && (e[j(t.provides)] = () => t.provide?.(this.#f()));
179
179
  }
180
180
  get #d() {
181
181
  return this.#a ??= this.#t.state ? this.#t.state(this.#n.inputs()) : {};
@@ -186,7 +186,7 @@ var N = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "
186
186
  state: this.#d,
187
187
  id: this.#r,
188
188
  hydrated: this.#s,
189
- context: this.#t.consume ? M(this.#e, this.#t.consume) : void 0,
189
+ context: this.#t.consume ? N(this.#e, this.#t.consume) : void 0,
190
190
  label: this.#o ?? null,
191
191
  api: () => this.#i.api
192
192
  };
@@ -213,21 +213,21 @@ var N = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "
213
213
  e !== null && t != null && t !== !1 && e === String(t) || e === this.#o || (this.#o = e, this.#e.requestUpdate());
214
214
  }
215
215
  #m() {
216
- for (let e = this.#e.parentNode; e; e = e instanceof ShadowRoot ? e.host : e.parentNode) j.get(e)?.delete(this.#e);
216
+ for (let e = this.#e.parentNode; e; e = e instanceof ShadowRoot ? e.host : e.parentNode) M.get(e)?.delete(this.#e);
217
217
  }
218
218
  #h() {
219
219
  if (!this.#t.provides || !this.#t.provide) return;
220
220
  let e = this.#t.provide(this.#f());
221
- N(e, this.#l) || (this.#l = e, j.get(this.#e)?.forEach((e) => e.isConnected ? e.requestUpdate() : j.get(this.#e)?.delete(e)));
221
+ P(e, this.#l) || (this.#l = e, M.get(this.#e)?.forEach((e) => e.isConnected ? e.requestUpdate() : M.get(this.#e)?.delete(e)));
222
222
  }
223
223
  props() {
224
- let e = this.#t.view(this.#f()), t = this.#n.hostBag ?? this.#t.host?.bind(this.#t);
225
- return t && (this.#c = b(this.#e, this.#c, t(e) ?? {})), e;
224
+ let e = this.#t.view(this.#f()), t = this.#n.hostBag ?? f(this.#t.host?.bind(this.#t), this.#n.hostScope);
225
+ return t && (this.#c = x(this.#e, this.#c, t(e) ?? {})), e;
226
226
  }
227
227
  call(e, t) {
228
228
  return this.#i.call(e, t);
229
229
  }
230
- }, I = s(class extends a {
230
+ }, L = s(class extends a {
231
231
  #e = null;
232
232
  constructor(e) {
233
233
  if (super(e), e.type !== o.CHILD) throw Error("teleport() must be used in child position");
@@ -239,11 +239,11 @@ var N = (e, t) => e === t || !!e && !!t && typeof e == "object" && typeof t == "
239
239
  let a = r ?? null;
240
240
  return this.#e && this.#e !== a && n(t, this.#e), this.#e = a, a && n(i, a), t;
241
241
  }
242
- }), L = "mp-content-change";
243
- function R(e) {
244
- e.dispatchEvent(new Event(L, { bubbles: !0 }));
242
+ }), R = "mp-content-change";
243
+ function z(e) {
244
+ e.dispatchEvent(new Event(R, { bubbles: !0 }));
245
245
  }
246
- var z = (e, t) => e.length === t.length && e.every((e, n) => [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t[n])])].every((r) => e[r] === t[n][r])), B = class {
246
+ var B = (e, t) => e.length === t.length && e.every((e, n) => [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t[n])])].every((r) => e[r] === t[n][r])), V = class {
247
247
  #e;
248
248
  constructor(e, t, n) {
249
249
  this.host = e, this.tag = t, this.within = n, this.value = [], this.lent = [], this.#e = null, this.#n = () => {
@@ -256,10 +256,10 @@ var z = (e, t) => e.length === t.length && e.every((e, n) => [.../* @__PURE__ */
256
256
  }), this.#e.observe(this.host, {
257
257
  childList: !0,
258
258
  subtree: !0
259
- }), this.host.addEventListener(L, this.#n);
259
+ }), this.host.addEventListener(R, this.#n);
260
260
  }
261
261
  hostDisconnected() {
262
- this.#e?.disconnect(), this.#e = null, this.host.removeEventListener(L, this.#n);
262
+ this.#e?.disconnect(), this.#e = null, this.host.removeEventListener(R, this.#n);
263
263
  }
264
264
  hostUpdate() {
265
265
  this.#r();
@@ -277,24 +277,24 @@ var z = (e, t) => e.length === t.length && e.every((e, n) => [.../* @__PURE__ */
277
277
  inputs: e.contentInputs ?? {},
278
278
  within: t && this.host.contains(t) ? t.contentInputs ?? {} : null
279
279
  };
280
- }), i = d(this.value, r), a = z(this.lent, n);
280
+ }), i = d(this.value, r), a = B(this.lent, n);
281
281
  return i && a ? !1 : (i || (this.value = r), a || (this.lent = n), !0);
282
282
  }
283
283
  };
284
284
  //#endregion
285
285
  //#region libs/mintplayer-web-components/machine/src/mark-links.ts
286
- function V(e, t) {
286
+ function H(e, t) {
287
287
  e.filter((e) => e instanceof Element).forEach((e) => e.classList.add(t));
288
288
  }
289
289
  //#endregion
290
290
  //#region libs/mintplayer-web-components/machine/src/core-directive.ts
291
- var H = 0;
292
- function U(a, o) {
293
- class s extends f {
291
+ var U = 0;
292
+ function W(a, o) {
293
+ class s extends p {
294
294
  #e = null;
295
295
  #t = null;
296
296
  #n;
297
- #r = `mp-overlay-d${++H}`;
297
+ #r = `mp-overlay-d${++U}`;
298
298
  #i = null;
299
299
  #a(e) {
300
300
  let t = o.overlay?.(e, this.#n) ?? null;
@@ -307,7 +307,7 @@ function U(a, o) {
307
307
  this.#i &&= (n(t, this.#i), i(document, this.#r), null);
308
308
  }
309
309
  constructor(e) {
310
- if (super(e), e.type !== p.ELEMENT) throw Error(`${o.idPrefix} is an element directive: put it in an element's attribute position`);
310
+ if (super(e), e.type !== m.ELEMENT) throw Error(`${o.idPrefix} is an element directive: put it in an element's attribute position`);
311
311
  }
312
312
  render(t, n) {
313
313
  return e;
@@ -333,17 +333,17 @@ function U(a, o) {
333
333
  this.#e?.attach();
334
334
  }
335
335
  }
336
- return m(s);
336
+ return h(s);
337
337
  }
338
338
  //#endregion
339
339
  //#region libs/mintplayer-web-components/machine/src/body-teleport-directive.ts
340
- var W = 0, G = m(class extends f {
341
- #e = `mp-overlay-${++W}`;
340
+ var G = 0, K = h(class extends p {
341
+ #e = `mp-overlay-${++G}`;
342
342
  #t = null;
343
343
  #n = t;
344
344
  #r = null;
345
345
  constructor(e) {
346
- if (super(e), e.type !== p.CHILD) throw Error("bodyTeleport() must be used in child position");
346
+ if (super(e), e.type !== m.CHILD) throw Error("bodyTeleport() must be used in child position");
347
347
  }
348
348
  render(e) {
349
349
  return t;
@@ -360,7 +360,7 @@ var W = 0, G = m(class extends f {
360
360
  reconnected() {
361
361
  this.#i();
362
362
  }
363
- }), K = s(class extends a {
363
+ }), q = s(class extends a {
364
364
  #e = null;
365
365
  constructor(e) {
366
366
  if (super(e), e.type !== o.CHILD) throw Error("instanceStyle() must be used in child position");
@@ -370,4 +370,4 @@ var W = 0, G = m(class extends f {
370
370
  }
371
371
  });
372
372
  //#endregion
373
- export { B as ContentQuery, F as CoreController, v as EMPTY_HOST_PROPS, w as LightChildren, h as MachineController, b as applyHostProps, G as bodyTeleport, E as booleanAttribute, U as coreDirective, S as forwardHostAttrs, K as instanceStyle, V as markLinks, R as notifyContentChange, O as numberAttribute, C as ownedByTemplate, _ as props, D as stringAttribute, x as takeHostAttrs, T as takeLightChildren, I as teleport };
373
+ export { V as ContentQuery, I as CoreController, y as EMPTY_HOST_PROPS, T as LightChildren, g as MachineController, x as applyHostProps, K as bodyTeleport, D as booleanAttribute, W as coreDirective, C as forwardHostAttrs, q as instanceStyle, H as markLinks, z as notifyContentChange, k as numberAttribute, w as ownedByTemplate, v as props, O as stringAttribute, S as takeHostAttrs, E as takeLightChildren, L as teleport };
@@ -6,6 +6,11 @@ export interface CoreControllerOptions<I, P> {
6
6
  readonly idPrefix: string;
7
7
  /** The host element's bag, where the template root is the host (`mp-host`). Default: `core.host`. */
8
8
  readonly hostBag?: (props: P) => CoreBag | null | undefined;
9
+ /**
10
+ * The group's scope, stamped as `data-mps` on the bag `core.host` writes where the template root is
11
+ * NOT the host (#460). Unlike `hostBag`, it does not make the host the core's root.
12
+ */
13
+ readonly hostScope?: string;
9
14
  /** Two-way inputs: properties written back when the core changes the state of the same name. */
10
15
  readonly models?: readonly string[];
11
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/web-components",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -319,7 +319,7 @@
319
319
  "@lit/context": "^1.1.6"
320
320
  },
321
321
  "dependencies": {
322
- "@mintplayer/ui-core": "^1.6.0",
322
+ "@mintplayer/ui-core": "^1.7.0",
323
323
  "tslib": "^2.3.0",
324
324
  "intl-tel-input": "^29.1.2",
325
325
  "libphonenumber-js": "^1.13.10"
@@ -130,7 +130,8 @@ var y = class extends o {
130
130
  animated: this.animated,
131
131
  label: this.label,
132
132
  valueText: this.valueText
133
- })
133
+ }),
134
+ hostScope: "progress"
134
135
  });
135
136
  constructor() {
136
137
  super(), this.minimum = 0, this.maximum = 100, this.value = 0, this.color = "primary", this.striped = !1, this.animated = !1, this.label = "Progress", this.valueText = null;