litos-ui 0.22.0 → 0.23.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.
- package/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/lib/button/style.js +4 -2
- package/lib/dialog/dialog_container.d.ts +1 -0
- package/lib/dialog/dialog_container.js +71 -60
- package/lib/dialog/dialog_container_style.js +4 -2
- package/lib/dialog/index.d.ts +1 -0
- package/lib/dialog/index.js +10 -5
- package/lib/entries/notification-box.d.ts +2 -0
- package/lib/entries/notification-box.js +2 -0
- package/lib/entries/notification.d.ts +0 -5
- package/lib/entries/notification.js +2 -6
- package/lib/icon/icon_style.js +4 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/input_number/style.js +4 -2
- package/lib/notification/index.d.ts +0 -41
- package/lib/notification/index.js +28 -82
- package/lib/notification/notification_box.d.ts +40 -0
- package/lib/notification/notification_box.js +57 -0
- package/lib/notification/placement.d.ts +2 -2
- package/lib/notification/placement.js +3 -3
- package/lib/notification/style.js +4 -2
- package/lib/styles/animation/index.js +4 -2
- package/lib/styles/mask/index.js +4 -2
- package/lib/upload/style.js +4 -2
- package/package.json +1 -1
- package/styles/dark.css +33 -0
- package/styles/vars.css +0 -34
package/README.md
CHANGED
|
@@ -47,9 +47,11 @@ import "litos-ui/styles/theme-jade.css";
|
|
|
47
47
|
|
|
48
48
|
Presets define global CSS variables on `:root`. Choose one preset; importing several makes the last loaded theme override the earlier ones. Omit the preset import to use the default blue theme. You can also override individual variables in your own stylesheet.
|
|
49
49
|
|
|
50
|
-
Dark mode variables are
|
|
50
|
+
Dark mode variables are in the separate `dark.css` file. Import it after `vars.css`, then toggle the root element's `dark` class from client-side code:
|
|
51
51
|
|
|
52
52
|
```js
|
|
53
|
+
import "litos-ui/styles/dark.css";
|
|
54
|
+
|
|
53
55
|
document.documentElement.classList.add("dark");
|
|
54
56
|
// Restore light mode:
|
|
55
57
|
document.documentElement.classList.remove("dark");
|
package/README.zh-CN.md
CHANGED
|
@@ -47,9 +47,11 @@ import "litos-ui/styles/theme-jade.css";
|
|
|
47
47
|
|
|
48
48
|
预置主题通过 `:root` 定义全局 CSS 变量。一次选择一套,同时引入多套时,后加载的主题会覆盖先加载的主题。不引入预置主题时,使用默认蓝色主题,也可以在自己的样式文件中覆盖单个变量。
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
暗黑模式变量独立放在 `dark.css` 中。在 `vars.css` 之后引入,再通过客户端代码切换根元素的 `dark` 类:
|
|
51
51
|
|
|
52
52
|
```js
|
|
53
|
+
import "litos-ui/styles/dark.css";
|
|
54
|
+
|
|
53
55
|
document.documentElement.classList.add("dark");
|
|
54
56
|
// 恢复浅色模式:
|
|
55
57
|
document.documentElement.classList.remove("dark");
|
package/lib/button/style.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.less_inline.js";
|
|
2
2
|
//#region src/components/button/style.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
|
@@ -31,6 +31,7 @@ export default class DialogContainer extends BaseComponent<DialogContainerState>
|
|
|
31
31
|
beforeDestroy(): void;
|
|
32
32
|
static get observedAttributes(): string[] | null | undefined;
|
|
33
33
|
protected attributeChanged(name: string, oldValue: string, newValue: string): void;
|
|
34
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
34
35
|
render_v2(): {
|
|
35
36
|
template: DocumentFragment;
|
|
36
37
|
styleSheets: CSSStyleSheet[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import e from "../base.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
2
|
+
import { parseAttrValue as t } from "../utils/index.js";
|
|
3
|
+
import n from "./dialog_container_style.js";
|
|
4
|
+
import { $ as r, $$ as i, $one as a, formatClass as o, iterate as s, off as c, on as l, shouldEventNext as u } from "utilane/browser";
|
|
4
5
|
//#region src/components/dialog/dialog_container.ts
|
|
5
|
-
var
|
|
6
|
+
var d = class extends e {
|
|
6
7
|
static baseName = "dialog-container";
|
|
7
8
|
constructor() {
|
|
8
9
|
super(), this.version = 2, this._state = {
|
|
@@ -19,19 +20,19 @@ var u = class extends e {
|
|
|
19
20
|
}
|
|
20
21
|
afterInit() {
|
|
21
22
|
this._state.close === 2 && this.classList.add("l-container-close-outside");
|
|
22
|
-
let e =
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let e = r("[data-action]", this.root);
|
|
24
|
+
s(e, (e) => {
|
|
25
|
+
l(e, "click", this.#e);
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
beforeDestroy() {
|
|
28
|
-
let e =
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
let e = r("[data-action]", this.root);
|
|
30
|
+
s(e, (e) => {
|
|
31
|
+
c(e, "click", this.#e);
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
#e(e) {
|
|
34
|
-
let [t, n] =
|
|
35
|
+
let [t, n] = u(e, "data-action");
|
|
35
36
|
t && this.emit("dialogAction", { detail: { action: n } });
|
|
36
37
|
}
|
|
37
38
|
static get observedAttributes() {
|
|
@@ -49,108 +50,118 @@ var u = class extends e {
|
|
|
49
50
|
"confirm-loading"
|
|
50
51
|
];
|
|
51
52
|
}
|
|
52
|
-
attributeChanged(e,
|
|
53
|
+
attributeChanged(e, n, r) {
|
|
53
54
|
switch (e) {
|
|
54
55
|
case "show-header":
|
|
55
|
-
this._state.showHeader =
|
|
56
|
+
this._state.showHeader = t(r, !0, e), this.connectedCallback();
|
|
56
57
|
break;
|
|
57
58
|
case "header":
|
|
58
|
-
this._state.header =
|
|
59
|
+
this._state.header = r || void 0, this.connectedCallback();
|
|
59
60
|
break;
|
|
60
61
|
case "show-footer":
|
|
61
|
-
this._state.showFooter =
|
|
62
|
+
this._state.showFooter = t(r, !0, e);
|
|
62
63
|
break;
|
|
63
64
|
case "show-cancel":
|
|
64
|
-
this._state.showCancel =
|
|
65
|
+
this._state.showCancel = t(r, !0, e), this.connectedCallback();
|
|
65
66
|
break;
|
|
66
67
|
case "cancel-text":
|
|
67
|
-
this._state.cancelText =
|
|
68
|
+
this._state.cancelText = r || "取消", this.connectedCallback();
|
|
68
69
|
break;
|
|
69
70
|
case "show-ok":
|
|
70
|
-
this._state.showOk =
|
|
71
|
+
this._state.showOk = t(r, !0, e), this.connectedCallback();
|
|
71
72
|
break;
|
|
72
73
|
case "ok-text":
|
|
73
|
-
this._state.okText =
|
|
74
|
+
this._state.okText = r || "确定", this.connectedCallback();
|
|
74
75
|
break;
|
|
75
76
|
case "close":
|
|
76
|
-
this._state.close = Number(
|
|
77
|
-
let
|
|
78
|
-
this._state.close === 0 &&
|
|
77
|
+
this._state.close = Number(r), this._state.close === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
|
|
78
|
+
let n = a(".l-btn-dialog-close", this.root);
|
|
79
|
+
this._state.close === 0 && n ? (c(n, "click", this.#e), n.remove()) : n ? n.className = this.#t() : (n = this.#n(), l(n, "click", this.#e), this.root.appendChild(n));
|
|
79
80
|
break;
|
|
80
81
|
case "container-class":
|
|
81
|
-
this._state.containerClass =
|
|
82
|
+
this._state.containerClass = r || void 0, this.connectedCallback();
|
|
82
83
|
break;
|
|
83
84
|
case "mobile":
|
|
84
|
-
this._state.mobile =
|
|
85
|
+
this._state.mobile = t(r, !1, e), this.connectedCallback();
|
|
85
86
|
break;
|
|
86
87
|
case "confirm-loading":
|
|
87
|
-
this._state.confirmLoading =
|
|
88
|
-
let
|
|
89
|
-
|
|
88
|
+
this._state.confirmLoading = t(r, !1, e);
|
|
89
|
+
let i = a("[data-action=\"ok\"]", this.root);
|
|
90
|
+
i && i.setAttribute("loading", this._state.confirmLoading.toString());
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
#t() {
|
|
93
94
|
return `l-btn-dialog-close l-dialog-close${this._state.close}`;
|
|
94
95
|
}
|
|
95
96
|
#n() {
|
|
96
|
-
let e =
|
|
97
|
+
let e = i("l-button", {
|
|
97
98
|
shape: "circle",
|
|
98
99
|
type: "normal",
|
|
99
100
|
class: this.#t(),
|
|
100
101
|
"data-action": "close",
|
|
101
102
|
part: "close-icon"
|
|
102
|
-
}), t =
|
|
103
|
+
}), t = i("l-close-icon");
|
|
104
|
+
return e.appendChild(t), e;
|
|
105
|
+
}
|
|
106
|
+
updateDOM(e) {
|
|
107
|
+
if (e.has("show-footer")) {
|
|
108
|
+
let e = a(".l-dialog-footer", this.root);
|
|
109
|
+
if (!this._state.showFooter) e && e.remove();
|
|
110
|
+
else if (!e) {
|
|
111
|
+
let e = a(".l-dialog-main", this.root);
|
|
112
|
+
e && e.appendChild(this.#r());
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
#r() {
|
|
117
|
+
let e = i("div", {
|
|
118
|
+
class: "l-dialog-footer",
|
|
119
|
+
part: "footer"
|
|
120
|
+
}), t = i("slot", { name: "footer" });
|
|
121
|
+
if (this._state.showCancel) {
|
|
122
|
+
let e = i("l-button", {
|
|
123
|
+
"data-action": "cancel",
|
|
124
|
+
text: this._state.mobile
|
|
125
|
+
});
|
|
126
|
+
e.textContent = this._state.cancelText, t.appendChild(e);
|
|
127
|
+
}
|
|
128
|
+
if (this._state.showOk) {
|
|
129
|
+
let e = i("l-button", {
|
|
130
|
+
type: "primary",
|
|
131
|
+
"data-action": "ok",
|
|
132
|
+
loading: this._state.confirmLoading,
|
|
133
|
+
text: this._state.mobile
|
|
134
|
+
});
|
|
135
|
+
e.textContent = this._state.okText, t.appendChild(e);
|
|
136
|
+
}
|
|
103
137
|
return e.appendChild(t), e;
|
|
104
138
|
}
|
|
105
139
|
render_v2() {
|
|
106
140
|
return {
|
|
107
141
|
template: this.render(),
|
|
108
|
-
styleSheets: [
|
|
142
|
+
styleSheets: [n]
|
|
109
143
|
};
|
|
110
144
|
}
|
|
111
145
|
render() {
|
|
112
146
|
let e = document.createDocumentFragment();
|
|
113
147
|
this._state.close !== 0 && e.appendChild(this.#n());
|
|
114
|
-
let t =
|
|
148
|
+
let t = i("div", {
|
|
115
149
|
class: ["l-dialog-main", this._state.mobile ? "l-dialog-main--mobile" : ""],
|
|
116
150
|
part: "main"
|
|
117
151
|
});
|
|
118
152
|
if (this._state.showHeader) {
|
|
119
|
-
let e =
|
|
153
|
+
let e = i("header", {
|
|
120
154
|
class: "l-dialog-header",
|
|
121
155
|
part: "header"
|
|
122
|
-
}), n =
|
|
156
|
+
}), n = i("slot", { name: "header" });
|
|
123
157
|
n.textContent = this._state.header || "", e.appendChild(n), t.appendChild(e);
|
|
124
158
|
}
|
|
125
|
-
let n =
|
|
126
|
-
class:
|
|
159
|
+
let n = i("div", {
|
|
160
|
+
class: o(["l-dialog-container", this._state.containerClass]),
|
|
127
161
|
part: "container"
|
|
128
|
-
}),
|
|
129
|
-
|
|
130
|
-
let e = r("div", {
|
|
131
|
-
class: "l-dialog-footer",
|
|
132
|
-
part: "footer"
|
|
133
|
-
}), n = r("slot", { name: "footer" });
|
|
134
|
-
if (this._state.showCancel) {
|
|
135
|
-
let e = r("l-button", {
|
|
136
|
-
"data-action": "cancel",
|
|
137
|
-
text: this._state.mobile
|
|
138
|
-
});
|
|
139
|
-
e.textContent = this._state.cancelText, n.appendChild(e);
|
|
140
|
-
}
|
|
141
|
-
if (this._state.showOk) {
|
|
142
|
-
let e = r("l-button", {
|
|
143
|
-
type: "primary",
|
|
144
|
-
"data-action": "ok",
|
|
145
|
-
loading: this._state.confirmLoading,
|
|
146
|
-
text: this._state.mobile
|
|
147
|
-
});
|
|
148
|
-
e.textContent = this._state.okText, n.appendChild(e);
|
|
149
|
-
}
|
|
150
|
-
e.appendChild(n), t.appendChild(e);
|
|
151
|
-
}
|
|
152
|
-
return e.appendChild(t), e;
|
|
162
|
+
}), r = i("slot");
|
|
163
|
+
return n.appendChild(r), t.appendChild(n), this._state.showFooter && t.appendChild(this.#r()), e.appendChild(t), e;
|
|
153
164
|
}
|
|
154
165
|
};
|
|
155
166
|
//#endregion
|
|
156
|
-
export {
|
|
167
|
+
export { d as default };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./dialog_container.css_inline.js";
|
|
2
2
|
//#region src/components/dialog/dialog_container_style.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
package/lib/dialog/index.d.ts
CHANGED
package/lib/dialog/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var s = class {
|
|
|
4
4
|
$dialog;
|
|
5
5
|
$container;
|
|
6
6
|
config;
|
|
7
|
+
finishClose;
|
|
7
8
|
constructor(e) {
|
|
8
9
|
e != null && this.init(e);
|
|
9
10
|
}
|
|
@@ -39,15 +40,19 @@ var s = class {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
open() {
|
|
42
|
-
this.$dialog && (this.$dialog.showModal(), t(this.$dialog, "l-dialog--open"), t(document.body, "l-body--dialog-open"));
|
|
43
|
+
this.$dialog && (this.finishClose &&= (i(this.$dialog, "transitionend", this.finishClose), void 0), this.$dialog.showModal(), t(this.$dialog, "l-dialog--open"), t(document.body, "l-body--dialog-open"));
|
|
43
44
|
}
|
|
44
45
|
close() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
let e = this.$dialog;
|
|
47
|
+
if (e && !this.finishClose && r(e, "l-dialog--open")) {
|
|
48
|
+
let t = (n) => {
|
|
49
|
+
n && n.target !== e || this.finishClose === t && (i(e, "transitionend", t), this.finishClose = void 0, e.open && e.close(), o(document.body, "l-body--dialog-open"));
|
|
50
|
+
};
|
|
51
|
+
this.finishClose = t, a(e, "transitionend", t), o(e, "l-dialog--open");
|
|
52
|
+
}
|
|
48
53
|
}
|
|
49
54
|
destroy() {
|
|
50
|
-
this.$dialog &&= (this.close(), i(this.$dialog, "keydown", this.handleKeydown), i(this.$dialog, "click", this.handleClick), this.$container && i(this.$container, "dialogAction", this.handleContainerAction), this.$container = void 0, void 0);
|
|
55
|
+
this.$dialog &&= (this.close(), this.finishClose?.(), i(this.$dialog, "keydown", this.handleKeydown), i(this.$dialog, "click", this.handleClick), this.$container && i(this.$container, "dialogAction", this.handleContainerAction), this.$container = void 0, void 0);
|
|
51
56
|
}
|
|
52
57
|
setProp(e, t) {
|
|
53
58
|
if (this.config && (this.config[e] = t, this.$dialog)) {
|
package/lib/icon/icon_style.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.less_inline.js";
|
|
2
2
|
//#region src/components/icon/icon_style.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
package/lib/index.d.ts
CHANGED
|
@@ -90,5 +90,6 @@ export { default as Calendar } from "./calendar";
|
|
|
90
90
|
export { default as Upload } from "./upload";
|
|
91
91
|
export { defaultUploadResponseParser } from "./upload";
|
|
92
92
|
export type { UploadFile, UploadResponseContext, UploadResponseParser, UploadRequestOptions, UploadRequestResult, UploadRequestHandler, } from "./upload";
|
|
93
|
+
export { default as NotificationBox } from "./notification/notification_box";
|
|
93
94
|
export { default as Notification } from "./notification";
|
|
94
95
|
export type { NotificationOptions, NotificationType, NotificationPlacement } from "./notification";
|
package/lib/index.js
CHANGED
|
@@ -86,5 +86,6 @@ import Ge from "./space/index.js";
|
|
|
86
86
|
import Ke from "./card/index.js";
|
|
87
87
|
import qe from "./calendar/index.js";
|
|
88
88
|
import Je, { defaultUploadResponseParser as Ye } from "./upload/index.js";
|
|
89
|
-
import Xe from "./notification/
|
|
90
|
-
|
|
89
|
+
import Xe from "./notification/notification_box.js";
|
|
90
|
+
import Ze from "./notification/index.js";
|
|
91
|
+
export { A as ArrowDownIcon, j as ArrowLeftIcon, M as ArrowRightIcon, N as ArrowUpIcon, e as BaseComponent, p as BaseIcon, x as Button, qe as Calendar, Q as CalendarIcon, Ke as Card, F as CaretBottomIcon, P as CaretTopIcon, Me as Carousel, Ne as CarouselItem, le as Checkbox, ue as CheckboxGroup, m as CloseFilledIcon, S as CloseIcon, Be as Collapse, Ve as CollapseItem, we as ColorPicker, ee as CopyIcon, q as DArrowLeftIcon, J as DArrowRightIcon, Se as DatePicker, Ce as DatePickerOri, ie as DeleteIcon, Fe as DescriptionPanel, y as Dialog, T as DialogBox, b as DialogContainer, re as EyeOutlineIcon, I as FontIcon, oe as Form, C as FormItem, He as Image, Ue as ImagePreview, _ as InfoIcon, w as Input, de as InputNumber, Te as List, E as Loading, L as LoadingIcon, Le as Mask, me as MdInput, je as Menu, v as Message, ne as MinusIcon, O as Modal, k as ModalBox, B as MoonIcon, K as MoreIcon, Ze as Notification, Xe as NotificationBox, Re as PageHeader, Ie as Pagination, ae as PictureIcon, te as PlusIcon, Ee as Polygon, he as Popover, Pe as Qrcode, ce as Radio, se as RadioGroup, V as ReductionIcon, $ as RefreshIcon, H as RefreshLeftIcon, U as RefreshRightIcon, R as SearchIcon, xe as Select, Z as SelectIcon, fe as SelectOri, W as SortIcon, Ge as Space, h as SuccessIcon, z as SunIcon, pe as Switch, De as Tabbar, Oe as TabbarItem, We as Table, D as Tabs, ze as Tag, ke as Theme, Ae as ThemeColor, G as ThemeDefaultIcon, Je as Upload, g as WarnIcon, Y as ZoomInIcon, X as ZoomOutIcon, f as addClickOutside, ge as autoUpdate, _e as createPopoverObserver, Ye as defaultUploadResponseParser, ve as getOverflowAncestors, t as initAttr, n as kebabToCamel, r as parseAttrValue, ye as popconfirmProps, i as regist, d as removeClickOutside, a as setAttrs, o as stopSignal, s as tagAttr, c as tagAttrs, l as unitNumberStr, be as updatePosition, u as useId };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.less_inline.js";
|
|
2
2
|
//#region src/components/input_number/style.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
|
@@ -54,48 +54,8 @@ type NotificationState = {
|
|
|
54
54
|
action: string;
|
|
55
55
|
customClass: string;
|
|
56
56
|
};
|
|
57
|
-
/**
|
|
58
|
-
* 设置全局默认配置, 之后创建的通知都会使用该配置
|
|
59
|
-
* @param option 配置项
|
|
60
|
-
*/
|
|
61
|
-
declare function configNotification(option: NotificationOptions): void;
|
|
62
|
-
/**
|
|
63
|
-
* 创建一条通知
|
|
64
|
-
* @param option 通知内容或配置项
|
|
65
|
-
* @param type 状态类型, 会覆盖配置项中的 `type`
|
|
66
|
-
* @returns 通知 id, 可以配合 `Notification.close` 手动关闭
|
|
67
|
-
*/
|
|
68
|
-
declare function showNotification(option: string | NotificationOptions, type?: NotificationType): string;
|
|
69
|
-
/**
|
|
70
|
-
* 关闭指定 id 的通知
|
|
71
|
-
* @param id 通知 id
|
|
72
|
-
*/
|
|
73
|
-
declare function closeNotification(id: string): void;
|
|
74
|
-
/**
|
|
75
|
-
* 关闭所有通知
|
|
76
|
-
* @param placement 只关闭指定方位的通知, 不传递则关闭所有方位
|
|
77
|
-
*/
|
|
78
|
-
declare function closeAllNotification(placement?: NotificationPlacement): void;
|
|
79
57
|
export default class Notification extends BaseComponent<NotificationState> {
|
|
80
58
|
static baseName: string;
|
|
81
|
-
/** 显示通知, 返回通知 id */
|
|
82
|
-
static show: typeof showNotification;
|
|
83
|
-
/** 显示普通通知 */
|
|
84
|
-
static info: (option: string | NotificationOptions) => string;
|
|
85
|
-
/** 显示成功通知 */
|
|
86
|
-
static success: (option: string | NotificationOptions) => string;
|
|
87
|
-
/** 显示错误通知 */
|
|
88
|
-
static error: (option: string | NotificationOptions) => string;
|
|
89
|
-
/** 显示警告通知 */
|
|
90
|
-
static warning: (option: string | NotificationOptions) => string;
|
|
91
|
-
/** 显示警告通知, `warning` 的别名 */
|
|
92
|
-
static warn: (option: string | NotificationOptions) => string;
|
|
93
|
-
/** 关闭指定 id 的通知 */
|
|
94
|
-
static close: typeof closeNotification;
|
|
95
|
-
/** 关闭所有通知 */
|
|
96
|
-
static closeAll: typeof closeAllNotification;
|
|
97
|
-
/** 设置全局默认配置 */
|
|
98
|
-
static config: typeof configNotification;
|
|
99
59
|
/** 关闭后是否从文档中移除, 命令式 API 创建的通知为 `true` */
|
|
100
60
|
removeOnClose: boolean;
|
|
101
61
|
/** 当前是否显示 */
|
|
@@ -133,7 +93,6 @@ export default class Notification extends BaseComponent<NotificationState> {
|
|
|
133
93
|
static get observedAttributes(): string[];
|
|
134
94
|
protected attributeChanged(name: string, _oldValue: string, newValue: string): void;
|
|
135
95
|
protected updateDOM(changedProps: Set<string>): void;
|
|
136
|
-
connectedCallback(): void;
|
|
137
96
|
disconnectedCallback(): void;
|
|
138
97
|
render_v2(): {
|
|
139
98
|
styleSheets: CSSStyleSheet[];
|
|
@@ -1,67 +1,16 @@
|
|
|
1
1
|
import e from "../base.js";
|
|
2
|
-
import { kebabToCamel as t, parseAttrValue as n,
|
|
3
|
-
import o from "
|
|
4
|
-
import s from "../icon/success.js";
|
|
5
|
-
import c from "../icon/warn.js";
|
|
6
|
-
import l from "../icon/info.js";
|
|
7
|
-
import u from "../icon/close.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "../utils/index.js";
|
|
3
|
+
import { DEFAULT_ZINDEX as i, getGroupSize as a, getOldestNotification as o, layoutGroup as s, normalizePlacement as c, registerNotification as l, unregisterNotification as u } from "./placement.js";
|
|
8
4
|
import d from "./style.js";
|
|
9
|
-
import {
|
|
10
|
-
import { $$ as y, $one as b, off as x, on as S } from "utilane/browser";
|
|
5
|
+
import { $$ as f, $one as p, off as m, on as h } from "utilane/browser";
|
|
11
6
|
//#region src/components/notification/index.ts
|
|
12
|
-
var
|
|
7
|
+
var g = {
|
|
13
8
|
info: "info",
|
|
14
9
|
success: "success",
|
|
15
10
|
error: "close-filled",
|
|
16
11
|
warning: "warn"
|
|
17
|
-
},
|
|
18
|
-
function O() {
|
|
19
|
-
E ||= (r([
|
|
20
|
-
l,
|
|
21
|
-
s,
|
|
22
|
-
c,
|
|
23
|
-
o,
|
|
24
|
-
u
|
|
25
|
-
]), !0);
|
|
26
|
-
}
|
|
27
|
-
function k(e) {
|
|
28
|
-
D = {
|
|
29
|
-
...D,
|
|
30
|
-
...e
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function A(e, t) {
|
|
34
|
-
O(), r(N);
|
|
35
|
-
let n = {
|
|
36
|
-
...D,
|
|
37
|
-
...typeof e == "string" ? { message: e } : e
|
|
38
|
-
};
|
|
39
|
-
t && (n.type = t);
|
|
40
|
-
let i = n.id || a(), o = g(n.placement), s = document.createElement(C);
|
|
41
|
-
return s.id = i, s.removeOnClose = !0, s.setAttribute("open", ""), s.setAttribute("type", n.type || "info"), s.setAttribute("placement", o), n.title != null && s.setAttribute("title", n.title), n.message != null && s.setAttribute("message", n.message), s.setAttribute("duration", `${n.duration ?? w}`), n.closable === !1 && s.setAttribute("closable", "false"), n.showIcon === !1 && s.setAttribute("show-icon", "false"), n.width != null && s.setAttribute("width", `${n.width}`), n.offset != null && s.setAttribute("offset", `${n.offset}`), n.zIndex != null && s.setAttribute("z-index", `${n.zIndex}`), n.maxCount != null && s.setAttribute("max-count", `${n.maxCount}`), n.action && s.setAttribute("action", n.action), n.customClass && s.setAttribute("custom-class", n.customClass), n.onClose && S(s, "close", () => n.onClose?.(i)), n.onAction && S(s, "action", () => n.onAction?.(i)), document.body.appendChild(s), i;
|
|
42
|
-
}
|
|
43
|
-
function j(e) {
|
|
44
|
-
let t = document.getElementById(e);
|
|
45
|
-
t && typeof t.close == "function" && t.close();
|
|
46
|
-
}
|
|
47
|
-
function M(e) {
|
|
48
|
-
let t = e ? [g(e)] : void 0, n = document.querySelectorAll(C);
|
|
49
|
-
for (let e of Array.from(n)) {
|
|
50
|
-
let n = e;
|
|
51
|
-
typeof n.close == "function" && (t && !t.includes(n.placement) || n.close());
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
var N = class extends e {
|
|
12
|
+
}, _ = class extends e {
|
|
55
13
|
static baseName = "notification";
|
|
56
|
-
static show = A;
|
|
57
|
-
static info = (e) => A(e, "info");
|
|
58
|
-
static success = (e) => A(e, "success");
|
|
59
|
-
static error = (e) => A(e, "error");
|
|
60
|
-
static warning = (e) => A(e, "warning");
|
|
61
|
-
static warn = (e) => A(e, "warning");
|
|
62
|
-
static close = j;
|
|
63
|
-
static closeAll = M;
|
|
64
|
-
static config = k;
|
|
65
14
|
removeOnClose = !1;
|
|
66
15
|
_visible = !1;
|
|
67
16
|
_timer;
|
|
@@ -91,7 +40,7 @@ var N = class extends e {
|
|
|
91
40
|
showIcon: !0,
|
|
92
41
|
width: "",
|
|
93
42
|
offset: 16,
|
|
94
|
-
zIndex:
|
|
43
|
+
zIndex: i,
|
|
95
44
|
maxCount: 0,
|
|
96
45
|
action: "",
|
|
97
46
|
customClass: ""
|
|
@@ -131,7 +80,7 @@ var N = class extends e {
|
|
|
131
80
|
"custom-class"
|
|
132
81
|
];
|
|
133
82
|
}
|
|
134
|
-
attributeChanged(e,
|
|
83
|
+
attributeChanged(e, i, a) {
|
|
135
84
|
switch (e) {
|
|
136
85
|
case "type":
|
|
137
86
|
this._state.type = a || "info";
|
|
@@ -149,10 +98,10 @@ var N = class extends e {
|
|
|
149
98
|
this._state.customClass = a || "";
|
|
150
99
|
break;
|
|
151
100
|
case "placement":
|
|
152
|
-
this._state.placement =
|
|
101
|
+
this._state.placement = c(a);
|
|
153
102
|
break;
|
|
154
103
|
case "width":
|
|
155
|
-
this._state.width =
|
|
104
|
+
this._state.width = r(a) || "";
|
|
156
105
|
break;
|
|
157
106
|
case "duration":
|
|
158
107
|
case "offset":
|
|
@@ -168,11 +117,8 @@ var N = class extends e {
|
|
|
168
117
|
updateDOM(e) {
|
|
169
118
|
(e.has("type") || e.has("show-icon")) && this._syncIcon(), (e.has("title") || e.has("message")) && this._syncSections(), e.has("action") && this._syncActions(), e.has("closable") && this._syncClose(), e.has("width") && this._syncWidth(), e.has("custom-class") && this._syncCustomClass(), (e.has("offset") || e.has("z-index")) && this._syncOffset(), e.has("placement") && this._updatePlacement(), e.has("duration") && this._visible && this._startTimer(), e.has("open") && this._toggleOpen();
|
|
170
119
|
}
|
|
171
|
-
connectedCallback() {
|
|
172
|
-
O(), super.connectedCallback();
|
|
173
|
-
}
|
|
174
120
|
disconnectedCallback() {
|
|
175
|
-
super.disconnectedCallback(),
|
|
121
|
+
super.disconnectedCallback(), u(this), this._cancelPendingAnimation(), this._unobserveSize(), this._clearTimer(), this._visible = !1;
|
|
176
122
|
}
|
|
177
123
|
render_v2() {
|
|
178
124
|
return this._changedProperties.clear(), {
|
|
@@ -187,15 +133,15 @@ var N = class extends e {
|
|
|
187
133
|
this._unbindEvents();
|
|
188
134
|
}
|
|
189
135
|
render() {
|
|
190
|
-
let e =
|
|
136
|
+
let e = f("div", {
|
|
191
137
|
class: "l-notification",
|
|
192
138
|
part: "default"
|
|
193
139
|
});
|
|
194
|
-
e.appendChild(
|
|
140
|
+
e.appendChild(f("div", {
|
|
195
141
|
class: "l-notification-icon",
|
|
196
142
|
part: "icon"
|
|
197
143
|
}));
|
|
198
|
-
let t =
|
|
144
|
+
let t = f("div", { class: "l-notification-content" });
|
|
199
145
|
return t.innerHTML = [
|
|
200
146
|
"<div class=\"l-notification-title\" part=\"title\">",
|
|
201
147
|
"<span class=\"l-notification-title-text\"></span>",
|
|
@@ -209,7 +155,7 @@ var N = class extends e {
|
|
|
209
155
|
"<button type=\"button\" class=\"l-notification-action\" part=\"action\"></button>",
|
|
210
156
|
"<slot name=\"action\"></slot>",
|
|
211
157
|
"</div>"
|
|
212
|
-
].join(""), e.appendChild(t), e.appendChild(
|
|
158
|
+
].join(""), e.appendChild(t), e.appendChild(f("button", {
|
|
213
159
|
class: "l-notification-close",
|
|
214
160
|
part: "close",
|
|
215
161
|
type: "button",
|
|
@@ -225,16 +171,16 @@ var N = class extends e {
|
|
|
225
171
|
}
|
|
226
172
|
_initRefs() {
|
|
227
173
|
let e = this.root;
|
|
228
|
-
this.$icon =
|
|
174
|
+
this.$icon = p(".l-notification-icon", e), this.$title = p(".l-notification-title", e), this.$titleText = p(".l-notification-title-text", e), this.$message = p(".l-notification-message", e), this.$messageText = p(".l-notification-message-text", e), this.$actionWrap = p(".l-notification-actions", e), this.$actionBtn = p(".l-notification-action", e), this.$actionSlot = p("slot[name=\"action\"]", e), this.$closeBtn = p(".l-notification-close", e);
|
|
229
175
|
}
|
|
230
176
|
_bindEvents() {
|
|
231
|
-
|
|
232
|
-
|
|
177
|
+
h(this, "mouseenter", this._handleMouseEnter), h(this, "mouseleave", this._handleMouseLeave), this.$closeBtn && h(this.$closeBtn, "click", this._handleCloseClick), this.$actionBtn && h(this.$actionBtn, "click", this._handleActionClick), this.root.querySelectorAll("slot").forEach((e) => {
|
|
178
|
+
h(e, "slotchange", this._handleSlotChange);
|
|
233
179
|
});
|
|
234
180
|
}
|
|
235
181
|
_unbindEvents() {
|
|
236
|
-
|
|
237
|
-
|
|
182
|
+
m(this, "mouseenter", this._handleMouseEnter), m(this, "mouseleave", this._handleMouseLeave), this.$closeBtn && m(this.$closeBtn, "click", this._handleCloseClick), this.$actionBtn && m(this.$actionBtn, "click", this._handleActionClick), this.root.querySelectorAll("slot").forEach((e) => {
|
|
183
|
+
m(e, "slotchange", this._handleSlotChange);
|
|
238
184
|
});
|
|
239
185
|
}
|
|
240
186
|
_syncAll() {
|
|
@@ -243,7 +189,7 @@ var N = class extends e {
|
|
|
243
189
|
_syncIcon() {
|
|
244
190
|
let e = this.$icon;
|
|
245
191
|
if (!e) return;
|
|
246
|
-
let t =
|
|
192
|
+
let t = g[this._state.type] || g.info;
|
|
247
193
|
e.dataset.icon !== t && (e.dataset.icon = t, e.innerHTML = `<l-${t}-icon></l-${t}-icon>`), e.toggleAttribute("hidden", !this._state.showIcon);
|
|
248
194
|
}
|
|
249
195
|
_syncSections() {
|
|
@@ -270,7 +216,7 @@ var N = class extends e {
|
|
|
270
216
|
this._state.width ? this.style.setProperty("--l-notification-width", this._state.width) : this.style.removeProperty("--l-notification-width");
|
|
271
217
|
}
|
|
272
218
|
_syncOffset() {
|
|
273
|
-
this.style.setProperty("--l-notification-offset", `${this._state.offset}px`), this.style.setProperty("--l-notification-zindex", `${this._state.zIndex}`), this._visible &&
|
|
219
|
+
this.style.setProperty("--l-notification-offset", `${this._state.offset}px`), this.style.setProperty("--l-notification-zindex", `${this._state.zIndex}`), this._visible && s(this._state.placement);
|
|
274
220
|
}
|
|
275
221
|
_syncCustomClass() {
|
|
276
222
|
for (let e of this._appliedClasses) this.classList.remove(e);
|
|
@@ -281,16 +227,16 @@ var N = class extends e {
|
|
|
281
227
|
return e ? e.assignedNodes().some((e) => e.nodeType !== 3 || (e.textContent || "").trim() !== "") : !1;
|
|
282
228
|
}
|
|
283
229
|
_updatePlacement() {
|
|
284
|
-
this._visible &&
|
|
230
|
+
this._visible && l(this, this._state.placement);
|
|
285
231
|
}
|
|
286
232
|
_toggleOpen() {
|
|
287
233
|
this.rendered && (this._state.open ? this._show() : this._hide());
|
|
288
234
|
}
|
|
289
235
|
_show() {
|
|
290
|
-
this._visible || (this._visible = !0, this.removeAttribute("hidden"),
|
|
236
|
+
this._visible || (this._visible = !0, this.removeAttribute("hidden"), l(this, this._state.placement), this._observeSize(), this._enter(), this._startTimer(), this._enforceMaxCount());
|
|
291
237
|
}
|
|
292
238
|
_hide() {
|
|
293
|
-
this._visible && (this._visible = !1, this._clearTimer(), this._unobserveSize(),
|
|
239
|
+
this._visible && (this._visible = !1, this._clearTimer(), this._unobserveSize(), u(this), this.emit("close", { detail: { id: this.id } }), this._leave(() => {
|
|
294
240
|
this.removeOnClose ? this.remove() : this.setAttribute("hidden", "");
|
|
295
241
|
}));
|
|
296
242
|
}
|
|
@@ -298,8 +244,8 @@ var N = class extends e {
|
|
|
298
244
|
let e = this._state.maxCount;
|
|
299
245
|
if (e <= 0) return;
|
|
300
246
|
let t = this._state.placement;
|
|
301
|
-
for (;
|
|
302
|
-
let e =
|
|
247
|
+
for (; a(t) > e;) {
|
|
248
|
+
let e = o(t);
|
|
303
249
|
if (!e || e === this) break;
|
|
304
250
|
e.close();
|
|
305
251
|
}
|
|
@@ -336,7 +282,7 @@ var N = class extends e {
|
|
|
336
282
|
}
|
|
337
283
|
_observeSize() {
|
|
338
284
|
this._resizeObserver || typeof ResizeObserver > "u" || (this._resizeObserver = new ResizeObserver(() => {
|
|
339
|
-
this._visible &&
|
|
285
|
+
this._visible && s(this._state.placement);
|
|
340
286
|
}), this._resizeObserver.observe(this));
|
|
341
287
|
}
|
|
342
288
|
_unobserveSize() {
|
|
@@ -377,4 +323,4 @@ var N = class extends e {
|
|
|
377
323
|
};
|
|
378
324
|
};
|
|
379
325
|
//#endregion
|
|
380
|
-
export {
|
|
326
|
+
export { _ as default };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { NotificationOptions, NotificationType, NotificationPlacement } from "./index";
|
|
2
|
+
export type { NotificationOptions, NotificationType, NotificationPlacement } from "./index";
|
|
3
|
+
/**
|
|
4
|
+
* 设置全局默认配置, 之后创建的通知都会使用该配置
|
|
5
|
+
* @param option 配置项
|
|
6
|
+
*/
|
|
7
|
+
declare function configNotification(option: NotificationOptions): void;
|
|
8
|
+
/**
|
|
9
|
+
* 创建一条通知
|
|
10
|
+
* @param option 通知内容或配置项
|
|
11
|
+
* @param type 状态类型, 会覆盖配置项中的 `type`
|
|
12
|
+
* @returns 通知 id, 可以配合 `NotificationBox.close` 手动关闭
|
|
13
|
+
*/
|
|
14
|
+
declare function showNotification(option: string | NotificationOptions, type?: NotificationType): string;
|
|
15
|
+
/**
|
|
16
|
+
* 关闭指定 id 的通知
|
|
17
|
+
* @param id 通知 id
|
|
18
|
+
*/
|
|
19
|
+
declare function closeNotification(id: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* 关闭所有通知
|
|
22
|
+
* @param placement 只关闭指定方位的通知, 不传递则关闭所有方位
|
|
23
|
+
*/
|
|
24
|
+
declare function closeAllNotification(placement?: NotificationPlacement): void;
|
|
25
|
+
declare function info(option: string | NotificationOptions): string;
|
|
26
|
+
declare function success(option: string | NotificationOptions): string;
|
|
27
|
+
declare function error(option: string | NotificationOptions): string;
|
|
28
|
+
declare function warning(option: string | NotificationOptions): string;
|
|
29
|
+
declare const _default: {
|
|
30
|
+
show: typeof showNotification;
|
|
31
|
+
info: typeof info;
|
|
32
|
+
success: typeof success;
|
|
33
|
+
error: typeof error;
|
|
34
|
+
warning: typeof warning;
|
|
35
|
+
warn: typeof warning;
|
|
36
|
+
close: typeof closeNotification;
|
|
37
|
+
closeAll: typeof closeAllNotification;
|
|
38
|
+
config: typeof configNotification;
|
|
39
|
+
};
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useId as e } from "../utils/index.js";
|
|
2
|
+
import { normalizePlacement as t } from "./placement.js";
|
|
3
|
+
import { on as n } from "utilane/browser";
|
|
4
|
+
//#region src/components/notification/notification_box.ts
|
|
5
|
+
var r = "l-notification", i = 4500, a = {};
|
|
6
|
+
function o(e) {
|
|
7
|
+
a = {
|
|
8
|
+
...a,
|
|
9
|
+
...e
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function s(o, s) {
|
|
13
|
+
if (!customElements.get(r)) throw Error("Register Notification before calling NotificationBox methods.");
|
|
14
|
+
let c = {
|
|
15
|
+
...a,
|
|
16
|
+
...typeof o == "string" ? { message: o } : o
|
|
17
|
+
};
|
|
18
|
+
s && (c.type = s);
|
|
19
|
+
let l = c.id || e(), u = t(c.placement), d = document.createElement(r);
|
|
20
|
+
return d.id = l, d.removeOnClose = !0, d.setAttribute("open", ""), d.setAttribute("type", c.type || "info"), d.setAttribute("placement", u), c.title != null && d.setAttribute("title", c.title), c.message != null && d.setAttribute("message", c.message), d.setAttribute("duration", `${c.duration ?? i}`), c.closable === !1 && d.setAttribute("closable", "false"), c.showIcon === !1 && d.setAttribute("show-icon", "false"), c.width != null && d.setAttribute("width", `${c.width}`), c.offset != null && d.setAttribute("offset", `${c.offset}`), c.zIndex != null && d.setAttribute("z-index", `${c.zIndex}`), c.maxCount != null && d.setAttribute("max-count", `${c.maxCount}`), c.action && d.setAttribute("action", c.action), c.customClass && d.setAttribute("custom-class", c.customClass), c.onClose && n(d, "close", () => c.onClose?.(l)), c.onAction && n(d, "action", () => c.onAction?.(l)), document.body.appendChild(d), l;
|
|
21
|
+
}
|
|
22
|
+
function c(e) {
|
|
23
|
+
let t = document.getElementById(e);
|
|
24
|
+
t && typeof t.close == "function" && t.close();
|
|
25
|
+
}
|
|
26
|
+
function l(e) {
|
|
27
|
+
let n = e ? [t(e)] : void 0, i = document.querySelectorAll(r);
|
|
28
|
+
for (let e of Array.from(i)) {
|
|
29
|
+
let t = e;
|
|
30
|
+
typeof t.close == "function" && (n && !n.includes(t.placement) || t.close());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function u(e) {
|
|
34
|
+
return s(e, "info");
|
|
35
|
+
}
|
|
36
|
+
function d(e) {
|
|
37
|
+
return s(e, "success");
|
|
38
|
+
}
|
|
39
|
+
function f(e) {
|
|
40
|
+
return s(e, "error");
|
|
41
|
+
}
|
|
42
|
+
function p(e) {
|
|
43
|
+
return s(e, "warning");
|
|
44
|
+
}
|
|
45
|
+
var m = {
|
|
46
|
+
show: s,
|
|
47
|
+
info: u,
|
|
48
|
+
success: d,
|
|
49
|
+
error: f,
|
|
50
|
+
warning: p,
|
|
51
|
+
warn: p,
|
|
52
|
+
close: c,
|
|
53
|
+
closeAll: l,
|
|
54
|
+
config: o
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { m as default };
|
|
@@ -35,12 +35,12 @@ export declare function normalizePlacement(placement?: string | null): Notificat
|
|
|
35
35
|
export declare function findPlacement($el: HTMLElement): NotificationPlacement | undefined;
|
|
36
36
|
/** 某个方位上正在显示的通知数量 */
|
|
37
37
|
export declare function getGroupSize(placement: NotificationPlacement): number;
|
|
38
|
-
/** 某个方位上最早创建的通知
|
|
38
|
+
/** 某个方位上最早创建的通知 */
|
|
39
39
|
export declare function getOldestNotification(placement: NotificationPlacement): NotificationLayoutItem | undefined;
|
|
40
40
|
/**
|
|
41
41
|
* 注册到方位分组并重新排布
|
|
42
42
|
*
|
|
43
|
-
*
|
|
43
|
+
* 最新创建的通知显示在最下方。顶部方位向下追加,底部方位将已有通知向上移动。
|
|
44
44
|
*/
|
|
45
45
|
export declare function registerNotification($el: NotificationLayoutItem, placement: NotificationPlacement): void;
|
|
46
46
|
/** 从方位分组中移除并重新排布 */
|
|
@@ -22,12 +22,12 @@ function u(e) {
|
|
|
22
22
|
}
|
|
23
23
|
function d(e) {
|
|
24
24
|
let t = a.get(e);
|
|
25
|
-
return t && t.length > 0 ? t[
|
|
25
|
+
return t && t.length > 0 ? t[0] : void 0;
|
|
26
26
|
}
|
|
27
27
|
function f(e, t) {
|
|
28
28
|
p(e);
|
|
29
29
|
let n = a.get(t);
|
|
30
|
-
n || (n = [], a.set(t, n)), n.
|
|
30
|
+
n || (n = [], a.set(t, n)), n.push(e), m(t);
|
|
31
31
|
}
|
|
32
32
|
function p(e) {
|
|
33
33
|
for (let [t, n] of a) {
|
|
@@ -42,7 +42,7 @@ function m(e) {
|
|
|
42
42
|
let t = a.get(e);
|
|
43
43
|
if (!t) return;
|
|
44
44
|
let n = o(e), r = n ? "top" : "bottom", i = n ? "bottom" : "top", s = 0;
|
|
45
|
-
for (let e of t) e.style.setProperty(r, `${e.notificationOffset + s}px`), e.style.removeProperty(i), s += e.offsetHeight + e.notificationGap;
|
|
45
|
+
for (let e of n ? t : [...t].reverse()) e.style.setProperty(r, `${e.notificationOffset + s}px`), e.style.removeProperty(i), s += e.offsetHeight + e.notificationGap;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
48
|
export { i as DEFAULT_GAP, n as DEFAULT_OFFSET, t as DEFAULT_PLACEMENT, r as DEFAULT_ZINDEX, e as PLACEMENTS, l as findPlacement, u as getGroupSize, d as getOldestNotification, s as isLeftPlacement, o as isTopPlacement, m as layoutGroup, c as normalizePlacement, f as registerNotification, p as unregisterNotification };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.less_inline.js";
|
|
2
2
|
//#region src/components/notification/style.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.css_inline.js";
|
|
2
2
|
//#region src/components/styles/animation/index.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
package/lib/styles/mask/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.css_inline.js";
|
|
2
2
|
//#region src/components/styles/mask/index.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
package/lib/upload/style.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import e from "./index.less_inline.js";
|
|
2
2
|
//#region src/components/upload/style.ts
|
|
3
|
-
var t =
|
|
4
|
-
t
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
5
7
|
//#endregion
|
|
6
8
|
export { t as default };
|
package/package.json
CHANGED
package/styles/dark.css
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* 暗黑模式 */
|
|
2
|
+
:root.dark {
|
|
3
|
+
--l-disabled-color: #6c6c6c;
|
|
4
|
+
/* 表格配置 */
|
|
5
|
+
--l-table-border-color: #444444;
|
|
6
|
+
--l-table-th-bg: #2d2d2d;
|
|
7
|
+
--l-table-th-color: #e0e0e0;
|
|
8
|
+
--l-table-td-bg: #1e1e1e;
|
|
9
|
+
--l-table-td-color: #e0e0e0;
|
|
10
|
+
--l-table-row-hover-bg: #333333;
|
|
11
|
+
--l-table-empty-color: #888888;
|
|
12
|
+
--l-table-stripe-bg: #252525;
|
|
13
|
+
--l-table-sort-inactive-color: #777777;
|
|
14
|
+
/* Card:仅覆盖暗黑模式中需要变化的值,默认值由组件消费处提供。 */
|
|
15
|
+
--l-card-bg: #232324;
|
|
16
|
+
--l-card-text-color: rgba(255, 255, 255, 0.7);
|
|
17
|
+
--l-card-border-color: rgb(72, 72, 73);
|
|
18
|
+
/* Upload:仅覆盖暗黑模式中需要变化的值,默认值由组件消费处提供。 */
|
|
19
|
+
--l-upload-border-color: rgba(255, 255, 255, 0.2);
|
|
20
|
+
--l-upload-border-hover-color: var(--l-primary-color-light1, #3399ff);
|
|
21
|
+
--l-upload-background: #1e1e1e;
|
|
22
|
+
--l-upload-text-color: rgba(255, 255, 255, 0.88);
|
|
23
|
+
--l-upload-text-secondary-color: rgba(255, 255, 255, 0.45);
|
|
24
|
+
--l-upload-disabled-color: rgba(255, 255, 255, 0.3);
|
|
25
|
+
--l-upload-disabled-background: rgba(255, 255, 255, 0.04);
|
|
26
|
+
--l-upload-disabled-border-color: rgba(255, 255, 255, 0.15);
|
|
27
|
+
--l-upload-list-hover-background: rgba(255, 255, 255, 0.04);
|
|
28
|
+
--l-upload-dragover-background: color-mix(
|
|
29
|
+
in srgb,
|
|
30
|
+
var(--l-primary-color, #007bff) 15%,
|
|
31
|
+
transparent
|
|
32
|
+
);
|
|
33
|
+
}
|
package/styles/vars.css
CHANGED
|
@@ -32,38 +32,4 @@
|
|
|
32
32
|
/* 边框颜色 */
|
|
33
33
|
--l-border-color: #dedede;
|
|
34
34
|
--l-border-radius: 5px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* 暗黑模式 */
|
|
38
|
-
:root.dark {
|
|
39
|
-
--l-disabled-color: #6c6c6c;
|
|
40
|
-
/* 表格配置 */
|
|
41
|
-
--l-table-border-color: #444444;
|
|
42
|
-
--l-table-th-bg: #2d2d2d;
|
|
43
|
-
--l-table-th-color: #e0e0e0;
|
|
44
|
-
--l-table-td-bg: #1e1e1e;
|
|
45
|
-
--l-table-td-color: #e0e0e0;
|
|
46
|
-
--l-table-row-hover-bg: #333333;
|
|
47
|
-
--l-table-empty-color: #888888;
|
|
48
|
-
--l-table-stripe-bg: #252525;
|
|
49
|
-
--l-table-sort-inactive-color: #777777;
|
|
50
|
-
/* Card:仅覆盖暗黑模式中需要变化的值,默认值由组件消费处提供。 */
|
|
51
|
-
--l-card-bg: #232324;
|
|
52
|
-
--l-card-text-color: rgba(255, 255, 255, 0.7);
|
|
53
|
-
--l-card-border-color: rgb(72, 72, 73);
|
|
54
|
-
/* Upload:仅覆盖暗黑模式中需要变化的值,默认值由组件消费处提供。 */
|
|
55
|
-
--l-upload-border-color: rgba(255, 255, 255, 0.2);
|
|
56
|
-
--l-upload-border-hover-color: var(--l-primary-color-light1, #3399ff);
|
|
57
|
-
--l-upload-background: #1e1e1e;
|
|
58
|
-
--l-upload-text-color: rgba(255, 255, 255, 0.88);
|
|
59
|
-
--l-upload-text-secondary-color: rgba(255, 255, 255, 0.45);
|
|
60
|
-
--l-upload-disabled-color: rgba(255, 255, 255, 0.3);
|
|
61
|
-
--l-upload-disabled-background: rgba(255, 255, 255, 0.04);
|
|
62
|
-
--l-upload-disabled-border-color: rgba(255, 255, 255, 0.15);
|
|
63
|
-
--l-upload-list-hover-background: rgba(255, 255, 255, 0.04);
|
|
64
|
-
--l-upload-dragover-background: color-mix(
|
|
65
|
-
in srgb,
|
|
66
|
-
var(--l-primary-color, #007bff) 15%,
|
|
67
|
-
transparent
|
|
68
|
-
);
|
|
69
35
|
}
|