@mintplayer/web-components 2.13.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-splitter-LszuRDbR.mjs → mp-splitter-Ckn1kN4v.mjs} +33 -19
- 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 +917 -921
- package/dock/src/components/mint-dock-manager.element.d.ts +16 -42
- package/dock/src/core/geometry.d.ts +36 -0
- package/dock/src/core/index.d.ts +6 -0
- package/dock/src/core/intersection-sizing.d.ts +83 -0
- package/dock/src/core/layout-tree.d.ts +105 -0
- package/dock/src/core/resize.d.ts +83 -0
- package/dock/src/core/sizes.d.ts +31 -0
- package/dock/src/core/types.d.ts +58 -0
- package/file-manager/index.mjs +31 -30
- 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/navbar/index.mjs +71 -44
- package/navbar/src/components/mp-navbar.d.ts +17 -1
- 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/ribbon/index.mjs +7 -3
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +11 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/state/splitter-state.d.ts +9 -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/file-manager/index.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { unsafeCSS as g, LitElement as _, html as d, nothing as c } from "lit";
|
|
2
|
+
import { a as v } from "../chunks/install-light-styles-DbCAGFOC.mjs";
|
|
2
3
|
import { L as m } from "../chunks/live-announcer-Bi0orG4n.mjs";
|
|
3
|
-
import { d as
|
|
4
|
-
import { R as
|
|
5
|
-
import { repeat as
|
|
4
|
+
import { d as w } from "../chunks/focus-restore-DxuP1Oe2.mjs";
|
|
5
|
+
import { R as y } from "../chunks/roving-focus-CrL9982a.mjs";
|
|
6
|
+
import { repeat as $ } from "lit/directives/repeat.js";
|
|
6
7
|
import { unsafeHTML as u } from "lit/directives/unsafe-html.js";
|
|
7
|
-
import { createRef as
|
|
8
|
-
import { styleMap as
|
|
9
|
-
import "../chunks/mp-splitter-
|
|
10
|
-
import "../chunks/mp-treeview-
|
|
11
|
-
import "../chunks/mp-datatable-
|
|
12
|
-
const
|
|
8
|
+
import { createRef as x, ref as C } from "lit/directives/ref.js";
|
|
9
|
+
import { styleMap as k } from "lit/directives/style-map.js";
|
|
10
|
+
import "../chunks/mp-splitter-Ckn1kN4v.mjs";
|
|
11
|
+
import "../chunks/mp-treeview-C8iltDbq.mjs";
|
|
12
|
+
import "../chunks/mp-datatable-UJI8E73X.mjs";
|
|
13
|
+
const E = g(`:host {
|
|
13
14
|
display: flex;
|
|
14
15
|
flex-direction: column;
|
|
15
16
|
width: 100%;
|
|
@@ -371,14 +372,14 @@ mp-datatable {
|
|
|
371
372
|
ariaFileList: "Files and folders",
|
|
372
373
|
ariaFileManager: "File manager"
|
|
373
374
|
};
|
|
374
|
-
function
|
|
375
|
+
function T(a) {
|
|
375
376
|
return a ? { ...p, ...a } : p;
|
|
376
377
|
}
|
|
377
|
-
let
|
|
378
|
-
const f = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H2.454l-.913-3.13a.5.5 0 0 1 .013-.087.5.5 0 0 1-.014-.913zM13.81 4H2.19l-.572 6 1.193 4 11.078-2.5L15.81 5.66A1 1 0 0 0 14.81 4z"/></svg>',
|
|
379
|
-
class
|
|
378
|
+
let M = 0;
|
|
379
|
+
const f = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181L15.546 8H2.454l-.913-3.13a.5.5 0 0 1 .013-.087.5.5 0 0 1-.014-.913zM13.81 4H2.19l-.572 6 1.193 4 11.078-2.5L15.81 5.66A1 1 0 0 0 14.81 4z"/></svg>', F = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5L14 4.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5h-2z"/></svg>', I = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/></svg>', S = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5v-3zm8 0A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5v-3zm-8 8A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5v-3zm8 0A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5v-3z"/></svg>';
|
|
380
|
+
class R extends _ {
|
|
380
381
|
constructor() {
|
|
381
|
-
super(...arguments), this.instanceId = `mp-file-manager-${++
|
|
382
|
+
super(...arguments), this.instanceId = `mp-file-manager-${++M}`, this._nodes = [], this._rootFolderId = null, this._currentFolderId = null, this._allowUpload = !1, this._allowOperations = !0, this._viewMode = "list", this._selectionMode = "multiple", this._searchPlaceholder = "", this._messages = p, this._selection = /* @__PURE__ */ new Set(), this._expandedTreeIds = /* @__PURE__ */ new Set(), this._clipboard = null, this._searchQuery = "", this._searchAnnounceTimer = null, this._iconFocusId = null, this.liveAnnouncer = new m(this), this.alertAnnouncer = new m(this, { politeness: "assertive" }), this._renameTarget = null, this._renameInputRef = x(), this._dragDepth = 0, this._contextMenu = null, this._isTouchMode = !1, this._touchHoldTimer = null, this._touchHoldTarget = null, this._pendingOps = /* @__PURE__ */ new Map(), this._uploads = [], this._loadedFolders = /* @__PURE__ */ new Set(), this.onTouchStart = (e) => {
|
|
382
383
|
if (e.touches.length !== 1) return;
|
|
383
384
|
const t = e.touches[0], n = (e.composedPath().find(
|
|
384
385
|
(s) => s instanceof HTMLElement && s.hasAttribute("data-node-id")
|
|
@@ -400,7 +401,7 @@ class S extends _ {
|
|
|
400
401
|
const t = Array.from(e.files ?? []);
|
|
401
402
|
t.length > 0 && this.handleFiles(t), e.remove();
|
|
402
403
|
}), document.body.appendChild(e), e.click();
|
|
403
|
-
}, this._contextMenuReturnTarget = null, this.contextMenuRoving = new
|
|
404
|
+
}, this._contextMenuReturnTarget = null, this.contextMenuRoving = new y({
|
|
404
405
|
items: () => Array.from(this.renderRoot?.querySelectorAll(".context-menu .menu-item:not([disabled])") ?? []),
|
|
405
406
|
orientation: "vertical",
|
|
406
407
|
wrap: !0
|
|
@@ -541,7 +542,7 @@ class S extends _ {
|
|
|
541
542
|
};
|
|
542
543
|
}
|
|
543
544
|
static {
|
|
544
|
-
this.styles = [
|
|
545
|
+
this.styles = [E];
|
|
545
546
|
}
|
|
546
547
|
static get observedAttributes() {
|
|
547
548
|
return [
|
|
@@ -617,7 +618,7 @@ class S extends _ {
|
|
|
617
618
|
return this._messages;
|
|
618
619
|
}
|
|
619
620
|
set messages(e) {
|
|
620
|
-
this._messages =
|
|
621
|
+
this._messages = T(e), this.hasAttribute("aria-label") && this.setAttribute("aria-label", this._messages.ariaFileManager), this.requestUpdate();
|
|
621
622
|
}
|
|
622
623
|
/**
|
|
623
624
|
* Replacement for `window.confirm` / `window.prompt`. When unset, falls
|
|
@@ -723,7 +724,7 @@ class S extends _ {
|
|
|
723
724
|
}
|
|
724
725
|
}
|
|
725
726
|
connectedCallback() {
|
|
726
|
-
if (super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "region"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", this._messages.ariaFileManager), typeof window < "u" && typeof window.matchMedia == "function")
|
|
727
|
+
if (super.connectedCallback(), this.renderRoot instanceof ShadowRoot && (this._releaseLightStyles?.(), this._releaseLightStyles = v(this.renderRoot)), this.hasAttribute("role") || this.setAttribute("role", "region"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", this._messages.ariaFileManager), typeof window < "u" && typeof window.matchMedia == "function")
|
|
727
728
|
try {
|
|
728
729
|
this._isTouchMode = window.matchMedia("(pointer: coarse)").matches;
|
|
729
730
|
} catch {
|
|
@@ -732,7 +733,7 @@ class S extends _ {
|
|
|
732
733
|
this.addEventListener("touchstart", this.onTouchStart, { passive: !1 }), this.addEventListener("touchend", this.onTouchEnd), this.addEventListener("touchcancel", this.onTouchEnd), this.addEventListener("touchmove", this.onTouchMove);
|
|
733
734
|
}
|
|
734
735
|
disconnectedCallback() {
|
|
735
|
-
super.disconnectedCallback(), this.removeEventListener("touchstart", this.onTouchStart), this.removeEventListener("touchend", this.onTouchEnd), this.removeEventListener("touchcancel", this.onTouchEnd), this.removeEventListener("touchmove", this.onTouchMove), this._touchHoldTimer && (clearTimeout(this._touchHoldTimer), this._touchHoldTimer = null);
|
|
736
|
+
super.disconnectedCallback(), this._releaseLightStyles?.(), this._releaseLightStyles = void 0, this.removeEventListener("touchstart", this.onTouchStart), this.removeEventListener("touchend", this.onTouchEnd), this.removeEventListener("touchcancel", this.onTouchEnd), this.removeEventListener("touchmove", this.onTouchMove), this._touchHoldTimer && (clearTimeout(this._touchHoldTimer), this._touchHoldTimer = null);
|
|
736
737
|
}
|
|
737
738
|
// ─── Operation flags helper ─────────────────────────────────────────────
|
|
738
739
|
/**
|
|
@@ -868,7 +869,7 @@ class S extends _ {
|
|
|
868
869
|
class="context-menu"
|
|
869
870
|
role="menu"
|
|
870
871
|
aria-label=${this._messages.ariaFileOperations}
|
|
871
|
-
style=${
|
|
872
|
+
style=${k({ left: `${e.x}px`, top: `${e.y}px` })}
|
|
872
873
|
@click=${(o) => o.stopPropagation()}
|
|
873
874
|
@keydown=${this.onContextMenuKeydown}
|
|
874
875
|
>
|
|
@@ -897,7 +898,7 @@ class S extends _ {
|
|
|
897
898
|
}
|
|
898
899
|
openContextMenu(e, t, i) {
|
|
899
900
|
if (this._allowOperations === !1) return;
|
|
900
|
-
const n =
|
|
901
|
+
const n = w();
|
|
901
902
|
this._contextMenuReturnTarget = n instanceof HTMLElement && n !== n.ownerDocument.body ? n : null, this._contextMenu = { x: t, y: i, targetId: e }, this.requestUpdate(), this.updateComplete.then(() => {
|
|
902
903
|
this.contextMenuRoving.sync(), this.contextMenuRoving.moveTo(0);
|
|
903
904
|
const o = (r) => {
|
|
@@ -965,14 +966,14 @@ class S extends _ {
|
|
|
965
966
|
@click=${() => this.setViewMode("list")}
|
|
966
967
|
aria-label=${e.listView}
|
|
967
968
|
aria-pressed=${this._viewMode === "list"}
|
|
968
|
-
>${u(
|
|
969
|
+
>${u(I)}</button>
|
|
969
970
|
<button
|
|
970
971
|
type="button"
|
|
971
972
|
data-active=${this._viewMode === "icons" ? "true" : "false"}
|
|
972
973
|
@click=${() => this.setViewMode("icons")}
|
|
973
974
|
aria-label=${e.iconsView}
|
|
974
975
|
aria-pressed=${this._viewMode === "icons"}
|
|
975
|
-
>${u(
|
|
976
|
+
>${u(S)}</button>
|
|
976
977
|
</div>
|
|
977
978
|
</div>
|
|
978
979
|
`;
|
|
@@ -1059,7 +1060,7 @@ class S extends _ {
|
|
|
1059
1060
|
<span class="row-cell">
|
|
1060
1061
|
<span class="row-icon" aria-hidden="true">${t ? u(t) : c}</span>
|
|
1061
1062
|
<input
|
|
1062
|
-
${
|
|
1063
|
+
${C(this._renameInputRef)}
|
|
1063
1064
|
type="text"
|
|
1064
1065
|
class="rename-input"
|
|
1065
1066
|
.value=${e.name}
|
|
@@ -1084,7 +1085,7 @@ class S extends _ {
|
|
|
1084
1085
|
renderIconGridView(e) {
|
|
1085
1086
|
return d`
|
|
1086
1087
|
<div class="icon-grid" role="listbox" aria-multiselectable="true" aria-label=${this._messages.ariaFileList} @keydown=${this.onContentKeydown}>
|
|
1087
|
-
${
|
|
1088
|
+
${$(
|
|
1088
1089
|
e,
|
|
1089
1090
|
(t) => t.id,
|
|
1090
1091
|
(t, i) => this.renderIconCard(t, i, e)
|
|
@@ -1123,7 +1124,7 @@ class S extends _ {
|
|
|
1123
1124
|
const i = this._iconResolver(t, e);
|
|
1124
1125
|
if (i) return i;
|
|
1125
1126
|
}
|
|
1126
|
-
return e.type === "folder" ? f :
|
|
1127
|
+
return e.type === "folder" ? f : F;
|
|
1127
1128
|
}
|
|
1128
1129
|
resolveIconForTree(e, t) {
|
|
1129
1130
|
const i = this._nodes.find((n) => n.id === t.id);
|
|
@@ -1320,10 +1321,10 @@ class S extends _ {
|
|
|
1320
1321
|
}
|
|
1321
1322
|
}
|
|
1322
1323
|
}
|
|
1323
|
-
typeof customElements < "u" && !customElements.get("mp-file-manager") && customElements.define("mp-file-manager",
|
|
1324
|
+
typeof customElements < "u" && !customElements.get("mp-file-manager") && customElements.define("mp-file-manager", R);
|
|
1324
1325
|
export {
|
|
1325
1326
|
p as DEFAULT_FILE_MANAGER_MESSAGES,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1327
|
+
R as MpFileManager,
|
|
1328
|
+
E as fileManagerStyles,
|
|
1329
|
+
T as mergeMessages
|
|
1329
1330
|
};
|
|
@@ -232,6 +232,8 @@ export declare class MpFileManager extends LitElement {
|
|
|
232
232
|
/** Remove a finished/aborted upload from the tracking list. */
|
|
233
233
|
clearUpload(uploadId: string): void;
|
|
234
234
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
235
|
+
/** Disposes the light-style mirror; see connectedCallback. */
|
|
236
|
+
private _releaseLightStyles?;
|
|
235
237
|
connectedCallback(): void;
|
|
236
238
|
disconnectedCallback(): void;
|
|
237
239
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a, c as e, g as i, i as o, r as c, s as g, b as l, d as p } from "../chunks/install-light-styles-DbCAGFOC.mjs";
|
|
2
|
+
export {
|
|
3
|
+
a as adoptLightStyles,
|
|
4
|
+
e as configureScopedHtml,
|
|
5
|
+
i as getLightStyleEntries,
|
|
6
|
+
o as installLightStyles,
|
|
7
|
+
c as rewriteStatics,
|
|
8
|
+
g as scopedHtml,
|
|
9
|
+
l as scopedSvg,
|
|
10
|
+
p as stampScope
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
/**
|
|
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.
|
|
12
|
+
*
|
|
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.
|
|
16
|
+
*/
|
|
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;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrite a template's static strings, stamping the scope attribute after
|
|
4
|
+
* every element tag name. Pure and deterministic; exported for the codegen
|
|
5
|
+
* (static `.element.html` templates route through the same rewriter) and for
|
|
6
|
+
* tests.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rewriteStatics(strings: TemplateStringsArray, scope: string): TemplateStringsArray;
|
|
9
|
+
/** Disable the once-per-template structural verification (see below) — an
|
|
10
|
+
* escape hatch for a false positive; the rewrite itself still runs. */
|
|
11
|
+
export declare function configureScopedHtml(options: {
|
|
12
|
+
verify?: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
type TemplateTag = (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult;
|
|
15
|
+
/** A scope-stamping replacement for lit's `html`. One factory call per
|
|
16
|
+
* component module; use the result for every template the component owns. */
|
|
17
|
+
export declare function scopedHtml(scope: string): TemplateTag;
|
|
18
|
+
/** The `svg` twin (data-* attributes are valid on SVG elements). */
|
|
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
|
+
export {};
|
package/navbar/index.mjs
CHANGED
|
@@ -1076,10 +1076,10 @@ class r extends d {
|
|
|
1076
1076
|
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
1077
1077
|
}
|
|
1078
1078
|
connectedCallback() {
|
|
1079
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#
|
|
1079
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#b(this.getAttribute("breakpoint")), this.addEventListener("click", this.#o);
|
|
1080
1080
|
}
|
|
1081
1081
|
disconnectedCallback() {
|
|
1082
|
-
super.disconnectedCallback(), this.removeEventListener("click", this.#
|
|
1082
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.#o);
|
|
1083
1083
|
}
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Clicking a navigation link (an `<a href>` — a routerLink renders one) should
|
|
@@ -1088,7 +1088,7 @@ class r extends d {
|
|
|
1088
1088
|
* (excluded), so opening a dropdown doesn't collapse the bar. Collapsing in
|
|
1089
1089
|
* wide mode is a no-op (the collapse is always shown there).
|
|
1090
1090
|
*/
|
|
1091
|
-
#
|
|
1091
|
+
#o = (a) => {
|
|
1092
1092
|
a.composedPath().find(
|
|
1093
1093
|
(t) => t instanceof HTMLAnchorElement && t.hasAttribute("href") && !t.classList.contains("dropdown-toggle")
|
|
1094
1094
|
) && (this.querySelectorAll("mp-navbar-dropdown").forEach(
|
|
@@ -1096,14 +1096,14 @@ class r extends d {
|
|
|
1096
1096
|
), this.toggle(!1));
|
|
1097
1097
|
};
|
|
1098
1098
|
attributeChangedCallback(a, e, t) {
|
|
1099
|
-
super.attributeChangedCallback(a, e, t), a === "color" ? this.#
|
|
1099
|
+
super.attributeChangedCallback(a, e, t), a === "color" ? this.#n(t) : a === "breakpoint" ? this.#b(t) : a === "expanded" ? this.#s(t !== null) : a === "aria-label" && this.requestUpdate();
|
|
1100
1100
|
}
|
|
1101
1101
|
/** Solid colors need `data-bs-theme` for text/link contrast; adaptive names inherit the page theme. */
|
|
1102
|
-
#
|
|
1103
|
-
const e = this.#
|
|
1102
|
+
#n(a) {
|
|
1103
|
+
const e = this.#r(a);
|
|
1104
1104
|
e ? this.setAttribute("data-bs-theme", e) : this.getAttribute("data-bs-theme") && this.removeAttribute("data-bs-theme");
|
|
1105
1105
|
}
|
|
1106
|
-
#
|
|
1106
|
+
#r(a) {
|
|
1107
1107
|
return a ? a === "light" || a === "white" ? "light" : a === "body" || a === "transparent" || a.startsWith("body-") ? null : "dark" : null;
|
|
1108
1108
|
}
|
|
1109
1109
|
/** min-width px for each Bootstrap breakpoint (xs = always collapsed → 0). */
|
|
@@ -1122,19 +1122,46 @@ class r extends d {
|
|
|
1122
1122
|
* inherit THROUGH shadow boundaries, so `mp-navbar-dropdown` reads the px in JS
|
|
1123
1123
|
* (matchMedia gate) without any DI/context.
|
|
1124
1124
|
*/
|
|
1125
|
-
#
|
|
1125
|
+
#b(a) {
|
|
1126
1126
|
const e = a ?? "md", t = r.#i[e] ?? 768;
|
|
1127
1127
|
this.setAttribute("data-breakpoint", e), this.style.setProperty("--mp-navbar-breakpoint", `${t}px`);
|
|
1128
1128
|
}
|
|
1129
1129
|
get #t() {
|
|
1130
1130
|
return this.renderRoot?.querySelector(".navbar-toggle") ?? null;
|
|
1131
1131
|
}
|
|
1132
|
+
/**
|
|
1133
|
+
* A programmatic write that arrives before the shadow tree exists. The
|
|
1134
|
+
* checkbox IS the state, so there is nowhere to put the value until it has
|
|
1135
|
+
* rendered, and `render()` deliberately does not bind `checked` (re-rendering
|
|
1136
|
+
* must never clobber what the user toggled). Held here and applied in
|
|
1137
|
+
* `firstUpdated`.
|
|
1138
|
+
*/
|
|
1139
|
+
#e = null;
|
|
1132
1140
|
/** Whether the collapse is (visually) expanded — the toggle's checked state. */
|
|
1133
1141
|
get expanded() {
|
|
1134
|
-
return this.#t?.checked ?? this.hasAttribute("expanded");
|
|
1142
|
+
return this.#t?.checked ?? this.#e ?? this.hasAttribute("expanded");
|
|
1135
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Accepts the empty string as ON, the way an HTML boolean attribute does.
|
|
1146
|
+
*
|
|
1147
|
+
* This is not defensive coding — it is the only reason `expanded` works
|
|
1148
|
+
* outside vanilla usage. The React and Vue wrappers both lower a `true` to
|
|
1149
|
+
* the attribute *shape* `''` (the DSD chrome and the no-JS CSS select on
|
|
1150
|
+
* attributes, and only an attribute is serialised by SSR), but both
|
|
1151
|
+
* frameworks route any name they find on the element's prototype through the
|
|
1152
|
+
* PROPERTY instead — and `''` is falsy in JavaScript, so the property setter
|
|
1153
|
+
* used to close the navbar when asked to open it. `expanded` was a silent
|
|
1154
|
+
* no-op in two of the three frameworks.
|
|
1155
|
+
*
|
|
1156
|
+
* Programmatic writes do not emit `expandedchange`: setting the state is the
|
|
1157
|
+
* consumer's own act, not a change to announce back to them. That matches
|
|
1158
|
+
* the `expanded` ATTRIBUTE path, which has always been silent.
|
|
1159
|
+
*/
|
|
1136
1160
|
set expanded(a) {
|
|
1137
|
-
this
|
|
1161
|
+
this.#s(a === "" ? !0 : !!a);
|
|
1162
|
+
}
|
|
1163
|
+
#s(a) {
|
|
1164
|
+
this.#t ? this.#a(a, !1) : this.#e = a;
|
|
1138
1165
|
}
|
|
1139
1166
|
/**
|
|
1140
1167
|
* The single write path for the collapse state: checkbox + `aria-expanded`
|
|
@@ -1142,25 +1169,25 @@ class r extends d {
|
|
|
1142
1169
|
* dismiss-on-navigate) don't fire the checkbox's `change` event, so syncing
|
|
1143
1170
|
* aria only there left `aria-expanded` stale after every programmatic close.
|
|
1144
1171
|
*/
|
|
1145
|
-
#
|
|
1172
|
+
#a(a, e = !0) {
|
|
1146
1173
|
const t = this.#t;
|
|
1147
|
-
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)), e && this.#
|
|
1174
|
+
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)), e && this.#v(a));
|
|
1148
1175
|
}
|
|
1149
1176
|
/** Programmatically open/close the collapse. */
|
|
1150
1177
|
toggle(a) {
|
|
1151
|
-
this.#
|
|
1178
|
+
this.#a(a ?? !(this.#t?.checked ?? !1));
|
|
1152
1179
|
}
|
|
1153
1180
|
firstUpdated() {
|
|
1154
1181
|
const a = this.#t;
|
|
1155
|
-
a && (a.setAttribute("role", "button"), a.setAttribute("aria-expanded", String(a.checked)));
|
|
1182
|
+
a && (a.setAttribute("role", "button"), this.#e !== null ? (this.#a(this.#e, !1), this.#e = null) : a.setAttribute("aria-expanded", String(a.checked)));
|
|
1156
1183
|
}
|
|
1157
|
-
#
|
|
1158
|
-
this.#
|
|
1184
|
+
#l = () => {
|
|
1185
|
+
this.#a(this.#t?.checked ?? !1);
|
|
1159
1186
|
};
|
|
1160
|
-
#
|
|
1187
|
+
#d = (a) => {
|
|
1161
1188
|
a.key === "Enter" && (a.preventDefault(), this.toggle());
|
|
1162
1189
|
};
|
|
1163
|
-
#
|
|
1190
|
+
#v(a) {
|
|
1164
1191
|
this.dispatchEvent(
|
|
1165
1192
|
new CustomEvent("expandedchange", {
|
|
1166
1193
|
detail: { expanded: a },
|
|
@@ -1184,8 +1211,8 @@ class r extends d {
|
|
|
1184
1211
|
class="navbar-toggle"
|
|
1185
1212
|
aria-label="Toggle navigation"
|
|
1186
1213
|
aria-controls="navbar-collapse"
|
|
1187
|
-
@change=${this.#
|
|
1188
|
-
@keydown=${this.#
|
|
1214
|
+
@change=${this.#l}
|
|
1215
|
+
@keydown=${this.#d}
|
|
1189
1216
|
/>
|
|
1190
1217
|
<label for="mp-navbar-toggle" class="navbar-toggler" part="toggler" aria-hidden="true">
|
|
1191
1218
|
<slot name="toggler">
|
|
@@ -1243,9 +1270,9 @@ class s extends i {
|
|
|
1243
1270
|
static get observedAttributes() {
|
|
1244
1271
|
return [...super.observedAttributes ?? [], "data-open", "data-menu-open"];
|
|
1245
1272
|
}
|
|
1246
|
-
#
|
|
1247
|
-
#a = null;
|
|
1273
|
+
#o = !1;
|
|
1248
1274
|
#n = null;
|
|
1275
|
+
#r = null;
|
|
1249
1276
|
/** Open via either path — inline (`data-open`) or overlay (`data-menu-open`). */
|
|
1250
1277
|
get #i() {
|
|
1251
1278
|
return this.hasAttribute("data-open") || this.hasAttribute("data-menu-open");
|
|
@@ -1254,7 +1281,7 @@ class s extends i {
|
|
|
1254
1281
|
super.attributeChangedCallback(a, e, t), (a === "data-open" || a === "data-menu-open") && this.requestUpdate();
|
|
1255
1282
|
}
|
|
1256
1283
|
/** min-width px per Bootstrap breakpoint — mirrors mp-navbar's map. */
|
|
1257
|
-
static #
|
|
1284
|
+
static #b = {
|
|
1258
1285
|
xs: 0,
|
|
1259
1286
|
sm: 576,
|
|
1260
1287
|
md: 768,
|
|
@@ -1264,16 +1291,16 @@ class s extends i {
|
|
|
1264
1291
|
};
|
|
1265
1292
|
/** Wide mode = at/above the navbar breakpoint (matchMedia). Small/no-JS = false. */
|
|
1266
1293
|
get #t() {
|
|
1267
|
-
return this.#
|
|
1294
|
+
return this.#r?.matches ?? !1;
|
|
1268
1295
|
}
|
|
1269
1296
|
connectedCallback() {
|
|
1270
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.#
|
|
1297
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.#o = !!this.closest("mp-dropdown-menu");
|
|
1271
1298
|
const a = this.closest("mp-navbar")?.getAttribute("breakpoint") ?? "md";
|
|
1272
1299
|
if (this.setAttribute("data-expand", a), typeof window < "u" && window.matchMedia) {
|
|
1273
|
-
const e = s.#
|
|
1274
|
-
this.#
|
|
1300
|
+
const e = s.#b[a] ?? 768;
|
|
1301
|
+
this.#r = window.matchMedia(`(min-width: ${e}px)`), this.#r.addEventListener("change", this.#e);
|
|
1275
1302
|
}
|
|
1276
|
-
this.addEventListener("keydown", this.#
|
|
1303
|
+
this.addEventListener("keydown", this.#p), this.#o && (this.setAttribute("data-submenu", ""), this.#n = new v(this, {
|
|
1277
1304
|
anchor: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1278
1305
|
trigger: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1279
1306
|
// The default-slotted panel: `<mp-dropdown-menu>` directly (React/Vue), or a
|
|
@@ -1290,29 +1317,29 @@ class s extends i {
|
|
|
1290
1317
|
}));
|
|
1291
1318
|
}
|
|
1292
1319
|
disconnectedCallback() {
|
|
1293
|
-
super.disconnectedCallback(), this.removeEventListener("keydown", this.#
|
|
1320
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this.#p), document.removeEventListener("mousedown", this.#l, !0), this.#r?.removeEventListener("change", this.#e);
|
|
1294
1321
|
}
|
|
1295
1322
|
// Resize crossed the breakpoint: close any open panel so state doesn't leak
|
|
1296
1323
|
// across the inline↔overlay switch (the CSS + #toggle re-resolve on next open).
|
|
1297
|
-
#
|
|
1298
|
-
this.#
|
|
1324
|
+
#e = () => {
|
|
1325
|
+
this.#n?.close(), this.#a(!1);
|
|
1299
1326
|
};
|
|
1300
|
-
get #
|
|
1327
|
+
get #s() {
|
|
1301
1328
|
return this.hasAttribute("data-open");
|
|
1302
1329
|
}
|
|
1303
|
-
#
|
|
1304
|
-
a !== this.#
|
|
1330
|
+
#a(a) {
|
|
1331
|
+
a !== this.#s && (this.toggleAttribute("data-open", a), a ? document.addEventListener("mousedown", this.#l, !0) : document.removeEventListener("mousedown", this.#l, !0));
|
|
1305
1332
|
}
|
|
1306
|
-
#
|
|
1307
|
-
a.composedPath().includes(this) || this.#
|
|
1333
|
+
#l = (a) => {
|
|
1334
|
+
a.composedPath().includes(this) || this.#a(!1);
|
|
1308
1335
|
};
|
|
1309
|
-
#
|
|
1310
|
-
this.#
|
|
1336
|
+
#d() {
|
|
1337
|
+
this.#o && this.#t && this.#n ? this.#n.toggle() : this.#a(!this.#s);
|
|
1311
1338
|
}
|
|
1312
1339
|
/** Close the dropdown (both the overlay and the inline paths). Public so the
|
|
1313
1340
|
* parent `mp-navbar` can dismiss every dropdown when a nav link is clicked. */
|
|
1314
1341
|
close() {
|
|
1315
|
-
this.#
|
|
1342
|
+
this.#n?.close(), this.#a(!1);
|
|
1316
1343
|
}
|
|
1317
1344
|
/**
|
|
1318
1345
|
* Toggle on MOUSEDOWN, not click — the whole gesture must resolve at press
|
|
@@ -1325,17 +1352,17 @@ class s extends i {
|
|
|
1325
1352
|
* is yanked out mid-gesture), and the dropdown silently fails to open.
|
|
1326
1353
|
* No preventDefault: it would suppress focus moving to the trigger.
|
|
1327
1354
|
*/
|
|
1328
|
-
#
|
|
1329
|
-
this.#
|
|
1355
|
+
#v = () => {
|
|
1356
|
+
this.#d();
|
|
1330
1357
|
};
|
|
1331
1358
|
#c = (a) => {
|
|
1332
|
-
a.key === "Enter" || a.key === " " || a.key === "Spacebar" ? (a.preventDefault(), this.#
|
|
1359
|
+
a.key === "Enter" || a.key === " " || a.key === "Spacebar" ? (a.preventDefault(), this.#d()) : a.key === "ArrowDown" && (a.preventDefault(), this.#i || this.#d(), this.#g());
|
|
1333
1360
|
};
|
|
1334
1361
|
/** Escape closes the INNERMOST open dropdown and returns focus to its
|
|
1335
1362
|
* trigger — fires for the shadow trigger and slotted menu content alike
|
|
1336
1363
|
* (keydown is composed). Closed hosts let the event bubble to an open
|
|
1337
1364
|
* ancestor, so nested submenus unwind one level per press. */
|
|
1338
|
-
#
|
|
1365
|
+
#p = (a) => {
|
|
1339
1366
|
a.key !== "Escape" || !this.#i || (a.stopPropagation(), this.close(), this.renderRoot?.querySelector(".dropdown-toggle")?.focus());
|
|
1340
1367
|
};
|
|
1341
1368
|
/** Move focus to the first item control of the slotted menu (this menu's own
|
|
@@ -1355,7 +1382,7 @@ class s extends i {
|
|
|
1355
1382
|
tabindex="0"
|
|
1356
1383
|
aria-haspopup="menu"
|
|
1357
1384
|
aria-expanded=${this.#i ? "true" : "false"}
|
|
1358
|
-
@mousedown=${this.#
|
|
1385
|
+
@mousedown=${this.#v}
|
|
1359
1386
|
@keydown=${this.#c}
|
|
1360
1387
|
><slot name="label"></slot></a>
|
|
1361
1388
|
<slot></slot>
|
|
@@ -45,7 +45,23 @@ export declare class MpNavbar extends LitElement {
|
|
|
45
45
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
46
46
|
/** Whether the collapse is (visually) expanded — the toggle's checked state. */
|
|
47
47
|
get expanded(): boolean;
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Accepts the empty string as ON, the way an HTML boolean attribute does.
|
|
50
|
+
*
|
|
51
|
+
* This is not defensive coding — it is the only reason `expanded` works
|
|
52
|
+
* outside vanilla usage. The React and Vue wrappers both lower a `true` to
|
|
53
|
+
* the attribute *shape* `''` (the DSD chrome and the no-JS CSS select on
|
|
54
|
+
* attributes, and only an attribute is serialised by SSR), but both
|
|
55
|
+
* frameworks route any name they find on the element's prototype through the
|
|
56
|
+
* PROPERTY instead — and `''` is falsy in JavaScript, so the property setter
|
|
57
|
+
* used to close the navbar when asked to open it. `expanded` was a silent
|
|
58
|
+
* no-op in two of the three frameworks.
|
|
59
|
+
*
|
|
60
|
+
* Programmatic writes do not emit `expandedchange`: setting the state is the
|
|
61
|
+
* consumer's own act, not a change to announce back to them. That matches
|
|
62
|
+
* the `expanded` ATTRIBUTE path, which has always been silent.
|
|
63
|
+
*/
|
|
64
|
+
set expanded(v: boolean | '');
|
|
49
65
|
/** Programmatically open/close the collapse. */
|
|
50
66
|
toggle(force?: boolean): void;
|
|
51
67
|
protected firstUpdated(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/web-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.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": {
|
|
@@ -101,6 +101,10 @@
|
|
|
101
101
|
"types": "./input-group/index.d.ts",
|
|
102
102
|
"import": "./input-group/index.mjs"
|
|
103
103
|
},
|
|
104
|
+
"./light-dom": {
|
|
105
|
+
"types": "./light-dom/index.d.ts",
|
|
106
|
+
"import": "./light-dom/index.mjs"
|
|
107
|
+
},
|
|
104
108
|
"./multi-range": {
|
|
105
109
|
"types": "./multi-range/index.d.ts",
|
|
106
110
|
"import": "./multi-range/index.mjs"
|