@mintplayer/web-components 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/badge/src/styles/badge.styles.d.ts +2 -0
- package/chunks/install-light-styles-DbCAGFOC.mjs +209 -0
- package/chunks/{mp-datatable-GmKqaN8y.mjs → mp-datatable-UJI8E73X.mjs} +484 -476
- package/chunks/{mp-treeview-tkWu28iF.mjs → mp-treeview-C8iltDbq.mjs} +61 -63
- package/datatable/index.mjs +2 -2
- package/datatable/src/components/mp-datatable.d.ts +9 -1
- package/datatable/src/index.d.ts +1 -1
- package/datatable/src/styles/datatable.light.styles.d.ts +2 -0
- package/datatable/src/styles/index.d.ts +1 -1
- package/dock/index.mjs +477 -492
- package/dock/src/components/mint-dock-manager.element.d.ts +10 -8
- package/dock/src/core/index.d.ts +1 -0
- package/dock/src/core/intersection-sizing.d.ts +83 -0
- package/dock/src/core/layout-tree.d.ts +23 -2
- package/dock/src/core/types.d.ts +14 -0
- package/file-manager/index.mjs +30 -29
- package/file-manager/src/components/mp-file-manager.d.ts +2 -0
- package/light-dom/index.d.ts +1 -0
- package/light-dom/index.mjs +11 -0
- package/light-dom/src/index.d.ts +2 -0
- package/light-dom/src/install-light-styles.d.ts +25 -0
- package/light-dom/src/scoped-html.d.ts +26 -0
- package/package.json +5 -1
- package/query-builder/index.mjs +1472 -2651
- package/query-builder/src/index.d.ts +4 -0
- package/query-builder/src/mp-query-builder.element.d.ts +1 -1
- package/query-builder/src/mp-query-builder.light.styles.d.ts +2 -0
- package/query-builder/src/mp-query-condition.element.d.ts +1 -1
- package/query-builder/src/mp-query-condition.light.styles.d.ts +2 -0
- package/query-builder/src/mp-query-group.element.d.ts +1 -1
- package/query-builder/src/mp-query-group.light.styles.d.ts +2 -0
- package/query-builder/src/mp-query-subquery.element.d.ts +1 -1
- package/query-builder/src/mp-query-subquery.light.styles.d.ts +2 -0
- package/tree-select/index.mjs +60 -58
- package/tree-select/src/components/mp-tree-select.d.ts +1 -1
- package/tree-select/src/index.d.ts +1 -1
- package/tree-select/src/styles/index.d.ts +1 -1
- package/tree-select/src/styles/tree-select.light.styles.d.ts +2 -0
- package/treeview/index.mjs +3 -3
- package/treeview/src/components/mp-treeview.d.ts +1 -1
- package/treeview/src/index.d.ts +1 -1
- package/treeview/src/styles/index.d.ts +1 -1
- package/treeview/src/styles/treeview.light.styles.d.ts +2 -0
package/README.md
CHANGED
|
@@ -9,3 +9,18 @@ Run `nx build mintplayer-web-components` to build the library.
|
|
|
9
9
|
## Running unit tests
|
|
10
10
|
|
|
11
11
|
Run `nx test mintplayer-web-components` to execute the unit tests via [Vitest](https://vitest.dev/).
|
|
12
|
+
|
|
13
|
+
## Styling and encapsulation
|
|
14
|
+
|
|
15
|
+
Most components keep a shadow root and take your content through native slots, so your stylesheets
|
|
16
|
+
reach that content normally.
|
|
17
|
+
|
|
18
|
+
``<mp-datatable>`, `<mp-treeview>`, `<mp-tree-select>` and the `<mp-query-builder>` family` mount DOM you author (row / node templates, cell renderers,
|
|
19
|
+
editor factories) and therefore render in the **light DOM**, with their own CSS scoped at build time
|
|
20
|
+
onto a `data-mps` attribute — the same device Angular uses for `_ngcontent`. Your styles and
|
|
21
|
+
Bootstrap's utilities reach anything you render into them; in exchange, page CSS also reaches their
|
|
22
|
+
internals, exactly as emulated encapsulation behaves elsewhere. `::part()` and `::slotted()` no
|
|
23
|
+
longer address them.
|
|
24
|
+
|
|
25
|
+
See **Styling and encapsulation** in the [workspace README](../../README.md) for the full contract
|
|
26
|
+
and the migration table.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { svg as y, html as T } from "lit";
|
|
2
|
+
const m = "data-mps", b = /* @__PURE__ */ new Set(["script", "style", "textarea", "title"]), n = {
|
|
3
|
+
Text: 0,
|
|
4
|
+
/** Saw `<`; the next char decides tag / closing / comment / bogus. */
|
|
5
|
+
TagOpen: 1,
|
|
6
|
+
/** Saw `<!`. */
|
|
7
|
+
MarkupDecl: 2,
|
|
8
|
+
/** Saw `<!-`. */
|
|
9
|
+
CommentDash: 3,
|
|
10
|
+
/** Inside a tag name (insertion happens when this state exits). */
|
|
11
|
+
TagName: 4,
|
|
12
|
+
/** Inside an open tag's attribute area. */
|
|
13
|
+
InTag: 5,
|
|
14
|
+
/** Saw `=` after an attribute name; the value follows (or is a binding). */
|
|
15
|
+
AfterEq: 6,
|
|
16
|
+
ValueDq: 7,
|
|
17
|
+
ValueSq: 8,
|
|
18
|
+
ValueUnq: 9,
|
|
19
|
+
/** Inside `</...>`. */
|
|
20
|
+
Closing: 10,
|
|
21
|
+
/** Inside `<!-- ... -->`. */
|
|
22
|
+
Comment: 11,
|
|
23
|
+
/** Inside `<!...>` / `<?...>`. */
|
|
24
|
+
Bogus: 12,
|
|
25
|
+
/** Inside a raw-text element's content. */
|
|
26
|
+
RawText: 13
|
|
27
|
+
}, C = (a) => /[a-zA-Z0-9-]/.test(a), h = (a) => a === " " || a === " " || a === `
|
|
28
|
+
` || a === "\r" || a === "\f";
|
|
29
|
+
function E(a, e, i) {
|
|
30
|
+
let s = "", r = 0;
|
|
31
|
+
const o = a.length, l = () => {
|
|
32
|
+
!e.sawSlash && b.has(e.tagName) ? (e.state = n.RawText, e.rawMatch = 0) : e.state = n.Text, e.sawSlash = !1;
|
|
33
|
+
};
|
|
34
|
+
for (; r < o; ) {
|
|
35
|
+
const t = a[r];
|
|
36
|
+
switch (e.state) {
|
|
37
|
+
case n.Text:
|
|
38
|
+
t === "<" && (e.state = n.TagOpen), s += t, r++;
|
|
39
|
+
break;
|
|
40
|
+
case n.TagOpen:
|
|
41
|
+
/[a-zA-Z]/.test(t) ? (e.state = n.TagName, e.tagName = t.toLowerCase()) : t === "/" ? e.state = n.Closing : t === "!" ? e.state = n.MarkupDecl : t === "?" ? e.state = n.Bogus : e.state = n.Text, s += t, r++;
|
|
42
|
+
break;
|
|
43
|
+
case n.MarkupDecl:
|
|
44
|
+
e.state = t === "-" ? n.CommentDash : n.Bogus, s += t, r++;
|
|
45
|
+
break;
|
|
46
|
+
case n.CommentDash:
|
|
47
|
+
t === "-" ? (e.state = n.Comment, e.commentDashes = 0) : e.state = n.Bogus, s += t, r++;
|
|
48
|
+
break;
|
|
49
|
+
case n.TagName:
|
|
50
|
+
C(t) ? (e.tagName += t.toLowerCase(), s += t, r++) : (s += i, e.state = n.InTag, e.sawSlash = !1);
|
|
51
|
+
break;
|
|
52
|
+
case n.InTag:
|
|
53
|
+
t === ">" ? (s += t, r++, l()) : t === "/" ? (e.sawSlash = !0, s += t, r++) : t === "=" ? (e.sawSlash = !1, e.state = n.AfterEq, s += t, r++) : t === '"' ? (e.sawSlash = !1, e.state = n.ValueDq, s += t, r++) : t === "'" ? (e.sawSlash = !1, e.state = n.ValueSq, s += t, r++) : (h(t) || (e.sawSlash = !1), s += t, r++);
|
|
54
|
+
break;
|
|
55
|
+
case n.AfterEq:
|
|
56
|
+
h(t) ? (s += t, r++) : t === '"' ? (e.state = n.ValueDq, s += t, r++) : t === "'" ? (e.state = n.ValueSq, s += t, r++) : t === ">" ? (s += t, r++, l()) : (e.state = n.ValueUnq, s += t, r++);
|
|
57
|
+
break;
|
|
58
|
+
case n.ValueDq:
|
|
59
|
+
t === '"' && (e.state = n.InTag), s += t, r++;
|
|
60
|
+
break;
|
|
61
|
+
case n.ValueSq:
|
|
62
|
+
t === "'" && (e.state = n.InTag), s += t, r++;
|
|
63
|
+
break;
|
|
64
|
+
case n.ValueUnq:
|
|
65
|
+
h(t) ? (e.state = n.InTag, s += t, r++) : t === ">" ? (s += t, r++, l()) : (s += t, r++);
|
|
66
|
+
break;
|
|
67
|
+
case n.Closing:
|
|
68
|
+
case n.Bogus:
|
|
69
|
+
t === ">" && (e.state = n.Text), s += t, r++;
|
|
70
|
+
break;
|
|
71
|
+
case n.Comment:
|
|
72
|
+
t === "-" ? e.commentDashes++ : t === ">" && e.commentDashes >= 2 ? e.state = n.Text : e.commentDashes = 0, s += t, r++;
|
|
73
|
+
break;
|
|
74
|
+
case n.RawText: {
|
|
75
|
+
const c = "</" + e.tagName;
|
|
76
|
+
t.toLowerCase() === c[e.rawMatch] ? (e.rawMatch++, e.rawMatch === c.length && (e.state = n.Closing, e.rawMatch = 0)) : e.rawMatch = t === "<" ? 1 : 0, s += t, r++;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return e.state === n.TagName && (s += i, e.state = n.InTag, e.sawSlash = !1), s;
|
|
82
|
+
}
|
|
83
|
+
function x(a) {
|
|
84
|
+
a.state === n.AfterEq && (a.state = n.ValueUnq);
|
|
85
|
+
}
|
|
86
|
+
function q(a) {
|
|
87
|
+
a.state === n.ValueUnq && (a.state = n.InTag);
|
|
88
|
+
}
|
|
89
|
+
function k(a, e) {
|
|
90
|
+
const i = ` ${m}="${e}"`, s = (t) => {
|
|
91
|
+
const c = {
|
|
92
|
+
state: n.Text,
|
|
93
|
+
tagName: "",
|
|
94
|
+
commentDashes: 0,
|
|
95
|
+
rawMatch: 0,
|
|
96
|
+
sawSlash: !1
|
|
97
|
+
}, d = [];
|
|
98
|
+
for (let f = 0; f < t.length; f++)
|
|
99
|
+
f > 0 && q(c), d.push(E(t[f], c, i)), f < t.length - 1 && x(c);
|
|
100
|
+
return d;
|
|
101
|
+
}, r = s(a), o = s(a.raw), l = r;
|
|
102
|
+
return Object.defineProperty(l, "raw", { value: Object.freeze(o) }), Object.freeze(l);
|
|
103
|
+
}
|
|
104
|
+
let g = !0;
|
|
105
|
+
function R(a) {
|
|
106
|
+
a.verify !== void 0 && (g = a.verify);
|
|
107
|
+
}
|
|
108
|
+
function A(a, e, i) {
|
|
109
|
+
if (!(typeof document > "u"))
|
|
110
|
+
try {
|
|
111
|
+
const s = (l) => {
|
|
112
|
+
const t = document.createElement("template");
|
|
113
|
+
return t.innerHTML = l.join("x"), t.content.querySelectorAll("*").length;
|
|
114
|
+
}, r = s(a), o = s(e);
|
|
115
|
+
if (r !== o)
|
|
116
|
+
throw new Error(
|
|
117
|
+
`scopedHtml('${i}'): rewrite changed the template's structure (${r} -> ${o} elements). Template statics: ` + JSON.stringify(Array.from(a))
|
|
118
|
+
);
|
|
119
|
+
} catch (s) {
|
|
120
|
+
if (s instanceof Error && s.message.startsWith("scopedHtml(")) throw s;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function p(a) {
|
|
124
|
+
if (!/^[a-z][a-z0-9-]*$/.test(a))
|
|
125
|
+
throw new Error(
|
|
126
|
+
`scopedHtml: invalid scope ${JSON.stringify(a)} — expected a lowercase identifier (the element name without its mp- prefix)`
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function w(a, e) {
|
|
130
|
+
p(a);
|
|
131
|
+
const i = /* @__PURE__ */ new WeakMap();
|
|
132
|
+
return (s, ...r) => {
|
|
133
|
+
let o = i.get(s);
|
|
134
|
+
return o || (o = k(s, a), g && A(s, o, a), i.set(s, o)), e(o, ...r);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function V(a) {
|
|
138
|
+
return w(a, T);
|
|
139
|
+
}
|
|
140
|
+
function I(a) {
|
|
141
|
+
return w(a, y);
|
|
142
|
+
}
|
|
143
|
+
function D(a, e) {
|
|
144
|
+
p(e);
|
|
145
|
+
const i = a.getAttribute(m);
|
|
146
|
+
if (!(i !== null && i !== e)) {
|
|
147
|
+
a.setAttribute(m, e);
|
|
148
|
+
for (const s of Array.from(a.children))
|
|
149
|
+
D(s, e);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const M = Symbol.for("mp.lightStyles");
|
|
153
|
+
function S() {
|
|
154
|
+
const a = globalThis;
|
|
155
|
+
return a[M] ??= {
|
|
156
|
+
entries: /* @__PURE__ */ new Map(),
|
|
157
|
+
listeners: /* @__PURE__ */ new Set()
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const u = "data-mp-light-styles";
|
|
161
|
+
function v() {
|
|
162
|
+
return typeof document < "u" && "adoptedStyleSheets" in Document.prototype && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
|
|
163
|
+
}
|
|
164
|
+
function O(a, e) {
|
|
165
|
+
if (typeof document > "u" || !document.head) return;
|
|
166
|
+
const i = S();
|
|
167
|
+
if (i.entries.has(a)) return;
|
|
168
|
+
const s = typeof e == "string" ? e : e.cssText, r = { key: a, cssText: s };
|
|
169
|
+
if (v()) {
|
|
170
|
+
const l = typeof e == "string" ? void 0 : e.styleSheet;
|
|
171
|
+
l ? r.sheet = l : (r.sheet = new CSSStyleSheet(), r.sheet.replaceSync(s));
|
|
172
|
+
}
|
|
173
|
+
if (!document.head.querySelector(
|
|
174
|
+
`style[${u}="${a}"]`
|
|
175
|
+
))
|
|
176
|
+
if (r.sheet)
|
|
177
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, r.sheet];
|
|
178
|
+
else {
|
|
179
|
+
const l = document.createElement("style");
|
|
180
|
+
l.setAttribute(u, a), l.textContent = s, document.head.appendChild(l);
|
|
181
|
+
}
|
|
182
|
+
i.entries.set(a, r);
|
|
183
|
+
for (const l of i.listeners) l(r);
|
|
184
|
+
}
|
|
185
|
+
function $() {
|
|
186
|
+
return [...S().entries.values()];
|
|
187
|
+
}
|
|
188
|
+
function L(a) {
|
|
189
|
+
const e = (s) => {
|
|
190
|
+
if (s.sheet)
|
|
191
|
+
a.adoptedStyleSheets.includes(s.sheet) || (a.adoptedStyleSheets = [...a.adoptedStyleSheets, s.sheet]);
|
|
192
|
+
else if (!a.querySelector(`style[${u}="${s.key}"]`)) {
|
|
193
|
+
const r = a.ownerDocument.createElement("style");
|
|
194
|
+
r.setAttribute(u, s.key), r.textContent = s.cssText, a.appendChild(r);
|
|
195
|
+
}
|
|
196
|
+
}, i = S();
|
|
197
|
+
for (const s of i.entries.values()) e(s);
|
|
198
|
+
return i.listeners.add(e), () => i.listeners.delete(e);
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
L as a,
|
|
202
|
+
I as b,
|
|
203
|
+
R as c,
|
|
204
|
+
D as d,
|
|
205
|
+
$ as g,
|
|
206
|
+
O as i,
|
|
207
|
+
k as r,
|
|
208
|
+
V as s
|
|
209
|
+
};
|