@deepfuture/dui-cdn 1.4.1 → 1.4.3

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 (3) hide show
  1. package/dui.js +33 -19
  2. package/dui.min.js +157 -172
  3. package/package.json +1 -1
package/dui.js CHANGED
@@ -7452,13 +7452,14 @@ var FloatingPortalController = class {
7452
7452
  }
7453
7453
  #createPositioner() {
7454
7454
  if (this.#positioner) {
7455
- this.#positioner.style.display = "";
7455
+ this.#positioner.style.display = "block";
7456
7456
  this.#applyForwardedProperties(this.#positioner);
7457
7457
  return;
7458
7458
  }
7459
7459
  const overlayRoot = this.#getOverlayRoot();
7460
7460
  const positioner = document.createElement("div");
7461
7461
  positioner.style.position = "fixed";
7462
+ positioner.style.display = "block";
7462
7463
  positioner.style.zIndex = "1000";
7463
7464
  positioner.style.pointerEvents = "none";
7464
7465
  positioner.setAttribute("data-floating-portal", "");
@@ -14892,19 +14893,9 @@ __publicField(DuiSidebarPrimitive, "styles", [base, styles90]);
14892
14893
  var styles91 = i5`
14893
14894
  :host {
14894
14895
  display: inline-block;
14896
+ cursor: pointer;
14895
14897
  }
14896
14898
  `;
14897
- var panelLeftSvg = b4`<svg
14898
- viewBox="0 0 24 24"
14899
- fill="none"
14900
- stroke="currentColor"
14901
- stroke-width="2"
14902
- stroke-linecap="round"
14903
- stroke-linejoin="round"
14904
- >
14905
- <rect width="18" height="18" x="3" y="3" rx="2" />
14906
- <path d="M9 3v18" />
14907
- </svg>`;
14908
14899
  var DuiSidebarTriggerPrimitive = class extends i8 {
14909
14900
  static tagName = "dui-sidebar-trigger";
14910
14901
  static styles = [base, styles91];
@@ -14912,17 +14903,40 @@ var DuiSidebarTriggerPrimitive = class extends i8 {
14912
14903
  context: sidebarContext,
14913
14904
  subscribe: true
14914
14905
  });
14906
+ connectedCallback() {
14907
+ super.connectedCallback();
14908
+ if (!this.hasAttribute("role")) {
14909
+ this.setAttribute("role", "button");
14910
+ }
14911
+ if (!this.hasAttribute("tabindex")) {
14912
+ this.setAttribute("tabindex", "0");
14913
+ }
14914
+ this.addEventListener("click", this.#onClick);
14915
+ this.addEventListener("keydown", this.#onKeyDown);
14916
+ }
14917
+ disconnectedCallback() {
14918
+ super.disconnectedCallback();
14919
+ this.removeEventListener("click", this.#onClick);
14920
+ this.removeEventListener("keydown", this.#onKeyDown);
14921
+ }
14915
14922
  #onClick = () => {
14916
14923
  this.#ctx.value?.toggleSidebar();
14917
14924
  };
14925
+ #onKeyDown = (e13) => {
14926
+ if (e13.key === "Enter" || e13.key === " ") {
14927
+ e13.preventDefault();
14928
+ this.#ctx.value?.toggleSidebar();
14929
+ }
14930
+ };
14931
+ willUpdate() {
14932
+ const ctx = this.#ctx.value;
14933
+ if (ctx) {
14934
+ const expanded = ctx.isMobile ? ctx.openMobile : ctx.open;
14935
+ this.setAttribute("aria-expanded", String(expanded));
14936
+ }
14937
+ }
14918
14938
  render() {
14919
- return b4`
14920
- <dui-button appearance="ghost" size="sm" @click=${this.#onClick}>
14921
- <slot>
14922
- <dui-icon>${panelLeftSvg}</dui-icon>
14923
- </slot>
14924
- </dui-button>
14925
- `;
14939
+ return b4`<slot></slot>`;
14926
14940
  }
14927
14941
  };
14928
14942