litos-ui 0.11.0 → 0.11.1

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,6 +1,7 @@
1
1
  import BaseComponent from "../base";
2
2
  export default class Button extends BaseComponent {
3
3
  static baseName: string;
4
+ static tagName: string;
4
5
  htmlType: "submit" | "reset" | "button";
5
6
  constructor();
6
7
  static get observedAttributes(): string[];
@@ -3,9 +3,10 @@ import d from "../base.js";
3
3
  import { $one as h, addClass as g, removeClass as p, on as v, off as f, formatClass as u, formatStyle as m, getAttr as k } from "ph-utils/dom";
4
4
  import { adjust as b } from "ph-utils/color";
5
5
  import { a as x } from "../animation-DttknHkX.js";
6
- const y = ":host{--l-btn-text-color: #ffffff;--l-btn-hover-text-color: var(--l-btn-text-color);--l-btn-active-text-color: var(--l-btn-text-color);--l-btn-border-color: var(--l-primary-color, #722ed1);--l-btn-background: var(--l-btn-border-color);--l-btn-hover-border-color: var(--l-primary-color-light1, #9254de);--l-btn-hover-background: var(--l-btn-hover-border-color);--l-btn-active-border-color: var(--l-primary-color-dark1, #531dab);--l-btn-active-background: var(--l-btn-active-border-color);--l-btn-disabled-color: #c9c9c9;--l-btn-disabled-background: #fbfbfb;--l-btn-disabled-border-color: #e6e6e6;display:inline-block;width:auto;font-size:0}.l-btn{width:100%;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:none;box-sizing:border-box;vertical-align:middle;padding:0 15px;line-height:1;height:var(--l-form-edit-height, 32px);border-radius:3px;font-size:14px;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);position:relative;gap:5px;transition:border-color .3s,background-color .3s,color .3s}.l-btn:hover{border-color:var(--l-btn-hover-border-color, var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color, var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color: auto;--l-btn-background: transparent;--l-btn-border-color: #d9d9d9;--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab);--l-btn-hover-background: #fff;--l-btn-active-background: #fff;--l-btn-hover-border-color: var(--l-btn-hover-text-color);--l-btn-active-border-color: var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background: var(--l-primary-color, #722ed1);--l-btn-hover-background: var(--l-primary-color-light1, #9254de);--l-btn-active-background: var(--l-primary-color-dark1, #531dab)}.l-btn:not(.l-btn-loading):disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn-text{--l-btn-background: transparent;--l-btn-border-color: transparent;--l-btn-hover-border-color: transparent;--l-btn-active-border-color: transparent;--l-btn-disabled-background: transparent;--l-btn-disabled-border-color: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;height:auto;padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color: var(--l-primary-color, #722ed1);--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab)}.l-btn-ghost{--l-btn-text-color: var(--l-btn-border-color);--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-hover-text-color: var(--l-btn-hover-border-color);--l-btn-active-text-color: var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-edit-height, 32px) / 2)}.l-btn-circle{border-radius:50%;width:var(--l-form-edit-height, 32px);padding:0}.l-btn-block{width:100%}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background: rgba(255, 255, 255, .08);--l-btn-disabled-color: rgba(255, 255, 255, .3);--l-btn-disabled-border-color: rgba(255, 255, 255, .3)}";
6
+ const y = ":host{--l-btn-text-color: #ffffff;--l-btn-hover-text-color: var(--l-btn-text-color);--l-btn-active-text-color: var(--l-btn-text-color);--l-btn-border-color: var(--l-primary-color, #722ed1);--l-btn-background: var(--l-btn-border-color);--l-btn-hover-border-color: var(--l-primary-color-light1, #9254de);--l-btn-hover-background: var(--l-btn-hover-border-color);--l-btn-active-border-color: var(--l-primary-color-dark1, #531dab);--l-btn-active-background: var(--l-btn-active-border-color);--l-btn-disabled-color: #c9c9c9;--l-btn-disabled-background: #fbfbfb;--l-btn-disabled-border-color: #e6e6e6;display:inline-block;width:auto;height:var(--l-form-edit-height, 32px);font-size:0}:host([block]){width:100%}.l-btn{width:100%;display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:none;box-sizing:border-box;vertical-align:middle;padding:0 15px;line-height:1;height:100%;border-radius:3px;font-size:14px;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);position:relative;gap:5px;transition:border-color .3s,background-color .3s,color .3s}.l-btn:hover{border-color:var(--l-btn-hover-border-color, var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color, var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color: auto;--l-btn-background: transparent;--l-btn-border-color: #d9d9d9;--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab);--l-btn-hover-background: #fff;--l-btn-active-background: #fff;--l-btn-hover-border-color: var(--l-btn-hover-text-color);--l-btn-active-border-color: var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background: var(--l-primary-color, #722ed1);--l-btn-hover-background: var(--l-primary-color-light1, #9254de);--l-btn-active-background: var(--l-primary-color-dark1, #531dab)}.l-btn:not(.l-btn-loading):disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn-text{--l-btn-background: transparent;--l-btn-border-color: transparent;--l-btn-hover-border-color: transparent;--l-btn-active-border-color: transparent;--l-btn-disabled-background: transparent;--l-btn-disabled-border-color: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;height:auto;padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color: var(--l-primary-color, #722ed1);--l-btn-hover-text-color: var(--l-primary-color-light1, #9254de);--l-btn-active-text-color: var(--l-primary-color-dark1, #531dab)}.l-btn-ghost{--l-btn-text-color: var(--l-btn-border-color);--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-active-background: transparent;--l-btn-hover-text-color: var(--l-btn-hover-border-color);--l-btn-active-text-color: var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-edit-height, 32px) / 2)}.l-btn-circle{border-radius:50%;width:var(--l-form-edit-height, 32px);padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background: rgba(255, 255, 255, .08);--l-btn-disabled-color: rgba(255, 255, 255, .3);--l-btn-disabled-border-color: rgba(255, 255, 255, .3)}";
7
7
  class w extends d {
8
8
  static baseName = "button";
9
+ static tagName = "l-button";
9
10
  htmlType = "button";
10
11
  constructor() {
11
12
  super(), s(this);
@@ -35,7 +36,6 @@ class w extends d {
35
36
  const r = this.getAttr("type", "normal"), t = document.createElement("button"), o = this.getAttr("loading", !1), l = this.getAttr("shape", "default"), e = this.getAttr("text", !1), n = this.getAttr("ghost", !1), i = [
36
37
  "l-btn",
37
38
  `l-btn-${r}`,
38
- this.getAttr("block", !1) ? "l-btn-block" : "",
39
39
  l === "round" ? "l-btn-round" : "",
40
40
  l === "circle" ? "l-btn-circle" : "",
41
41
  n ? "l-btn-ghost" : "",
@@ -9,7 +9,7 @@ const D = (g) => {
9
9
  }
10
10
  function p(e) {
11
11
  const o = e.detail.action;
12
- i.onAction != null && i.onAction(o, n), n();
12
+ i.onAction != null && i.onAction(o, n);
13
13
  }
14
14
  function u(e) {
15
15
  if (!i) {
package/lib/index.js CHANGED
@@ -1,104 +1,103 @@
1
- import { config as t, createTransition as r, getPopoverOffsetX as a, getPopoverOffsetY as f, impactDetect as s, initAttr as m, parseAttrValue as p, regist as l, setAttrs as u, tagAttr as d, tagAttrs as x, useId as n } from "./utils/index.js";
2
- import { set as I, remove as i } from "./utils/clickoutside.js";
3
- import { default as h } from "./base.js";
4
- import { default as A } from "./message/index.js";
5
- import { default as P } from "./popover/index.js";
6
- import { default as S } from "./popconfirm/index.js";
7
- import { default as v } from "./dialog/index.js";
8
- import { default as L } from "./dialog/dialog_container.js";
9
- import { default as k } from "./loading/index.js";
10
- import { default as b } from "./icon/base.js";
11
- import { default as M } from "./icon/arrow_down.js";
12
- import { default as U } from "./icon/arrow_left.js";
13
- import { default as W } from "./icon/arrow_right.js";
14
- import { default as Y } from "./icon/arrow_up.js";
15
- import { default as q } from "./icon/caret_top.js";
16
- import { default as E } from "./icon/caret_bottom.js";
17
- import { default as H } from "./icon/font_icon.js";
18
- import { default as K } from "./icon/loading.js";
19
- import { default as Q } from "./icon/search.js";
20
- import { default as _ } from "./icon/sun.js";
21
- import { default as oo } from "./icon/moon.js";
22
- import { default as to } from "./icon/reduction.js";
23
- import { default as ao } from "./icon/refresh_left.js";
24
- import { default as so } from "./icon/refresh_right.js";
25
- import { default as po } from "./icon/sort.js";
26
- import { default as uo } from "./icon/theme_default.js";
27
- import { default as no } from "./icon/close.js";
28
- import { default as Io } from "./icon/info.js";
29
- import { default as go } from "./icon/success.js";
30
- import { default as Co } from "./icon/warn.js";
31
- import { default as wo } from "./form/index.js";
32
- import { default as Ro } from "./form/form_item.js";
33
- import { default as To } from "./radio/index.js";
34
- import { default as Do } from "./checkbox/index.js";
35
- import { default as Oo } from "./button/index.js";
36
- import { default as Bo } from "./input/index.js";
37
- import { default as Fo } from "./select_ori/index.js";
38
- import { default as yo } from "./switch/index.js";
39
- import { default as Vo } from "./md_input/index.js";
40
- import { default as Xo } from "./list/index.js";
41
- import { default as jo } from "./polygon/index.js";
42
- import { default as zo } from "./color_picker/index.js";
43
- import { default as Go } from "./tabbar/index.js";
44
- import { default as Jo } from "./theme/index.js";
45
- import { default as No } from "./theme/theme_color.js";
1
+ import { createTransition as t, getPopoverOffsetX as r, getPopoverOffsetY as a, impactDetect as f, initAttr as s, parseAttrValue as m, regist as p, setAttrs as l, tagAttr as u, tagAttrs as d, useId as x } from "./utils/index.js";
2
+ import { set as c, remove as I } from "./utils/clickoutside.js";
3
+ import { default as g } from "./base.js";
4
+ import { default as C } from "./message/index.js";
5
+ import { default as w } from "./popover/index.js";
6
+ import { default as R } from "./popconfirm/index.js";
7
+ import { default as T } from "./dialog/index.js";
8
+ import { default as D } from "./dialog/dialog_container.js";
9
+ import { default as O } from "./loading/index.js";
10
+ import { default as B } from "./icon/base.js";
11
+ import { default as F } from "./icon/arrow_down.js";
12
+ import { default as y } from "./icon/arrow_left.js";
13
+ import { default as V } from "./icon/arrow_right.js";
14
+ import { default as X } from "./icon/arrow_up.js";
15
+ import { default as j } from "./icon/caret_top.js";
16
+ import { default as z } from "./icon/caret_bottom.js";
17
+ import { default as G } from "./icon/font_icon.js";
18
+ import { default as J } from "./icon/loading.js";
19
+ import { default as N } from "./icon/search.js";
20
+ import { default as Z } from "./icon/sun.js";
21
+ import { default as $ } from "./icon/moon.js";
22
+ import { default as eo } from "./icon/reduction.js";
23
+ import { default as ro } from "./icon/refresh_left.js";
24
+ import { default as fo } from "./icon/refresh_right.js";
25
+ import { default as mo } from "./icon/sort.js";
26
+ import { default as lo } from "./icon/theme_default.js";
27
+ import { default as xo } from "./icon/close.js";
28
+ import { default as co } from "./icon/info.js";
29
+ import { default as io } from "./icon/success.js";
30
+ import { default as ho } from "./icon/warn.js";
31
+ import { default as Ao } from "./form/index.js";
32
+ import { default as Po } from "./form/form_item.js";
33
+ import { default as So } from "./radio/index.js";
34
+ import { default as vo } from "./checkbox/index.js";
35
+ import { default as Lo } from "./button/index.js";
36
+ import { default as ko } from "./input/index.js";
37
+ import { default as bo } from "./select_ori/index.js";
38
+ import { default as Mo } from "./switch/index.js";
39
+ import { default as Uo } from "./md_input/index.js";
40
+ import { default as Wo } from "./list/index.js";
41
+ import { default as Yo } from "./polygon/index.js";
42
+ import { default as qo } from "./color_picker/index.js";
43
+ import { default as Eo } from "./tabbar/index.js";
44
+ import { default as Ho } from "./theme/index.js";
45
+ import { default as Ko } from "./theme/theme_color.js";
46
46
  export {
47
- M as ArrowDownIcon,
48
- U as ArrowLeftIcon,
49
- W as ArrowRightIcon,
50
- Y as ArrowUpIcon,
51
- h as BaseComponent,
52
- b as BaseIcon,
53
- Oo as Button,
54
- E as CaretBottomIcon,
55
- q as CaretTopIcon,
56
- Do as Checkbox,
57
- no as CloseIcon,
58
- zo as ColorPicker,
59
- v as Dialog,
60
- L as DialogContainer,
61
- H as FontIcon,
62
- wo as Form,
63
- Ro as FormItem,
64
- Io as InfoIcon,
65
- Bo as Input,
66
- Xo as List,
67
- k as Loading,
68
- K as LoadingIcon,
69
- Vo as MdInput,
70
- A as Message,
71
- oo as MoonIcon,
72
- jo as Polygon,
73
- S as Popconfirm,
74
- P as Popover,
75
- To as Radio,
76
- to as ReductionIcon,
77
- ao as RefreshLeftIcon,
78
- so as RefreshRightIcon,
79
- Q as SearchIcon,
80
- Fo as SelectOri,
81
- po as SortIcon,
82
- go as SuccessIcon,
83
- _ as SunIcon,
84
- yo as Switch,
85
- Go as Tabbar,
86
- Jo as Theme,
87
- No as ThemeColor,
88
- uo as ThemeDefaultIcon,
89
- Co as WarnIcon,
90
- I as addClickOutside,
91
- t as config,
92
- r as createTransition,
93
- a as getPopoverOffsetX,
94
- f as getPopoverOffsetY,
95
- s as impactDetect,
96
- m as initAttr,
97
- p as parseAttrValue,
98
- l as regist,
99
- i as removeClickOutside,
100
- u as setAttrs,
101
- d as tagAttr,
102
- x as tagAttrs,
103
- n as useId
47
+ F as ArrowDownIcon,
48
+ y as ArrowLeftIcon,
49
+ V as ArrowRightIcon,
50
+ X as ArrowUpIcon,
51
+ g as BaseComponent,
52
+ B as BaseIcon,
53
+ Lo as Button,
54
+ z as CaretBottomIcon,
55
+ j as CaretTopIcon,
56
+ vo as Checkbox,
57
+ xo as CloseIcon,
58
+ qo as ColorPicker,
59
+ T as Dialog,
60
+ D as DialogContainer,
61
+ G as FontIcon,
62
+ Ao as Form,
63
+ Po as FormItem,
64
+ co as InfoIcon,
65
+ ko as Input,
66
+ Wo as List,
67
+ O as Loading,
68
+ J as LoadingIcon,
69
+ Uo as MdInput,
70
+ C as Message,
71
+ $ as MoonIcon,
72
+ Yo as Polygon,
73
+ R as Popconfirm,
74
+ w as Popover,
75
+ So as Radio,
76
+ eo as ReductionIcon,
77
+ ro as RefreshLeftIcon,
78
+ fo as RefreshRightIcon,
79
+ N as SearchIcon,
80
+ bo as SelectOri,
81
+ mo as SortIcon,
82
+ io as SuccessIcon,
83
+ Z as SunIcon,
84
+ Mo as Switch,
85
+ Eo as Tabbar,
86
+ Ho as Theme,
87
+ Ko as ThemeColor,
88
+ lo as ThemeDefaultIcon,
89
+ ho as WarnIcon,
90
+ c as addClickOutside,
91
+ t as createTransition,
92
+ r as getPopoverOffsetX,
93
+ a as getPopoverOffsetY,
94
+ f as impactDetect,
95
+ s as initAttr,
96
+ m as parseAttrValue,
97
+ p as regist,
98
+ I as removeClickOutside,
99
+ l as setAttrs,
100
+ u as tagAttr,
101
+ d as tagAttrs,
102
+ x as useId
104
103
  };
@@ -14,6 +14,7 @@ import FormInner from "../form/form_inner";
14
14
  */
15
15
  export default class Input extends FormInner {
16
16
  static baseName: string;
17
+ static tagName: string;
17
18
  /** 原生 input 的 type */
18
19
  type: string;
19
20
  placeholder: string | undefined;
@@ -5,6 +5,7 @@ import { remove as $, add as b } from "../utils/event.js";
5
5
  import { i as _ } from "../index-391POYEJ.js";
6
6
  class S extends v {
7
7
  static baseName = "input";
8
+ static tagName = "l-input";
8
9
  /** 原生 input 的 type */
9
10
  type = "text";
10
11
  placeholder = void 0;
@@ -1,8 +1,3 @@
1
- type UIConfig = {
2
- /** 注册应用的前缀, 默认: lt */
3
- prefix: string;
4
- };
5
- export declare function config(cfg: Partial<UIConfig>): void;
6
1
  /**
7
2
  * 注册 Web Components 组件
8
3
  * @param component Web Components 组件
@@ -1,21 +1,15 @@
1
1
  import { isBlank as N } from "ph-utils";
2
- import { $, iterate as p, transition as m } from "ph-utils/dom";
3
- let E = -1, y = {
4
- /** 注册应用的前缀 */
5
- prefix: "l"
6
- };
7
- function H(t) {
8
- y = { ...y, ...t };
9
- }
10
- function _(t, r) {
2
+ import { $ as x, iterate as $, transition as y } from "ph-utils/dom";
3
+ let E = -1;
4
+ function H(t, r) {
11
5
  const e = Array.isArray(t) ? t : [t];
12
6
  for (const i of e) {
13
- const n = r || `${y.prefix}-${i.baseName}`;
14
- customElements.get(n) || customElements.define(n, i);
7
+ const s = r || i.tabName || `l-${i.baseName}`;
8
+ customElements.get(s) || customElements.define(s, i);
15
9
  }
16
10
  }
17
- function k() {
18
- return `${y.prefix}-${++E}`;
11
+ function _() {
12
+ return `l-${++E}`;
19
13
  }
20
14
  function I(t, r, e) {
21
15
  if (t == null) return r;
@@ -28,95 +22,95 @@ function I(t, r, e) {
28
22
  return t;
29
23
  }
30
24
  }
31
- function V(t) {
25
+ function k(t) {
32
26
  const r = t.attributes;
33
27
  for (const e of r) {
34
- const { name: i, value: n } = e;
28
+ const { name: i, value: s } = e;
35
29
  if (i.startsWith("data-") || i.startsWith("aria-") || i.startsWith("_") || i.startsWith("$") || ["id", "class", "style"].includes(i))
36
30
  continue;
37
- const s = i.split("-").map((d, h) => h === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), f = I(n, t[s], i), u = Object.getOwnPropertyNames(t);
38
- (t._ignoreInitAttrs || []).includes(s) || (i === "value" ? (t[s] = f, t._resetValue = f) : u.includes(s) && (t[s] = f));
31
+ const n = i.split("-").map((d, h) => h === 0 ? d : d[0].toUpperCase() + d.slice(1)).join(""), u = I(s, t[n], i), f = Object.getOwnPropertyNames(t);
32
+ (t._ignoreInitAttrs || []).includes(n) || (i === "value" ? (t[n] = u, t._resetValue = u) : f.includes(n) && (t[n] = u));
39
33
  }
40
34
  }
41
35
  function W(t, r) {
42
36
  let e = " ";
43
37
  return r === !0 ? e = ` ${t}` : typeof r == "string" && !N(r) && (e = ` ${t}="${r}"`), e;
44
38
  }
45
- function B(t) {
39
+ function C(t) {
46
40
  return t.map((e) => W(e[0], e[1])).join("");
47
41
  }
48
- function F(t, r) {
42
+ function V(t, r) {
49
43
  for (const e of r) {
50
- const i = e[1], n = e[0];
51
- i === !0 ? t.setAttribute(n, "") : typeof i == "string" && !N(i) && t.setAttribute(n, i);
44
+ const i = e[1], s = e[0];
45
+ i === !0 ? t.setAttribute(s, "") : typeof i == "string" && !N(i) && t.setAttribute(s, i);
52
46
  }
53
47
  }
54
- function M() {
48
+ function B() {
55
49
  let t;
56
50
  const r = {
57
51
  attributes: !0,
58
52
  attributeFilter: ["l-transition-emit"]
59
- }, e = (s) => {
60
- for (let f of s)
61
- if (f.type === "attributes" && f.attributeName) {
62
- const u = f.target, c = u.getAttribute(f.attributeName) || "show", d = u.getAttribute("l-transition") || "l", h = u.getAttribute("l-transition-method") || "hide";
63
- c === "show" ? (u.style.removeProperty("display"), m(u, d, "enter")) : m(u, d, "leave", () => {
64
- h === "remove" ? u.remove() : u.style.display = "none";
53
+ }, e = (n) => {
54
+ for (let u of n)
55
+ if (u.type === "attributes" && u.attributeName) {
56
+ const f = u.target, c = f.getAttribute(u.attributeName) || "show", d = f.getAttribute("l-transition") || "l", h = f.getAttribute("l-transition-method") || "hide";
57
+ c === "show" ? (f.style.removeProperty("display"), y(f, d, "enter")) : y(f, d, "leave", () => {
58
+ h === "remove" ? f.remove() : f.style.display = "none";
65
59
  });
66
60
  }
67
61
  };
68
- function i(s) {
69
- s && s.length > 0 && (t == null && (t = new MutationObserver(e)), p(s, (f) => {
70
- const u = f.getAttribute("l-transition");
71
- u && (m(f, u, "enter"), t.observe(f, r));
62
+ function i(n) {
63
+ n && n.length > 0 && (t == null && (t = new MutationObserver(e)), $(n, (u) => {
64
+ const f = u.getAttribute("l-transition");
65
+ f && (y(u, f, "enter"), t.observe(u, r));
72
66
  }));
73
67
  }
74
- function n(s) {
75
- s == null && (s = $("[l-transition]"), i(s));
68
+ function s(n) {
69
+ n == null && (n = x("[l-transition]"), i(n));
76
70
  }
77
71
  function o() {
78
72
  t && (t.disconnect(), t = void 0);
79
73
  }
80
- return { destroy: o, add: i, init: n };
74
+ return { destroy: o, add: i, init: s };
81
75
  }
82
- function w(t, r, e, i, n = 10) {
76
+ function m(t, r, e, i, s = 10) {
83
77
  let o = 0;
84
- 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;
78
+ return e === "top" ? o = r.height + s : e === "bottom" ? o = -(t.height + s) : (e === "left" || e === "right") && (i === "" ? o = r.height / 2 - t.height / 2 : i === "end" && (o = r.height - t.height)), o;
85
79
  }
86
- function x(t, r, e, i, n = 10) {
80
+ function w(t, r, e, i, s = 10) {
87
81
  let o = 0;
88
- 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;
82
+ return e === "left" ? o = r.width + s : e === "right" ? o = -(t.width + s) : (e === "top" || e === "bottom") && (i === "" ? o = r.width / 2 - t.width / 2 : i === "end" && (o = r.width - t.width)), o;
89
83
  }
90
- function U(t, r, e, i, n, o, s, f, u = 10, c = "absolute") {
91
- const d = window.innerHeight + o - 10, h = window.innerWidth + n - 10;
92
- let a = t.top + o - f;
93
- a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", f = w(
84
+ function F(t, r, e, i, s, o, n, u, f = 10, c = "absolute") {
85
+ const d = window.innerHeight + o - 10, h = window.innerWidth + s - 10;
86
+ let a = t.top + o - u;
87
+ a + r.height > d && (e === "left" || e === "right" ? i = "end" : e = "top", u = m(
94
88
  t,
95
89
  r,
96
90
  e,
97
91
  i,
98
- u
99
- ), a = t.top + o - f), a < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
100
- let b = t.left + n - s;
101
- return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left", s = x(
92
+ f
93
+ ), a = t.top + o - u), a < o && (e === "left" || e === "right" ? i = "start" : e = "bottom");
94
+ let b = t.left + s - n;
95
+ return b + r.width > h && (e === "top" || e === "bottom" ? i = "end" : e = "left", n = w(
102
96
  t,
103
97
  r,
104
98
  e,
105
99
  i,
106
- u
107
- ), b = t.left + n - s), b < n && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (f = w(
100
+ f
101
+ ), b = t.left + s - n), b < s && (e === "top" || e === "bottom" ? i = "start" : e = "right"), c === "fixed" && (u = m(
108
102
  t,
109
103
  r,
110
104
  e,
111
105
  i,
112
- u
113
- ), s = x(
106
+ f
107
+ ), n = w(
114
108
  t,
115
109
  r,
116
110
  e,
117
111
  i,
118
- u
119
- ), b = t.left + n - s, a = t.top + o - f), {
112
+ f
113
+ ), b = t.left + s - n, a = t.top + o - u), {
120
114
  x: b,
121
115
  y: a,
122
116
  mainAlign: e,
@@ -124,16 +118,15 @@ function U(t, r, e, i, n, o, s, f, u = 10, c = "absolute") {
124
118
  };
125
119
  }
126
120
  export {
127
- H as config,
128
- M as createTransition,
129
- x as getPopoverOffsetX,
130
- w as getPopoverOffsetY,
131
- U as impactDetect,
132
- V as initAttr,
121
+ B as createTransition,
122
+ w as getPopoverOffsetX,
123
+ m as getPopoverOffsetY,
124
+ F as impactDetect,
125
+ k as initAttr,
133
126
  I as parseAttrValue,
134
- _ as regist,
135
- F as setAttrs,
127
+ H as regist,
128
+ V as setAttrs,
136
129
  W as tagAttr,
137
- B as tagAttrs,
138
- k as useId
130
+ C as tagAttrs,
131
+ _ as useId
139
132
  };
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "litos-ui",
3
3
  "description": "基于 Web Component 的 UI 组件库",
4
- "version": "0.11.0",
4
+ "version": "0.11.1",
5
5
  "type": "module",
6
6
  "devDependencies": {
7
- "@eslint/js": "^9.21.0",
8
- "@eslint/markdown": "^6.2.2",
9
- "@types/node": "^22.13.5",
10
- "eslint": "^9.21.0",
7
+ "@eslint/js": "^9.22.0",
8
+ "@eslint/markdown": "^6.3.0",
9
+ "@types/node": "^22.13.10",
10
+ "eslint": "^9.22.0",
11
11
  "globals": "^16.0.0",
12
12
  "less": "^4.2.2",
13
- "lightningcss": "^1.29.1",
14
- "prettier": "^3.5.2",
15
- "typescript": "^5.7.3",
16
- "typescript-eslint": "^8.24.1",
17
- "vite": "^6.1.1",
18
- "vite-plugin-dts": "^4.5.0",
13
+ "lightningcss": "^1.29.3",
14
+ "prettier": "^3.5.3",
15
+ "typescript": "^5.8.2",
16
+ "typescript-eslint": "^8.26.1",
17
+ "vite": "^6.2.2",
18
+ "vite-plugin-dts": "^4.5.3",
19
19
  "vitepress": "^1.6.3"
20
20
  },
21
21
  "files": [
@@ -52,8 +52,8 @@
52
52
  },
53
53
  "license": "MIT",
54
54
  "dependencies": {
55
- "ph-utils": "^0.13.1",
56
- "shiki": "^3.0.0"
55
+ "ph-utils": "^0.15.0",
56
+ "shiki": "^3.2.1"
57
57
  },
58
58
  "scripts": {
59
59
  "dev": "vite dev",
package/styles/dialog.css CHANGED
@@ -1,56 +1,56 @@
1
- .l-dialog {
2
- --l-dialog-translate: translate3d(0, 80px, 0);
3
- --l-dialog-width: 30%;
4
- transform: scale3d(0, 0, 0);
5
- border: none;
6
- outline: none;
7
- opacity: 0;
8
- width: var(--l-dialog-width);
9
- margin: 0 auto;
10
- transition:
11
- transform 0.3s,
12
- opacity 0.3s;
13
- max-width: 100%;
14
- background-color: transparent;
15
- }
16
- .l-dialog-close-outside {
17
- --l-dialog-translate: translate3d(5px, 90px, 0);
18
- }
19
- .l-dialog--vertical-middle {
20
- --l-dialog-translate: translate3d(0, 0, 0);
21
- margin: auto;
22
- }
23
- .l-dialog-close-outside.l-dialog--vertical-middle {
24
- --l-dialog-translate: translate3d(5px, 0, 0);
25
- }
26
- .l-dialog--vertical-bottom {
27
- --l-dialog-translate: translate3d(0, -100%, 0);
28
- top: 100%;
29
- border-bottom-left-radius: 0;
30
- border-bottom-right-radius: 0;
31
- }
32
- .l-dialog-close-outside.l-dialog--vertical-bottom {
33
- --l-dialog-translate: translate3d(5px, -100%, 0);
34
- }
35
- .l-dialog::backdrop {
36
- background-color: rgba(0, 0, 0, 0.7);
37
- opacity: 0;
38
- transition: opacity 0.3s;
39
- }
40
- .l-dialog--open {
41
- transform: scale3d(1, 1, 1) var(--l-dialog-translate);
42
- opacity: 1;
43
- }
44
- .l-dialog--open::backdrop {
45
- opacity: 1;
46
- }
47
- .l-body--dialog-open {
48
- overflow: hidden;
49
- }
50
-
51
- @media screen and (max-width: 768px) {
52
- .l-dialog {
53
- width: 80%;
54
- max-width: 300px;
55
- }
56
- }
1
+ .l-dialog {
2
+ --l-dialog-translate: translate3d(0, 80px, 0);
3
+ --l-dialog-width: 30%;
4
+ transform: scale3d(0, 0, 0);
5
+ border: none;
6
+ outline: none;
7
+ opacity: 0;
8
+ width: var(--l-dialog-width);
9
+ margin: 0 auto;
10
+ transition:
11
+ transform 0.3s,
12
+ opacity 0.3s;
13
+ max-width: 100%;
14
+ background-color: transparent;
15
+ }
16
+ .l-dialog-close-outside {
17
+ --l-dialog-translate: translate3d(5px, 90px, 0);
18
+ }
19
+ .l-dialog--vertical-middle {
20
+ --l-dialog-translate: translate3d(0, 0, 0);
21
+ margin: auto;
22
+ }
23
+ .l-dialog-close-outside.l-dialog--vertical-middle {
24
+ --l-dialog-translate: translate3d(5px, 0, 0);
25
+ }
26
+ .l-dialog--vertical-bottom {
27
+ --l-dialog-translate: translate3d(0, -100%, 0);
28
+ top: 100%;
29
+ border-bottom-left-radius: 0;
30
+ border-bottom-right-radius: 0;
31
+ }
32
+ .l-dialog-close-outside.l-dialog--vertical-bottom {
33
+ --l-dialog-translate: translate3d(5px, -100%, 0);
34
+ }
35
+ .l-dialog::backdrop {
36
+ background-color: rgba(0, 0, 0, 0.7);
37
+ opacity: 0;
38
+ transition: opacity 0.3s;
39
+ }
40
+ .l-dialog--open {
41
+ transform: scale3d(1, 1, 1) var(--l-dialog-translate);
42
+ opacity: 1;
43
+ }
44
+ .l-dialog--open::backdrop {
45
+ opacity: 1;
46
+ }
47
+ .l-body--dialog-open {
48
+ overflow: hidden;
49
+ }
50
+
51
+ @media screen and (max-width: 768px) {
52
+ .l-dialog {
53
+ width: 80%;
54
+ max-width: 300px;
55
+ }
56
+ }
@@ -1,100 +1,100 @@
1
- .l-loading:not(.l-loading-fullscreen) {
2
- position: relative;
3
- }
4
- .l-loading-mask {
5
- position: absolute;
6
- top: 0;
7
- right: 0;
8
- bottom: 0;
9
- left: 0;
10
- background: rgba(0, 0, 0, 0.6);
11
- border-radius: inherit;
12
- display: flex;
13
- justify-content: center;
14
- align-items: center;
15
- transition: opacity 0.3s ease-in-out;
16
- opacity: 0;
17
- }
18
-
19
- .l-loading-spinner {
20
- text-align: center;
21
- }
22
- .l-loading-spinner .circle {
23
- display: inline;
24
- width: 40px;
25
- height: 40px;
26
- animation: loading-rotate 1.5s linear infinite;
27
- }
28
-
29
- .l-loading-spinner .path {
30
- stroke: var(--l-primary-color, #722ed1);
31
- stroke-width: 2px;
32
- stroke-linecap: round;
33
- stroke-linejoin: round;
34
- stroke-dasharray: 90, 150;
35
- stroke-dashoffset: 0px;
36
- }
37
-
38
- .l-loading-spinner .l-loading-text {
39
- color: var(--l-primary-color, #722ed1);
40
- margin: 0;
41
- font-size: 14px;
42
- }
43
-
44
- /* 全屏组件 */
45
- .l-loading-fullscreen.l-loading-lock {
46
- overflow: hidden;
47
- }
48
- .l-loading-fullscreen > .l-loading-mask {
49
- position: fixed;
50
- z-index: 100;
51
- }
52
-
53
- /* 进度条样式 */
54
- .l-loading-bar.l-loading-mask {
55
- bottom: auto;
56
- height: 2px;
57
- border-radius: inherit;
58
- background-color: transparent;
59
- justify-content: flex-start;
60
- opacity: 1;
61
- }
62
- .l-loading-bar > .l-loading-spinner {
63
- width: 100%;
64
- height: 100%;
65
- max-width: 0;
66
- opacity: 1;
67
- transition:
68
- max-width 4s linear,
69
- background-color 0.2s linear,
70
- opacity 0.2s linear;
71
- background-color: var(--l-primary-color, #722ed1);
72
- }
73
- .l-loading-bar--start .l-loading-spinner {
74
- max-width: 90%;
75
- }
76
-
77
- .l-loading-bar--finish .l-loading-spinner {
78
- transition:
79
- max-width 0.2s linear,
80
- background-color 0.2s linear,
81
- opacity 0.2s linear;
82
- max-width: 100%;
83
- opacity: 0;
84
- }
85
-
86
- .l-loading-bar--error .l-loading-spinner {
87
- transition:
88
- max-width 0.2s linear,
89
- background-color 0.2s linear,
90
- opacity 0.2s linear;
91
- max-width: 100%;
92
- background-color: var(--l-error-color, #d03050);
93
- opacity: 0;
94
- }
95
-
96
- @keyframes loading-rotate {
97
- 100% {
98
- transform: rotate3d(0, 0, 1, 360deg);
99
- }
100
- }
1
+ .l-loading:not(.l-loading-fullscreen) {
2
+ position: relative;
3
+ }
4
+ .l-loading-mask {
5
+ position: absolute;
6
+ top: 0;
7
+ right: 0;
8
+ bottom: 0;
9
+ left: 0;
10
+ background: rgba(0, 0, 0, 0.6);
11
+ border-radius: inherit;
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ transition: opacity 0.3s ease-in-out;
16
+ opacity: 0;
17
+ }
18
+
19
+ .l-loading-spinner {
20
+ text-align: center;
21
+ }
22
+ .l-loading-spinner .circle {
23
+ display: inline;
24
+ width: 40px;
25
+ height: 40px;
26
+ animation: loading-rotate 1.5s linear infinite;
27
+ }
28
+
29
+ .l-loading-spinner .path {
30
+ stroke: var(--l-primary-color, #722ed1);
31
+ stroke-width: 2px;
32
+ stroke-linecap: round;
33
+ stroke-linejoin: round;
34
+ stroke-dasharray: 90, 150;
35
+ stroke-dashoffset: 0px;
36
+ }
37
+
38
+ .l-loading-spinner .l-loading-text {
39
+ color: var(--l-primary-color, #722ed1);
40
+ margin: 0;
41
+ font-size: 14px;
42
+ }
43
+
44
+ /* 全屏组件 */
45
+ .l-loading-fullscreen.l-loading-lock {
46
+ overflow: hidden;
47
+ }
48
+ .l-loading-fullscreen > .l-loading-mask {
49
+ position: fixed;
50
+ z-index: 100;
51
+ }
52
+
53
+ /* 进度条样式 */
54
+ .l-loading-bar.l-loading-mask {
55
+ bottom: auto;
56
+ height: 2px;
57
+ border-radius: inherit;
58
+ background-color: transparent;
59
+ justify-content: flex-start;
60
+ opacity: 1;
61
+ }
62
+ .l-loading-bar > .l-loading-spinner {
63
+ width: 100%;
64
+ height: 100%;
65
+ max-width: 0;
66
+ opacity: 1;
67
+ transition:
68
+ max-width 4s linear,
69
+ background-color 0.2s linear,
70
+ opacity 0.2s linear;
71
+ background-color: var(--l-primary-color, #722ed1);
72
+ }
73
+ .l-loading-bar--start .l-loading-spinner {
74
+ max-width: 90%;
75
+ }
76
+
77
+ .l-loading-bar--finish .l-loading-spinner {
78
+ transition:
79
+ max-width 0.2s linear,
80
+ background-color 0.2s linear,
81
+ opacity 0.2s linear;
82
+ max-width: 100%;
83
+ opacity: 0;
84
+ }
85
+
86
+ .l-loading-bar--error .l-loading-spinner {
87
+ transition:
88
+ max-width 0.2s linear,
89
+ background-color 0.2s linear,
90
+ opacity 0.2s linear;
91
+ max-width: 100%;
92
+ background-color: var(--l-error-color, #d03050);
93
+ opacity: 0;
94
+ }
95
+
96
+ @keyframes loading-rotate {
97
+ 100% {
98
+ transform: rotate3d(0, 0, 1, 360deg);
99
+ }
100
+ }