@deepfuture/dui-cdn 1.4.0 → 1.4.2
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/dui.js +41 -24
- package/dui.min.js +314 -329
- package/package.json +1 -1
package/dui.js
CHANGED
|
@@ -14591,13 +14591,17 @@ var DuiSidebarProviderPrimitive = class extends (_a42 = i8, _open_dec6 = [n7({ t
|
|
|
14591
14591
|
}
|
|
14592
14592
|
connectedCallback() {
|
|
14593
14593
|
super.connectedCallback();
|
|
14594
|
-
if (this.
|
|
14595
|
-
__privateSet(this, _DuiSidebarProviderPrimitive_instances,
|
|
14594
|
+
if (this.collapsible === "always") {
|
|
14595
|
+
__privateSet(this, _DuiSidebarProviderPrimitive_instances, true, isMobile_set);
|
|
14596
|
+
} else {
|
|
14597
|
+
if (this.open === void 0) {
|
|
14598
|
+
__privateSet(this, _DuiSidebarProviderPrimitive_instances, this.defaultOpen, internalOpen_set6);
|
|
14599
|
+
}
|
|
14600
|
+
__privateSet(this, _mediaQuery, matchMedia("(min-width: 768px)"));
|
|
14601
|
+
__privateSet(this, _DuiSidebarProviderPrimitive_instances, !__privateGet(this, _mediaQuery).matches, isMobile_set);
|
|
14602
|
+
__privateSet(this, _boundOnMediaChange, __privateGet(this, _onMediaChange).bind(this));
|
|
14603
|
+
__privateGet(this, _mediaQuery).addEventListener("change", __privateGet(this, _boundOnMediaChange));
|
|
14596
14604
|
}
|
|
14597
|
-
__privateSet(this, _mediaQuery, matchMedia("(min-width: 768px)"));
|
|
14598
|
-
__privateSet(this, _DuiSidebarProviderPrimitive_instances, !__privateGet(this, _mediaQuery).matches, isMobile_set);
|
|
14599
|
-
__privateSet(this, _boundOnMediaChange, __privateGet(this, _onMediaChange).bind(this));
|
|
14600
|
-
__privateGet(this, _mediaQuery).addEventListener("change", __privateGet(this, _boundOnMediaChange));
|
|
14601
14605
|
__privateSet(this, _boundOnKeyDown, __privateGet(this, _onKeyDown6).bind(this));
|
|
14602
14606
|
document.addEventListener("keydown", __privateGet(this, _boundOnKeyDown));
|
|
14603
14607
|
this._ctx = __privateMethod(this, _DuiSidebarProviderPrimitive_instances, buildContext_fn8).call(this);
|
|
@@ -14888,19 +14892,9 @@ __publicField(DuiSidebarPrimitive, "styles", [base, styles90]);
|
|
|
14888
14892
|
var styles91 = i5`
|
|
14889
14893
|
:host {
|
|
14890
14894
|
display: inline-block;
|
|
14895
|
+
cursor: pointer;
|
|
14891
14896
|
}
|
|
14892
14897
|
`;
|
|
14893
|
-
var panelLeftSvg = b4`<svg
|
|
14894
|
-
viewBox="0 0 24 24"
|
|
14895
|
-
fill="none"
|
|
14896
|
-
stroke="currentColor"
|
|
14897
|
-
stroke-width="2"
|
|
14898
|
-
stroke-linecap="round"
|
|
14899
|
-
stroke-linejoin="round"
|
|
14900
|
-
>
|
|
14901
|
-
<rect width="18" height="18" x="3" y="3" rx="2" />
|
|
14902
|
-
<path d="M9 3v18" />
|
|
14903
|
-
</svg>`;
|
|
14904
14898
|
var DuiSidebarTriggerPrimitive = class extends i8 {
|
|
14905
14899
|
static tagName = "dui-sidebar-trigger";
|
|
14906
14900
|
static styles = [base, styles91];
|
|
@@ -14908,17 +14902,40 @@ var DuiSidebarTriggerPrimitive = class extends i8 {
|
|
|
14908
14902
|
context: sidebarContext,
|
|
14909
14903
|
subscribe: true
|
|
14910
14904
|
});
|
|
14905
|
+
connectedCallback() {
|
|
14906
|
+
super.connectedCallback();
|
|
14907
|
+
if (!this.hasAttribute("role")) {
|
|
14908
|
+
this.setAttribute("role", "button");
|
|
14909
|
+
}
|
|
14910
|
+
if (!this.hasAttribute("tabindex")) {
|
|
14911
|
+
this.setAttribute("tabindex", "0");
|
|
14912
|
+
}
|
|
14913
|
+
this.addEventListener("click", this.#onClick);
|
|
14914
|
+
this.addEventListener("keydown", this.#onKeyDown);
|
|
14915
|
+
}
|
|
14916
|
+
disconnectedCallback() {
|
|
14917
|
+
super.disconnectedCallback();
|
|
14918
|
+
this.removeEventListener("click", this.#onClick);
|
|
14919
|
+
this.removeEventListener("keydown", this.#onKeyDown);
|
|
14920
|
+
}
|
|
14911
14921
|
#onClick = () => {
|
|
14912
14922
|
this.#ctx.value?.toggleSidebar();
|
|
14913
14923
|
};
|
|
14924
|
+
#onKeyDown = (e13) => {
|
|
14925
|
+
if (e13.key === "Enter" || e13.key === " ") {
|
|
14926
|
+
e13.preventDefault();
|
|
14927
|
+
this.#ctx.value?.toggleSidebar();
|
|
14928
|
+
}
|
|
14929
|
+
};
|
|
14930
|
+
willUpdate() {
|
|
14931
|
+
const ctx = this.#ctx.value;
|
|
14932
|
+
if (ctx) {
|
|
14933
|
+
const expanded = ctx.isMobile ? ctx.openMobile : ctx.open;
|
|
14934
|
+
this.setAttribute("aria-expanded", String(expanded));
|
|
14935
|
+
}
|
|
14936
|
+
}
|
|
14914
14937
|
render() {
|
|
14915
|
-
return b4
|
|
14916
|
-
<dui-button appearance="ghost" size="sm" @click=${this.#onClick}>
|
|
14917
|
-
<slot>
|
|
14918
|
-
<dui-icon>${panelLeftSvg}</dui-icon>
|
|
14919
|
-
</slot>
|
|
14920
|
-
</dui-button>
|
|
14921
|
-
`;
|
|
14938
|
+
return b4`<slot></slot>`;
|
|
14922
14939
|
}
|
|
14923
14940
|
};
|
|
14924
14941
|
|