litos-ui 0.6.2 → 0.7.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.
@@ -1,21 +1,21 @@
1
1
  import { isBlank as $ } from "ph-utils";
2
- import { iterate as N, transition as w, $ as p } from "ph-utils/dom";
3
- let E = -1, y = {
2
+ import { iterate as N, transition as c, $ as p } from "ph-utils/dom";
3
+ let E = -1, b = {
4
4
  /** 注册应用的前缀 */
5
5
  prefix: "l"
6
6
  };
7
- function j(t) {
8
- y = { ...y, ...t };
7
+ function P(t) {
8
+ b = { ...b, ...t };
9
9
  }
10
10
  function k(t, r) {
11
11
  const e = Array.isArray(t) ? t : [t];
12
12
  for (const i of e) {
13
- const n = r || `${y.prefix}-${i.baseName}`;
13
+ const n = r || `${b.prefix}-${i.baseName}`;
14
14
  customElements.get(n) || customElements.define(n, i);
15
15
  }
16
16
  }
17
17
  function V() {
18
- return `${y.prefix}-${++E}`;
18
+ return `${b.prefix}-${++E}`;
19
19
  }
20
20
  function W(t, r, e) {
21
21
  if (t == null) return r;
@@ -34,16 +34,19 @@ function _(t) {
34
34
  const { name: i, value: n } = e;
35
35
  if (i.startsWith("data-") || i.startsWith("aria-") || i.startsWith("_") || i.startsWith("$"))
36
36
  continue;
37
- const f = i.split("-").map((o, h) => h === 0 ? o : o[0].toUpperCase() + o.slice(1)).join(""), u = W(n, t[f], i);
38
- t[f] = u, i === "value" && (t._resetValue = u);
37
+ const f = i.split("-").map((s, u) => u === 0 ? s : s[0].toUpperCase() + s.slice(1)).join("");
38
+ if (Object.hasOwn(t, f)) {
39
+ const s = W(n, t[f], i);
40
+ t[f] = s, i === "value" && (t._resetValue = s);
41
+ }
39
42
  }
40
43
  }
41
- function C(t, r) {
44
+ function O(t, r) {
42
45
  let e = " ";
43
46
  return r === !0 ? e = ` ${t}` : typeof r == "string" && !$(r) && (e = ` ${t}="${r}"`), e;
44
47
  }
45
48
  function B(t) {
46
- return t.map((e) => C(e[0], e[1])).join("");
49
+ return t.map((e) => O(e[0], e[1])).join("");
47
50
  }
48
51
  function F(t, r) {
49
52
  for (const e of r) {
@@ -57,83 +60,83 @@ function M() {
57
60
  attributes: !0,
58
61
  attributeFilter: ["l-transition-emit"]
59
62
  }, e = (f) => {
60
- for (let u of f)
61
- if (u.type === "attributes" && u.attributeName) {
62
- const o = u.target, h = o.getAttribute(u.attributeName) || "show", b = o.getAttribute("l-transition") || "l", m = o.getAttribute("l-transition-method") || "hide";
63
- h === "show" ? (o.style.removeProperty("display"), w(o, b, "enter")) : w(o, b, "leave", () => {
64
- m === "remove" ? o.remove() : o.style.display = "none";
63
+ for (let s of f)
64
+ if (s.type === "attributes" && s.attributeName) {
65
+ const u = s.target, y = u.getAttribute(s.attributeName) || "show", a = u.getAttribute("l-transition") || "l", w = u.getAttribute("l-transition-method") || "hide";
66
+ y === "show" ? (u.style.removeProperty("display"), c(u, a, "enter")) : c(u, a, "leave", () => {
67
+ w === "remove" ? u.remove() : u.style.display = "none";
65
68
  });
66
69
  }
67
70
  };
68
71
  function i(f) {
69
- f && f.length > 0 && (t == null && (t = new MutationObserver(e)), N(f, (u) => {
70
- const o = u.getAttribute("l-transition");
71
- o && (w(u, o, "enter"), t.observe(u, r));
72
+ f && f.length > 0 && (t == null && (t = new MutationObserver(e)), N(f, (s) => {
73
+ const u = s.getAttribute("l-transition");
74
+ u && (c(s, u, "enter"), t.observe(s, r));
72
75
  }));
73
76
  }
74
77
  function n(f) {
75
78
  f == null && (f = p("[l-transition]"), i(f));
76
79
  }
77
- function s() {
80
+ function o() {
78
81
  t && (t.disconnect(), t = void 0);
79
82
  }
80
- return { destroy: s, add: i, init: n };
83
+ return { destroy: o, add: i, init: n };
81
84
  }
82
- function c(t, r, e, i, n = 10) {
83
- let s = 0;
84
- return e === "top" ? s = r.height + n : e === "bottom" ? s = -(t.height + n) : (e === "left" || e === "right") && (i === "" ? s = r.height / 2 - t.height / 2 : i === "end" && (s = r.height - t.height)), s;
85
+ function m(t, r, e, i, n = 10) {
86
+ let o = 0;
87
+ return e === "top" ? o = r.height + n : e === "bottom" ? o = -(t.height + n) : (e === "left" || e === "right") && (i === "" ? o = r.height / 2 - t.height / 2 : i === "end" && (o = r.height - t.height)), o;
85
88
  }
86
89
  function x(t, r, e, i, n = 10) {
87
- let s = 0;
88
- return e === "left" ? s = r.width + n : e === "right" ? s = -(t.width + n) : (e === "top" || e === "bottom") && (i === "" ? s = r.width / 2 - t.width / 2 : i === "end" && (s = r.width - t.width)), s;
90
+ let o = 0;
91
+ return e === "left" ? o = r.width + n : e === "right" ? o = -(t.width + n) : (e === "top" || e === "bottom") && (i === "" ? o = r.width / 2 - t.width / 2 : i === "end" && (o = r.width - t.width)), o;
89
92
  }
90
- function U(t, r, e, i, n, s, f, u, o = 10, h = "absolute") {
91
- const b = window.innerHeight + s - 10, m = window.innerWidth + n - 10;
92
- let d = t.top + s - u;
93
- d + r.height > b && (e === "left" || e === "right" ? i = "end" : e = "top", u = c(
93
+ function U(t, r, e, i, n, o, f, s, u = 10, y = "absolute") {
94
+ const a = window.innerHeight + o - 10, w = window.innerWidth + n - 10;
95
+ let h = t.top + o - s;
96
+ h + r.height > a && (e === "left" || e === "right" ? i = "end" : e = "top", s = m(
94
97
  t,
95
98
  r,
96
99
  e,
97
100
  i,
98
- o
99
- ), d = t.top + s - u), d < s && (e === "left" || e === "right" ? i = "start" : e = "bottom");
100
- let a = t.left + n - f;
101
- return a + r.width > m && (e === "top" || e === "bottom" ? i = "end" : e = "left", f = x(
101
+ u
102
+ ), h = t.top + o - s), h < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
103
+ let d = t.left + n - f;
104
+ return d + r.width > w && (e === "top" || e === "bottom" ? i = "end" : e = "left", f = x(
102
105
  t,
103
106
  r,
104
107
  e,
105
108
  i,
106
- o
107
- ), a = t.left + n - f), a < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), h === "fixed" && (u = c(
109
+ u
110
+ ), d = t.left + n - f), d < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), y === "fixed" && (s = m(
108
111
  t,
109
112
  r,
110
113
  e,
111
114
  i,
112
- o
115
+ u
113
116
  ), f = x(
114
117
  t,
115
118
  r,
116
119
  e,
117
120
  i,
118
- o
119
- ), a = t.left + n - f, d = t.top + s - u), {
120
- x: a,
121
- y: d,
121
+ u
122
+ ), d = t.left + n - f, h = t.top + o - s), {
123
+ x: d,
124
+ y: h,
122
125
  mainAlign: e,
123
126
  crossAlign: i
124
127
  };
125
128
  }
126
129
  export {
127
- j as config,
130
+ P as config,
128
131
  M as createTransition,
129
132
  x as getPopoverOffsetX,
130
- c as getPopoverOffsetY,
133
+ m as getPopoverOffsetY,
131
134
  U as impactDetect,
132
135
  _ as initAttr,
133
136
  W as parseAttrValue,
134
137
  k as regist,
135
138
  F as setAttrs,
136
- C as tagAttr,
139
+ O as tagAttr,
137
140
  B as tagAttrs,
138
141
  V as useId
139
142
  };
@@ -1,8 +1,8 @@
1
1
  var c = Object.defineProperty;
2
2
  var p = (s, e, t) => e in s ? c(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var o = (s, e, t) => p(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { initAttr as d } from "./index.js";
5
- import u from "../base.js";
4
+ import { initAttr as m } from "./index.js";
5
+ import d from "../base.js";
6
6
  import "../message/index.js";
7
7
  import { transition as n } from "ph-utils/dom";
8
8
  import "ph-utils";
@@ -10,13 +10,18 @@ import "ph-utils/validator";
10
10
  import "../button/index.js";
11
11
  import "../list/index.js";
12
12
  import "ph-utils/theme";
13
- class m extends u {
13
+ import "../button/regist.js";
14
+ import "../tabbar/regist.js";
15
+ import "../popover/regist.js";
16
+ import "../popconfirm/index.js";
17
+ import "../popconfirm/regist.js";
18
+ class u extends d {
14
19
  constructor() {
15
20
  super();
16
21
  /** 应用过滤动画的属性值, 例如: opacity: 0; transform: xx; */
17
22
  o(this, "sheetRec");
18
23
  o(this, "duration", "0.3s");
19
- d(this), this.sheetRec = this._parseSheets(this.getAttr("sheets", "opacity: 0"));
24
+ m(this), this.sheetRec = this._parseSheets(this.getAttr("sheets", "opacity: 0"));
20
25
  }
21
26
  static get observedAttributes() {
22
27
  return ["sheets"];
@@ -52,7 +57,7 @@ class m extends u {
52
57
  return t != null && t.assignedNodes().length > 0 ? t.assignedNodes()[0] : null;
53
58
  }
54
59
  }
55
- o(m, "baseName", "transition");
60
+ o(u, "baseName", "transition");
56
61
  export {
57
- m as Transition
62
+ u as Transition
58
63
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "litos-ui",
3
3
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.6.2",
4
+ "version": "0.7.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "docs:dev": "vitepress dev docs",