litos-ui 0.15.2 → 0.15.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.
@@ -1,8 +1,8 @@
1
- import { addClass as r, $one as a, on as h, off as p, removeClass as d, queryHideNodeSize as u, toggleClass as m, $$ as n } from "ph-utils/dom";
2
- import g from "../base.js";
3
- import { initAttr as f, parseAttrValue as c } from "../utils/index.js";
4
- const v = ":host{display:block;width:100%;overflow:hidden}.l-submenu-title{display:flex;align-items:center;padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;position:relative;overflow:hidden;text-overflow:ellipsis;border-right:2px solid transparent;transition:color .3s,background-color .3s,border-color .3s}.l-submenu-title:hover{background-color:var(--l-primary-color-light5)}.l-menu{--l-menu-level: 1;display:block;width:var(--l-menu-width);height:var(--l-menu-height);font-size:14px;position:relative;color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;transition:height .3s,width .3s;overflow:hidden;border-right:1px solid var(--l-border-color, #dedede)}.l-menu-icon-wrap{display:inline-flex;font-size:14px;margin-right:5px}.l-submenu-arrow-icon{position:absolute;top:50%;right:10px;transition:transform .3s;transform:translate3d(0,-50%,0) rotate(90deg);color:var(--l-info-color)}:host(.collapsed) .l-submenu-arrow-icon{transform:translate3d(0,-50%,0) rotate(0)}.l-menu--collapsed{display:none}:host(.is-active) .l-submenu-title{color:var(--l-primary-color)}";
5
- class C extends g {
1
+ import { addClass as l, $one as r, on as h, off as p, removeClass as d, toggleClass as u, $$ as n } from "ph-utils/dom";
2
+ import m from "../base.js";
3
+ import { initAttr as g, parseAttrValue as c } from "../utils/index.js";
4
+ const f = ":host{display:block;width:100%;overflow:hidden}.l-submenu-title{display:flex;align-items:center;padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;position:relative;overflow:hidden;text-overflow:ellipsis;border-right:2px solid transparent;transition:color .3s,background-color .3s,border-color .3s}.l-submenu-title:hover{background-color:var(--l-primary-color-light5)}.l-menu{--l-menu-level: 1;display:block;width:var(--l-menu-width);height:var(--l-menu-height);font-size:14px;position:relative;color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;transition:height .3s,width .3s;overflow:hidden;border-right:1px solid var(--l-border-color, #dedede)}.l-menu-icon-wrap{display:inline-flex;font-size:14px;margin-right:5px}.l-submenu-arrow-icon{position:absolute;top:50%;right:10px;transition:transform .3s;transform:translate3d(0,-50%,0) rotate(90deg);color:var(--l-info-color)}:host(.collapsed) .l-submenu-arrow-icon{transform:translate3d(0,-50%,0) rotate(0)}.l-menu--collapsed{display:none}.l-menu--hide{position:absolute;visibility:hidden}:host(.is-active) .l-submenu-title{color:var(--l-primary-color)}";
5
+ class C extends m {
6
6
  static baseName = "sub-menu";
7
7
  /** 默认折叠子菜单 */
8
8
  expanded = !1;
@@ -10,35 +10,35 @@ class C extends g {
10
10
  active = !1;
11
11
  #e;
12
12
  connectedCallback() {
13
- this.loadStyleText(v), f(this), this.expanded || r(this, "collapsed"), this.active && r(this, "is-active"), super.connectedCallback();
13
+ this.loadStyleText(f), g(this), this.expanded || l(this, "collapsed"), this.active && l(this, "is-active"), super.connectedCallback();
14
14
  }
15
15
  afterInit() {
16
- const e = a(".l-menu", this.root);
16
+ const e = r(".l-menu", this.root);
17
17
  h(e, "transitionend", this.#t);
18
18
  }
19
19
  beforeDestroy() {
20
- const e = a(".l-menu", this.root);
20
+ const e = r(".l-menu", this.root);
21
21
  p(e, "transitionend", this.#t), this.#e && clearTimeout(this.#e);
22
22
  }
23
23
  static get observedAttributes() {
24
24
  return ["expanded", "active"];
25
25
  }
26
- attributeChangedCallback(e, i, l) {
26
+ attributeChangedCallback(e, i, a) {
27
27
  if (this.rendered) {
28
28
  if (e === "expanded") {
29
- const o = c(l, !1, "expanded");
29
+ const o = c(a, !1, "expanded");
30
30
  if (this.expanded !== o) {
31
31
  this.expanded = o;
32
- const t = a(".l-menu", this.root);
32
+ const t = r(".l-menu", this.root);
33
33
  if (this.expanded) {
34
- d(this, "collapsed");
35
- const s = u(t, null);
36
- t.style.height = "0", d(t, "l-menu--collapsed"), requestAnimationFrame(() => {
34
+ d(this, "collapsed"), l(t, "l-menu--hide"), d(t, "l-menu--collapsed");
35
+ const s = t.getBoundingClientRect();
36
+ t.style.height = "0", d(t, "l-menu--hide"), requestAnimationFrame(() => {
37
37
  t.style.height = `${s.height}px`;
38
38
  });
39
39
  } else {
40
40
  const s = t.getBoundingClientRect();
41
- t.style.height = `${s.height}px`, r(this, "collapsed"), requestAnimationFrame(() => {
41
+ t.style.height = `${s.height}px`, l(this, "collapsed"), requestAnimationFrame(() => {
42
42
  t.style.height = "0";
43
43
  });
44
44
  }
@@ -50,14 +50,14 @@ class C extends g {
50
50
  }, 350);
51
51
  }
52
52
  } else if (e === "active") {
53
- const o = c(l, !1, "active");
54
- o !== this.active && (this.active = o, m(this, "is-active"));
53
+ const o = c(a, !1, "active");
54
+ o !== this.active && (this.active = o, u(this, "is-active"));
55
55
  }
56
56
  }
57
57
  }
58
58
  render() {
59
59
  const e = document.createDocumentFragment(), i = n("div", { class: "l-submenu-title" });
60
- if (a('[slot="icon"]', this)) {
60
+ if (r('[slot="icon"]', this)) {
61
61
  const s = n("span", { class: "l-menu-icon-wrap" });
62
62
  s.appendChild(n("slot", { name: "icon" })), i.appendChild(s);
63
63
  }
@@ -73,7 +73,7 @@ class C extends g {
73
73
  if (!this.expanded && e.propertyName === "height") {
74
74
  this.#e && clearTimeout(this.#e);
75
75
  const i = e.target;
76
- i.style.removeProperty("height"), r(i, "l-menu--collapsed");
76
+ i.style.removeProperty("height"), l(i, "l-menu--collapsed");
77
77
  }
78
78
  };
79
79
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "litos-ui",
3
3
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.15.2",
4
+ "version": "0.15.3",
5
5
  "type": "module",
6
6
  "devDependencies": {
7
7
  "@eslint/js": "^9.30.1",