@mintplayer/web-components 2.20.0 → 3.0.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.
Files changed (41) hide show
  1. package/chunks/{datatable-qkYf-N0c.mjs → datatable-CrK1ZNq-.mjs} +132 -130
  2. package/chunks/{pagination-Bcz1TwlS.mjs → pagination-DgDp3v3u.mjs} +1 -1
  3. package/custom-elements.json +3119 -3416
  4. package/datatable/index.mjs +1 -1
  5. package/datatable/src/components/mp-datatable.d.ts +4 -0
  6. package/datatable/src/types/tree.d.ts +7 -0
  7. package/dropdown-menu/index.mjs +16 -23
  8. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +5 -8
  9. package/dropdown-menu/src/index.d.ts +1 -1
  10. package/dropdown-menu/src/types/dropdown.d.ts +0 -2
  11. package/dropdown-menu/src/types/index.d.ts +1 -1
  12. package/file-manager/index.mjs +1 -1
  13. package/light-dom/index.mjs +61 -121
  14. package/light-dom/src/install-light-styles.d.ts +10 -22
  15. package/light-dom/src/scoped-html.d.ts +0 -6
  16. package/machine/index.d.ts +1 -0
  17. package/machine/index.mjs +47 -0
  18. package/machine/src/index.d.ts +2 -0
  19. package/machine/src/machine-controller.d.ts +25 -0
  20. package/machine/src/props-directive.d.ts +21 -0
  21. package/package.json +10 -1
  22. package/pagination/index.mjs +1 -1
  23. package/tile-manager/index.mjs +150 -731
  24. package/tile-manager/src/components/index.d.ts +1 -2
  25. package/tile-manager/src/components/mp-tile-manager.d.ts +107 -0
  26. package/tile-manager/src/index.d.ts +2 -3
  27. package/tree-select/index.mjs +63 -55
  28. package/tree-select/src/components/mp-tree-select.d.ts +16 -5
  29. package/typeahead/index.d.ts +1 -0
  30. package/typeahead/index.mjs +220 -0
  31. package/typeahead/src/components/mp-typeahead.d.ts +67 -0
  32. package/typeahead/src/index.d.ts +3 -0
  33. package/tile-manager/src/components/mint-tile-manager.element.d.ts +0 -212
  34. package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +0 -2
  35. package/tile-manager/src/types/grid-rect.d.ts +0 -12
  36. package/tile-manager/src/types/index.d.ts +0 -3
  37. package/tile-manager/src/types/tile-layout-snapshot.d.ts +0 -15
  38. package/tile-manager/src/types/tile-position.d.ts +0 -10
  39. package/tile-manager/src/utils/grid-geometry.d.ts +0 -49
  40. package/tile-manager/src/utils/index.d.ts +0 -1
  41. package/tile-manager/src/utils/pack.d.ts +0 -24
@@ -1 +1 @@
1
- export { a as DEFAULT_DATATABLE_LABELS, t as MpDatatable, r as computeNextSort, i as datatableLightStyles, n as sortRows } from "../chunks/datatable-qkYf-N0c.mjs";
1
+ export { a as DEFAULT_DATATABLE_LABELS, t as MpDatatable, r as computeNextSort, i as datatableLightStyles, n as sortRows } from "../chunks/datatable-CrK1ZNq-.mjs";
@@ -231,6 +231,8 @@ export declare class MpDatatable extends LitElement {
231
231
  private _fetch;
232
232
  /** Bumped on invalidation; in-flight responses from an older generation are dropped. */
233
233
  private _fetchGeneration;
234
+ /** Aborts every in-flight `fetch` of the current generation; replaced on invalidation (#436 D4). */
235
+ private _fetchAbort;
234
236
  /** Guards the one-time initial page-1 load. Reset when the callback changes. */
235
237
  private _initialFetchDone;
236
238
  /** Coalesces multiple setter calls in one flush into a single reload. */
@@ -781,6 +783,8 @@ export declare class MpDatatable extends LitElement {
781
783
  * that echoes a different page number can't deadlock the window.
782
784
  * Generation-guarded against responses that land after an invalidation.
783
785
  */
786
+ /** Drop every in-flight fetch response (generation) and abort the requests themselves (signal). */
787
+ private invalidateFetches;
784
788
  private fetchWindowPage;
785
789
  /**
786
790
  * Fetch a node's children into the child cache. Called on expand or when a
@@ -23,6 +23,13 @@ export interface DatatableFetchRequest {
23
23
  page: number;
24
24
  perPage: number;
25
25
  sortColumns: SortColumn[];
26
+ /**
27
+ * Aborts when the table invalidates its pages (sort, page size, a new `fetch`,
28
+ * `reload()`), so a superseded request stops instead of running to completion
29
+ * and being ignored. Pass it to `fetch`; the same shape as every other
30
+ * provider request in the libraries (#436 D4).
31
+ */
32
+ signal: AbortSignal;
26
33
  }
27
34
  /**
28
35
  * Response returned from the `fetch` callback. Only `data` + `totalRecords` are
@@ -10,7 +10,7 @@ var a = class extends t {
10
10
  super(...t), this.#e = 0, this._inputLabel = null, this.#t = new e(this, { referenceTarget: () => this.renderRoot?.querySelector("ul") ?? null }), this.#o = () => {
11
11
  this.#s();
12
12
  }, this.#c = (e) => {
13
- if (this.mode === "menu") switch (e.key) {
13
+ switch (e.key) {
14
14
  case "ArrowDown":
15
15
  this.#l(1), e.preventDefault();
16
16
  break;
@@ -59,7 +59,6 @@ var a = class extends t {
59
59
  static get observedAttributes() {
60
60
  return [
61
61
  ...super.observedAttributes ?? [],
62
- "mode",
63
62
  "max-height",
64
63
  "aria-label",
65
64
  "input-label",
@@ -68,12 +67,6 @@ var a = class extends t {
68
67
  ];
69
68
  }
70
69
  #e;
71
- get mode() {
72
- return this.getAttribute("mode") === "listbox" ? "listbox" : "menu";
73
- }
74
- set mode(e) {
75
- e ? this.setAttribute("mode", e) : this.removeAttribute("mode");
76
- }
77
70
  get inputLabel() {
78
71
  return this._inputLabel;
79
72
  }
@@ -89,7 +82,7 @@ var a = class extends t {
89
82
  super.disconnectedCallback(), this.removeEventListener("click", this.#d), this.removeEventListener("keydown", this.#c);
90
83
  }
91
84
  attributeChangedCallback(e, t, n) {
92
- super.attributeChangedCallback(e, t, n), e === "max-height" ? n ? this.style.setProperty("--mp-dropdown-max-height", `${n}px`) : this.style.removeProperty("--mp-dropdown-max-height") : e === "aria-labelledby" || e === "aria-describedby" ? this.#t.syncReferences() : e === "input-label" ? (this._inputLabel = n, this.requestUpdate()) : (e === "mode" || e === "aria-label") && (this.requestUpdate(), this.#s());
85
+ super.attributeChangedCallback(e, t, n), e === "max-height" ? n ? this.style.setProperty("--mp-dropdown-max-height", `${n}px`) : this.style.removeProperty("--mp-dropdown-max-height") : e === "aria-labelledby" || e === "aria-describedby" ? this.#t.syncReferences() : e === "input-label" ? (this._inputLabel = n, this.requestUpdate()) : e === "aria-label" && (this.requestUpdate(), this.#s());
93
86
  }
94
87
  firstUpdated() {
95
88
  this.#s();
@@ -117,20 +110,20 @@ var a = class extends t {
117
110
  let e = (e) => [...this.querySelectorAll(e)].filter((e) => e.closest("mp-dropdown-menu") === this && !e.hasAttribute("role"));
118
111
  e(".dropdown-header").forEach((e) => e.setAttribute("role", "presentation")), e(".dropdown-divider").forEach((e) => e.setAttribute("role", "separator"));
119
112
  let t = this.#n();
120
- if (t.length === 0) return;
121
- if (!t[this.#e] || this.#i(t[this.#e])) {
122
- let e = t.findIndex((e) => !this.#i(e));
123
- this.#e = e >= 0 ? e : 0;
113
+ if (t.length !== 0) {
114
+ if (!t[this.#e] || this.#i(t[this.#e])) {
115
+ let e = t.findIndex((e) => !this.#i(e));
116
+ this.#e = e >= 0 ? e : 0;
117
+ }
118
+ t.forEach((e, t) => {
119
+ let n = this.#r(e);
120
+ n !== e && e.setAttribute("role", "presentation"), n.setAttribute("role", "menuitem");
121
+ let r = this.#i(e);
122
+ n.removeAttribute("aria-selected"), r ? n.setAttribute("aria-disabled", "true") : n.removeAttribute("aria-disabled");
123
+ let i = t === this.#e && !r;
124
+ n.setAttribute("tabindex", i ? "0" : "-1");
125
+ });
124
126
  }
125
- let n = this.mode === "listbox";
126
- t.forEach((e, t) => {
127
- let r = this.#r(e);
128
- r !== e && e.setAttribute("role", "presentation"), r.setAttribute("role", n ? "option" : "menuitem");
129
- let i = this.#i(e);
130
- n ? r.setAttribute("aria-selected", e.classList.contains("active") ? "true" : "false") : r.removeAttribute("aria-selected"), i ? r.setAttribute("aria-disabled", "true") : r.removeAttribute("aria-disabled");
131
- let a = !n && t === this.#e && !i;
132
- r.setAttribute("tabindex", a ? "0" : "-1");
133
- });
134
127
  }
135
128
  #c;
136
129
  #l(e) {
@@ -151,7 +144,7 @@ var a = class extends t {
151
144
  return n`
152
145
  <ul
153
146
  class="dropdown-menu show"
154
- role=${this.mode}
147
+ role="menu"
155
148
  part="menu"
156
149
  aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? r}
157
150
  >
@@ -1,5 +1,4 @@
1
1
  import { MpDropdownElement } from './mp-dropdown-element';
2
- import { DropdownMode } from '../types';
3
2
  /**
4
3
  * `<mp-dropdown-menu>` — a Bootstrap `.dropdown-menu` rendered inside its shadow
5
4
  * root, with theme-aware styling that follows the page theme across the shadow
@@ -16,13 +15,13 @@ import { DropdownMode } from '../types';
16
15
  * framework wrapper ships. In Angular the classes come from the `[bsDropdownItem]`
17
16
  * / `[bsDropdownDivider]` / `[bsDropdownHeader]` attribute directives.
18
17
  *
19
- * In `menu` mode (default) the menu provides roving-tabindex keyboard navigation
20
- * (Arrow keys / Home / End) over the enabled items and assigns `role="menuitem"`
21
- * to each item's interactive control. In `listbox` mode it assigns `role="option"`
22
- * + `aria-selected` and leaves focus management to the consumer.
18
+ * The menu provides roving-tabindex keyboard navigation (Arrow keys / Home /
19
+ * End) over the enabled items and assigns `role="menuitem"` to each item's
20
+ * interactive control. It is a menu only: the former `mode="listbox"` existed
21
+ * for the typeahead alone, which now renders its own listbox from its headless
22
+ * core (#436 D10).
23
23
  *
24
24
  * Attributes:
25
- * - `mode` — `menu` (default) | `listbox`.
26
25
  * - `max-height` — px cap; maps to `--mp-dropdown-max-height` (scrolls beyond).
27
26
  * - naming: `aria-label` / `input-label`, or `aria-labelledby` on the host
28
27
  * (resolved into cross-root element references). The old `label-id` is gone —
@@ -41,8 +40,6 @@ export declare class MpDropdownMenu extends MpDropdownElement {
41
40
  #private;
42
41
  static styles: import('lit').CSSResult[];
43
42
  static get observedAttributes(): string[];
44
- get mode(): DropdownMode;
45
- set mode(v: DropdownMode);
46
43
  private _inputLabel;
47
44
  /**
48
45
  * Optional accessible name for the menu list. A menu has no intrinsic text of
@@ -1,3 +1,3 @@
1
1
  export { MpDropdownMenu } from './components';
2
- export type { DropdownItemElement, DropdownMode, DropdownSelectEventDetail } from './types';
2
+ export type { DropdownItemElement, DropdownSelectEventDetail } from './types';
3
3
  export { dropdownMenuStyles } from './styles';
@@ -1,5 +1,3 @@
1
- /** How the menu exposes itself to assistive tech (and how items are roled). */
2
- export type DropdownMode = 'menu' | 'listbox';
3
1
  /**
4
2
  * A `.dropdown-item` carrying an opaque value for the menu's `select` event.
5
3
  * Assign any value (object, string, number) to `dropdownValue`; the menu reports
@@ -1 +1 @@
1
- export type { DropdownItemElement, DropdownMode, DropdownSelectEventDetail } from './dropdown';
1
+ export type { DropdownItemElement, DropdownSelectEventDetail } from './dropdown';
@@ -1,6 +1,6 @@
1
1
  import { s as e, v as t, y as n } from "../chunks/a11y-C6aX-lsZ.mjs";
2
2
  import { adoptLightStyles as r } from "../light-dom/index.mjs";
3
- import "../chunks/datatable-qkYf-N0c.mjs";
3
+ import "../chunks/datatable-CrK1ZNq-.mjs";
4
4
  import "../chunks/splitter-ByLyrd5H.mjs";
5
5
  import "../chunks/treeview-BuznGbcj.mjs";
6
6
  import { LitElement as i, html as a, nothing as o, unsafeCSS as s } from "lit";
@@ -1,11 +1,12 @@
1
1
  import { html as e, svg as t } from "lit";
2
+ import { SCOPED_STYLE_MARKER as n, SCOPE_ATTRIBUTE as r, SCOPE_ATTRIBUTE as i, adoptLightStyles as a, getLightStyleEntries as o, installLightStyles as s, installScopedStyles as c, stampScope as l, validateScope as u, validateScope as d, writeScopedStyleTag as f } from "@mintplayer/ui-core/scoped-styles";
2
3
  //#region libs/mintplayer-web-components/light-dom/src/scoped-html.ts
3
- var n = "data-mps", r = /* @__PURE__ */ new Set([
4
+ var p = /* @__PURE__ */ new Set([
4
5
  "script",
5
6
  "style",
6
7
  "textarea",
7
8
  "title"
8
- ]), i = {
9
+ ]), m = {
9
10
  Text: 0,
10
11
  TagOpen: 1,
11
12
  MarkupDecl: 2,
@@ -20,85 +21,85 @@ var n = "data-mps", r = /* @__PURE__ */ new Set([
20
21
  Comment: 11,
21
22
  Bogus: 12,
22
23
  RawText: 13
23
- }, a = (e) => /[a-zA-Z0-9-]/.test(e), o = (e) => e === " " || e === " " || e === "\n" || e === "\r" || e === "\f";
24
- function s(e, t, n) {
25
- let s = "", c = 0, l = e.length, u = () => {
26
- !t.sawSlash && r.has(t.tagName) ? (t.state = i.RawText, t.rawMatch = 0) : t.state = i.Text, t.sawSlash = !1;
24
+ }, h = (e) => /[a-zA-Z0-9-]/.test(e), g = (e) => e === " " || e === " " || e === "\n" || e === "\r" || e === "\f";
25
+ function _(e, t, n) {
26
+ let r = "", i = 0, a = e.length, o = () => {
27
+ !t.sawSlash && p.has(t.tagName) ? (t.state = m.RawText, t.rawMatch = 0) : t.state = m.Text, t.sawSlash = !1;
27
28
  };
28
- for (; c < l;) {
29
- let r = e[c];
29
+ for (; i < a;) {
30
+ let a = e[i];
30
31
  switch (t.state) {
31
- case i.Text:
32
- r === "<" && (t.state = i.TagOpen), s += r, c++;
32
+ case m.Text:
33
+ a === "<" && (t.state = m.TagOpen), r += a, i++;
33
34
  break;
34
- case i.TagOpen:
35
- /[a-zA-Z]/.test(r) ? (t.state = i.TagName, t.tagName = r.toLowerCase()) : t.state = r === "/" ? i.Closing : r === "!" ? i.MarkupDecl : r === "?" ? i.Bogus : i.Text, s += r, c++;
35
+ case m.TagOpen:
36
+ /[a-zA-Z]/.test(a) ? (t.state = m.TagName, t.tagName = a.toLowerCase()) : t.state = a === "/" ? m.Closing : a === "!" ? m.MarkupDecl : a === "?" ? m.Bogus : m.Text, r += a, i++;
36
37
  break;
37
- case i.MarkupDecl:
38
- t.state = r === "-" ? i.CommentDash : i.Bogus, s += r, c++;
38
+ case m.MarkupDecl:
39
+ t.state = a === "-" ? m.CommentDash : m.Bogus, r += a, i++;
39
40
  break;
40
- case i.CommentDash:
41
- r === "-" ? (t.state = i.Comment, t.commentDashes = 0) : t.state = i.Bogus, s += r, c++;
41
+ case m.CommentDash:
42
+ a === "-" ? (t.state = m.Comment, t.commentDashes = 0) : t.state = m.Bogus, r += a, i++;
42
43
  break;
43
- case i.TagName:
44
- a(r) ? (t.tagName += r.toLowerCase(), s += r, c++) : (s += n, t.state = i.InTag, t.sawSlash = !1);
44
+ case m.TagName:
45
+ h(a) ? (t.tagName += a.toLowerCase(), r += a, i++) : (r += n, t.state = m.InTag, t.sawSlash = !1);
45
46
  break;
46
- case i.InTag:
47
- r === ">" ? (s += r, c++, u()) : r === "/" ? (t.sawSlash = !0, s += r, c++) : r === "=" ? (t.sawSlash = !1, t.state = i.AfterEq, s += r, c++) : r === "\"" ? (t.sawSlash = !1, t.state = i.ValueDq, s += r, c++) : r === "'" ? (t.sawSlash = !1, t.state = i.ValueSq, s += r, c++) : (o(r) || (t.sawSlash = !1), s += r, c++);
47
+ case m.InTag:
48
+ a === ">" ? (r += a, i++, o()) : a === "/" ? (t.sawSlash = !0, r += a, i++) : a === "=" ? (t.sawSlash = !1, t.state = m.AfterEq, r += a, i++) : a === "\"" ? (t.sawSlash = !1, t.state = m.ValueDq, r += a, i++) : a === "'" ? (t.sawSlash = !1, t.state = m.ValueSq, r += a, i++) : (g(a) || (t.sawSlash = !1), r += a, i++);
48
49
  break;
49
- case i.AfterEq:
50
- o(r) ? (s += r, c++) : r === "\"" ? (t.state = i.ValueDq, s += r, c++) : r === "'" ? (t.state = i.ValueSq, s += r, c++) : r === ">" ? (s += r, c++, u()) : (t.state = i.ValueUnq, s += r, c++);
50
+ case m.AfterEq:
51
+ g(a) ? (r += a, i++) : a === "\"" ? (t.state = m.ValueDq, r += a, i++) : a === "'" ? (t.state = m.ValueSq, r += a, i++) : a === ">" ? (r += a, i++, o()) : (t.state = m.ValueUnq, r += a, i++);
51
52
  break;
52
- case i.ValueDq:
53
- r === "\"" && (t.state = i.InTag), s += r, c++;
53
+ case m.ValueDq:
54
+ a === "\"" && (t.state = m.InTag), r += a, i++;
54
55
  break;
55
- case i.ValueSq:
56
- r === "'" && (t.state = i.InTag), s += r, c++;
56
+ case m.ValueSq:
57
+ a === "'" && (t.state = m.InTag), r += a, i++;
57
58
  break;
58
- case i.ValueUnq:
59
- o(r) ? (t.state = i.InTag, s += r, c++) : r === ">" ? (s += r, c++, u()) : (s += r, c++);
59
+ case m.ValueUnq:
60
+ g(a) ? (t.state = m.InTag, r += a, i++) : a === ">" ? (r += a, i++, o()) : (r += a, i++);
60
61
  break;
61
- case i.Closing:
62
- case i.Bogus:
63
- r === ">" && (t.state = i.Text), s += r, c++;
62
+ case m.Closing:
63
+ case m.Bogus:
64
+ a === ">" && (t.state = m.Text), r += a, i++;
64
65
  break;
65
- case i.Comment:
66
- r === "-" ? t.commentDashes++ : r === ">" && t.commentDashes >= 2 ? t.state = i.Text : t.commentDashes = 0, s += r, c++;
66
+ case m.Comment:
67
+ a === "-" ? t.commentDashes++ : a === ">" && t.commentDashes >= 2 ? t.state = m.Text : t.commentDashes = 0, r += a, i++;
67
68
  break;
68
- case i.RawText: {
69
+ case m.RawText: {
69
70
  let e = "</" + t.tagName;
70
- r.toLowerCase() === e[t.rawMatch] ? (t.rawMatch++, t.rawMatch === e.length && (t.state = i.Closing, t.rawMatch = 0)) : t.rawMatch = +(r === "<"), s += r, c++;
71
+ a.toLowerCase() === e[t.rawMatch] ? (t.rawMatch++, t.rawMatch === e.length && (t.state = m.Closing, t.rawMatch = 0)) : t.rawMatch = +(a === "<"), r += a, i++;
71
72
  break;
72
73
  }
73
74
  }
74
75
  }
75
- return t.state === i.TagName && (s += n, t.state = i.InTag, t.sawSlash = !1), s;
76
+ return t.state === m.TagName && (r += n, t.state = m.InTag, t.sawSlash = !1), r;
76
77
  }
77
- function c(e) {
78
- e.state === i.AfterEq && (e.state = i.ValueUnq);
78
+ function v(e) {
79
+ e.state === m.AfterEq && (e.state = m.ValueUnq);
79
80
  }
80
- function l(e) {
81
- e.state === i.ValueUnq && (e.state = i.InTag);
81
+ function y(e) {
82
+ e.state === m.ValueUnq && (e.state = m.InTag);
82
83
  }
83
- function u(e, t) {
84
- let r = ` ${n}="${t}"`, a = (e) => {
84
+ function b(e, t) {
85
+ let n = ` ${i}="${t}"`, r = (e) => {
85
86
  let t = {
86
- state: i.Text,
87
+ state: m.Text,
87
88
  tagName: "",
88
89
  commentDashes: 0,
89
90
  rawMatch: 0,
90
91
  sawSlash: !1
91
- }, n = [];
92
- for (let i = 0; i < e.length; i++) i > 0 && l(t), n.push(s(e[i], t, r)), i < e.length - 1 && c(t);
93
- return n;
94
- }, o = a(e), u = a(e.raw), d = o;
95
- return Object.defineProperty(d, "raw", { value: Object.freeze(u) }), Object.freeze(d);
92
+ }, r = [];
93
+ for (let i = 0; i < e.length; i++) i > 0 && y(t), r.push(_(e[i], t, n)), i < e.length - 1 && v(t);
94
+ return r;
95
+ }, a = r(e), o = r(e.raw), s = a;
96
+ return Object.defineProperty(s, "raw", { value: Object.freeze(o) }), Object.freeze(s);
96
97
  }
97
- var d = !0;
98
- function f(e) {
99
- e.verify !== void 0 && (d = e.verify);
98
+ var x = !0;
99
+ function S(e) {
100
+ e.verify !== void 0 && (x = e.verify);
100
101
  }
101
- function p(e, t, n) {
102
+ function C(e, t, n) {
102
103
  if (typeof document < "u") try {
103
104
  let r = (e) => {
104
105
  let t = document.createElement("template");
@@ -109,80 +110,19 @@ function p(e, t, n) {
109
110
  if (e instanceof Error && e.message.startsWith("scopedHtml(")) throw e;
110
111
  }
111
112
  }
112
- function m(e) {
113
- if (!/^[a-z][a-z0-9-]*$/.test(e)) throw Error(`scopedHtml: invalid scope ${JSON.stringify(e)} — expected a lowercase identifier (the element name without its mp- prefix)`);
114
- }
115
- function h(e, t) {
116
- m(e);
113
+ function w(e, t) {
114
+ d(e);
117
115
  let n = /* @__PURE__ */ new WeakMap();
118
116
  return (r, ...i) => {
119
117
  let a = n.get(r);
120
- return a || (a = u(r, e), d && p(r, a, e), n.set(r, a)), t(a, ...i);
121
- };
122
- }
123
- function g(t) {
124
- return h(t, e);
125
- }
126
- function _(e) {
127
- return h(e, t);
128
- }
129
- function v(e, t) {
130
- m(t);
131
- let r = e.getAttribute(n);
132
- if (r === null || r === t) {
133
- e.setAttribute(n, t);
134
- for (let n of Array.from(e.children)) v(n, t);
135
- }
136
- }
137
- //#endregion
138
- //#region libs/mintplayer-web-components/light-dom/src/install-light-styles.ts
139
- var y = Symbol.for("mp.lightStyles");
140
- function b() {
141
- let e = globalThis;
142
- return e[y] ??= {
143
- entries: /* @__PURE__ */ new Map(),
144
- listeners: /* @__PURE__ */ new Set()
118
+ return a || (a = b(r, e), x && C(r, a, e), n.set(r, a)), t(a, ...i);
145
119
  };
146
120
  }
147
- var x = "data-mp-light-styles";
148
- function S() {
149
- return typeof document < "u" && "adoptedStyleSheets" in Document.prototype && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
121
+ function T(t) {
122
+ return w(t, e);
150
123
  }
151
- function C(e, t) {
152
- if (typeof document > "u" || !document.head) return;
153
- let n = b();
154
- if (n.entries.has(e)) return;
155
- let r = typeof t == "string" ? t : t.cssText, i = {
156
- key: e,
157
- cssText: r
158
- };
159
- if (S()) {
160
- let e = typeof t == "string" ? void 0 : t.styleSheet;
161
- e ? i.sheet = e : (i.sheet = new CSSStyleSheet(), i.sheet.replaceSync(r));
162
- }
163
- if (!document.head.querySelector(`style[${x}="${e}"]`)) {
164
- if (i.sheet) document.adoptedStyleSheets = [...document.adoptedStyleSheets, i.sheet];
165
- else {
166
- let t = document.createElement("style");
167
- t.setAttribute(x, e), t.textContent = r, document.head.appendChild(t);
168
- }
169
- }
170
- n.entries.set(e, i);
171
- for (let e of n.listeners) e(i);
172
- }
173
- function w() {
174
- return [...b().entries.values()];
175
- }
176
- function T(e) {
177
- let t = (t) => {
178
- if (t.sheet) e.adoptedStyleSheets.includes(t.sheet) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t.sheet]);
179
- else if (!e.querySelector(`style[${x}="${t.key}"]`)) {
180
- let n = e.ownerDocument.createElement("style");
181
- n.setAttribute(x, t.key), n.textContent = t.cssText, e.appendChild(n);
182
- }
183
- }, n = b();
184
- for (let e of n.entries.values()) t(e);
185
- return n.listeners.add(t), () => n.listeners.delete(t);
124
+ function E(e) {
125
+ return w(e, t);
186
126
  }
187
127
  //#endregion
188
- export { T as adoptLightStyles, f as configureScopedHtml, w as getLightStyleEntries, C as installLightStyles, u as rewriteStatics, g as scopedHtml, _ as scopedSvg, v as stampScope };
128
+ export { n as SCOPED_STYLE_MARKER, r as SCOPE_ATTRIBUTE, a as adoptLightStyles, S as configureScopedHtml, o as getLightStyleEntries, s as installLightStyles, c as installScopedStyles, b as rewriteStatics, T as scopedHtml, E as scopedSvg, l as stampScope, u as validateScope, f as writeScopedStyleTag };
@@ -1,25 +1,13 @@
1
- import { CSSResult } from 'lit';
2
- export interface LightStyleEntry {
3
- key: string;
4
- cssText: string;
5
- /** Present when constructable stylesheets are supported. */
6
- sheet?: CSSStyleSheet;
7
- }
8
1
  /**
9
- * Install a light-tier component's rescoped stylesheet at document level.
10
- * Idempotent per `key`, cross-bundle safe, no-op during SSR. Call it right
11
- * before `customElements.define`, so styles precede the first render.
2
+ * The registry moved to `@mintplayer/ui-core/scoped-styles` (#436 D8) so the
3
+ * Angular, React and Vue fronts install the same sheets through the same
4
+ * mechanism. This entry re-exports it unchanged for the light-tier elements.
12
5
  *
13
- * A `<style data-mp-light-styles="<key>">` already present in `<head>` (an
14
- * SSR-emitted copy) counts as installed — only the registry entry is added,
15
- * so shadow adopters still get a sheet.
6
+ * The names are listed, not `export *`: ui-core is external to this build, so
7
+ * Rolldown cannot see what a star re-export contains. A chunk importing
8
+ * `installLightStyles` from this entry was compiled to a lookup on a namespace
9
+ * object that holds only the local exports, and threw at load
10
+ * ("installLightStyles is not a function") for every consumer of the dist.
16
11
  */
17
- export declare function installLightStyles(key: string, styles: CSSResult | string): void;
18
- /** Snapshot of everything installed so far. */
19
- export declare function getLightStyleEntries(): LightStyleEntry[];
20
- /**
21
- * Mirror all light-tier sheets — current and future — into a shadow root, so
22
- * consumer DOM adopted into it (render callbacks) keeps its light-tier
23
- * styling. Returns a disposer; call it from `disconnectedCallback`.
24
- */
25
- export declare function adoptLightStyles(root: ShadowRoot): () => void;
12
+ export { SCOPED_STYLE_MARKER, SCOPE_ATTRIBUTE, adoptLightStyles, getLightStyleEntries, installLightStyles, installScopedStyles, stampScope, validateScope, writeScopedStyleTag, } from '@mintplayer/ui-core/scoped-styles';
13
+ export type { LightStyleEntry, ScopedStyleSource } from '@mintplayer/ui-core/scoped-styles';
@@ -17,10 +17,4 @@ type TemplateTag = (strings: TemplateStringsArray, ...values: unknown[]) => Temp
17
17
  export declare function scopedHtml(scope: string): TemplateTag;
18
18
  /** The `svg` twin (data-* attributes are valid on SVG elements). */
19
19
  export declare function scopedSvg(scope: string): TemplateTag;
20
- /**
21
- * Imperatively stamp a DOM subtree with a scope — for DOM the rewriter can't
22
- * see (`unsafeHTML` output, `document.createElement`, an overlay panel built
23
- * by hand). Skips subtrees that already belong to another scope.
24
- */
25
- export declare function stampScope(root: Element, scope: string): void;
26
20
  export {};
@@ -0,0 +1 @@
1
+ export * from './src';
@@ -0,0 +1,47 @@
1
+ import { noChange as e } from "lit";
2
+ import { Directive as t, PartType as n, directive as r } from "lit/directive.js";
3
+ //#region libs/mintplayer-web-components/machine/src/machine-controller.ts
4
+ var i = class {
5
+ #e = null;
6
+ constructor(e, t, n = !0) {
7
+ this.host = e, this.machine = t, this.ownsMachine = n, e.addController(this);
8
+ }
9
+ get state() {
10
+ return this.machine.snapshot;
11
+ }
12
+ hostConnected() {
13
+ this.#e ??= this.machine.subscribe(() => this.host.requestUpdate()), this.host.requestUpdate();
14
+ }
15
+ hostDisconnected() {
16
+ this.#e?.(), this.#e = null;
17
+ }
18
+ dispose() {
19
+ this.hostDisconnected(), this.ownsMachine && this.machine.destroy();
20
+ }
21
+ }, a = /* @__PURE__ */ new Set([
22
+ "href",
23
+ "src",
24
+ "srcdoc",
25
+ "xlink:href",
26
+ "style",
27
+ "action",
28
+ "formaction",
29
+ "data"
30
+ ]), o = r(class extends t {
31
+ #e = {};
32
+ constructor(e) {
33
+ if (super(e), e.type !== n.ELEMENT) throw Error("props() must be used in element position");
34
+ }
35
+ render(t) {
36
+ return e;
37
+ }
38
+ update(t, [n]) {
39
+ let r = t.element, i = (e) => e == null || e === !1;
40
+ 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]) => {
41
+ if (a.has(e) || e.startsWith("on")) throw Error(`props() refuses to set "${e}"`);
42
+ return !0;
43
+ }).filter(([e, t]) => !Object.is(this.#e[e], t)).forEach(([e, t]) => r.setAttribute(e, t === !0 ? "" : String(t))), this.#e = { ...n }, e;
44
+ }
45
+ });
46
+ //#endregion
47
+ export { i as MachineController, o as props };
@@ -0,0 +1,2 @@
1
+ export * from './machine-controller';
2
+ export * from './props-directive';
@@ -0,0 +1,25 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import { Machine } from '@mintplayer/ui-core/store';
3
+ /**
4
+ * Bridge a `@mintplayer/ui-core` machine into a Lit element: every committed
5
+ * snapshot requests one host update (Lit coalesces per microtask), the
6
+ * subscription follows the host's connected state, and the machine is
7
+ * destroyed with the host unless `ownsMachine` is false.
8
+ *
9
+ * The element reads `controller.state` in `render()`; it is always the
10
+ * machine's current snapshot (spike S1, `machine-controller.spec.ts`).
11
+ */
12
+ export declare class MachineController<M extends Machine<S>, S extends object> implements ReactiveController {
13
+ #private;
14
+ private readonly host;
15
+ readonly machine: M;
16
+ private readonly ownsMachine;
17
+ constructor(host: ReactiveControllerHost & {
18
+ isConnected: boolean;
19
+ }, machine: M, ownsMachine?: boolean);
20
+ get state(): S;
21
+ hostConnected(): void;
22
+ hostDisconnected(): void;
23
+ /** Called by the host when it is torn down for good (not merely moved in the DOM). */
24
+ dispose(): void;
25
+ }
@@ -0,0 +1,21 @@
1
+ import { noChange } from 'lit';
2
+ import { Directive, ElementPart, PartInfo } from 'lit/directive.js';
3
+ /** An attribute bag as a `@mintplayer/ui-core` `connect()` returns it. */
4
+ export type AttrBag = Record<string, string | boolean | null | undefined>;
5
+ /**
6
+ * Apply a core's attribute bag to the element it sits on — Lit's stand-in for
7
+ * JSX/Vue attribute spread, and the twin of Angular's `[mpProps]`. Diffs the
8
+ * previous bag: a key that disappears (or becomes null/false) is removed, so a
9
+ * stale `aria-activedescendant` never survives a close. URL- and
10
+ * script-bearing names are refused, as in the Angular directive.
11
+ *
12
+ * html`<input ${props(api.input)}>`
13
+ */
14
+ declare class PropsDirective extends Directive {
15
+ #private;
16
+ constructor(partInfo: PartInfo);
17
+ render(_bag: AttrBag): typeof noChange;
18
+ update(part: ElementPart, [bag]: [AttrBag]): typeof noChange;
19
+ }
20
+ export declare const props: (_bag: AttrBag) => import('lit-html/directive.js').DirectiveResult<typeof PropsDirective>;
21
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/web-components",
3
- "version": "2.20.0",
3
+ "version": "3.0.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": {
@@ -107,6 +107,10 @@
107
107
  "types": "./light-dom/index.d.ts",
108
108
  "import": "./light-dom/index.mjs"
109
109
  },
110
+ "./machine": {
111
+ "types": "./machine/index.d.ts",
112
+ "import": "./machine/index.mjs"
113
+ },
110
114
  "./multi-range": {
111
115
  "types": "./multi-range/index.d.ts",
112
116
  "import": "./multi-range/index.mjs"
@@ -214,6 +218,10 @@
214
218
  "./treeview": {
215
219
  "types": "./treeview/index.d.ts",
216
220
  "import": "./treeview/index.mjs"
221
+ },
222
+ "./typeahead": {
223
+ "types": "./typeahead/index.d.ts",
224
+ "import": "./typeahead/index.mjs"
217
225
  }
218
226
  },
219
227
  "peerDependencies": {
@@ -227,6 +235,7 @@
227
235
  }
228
236
  },
229
237
  "dependencies": {
238
+ "@mintplayer/ui-core": "^1.1.0",
230
239
  "tslib": "^2.3.0",
231
240
  "intl-tel-input": "^29.1.2",
232
241
  "libphonenumber-js": "^1.13.10"
@@ -1 +1 @@
1
- export { t as MpPagination, n as buildPaginationLayout } from "../chunks/pagination-Bcz1TwlS.mjs";
1
+ export { t as MpPagination, n as buildPaginationLayout } from "../chunks/pagination-DgDp3v3u.mjs";